/* ════════════════════════════════════════════════════════════════════════
   LEAVE MODELLER — layout only. Every colour, radius, weight and size is a
   --fc-* token from where-port.css: no new visual language (ticket 20's own
   constraint), and no raw hex below.

   COLOUR IS NEVER THE ONLY SIGNAL. Every state carries a glyph or a word as
   well as a hue, so the model reads in greyscale and to a colour-blind eye —
   the same rule js/schengen.js's STATE_META follows.
   ════════════════════════════════════════════════════════════════════════ */

.lm-wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 64px; }
.lm-head { margin-bottom: 18px; }
.lm-head h1 {
  font-size: var(--fc-size-screen-title); font-weight: var(--fc-weight-bold);
  letter-spacing: var(--fc-track-title); color: var(--fc-text-ink); margin: 0 0 4px;
}
.lm-head p { margin: 0; color: var(--fc-text-secondary); font-size: var(--fc-size-qualifier); line-height: var(--fc-leading-body); }

/* minmax(0, …) on every track, or a 1fr track grows to its widest child and the
   page scrolls sideways on a phone — measured 541px wide at a 390px viewport
   by the 2026-09-07 visual pass. Same trap .sf-tabpanel already guards. */
.lm-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.lm-grid > div { min-width: 0; }
@media (max-width: 900px) { .lm-grid { grid-template-columns: minmax(0, 1fr); } }

.lm-card {
  background: var(--fc-surface-card); border-radius: var(--fc-radius-card);
  box-shadow: var(--fc-shadow-card); padding: 18px; margin-bottom: 16px;
}
.lm-card h2 {
  font-size: var(--fc-size-section); font-weight: var(--fc-weight-semibold);
  letter-spacing: var(--fc-track-tight); color: var(--fc-text-ink); margin: 0 0 12px;
}
.lm-card h3 {
  font-size: var(--fc-size-caps, var(--fc-size-meta)); text-transform: uppercase;
  letter-spacing: var(--fc-track-caps); color: var(--fc-text-secondary);
  font-weight: var(--fc-weight-semibold); margin: 16px 0 8px;
}

/* ── controls ────────────────────────────────────────────────────────── */
.lm-field { margin-bottom: 14px; }
.lm-field > label {
  display: block; font-size: var(--fc-size-qualifier); font-weight: var(--fc-weight-medium);
  color: var(--fc-text-ink); margin-bottom: 5px;
}
.lm-field .lm-hint { display: block; font-size: var(--fc-size-meta); color: var(--fc-text-secondary); margin-top: 4px; }
.lm-field input[type="date"], .lm-field input[type="number"], .lm-field input[type="text"], .lm-field select {
  width: 100%; box-sizing: border-box; min-height: var(--fc-tap);
  font-family: var(--fc-font); font-size: var(--fc-size-body); color: var(--fc-text-ink);
  background: var(--fc-surface-rail); border: 1px solid var(--fc-hairline-card);
  border-radius: var(--fc-radius-row); padding: 8px 10px;
}
.lm-field input[type="range"] { width: 100%; min-height: var(--fc-tap); }
.lm-row { display: flex; gap: 10px; align-items: center; }
.lm-row > * { flex: 1; }
.lm-val {
  flex: 0 0 auto; min-width: 74px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: var(--fc-weight-semibold);
  font-size: var(--fc-size-body); color: var(--fc-text-ink);
}

.lm-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.lm-seg button {
  flex: 1 1 auto; min-height: var(--fc-tap); padding: 8px 10px; cursor: pointer;
  font-family: var(--fc-font); font-size: var(--fc-size-pill); font-weight: var(--fc-weight-medium);
  color: var(--fc-text-ink); background: var(--fc-surface-rail);
  border: 1px solid var(--fc-hairline-card); border-radius: var(--fc-radius-pill);
  transition: background var(--fc-duration-state) var(--fc-ease-standard);
}
.lm-seg button[aria-pressed="true"] {
  background: var(--fc-eu-chip); border-color: var(--fc-eu-micro); color: var(--fc-eu-ink);
  font-weight: var(--fc-weight-semibold);
}
/* the glyph, not the fill, is what says "selected" in greyscale */
.lm-seg button[aria-pressed="true"]::before { content: '✓ '; }

