/* ==========================================================================
   PileManager — application stylesheet (no external dependencies)

   House style: a contractor's back-office system, not a consumer product.
   Flat surfaces, hairline rules, one navy accent, tabular figures, and a
   fixed side rail so the application reads as a tool rather than a page.
   ========================================================================== */

:root {
  color-scheme: light;

  /* neutrals — cool grey, the colour of drawing paper under office light */
  --surface-0:  #eef0f3;   /* app background          */
  --surface-1:  #ffffff;   /* cards, inputs           */
  --surface-2:  #f3f5f7;   /* zebra, wells, tracks    */
  --surface-3:  #e7eaee;   /* headers inside cards    */
  --border:     #d7dce3;
  --border-str: #bcc4ce;

  --text-primary:   #16202c;
  --text-secondary: #4b5766;
  --text-muted:     #78838f;

  /* navy: the only strong colour in the interface */
  --navy:       #12365f;
  --navy-dark:  #0d2946;
  --navy-light: #1d5089;

  --accent:      #1c4c86;
  --accent-weak: #e8eef6;
  --accent-ink:  #123563;

  --good:     #16704a;
  --good-bg:  #e6f2ec;
  --warn:     #8a6100;
  --warn-bg:  #f8f0dd;
  --danger:   #a52630;
  --danger-bg:#f8e9ea;
  --info-bg:  #e8eef6;

  --series-1: #1d5fa8;
  --series-2: #4a90d9;
  --series-3: #7fa8c9;

  --radius:   4px;
  --radius-s: 3px;
  --shadow:   none;

  --side-w:   182px;
  --top-h:    54px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-0:  #11161c;
    --surface-1:  #171d25;
    --surface-2:  #1e262f;
    --surface-3:  #232c37;
    --border:     #2b343f;
    --border-str: #3b4653;

    --text-primary:   #eef2f6;
    --text-secondary: #b0bac6;
    --text-muted:     #8794a2;

    --navy:      #0f2b4a;
    --navy-dark: #0a1e36;

    --accent:      #5c93d6;
    --accent-weak: #17304d;
    --accent-ink:  #9dc0e8;

    --good:     #4fae86;  --good-bg:  #12291f;
    --warn:     #c99a3a;  --warn-bg:  #2c2411;
    --danger:   #d97b82;  --danger-bg:#2e1a1c;
    --info-bg:  #17304d;

    --series-1: #5c93d6;
    --series-2: #4a7ab0;
    --series-3: #7d95ab;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0:  #11161c;
  --surface-1:  #171d25;
  --surface-2:  #1e262f;
  --surface-3:  #232c37;
  --border:     #2b343f;
  --border-str: #3b4653;
  --text-primary:   #eef2f6;
  --text-secondary: #b0bac6;
  --text-muted:     #8794a2;
  --navy:      #0f2b4a;
  --navy-dark: #0a1e36;
  --accent:      #5c93d6;
  --accent-weak: #17304d;
  --accent-ink:  #9dc0e8;
  --good: #4fae86;  --good-bg: #12291f;
  --warn: #c99a3a;  --warn-bg: #2c2411;
  --danger: #d97b82; --danger-bg: #2e1a1c;
  --info-bg: #17304d;
  --series-1: #5c93d6;
  --series-2: #4a7ab0;
  --series-3: #7d95ab;
}

/* -------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface-0);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 19px; }
h2 { font-size: 14px; letter-spacing: .01em; }
h3 { font-size: 13px; }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.muted     { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small     { font-size: 12px; }
.mono      { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap    { white-space: nowrap; }
.right     { text-align: right; }
.center    { text-align: center; }

code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 4px; border-radius: 2px;
}
.code-block {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 9px 11px; margin: 8px 0 0;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  color: var(--text-secondary);
}

svg { flex: none; }

/* -------------------------------------------------------------- shell */

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 50;
  display: flex; flex-direction: column;
  background: var(--navy);
  border-right: 1px solid var(--navy-dark);
  color: #dbe4ef;
}

.side-brand {
  display: flex; align-items: center; gap: 8px;
  height: var(--top-h); padding: 0 11px; flex: none;
  border-bottom: 1px solid rgba(255,255,255,.10);
  color: #fff; font-weight: 600; font-size: 13.5px; letter-spacing: .01em;
}
.side-brand:hover { text-decoration: none; color: #fff; }
.side-brand .brand-mark {
  width: 23px; height: 23px; flex: none; border-radius: 3px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.13); color: #fff;
}
.side-brand .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-scroll { flex: 1; overflow-y: auto; padding: 8px 0 20px; }

.side-group {
  padding: 11px 12px 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: rgba(255,255,255,.42);
}
.side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  color: #cfdae8; font-size: 12.5px; font-weight: 500;
  line-height: 1.35;
  border-left: 2px solid transparent;
}
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.side-link.active {
  background: rgba(255,255,255,.11); color: #fff; font-weight: 600;
  border-left-color: #7fb0e8;
}
.side-link svg { opacity: .85; }
.side-link.active svg { opacity: 1; }

