/* Telemetee course operations portal, served by `course-admin serve` (design: docs/admin-portal).
   Graphite neutrals (chroma 0) and the portal tokens from DESIGN.md section 9. Signal green/lime means one thing here:
   "players receive this" (live publication and the act of publishing). Everything else is ink. */
@font-face { font-family: "B612 Mono"; src: url("fonts/B612Mono-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("fonts/B612Mono-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
:root {
  color-scheme: light;
  --bg: oklch(0.985 0 0);
  --surface: oklch(1 0 0);
  --side: oklch(0.955 0 0);
  --sunk: oklch(0.965 0 0);
  --hover: oklch(0.94 0 0);
  --ink: oklch(0.17 0 0);
  --muted: oklch(0.43 0 0);
  --rule: oklch(0.88 0 0);
  --rule-strong: oklch(0.78 0 0);
  --btn: oklch(0.2 0 0);
  --on-btn: oklch(1 0 0);
  --focus: oklch(0.45 0.13 135);

  --live: oklch(0.43 0.13 135);
  --on-live: oklch(1 0 0);
  --live-text: oklch(0.40 0.12 135);
  --live-wash: oklch(0.95 0.05 130);
  --live-line: oklch(0.78 0.1 130);

  --warn-text: oklch(0.47 0.12 60);
  --warn-wash: oklch(0.96 0.045 80);
  --warn-line: oklch(0.8 0.1 75);
  --bad-text: oklch(0.49 0.17 27);
  --bad-wash: oklch(0.965 0.025 25);
  --bad-line: oklch(0.8 0.08 25);
  --info-text: oklch(0.46 0.13 250);
  --info-wash: oklch(0.96 0.025 250);
  --info-line: oklch(0.8 0.07 250);

  --map-ground: oklch(0.95 0 0);
  --poly-boundary: oklch(0.985 0 0);
  --poly-fw: oklch(0.83 0.08 135);
  --poly-gr: oklch(0.70 0.12 135);
  --poly-tee: oklch(0.78 0.08 135);
  --poly-bk: oklch(0.90 0.05 85);
  --poly-bk-edge: oklch(0.72 0.06 85);
  --poly-wt: oklch(0.72 0.07 235);
  --map-line: oklch(0.2 0 0);
  --map-added: oklch(0.5 0.15 250);


  --f-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --f-num: "B612 Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --shadow-pop: 0 10px 30px oklch(0 0 0 / 0.14), 0 2px 6px oklch(0 0 0 / 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-sticky: 10;
  --z-popover: 20;
  --z-backdrop: 30;
  --z-dialog: 40;
  --z-toast: 50;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: oklch(0.15 0 0); --surface: oklch(0.185 0 0); --side: oklch(0.13 0 0); --sunk: oklch(0.165 0 0); --hover: oklch(0.23 0 0);
    --ink: oklch(0.95 0 0); --muted: oklch(0.74 0 0); --rule: oklch(0.29 0 0); --rule-strong: oklch(0.4 0 0);
    --btn: oklch(0.95 0 0); --on-btn: oklch(0.15 0 0); --focus: oklch(0.89 0.18 125);
    --live: oklch(0.89 0.18 125); --on-live: oklch(0.15 0.03 125); --live-text: oklch(0.89 0.18 125); --live-wash: oklch(0.24 0.05 125); --live-line: oklch(0.45 0.1 125);
    --warn-text: oklch(0.85 0.13 75); --warn-wash: oklch(0.24 0.045 75); --warn-line: oklch(0.48 0.09 75);
    --bad-text: oklch(0.78 0.13 27); --bad-wash: oklch(0.24 0.05 25); --bad-line: oklch(0.47 0.11 25);
    --info-text: oklch(0.8 0.1 250); --info-wash: oklch(0.23 0.04 250); --info-line: oklch(0.45 0.09 250);
    --map-ground: oklch(0.17 0 0); --poly-boundary: oklch(0.205 0 0); --poly-fw: oklch(0.30 0.05 135); --poly-gr: oklch(0.42 0.08 135); --poly-tee: oklch(0.34 0.05 135);
    --poly-bk: oklch(0.55 0.03 85); --poly-bk-edge: oklch(0.65 0.03 85); --poly-wt: oklch(0.36 0.06 235); --map-line: oklch(0.96 0 0); --map-added: oklch(0.78 0.12 250);
    --shadow-pop: 0 10px 30px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.15 0 0); --surface: oklch(0.185 0 0); --side: oklch(0.13 0 0); --sunk: oklch(0.165 0 0); --hover: oklch(0.23 0 0);
  --ink: oklch(0.95 0 0); --muted: oklch(0.74 0 0); --rule: oklch(0.29 0 0); --rule-strong: oklch(0.4 0 0);
  --btn: oklch(0.95 0 0); --on-btn: oklch(0.15 0 0); --focus: oklch(0.89 0.18 125);
  --live: oklch(0.89 0.18 125); --on-live: oklch(0.15 0.03 125); --live-text: oklch(0.89 0.18 125); --live-wash: oklch(0.24 0.05 125); --live-line: oklch(0.45 0.1 125);
  --warn-text: oklch(0.85 0.13 75); --warn-wash: oklch(0.24 0.045 75); --warn-line: oklch(0.48 0.09 75);
  --bad-text: oklch(0.78 0.13 27); --bad-wash: oklch(0.24 0.05 25); --bad-line: oklch(0.47 0.11 25);
  --info-text: oklch(0.8 0.1 250); --info-wash: oklch(0.23 0.04 250); --info-line: oklch(0.45 0.09 250);
  --map-ground: oklch(0.17 0 0); --poly-boundary: oklch(0.205 0 0); --poly-fw: oklch(0.30 0.05 135); --poly-gr: oklch(0.42 0.08 135); --poly-tee: oklch(0.34 0.05 135);
  --poly-bk: oklch(0.55 0.03 85); --poly-bk-edge: oklch(0.65 0.03 85); --poly-wt: oklch(0.36 0.06 235); --map-line: oklch(0.96 0 0); --map-added: oklch(0.78 0.12 250);
  --shadow-pop: 0 10px 30px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 14px; line-height: 1.35; font-weight: 650; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 2px; }
code, .mono { font-family: var(--f-num); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; font: inherit; color: inherit; }
.skip { position: absolute; left: 12px; top: -60px; z-index: var(--z-toast); background: var(--btn); color: var(--on-btn); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 18px 12px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--btn); color: var(--on-btn); display: grid; place-items: center; font: 700 13px/1 var(--f-num); }
.brand-name { font-weight: 650; font-size: 14px; line-height: 1.2; }
.brand-sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.nav svg { width: 16px; height: 16px; flex: none; }
.nav .count { margin-left: auto; font: 500 11.5px/1 var(--f-num); color: var(--muted); }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.env { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12px; line-height: 1.4; background: var(--surface); }
.env strong { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.env .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.env span { color: var(--muted); word-break: break-all; }
.who { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; text-align: left; }
.who:hover { background: var(--hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--btn); color: var(--on-btn); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.who-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.who-mail { color: var(--muted); font-size: 12px; line-height: 1.2; display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; padding: 22px 32px 96px; }
.page { max-width: 1440px; margin: 0 auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; justify-content: space-between; padding-bottom: 18px; }
.page-head .lede { color: var(--muted); margin-top: 6px; max-width: 72ch; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.meta-line .sep { width: 1px; height: 12px; background: var(--rule-strong); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Buttons & controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-weight: 550; font-size: 13.5px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms; }
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--btn); color: var(--on-btn); border-color: var(--btn); }
.btn.primary:hover { background: color-mix(in oklch, var(--btn) 86%, var(--bg)); }
.btn.publish { background: var(--live); color: var(--on-live); border-color: var(--live); }
.btn.publish:hover { background: color-mix(in oklch, var(--live) 88%, var(--ink)); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--hover); }
.btn.danger { color: var(--bad-text); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn svg { width: 15px; height: 15px; flex: none; }
.spin { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--surface); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--bad-text); box-shadow: 0 0 0 1px var(--bad-text); }
.err-msg { color: var(--bad-text); font-size: 12.5px; font-weight: 550; display: flex; gap: 6px; align-items: flex-start; }
.err-msg::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--bad-text); color: var(--surface); font: 700 11px/1 var(--f-ui); }
.search { position: relative; flex: 1 1 320px; max-width: 460px; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }

