/* Screens added in the second pass: shell layers, Map, Issues, Analytics, Reports.
 * Tokens and the shared component language live in app.css. */

/* ===================================================================== shell
 * Layers that must sit OUTSIDE the smoother's transform. */
/* 🔴 The canvas paints UNDER the scroll column and shows through a transparent
   hole in the stage panel. At a z-index above the column it covered the pins,
   the rail and the hero — and the pins were positioned correctly the whole time,
   which is exactly what makes this one hard to see. */
#gl {
  position: fixed; left: 0; top: 0; z-index: 1;
  transform-origin: 0 0; pointer-events: auto;
  border-radius: var(--r-lg);
}
#gl[hidden] { display: none; }

.mast .mastxt { min-width: 0; }
.langtog { margin-inline-start: 12px; font-weight: 700; }

.panel.empty { padding: 64px var(--sp-6); text-align: center; }
.panel.empty h2 { margin: 0 0 6px; font-size: var(--t-h2); }
.panel.empty p { margin: 0; color: var(--slate); }

.panel > header .note {
  font-size: var(--t-label); color: var(--stone-text); max-width: 46ch;
  text-align: end; line-height: 1.4;
}
.kpis.kpis-4 { grid-template-columns: repeat(4, 1fr); }

.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--canvas); font-size: 13px; font-weight: 600;
}
.pill svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.9;
  fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pill.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--hairline); }
.field input[type="date"] {
  min-height: 38px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline); background: var(--card); font-size: 13px;
  font-family: inherit;
}

/* ===================================================================== map */
.mapcols {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--sp-4); align-items: start;
}
/* transparent so the canvas underneath is visible; the border still reads as a panel */
.stagewrap { padding: 0; overflow: hidden; background: transparent; }
.stage {
  position: relative; height: min(62vh, 620px); min-height: 380px;
  border-radius: var(--r-lg); overflow: hidden;
  background: transparent;
  /* 🔴 A transparent region layered over the canvas still takes every pointer
     hit, so orbit, zoom and click would be silently dead with no error. Only
     the chrome takes events; everything else falls through to the canvas. */
  pointer-events: none;
}
.stage.noscene-on { background: var(--hairline-soft); }
.stage .pins, .stage .stagechrome { pointer-events: none; }
.stage .pin, .stage .namechip, .stage .noscene { pointer-events: auto; }

.stagechrome {
  position: absolute; inset: 0; padding: var(--sp-4);
  display: flex; align-items: flex-start; gap: var(--sp-3); z-index: 3;
}
.namechip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: oklch(1 0 0 / .92); border: 1px solid var(--hairline);
  font-size: 13px; font-weight: 600;
}
.stage .loading {
  margin-inline-start: auto; padding: 7px 13px; border-radius: var(--r-pill);
  background: oklch(1 0 0 / .92); border: 1px solid var(--hairline);
  font-size: var(--t-label); font-weight: 600; color: var(--slate);
}

.pins { position: absolute; inset: 0; z-index: 2; }
.pin {
  position: absolute; left: 0; top: 0; z-index: var(--z, 1);
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -50%); padding: 0; will-change: transform;
}
.pin > * { pointer-events: none; }
.pin .shot {
  position: relative; width: 62px; height: 46px; border-radius: 9px;
  overflow: hidden; border: 2px solid var(--canvas); background: var(--hairline);
  box-shadow: 0 2px 10px oklch(0.227 0.004 286 / .28);
}
.pin .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin.locked .shot img { filter: grayscale(1) brightness(.8); }
.pin .hazard {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg,
    oklch(0.487 0.180 25 / .6) 0 5px, oklch(0.227 0.004 286 / .6) 5px 10px);
}
.pin .lk {
  position: absolute; inset-block-start: 3px; inset-inline-end: 3px;
  width: 15px; height: 15px; border-radius: 4px; background: var(--late);
  display: grid; place-items: center;
}
.pin .lk svg { width: 9px; height: 9px; stroke: var(--canvas); stroke-width: 2.4;
  fill: none; stroke-linecap: round; }
.pin .lbl {
  margin-top: 5px; padding: 3px 8px; border-radius: var(--r-pill);
  background: oklch(1 0 0 / .94); border: 1px solid var(--hairline);
  display: flex; flex-direction: column; align-items: center; line-height: 1.25;
  white-space: nowrap;
}
.pin .lbl .nm { font-size: 11px; font-weight: 700; }
.pin .lbl .dt { font-size: 11px; color: var(--slate); }
.pin .leader { width: 1px; height: 14px; background: var(--ink); opacity: .5; }
.pin:not(.locked) { cursor: pointer; }
.pin:not(.locked):hover .shot { border-color: var(--brand-yellow); }