.side-foot {
  flex: none; padding: 9px 12px;
  border-top: 1px solid rgba(255,255,255,.10);
  font-size: 10px; color: rgba(255,255,255,.45);
}

.side-credit { display: block; margin-top: 2px; color: rgba(255,255,255,.32); font-size: 9.5px; }

.shell { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; height: var(--top-h); flex: none;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.topbar-context { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-context .tc-icon { color: var(--text-muted); }
.topbar-context .tc-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-context .tc-sub { font-size: 12px; color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-right select { min-width: 190px; }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 9px 4px 5px; border-radius: var(--radius-s);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 550;
  border: 1px solid var(--border);
}
.user-chip:hover { background: var(--surface-2); text-decoration: none; color: var(--text-primary); }
.user-avatar {
  width: 22px; height: 22px; flex: none; border-radius: 2px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
}

/* the mobile bar that replaces the side rail */
.side-toggle { display: none; }

.page { flex: 1; max-width: 1380px; width: 100%; padding: 20px 20px 56px; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding-bottom: 13px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-head .spacer { margin-left: auto; }
.page-head h1 { display: flex; align-items: center; gap: 9px; }
.page-head h1 .page-icon { color: var(--accent); }
.page-title-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }

/* -------------------------------------------------------------- cards */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-head h2 {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-secondary);
  min-width: 0;
}
.card-head h2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head h2 svg { color: var(--accent); }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 15px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 940px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* -------------------------------------------------------------- stat tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 1px;
  margin-bottom: 18px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* the shadow paints the 1px gap, so a half-filled last row has no stray rules */
.stat {
  background: var(--surface-1); padding: 11px 14px 12px;
  box-shadow: 1px 0 0 0 var(--border), 0 1px 0 0 var(--border);
}
.stat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-value {
  margin-top: 5px;
  font-size: 23px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.stat-value .unit { font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.stat-delta { margin-top: 3px; font-size: 11.5px; display: flex; align-items: center; gap: 4px; }
.stat-delta.up   { color: var(--good); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--text-muted); }

/* -------------------------------------------------------------- charts */

.chart { width: 100%; height: auto; display: block; }
.chart-grid  { stroke: var(--border); stroke-width: 1; }
.chart-axis  { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }
.chart-line  { fill: none; stroke: var(--series-1); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart-area  { fill: var(--series-1); opacity: .09; stroke: none; }
.chart-dot   { fill: var(--series-1); }
.chart-empty { fill: var(--text-muted); font-size: 13px; font-family: var(--font); }
.chart-hit   { fill: transparent; }
.chart-hit:hover { fill: var(--accent); opacity: .07; }

/* SVG chart furniture shared by the column and bar charts */
.chart-axis-line { stroke: var(--border-str); stroke-width: 1; }
.col-rect  { fill: var(--series-1); }
.col-figure {
  fill: var(--text-primary); font-size: 11.5px; font-weight: 600;
  font-family: var(--font); font-variant-numeric: tabular-nums;
}
.bar-name { font-size: 11.5px; fill: var(--text-secondary); }
.colchart-svg, .barchart-svg { width: 100%; height: auto; display: block; }
.colchart-svg { max-height: 320px; }

/* the bars grow into place, so the board looks alive when it opens */
@keyframes bar-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes bar-run  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }

.col-rect { transform-origin: center bottom; animation: bar-rise .45s cubic-bezier(.2,.7,.3,1) both; }
.bar-rect { transform-origin: left center;   animation: bar-run  .45s cubic-bezier(.2,.7,.3,1) both; }
.col-figure { animation: fade-in .5s ease .25s both; }
.chart-line, .chart-dot, .chart-area { animation: fade-in .6s ease both; }

/* each bar a beat after the one before it */
.col-rect:nth-of-type(1) { animation-delay: .02s } .col-rect:nth-of-type(2) { animation-delay: .06s }
.col-rect:nth-of-type(3) { animation-delay: .10s } .col-rect:nth-of-type(4) { animation-delay: .14s }
.col-rect:nth-of-type(5) { animation-delay: .18s } .col-rect:nth-of-type(6) { animation-delay: .22s }
.col-rect:nth-of-type(7) { animation-delay: .26s } .col-rect:nth-of-type(8) { animation-delay: .30s }

@media (prefers-reduced-motion: reduce) {
  .col-rect, .bar-rect, .col-figure, .chart-line, .chart-dot, .chart-area { animation: none; }
}

.barlist { display: flex; flex-direction: column; gap: 7px; }
.barlist-row { display: grid; grid-template-columns: 130px 1fr 74px; align-items: center; gap: 10px; }
.barlist-label {
  font-size: 12.5px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.barlist-track { background: var(--surface-2); border: 1px solid var(--border); height: 15px; overflow: hidden; }
.barlist-fill  { background: var(--series-1); height: 100%; }
.barlist-value { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.barlist-value .unit { color: var(--text-muted); font-size: 11px; }

/* soil profile */
.soil-svg { width: 100%; height: auto; max-width: 280px; display: block; }
.soil-tick  { stroke: var(--border-str); stroke-width: 1; }
.soil-depth { fill: var(--text-secondary); font-size: 10px; font-family: var(--mono); }
.soil-name  { fill: var(--text-secondary); font-size: 10.5px; font-family: var(--font); }
.soil-axis-title { fill: var(--text-muted); font-size: 10px; font-family: var(--font); }

/* -------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td {
  padding: 7px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-secondary); background: var(--surface-2);
  border-bottom: 1px solid var(--border-str);
  position: sticky; top: 0; white-space: nowrap;
}
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr:hover { background: var(--accent-weak); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* key/value display table */
table.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.kv th, table.kv td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
table.kv th {
  text-align: left; font-weight: 500; color: var(--text-secondary);
  width: 52%; font-size: 12.5px;
}
table.kv td { text-align: right; font-variant-numeric: tabular-nums; }
table.kv td .unit { color: var(--text-muted); font-size: 11.5px; margin-left: 2px; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: none; }
table.kv tr.is-computed th { color: var(--accent-ink); }
table.kv tr.is-computed td { font-weight: 600; }

/* -------------------------------------------------------------- forms */

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

label.label {
  display: block; margin-bottom: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-secondary);
}
label.label .req { color: var(--danger); margin-left: 2px; }
label.label .unit { color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=search],
input[type=url], input[type=file], select, textarea {
  width: 100%;
  padding: 6px 9px;
  font-family: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-str);
  border-radius: var(--radius-s);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input[type=file] { padding: 5px 8px; font-size: 12.5px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}
input:disabled, select:disabled, textarea:disabled,
input[readonly] {
  background: var(--surface-2); color: var(--text-secondary); cursor: not-allowed;
}
textarea { min-height: 74px; resize: vertical; }

.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.check input { width: auto; margin-top: 2px; }

.input-error { border-color: var(--danger) !important; }
.field-error { margin-top: 3px; font-size: 12px; color: var(--danger); }
.field-help  { margin-top: 4px; font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.form-grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.computed-value {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 9px;
  background: var(--accent-weak);
  border: 1px solid var(--accent);
  border-left-width: 2px;
  border-radius: var(--radius-s);
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--accent-ink);
  min-height: 32px;
}
.computed-value .unit { font-weight: 400; font-size: 11.5px; opacity: .8; }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.35;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-str);
  border-radius: var(--radius-s);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn svg { opacity: .75; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-primary svg { opacity: 1; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface-1); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------- tool grid (admin console) */

.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 1px; background: var(--surface-1);
}
.tool {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: 1px 0 0 0 var(--border), 0 1px 0 0 var(--border);
}
.tool:hover { background: var(--accent-weak); text-decoration: none; }
.tool-icon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 2px; color: var(--accent);
}
.tool:hover .tool-icon { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-text { min-width: 0; flex: 1; }
.tool-text strong { display: block; font-size: 13px; font-weight: 600; }
.tool-text span {
  display: block; font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tool-go { color: var(--border-str); flex: none; }
.tool:hover .tool-go { color: var(--accent); }

/* -------------------------------------------------------------- badges & alerts */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 2px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: var(--surface-2); color: var(--text-secondary);
  border: 1px solid var(--border-str);
}
.badge.ok    { background: var(--good-bg);   color: var(--good);   border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.badge.info  { background: var(--info-bg);   color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.warn  { background: var(--warn-bg);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.err   { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge.muted { background: var(--surface-2); color: var(--text-muted); }

.alert {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 9px 12px; margin-bottom: 12px;
  border: 1px solid var(--border-str);
  border-left-width: 3px;
  border-radius: var(--radius-s);
  font-size: 12.5px;
  background: var(--surface-1);
}
.alert-icon { flex: none; display: inline-flex; padding-top: 1px; }
.alert-success { background: var(--good-bg);   border-color: var(--good);   color: var(--good); }
.alert-error   { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.alert-warn    { background: var(--warn-bg);   border-color: var(--warn);   color: var(--warn); }
.alert-info    { background: var(--info-bg);   border-color: var(--accent); color: var(--accent-ink); }
.alert div { color: var(--text-primary); }
.alert-error div, .alert-success div, .alert-warn div, .alert-info div { color: inherit; }

.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert li { margin-bottom: 2px; }

/* -------------------------------------------------------------- filters */

.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.filters .field { margin-bottom: 0; }
.filters input, .filters select { min-width: 130px; }
.filters .spacer { margin-left: auto; }

.range-chips { display: flex; gap: 0; }
.range-chips a {
  padding: 5px 11px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  border: 1px solid var(--border-str);
  border-right-width: 0;
  background: var(--surface-1);
}
.range-chips a:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.range-chips a:last-child  { border-radius: 0 var(--radius-s) var(--radius-s) 0; border-right-width: 1px; }
.range-chips a:hover { background: var(--surface-2); text-decoration: none; }
.range-chips a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* -------------------------------------------------------------- grid editor (repeating rows) */

.gridtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gridtable th {
  padding: 6px 8px; text-align: left;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-secondary); background: var(--surface-2);
  border-bottom: 1px solid var(--border-str);
}
.gridtable td { padding: 3px 4px; border-bottom: 1px solid var(--border); }
.gridtable td:last-child { width: 34px; }
.gridtable input, .gridtable select { padding: 4px 7px; font-size: 12.5px; }
.gridtable tfoot td { padding: 8px 4px; border-bottom: none; background: var(--surface-2); }
.row-remove {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 2px;
}
.row-remove:hover { background: var(--danger-bg); color: var(--danger); }

/* -------------------------------------------------------------- section nav inside the form */

.section-nav {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 8px 14px; margin-bottom: 16px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  position: sticky; top: var(--top-h); z-index: 20;
}
.section-nav a {
  padding: 4px 10px; border-radius: var(--radius-s);
  font-size: 12px; font-weight: 550; color: var(--text-secondary);
}
.section-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text-primary); }

/* -------------------------------------------------------------- login */

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 24px; background: var(--surface-0);
}
.auth-card {
  width: 100%; max-width: 372px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 26px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-brand .brand-mark {
  width: 30px; height: 30px; border-radius: 3px;
  display: grid; place-items: center;
  background: var(--navy); color: #fff;
}
.auth-title { font-size: 17px; font-weight: 650; }
.auth-foot {
  margin: 16px 0 0; text-align: center;
  font-size: 11.5px; color: var(--text-muted);
}

/* -------------------------------------------------------------- misc */

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 14px; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 6px; }
.empty-state svg { color: var(--border-str); margin-bottom: 10px; }

.divider { height: 1px; background: var(--border); margin: 15px 0; border: none; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-secondary); }
.legend-swatch { width: 11px; height: 11px; border: 1px solid var(--border-str); }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  padding: 5px 8px; border-radius: 2px;
  background: var(--navy-dark); color: #fff; font-size: 12px;
  opacity: 0; transition: opacity .1s;
  white-space: nowrap;
}
.tooltip.show { opacity: 1; }
.tooltip .t-label { color: #9fb4cc; margin-right: 6px; }

/* rows written by the production auto-fill */
.gridtable tr.row-filled > td { background: var(--accent-weak); }
.gridtable tr.row-filled > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* ---------------------------------------------------------------- landing page */
.land { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface-0); }
.land-top {
  background: var(--navy); color: #fff;
  border-bottom: 3px solid var(--navy-dark);
}
.land-top-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 58px; display: flex; align-items: center;
}
.land-brand { display: flex; align-items: center; gap: 11px; }
.land-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 3px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.14); color: #fff;
}
.land-name { font-size: 16px; font-weight: 650; letter-spacing: .01em; color: #fff; }
.land-tag { margin-left: auto; font-size: 12px; color: rgba(255,255,255,.6); letter-spacing: .06em; text-transform: uppercase; }

.land-inner {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 44px 24px 40px;
  display: grid; grid-template-columns: 1.25fr 0.95fr; gap: 52px; align-items: start;
}
.land-h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 16px; max-width: 24ch; }
.land-lead { font-size: 15px; line-height: 1.65; color: var(--text-secondary); margin: 0 0 28px; max-width: 56ch; }

