/* FairFind brand (The Finding): Fira Sans, ink navy, verdigris. Fonts are self-hosted so the
   private instance never calls out to Google Fonts. */
@font-face { font-family: "Fira Sans"; src: url("brand/FiraSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("brand/FiraSans-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("brand/FiraSans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("brand/FiraSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("brand/FiraSans-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }

:root {
  /* FairFind palette */
  --ff-navy: #1C2541;
  --ff-verdigris: #3A8F85;
  --ff-verdigris-dark: #2F7A71;
  --ff-verdigris-tint: #E1F0EE;
  --ff-bg: #F3F5F7;
  --ff-surface: #FFFFFF;
  --ff-border: #DFE3EA;
  --ff-text: #1C2541;
  --ff-text-muted: #586174;
  --ff-sidebar-text: #C9CEDB;
  /* Role names used throughout the stylesheet (kept so the layout rules did not need rewriting) */
  --forest-950: var(--ff-navy);
  --forest-900: #232E4F;
  --forest: var(--ff-verdigris-dark);
  --forest-700: var(--ff-verdigris);
  --sage: var(--ff-text-muted);
  --sage-200: #9AA3B8;
  --mist: var(--ff-sidebar-text);
  --fog: var(--ff-verdigris-tint);
  --paper: var(--ff-surface);
  --canvas: var(--ff-bg);
  --ink: var(--ff-text);
  --muted: var(--ff-text-muted);
  --clay: #b0603f;
  --ochre: #c99448;
  --ok: var(--ff-verdigris-dark);
  --line: var(--ff-border);
  --white: #fff;
  --shadow: 0 18px 48px rgba(28, 37, 65, .08), 0 2px 10px rgba(28, 37, 65, .05);
  --sans: "Fira Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Fira Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
a { color: var(--forest); }
h1, h2, h3, h4 { line-height: 1.2; overflow-wrap: anywhere; }
h1 { margin: 4px 0 6px; font-family: var(--sans); color: var(--forest-950); font-size: clamp(24px, 3vw, 34px); font-weight: 600; letter-spacing: -.5px; }
h2 { margin: 0; font-size: 15px; color: var(--forest-950); font-weight: 700; }
h3 { margin: 0 0 6px; font-size: 13px; color: var(--forest-950); font-weight: 700; }

/* Layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; height: 100vh; padding: 26px 18px; background: var(--forest-950); color: #F4F6FA; display: flex; flex-direction: column; z-index: 10; overflow-y: auto; }
.brand { display: block; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-logo { display: block; width: 100%; max-width: 196px; height: auto; }
.brand-suite { display: block; margin: 10px 0 0 2px; color: var(--mist); font-size: 9px; font-weight: 700; letter-spacing: 1.8px; }
.nav-kicker { display: block; margin: 24px 12px 8px; color: var(--sage-200); font-size: 9px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav a { color: var(--ff-sidebar-text); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.nav a:hover, .nav a:focus-visible { background: rgba(255,255,255,.08); color: #fff; outline: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--mist); }
.nav svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .85; }
.sidebar-note { margin-top: auto; padding: 13px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; }
.sidebar-note strong { display: block; color: #fff; font-size: 12px; margin-bottom: 5px; }
.sidebar-note span, .sidebar-note a { color: #AEB5C7; font-size: 11px; line-height: 1.5; }
main { grid-column: 2; min-width: 0; }
.topbar { min-height: 70px; padding: 12px 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(251,251,249,.9); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5; }
.eyebrow { color: var(--sage); font-size: 10px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.top-title { font-size: 14px; font-weight: 700; margin-top: 3px; }
.content { max-width: 1400px; padding: 30px 34px 64px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.subtitle { color: var(--muted); font-size: 13.5px; line-height: 1.55; max-width: 720px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Timer bar */
.timer-shell { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; background: var(--fog); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }
.timer-shell.running { background: var(--ff-verdigris-tint); border-color: var(--forest-700); }
.timer-readout { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 700; color: var(--forest-950); min-width: 72px; }
.timer-shell .meta { color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-shell form { display: inline; margin: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage-200); flex: 0 0 auto; }
.running .status-dot { background: var(--clay); box-shadow: 0 0 0 4px rgba(176,96,63,.15); }

/* Cards, grids */
.grid { display: grid; gap: 16px; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.grid.wide-narrow { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 16px; }
.card { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.card-header { min-height: 54px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-header span { color: var(--muted); font-size: 11.5px; }
.card-body { padding: 18px; }
.metric { min-height: 118px; padding: 16px 18px; position: relative; }
.metric:after { content: ""; position: absolute; inset: auto 18px 0 18px; height: 3px; background: var(--fog); }
.metric.attention:after { background: var(--clay); }
.metric.ok:after { background: var(--ok); }
.metric-label { color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.metric-value { margin-top: 12px; font-family: var(--sans); font-weight: 600; font-size: 28px; color: var(--forest-950); overflow-wrap: anywhere; }
.metric-value.state { font-size: 20px; line-height: 1.2; }
.metric-note { margin-top: 6px; color: var(--muted); font-size: 11px; }
.records { padding: 2px 18px 8px; }
.record { padding: 13px 0; border-bottom: 1px solid rgba(28,37,65,.08); display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.record:last-child { border: 0; }
.record strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.record strong a { text-decoration: none; }
.record p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.record .aside { text-align: right; flex: 0 0 auto; color: var(--muted); font-size: 11.5px; }
.empty { margin: 0; padding: 28px 18px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; background: var(--fog); color: var(--forest); font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
.pill.clay { background: #f6e5dc; color: #8b3d29; }
.pill.ochre { background: #f7ecd8; color: #775418; }
.pill.ok { background: var(--ff-verdigris-tint); color: #245F58; }
.pill.muted { background: var(--fog); color: var(--muted); }
.boundary { margin-top: 16px; padding: 14px 16px; border: 1px dashed rgba(28,37,65,.3); background: rgba(225,240,238,.5); color: var(--forest); font-size: 12px; line-height: 1.55; border-radius: 10px; }
.toast { margin: 0 0 18px; padding: 12px 16px; border-radius: 10px; background: var(--ff-verdigris-tint); color: #245F58; border: 1px solid #BBDDD8; font-size: 13px; }
.toast.error { background: #f6e5dc; color: #8b3d29; border-color: #e6c3b4; }

/* Stages */
.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 18px; }
.stage { padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.stage .stage-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fog); color: var(--muted); font-size: 11px; font-weight: 800; margin-bottom: 8px; }
.stage.done { border-color: var(--forest-700); }
.stage.done .stage-mark { background: var(--forest); color: #fff; }
.stage.current { background: var(--forest-950); color: #fff; border-color: var(--forest-950); }
.stage.current .stage-mark { background: var(--mist); color: var(--forest-950); }
.stage strong { display: block; font-size: 12px; }
.stage span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stage.current span { color: var(--mist); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--forest-950); border-bottom-color: var(--forest); }
.tabs a .count { margin-left: 6px; color: var(--sage); font-size: 11px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; padding: 10px 14px; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: rgba(234,238,237,.5); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid rgba(28,37,65,.08); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data a { text-decoration: none; font-weight: 600; }
table.data tr:hover td { background: rgba(234,238,237,.35); }
table.data .sub { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
table.data tfoot td { font-weight: 700; background: rgba(234,238,237,.5); }

/* Forms */
form.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field label, label.field-label { font-size: 11px; font-weight: 700; color: var(--forest-950); letter-spacing: .3px; }
.field .hint { font-size: 11px; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 13.5px; min-height: 40px; border-radius: 8px; border: 1px solid var(--ff-border); padding: 8px 11px; background: var(--white); color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(58,143,133,.3); border-color: var(--forest-700); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: auto; min-height: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.button, button { font: inherit; font-size: 13px; font-weight: 700; min-height: 38px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--forest); background: var(--forest); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.button:hover, button:hover { background: var(--forest-700); border-color: var(--forest-700); }
.button.secondary, button.secondary { background: var(--white); color: var(--forest); border-color: var(--ff-border); }
.button.secondary:hover, button.secondary:hover { background: var(--fog); }
.button.clay, button.clay { background: var(--clay); border-color: var(--clay); }
.button.small, button.small { min-height: 30px; padding: 4px 11px; font-size: 12px; }
.button.link, button.link { background: none; border: 0; color: var(--forest); padding: 0; min-height: 0; text-decoration: underline; font-weight: 600; }
.button.danger, button.danger { background: var(--white); color: #8b3d29; border-color: #e6c3b4; }
.inline-form { display: inline; }
.meta-line { color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .field { min-width: 160px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% 0%, #2A3760 0%, var(--forest-950) 60%); }
.login-card { width: 100%; max-width: 440px; background: var(--paper); border-radius: 14px; padding: 34px 32px; box-shadow: var(--shadow); }
.login-card .brand-logo { max-width: 260px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; }
.week-nav { display: flex; align-items: center; gap: 12px; }
.week-nav strong { font-size: 14px; }
.day-head td { background: var(--fog); font-weight: 700; color: var(--forest-950); }
.print-only { display: none; }

@media (max-width: 1100px) {
  .grid.metrics { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .grid.three, .grid.wide-narrow { grid-template-columns: 1fr; }
  .stages { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .app { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; }
  .brand { padding-bottom: 14px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-kicker { display: none; }
  .sidebar-note { display: none; }
  main { display: block; }
  .topbar { position: static; padding: 14px 16px; align-items: flex-start; flex-direction: column; }
  .content { padding: 20px 16px 48px; }
  .grid.metrics { grid-template-columns: 1fr; }
  .stages { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .tabs, .hero-actions, .no-print { display: none !important; }
  .app { display: block; }
  main { grid-column: 1; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; }
  .print-only { display: block; }
}
