    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    :root {
      --bg: #F7F6F3;
      --surface: #FFFFFF;
      --border: #E2DFD8;
      --border-light: #EDE9E3;
      --text: #1A1916;
      --text-2: #6B6860;
      --text-3: #9C9A95;
      --accent: #2C5F8A;
      --accent-light: #EBF2F8;
      --orange: #C4622D;
      --orange-light: #FAEEE7;
      --green: #2A7A52;
      --green-light: #E8F4EE;
      --amber: #B07D2A;
      --amber-light: #FBF3E3;
      --purple: #5B4C9A;
      --purple-light: #EEEDFB;
      --teal: #2A7A6E;
      --teal-light: #E8F4F2;
      --radius: 6px;
      --radius-sm: 4px;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      font-size: 13px;
      line-height: 1.5;
      min-height: 100vh;
    }

    /* ── LAYOUT ── */
    .app {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    .topbar {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 0 24px;
      display: flex;
      align-items: center;
      gap: 0;
      height: 48px;
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .logo {
      font-size: 12px;
      font-weight: 600;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: var(--text-3);
      margin-right: 28px;
      white-space: nowrap;
    }

    .nav {
      display: flex;
      gap: 0;
      flex: 1;
      overflow-x: auto;
    }

    .nav-btn {
      padding: 0 14px;
      height: 48px;
      border: none;
      background: none;
      color: var(--text-2);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      white-space: nowrap;
      transition: color .15s, border-color .15s;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .nav-btn:hover {
      color: var(--text);
    }

    .nav-btn.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    .content {
      flex: 1;
      padding: 28px 24px 48px;
      max-width: 1280px;
      margin: 0 auto;
      width: 100%;
    }

    /* ── PANELS ── */
    .panel {
      display: none;
    }

    .panel.active {
      display: block;
    }

    /* ── TYPOGRAPHY ── */
    .section-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: .1em;
      text-transform: uppercase;
      color: var(--text-3);
      margin-bottom: 12px;
      margin-top: 24px;
    }

    .section-label:first-child {
      margin-top: 0;
    }

    .page-title {
      font-size: 18px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 4px;
    }

    .page-sub {
      font-size: 12px;
      color: var(--text-2);
      margin-bottom: 24px;
    }

    /* ── CARDS ── */
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 18px;
      margin-bottom: 12px;
    }

    .card-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 8px;
    }

    .card-sub {
      font-size: 11px;
      color: var(--text-2);
      line-height: 1.55;
    }

    /* ── GRIDS ── */
    .g2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .g3 {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 12px;
    }

    .g4 {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr 1fr;
      gap: 12px;
    }

    /* ── BADGES ── */
    .badge {
      display: inline-block;
      font-size: 10px;
      font-weight: 500;
      padding: 1px 7px;
      border-radius: 10px;
      vertical-align: middle;
      margin-left: 4px;
    }

    .b-blue {
      background: var(--accent-light);
      color: var(--accent);
    }

    .b-orange {
      background: var(--orange-light);
      color: var(--orange);
    }

    .b-green {
      background: var(--green-light);
      color: var(--green);
    }

    .b-amber {
      background: var(--amber-light);
      color: var(--amber);
    }

    .b-purple {
      background: var(--purple-light);
      color: var(--purple);
    }

    .b-teal {
      background: var(--teal-light);
      color: var(--teal);
    }

    .b-grey {
      background: #F1EFE8;
      color: #5A5852;
    }

    /* ── PILL TAGS ── */
    .tag {
      display: inline-block;
      font-size: 10px;
      font-weight: 500;
      padding: 2px 8px;
      border-radius: 3px;
      margin: 2px 2px 0 0;
    }

    /* ── TIMELINE BLOCKS (daily schedule) ── */
    .timeline {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .tl-row {
      display: flex;
      align-items: stretch;
      gap: 0;
      /* min-height set by JS from duration; height:auto so content expands freely */
    }

    .tl-time {
      font-size: 11px;
      font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
      font-weight: 500;
      color: var(--text-3);
      min-width: 48px;
      width: 48px;
      padding-top: 10px;
      text-align: right;
      padding-right: 12px;
      flex-shrink: 0;
    }

    .tl-rail {
      width: 3px;
      border-radius: 2px;
      flex-shrink: 0;
      margin-right: 10px;
      align-self: stretch;
    }

    .tl-block {
      flex: 1;
      padding: 10px 12px;
      border-radius: var(--radius-sm);
      margin-bottom: 0;
      position: relative;
    }

    .tl-title {
      font-size: 12px;
      font-weight: 600;
      margin-bottom: 3px;
      padding-right: 56px;
    }

    .tl-desc {
      font-size: 11px;
      line-height: 1.5;
    }

    /* Colour variants */
    .tl-deep {
      background: var(--purple-light);
    }

    .tl-deep .tl-title {
      color: var(--purple);
    }

    .tl-deep .tl-rail-c {
      background: var(--purple);
    }

    .tl-stand {
      background: var(--green-light);
    }

    .tl-stand .tl-title {
      color: var(--green);
    }

    .tl-so {
      background: var(--orange-light);
    }

    .tl-so .tl-title {
      color: var(--orange);
    }

    .tl-mtg {
      background: var(--accent-light);
    }

    .tl-mtg .tl-title {
      color: var(--accent);
    }

    .tl-supp {
      background: var(--amber-light);
    }

    .tl-supp .tl-title {
      color: var(--amber);
    }

    .tl-lunch {
      background: #F4F2EE;
    }

    .tl-lunch .tl-title {
      color: var(--text-2);
    }

    /* Rail colours by type */
    .rail-deep {
      background: var(--purple);
    }

    .rail-stand {
      background: var(--green);
    }

    .rail-so {
      background: var(--orange);
    }

    .rail-mtg {
      background: var(--accent);
    }

    .rail-supp {
      background: var(--amber);
    }

    .rail-lunch {
      background: #C8C4BB;
    }

    /* ── WEEK OVERVIEW ── */
    .week-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 10px;
      margin-bottom: 20px;
    }

    .day-col {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }

    .day-col-head {
      padding: 8px 10px 6px;
      border-bottom: 1px solid var(--border-light);
      font-size: 11px;
      font-weight: 600;
    }

    .day-col-body {
      padding: 8px 8px 10px;
    }

    .day-block {
      font-size: 10px;
      padding: 3px 6px;
      border-radius: 3px;
      margin-bottom: 3px;
      line-height: 1.4;
    }

    .db-deep {
      background: var(--purple-light);
      color: var(--purple);
    }

    .db-stand {
      background: var(--green-light);
      color: var(--green);
    }

    .db-so {
      background: var(--orange-light);
      color: var(--orange);
    }

    .db-mtg {
      background: var(--accent-light);
      color: var(--accent);
    }

    .db-supp {
      background: var(--amber-light);
      color: var(--amber);
    }

    .db-lunch {
      background: #F1EFE8;
      color: #6B6860;
    }

    /* ── SUB TABS ── */
    .sub-tabs {
      display: flex;
      gap: 4px;
      margin-bottom: 20px;
      border-bottom: 1px solid var(--border);
      padding-bottom: 0;
    }

    .sub-tab {
      padding: 6px 14px 8px;
      border: none;
      background: none;
      color: var(--text-2);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
      transition: color .15s, border-color .15s;
    }

    .sub-tab:hover {
      color: var(--text);
    }

    .sub-tab.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    .sub-panel {
      display: none;
    }

    .sub-panel.active {
      display: block;
    }

    /* ── TABLES ── */
    .tbl {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }

    .tbl th {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--text-3);
      text-align: left;
      padding: 6px 10px 8px;
      border-bottom: 1px solid var(--border);
    }

    .tbl td {
      padding: 8px 10px;
      border-bottom: 1px solid var(--border-light);
      color: var(--text-2);
      vertical-align: top;
    }

    .tbl tr:last-child td {
      border-bottom: none;
    }

    .tbl td:first-child {
      color: var(--text);
      font-weight: 500;
    }

    /* ── LEGEND ── */
    .legend {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 12px;
      padding: 10px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 10px;
      color: var(--text-2);
    }

    .legend-dot {
      width: 8px;
      height: 8px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    /* ── NOTE BOX ── */
    .note {
      background: var(--accent-light);
      border-left: 3px solid var(--accent);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      padding: 10px 14px;
      font-size: 11px;
      color: var(--text-2);
      line-height: 1.6;
      margin: 12px 0;
    }

    .note strong {
      color: var(--text);
    }

    .note-amber {
      background: var(--amber-light);
      border-left-color: var(--amber);
    }

    .note-orange {
      background: var(--orange-light);
      border-left-color: var(--orange);
    }

    .note-green {
      background: var(--green-light);
      border-left-color: var(--green);
    }

    /* ── TZ SPECIFIC ── */
    .tz-viz-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
    }

    .tz-viz-label {
      font-size: 11px;
      color: var(--text-2);
      min-width: 130px;
      text-align: right;
      flex-shrink: 0;
    }

    .tz-track {
      flex: 1;
      height: 20px;
      background: var(--bg);
      border-radius: 3px;
      overflow: hidden;
      display: flex;
    }

    .tz-seg {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 9px;
      font-weight: 500;
    }

    .tz-header-row {
      display: flex;
      gap: 8px;
      margin-bottom: 5px;
      padding-left: 138px;
    }

    .tz-header-cell {
      flex: 1;
      font-size: 9px;
      color: var(--text-3);
      text-align: center;
    }

    /* ── KPI CARDS ── */
    .kpi-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
    }

    .kpi-name {
      font-size: 11px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 4px;
    }

    .kpi-def {
      font-size: 11px;
      color: var(--text-2);
      margin-bottom: 8px;
      line-height: 1.5;
    }

    .kpi-calc {
      font-size: 10px;
      font-family: 'SF Mono', 'Consolas', monospace;
      background: var(--bg);
      padding: 5px 8px;
      border-radius: var(--radius-sm);
      color: var(--text-2);
      margin-bottom: 8px;
    }

    .kpi-bench {
      font-size: 10px;
      color: var(--text-3);
    }

    .kpi-bench span {
      font-weight: 600;
    }

    /* ── DECISION FLOW ── */
    .decision-step {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      margin-bottom: 10px;
    }

    .step-num {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
    }

    .step-body {
      flex: 1;
    }

    .step-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 2px;
    }

    .step-desc {
      font-size: 11px;
      color: var(--text-2);
      line-height: 1.5;
    }

    .outcome-row {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 10px;
      margin: 14px 0;
    }

    .outcome-card {
      padding: 12px 14px;
      border-radius: var(--radius);
      border: 1px solid var(--border);
    }

    .outcome-card h4 {
      font-size: 11px;
      font-weight: 700;
      margin-bottom: 6px;
    }

    .outcome-card ul {
      list-style: none;
    }

    .outcome-card ul li {
      font-size: 11px;
      color: var(--text-2);
      padding: 2px 0;
    }

    .outcome-card ul li::before {
      content: "→ ";
      color: var(--text-3);
    }

    .oc-prod {
      background: var(--green-light);
      border-color: #B8DFC8;
    }

    .oc-prod h4 {
      color: var(--green);
    }

    .oc-disp {
      background: var(--accent-light);
      border-color: #BDD6EC;
    }

    .oc-disp h4 {
      color: var(--accent);
    }

    .oc-purch {
      background: var(--orange-light);
      border-color: #F0C4A8;
    }

    .oc-purch h4 {
      color: var(--orange);
    }

    /* ── VENDOR TIERS ── */
    .tier-card {
      border-left: 4px solid;
      padding: 12px 16px;
      background: var(--surface);
      border-radius: 0 var(--radius) var(--radius) 0;
      margin-bottom: 10px;
      border-top: 1px solid var(--border);
      border-right: 1px solid var(--border);
      border-bottom: 1px solid var(--border);
    }

    /* ── TRIAGE ── */
    .triage-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .triage-card {
      border-radius: var(--radius);
      padding: 14px 16px;
      border: 1px solid var(--border);
    }

    .triage-card h4 {
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 6px;
    }

    .triage-card p,
    .triage-card li {
      font-size: 11px;
      color: var(--text-2);
      line-height: 1.6;
    }

    .triage-card ul {
      list-style: none;
      padding: 0;
    }

    .triage-card ul li::before {
      content: "• ";
      color: var(--text-3);
    }

    /* ── TIPS ── */
    .tip-row {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      padding: 10px 0;
      border-bottom: 1px solid var(--border-light);
    }

    .tip-row:last-child {
      border-bottom: none;
    }

    .tip-num {
      font-size: 11px;
      font-family: 'SF Mono', 'Consolas', monospace;
      color: var(--text-3);
      min-width: 24px;
      padding-top: 1px;
    }

    .tip-body {
      flex: 1;
    }

    .tip-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 2px;
    }

    .tip-desc {
      font-size: 11px;
      color: var(--text-2);
      line-height: 1.5;
    }

    /* ── SEASON TOGGLE ── */
    .season-toggle {
      display: flex;
      gap: 6px;
      margin-bottom: 20px;
    }

    .season-btn {
      padding: 5px 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--surface);
      color: var(--text-2);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all .15s;
    }

    .season-btn.active {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }

    /* ── CHECKLIST ── */
    .checklist {
      list-style: none;
    }

    .checklist li {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      padding: 5px 0;
      border-bottom: 1px solid var(--border-light);
      font-size: 12px;
      color: var(--text-2);
    }

    .checklist li:last-child {
      border-bottom: none;
    }

    .checklist li::before {
      content: "☐";
      color: var(--text-3);
      flex-shrink: 0;
      margin-top: 1px;
    }

    /* ── HR ── */
    hr {
      border: none;
      border-top: 1px solid var(--border-light);
      margin: 16px 0;
    }

    /* ── MOBILE ── */
    @media (max-width: 768px) {

      /* Topbar: logo above scrollable nav */
      .topbar {
        flex-direction: column;
        height: auto;
        padding: 8px 12px 0;
        align-items: flex-start;
        gap: 0;
      }

      .logo {
        margin-right: 0;
        margin-bottom: 4px;
        font-size: 11px;
      }

      .nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        display: flex;
        flex-wrap: nowrap;
      }

      .nav::-webkit-scrollbar {
        display: none;
      }

      .nav-btn {
        padding: 0 11px;
        height: 36px;
        font-size: 11px;
        flex-shrink: 0;
      }

      /* Content padding */
      .content {
        padding: 16px 12px 40px;
      }

      /* Grids collapse to single column */
      .g2, .g3, .g4 {
        grid-template-columns: 1fr;
      }

      /* Week overview: stack days vertically */
      .week-grid {
        grid-template-columns: 1fr;
      }

      /* Timeline: tighten up */
      .tl-time {
        min-width: 38px;
        font-size: 10px;
        padding-right: 8px;
      }

      .tl-block {
        padding: 8px 10px;
      }

      .tl-title {
        font-size: 11px;
      }

      .tl-desc {
        font-size: 10px;
      }

      /* Badges wrap naturally — just allow it */
      .badge {
        display: inline-block;
        margin-top: 2px;
      }

      /* Outcome cards (3-col → 1-col) */
      .outcome-row {
        grid-template-columns: 1fr;
      }

      /* Triage grid (2-col → 1-col) */
      .triage-grid {
        grid-template-columns: 1fr;
      }

      /* TZ visualiser: smaller label, bars taller, text nowrap */
      .tz-viz-label {
        min-width: 80px;
        font-size: 9px;
      }

      .tz-header-row {
        padding-left: 88px;
      }

      .tz-track {
        height: 22px;
      }

      .tz-seg {
        white-space: nowrap;
        font-size: 8px;
      }

      /* Tables: allow horizontal scroll */
      .tbl-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        -webkit-overflow-scrolling: touch;
      }

      .card.tbl-wrap {
        overflow-x: auto !important;
      }

      .tbl {
        min-width: 480px;
      }

      /* Sub-nav tabs (Weekly Structure days) */
      .sub-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
      }

      .sub-nav::-webkit-scrollbar {
        display: none;
      }

      /* Page title */
      .page-title {
        font-size: 15px;
      }

      .page-sub {
        font-size: 11px;
      }

      /* Section labels */
      .section-label {
        font-size: 9px;
      }
    }

    /* ── DURATION LABEL (top-right corner of tl-block) ── */
    .tl-duration {
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 10px;
      font-weight: 500;
      color: var(--text-3);
      letter-spacing: 0.02em;
      line-height: 1;
      white-space: nowrap;
    }