.land-features {
  display: grid; gap: 1px; margin-bottom: 26px;
  background: var(--surface-1); border: 1px solid var(--border);
}
.land-feature + .land-feature { box-shadow: 0 -1px 0 0 var(--border); }
.land-feature {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; background: var(--surface-1);
}
.land-feature .lf-icon {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-weak); color: var(--accent);
  border-radius: 2px;
}
.land-feature strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.land-feature span { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

.land-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.land-points li {
  position: relative; padding-left: 20px;
  font-size: 13.5px; line-height: 1.6; color: var(--text-secondary);
}
.land-points li::before {
  content: ""; position: absolute; left: 2px; top: 8px;
  width: 6px; height: 6px; background: var(--accent);
}
.land-points strong { color: var(--text-primary); font-weight: 600; }

.land-stat { font-size: 12.5px; color: var(--text-secondary); margin: 0; }
.land-stat strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.land-login { position: sticky; top: 32px; }
.land-card { width: 100%; max-width: 420px; margin: 0; }
.land-signin { font-size: 18px; margin: 0 0 4px; letter-spacing: -0.01em; }
.land-help {
  margin: 16px 0 0; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); line-height: 1.55;
}
/* showcase bands, each one screen of the application with its explanation */
.land-band { border-top: 1px solid var(--border); background: var(--surface-1); }
.land-band.alt { background: var(--surface-0); }

