/* AI Adoption Map — Secure Screening Services brand (tokens from SSS-Tailwind/src/input.css) */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/montserrat-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/montserrat-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --orange: #ea5b0c;
  --orange-text: #c94e0a;
  --orange-tint: rgba(234, 91, 12, 0.14);
  --blue: #5eb0ea;
  --green: #9fbf43;
  --dark-900: #0e1723;
  --dark-800: #15293c;
  --dark-700: #183d50;
  --dark-600: #437188;
  --body: #020202;
  --muted: #484646;
  --border: #c6d3db;
  --light: #e8ecee;
  --proj: #7d9fb3; /* projected score: between now (dark-600) and potential (pale) */
  --off-white: #f5f5f5;
  --white: #fff;
  --radius: 12.5px;
  --shadow: 0 1px 2px rgba(14, 23, 35, 0.06), 0 8px 24px rgba(14, 23, 35, 0.07);
  --shadow-lift: 0 2px 4px rgba(14, 23, 35, 0.08), 0 14px 32px rgba(14, 23, 35, 0.12);
  --gradient-dark: linear-gradient(174deg, var(--dark-900) 45%, var(--dark-800) 67%, var(--dark-700) 83%, var(--dark-800) 94%);
  --gutter: clamp(16px, 1.6vw, 32px);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Montserrat", system-ui, sans-serif;
  color: var(--body);
  background-color: var(--off-white);
  /* whiteboard dot grid */
  background-image: radial-gradient(circle, #cfd9e0 1px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.45;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ── App frame ─────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
}

/* ── Top bar ───────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px var(--gutter);
  background: var(--gradient-dark);
  color: var(--white);
  position: relative;
  z-index: 3;
}

.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.logo { height: 40px; width: auto; flex: none; }
.brand-rule { width: 1px; height: 38px; background: rgba(255, 255, 255, 0.22); flex: none; }
.brand-text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  position: relative;
  padding-bottom: 6px;
}
.brand-text h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: var(--orange);
}
.brand-text p { margin: 4px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.72); }

/* Now / 3 months / 6 months switcher */
.timeframe {
  margin-left: auto;
  display: flex; gap: 2px; padding: 4px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
.timeframe button {
  border: 0; background: none; color: rgba(255, 255, 255, 0.78);
  padding: 5px 14px; border-radius: 7px;
  display: flex; flex-direction: column; align-items: center;
  font-size: 13.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.timeframe button small { font-size: 10.5px; font-weight: 500; opacity: 0.75; }
.timeframe button:hover { background: rgba(255, 255, 255, 0.1); color: var(--white); }
.timeframe button[aria-checked="true"] { background: var(--orange); color: var(--white); }
.timeframe button[aria-checked="true"] small { opacity: 0.9; }

.overall {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.overall-ring { width: 46px; height: 46px; flex: none; }
.overall-ring .ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 5; }
.overall-ring .ring-fg {
  fill: none; stroke: var(--orange); stroke-width: 5; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.5s ease;
}
.overall-ring text { fill: var(--white); font-size: 15px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.overall-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.65); font-weight: 600; }
.overall-stage { font-size: 16px; font-weight: 700; line-height: 1.2; }
.overall-target { font-size: 12px; color: rgba(255, 255, 255, 0.7); }

.actions { display: flex; align-items: center; gap: 8px; }

.sync {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.78);
  margin-right: 6px; white-space: nowrap;
}
.sync i { width: 9px; height: 9px; border-radius: 50%; background: #8a99a5; flex: none; }
.sync[data-state="live"] i { background: var(--green); box-shadow: 0 0 0 4px rgba(159, 191, 67, 0.22); }
.sync[data-state="saving"] i { background: var(--orange); animation: pulse 1s ease-in-out infinite; }
.sync[data-state="offline"] i { background: #e2483d; }
.sync[data-state="local"] i { background: var(--blue); }
.sync[data-state="published"] i { background: var(--blue); }
@keyframes pulse { 50% { opacity: 0.35; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  background: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-edit { color: var(--white); border-color: rgba(255, 255, 255, 0.4); }
.btn-edit:hover { border-color: var(--white); background: rgba(255, 255, 255, 0.08); }
.btn-edit[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); }
.btn-edit[aria-pressed="true"]:hover { background: var(--orange-text); }
.btn-icon { width: 38px; padding: 0; color: var(--white); }
.btn-icon:hover { background: rgba(255, 255, 255, 0.1); }
.btn-icon svg circle { fill: currentColor; stroke: none; }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-text); }
.btn-quiet { color: var(--dark-700); }
.btn-quiet:hover { background: var(--light); }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 250px; padding: 6px;
  background: var(--white); color: var(--body);
  border-radius: 10px; box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
}
.menu-list button {
  text-align: left; padding: 10px 12px; border: 0; background: none;
  border-radius: 6px; font-size: 14px; font-weight: 500;
}
.menu-list button:hover:not(:disabled) { background: var(--light); }
.menu-list button:disabled { color: #9aa5ad; cursor: not-allowed; }

/* ── Board (mind map) ──────────────────────────────────── */

.board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(460px, 1.45fr) minmax(300px, 0.8fr);
  gap: 0 clamp(28px, 3vw, 64px);
  padding: 20px var(--gutter);
  min-height: 0;
}