.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); padding: 2px; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 30px; padding: 0 12px; border-radius: 4px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--on-btn); }
.seg button .num { font-size: 11.5px; opacity: 0.8; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Status vocabulary ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--rule-strong); color: var(--ink); background: var(--surface); }
.badge svg { width: 12px; height: 12px; flex: none; }
.badge.live { background: var(--live); color: var(--on-live); border-color: var(--live); }
.badge.ready { border-color: var(--rule-strong); }
.badge.draft { color: var(--muted); border-style: dashed; }
.badge.warn { color: var(--warn-text); background: var(--warn-wash); border-color: var(--warn-line); }
.badge.bad { color: var(--bad-text); background: var(--bad-wash); border-color: var(--bad-line); }
.badge.info { color: var(--info-text); background: var(--info-wash); border-color: var(--info-line); }
.badge.run { color: var(--ink); }
.badge.run .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.notice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--surface); }
.notice > svg { width: 18px; height: 18px; margin-top: 1px; }
.notice h3 { font-size: 14px; }
.notice p { color: var(--ink); }
.notice .notice-body { display: grid; gap: 4px; }
.notice .notice-actions { display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }
.notice.live { background: var(--live-wash); border-color: var(--live-line); }
.notice.live > svg { color: var(--live-text); }
.notice.warn { background: var(--warn-wash); border-color: var(--warn-line); }
.notice.warn > svg { color: var(--warn-text); }
.notice.bad { background: var(--bad-wash); border-color: var(--bad-line); }
.notice.bad > svg { color: var(--bad-text); }
.notice.info { background: var(--info-wash); border-color: var(--info-line); }
.notice.info > svg { color: var(--info-text); }
@media (max-width: 720px) { .notice { grid-template-columns: auto minmax(0, 1fr); } .notice .notice-actions { grid-column: 2; } }