.land-band-inner {
  max-width: 1180px; margin: 0 auto; padding: 52px 24px;
  display: grid; grid-template-columns: 0.85fr 1.15fr;
  gap: 46px; align-items: center;
}
/* image first on the reversed band, and the wider column travels with it */
.land-band-inner.reverse { grid-template-columns: 1.15fr 0.85fr; }
.land-band-inner.reverse .band-text { order: 2; }
.land-band-inner.reverse .shot     { order: 1; }

.land-band-narrow { max-width: 940px; margin: 0 auto; padding: 52px 24px; }

.band-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
}
.band-eyebrow.center { display: flex; justify-content: center; }
.band-h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 14px; }
.band-h2.center { text-align: center; }
.band-text p { font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin: 0 0 14px; }
.band-sub {
  text-align: center; max-width: 62ch; margin: 0 auto 26px;
  font-size: 13.5px; line-height: 1.7; color: var(--text-secondary);
}

.band-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.band-list li {
  position: relative; padding-left: 22px;
  font-size: 13px; color: var(--text-secondary);
}
.band-list li::before {
  content: ""; position: absolute; left: 4px; top: 7px;
  width: 7px; height: 7px; border: 1.5px solid var(--accent); border-radius: 50%;
}

/* a framed screenshot */
.shot { margin: 0; min-width: 0; }
.shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border-str); border-radius: var(--radius);
  background: var(--surface-1);
}
.shot figcaption {
  margin-top: 9px; font-size: 11.5px; color: var(--text-muted);
  letter-spacing: .02em;
}

