/* Radar Solaire, pages of the study, of the prospects and « votre toit » (brief 82, part E).
   Only the tokens of the design system (style.css :root); nothing here changes another page. */

/* 1. The study: one bar of actions at the top (brief 80, A.1.2, rule 55). ---------------------------- */
.study-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); margin: -36px -40px var(--space-5); padding: var(--space-3) 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
.study-bar-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 18rem; }
.study-bar-title a.back { margin: 0; min-height: 0; font-size: 13px; font-weight: 400; }
.study-bar-title h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 0; }
.study-bar-sub { margin: 0; font-size: 13px; color: var(--muted); }
.study-bar-actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.study-bar-actions form { margin: 0; }
.study-bar-actions button, .study-bar-actions .button { margin: 0; min-height: var(--control); }
.study-more { position: relative; }
.study-menu { position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 40; width: 330px; max-width: calc(100vw - 2 * var(--space-4)); display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-hover); }
.study-menu[hidden], .study-sheet[hidden], .study-sheet-back[hidden] { display: none; }
.study-menu form, .study-sheet form { margin: 0; }
.study-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: var(--control); margin: 0; padding: 10px 12px; border: 0; border-radius: var(--radius-small); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; }
.study-item:hover, .study-item:focus-visible { background: var(--bg); color: var(--text); }
.study-item strong { font-weight: 600; }
.study-item span { font-size: 13px; color: var(--muted); font-weight: 400; }
.study-item-bad, .study-item-bad:hover { color: var(--bad); }
.study-item-off { cursor: default; color: var(--muted); }
.study-menu-line { width: 100%; height: 1px; margin: var(--space-1) 0; border: 0; background: var(--line); }

/* The question about panels already on the roof, in one card (E.4 to E.6). */
.equipped-toggle { padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.equipped-question { flex: 1 1 300px; }
.equipped-question .photo-date { margin: 0; font-size: 13px; }

/* Four tiles, then the card of the image. */
.study-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.study-tiles .tile-value { font-size: 22px; }
.tile-point { margin-top: var(--space-1); font-weight: 700; color: var(--warn); }
.study-figure-card { padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.study-figure-card > .obstacle-editor { grid-column: 1 / -1; margin: 0; padding: 0 0 var(--space-3); border-top: 0; border-bottom: 1px solid var(--line); }

/* On a phone: the bar at the bottom, « Faire le devis » and « ⋯ »; the panel that comes up from the bottom. */
.study-dock { display: none; }
@media (max-width: 899px) {
  .study-bar { position: static; }
  .study-bar-actions { display: none; }
  .study-dock { display: flex; flex-wrap: nowrap; gap: var(--space-2); justify-content: stretch; }
  .study-dock .hero-quote { flex: 1 1 auto; }
  .study-dock .hero-quote button { width: 100%; }
  .study-dock-more { flex: 0 0 auto; min-width: 52px; min-height: var(--control); margin: 0; font-size: 18px; }
  .study-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-tiles .tile:first-child, .study-tiles .tile-check { grid-column: 1 / -1; }
  .study-tiles .tile-value { font-size: 20px; }
}
@media (max-width: 700px) {
  .study-bar { margin: -22px -16px var(--space-4); padding: var(--space-3) var(--space-4); }
}
.study-sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, 0.45); }
.study-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; display: flex; flex-direction: column; gap: var(--space-1); max-height: 85vh; overflow-y: auto; padding: 10px var(--space-4) calc(20px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 20px 20px 0 0; }
.study-sheet-grip { align-self: center; width: 40px; height: 4px; margin-bottom: var(--space-2); border-radius: var(--radius-pill); background: var(--line-strong); }
.study-sheet .study-item { min-height: 52px; justify-content: center; font-size: 16px; font-weight: 600; }
.study-sheet .prospect-entry button.study-item { font-weight: 600; }
.study-sheet-end { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.study-sheet-close { flex: 0 0 52px; min-height: 52px; margin: 0; font-size: 18px; }
.study-sheet-end .hero-quote { flex: 1 1 auto; }
.study-sheet-end .hero-quote button { width: 100%; min-height: 52px; margin: 0; }
body.study-sheet-open .study-dock { visibility: hidden; }
/* A line of a menu is not a button that leads further: no arrow (style.css adds one to the main buttons). */
.study-item::after { content: none !important; }

/* 2. The block « Batterie » (brief 81, A.1). ------------------------------------------------------------- */
.battery-use { margin: 0 0 var(--space-3); }
.battery-form { display: flex; flex-direction: column; gap: var(--space-1); margin: 0 0 var(--space-4); max-width: 26rem; }
.battery-form label { font-weight: 600; }
.battery-field { display: flex; align-items: center; gap: var(--space-3); }
.battery-field input { flex: 1 1 auto; min-width: 0; min-height: var(--control); }
.battery-saved { flex: none; font-size: 14px; color: var(--ok); }
.battery-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-3); }
@media (max-width: 700px) { .battery-tiles { grid-template-columns: minmax(0, 1fr); } }

