/* Cairn Leave & Disability Command App — Cairn Vision Tokens (docs/CAIRN_STYLE.md) */
:root, [data-theme="dark"] {
  --bg: #080a0d;
  --surface: #111318;
  --lift: #17191e;
  --soft: #20232a;
  --line: #34302b;
  --line2: #3b3936;
  --ink: #ede9e0;
  --ink2: #c8c1b5;
  --muted: #8d908f;
  --dim: #64696d;
  --text-dim: #b0b3b2;
  --gold: #d9b67a;
  --bright: #f1d29a;
  --bronze: #63533b;
  --green: #87ac9c;
  --red: #c48b82;
  --blue: #9fc2d6;
  --violet: #b3a6cf;
  --gold-a: rgba(217, 182, 122, 0.14);
  --gold-b: rgba(217, 182, 122, 0.32);
  --green-a: rgba(135, 172, 156, 0.14);
  --green-b: rgba(135, 172, 156, 0.34);
  --red-a: rgba(196, 139, 130, 0.14);
  --red-b: rgba(196, 139, 130, 0.36);
  --blue-a: rgba(159, 194, 214, 0.14);
  --blue-b: rgba(159, 194, 214, 0.34);
  --violet-a: rgba(179, 166, 207, 0.14);
  --violet-b: rgba(179, 166, 207, 0.34);
  --ink-dark: #141008;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --glass: rgba(14, 17, 21, 0.42);
  --glass-line: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 232, 180, 0.28);
  --glass-blur: blur(10px) saturate(1.15);
  --display: 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --tech: 'Rajdhani', 'Manrope', sans-serif;
  --t-fade: 160ms;
  --t-lift: 240ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --r: 10px;
  --r-s: 8px;
  --sp1: 4px;
  --sp2: 8px;
  --sp3: 12px;
  --sp4: 16px;
  --sp5: 24px;
  --sp6: 32px;
  --maxw: 1320px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-fade: 1ms;
    --t-lift: 1ms;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

a {
  color: var(--gold);
  text-decoration: none;
}

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.ico.lg {
  width: 22px;
  height: 22px;
}

.ico.sm {
  width: 15px;
  height: 15px;
}

/* Main shell — zero top bars */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--safe-t) + var(--sp4)) var(--sp4) calc(var(--safe-b) + 96px);
}

html.cn-on #app {
  padding-bottom: calc(var(--cn-bottom, 76px) + 24px) !important;
}

/* Top-level glass card (never nested) */
.glass-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Surface inner containers (no nested backdrop-filter) */
.sub-box {
  background: var(--lift);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: var(--sp3);
}

/* Typography scale */
h1.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h2.sec-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.hero-num {
  font-family: var(--tech);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--bright);
}

.stat-num {
  font-family: var(--tech);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--ink);
}

.mono {
  font-family: var(--mono);
}

.meta {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

.caption {
  font-size: 11px;
  color: var(--text-dim);
}

/* Waymark Header Strip (not a top bar — inline trailhead hero summary + desktop tab switcher) */
.waymark-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp3);
  margin-bottom: var(--sp4);
}

.waymark-left {
  display: flex;
  align-items: center;
  gap: var(--sp3);
}

.waymark-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  background: var(--gold-a);
  border: 1px solid var(--gold-b);
  color: var(--gold);
  display: grid;
  place-items: center;
  flex: none;
}

.waymark-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp2);
  align-items: center;
}

/* Segmented controls & pills */
.seg-nav {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
}

.seg-nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: background var(--t-fade) var(--ease), color var(--t-fade) var(--ease);
}

.seg-nav button:hover {
  color: var(--ink);
}

.seg-nav button.on {
  background: var(--gold-a);
  border: 1px solid var(--gold-b);
  color: var(--bright);
  font-weight: 600;
}

.seg-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg-filter button {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: background var(--t-fade) var(--ease), color var(--t-fade) var(--ease);
}

.seg-filter button.on {
  background: var(--gold-a);
  color: var(--bright);
  border: 1px solid var(--gold-b);
}

/* Floating bottom nav pill (mobile standalone or fallback when CairnNav hides) */
.dock-nav {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 12px);
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  width: min(460px, calc(100vw - 16px));
  justify-content: space-between;
  box-shadow: var(--shadow);
}

html.cn-on .dock-nav {
  display: none !important;
}

.dock-nav button {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  transition: background var(--t-fade) var(--ease), color var(--t-fade) var(--ease);
}

.dock-nav button.on {
  background: var(--gold-a);
  border: 1px solid var(--gold-b);
  color: var(--bright);
}