/* how a day runs */
.land-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  margin-top: 26px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.step { background: var(--surface-1); padding: 20px 18px; }
.step-no {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-bottom: 11px;
  background: var(--navy); color: #fff;
  font-size: 13px; font-weight: 700; line-height: 1; border-radius: 2px;
}
.step strong { display: block; font-size: 14px; margin-bottom: 5px; }
/* :not() keeps this off the numbered badge, which would otherwise win on
   specificity and paint the digit grey on navy */
.step > span:not(.step-no) {
  display: block; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary);
}

.land-foot {
  border-top: 1px solid var(--border);
  text-align: center; padding: 18px 24px 24px;
  font-size: 12px; color: var(--text-muted);
}

@media (max-width: 900px) {
  .land-band-inner,
  .land-band-inner.reverse { grid-template-columns: 1fr; gap: 26px; padding: 36px 20px; }
  .land-band-inner.reverse .band-text { order: 1; }
  .land-band-inner.reverse .shot     { order: 2; }
  .land-band-narrow { padding: 36px 20px; }
  .land-steps { grid-template-columns: 1fr; }
  .band-h2 { font-size: 21px; }
}

@media (max-width: 900px) {
  .land-inner { grid-template-columns: 1fr; gap: 32px; padding: 32px 20px 28px; }
  .land-h1 { font-size: 27px; max-width: none; }
  .land-login { position: static; }
  .land-card { max-width: none; }
}

/* ---------------------------------------------------------------- overview board */

.prog { display: flex; align-items: center; gap: 12px; }
.prog-track {
  flex: 1; height: 8px;
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
}
.prog-fill { height: 100%; background: var(--accent); }
.prog-fill.good   { background: var(--good); }
.prog-fill.warn   { background: var(--warn); }
.prog-fill.danger { background: var(--danger); }
.prog-num { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

tr.row-total td { background: var(--surface-3); font-weight: 600; }

/* -------------------------------------------------- progress by KM location
   Matches the table the client circulates: chainage chip, centred counts,
   a wide traffic-light bar, and the overall figure in a filled navy box. */

.progress-table td, .progress-table th { vertical-align: middle; padding: 4px 8px; }
.progress-table td:first-child { white-space: nowrap; width: 1%; }
.progress-table th.mid, .progress-table td.mid {
  text-align: center; font-variant-numeric: tabular-nums; width: 16%;
}
.progress-table td.mid { font-size: 11.5px; }
.progress-table .prog-col { width: 44%; }
.progress-table .prog { gap: 7px; }
.progress-table .prog-track { height: 11px; border-radius: 2px; min-width: 40px; }
.progress-table .prog-fill  { border-radius: 1px; }
.progress-table .prog-num {
  min-width: 38px; flex: none; font-size: 11px; font-weight: 700; color: var(--text-primary);
}

.progress-table tr.row-total td {
  background: var(--surface-2);
  border-top: 2px solid var(--border-str);
  font-size: 11.5px; font-weight: 700;
}
.plant-table th.mid, .plant-table td.mid { text-align: center; font-variant-numeric: tabular-nums; }
.plant-table td { vertical-align: middle; }
.plant-table tr.row-total td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--border-str); }