.noscene {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-content: center; justify-items: center; gap: var(--sp-4);
  padding: var(--sp-6); background: var(--surface); text-align: center;
}
.noscene .ph { width: min(380px, 70%); border-radius: var(--r-md); overflow: hidden; }
.noscene .ph img { width: 100%; display: block; }
.noscene p { margin: 0; color: var(--slate); font-size: 13px; max-width: 36ch; }

.viewlist ul { list-style: none; margin: 0; padding: var(--sp-2); }
.vrow {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center;
  padding: var(--sp-2); border-radius: var(--r-md);
  text-decoration: none; color: inherit; min-height: 48px;
}
a.vrow:hover { background: var(--surface); }
.vrow .th {
  position: relative; width: 54px; height: 40px; border-radius: 7px;
  overflow: hidden; background: var(--hairline);
}
.vrow .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrow.locked .th img { filter: grayscale(1) brightness(.8); }
.vrow .th .hazard {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg,
    oklch(0.487 0.180 25 / .55) 0 5px, oklch(0.227 0.004 286 / .55) 5px 10px);
}
.vrow .meta { min-width: 0; }
.vrow .nm { display: block; font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow .dt { display: block; font-size: var(--t-label); color: var(--stone-text); }
.vrow .rs {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px;
  font-size: var(--t-label); font-weight: 600; color: var(--late);
}
.vrow .rs svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2.2; fill: none; }

/* ================================================================== issues */
.issues { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-4); }
.issue {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) 128px 164px;
  gap: var(--sp-4); align-items: start;
  padding: var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--hairline-soft);
}
.issue:last-child { border-bottom: 0; }
.issue .th {
  width: 92px; height: 68px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--hairline); display: block;
}
.issue .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.issue .hd { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.issue .ttl { font-size: 14px; font-weight: 600; }
.issue .anchor {
  display: flex; align-items: center; gap: 5px; margin-top: 4px;
  font-size: var(--t-label); color: var(--slate);
}
.issue .anchor svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.7;
  fill: none; stroke-linejoin: round; }
.issue .desc { margin: 7px 0 0; font-size: 13px; color: var(--slate); }
.issue .meta {
  margin-top: 6px; font-size: var(--t-label); color: var(--stone-text);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.issue .sep { opacity: .5; }
.issue .side2 { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.issue .type { font-size: var(--t-label); font-weight: 600; color: var(--slate); }
.issue .act {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  text-align: end; font-size: var(--t-label); color: var(--stone-text);
}
.issue .act .who { font-weight: 600; color: var(--slate); }
.issue .cmt { display: inline-flex; align-items: center; gap: 4px; }
.issue .cmt svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.8;
  fill: none; stroke-linejoin: round; }
.issue .open {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
  font-size: var(--t-label); font-weight: 600; color: var(--ink);
  text-decoration: none; min-height: 28px;
}
.issue .open svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round; }
:dir(rtl) .issue .open svg { transform: scaleX(-1); }
.issue .open:hover { text-decoration: underline; text-underline-offset: 3px; }

.state {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--t-label); font-weight: 700;
  border: 1px solid transparent;
}
.state.open     { background: var(--brand-yellow); color: var(--ink); }
.state.resolved { background: var(--tint-teal); color: var(--ok); }
.state.closed   { background: var(--card); color: var(--slate); border-color: var(--hairline); }

.issues .empty { padding: 56px var(--sp-4); text-align: center; color: var(--slate); }

/* =============================================================== analytics */
.anal {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4); align-items: start;
}
.anal .wide { grid-column: 1 / -1; }
.anal .chartbox { padding: var(--sp-3) var(--sp-5) var(--sp-5); }
.anal .caption {
  padding: 0 var(--sp-5) var(--sp-5); font-size: var(--t-label); color: var(--slate);
}
.legend { display: flex; align-items: center; gap: 7px; font-size: var(--t-label);
  color: var(--slate); }
.legend .lg { width: 14px; height: 3px; border-radius: 2px; background: var(--planned);
  margin-inline-start: var(--sp-2); }
.legend .lg.actual { background: var(--ok-fill); margin-inline-start: 0; }
.legend .lg.actual.warn { background: var(--warn-fill); }
.legend .lg.actual.late { background: var(--late-fill); }