.keep-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border-radius: 999px; border: 1px solid var(--live-line); background: var(--live-wash); font-size: 12.5px; font-weight: 550; }
.keep-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 2px var(--surface); }

/* ---------- Panels & tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.panel-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.panel-h p { color: var(--muted); font-size: 13px; }
.panel-b { padding: 14px 16px; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stack-lg { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

.table-wrap { overflow-x: auto; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--sunk); position: sticky; top: 0; z-index: 1; white-space: nowrap; padding-top: 8px; padding-bottom: 8px; }
.tbl tbody tr:last-child td, .tbl tbody tr:last-child th { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .sub { display: block; color: var(--muted); font-size: 12.5px; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--hover); }
.tbl tbody tr[aria-selected="true"] { background: var(--hover); box-shadow: inset 2px 0 0 var(--ink); }
.tbl a.rowlink { font-weight: 600; text-decoration: none; }
.tbl a.rowlink:hover { text-decoration: underline; }
.tbl.dense th, .tbl.dense td { padding: 7px 10px; }
.tbl .hole-n { font: 700 13px/1 var(--f-num); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule-strong); }

.dl { display: grid; grid-template-columns: minmax(140px, max-content) minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 10px; } }

.hash { font-family: var(--f-num); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.hash .full { overflow-wrap: anywhere; }
.copy { border: 0; background: transparent; color: var(--muted); padding: 2px; border-radius: 4px; cursor: pointer; display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; }
.copy:hover { color: var(--ink); background: var(--hover); }
.copy svg { width: 13px; height: 13px; }

/* ---------- Library ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.lib .course-name { font-weight: 600; font-size: 14px; }
.lib td { padding-top: 12px; padding-bottom: 12px; }
.rev-cell { display: grid; gap: 4px; justify-items: start; }
.skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--hover) 0%, var(--sunk) 50%, var(--hover) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 48px 24px; display: grid; justify-items: start; gap: 12px; max-width: 620px; margin: 0 auto; }
.empty h2 { font-size: 18px; }
.empty ol { margin: 4px 0 8px; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
@media (max-width: 760px) {
  .lib thead { display: none; }
  .lib tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
  .lib td { display: block; padding: 0; border: 0; }
  .lib td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11.5px; }
  .lib td.c-name { grid-column: 1 / -1; }
  .lib td.c-go { display: none; }
}

/* ---------- Course detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.detail-grid > .map-col { position: sticky; top: 16px; }
@media (max-width: 1180px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } .detail-grid > .map-col { position: static; } }
.map-panel { overflow: hidden; }
.map-wrap { position: relative; background: var(--map-ground); aspect-ratio: 1.55; }
@media (max-width: 640px) { .map-wrap { aspect-ratio: 1.15; } }
.map-wrap svg.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map svg, .map path { vector-effect: non-scaling-stroke; }
.map .f-boundary { fill: var(--poly-boundary); stroke: var(--rule-strong); stroke-width: 1; }
.map .f-fairway { fill: var(--poly-fw); }
.map .f-green { fill: var(--poly-gr); stroke: color-mix(in oklch, var(--poly-gr) 70%, var(--ink)); stroke-width: 0.6; }
.map .f-tee { fill: var(--poly-tee); stroke: color-mix(in oklch, var(--poly-tee) 60%, var(--ink)); stroke-width: 0.5; }
.map .f-bunker { fill: var(--poly-bk); stroke: var(--poly-bk-edge); stroke-width: 0.5; }
.map .f-water { fill: var(--poly-wt); }
.map .f-added { fill: color-mix(in oklch, var(--map-added) 28%, transparent); stroke: var(--map-added); stroke-width: 2; stroke-dasharray: 5 3; }
.map .hole-line { fill: none; stroke: var(--map-line); stroke-width: 1.4; stroke-opacity: 0.55; stroke-linecap: round; stroke-linejoin: round; }
.map .hole-line.sel { stroke-opacity: 1; stroke-width: 2.6; }
.map .hole-line.hl { stroke: var(--map-added); stroke-opacity: 1; stroke-width: 2.2; }
.map .dim { opacity: 0.35; transition: opacity 200ms var(--ease); }
.map .envelope { fill: none; stroke: var(--warn-text); stroke-width: 1.5; stroke-dasharray: 8 5; }
.map .envelope-label { font: 600 11px var(--f-ui); fill: var(--warn-text); }
.map .hole-tag circle { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; }
.map .hole-tag text { font: 700 10.5px var(--f-num); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.map .hole-tag.sel circle { fill: var(--ink); }
.map .hole-tag.sel text { fill: var(--surface); }
.map .hole-tag { cursor: pointer; }
.map .ref { fill: var(--ink); stroke: var(--surface); stroke-width: 1.5; }
.map .add-tag rect { fill: var(--map-added); }
.map .add-tag text { font: 650 11px var(--f-ui); fill: var(--surface); dominant-baseline: central; }
.map-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.map-tools .btn { box-shadow: 0 1px 2px oklch(0 0 0 / 0.08); }
.map-scale { position: absolute; left: 10px; bottom: 10px; font: 500 11px var(--f-num); color: var(--ink); background: color-mix(in oklch, var(--surface) 88%, transparent); padding: 3px 7px; border-radius: 4px; display: flex; align-items: center; gap: 6px; }
.map-scale i { display: inline-block; height: 5px; border: 1.5px solid var(--ink); border-top: 0; }
.map-attr { position: absolute; right: 8px; bottom: 6px; font-size: 10.5px; color: var(--muted); background: color-mix(in oklch, var(--surface) 88%, transparent); padding: 1px 6px; border-radius: 3px; }
.layers { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 14px; border-top: 1px solid var(--rule); font-size: 12.5px; }
.layers label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; cursor: pointer; }
.layers input { accent-color: var(--ink); }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid color-mix(in oklch, var(--ink) 25%, transparent); }
.map-caption { padding: 10px 14px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--rule); }
.metric { padding: 12px 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.metric dt { color: var(--muted); font-size: 12.5px; }
.metric dd { margin: 2px 0 0; display: flex; align-items: baseline; gap: 6px; }
.metric .v { font: 700 18px/1.2 var(--f-num); }
.metric .of { color: var(--muted); font-size: 12.5px; }
.cap-list { display: grid; gap: 0; }
.cap-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 10px 16px; border-top: 1px solid var(--rule); }
.cap-row p { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.meter { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; grid-column: 1 / -1; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.meter.none i { background: transparent; }

.par-cell { display: inline-flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.par-cell s { color: var(--muted); }
.corr { font-size: 11.5px; color: var(--info-text); font-weight: 600; white-space: nowrap; }
.par-cell .corr { text-decoration: line-through; text-decoration-thickness: 1px; }
.par-cell .corr .sr-only { text-decoration: none; }

/* ---------- Revisions ---------- */
.rev-list { display: grid; }
.rev { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 6px 18px; padding: 16px; border-top: 1px solid var(--rule); align-items: start; }
.rev:first-child { border-top: 0; }
.rev-no { font: 700 20px/1 var(--f-num); }
.rev-no small { display: block; font: 500 11.5px var(--f-ui); color: var(--muted); margin-top: 6px; }
.rev-body { display: grid; gap: 6px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.rev-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.rev-facts b { color: var(--ink); font-weight: 550; }
.lock { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; }
.lock svg { width: 13px; height: 13px; }
@media (max-width: 720px) { .rev { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Import / job ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.choice { display: grid; gap: 10px; border: 0; margin: 0; padding: 0; }
.choice legend { font-weight: 650; font-size: 15px; margin-bottom: 8px; padding: 0; }
.opt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.opt:hover { border-color: var(--rule-strong); }
.opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt > input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--ink); }
.opt .t { font-weight: 600; cursor: pointer; }
.opt .d { grid-column: 2; color: var(--muted); font-size: 13px; }
.opt .more { grid-column: 2; margin-top: 10px; display: none; cursor: auto; }
.opt:has(input[aria-invalid="true"]) { border-color: var(--bad-text); }
.opt:has(input:checked) .more { display: grid; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; align-items: start; }
@media (max-width: 760px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.cfg { font: 12px/1.55 var(--f-num); background: var(--sunk); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; white-space: pre; margin: 0; }
.err-summary { border: 1px solid var(--bad-line); background: var(--bad-wash); border-radius: var(--r-md); padding: 12px 16px; }
.err-summary h2 { font-size: 14px; color: var(--bad-text); }
.err-summary ul { margin: 6px 0 0; padding-left: 18px; }
.err-summary a { color: var(--bad-text); font-weight: 550; }
.side-note { display: grid; gap: 12px; font-size: 13px; }
.side-note h2 { font-size: 14px; }
.side-note ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 2px 14px; padding: 14px 16px; border-top: 1px solid var(--rule); position: relative; }
.step:first-child { border-top: 0; }
.step-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--rule-strong); color: var(--muted); font: 700 11px/1 var(--f-num); background: var(--surface); }
.step-ic svg { width: 13px; height: 13px; }
.step.done .step-ic { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.step.run .step-ic { border-color: var(--ink); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.step.warn .step-ic { background: var(--warn-wash); border-color: var(--warn-text); color: var(--warn-text); }
.step.bad .step-ic { background: var(--bad-text); border-color: var(--bad-text); color: var(--surface); }
.step.you .step-ic { border-color: var(--ink); color: var(--ink); background: var(--surface); box-shadow: 0 0 0 3px var(--hover); }
.step-t { font-weight: 600; }
.step.wait .step-t { color: var(--muted); font-weight: 500; }
.step-d { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.step-time { font: 500 12px var(--f-num); color: var(--muted); }
.progress { grid-column: 2 / -1; height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; width: 35%; background: var(--ink); border-radius: inherit; animation: indet 1.3s var(--ease) infinite; }
.progress.det i { animation: none; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 300ms linear; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.findings { list-style: none; margin: 0; padding: 0; }
.finding { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.finding:first-child { border-top: 0; }
.finding > svg { width: 16px; height: 16px; margin-top: 2px; }
.finding.bad > svg { color: var(--bad-text); }
.finding.warn > svg { color: var(--warn-text); }
.finding.info > svg { color: var(--info-text); }
.finding.ok > svg { color: var(--live-text); }
.finding .ft { font-weight: 600; }
.finding .fd { grid-column: 2; color: var(--muted); font-size: 13px; }
.finding .fids { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.finding .fids code { background: var(--sunk); border: 1px solid var(--rule); padding: 1px 6px; border-radius: 4px; font-size: 11.5px; }
.finding .ack { grid-column: 2; margin-top: 8px; }
.sev { font-size: 11.5px; font-weight: 650; margin-right: 6px; }
.finding.bad .sev { color: var(--bad-text); }
.finding.warn .sev { color: var(--warn-text); }
.finding.info .sev { color: var(--info-text); }

.log { font: 11.5px/1.6 var(--f-num); background: var(--sunk); border-top: 1px solid var(--rule); padding: 10px 16px; max-height: 180px; overflow: auto; color: var(--muted); margin: 0; white-space: pre-wrap; border-radius: 0 0 var(--r-md) var(--r-md); }
.log b { color: var(--ink); font-weight: 500; }

/* ---------- Review ---------- */
.compare { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); align-items: stretch; }
.compare .side-a, .compare .side-b { padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
.compare .arrow { display: grid; place-items: center; color: var(--muted); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.compare .arrow svg { width: 18px; height: 18px; }
.compare .k { color: var(--muted); font-size: 12.5px; }
.compare .badge { justify-self: start; }
.compare .rv { font: 700 22px/1.1 var(--f-num); }
@media (max-width: 720px) { .compare { grid-template-columns: minmax(0, 1fr); } .compare .arrow { border: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); height: 32px; } .compare .arrow svg { rotate: 90deg; } }
.delta-list { display: grid; }
.delta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 10px 16px; border-top: 1px solid var(--rule); align-items: baseline; }
.delta .dv { font: 600 13px var(--f-num); white-space: nowrap; }
.delta .dv.add { color: var(--info-text); }
.delta p { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.publish-box { border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--surface); }
.publish-box .panel-b { display: grid; gap: 16px; }
.publish-box ul.consequences { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.publish-box ul.consequences li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; }
.publish-box ul.consequences svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.gen { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--f-num); }
.gen svg { width: 14px; height: 14px; color: var(--muted); }
.result { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-md); border: 1px solid var(--rule); }
.result.live { background: var(--live-wash); border-color: var(--live-line); }
.result.bad { background: var(--bad-wash); border-color: var(--bad-line); }
.result.warn { background: var(--warn-wash); border-color: var(--warn-line); }
.result h2 { font-size: 17px; display: flex; gap: 10px; align-items: center; }
.result h2 svg { width: 20px; height: 20px; }
.result.live h2 svg { color: var(--live-text); }
.result.bad h2 svg { color: var(--bad-text); }
.result.warn h2 svg { color: var(--warn-text); }

/* ---------- Dialog & popover ---------- */
dialog { border: 1px solid var(--rule); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: oklch(0 0 0 / 0.38); }
dialog[open] { animation: rise 220ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.dlg-b { padding: 20px 22px; display: grid; gap: 14px; }
.dlg-f { padding: 14px 22px; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: var(--sunk); border-radius: 0 0 14px 14px; }
.menu { position: fixed; z-index: var(--z-popover); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; width: 260px; display: grid; gap: 2px; }
.menu[hidden] { display: none; }
.menu .menu-h { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; }
.menu .menu-h strong { color: var(--ink); font-size: 13.5px; }
.menu button { text-align: left; border: 0; background: transparent; padding: 8px 10px; min-height: 36px; border-radius: var(--r-sm); cursor: pointer; }
.menu button:hover { background: var(--hover); }

.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: 24px; translate: -50% 0; background: var(--btn); color: var(--on-btn); padding: 10px 16px; border-radius: var(--r-sm); font-size: 13px; box-shadow: var(--shadow-pop); animation: rise 200ms var(--ease); }

/* ---------- Sign-in ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-main { display: grid; align-content: center; padding: 48px clamp(20px, 6vw, 88px); gap: 28px; max-width: 620px; }
.auth-main .brand { padding: 0; }
.auth-main h1 { font-size: 26px; }
.auth-main .lede { color: var(--muted); font-size: 15px; max-width: 46ch; margin-top: 8px; }
.apple-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; min-width: 280px; padding: 0 24px; border-radius: 8px; border: 0; background: #000; color: #fff; font: 600 17px/1 -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif; cursor: pointer; letter-spacing: -0.01em; }
.apple-btn svg { width: 18px; height: 22px; margin-top: -3px; }
.apple-btn:hover { background: #1d1d1f; }
.apple-btn[aria-busy="true"] { opacity: 0.8; cursor: progress; }
:root[data-theme="dark"] .apple-btn { background: #fff; color: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .apple-btn { background: #fff; color: #000; } }
.auth-fine { font-size: 12.5px; color: var(--muted); max-width: 52ch; display: grid; gap: 8px; }
.auth-art { background: var(--map-ground); border-left: 1px solid var(--rule); position: relative; overflow: hidden; }
.auth-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .cap { position: absolute; left: 20px; bottom: 16px; font: 500 11.5px var(--f-num); color: var(--muted); }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-art { display: none; } .apple-btn { width: 100%; min-width: 0; } }
.request { border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); padding: 14px 16px; display: grid; gap: 10px; }

/* ---------- Prototype chrome (not part of the design) ---------- */

/* ---------- Review index (design board) ---------- */
.board { max-width: 1100px; margin: 0 auto; padding: 40px 24px 96px; display: grid; gap: 36px; }
.board-head { display: grid; gap: 10px; border-bottom: 1px solid var(--rule); padding-bottom: 24px; }
.board-head h1 { font-size: 28px; }
.board-head p { color: var(--muted); max-width: 72ch; font-size: 15px; }
.flow { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px 32px; padding-top: 4px; }
.flow h2 { font-size: 15px; }
.flow > div > p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.flow ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 24px; }
.flow li a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.flow li a:hover { text-decoration: underline; }
.flow li a span { color: var(--muted); font-size: 12px; font-family: var(--f-num); white-space: nowrap; }
@media (max-width: 760px) { .flow { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Narrow windows ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: var(--z-sticky); height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand { padding: 0 8px 0 0; }
  .brand-sub, .env, .who-text { display: none; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .nav .count { display: none; }
  .side-foot { margin: 0 0 0 auto; }
  .main { padding: 16px 16px 96px; }
}
@media (max-width: 560px) { .nav svg { display: none; } .brand-name { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .progress i { width: 100%; opacity: 0.4; }
}
h1[tabindex="-1"]:focus { outline: none; }

/* Hole change classification */
.cls { border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; }
.cls:has(input[aria-invalid="true"]), .cls:has(select[aria-invalid="true"]) { border-color: var(--bad-text); }
.cls legend { font-weight: 600; padding: 0 4px; line-height: 1.6; }
.cls legend .hole-n { vertical-align: middle; margin-right: 6px; }
.cls .hole-n { font: 700 12px/1 var(--f-num); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--rule-strong); }
.cls-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cls-opts label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); cursor: pointer; font-weight: 550; font-size: 13px; }
.cls-opts label:hover { background: var(--hover); }
.cls-opts label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cls-opts input { accent-color: var(--ink); margin: 0; }
.cls-more { display: none; gap: 10px; }
.cls:has(input[value="layout"]:checked) .cls-more[data-for="layout"],
.cls:has(input[value="replacement"]:checked) .cls-more[data-for="replacement"],
.cls:has(input[value="correction"]:checked) .cls-more[data-for="correction"] { display: grid; }
.change-tag { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.change-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid currentColor; }
.change-tag.layout { color: var(--warn-text); }
.change-tag.layout::before { background: currentColor; }
.auth.solo { grid-template-columns: minmax(0, 1fr); }
.main:focus { outline: none; }