.total-pill {
  display: block; padding: 3px 0; text-align: center; font-size: 11.5px;
  background: var(--navy); color: #fff;
  border-radius: 2px;
  font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* vertical column chart */
.colchart { display: flex; align-items: flex-end; gap: 6px; }
.col-item { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0; }
.col-value {
  font-size: 11px; text-align: center; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; margin-bottom: 4px; height: 15px;
}
.col-bar-wrap { flex: 1; display: flex; align-items: flex-end; }
.col-bar { width: 100%; background: var(--series-1); }
.col-label {
  font-size: 10.5px; text-align: center; color: var(--text-muted);
  margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-legend { align-content: center; }
.donut { flex: none; }
.donut-centre { font-size: 20px; font-weight: 700; fill: var(--text-primary); }
.donut-note   { font-size: 9px; fill: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
/* in a narrow card the legend sits under the donut, so lay it out across
   rather than down — that is what made this panel twice its neighbours' height */
.donut-legend {
  flex: 1; min-width: 130px;
  display: grid; gap: 9px;
  grid-template-columns: 1fr;
  min-width: 104px;
}
.donut-item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; }
.donut-swatch { width: 11px; height: 11px; flex: none; margin-top: 3px; }
.donut-text { display: block; }
.donut-label { display: block; color: var(--text-primary); font-weight: 600; }
.donut-val {
  display: block; font-variant-numeric: tabular-nums;
  color: var(--text-secondary); font-weight: 500;
}

/* The banner across the top of the board: the same navy band the client's own
   dashboard is printed with — mark, project, and the two stamps on the right. */
.board-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; margin-bottom: 16px;
  border: 1px solid var(--navy-dark);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
}
.bb-mark {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--radius-s);
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}
.bb-title { min-width: 0; }
.board-banner h1 {
  margin: 0; font-size: 17px; font-weight: 700;
  letter-spacing: .05em; color: #fff; line-height: 1.25;
}
.bb-sub {
  font-size: 11.5px; color: rgba(255,255,255,.7); margin-top: 3px;
  text-transform: uppercase; letter-spacing: .07em;
}
.bb-stamps { display: flex; gap: 26px; text-align: right; }
.bb-stamp .bs-label {
  display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .11em;
  color: rgba(255,255,255,.55);
}
.bb-stamp .bs-value { font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.board { display: grid; grid-template-columns: 1fr 244px; gap: 18px; align-items: start; }
.board-main { min-width: 0; display: grid; gap: 16px; }
/* same reason: nothing in the main column may grow past its own track */
.board-main > * { min-width: 0; }
.card, .table-wrap { max-width: 100%; }

/* A card is as tall as what is in it. Stretching every card to the tallest one
   in its row is what left half a screen of white under the charts. */
.board-main .grid-2,
.board-main .grid-3 { align-items: start; }

/* the donut needs more room than the two panels beside it */
.grid-plant { grid-template-columns: 1.3fr 1fr 0.9fr; }
@media (max-width: 1000px) { .grid-plant { grid-template-columns: 1fr; } }

/* The board panels pack themselves.

   Multi-column layout lets the browser fill whichever column has room, so the
   panels sit tight against each other whatever their heights are. A card is
   never split across the fold. */
.board-cols {
  /* one column until there is genuinely room for two: at 1,180 px the main
     column is only ~660 px wide, and a split table hides its own figures */
  columns: 1; column-gap: 16px; margin-bottom: 16px;
  /* A grid item is min-width:auto by default, so a wide table inside would
     stretch this container past its track and paint over the filter rail. */
  min-width: 0;
}
.board-cols > .card {
  break-inside: avoid; page-break-inside: avoid;
  margin: 0 0 16px;
  min-width: 0;
}
@media (min-width: 1400px) { .board-cols { columns: 2; } }
@media (min-width: 1900px) { .board-cols { columns: 3; } }

/* ------------------------------------------------ the client's panel rows

   The board the client circulates is a fixed arrangement, not a flow: three
   panels across the top (KM table, S-curve, production), four across the
   second row (utilisation, delays, concrete, QA/QC). Below those widths the
   rows fold rather than squeeze the charts into strips. */
.board-row {
  display: grid; gap: 14px; margin-bottom: 14px; align-items: stretch;
  min-width: 0;
}
.board-row > .card { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.board-row > .card > .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.board-row > .card > .card-body.tight { display: block; }
.board-row.row-3 { grid-template-columns: minmax(0, .95fr) minmax(0, 1fr) minmax(0, 1fr); }
.board-row.row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1460px) { .board-row.row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .board-row.row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .board-row.row-3, .board-row.row-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------- board density

   Panels on the board are read at a glance from across the site office, so
   they are set tighter than the data-entry screens: shorter rows, smaller
   type, less padding. Nothing here leaves the board. */
.board .card-head { padding: 6px 10px; }
.board .card-head h2 { font-size: 10.5px; letter-spacing: .05em; }
.board .card-body { padding: 11px; }
.board .card-body.tight { padding: 0; }
.board table.data { font-size: 11.5px; }
.board table.data th, .board table.data td { padding: 5px 8px; vertical-align: middle; }
.board table.data th { font-size: 9.5px; letter-spacing: .04em; }
.board table.kv { font-size: 11.5px; }
.board table.kv th, .board table.kv td { padding: 4px 8px; }
.board .empty-state { padding: 18px 12px; }
.board .empty-state h3 { font-size: 12px; }
.board .stats { margin: 0; }
.board .stat { padding: 9px 10px; }
.board .stat-value { font-size: 19px; }
.panel-note { margin: 9px 0 0; font-size: 10.5px; line-height: 1.45; color: var(--text-muted); }

/* A panel that ends up alone on a row must not blow its chart up to half a
   screen — the drawing is centred at its natural size instead. */
.board .chart { max-height: 330px; }
.board .donut { max-height: 130px; }

/* the overall pass rate, boxed under the QA table the way the client prints it */
.pass-rate {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px; padding: 7px 11px;
  border: 1px solid var(--border-str); border-radius: var(--radius-s);
  background: var(--surface-2);
}
.pr-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-secondary);
}
.pr-value { font-size: 18px; font-weight: 700; color: var(--good); font-variant-numeric: tabular-nums; }