/* Chips & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line2);
  background: var(--surface);
  color: var(--ink2);
  white-space: nowrap;
}

.pill.gold {
  background: var(--gold-a);
  border-color: var(--gold-b);
  color: var(--bright);
}

.pill.ok {
  background: var(--green-a);
  border-color: var(--green-b);
  color: var(--green);
}

.pill.warn {
  background: var(--red-a);
  border-color: var(--red-b);
  color: var(--red);
}

.pill.michelle {
  background: var(--violet-a);
  border-color: var(--violet-b);
  color: var(--violet);
}

.pill.dan {
  background: var(--blue-a);
  border-color: var(--blue-b);
  color: var(--blue);
}

.pill.both {
  background: var(--gold-a);
  border-color: var(--gold-b);
  color: var(--bright);
}

/* Buttons (min touch target 44px) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line2);
  background: var(--soft);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color var(--t-fade) var(--ease), background var(--t-fade) var(--ease);
}

.btn:hover {
  border-color: var(--gold-b);
}

.btn.primary {
  background: var(--gold-a);
  border-color: var(--gold-b);
  color: var(--bright);
  font-weight: 600;
}

.btn.sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12.5px;
}

/* Trail Elevation Hero Visual */
.trail-strip {
  padding: var(--sp4);
  margin-bottom: var(--sp4);
  position: relative;
  overflow: hidden;
}

.trail-strip-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp2);
  margin-bottom: var(--sp3);
}

.trail-svg {
  width: 100%;
  height: 76px;
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp3);
  margin-top: var(--sp3);
}

.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Grid Layouts */
.cmd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp4);
  align-items: start;
}

.cards-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp3);
}

/* Needs Attention Now Queue */
.hero-queue {
  padding: var(--sp4);
  border-color: var(--gold-b);
}

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp2);
  margin-bottom: var(--sp3);
  flex-wrap: wrap;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}

.task-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  transition: border-color var(--t-fade) var(--ease);
}

.task-row.urgent {
  border-color: var(--gold-b);
}

.task-row.done {
  opacity: 0.68;
}

.task-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.chk-btn {
  width: 44px;
  height: 44px;
  margin: -8px 0 -8px -8px;
  display: grid;
  place-items: center;
  flex: none;
}

.chk-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid var(--line2);
  background: var(--bg);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background var(--t-fade) var(--ease), border-color var(--t-fade) var(--ease);
}

.chk-btn.done .chk-box {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink-dark);
}

.task-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp2);
}

.task-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.task-row.done .task-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.task-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.task-expand-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-s);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  flex: none;
}

.task-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink2);
  line-height: 1.5;
}

.script-pre {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Live Claim & Benefit Trackers */
.claim-card {
  padding: var(--sp4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.claim-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp2);
}

.claim-id {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--gold);
}

.prog-track {
  width: 100%;
  height: 6px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
  transition: width 400ms var(--ease);
}

.prog-fill.ok {
  background: var(--green);
}

.claim-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kv-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 8px 10px;
}

.kv-cell span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
}

.kv-cell strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

/* Pre-Flight Vault */
.vault-summary {
  padding: var(--sp4);
  margin-bottom: var(--sp4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp4);
}

.ring-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp4);
}

.ring-svg {
  width: 72px;
  height: 72px;
  flex: none;
}

.vault-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp3);
}

.vault-card {
  padding: var(--sp4);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vault-card.confirmed {
  border-color: var(--green-b);
}

.vault-note {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--r-s);
  color: var(--ink);
  font-size: 13.5px;
}

.vault-note:focus, .field-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* Timeline & Milestones */
.tl-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp3);
  margin-bottom: var(--sp4);
}

.month-group {
  margin-bottom: var(--sp5);
}

.month-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 var(--sp3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-rail {
  position: relative;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

.month-rail::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line2);
}

.ms-item {
  position: relative;
  padding: 14px;
}

.ms-dot {
  position: absolute;
  left: -24px;
  top: 18px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gold);
}

.ms-item.done .ms-dot {
  background: var(--green);
  border-color: var(--green);
}

/* Verified Docs & Benefits Info */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.doc-path {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gold);
  word-break: break-all;
  margin-top: 3px;
}

.benefit-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.benefit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: 13.5px;
}

.benefit-row strong {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--bright);
}

/* Sheet / Modal for adding custom tasks & editing notes */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 10, 13, 0.76);
  display: grid;
  place-items: end center;
  padding: 0;
}

.sheet-panel {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--gold-b);
  border-radius: 12px 12px 0 0;
  padding: var(--sp5) var(--sp4) calc(var(--safe-b) + var(--sp5));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink2);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--r-s);
  color: var(--ink);
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 88px);
  transform: translateX(-50%);
  z-index: 95;
  background: var(--lift);
  border: 1px solid var(--gold-b);
  color: var(--bright);
  padding: 10px 16px;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 500;
  max-width: calc(100vw - 32px);
}

/* Responsive Breakpoints (390 -> 768 -> 1280) */
@media (min-width: 768px) {
  #app {
    padding: calc(var(--safe-t) + var(--sp5)) var(--sp5) calc(var(--safe-b) + var(--sp6));
  }
  .seg-nav {
    display: inline-flex;
  }
  .dock-nav {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vault-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sheet-backdrop {
    place-items: center;
    padding: var(--sp4);
  }
  .sheet-panel {
    border-radius: 12px;
    padding: var(--sp5);
  }
}

@media (min-width: 1120px) {
  .cmd-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .cards-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