.lm-btn {
  min-height: var(--fc-tap); padding: 9px 14px; cursor: pointer;
  font-family: var(--fc-font); font-size: var(--fc-size-pill); font-weight: var(--fc-weight-semibold);
  color: var(--fc-text-ink); background: var(--fc-surface-rail);
  border: 1px solid var(--fc-hairline-card); border-radius: var(--fc-radius-pill);
}
.lm-btn--primary { background: var(--fc-eu-fill); border-color: var(--fc-eu-fill); color: var(--fc-text-on-fill); }
.lm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.lm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── the timeline ────────────────────────────────────────────────────── */
.lm-tl { position: relative; }
.lm-tl-months { display: flex; border-bottom: 1px solid var(--fc-hairline-row); margin-bottom: 10px; }
.lm-tl-month {
  font-size: var(--fc-size-meta); color: var(--fc-text-secondary); text-transform: uppercase;
  letter-spacing: var(--fc-track-caps); padding-bottom: 6px; border-left: 1px solid var(--fc-cell-vertical);
  padding-left: 5px; box-sizing: border-box; overflow: hidden; white-space: nowrap;
}
.lm-lane { margin-bottom: 12px; }
.lm-lane-label {
  font-size: var(--fc-size-meta); color: var(--fc-text-secondary); text-transform: uppercase;
  letter-spacing: var(--fc-track-caps); margin-bottom: 5px; font-weight: var(--fc-weight-semibold);
}
.lm-track { position: relative; height: 30px; background: var(--fc-surface-rail); border-radius: var(--fc-radius-chip); }
.lm-bar {
  position: absolute; top: 3px; bottom: 3px; border-radius: var(--fc-radius-badge);
  display: flex; align-items: center; padding: 0 7px; box-sizing: border-box;
  font-size: var(--fc-size-badge); font-weight: var(--fc-weight-semibold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fc-text-on-fill);
}
.lm-bar--pl { background: var(--fc-eu-fill); }
.lm-bar--pl-off { background: var(--fc-eu-rolled); color: var(--fc-eu-rolled-ink); }
.lm-bar--stat { background: var(--fc-today); }
.lm-bar--trip { background: var(--fc-eu-plan-a); color: var(--fc-text-ink); }
.lm-bar--trip-off { background: var(--fc-neutral-chip); color: var(--fc-text-secondary); border: 1px solid var(--fc-hairline-card); }
.lm-bar--al { background: var(--fc-tentative-ground); color: var(--fc-warn-ink); }
.lm-bar--bh { background: var(--fc-eu-plan-b); color: var(--fc-text-ink); }

.lm-birth { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--fc-breach); }
/* The label sits BELOW the track. Above it, it collided with the lane's own
   uppercase label — caught in the first render, not by reasoning about it. */
.lm-birth::after {
  content: '● birth'; position: absolute; bottom: -15px; left: 3px;
  font-size: var(--fc-size-badge); color: var(--fc-breach); white-space: nowrap; font-weight: var(--fc-weight-semibold);
}
.lm-lane--hasbirth { padding-bottom: 15px; }

/* the Schengen curve: an area chart drawn as one bar per day */
.lm-curve { position: relative; height: 76px; background: var(--fc-surface-rail); border-radius: var(--fc-radius-chip); overflow: hidden; }
.lm-curve-day { position: absolute; bottom: 0; background: var(--fc-eu-track); }
.lm-curve-day--warn { background: var(--fc-tentative-ground); }
.lm-curve-day--breach { background: var(--fc-breach-ground); }
.lm-curve-limit { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--fc-breach); }
/* The label sits INSIDE and BELOW the dashed line. Above it, at the top of an
   overflow:hidden box, it was clipped by the container — visible only once the
   page was actually rendered and looked at. */
.lm-curve-limit span {
  position: absolute; right: 5px; top: 2px; font-size: var(--fc-size-badge);
  color: var(--fc-breach); font-weight: var(--fc-weight-semibold);
  background: var(--fc-surface-card); padding: 0 4px; border-radius: var(--fc-radius-badge);
}

/* ── verdict list ────────────────────────────────────────────────────── */
.lm-verdict { list-style: none; margin: 0; padding: 0; }
.lm-verdict li {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px; margin-bottom: 6px;
  border-radius: var(--fc-radius-row); font-size: var(--fc-size-body);
  line-height: var(--fc-leading-body); color: var(--fc-text-ink);
}
.lm-verdict li b { font-weight: var(--fc-weight-semibold); }
.lm-v-ok    { background: var(--fc-status-ok-ground); }
.lm-v-warn  { background: var(--fc-tentative-ground); }
.lm-v-alert { background: var(--fc-status-alert-ground); }
.lm-v-info  { background: var(--fc-neutral-chip); }
.lm-glyph { flex: 0 0 auto; font-weight: var(--fc-weight-bold); font-variant-numeric: tabular-nums; }