/* the QA table sits in a quarter-width panel, so it has to stay narrow */
.qa-table td:first-child { line-height: 1.3; }
.qa-table th.mid, .qa-table td.mid { text-align: center; width: 17%; font-variant-numeric: tabular-nums; }
.board-main .card { margin-bottom: 0; }

/* headline tiles */
.tiles {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
/* icon at the left, the reading stacked beside it, a coloured rule underneath */
.tile {
  position: relative; background: var(--surface-1);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 16px;
  box-shadow: 1px 0 0 0 var(--border), 0 1px 0 0 var(--border);
}
.tile-icon { flex: none; color: var(--tile-tone); }
.tile-body { min-width: 0; flex: 1; text-align: center; }
.tile-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-secondary); line-height: 1.3;
}
.tile-value {
  margin-top: 4px;
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
  color: var(--text-primary);
}
.tile-note { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.tile-rule { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tile-tone); }

.tile.tone-a { --tile-tone: var(--series-1); }
.tile.tone-b { --tile-tone: var(--series-2); }
.tile.tone-c { --tile-tone: var(--good); }
.tile.tone-d { --tile-tone: var(--accent); }
.tile.tone-e { --tile-tone: var(--warn); }
.tile.tone-f { --tile-tone: var(--series-3); }

.ch-icon { vertical-align: -3px; margin-right: 6px; color: var(--text-muted); }

.loc-chip {
  display: inline-block; min-width: 50px; padding: 2px 7px; border-radius: 2px;
  background: var(--navy); color: #fff;
  border: 1px solid var(--navy-dark);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .03em; text-align: center;
  text-decoration: none; font-weight: 700;
}
.loc-chip:hover { background: var(--navy-light); color: #fff; text-decoration: none; }

/* filter rail */
.board-rail {
  display: grid; gap: 12px; position: sticky; top: calc(var(--top-h) + 12px);
  z-index: 2;   /* nothing from the main column may be painted over it */
  min-width: 0;
}
.rail-card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 12px;
}
.rail-head {
  display: flex; align-items: center; gap: 7px; margin-bottom: 9px;
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-secondary);
}
.rail-head svg { color: var(--accent); }
.rail-head .rail-clear {
  margin-left: auto; text-transform: none; letter-spacing: 0;
  font-weight: 600; font-size: 11px; color: var(--accent);
}
.rail-years { display: flex; gap: 0; margin-bottom: 8px; }
.rail-years a {
  flex: 1; text-align: center; padding: 4px 0;
  font-size: 11.5px; text-decoration: none; color: var(--text-secondary);
  background: var(--surface-1); border: 1px solid var(--border-str); border-right-width: 0;
}
.rail-years a:first-child { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.rail-years a:last-child  { border-radius: 0 var(--radius-s) var(--radius-s) 0; border-right-width: 1px; }
.rail-years a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.rail-chips { display: grid; grid-template-columns: 1fr; gap: 4px; }
.rail-chips.cols-2 { grid-template-columns: repeat(2, 1fr); }
.rail-chips.cols-3 { grid-template-columns: repeat(3, 1fr); }
.rail-chips.cols-3 a { padding: 6px 2px; font-size: 11px; letter-spacing: -0.01em; }
.rail-chips a {
  display: block; text-align: center; padding: 5px 4px; border-radius: var(--radius-s);
  font-size: 11.5px; text-decoration: none;
  color: var(--text-secondary); background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-chips a:hover { border-color: var(--border-str); color: var(--text-primary); }
.rail-chips a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.rail-form { display: grid; gap: 6px; }
.rail-form .label { margin: 0; }
.rail-form input { padding: 5px 8px; font-size: 12px; }
.rail-form .btn { margin-top: 4px; justify-content: center; }

.rail-links { display: grid; gap: 6px; font-size: 12.5px; }
.rail-links a { color: var(--accent); text-decoration: none; display: flex; align-items: center; gap: 7px; }
.rail-links a:hover { text-decoration: underline; }

/* rig list on the rail: plant number and the state it is in */
.rail-rigs { display: grid; gap: 3px; }
.rr-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11.5px;
}
.rr-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.rr-dot.ok  { background: var(--good); }
.rr-dot.warn { background: var(--warn); }
.rr-dot.err  { background: var(--danger); }
.rr-code { font-family: var(--mono); font-weight: 700; color: var(--text-primary); }
.rr-state { margin-left: auto; color: var(--text-muted); font-size: 10.5px; }

/* the strip the client prints under its board */
.board-strip {
  margin-top: 16px; padding: 9px 14px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  border-radius: var(--radius); border: 1px solid var(--navy-dark);
  background: var(--navy); color: rgba(255,255,255,.9);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
}
.board-strip i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.board-foot {
  margin-top: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-muted);
  font-size: 11.5px; text-align: center;
}