/* 3. Prospects: « Colonnes, Liste, Carte » (brief 81, A.2) and the tabs « Matériel », « Dossier » (A.3). -------- */
.stage-to_contact { --stage: var(--accent); }
.stage-letter_sent { --stage: var(--info); }
.stage-answered, .stage-meeting, .stage-quote_sent { --stage: var(--warn); }
.stage-signed, .stage-installed { --stage: var(--ok); }
.stage-lost { --stage: var(--muted); }
.view-switch { display: inline-flex; gap: var(--space-1); margin: 0 0 var(--space-4); padding: var(--space-1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small); box-shadow: var(--shadow); }
.view-switch a { display: inline-flex; align-items: center; min-height: var(--control); padding: 0 var(--space-4); border-radius: var(--radius-small); color: var(--nav); font-weight: 600; font-size: 15px; text-decoration: none; }
.view-switch a:hover { background: var(--box); color: var(--text); }
.view-switch a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.prospect-list-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.prospect-list { width: 100%; min-width: 34rem; border-collapse: collapse; }
.prospect-list th, .prospect-list td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.prospect-list tbody tr:last-child td { border-bottom: 0; }
.prospect-list th { font-size: 13px; color: var(--muted); font-weight: 600; }
.prospect-list th button { min-height: var(--control); margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.prospect-list th button::after { content: none; }
.prospect-list th[aria-sort="ascending"] button::after { content: " ↑"; }
.prospect-list th[aria-sort="descending"] button::after { content: " ↓"; }
.prospect-list td small { display: block; color: var(--muted); font-size: 13px; }
.prospect-list .num { text-align: right; white-space: nowrap; }
.stage-pill { display: inline-flex; align-items: center; gap: var(--space-2); white-space: nowrap; font-size: 14px; }
.stage-pill::before, .stage-dot { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-pill); background: var(--stage); flex: none; }
.prospect-map { height: 520px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 700px) { .prospect-map { height: 420px; } }
.prospect-map-key { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0 0; font-size: 14px; color: var(--muted); }
.prospect-map-key li { display: inline-flex; align-items: center; gap: var(--space-2); }
.prospect-dot { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; text-decoration: none; }
.prospect-dot span { display: block; width: 18px; height: 18px; border-radius: var(--radius-pill); background: var(--stage); border: 2px solid var(--surface); box-shadow: var(--shadow-hover); }
.prospect-dot.prospect-group span { width: auto; height: auto; padding: var(--space-1) var(--space-3); background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font-weight: 700; font-size: 14px; white-space: nowrap; }
.material-table { width: 100%; border-collapse: collapse; margin: 0 0 var(--space-3); }
.material-table th, .material-table td { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.material-table th { font-size: 13px; color: var(--muted); }
.material-table td small { display: block; color: var(--muted); font-size: 13px; }
.material-table .num { text-align: right; padding-left: var(--space-3); white-space: nowrap; font-weight: 700; }
.material-rows { margin: 0 0 var(--space-3); }
.permit-pieces li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.permit-pieces strong { display: block; }

/* 4. The page « votre toit » of the owner (brief 81, A.6, maquette Proprietaire). ---------------------------- */
body.owner-page { margin: 0; padding: 0; max-width: none; background: var(--bg); }
.owner-head { display: flex; align-items: center; gap: var(--space-3); padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 15px; }
.owner-logo { max-height: 32px; width: auto; }
.owner-photo { position: relative; margin: 0 auto; max-width: 720px; }
.owner-photo img { display: block; width: 100%; height: auto; }
.owner-badge { position: absolute; left: var(--space-4); bottom: var(--space-4); padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.owner-main { max-width: 720px; margin: 0 auto; padding: 20px 18px 32px; display: flex; flex-direction: column; gap: 18px; }
.owner-title h1 { margin: 4px 0 0; font-size: 28px; line-height: 1.2; }
.owner-address { margin: 0; font-size: 13px; color: var(--muted); }
.owner-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.owner-tiles .tile-value { font-size: 22px; }
.owner-card { margin: 0; }
.owner-card h2 { margin: 0 0 var(--space-2); font-size: 17px; font-weight: 800; }
.owner-card p { margin: 0; }
.owner-bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.owner-bar { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.owner-bar span { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--accent); }
.owner-bar small { font-size: 11px; color: var(--muted); }
.owner-figures { margin-top: var(--space-3); }
.owner-figures summary { font-size: 14px; font-weight: 600; color: var(--accent); cursor: pointer; min-height: var(--control); display: flex; align-items: center; }
.owner-figures table { width: 100%; border-collapse: collapse; font-size: 14px; }
.owner-figures th, .owner-figures td { padding: var(--space-1) 0; border-bottom: 1px solid var(--line); text-align: right; }
.owner-figures th:first-child, .owner-figures td:first-child { text-align: left; }
.owner-page .owner-answer { margin: 0; border: 2px solid var(--accent); }
.owner-foot { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.owner-foot strong { color: var(--text); }
body.owner-page figure.owner-photo { margin: 0 auto; padding: 0; border: 0; background: none; box-shadow: none; }
body.owner-page figure.owner-photo img { border-radius: 0; border: 0; box-shadow: none; }
/* On a phone the list becomes cards (rule 1, tables of more than 3 columns, auto-cards of the core). */
@media (max-width: 700px) { .prospect-list { min-width: 0; } .prospect-list-wrap { overflow-x: visible; background: none; border: 0; box-shadow: none; } }

/* 5. Brief 85: « Plan », « Photo », « 3D » above the image; « Modifier les pans » and « Modifier la pose »;
   the table of a flat roof. Only tokens of style.css. -------------------------------------------------------- */
.study-figure-card > .study-views { grid-column: 1 / -1; justify-self: start; margin: 0; }
.view-switch button { display: inline-flex; align-items: center; min-height: var(--control); margin: 0; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-small); background: none; box-shadow: none; color: var(--nav); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.view-switch button::after { content: none; }
.view-switch button:hover { background: var(--box); color: var(--text); }
.view-switch button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.figure-edit-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.figure-edit-buttons .button { margin: 0; }
.figure-edit-buttons .button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.study-figure-card > .hand-editor { grid-column: 1 / -1; display: flex; flex-direction: column; gap: var(--space-2); padding: 0 0 var(--space-3); border-bottom: 1px solid var(--line); }
.study-figure-card > .hand-editor[hidden] { display: none; }
.hand-editor p { margin: 0; }
.hand-tools { display: flex; flex-direction: column; gap: var(--space-2); }
.hand-row, .hand-actions, .hand-shapes, .hand-way { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.hand-editor button { margin: 0; min-height: var(--control); }
.hand-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: var(--space-2) var(--space-3); }
.hand-fields label { display: flex; flex-direction: column; gap: var(--space-1); font-size: 14px; font-weight: 600; }
.hand-fields input { min-height: var(--control); width: 100%; min-width: 0; }
.hand-compass-field { display: flex; align-items: center; gap: var(--space-2); }
.hand-compass-field output { flex: none; min-width: 2.5rem; font-weight: 700; color: var(--accent); }
.hand-face { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-row); background: var(--bg); }
.hand-face-title { font-weight: 700; }
.hand-delete { color: var(--bad); align-self: flex-start; }
.hand-block { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-row); background: var(--bg); }
.hand-way label { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control); font-weight: 600; }
.hand-counter { font-size: 15px; font-weight: 700; }
.hand-status { font-weight: 600; color: var(--info); }
.hand-status:empty { display: none; }
.hand-layer .hand-face polygon { fill: var(--surface); fill-opacity: 0.12; stroke: var(--surface); stroke-width: 2px; cursor: pointer; }
.hand-layer .hand-face.chosen polygon { fill: var(--accent); fill-opacity: 0.18; stroke: var(--accent); stroke-width: 3px; }
.hand-layer .hand-obstacle { fill: none; stroke: var(--bad); stroke-width: 1.5px; stroke-dasharray: 4 3; pointer-events: none; }
.hand-layer .hand-panel { fill: var(--info); fill-opacity: 0.85; stroke: var(--surface); stroke-width: 1px; cursor: pointer; }
.hand-layer .hand-panel.refused { fill: var(--bad); fill-opacity: 0.85; }
.hand-layer .hand-box { fill: none; stroke: var(--accent); stroke-width: 1.5px; stroke-dasharray: 5 4; pointer-events: none; }
.hand-layer .hand-handle { fill: var(--surface); stroke: var(--accent); stroke-width: 3px; vector-effect: non-scaling-stroke; cursor: grab; }
.hand-layer .hand-turn { fill: var(--accent); }
.hand-layer .hand-trace { fill: none; stroke: var(--accent); stroke-width: 2px; }
.hand-layer .hand-corner { fill: var(--accent); }
.hand-layer text { fill: var(--text); stroke: var(--surface); stroke-width: 0.25; font-weight: 700; }
.hand-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.hand-banner p { margin: 0; font-weight: 600; }
.hand-banner form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.hand-banner button { margin: 0; min-height: var(--control); }
.study-pane img { display: block; width: 100%; height: auto; }
.flat-compare tr.flat-chosen td { background: var(--accent-soft); }
.flat-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.flat-choice { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-row); }
.flat-choice-name { margin: 0; font-weight: 700; }
.flat-choice label { font-size: 14px; font-weight: 600; }
.flat-choice input { min-height: var(--control); max-width: 8rem; }
.flat-choice button { margin: var(--space-2) 0 0; min-height: var(--control); align-self: flex-start; }
.flat-choices .hand-status { grid-column: 1 / -1; }