.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.links path { fill: none; stroke: var(--dark-600); stroke-width: 1.5; stroke-dasharray: 3 5; stroke-linecap: round; opacity: 0.7; }
.links .dot-card { fill: var(--white); stroke: var(--dark-600); stroke-width: 1.5; }
.links .dot-tip { fill: var(--dark-600); }
.links .active path { stroke: var(--orange); opacity: 1; stroke-dasharray: none; stroke-width: 2; }
.links .active .dot-card { stroke: var(--orange); }
.links .active .dot-tip { fill: var(--orange); }

.col { display: flex; flex-direction: column; gap: 16px; min-height: 0; position: relative; z-index: 1; }

.hub { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.radar { width: 100%; height: 100%; min-height: 0; flex: 1; overflow: visible; }
.hub-key { display: flex; gap: 22px; font-size: 13px; font-weight: 500; color: var(--dark-700); padding-top: 4px; }
.hub-key span { display: inline-flex; align-items: center; gap: 8px; }
.hub-key i { display: inline-block; width: 26px; height: 0; }
.key-now i { border-top: 2px solid var(--orange); }
.key-target i { border-top: 2px dashed var(--dark-700); }
.key-ghost i { border-top: 1.5px solid var(--dark-600); opacity: 0.6; }

/* radar parts */
.band { stroke: var(--border); stroke-width: 1; }
.axis { stroke: var(--border); stroke-width: 1; }
.ring-label {
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  fill: var(--dark-600); text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: var(--off-white); stroke-width: 4px; stroke-linejoin: round;
}
.target-shape { fill: none; stroke: var(--dark-700); stroke-width: 2; stroke-dasharray: 6 5; stroke-linejoin: round; }
.ghost-shape { fill: none; stroke: var(--dark-600); stroke-width: 1.5; stroke-linejoin: round; opacity: 0.55; }
.now-shape { fill: var(--orange-tint); stroke: var(--orange); stroke-width: 1.75; stroke-linejoin: round; }
.now-dot { fill: var(--orange); stroke: var(--white); stroke-width: 2; }
.val-label {
  font-size: 12px; font-weight: 600; fill: var(--dark-800); text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: var(--off-white); stroke-width: 5px; stroke-linejoin: round;
  font-variant-numeric: tabular-nums;
}
.tip-badge { cursor: pointer; }
.tip-badge .badge-bg { fill: var(--dark-800); stroke: var(--white); stroke-width: 3; transition: fill 0.15s; filter: drop-shadow(0 2px 3px rgba(14, 23, 35, 0.25)); }
.tip-badge .badge-ic { fill: none; stroke: var(--white); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.tip-label { display: none; font-size: 15px; font-weight: 500; fill: var(--dark-800); dominant-baseline: central; }
.axis-hit { cursor: pointer; }
.tip-badge:hover .badge-bg, .axis-hit:hover + .tip-badge .badge-bg, .tip-badge.active .badge-bg { fill: var(--orange); }

/* ── Area cards ─────────────────────────────────────────── */

.card {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #e1e8ec;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  text-align: left;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card.active { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange), var(--shadow-lift); }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--dark-800);
  color: var(--white);
  flex: none;
}
.card-head .ic svg, .drawer-head .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-edit-hint { display: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--orange); }
.editing .card-edit-hint { display: inline-flex; align-items: center; gap: 5px; }
.card-edit-hint svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.card-body { padding: 12px 16px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }

.score-row { display: flex; align-items: flex-end; gap: 14px; }
.score-big { font-size: 38px; font-weight: 800; line-height: 0.9; color: var(--dark-900); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.score-big small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.score-meta { display: flex; flex-direction: column; gap: 2px; padding-bottom: 1px; min-width: 0; }
.stage-name { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--orange-text); }
.target-txt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* five-stage track */
.track {
  position: relative; height: 10px;
  --seg: linear-gradient(90deg, #000 calc(20% - 3px), transparent 0 20%, #000 0 calc(40% - 3px), transparent 0 40%, #000 0 calc(60% - 3px), transparent 0 60%, #000 0 calc(80% - 3px), transparent 0 80%, #000 0);
}
.track::before, .track-fill, .track-pot, .track-proj {
  content: ""; position: absolute; inset: 0; border-radius: 3px;
  -webkit-mask: var(--seg); mask: var(--seg);
}
.track::before { background: var(--light); }
/* potential: pale band behind the current score */
.track-pot {
  background: #b9ccd7;
  clip-path: inset(0 calc(100% - var(--p, 0) * 1%) 0 0);
  transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.track-proj {
  background: var(--proj);
  clip-path: inset(0 calc(100% - var(--p, 0) * 1%) 0 0);
  transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.track-fill {
  background: var(--dark-600);
  clip-path: inset(0 calc(100% - var(--p, 0) * 1%) 0 0);
  transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.track.small { height: 8px; }
.track-target {
  position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px;
  background: var(--dark-800); border-radius: 2px;
  transition: left 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sys-list { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; }
.sys-list li { display: grid; grid-template-columns: 1fr 64px 44px; align-items: center; gap: 10px; font-size: 13px; }
.sys-list .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dark-900); font-weight: 500; }
.mini { position: relative; height: 6px; background: var(--light); border-radius: 3px; overflow: hidden; }
.mini b, .mini u, .mini i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.mini b { background: #b9ccd7; }
.mini u { background: var(--proj); }
.mini i { background: var(--dark-600); }
.delta {
  align-self: flex-start; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; color: #4f6b12;
  background: rgba(159, 191, 67, 0.22); border-radius: 999px; padding: 1px 7px;
}
.sys-list .v { text-align: right; font-weight: 700; font-size: 12px; color: var(--dark-700); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sys-list .v small { font-size: 0.85em; font-weight: 500; color: #7d8b95; margin-left: 1px; }
.more-inline { margin-left: auto; align-self: center; flex: none; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--light); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.sys-empty { font-size: 13px; color: var(--muted); font-style: italic; margin: 0; }

/* ── Scale footer ──────────────────────────────────────── */

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  padding: 12px var(--gutter) 14px;
  background: var(--white);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
.scale-item { border-top: 3px solid var(--border); padding-top: 8px; }
.scale-item h3 { margin: 0; font-size: 13px; font-weight: 800; display: flex; align-items: baseline; gap: 8px; color: var(--dark-900); }
.scale-item h3 span { font-size: 11px; font-weight: 700; color: var(--dark-600); }
.scale-item p { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.scale-item.current { border-top-color: var(--orange); }
.scale-item.current h3 span { color: var(--orange-text); }

/* ── Drawer ────────────────────────────────────────────── */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  background: var(--white);
  box-shadow: -18px 0 48px rgba(14, 23, 35, 0.22);
  z-index: 10;
  display: flex; flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 18px 16px 22px;
  background: var(--gradient-dark); color: var(--white);
  flex: none;
}
.drawer-head .ic { padding-top: 6px; }
.drawer-head .ic svg { width: 26px; height: 26px; }
.dh-text { flex: 1; min-width: 0; }
.dh-text h2 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; }
.area-name-input {
  width: 100%; font-size: 22px; font-weight: 700; color: var(--white);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; padding: 2px 8px; margin-left: -9px;
}
.area-name-input:focus { outline: none; border-color: var(--orange); background: rgba(255, 255, 255, 0.1); }
.dh-sub { margin: 6px 0 0; font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.dh-sub b { color: var(--white); font-size: 18px; }
.dh-sub .stage { color: #ffb184; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px; }
.close-btn { color: var(--white); flex: none; }
.close-btn svg { width: 22px; height: 22px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; overscroll-behavior: contain; }
.drawer-body h3 {
  margin: 22px 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--dark-600);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-body h3:first-child { margin-top: 0; }
.drawer-hint { font-size: 13px; color: var(--muted); margin: -2px 0 14px; }

.field-target, .sys-edit, .sys-view {
  border: 1px solid #dfe7ec; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--white);
}
.field-target { background: #f7f9fa; }

.se-top { display: flex; align-items: center; gap: 8px; }
.se-name {
  flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: var(--dark-900);
  border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; margin-left: -7px; background: none;
}
.se-name:hover { border-color: var(--border); }
.se-name:focus { outline: none; border-color: var(--orange); }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: #fde9df; color: var(--orange-text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.close-btn.icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--white); }

.slider-row { display: grid; grid-template-columns: 64px 1fr 92px; gap: 14px; align-items: center; margin-top: 6px; }
.slider-cap { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--orange-text); }
.slider-row:has(.pot-range) .slider-cap, .slider-row:has(.pot-range) .slider-out span { color: var(--dark-600); }
.slider-out { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.slider-out b { font-size: 22px; font-weight: 800; color: var(--dark-900); font-variant-numeric: tabular-nums; }
.slider-out span { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--orange-text); white-space: nowrap; }
.field-target .slider-out span { color: var(--dark-600); }

/* stage boundaries under each slider (thumb is 22px, so inset 11px each side) */
.ticks { display: grid; grid-template-columns: repeat(5, 1fr); margin: 2px 117px 0 89px; height: 6px; border-right: 1px solid var(--border); }
.ticks span { border-left: 1px solid var(--border); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer;
  --fill: var(--orange);
}
input[type="range"].pot-range { --fill: var(--dark-600); }
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--fill) 0 calc(var(--val, 0) * 1%), var(--light) calc(var(--val, 0) * 1%) 100%);
}
input[type="range"]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--light); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--fill); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -7px; border-radius: 50%;
  background: var(--white); border: 4px solid var(--fill); box-shadow: 0 2px 6px rgba(14, 23, 35, 0.25);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white); border: 4px solid var(--fill); box-shadow: 0 2px 6px rgba(14, 23, 35, 0.25);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(234, 91, 12, 0.35); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(234, 91, 12, 0.35); }

.se-note {
  width: 100%; margin-top: 10px; resize: vertical; min-height: 54px;
  font-size: 13px; line-height: 1.45; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfc;
}
.se-note:focus { outline: none; border-color: var(--orange); background: var(--white); }

.sv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.sv-name { font-weight: 700; font-size: 15px; color: var(--dark-900); }
.sv-score { font-size: 12px; font-weight: 800; color: var(--orange-text); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.sv-score b { font-size: 18px; color: var(--dark-900); margin-right: 4px; }
.sv-pot { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.sv-pot b { color: var(--dark-900); }
.pot-key { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.pot-key i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
.pot-key .k-now { background: var(--dark-600); }
.pot-key .k-pot { background: #b9ccd7; margin-left: 10px; }
.pot-key .k-proj { background: var(--proj); margin-left: 10px; }
.sv-timeline { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.sv-timeline b { color: var(--dark-900); }
.sv-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); white-space: pre-line; }

.add-btn {
  width: 100%; height: 44px; margin-top: 4px;
  border: 1.5px dashed var(--border); border-radius: 10px; background: none;
  font-size: 14px; font-weight: 700; color: var(--dark-700);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.add-btn:hover:not(:disabled) { border-color: var(--orange); color: var(--orange-text); background: #fff7f2; }
.add-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.add-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.drawer-foot { flex: none; padding: 12px 22px; border-top: 1px solid var(--light); font-size: 12px; color: var(--muted); }

/* ── Dialog + toast ────────────────────────────────────── */

.key-dialog { border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-lift); }
.key-dialog::backdrop { background: rgba(14, 23, 35, 0.55); }
.key-dialog form { padding: 24px; }
.key-dialog h2 { margin: 0 0 6px; font-size: 20px; }
.key-dialog p { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.key-dialog label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.key-dialog input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; }
.key-dialog input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(234, 91, 12, 0.2); }
.key-error { color: #c0392b !important; margin: 8px 0 0 !important; font-weight: 600; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--dark-900); color: var(--white); padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lift); z-index: 20; max-width: calc(100vw - 32px);
}

/* ── Smaller laptop screens ────────────────────────────── */

@media (max-height: 860px) and (min-width: 1100px) {
  .topbar { padding-top: 8px; padding-bottom: 8px; }
  .logo { height: 34px; }
  .brand-text p { display: none; }
  .board { padding-top: 14px; padding-bottom: 12px; }
  .col { gap: 12px; }
  .card-head { padding: 7px 14px; }
  .card-body { padding: 9px 14px; gap: 7px; }
  .score-big { font-size: 30px; }
  .sys-list { gap: 4px; }
  .sys-list li { font-size: 12.5px; }
  .scale { padding-top: 8px; padding-bottom: 10px; }
  .scale-item p { display: none; }
}

/* ── Full-HD and taller: use the spare card height ─────── */

@media (min-height: 1000px) and (min-width: 1100px) {
  .card-head { padding: 12px 18px; }
  .card-head h2 { font-size: 17px; }
  .card-body { padding: 16px 18px; gap: 13px; }
  .score-big { font-size: 44px; }
  .stage-name { font-size: 14px; }
  .target-txt { font-size: 13px; }
  .sys-list { gap: 10px; }
  .sys-list li { font-size: 14.5px; grid-template-columns: 1fr 84px 54px; }
  .sys-list .v { font-size: 13.5px; }
  .mini { height: 7px; }
}

/* ── Compact cards when a column holds 4+ areas ────────── */

.head-score { display: none; }

@media (min-width: 1100px) {
  .board.dense .col { gap: 10px; }
  /* size cards by how many systems they list, so a long card borrows space from short ones */
  .board.dense .card { flex: 1 1 auto; }
  .board.dense .card-head { padding: 8px 14px; }
  .board.dense .card-head h2 { font-size: 16px; }
  .board.dense .head-score {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 26px; padding: 0 9px; border-radius: 999px;
    background: var(--orange); color: var(--white);
    font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
  }
  .board.dense .card-body { padding: 9px 14px; gap: 6px; }
  .board.dense .score-big { display: none; }
  .board.dense .score-meta { flex-direction: row; align-items: baseline; gap: 10px; min-width: 0; }
  .board.dense .sys-list { gap: 3px; }
  .board.dense .sys-list li { font-size: 13.5px; line-height: 1.3; grid-template-columns: 1fr 72px 48px; }
}

@media (min-width: 1100px) and (max-height: 860px) {
  .board.dense .col { gap: 9px; }
  .board.dense .card-head { padding: 6px 12px; }
  .board.dense .card-body { padding: 7px 12px; gap: 6px; }
  .board.dense .sys-list { gap: 3px; }
  .board.dense .sys-list li { font-size: 12.5px; }
}

/* ── Big screens / TVs ─────────────────────────────────── */

@media (min-width: 2200px) and (min-height: 1200px) {
  html { zoom: 1.35; }
}

/* ── Narrow: stack radar then cards ────────────────────── */

@media (max-width: 1099px) {
  .app { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; gap: 12px 16px; }
  .overall { order: 3; margin-left: 0; }
  .timeframe { order: 4; margin-left: 0; }
  .actions { margin-left: auto; }
  .board { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; padding-top: 16px; }
  .col { display: contents; }
  .hub { grid-column: 1 / -1; order: -1; }
  .radar { flex: none; height: auto; aspect-ratio: 720 / 600; max-height: 620px; }
  .card { flex: none; }
  .links { display: none; }
  .tip-label { display: block; }
  .scale { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

@media (max-width: 640px) {
  .brand-rule, .brand-text p { display: none; }
  .logo { height: 32px; }
  .brand-text h1 { font-size: 18px; }
  .sync span { display: none; }
  .btn-edit span { display: none; }
  .btn-edit { width: 38px; padding: 0; }
  .overall { width: 100%; }
  .timeframe { width: 100%; }
  .timeframe button { flex: 1; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  body { background: var(--white); }
  .actions, .drawer, .toast { display: none !important; }
  .app { height: auto; }
}