/* a shortfall against plan */
.stat-value.neg, td.num.neg { color: var(--danger); }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1240px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1080px) {
  .board { grid-template-columns: 1fr; }
  .board-rail { position: static; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --side-w: 0px; }
  .side {
    position: static; width: auto; inset: auto;
    flex-direction: row; align-items: center; gap: 4px;
    overflow-x: auto; border-right: none; border-bottom: 1px solid var(--navy-dark);
  }
  .side-brand { border-bottom: none; }
  .side-scroll { display: flex; padding: 0; overflow-x: auto; }
  .side-group, .side-foot { display: none; }
  .side-link { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; padding: 8px 12px; }
  .side-link.active { border-left: none; border-bottom-color: #7fb0e8; }
  .shell { margin-left: 0; }
  .topbar { gap: 8px; }
  .topbar-right select { min-width: 130px; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .board-rail { grid-template-columns: 1fr; }
  .board-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .bb-stamps { text-align: left; gap: 18px; }
  .board-strip { flex-wrap: wrap; gap: 10px; letter-spacing: .08em; }
  .page { padding: 14px 12px 40px; }
  .topbar-context .tc-sub { display: none; }
}

/* -------------------------------------------------------------- print */

@media print {
  .side, .topbar, .section-nav, .filters, .btn, .no-print, .pagination,
  .board-rail { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .shell { margin-left: 0; }
  .page { max-width: none; padding: 0; }
  .board { grid-template-columns: 1fr; }
  .card { border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; margin-bottom: 10px; }
  .card-head { background: #f1f1f1; padding: 6px 10px; }
  .card-body { padding: 10px; }
  .board-banner { background: #fff !important; color: #000; border: 1px solid #999; }
  .board-banner h1, .bb-sub, .bb-stamp .bs-label, .bb-stamp .bs-value { color: #000 !important; }
  .bb-mark { background: none; border-color: #999; color: #000; }
  .board-strip { background: #fff !important; color: #000; border: 1px solid #999; }
  a { color: #000; text-decoration: none; }
  table.kv th, table.kv td { padding: 3px 7px; }
}

/* ---------------------------------------------------------------- control panel

   The platform's own back office. Kept visibly plainer than the customer
   application — a slate bar instead of the navy rail — so nobody can mistake
   one for the other at a glance. */

body.control { background: var(--surface-0); }

.ctl-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--top-h); padding: 0 20px;
  background: var(--navy-dark); color: #fff;
  border-bottom: 3px solid var(--accent);
}
.ctl-brand {
  display: flex; align-items: center; gap: 9px;
  color: #fff; font-weight: 600; font-size: 14.5px;
}
.ctl-brand:hover { text-decoration: none; color: #fff; }
.ctl-brand em {
  font-style: normal; font-weight: 500; opacity: .65;
  padding-left: 6px; border-left: 1px solid rgba(255,255,255,.25); margin-left: 4px;
}
.ctl-bar .brand-mark {
  width: 26px; height: 26px; flex: none; border-radius: 3px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.13); color: #fff;
}
.ctl-bar .spacer { margin-left: auto; }
.ctl-bar .small.muted { color: rgba(255,255,255,.6); }

.ctl-page { max-width: 1280px; margin: 0 auto; width: 100%; }

/* ---------------------------------------------------------------- front door

   Shown at the bare service address: the product, and the box that sends a
   visitor to their own workspace. Everything else here reuses the landing
   page's bands, so the two pages read as one site. */

.ws-input {
  display: flex; align-items: stretch;
  border: 1px solid var(--border-str); border-radius: var(--radius-s);
  background: var(--surface-1); overflow: hidden;
}
.ws-input input {
  border: none; border-radius: 0; flex: 1; min-width: 0;
  background: transparent;
}
.ws-input input:focus { outline: none; box-shadow: none; }
.ws-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.ws-suffix {
  display: flex; align-items: center; padding: 0 10px;
  background: var(--surface-2); border-left: 1px solid var(--border);
  color: var(--text-muted); font-size: 12.5px; white-space: nowrap;
}

/* plan cards */
.plan-cards {
  display: grid; gap: 16px; margin-top: 22px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.plan-card {
  position: relative;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 18px 18px;
  display: flex; flex-direction: column;
}
.plan-card.featured { border-color: var(--accent); border-top: 3px solid var(--accent); }
.plan-flag {
  position: absolute; top: -10px; left: 18px;
  background: var(--accent); color: #fff;
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 2px;
}
.plan-name {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-secondary);
}
.plan-price {
  margin-top: 6px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.plan-cur { font-size: 13px; font-weight: 600; margin-left: 4px; color: var(--text-secondary); }
.plan-per { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.plan-list {
  list-style: none; margin: 14px 0 0; padding: 0;
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; flex: 1;
}
.plan-list li { padding-left: 16px; position: relative; }
.plan-list li::before {
  content: ''; position: absolute; left: 2px; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.plan-trial {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