.lm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin-bottom: 14px; }
.lm-stat { background: var(--fc-surface-rail); border-radius: var(--fc-radius-panel); padding: 12px; }
.lm-stat .lm-stat-n {
  font-size: var(--fc-w-size-count); line-height: var(--fc-w-leading-count);
  letter-spacing: var(--fc-w-track-count); font-weight: var(--fc-weight-bold);
  color: var(--fc-text-ink); font-variant-numeric: tabular-nums;
}
.lm-stat .lm-stat-l {
  font-size: var(--fc-w-size-caps); text-transform: uppercase; letter-spacing: var(--fc-track-caps);
  color: var(--fc-text-secondary); font-weight: var(--fc-weight-semibold); margin-top: 5px;
}
.lm-stat--unsupplied .lm-stat-n { font-size: var(--fc-size-body); color: var(--fc-text-secondary); font-weight: var(--fc-weight-medium); }

.lm-scen { list-style: none; margin: 0; padding: 0; }
.lm-scen li {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 9px 11px; border-radius: var(--fc-radius-row); background: var(--fc-surface-rail); margin-bottom: 6px;
  font-size: var(--fc-size-qualifier);
}
.lm-scen .lm-scen-meta { color: var(--fc-text-secondary); font-size: var(--fc-size-meta); }

.lm-note {
  font-size: var(--fc-size-meta); color: var(--fc-text-secondary);
  line-height: var(--fc-leading-body); margin-top: 10px;
}
.lm-unsupplied { color: var(--fc-text-secondary); font-style: normal; }
.lm-unsupplied::before { content: '— '; }

.lm-banner {
  padding: 11px 13px; border-radius: var(--fc-radius-row); font-size: var(--fc-size-body);
  background: var(--fc-status-alert-ground); color: var(--fc-text-ink); margin-bottom: 14px;
}
:focus-visible { outline: 2px solid var(--fc-today); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── the HR sheet ────────────────────────────────────────────────────── */
.lm-sheet {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: var(--fc-size-meta); line-height: 1.55; color: var(--fc-text-ink);
  background: var(--fc-surface-rail); border-radius: var(--fc-radius-panel);
  padding: 15px; margin: 0; white-space: pre-wrap; word-break: break-word;
  max-height: 460px; overflow-y: auto;
}

/* PRINT. Only the sheet survives — controls, timeline and verdict are working
   surfaces, not the document he sends. A print that carries the sliders would
   make the sheet look like a screenshot of a tool rather than a request. */
@media print {
  body { background: #fff; }
  .lm-grid { display: block; }
  .lm-grid > div:first-child, .lm-head p, .lm-banner,
  .lm-card:not(.lm-sheet-card), .lm-actions { display: none !important; }
  .lm-sheet-card { box-shadow: none; padding: 0; }
  .lm-sheet {
    background: #fff; max-height: none; overflow: visible; padding: 0;
    font-size: 10.5pt; line-height: 1.45;
  }
  .lm-sheet-card h2, .lm-sheet-card .lm-note { display: none; }
  @page { margin: 18mm; }
}

/* ── holidays table + the time-away total ────────────────────────────── */
.lm-hol { width: 100%; border-collapse: collapse; font-size: var(--fc-size-qualifier); margin-bottom: 8px; }
.lm-hol th {
  text-align: left; font-size: var(--fc-size-meta); text-transform: uppercase;
  letter-spacing: var(--fc-track-caps); color: var(--fc-text-secondary);
  font-weight: var(--fc-weight-semibold); padding: 6px 8px; border-bottom: 1px solid var(--fc-hairline-row);
}
.lm-hol td { padding: 7px 8px; border-bottom: 1px solid var(--fc-hairline-leg); color: var(--fc-text-ink); }
.lm-hol tr:last-child td { border-bottom: none; }

.lm-away { margin-top: 14px; border-top: 1px solid var(--fc-hairline-row); padding-top: 12px; }
.lm-away > div {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  font-size: var(--fc-size-body); color: var(--fc-text-ink);
}
.lm-away > div span { font-variant-numeric: tabular-nums; color: var(--fc-text-secondary); }
.lm-away-total {
  border-top: 1px solid var(--fc-hairline-row); margin-top: 5px; padding-top: 11px !important;
  font-weight: var(--fc-weight-semibold);
}
.lm-away-total span { color: var(--fc-text-ink) !important; font-weight: var(--fc-weight-bold); }

.lm-latest {
  background: var(--fc-surface-rail); border-radius: var(--fc-radius-panel);
  padding: 13px; margin-bottom: 10px; font-size: var(--fc-size-qualifier);
  line-height: var(--fc-leading-body); color: var(--fc-text-ink);
}
.lm-latest > div { margin-bottom: 4px; }
.lm-latest .lm-btn { margin-top: 8px; }
.lm-latest--over { background: var(--fc-tentative-ground); }
.lm-latest-now { color: var(--fc-text-secondary); }
.lm-basis { color: var(--fc-text-secondary); font-size: var(--fc-size-meta); }
