    :root {
      color-scheme: light;
      --ink: #17324d;
      --muted: #5f7283;
      --line: #d5e4ea;
      --panel: #ffffff;
      --soft: #eef7fa;
      --brand: #007c89;
      --brand-dark: #005f6b;
      --brand-blue: #0067a6;
      --accent: #f3b229;
      --warn: #9f4f13;
      --warn-soft: #fff6e5;
      --ok-soft: #e8f6f3;
      --shadow: 0 16px 34px rgba(23, 50, 77, 0.1);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      font-family: Roboto, Arial, ui-sans-serif, system-ui, sans-serif;
      background:
        linear-gradient(180deg, #eef8fb 0, rgba(246, 251, 253, 0) 344px),
        #f6fbfd;
      color: var(--ink);
      line-height: 1.5;
    }

    button,
    input {
      font: inherit;
    }

    button {
      border: 0;
      cursor: pointer;
    }

    .app-shell {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    .topbar {
      background: #ffffff;
      border-bottom: 4px solid var(--brand);
      box-shadow: 0 2px 12px rgba(23, 50, 77, 0.06);
    }

    .topbar-inner,
    main {
      width: min(1180px, calc(100% - 32px));
      margin: 0 auto;
    }

    .topbar-inner {
      min-height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      color: var(--brand-dark);
      font-weight: 700;
    }

    .brand-mark {
      width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      border-radius: 8px;
      background: linear-gradient(135deg, var(--brand), var(--brand-blue));
      color: white;
      font-weight: 700;
    }

    .topbar-meta {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 10px;
    }


    .privacy-pill {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--brand-dark);
      background: #eef9f8;
      border: 1px solid #bddfdc;
      border-radius: 999px;
      padding: 7px 12px;
      font-size: 0.9rem;
      font-weight: 500;
      white-space: nowrap;
    }

    main {
      flex: 1;
      padding: 34px 0 56px;
    }

    .view {
      display: none;
    }

    .view.active {
      display: block;
    }

    .page-heading {
      margin-bottom: 22px;
    }

    h1 {
      margin: 0 0 8px;
      font-size: clamp(2rem, 4vw, 3.4rem);
      line-height: 1.05;
      color: var(--ink);
    }

    h2 {
      margin: 0 0 12px;
      font-size: 1.2rem;
    }

    h3 {
      margin: 0 0 10px;
      font-size: 1rem;
    }

    p {
      margin: 0;
    }

    .lede {
      max-width: 760px;
      color: var(--muted);
      font-size: 1rem;
    }

    .home-subtitle {
      margin: 4px 0 0;
      font-size: 0.9rem;
      color: var(--muted);
    }

    .site-footer {
      padding: 18px 0;
      text-align: center;
      color: var(--muted);
      font-size: 0.82rem;
      border-top: 1px solid var(--line);
    }
    .site-footer a { color: inherit; }

    .tool-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(250px, 1fr));
      gap: 16px;
      margin-top: 28px;
    }

    .tool-tile {
      min-height: 168px;
      text-align: left;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 22px;
      box-shadow: var(--shadow);
      transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
    }

    .tool-tile:hover,
    .tool-tile:focus-visible {
      transform: translateY(-2px);
      box-shadow: 0 20px 42px rgba(23, 50, 77, 0.15);
      border-color: var(--brand);
      outline: none;
    }

    .tool-icon {
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      border-radius: 8px;
      background: #e5f4f6;
      color: var(--brand);
      margin-bottom: 18px;
    }

    .tool-title {
      display: block;
      font-size: 1.2rem;
      font-weight: 700;
      margin-bottom: 8px;
    }

    .tool-copy {
      display: block;
      color: var(--muted);
    }


    .back-row {
      margin-bottom: 18px;
    }

    .ghost-button,
    .primary-button,
    .secondary-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 40px;
      border-radius: 8px;
      padding: 9px 14px;
      font-weight: 700;
    }

    .ghost-button {
      background: transparent;
      color: var(--brand-blue);
    }

    .primary-button {
      background: var(--brand-blue);
      color: #ffffff;
      box-shadow: 0 8px 18px rgba(0, 103, 166, 0.22);
    }

    .secondary-button {
      background: #ffffff;
      color: var(--brand-blue);
      border: 1px solid var(--line);
    }

    .primary-button:disabled,
    .secondary-button:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .workspace {
      display: grid;
      grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
      gap: 18px;
      align-items: start;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 20px;
      box-shadow: var(--shadow);
    }

    .result-panel {
      margin-top: 18px;
    }

    .instructions {
      display: grid;
      gap: 12px;
      color: var(--ink);
    }

    .instructions ol {
      margin: 0;
      padding-left: 22px;
    }

    .instructions li + li {
      margin-top: 8px;
    }

    .trust-badges {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
      gap: 10px;
    }

    .trust-badge {
      min-height: 86px;
      display: grid;
      align-content: center;
      justify-items: center;
      gap: 6px;
      text-align: center;
      border: 1px solid #bddfdc;
      border-radius: 8px;
      background: #f7fcfb;
      color: var(--brand-dark);
      padding: 12px 10px;
    }

    .trust-badge svg {
      color: var(--brand);
    }

    .trust-badge strong {
      display: block;
      font-size: 0.82rem;
      line-height: 1.2;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .local-note {
      margin-top: 14px;
      padding: 12px;
      border: 1px solid #bddfdc;
      border-radius: 8px;
      background: var(--ok-soft);
      color: var(--brand-dark);
      font-size: 0.9rem;
      font-weight: 500;
    }

    .keyword-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
    }

    .keyword-pill {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: #f4f9fb;
      color: var(--ink);
      padding: 5px 9px;
      font-size: 0.82rem;
      font-weight: 700;
    }

    .upload-box {
      display: grid;
      gap: 14px;
    }

    .file-input {
      width: 100%;
      min-height: 112px;
      display: grid;
      place-items: center;
      text-align: center;
      padding: 18px;
      border: 2px dashed #8fc7cf;
      border-radius: 8px;
      background: #f2fafc;
      color: var(--ink);
    }

    .file-input input {
      width: 100%;
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .status {
      min-height: 24px;
      color: var(--muted);
      font-weight: 500;
    }

    .status.error {
      color: var(--warn);
    }

    .summary-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(120px, 1fr));
      gap: 12px;
      margin-bottom: 18px;
    }

    .metric {
      background: #f2fafc;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 13px;
    }

    .metric-value {
      display: block;
      font-size: 1.6rem;
      font-weight: 700;
      line-height: 1.1;
      color: var(--brand-dark);
    }

    .metric-label {
      display: block;
      color: var(--muted);
      font-size: 0.9rem;
      margin-top: 4px;
    }

    .table-section + .table-section {
      margin-top: 24px;
    }

    .accordion-section {
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background: #fff;
    }

    .accordion-section + .accordion-section {
      margin-top: 10px;
    }

    .accordion-header {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 16px;
      background: var(--panel);
      border: none;
      border-bottom: 1px solid transparent;
      cursor: pointer;
      text-align: left;
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text);
      font-family: inherit;
    }

    .accordion-header:hover {
      background: #eef0f2;
    }

    .accordion-header.open {
      border-bottom-color: var(--line);
    }

    .accordion-caret {
      font-size: 0.7rem;
      color: var(--muted);
      transition: transform 0.15s;
      flex-shrink: 0;
    }

    .accordion-header.open .accordion-caret {
      transform: rotate(90deg);
    }

    .accordion-count {
      margin-left: auto;
      background: var(--muted);
      color: #fff;
      border-radius: 10px;
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 8px;
      flex-shrink: 0;
    }

    .accordion-body .table-wrap {
      border: none;
      border-radius: 0;
    }

    .cpt-discrepancy-table { table-layout: fixed; }
    .cpt-discrepancy-table th:nth-child(1) { width: 8%; }
    .cpt-discrepancy-table th:nth-child(2) { width: 10%; }
    .cpt-discrepancy-table th:nth-child(3) { width: 9%; }
    .cpt-discrepancy-table th:nth-child(4) { width: 25%; }
    .cpt-discrepancy-table th:nth-child(5) { width: 25%; }
    .cpt-discrepancy-table th:nth-child(6) { width: 23%; }

    .equipment-missing-table th:nth-child(1) { width: 8%; }
    .equipment-missing-table th:nth-child(2) { width: 12%; }
    .equipment-missing-table th:nth-child(3) { width: 9%; }
    .equipment-missing-table th:nth-child(4) { width: 11%; }
    .equipment-missing-table th:nth-child(5) { width: 28%; }
    .equipment-missing-table th:nth-child(6) { width: 32%; }

    .table-wrap {
      overflow-x: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #ffffff;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      min-width: 680px;
    }

    th,
    td {
      padding: 11px 12px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      vertical-align: top;
    }

    th {
      background: #eaf5f8;
      font-size: 0.82rem;
      color: var(--ink);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    tr:last-child td {
      border-bottom: 0;
    }

    .empty-row td {
      color: var(--muted);
      font-style: italic;
    }

    .error-row td {
      background: var(--warn-soft);
      color: var(--warn);
      font-weight: 700;
      border-left: 4px solid var(--accent);
    }

    .code-list {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.9rem;
      white-space: normal;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 3px 9px;
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      white-space: nowrap;
    }

    .badge-tier-1 {
      background: #fce8e8;
      color: #b91c1c;
      border: 1px solid #fca5a5;
    }

    .badge-tier-2 {
      background: #fff3ed;
      color: #c2410c;
      border: 1px solid #fdba74;
    }

    .badge-tier-3 {
      background: #fff8e1;
      color: #92400e;
      border: 1px solid #fcd34d;
    }

    .badge-tier-4 {
      background: #eff6ff;
      color: #1e40af;
      border: 1px solid #bfdbfe;
    }

    .badge-tier-5 {
      background: #f8f9fa;
      color: #4b5563;
      border: 1px solid #d1d5db;
    }

    /* ── Results top: calendar left + metrics stack right ───────── */
    .results-top {
      display: flex;
      gap: 16px;
      align-items: stretch;
      margin-bottom: 20px;
    }
    .summary-stack {
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex: 1;
    }
    .summary-stack .metric {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    /* ── Violation table rows are clickable ──────────────────────── */
    tr[class*="violation-tier"] { cursor: pointer; }
    tr[class*="violation-tier"]:hover td { filter: brightness(0.94); }
    tr[class*="violation-tier"] td:nth-child(4) { white-space: nowrap; }
    .equip-row-main td:nth-child(2) { white-space: nowrap; }

    /* ── Gantt block highlight (from table row click) ────────────── */
    @keyframes gantt-highlight-pulse {
      0%   { box-shadow: 0 0 0 2px #2563eb; }
      50%  { box-shadow: 0 0 0 5px rgba(37,99,235,0.5); }
      100% { box-shadow: 0 0 0 2px #2563eb; }
    }
    .gantt-block-highlight {
      animation: gantt-highlight-pulse 0.65s ease 2;
      z-index: 4 !important;
    }

    .violation-tier-1 td {
      background: #fff5f5;
      border-left: 4px solid #ef4444;
    }

    .violation-tier-2 td {
      background: #fff7f0;
      border-left: 4px solid #f97316;
    }

    .violation-tier-3 td {
      background: #fffbeb;
      border-left: 4px solid #f59e0b;
    }

    .violation-tier-4 td {
      background: #f0f7ff;
      border-left: 4px solid #60a5fa;
    }

    .violation-tier-5 td {
      background: #f9fafb;
      border-left: 4px solid #9ca3af;
    }

    .date-separator td {
      background: var(--soft);
      color: var(--muted);
      font-size: 0.82rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      padding: 6px 12px;
      border-top: 2px solid var(--line);
      border-left: none;
    }

    /* ── Gantt legend ────────────────────────────────────────── */
    .gantt-legend {
      width: 140px;
      flex-shrink: 0;
      padding: 12px 14px;
      display: flex;
      flex-direction: column;
    }
    .gantt-legend-title {
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 8px;
    }
    .gantt-legend-entry {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 0.78rem;
      color: var(--ink);
      margin-bottom: 5px;
    }
    .gantt-legend-swatch {
      flex-shrink: 0;
      width: 18px;
      height: 12px;
      border-radius: 3px;
      border: 1px solid transparent;
    }

    /* ── Gantt chart ─────────────────────────────────────────── */
    .gantt-section { margin-bottom: 28px; }

    .gantt-body {
      display: flex;
      gap: 16px;
      align-items: flex-start;
    }
    .gantt-cal-col { flex-shrink: 0; }
    .gantt-main    { flex: 1; min-width: 0; }

    .gantt-calendar { display: block; }

    .gantt-cal-month {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px 14px 14px;
      background: var(--panel);
      min-width: 210px;
    }

    .gantt-cal-nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    .gantt-cal-month-label {
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--ink);
    }
    .gantt-cal-nav-btn {
      background: none;
      border: 1px solid var(--line);
      border-radius: 4px;
      cursor: pointer;
      color: var(--muted);
      padding: 1px 8px;
      font-size: 1rem;
      line-height: 1.5;
    }
    .gantt-cal-nav-btn:hover:not(:disabled) { color: var(--ink); background: var(--soft); }
    .gantt-cal-nav-btn:disabled { opacity: 0.3; cursor: default; }

    .gantt-cal-dow {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      margin-bottom: 3px;
    }
    .gantt-cal-dow span {
      text-align: center;
      font-size: 0.72rem;
      font-weight: 500;
      color: var(--muted);
      padding: 2px 0;
    }

    .gantt-cal-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      grid-auto-rows: 26px;
      gap: 2px;
      height: 166px; /* fixed: 6 rows × 26px + 5 × 2px gaps */
      align-content: start;
    }

    .gantt-cal-cell {
      text-align: center;
      border-radius: 5px;
      padding: 4px 2px;
      font-size: 0.82rem;
      font-weight: 500;
      line-height: 1.4;
      border: 1px solid transparent;
    }
    .gantt-cal-cell-empty { color: transparent; pointer-events: none; }
    .gantt-cal-cell-no-case { color: #c4cdd5; pointer-events: none; }
    .gantt-cal-cell-green {
      background: #e8f6f3; color: #065f46;
      border-color: #6ee7b7; cursor: pointer;
    }
    .gantt-cal-cell-amber {
      background: #fff8e1; color: #92400e;
      border-color: #fcd34d; cursor: pointer;
    }
    .gantt-cal-cell-red {
      background: #fce8e8; color: #b91c1c;
      border-color: #fca5a5; cursor: pointer;
    }
    .gantt-cal-cell-green:hover,
    .gantt-cal-cell-amber:hover,
    .gantt-cal-cell-red:hover { opacity: 0.72; }
    .gantt-cal-cell.active { box-shadow: 0 0 0 2px var(--brand); font-weight: 700; }

    .gantt-container {
      display: flex;
      border: 1px solid var(--line);
      border-radius: 6px;
      overflow: hidden;
    }

    .gantt-fixed-col {
      flex-shrink: 0;
      width: 72px;
      background: #dce7ef;
      border-right: 1px solid var(--line);
    }

    .gantt-scrollable { flex: 1; overflow-x: auto; }

    .gantt-corner {
      height: 28px;
      border-bottom: 1px solid var(--line);
    }

    .gantt-room-label {
      height: 52px;
      display: flex;
      align-items: center;
      padding: 0 8px;
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--ink);
      border-bottom: 1px solid var(--line);
      white-space: nowrap;
    }

    .gantt-time-axis {
      position: relative;
      height: 28px;
      border-bottom: 1px solid var(--line);
      background: #f0f6fa;
    }

    .gantt-time-tick {
      position: absolute;
      top: 7px;
      font-size: 0.72rem;
      color: var(--muted);
      transform: translateX(-50%);
      white-space: nowrap;
      pointer-events: none;
    }

    .gantt-lane {
      position: relative;
      height: 52px;
      border-bottom: 1px solid var(--line);
      background: #ffffff;
    }
    .gantt-lane-alt { background: #f7fbfc; }

    .gantt-lane-gridline {
      position: absolute;
      top: 0; bottom: 0;
      width: 1px;
      background: #e5eef3;
      pointer-events: none;
    }

    .gantt-ref-line {
      position: absolute;
      top: 0; bottom: 0;
      width: 0;
      border-left: 2px dashed #aac4d0;
      pointer-events: none;
      z-index: 1;
    }

    .gantt-case-block {
      position: absolute;
      top: 5px;
      height: 42px;
      border-radius: 4px;
      cursor: pointer;
      overflow: hidden;
      display: flex;
      flex-direction: row;
      align-items: stretch;
      box-sizing: border-box;
      z-index: 2;
    }
    .gantt-case-block:hover { filter: brightness(0.91); }

    /* Violation tiers: proc segment (lighter), prep/cleanup (darker) */
    .gantt-block-prep    { background: #c4a97d; flex-shrink: 0; }
    .gantt-block-cleanup { background: #c4a97d; flex-shrink: 0; }
    .gantt-block-proc    { background: #e8d5b0; flex: 1; min-width: 0; }

    .gantt-viol-1 .gantt-block-proc              { background: #fce8e8; }
    .gantt-viol-1 .gantt-block-prep,
    .gantt-viol-1 .gantt-block-cleanup            { background: #fca5a5; }
    .gantt-viol-2 .gantt-block-proc              { background: #fff3ed; }
    .gantt-viol-2 .gantt-block-prep,
    .gantt-viol-2 .gantt-block-cleanup            { background: #fdba74; }
    .gantt-viol-3 .gantt-block-proc              { background: #fff8e1; }
    .gantt-viol-3 .gantt-block-prep,
    .gantt-viol-3 .gantt-block-cleanup            { background: #fcd34d; }
    .gantt-viol-4 .gantt-block-proc              { background: #eff6ff; }
    .gantt-viol-4 .gantt-block-prep,
    .gantt-viol-4 .gantt-block-cleanup            { background: #bfdbfe; }
    .gantt-viol-5 .gantt-block-proc              { background: #f8f9fa; }
    .gantt-viol-5 .gantt-block-prep,
    .gantt-viol-5 .gantt-block-cleanup            { background: #d1d5db; }

    /* Text overlay: absolutely positioned, spans the full tile so text starts at left edge */
    .gantt-block-text {
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      justify-content: center;
      overflow: hidden;
      padding: 1px 4px;
    }
    .gantt-block-surgeon {
      font-size: 0.68rem;
      font-weight: 700;
      color: var(--ink);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.25;
    }
    .gantt-block-proctxt {
      font-size: 0.68rem;
      font-weight: 400;
      color: var(--ink);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.25;
    }
    .gantt-block-casenum {
      font-size: 0.68rem;
      font-weight: 700;
      color: var(--ink);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.25;
    }

    .gantt-tooltip {
      position: fixed;
      z-index: 9000;
      background: #17324d;
      color: #ffffff;
      border-radius: 6px;
      padding: 10px 13px;
      font-size: 0.82rem;
      line-height: 1.45;
      max-width: 320px;
      pointer-events: none;
      box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    }
    .gantt-tooltip strong { display: block; margin-bottom: 3px; font-size: 0.82rem; }
    .gantt-tooltip .tt-row { color: #c7dde8; }
    .gantt-tooltip .tt-viol-header {
      color: #fca5a5; margin-top: 7px; font-weight: 700;
      border-top: 1px solid rgba(255,255,255,0.12); padding-top: 6px;
    }
    .gantt-tooltip .tt-viol-item { margin-top: 5px; }
    .gantt-tooltip .tt-viol-label { color: #ffd0a0; font-weight: 500; font-size: 0.75rem; }
    .gantt-tooltip .tt-viol-expl  { color: #c7dde8; font-size: 0.75rem; line-height: 1.35; margin-top: 1px; }

    .gantt-sidebar {
      position: fixed;
      top: 0; right: 0; bottom: 0;
      width: 340px;
      background: var(--panel);
      border-left: 1px solid var(--line);
      box-shadow: -4px 0 20px rgba(0,0,0,0.12);
      z-index: 8000;
      overflow-y: auto;
      padding: 22px 20px 30px;
    }
    .gantt-sidebar-close {
      position: absolute;
      top: 14px; right: 14px;
      background: none;
      border: none;
      cursor: pointer;
      color: var(--muted);
      font-size: 1.2rem;
      line-height: 1;
      padding: 4px;
    }
    .gantt-sidebar-close:hover { color: var(--ink); }
    .gantt-sidebar h3 { margin: 0 32px 14px 0; color: var(--ink); font-size: 1rem; }
    .gantt-sidebar .sb-row {
      display: flex;
      gap: 8px;
      margin-bottom: 7px;
      font-size: 0.82rem;
      align-items: flex-start;
    }
    .gantt-sidebar .sb-label { color: var(--muted); flex-shrink: 0; width: 90px; }
    .gantt-sidebar .sb-val { color: var(--ink); }
    .gantt-sidebar .sb-violations { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
    .gantt-sidebar .sb-violations h4 { font-size: 0.82rem; color: var(--muted); margin: 0 0 10px; }
    .gantt-sidebar .sb-viol-item { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
    .gantt-sidebar .sb-viol-text { font-size: 0.82rem; color: var(--ink); line-height: 1.4; }
    .gantt-sidebar .sb-view-btn {
      display: block;
      width: 100%;
      margin: 14px 0 4px;
      padding: 7px 12px;
      background: none;
      border: 1px solid var(--brand);
      border-radius: 5px;
      color: var(--brand-dark);
      font-size: 0.82rem;
      font-weight: 500;
      cursor: pointer;
      text-align: center;
    }
    .gantt-sidebar .sb-view-btn:hover { background: var(--brand); color: #ffffff; }

    /* ── Day navigation ──────────────────────────────────────────── */
    .gantt-day-nav {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-top: 10px;
    }
    .gantt-day-nav-btn {
      background: none;
      border: 1px solid var(--line);
      border-radius: 4px;
      cursor: pointer;
      color: var(--muted);
      padding: 1px 10px;
      font-size: 1rem;
      line-height: 1.5;
    }
    .gantt-day-nav-btn:hover:not(:disabled) { color: var(--ink); background: var(--soft); }
    .gantt-day-nav-btn:disabled { opacity: 0.3; cursor: default; }
    .gantt-day-nav-label {
      font-size: 0.9rem;
      font-weight: 500;
      color: var(--ink);
      min-width: 220px;
      text-align: center;
    }

    /* ── Rule Management ─────────────────────────────────────────── */
    .rule-tier-section { margin-bottom: 28px; }
    .rule-tier-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      padding-bottom: 6px;
      border-bottom: 2px solid var(--line);
    }
    .rule-tier-header h3 { margin: 0; font-size: 1rem; color: var(--ink); }
    .rule-tier-desc { font-size: 0.82rem; color: var(--muted); }
    .rule-cards { display: flex; flex-direction: column; gap: 8px; }
    .rule-card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 12px 14px;
      display: grid;
      grid-template-columns: auto 1fr auto;
      gap: 8px 14px;
      align-items: start;
    }
    .rule-card-badge { padding-top: 1px; }
    .rule-card-main { min-width: 0; }
    .rule-card-label {
      font-weight: 700;
      font-size: 0.9rem;
      color: var(--ink);
      margin-bottom: 3px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .rule-card-match {
      font-size: 0.75rem;
      color: var(--muted);
      margin-bottom: 4px;
      word-break: break-word;
    }
    .rule-card-rooms { font-size: 0.75rem; color: var(--ink); }
    .rule-card-meta {
      display: flex;
      gap: 14px;
      font-size: 0.75rem;
      color: var(--muted);
      margin-top: 5px;
    }
    .rule-card-actions {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 6px;
      min-width: 110px;
    }
    .rule-flag-btn {
      background: none;
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 3px 10px;
      font-size: 0.75rem;
      cursor: pointer;
      color: var(--muted);
      white-space: nowrap;
    }
    .rule-flag-btn:hover { background: var(--soft); }
    .copy-case { cursor: pointer; }
    .copy-case:hover { opacity: 0.7; }
    .row-visited { background-color: #f0f7f0 !important; }
    .rule-info-section { margin-bottom: 22px; }
    .rule-info-section h3 { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin: 0 0 5px; }
    .rule-info-section p { font-size: 0.875rem; color: var(--muted); line-height: 1.65; margin: 0; }
    .rule-note-input {
      width: 100%;
      box-sizing: border-box;
      font-size: 0.75rem;
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 4px 7px;
      resize: vertical;
      min-height: 38px;
      color: var(--ink);
      background: var(--bg);
      font-family: inherit;
    }
    .rule-note-input:focus { outline: none; border-color: var(--brand); }

    /* ── Equipment audit expand/collapse ────────────────────────── */
    .equip-row-main { cursor: pointer; }
    .equip-row-main:hover td { filter: brightness(0.96); }
    .equip-toggle-affordance {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-top: auto;
      align-self: flex-start;
      width: fit-content;
      cursor: pointer;
      user-select: none;
    }
    .equip-toggle-icon {
      font-size: 0.6rem;
      color: var(--muted);
      transition: transform 120ms ease;
      transform-origin: center;
      line-height: 1;
      flex-shrink: 0;
    }
    .equip-toggle-label {
      font-size: 0.65rem;
      color: var(--muted);
      line-height: 1;
    }
    .equip-row-main.expanded .equip-toggle-icon { transform: rotate(90deg); }
    #copyToast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(30,30,30,0.88);
      color: #fff;
      font-size: 0.78rem;
      padding: 7px 16px;
      border-radius: 6px;
      pointer-events: none;
      opacity: 0;
      transition: opacity 180ms ease;
      z-index: 9998;
      white-space: nowrap;
    }
    #copyToast.visible { opacity: 1; }
    .equip-detail-row td {
      background: #f4f9fb;
      padding: 0;
      border-left: none;
    }
    .equip-detail {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 18px;
      padding: 14px 16px 16px;
    }
    .equip-detail-label {
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 5px;
    }
    .equip-detail-value {
      font-size: 0.82rem;
      color: var(--ink);
      line-height: 1.55;
      white-space: pre-line;
    }

    @media (max-width: 820px) {
      .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding: 12px 0;
      }

      .topbar-meta {
        justify-content: flex-start;
      }

      .privacy-pill {
        white-space: normal;
      }

      .workspace {
        grid-template-columns: 1fr;
      }

      .summary-grid {
        grid-template-columns: 1fr;
      }
    }
    #wormModal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.88);
      z-index: 9999;
      align-items: center;
      justify-content: center;
    }
    #wormModal.active { display: flex; }
    #wormGame {
      background: #111;
      border-radius: 10px;
      padding: 20px 24px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      position: relative;
    }
    #wormCanvas { display: block; background: #000; border-radius: 4px; }
    #wormScore { color: #4ade80; font-family: monospace; font-size: 1rem; letter-spacing: 0.05em; }
    #wormGameOver {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.75);
      border-radius: 10px;
      justify-content: center;
      color: #fff;
      font-family: monospace;
    }
    #wormGameOver p { margin: 0; font-size: 1.1rem; }
    #wormFinalScore { color: #4ade80; font-size: 0.9rem; }
    #wormRestartBtn {
      margin-top: 4px;
      background: #4ade80;
      color: #000;
      border: none;
      border-radius: 4px;
      padding: 6px 18px;
      font-size: 0.85rem;
      font-family: monospace;
      cursor: pointer;
      font-weight: 700;
    }
    #wormRestartBtn:hover { background: #86efac; }
    .dev-gate-overlay {
      position: fixed;
      inset: 0;
      background: #ffffff;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .dev-gate-overlay[hidden] { display: none; }
    .dev-gate-prod-link {
      font-size: 1rem;
      color: var(--brand-blue);
    }
    .dev-pill {
      color: var(--warn);
      background: var(--warn-soft);
      border-color: var(--accent);
      font-weight: 700;
      letter-spacing: 0.06em;
    }
    .dev-pill[hidden] { display: none; }