.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--hairline-soft); stroke-width: 1; }
.chart .ax { fill: var(--stone-text); font-size: 11px; font-weight: 600; }
.chart .axv { fill: var(--slate); font-size: 11px; font-weight: 700; }
.chart .ln { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { stroke: var(--canvas); stroke-width: 2; r: 4; }
.chart .ser.plan .ln, .chart .ser.plan .dot { stroke: var(--planned); }
.chart .ser.plan .dot { fill: var(--planned); }
.chart .ser.actual .ln { stroke: var(--ok-fill); }
.chart .ser.actual .dot { fill: var(--ok-fill); }
.chart .ser.actual.warn .ln { stroke: var(--warn-fill); }
.chart .ser.actual.warn .dot { fill: var(--warn-fill); }
.chart .ser.actual.late .ln { stroke: var(--late-fill); }
.chart .ser.actual.late .dot { fill: var(--late-fill); }
.chart .bar { fill: var(--planned); }
.chart .bar.ok { fill: var(--ok-fill); }
.chart .bar.warn { fill: var(--warn-fill); }
.chart .bar.late { fill: var(--late-fill); }

.fresh { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-5) var(--sp-5); }
.fresh li {
  display: grid; grid-template-columns: minmax(0, 260px) 1fr 56px;
  gap: var(--sp-4); align-items: center; padding: 7px 0;
}
.fresh .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fresh .dt { text-align: end; font-size: var(--t-label); font-weight: 700; color: var(--slate); }

/* ================================================================= reports */
.sheet { padding: var(--sp-7); max-width: 1000px; }
.sheethead { border-bottom: 1px solid var(--hairline); padding-bottom: var(--sp-5); }
.sheethead .eyebrow {
  font-size: var(--t-label); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--stone-text);
}
.sheethead h2 { margin: 6px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.sheethead .sub { margin: 4px 0 0; color: var(--slate); font-size: 13px; }
.sheethead .range { margin: 2px 0 0; color: var(--stone-text); font-size: var(--t-label); }

.counters {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3);
  padding: var(--sp-5) 0;
}
.counter {
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: 4px;
}
.counter .k { font-size: var(--t-label); font-weight: 700; color: var(--slate); }
.counter .n { font-size: var(--t-metric); font-weight: 700; letter-spacing: -.02em; }
.counter.open .n { color: var(--warn); }
.counter.resolved .n { color: var(--ok); }

.acth { margin: var(--sp-4) 0 var(--sp-3); font-size: 15px; font-weight: 700; }
.replist { list-style: none; margin: 0; padding: 0; }
.replist li {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) 140px;
  gap: var(--sp-4); align-items: start;
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--hairline-soft);
}
.replist .th { width: 76px; height: 56px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--hairline); display: block; }
.replist .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.replist .hd { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.replist .ttl { font-size: 14px; font-weight: 600; }
.replist .meta { margin-top: 4px; font-size: var(--t-label); color: var(--stone-text);
  display: flex; gap: 6px; flex-wrap: wrap; }
.replist .sep { opacity: .5; }
.replist .desc { margin: 6px 0 0; font-size: 13px; color: var(--slate); }
.replist .act { text-align: end; font-size: var(--t-label); color: var(--stone-text);
  display: flex; flex-direction: column; gap: 3px; }
.replist .act .who { font-weight: 600; color: var(--slate); }
.sheet .empty { color: var(--slate); font-size: 13px; }

/* ===================================================================== print
 * Everything but the report sheet is chrome. */
@media print {
  #rail, #gl, #depth, #pop, .hero, .mast { display: none !important; }
  #smooth-wrapper { position: static !important; overflow: visible !important; }
  #smooth-content { padding: 0 !important; transform: none !important; }
  .sheet { border: 0; padding: 0; max-width: none; }
  .replist li { break-inside: avoid; }
}

/* =============================================================== responsive */
@media (max-width: 1360px) {
  .mapcols { grid-template-columns: minmax(0, 1fr) 280px; }
  .issue { grid-template-columns: 76px minmax(0, 1fr) 120px; }
  .issue .act { grid-column: 2 / -1; flex-direction: row; gap: var(--sp-3);
    align-items: center; justify-content: flex-start; text-align: start; }
  .kpis.kpis-4 { grid-template-columns: repeat(2, 1fr); }
  .kpis.kpis-4 .kpi:nth-child(n+4) { display: flex; }
}
@media (max-width: 1080px) {
  .mapcols, .anal { grid-template-columns: minmax(0, 1fr); }
  .counters { grid-template-columns: repeat(2, 1fr); }
  .issue { grid-template-columns: 64px minmax(0, 1fr); }
  .issue .side2 { grid-column: 2; flex-direction: row; }
}

/* leader lines from each fanned billboard back to its true ground point */
.leaders {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}
.leaders line { stroke: var(--ink); stroke-width: 1; opacity: .45; }
.leaders circle { fill: var(--ink); opacity: .75; }

/* ============================================================== demo marker
 * The chip makes the note get seen; the note is what actually says what is
 * illustrative. Both are chrome, so neither prints. */
.titlerow { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.demochip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--hairline);
  background: var(--card); color: var(--slate);
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  white-space: nowrap; align-self: center;
}
.demonote {
  margin: var(--sp-6) 0 0; padding-top: var(--sp-4);
  border-top: 1px solid var(--hairline);
  font-size: var(--t-label); color: var(--stone-text);
  max-width: 78ch; line-height: 1.5;
}
@media print { .demochip, .demonote { display: none; } }
