:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --bg-grid: radial-gradient(circle at 12% 5%, rgba(166, 215, 94, .16), transparent 25rem), radial-gradient(circle at 90% 90%, rgba(47, 91, 83, .08), transparent 30rem);
  --sidebar: #f8f6ef;
  --panel: #fcfbf7;
  --panel-2: #f1eee5;
  --line: rgba(90, 98, 90, .28);
  --line-strong: #bbc2b3;
  --text: #151a17;
  --muted: #4f594f;
  --primary: #193628;
  --primary-text: #f7f4ec;
  --accent: #a6d75e;
  --accent-ink: #112018;
  --danger: #a9382e;
  --danger-soft: #fae7e3;
  --warning: #805500;
  --warning-soft: #f7ebce;
  --success-soft: #e4eedb;
  --shadow-1: 0 8px 18px rgba(21, 26, 23, .06);
  --shadow-2: 0 16px 36px rgba(21, 26, 23, .1);
  font: 14px/1.55 Manrope, ui-sans-serif, system-ui, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08110d;
  --bg-grid: radial-gradient(circle at 12% 5%, rgba(183, 228, 110, .1), transparent 24rem), radial-gradient(circle at 90% 90%, rgba(70, 118, 97, .12), transparent 30rem);
  --sidebar: #17241e;
  --panel: #0f1914;
  --panel-2: #13201a;
  --line: rgba(106, 126, 115, .35);
  --line-strong: #36463e;
  --text: #dcdcd3;
  --muted: #b6c1b8;
  --primary: #d7efb0;
  --primary-text: #112018;
  --accent: #b7e46e;
  --accent-ink: #112018;
  --danger: #ff9385;
  --danger-soft: #38201d;
  --warning: #f0c86e;
  --warning-soft: #352d1c;
  --success-soft: #21331d;
  --shadow-1: 0 8px 20px rgba(0, 0, 0, .22);
  --shadow-2: 0 18px 42px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background-color: var(--bg); background-image: var(--bg-grid); background-attachment: fixed; color: var(--text); overflow-x: hidden; }
body.nav-open { overflow: hidden; }
body.auth-pending > * { visibility: hidden; }
a { color: var(--primary); text-underline-offset: 3px; }
button, a, input, select, textarea { transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease; }
button, select, .job-row, nav a { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 10px 14px; border-radius: 999px; color: var(--primary-text); background: var(--primary); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

aside { position: fixed; z-index: 8; inset: 0 auto 0 0; width: 272px; padding: 28px 20px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--sidebar) 94%, transparent); backdrop-filter: blur(18px); display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px 32px; color: var(--text); font-family: "Space Grotesk", ui-sans-serif, sans-serif; font-size: 19px; font-weight: 700; text-decoration: none; }
.brand > span { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); border-radius: 12px; color: var(--accent-ink); background: var(--accent); box-shadow: var(--shadow-1); }
.brand small { display: block; margin-top: 1px; color: var(--muted); font: 700 9px/1.4 Manrope, sans-serif; text-transform: uppercase; letter-spacing: .15em; }
nav { display: grid; gap: 5px; }
nav a { position: relative; padding: 11px 13px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); font-weight: 600; text-decoration: none; }
nav a:hover { color: var(--text); background: color-mix(in srgb, var(--panel) 65%, transparent); border-color: var(--line); }
nav a.active { color: var(--primary-text); background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-1); }
.stage-tabs, .stage-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.stage-tabs button[aria-selected="true"] { color: var(--primary-text); background: var(--primary); border-color: var(--primary); }
.aside-note { margin-top: auto; padding: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 55%, transparent); font-size: 12px; }
.aside-note span { color: var(--primary); font-weight: 700; }

main { margin-left: 272px; width: calc(100% - 272px); padding: 32px clamp(22px, 3vw, 52px) 72px; }
main > * { width: min(100%, 1320px); margin-inline: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.header-title, .header-actions { display: flex; align-items: center; gap: 12px; }
.header-actions { justify-content: flex-end; flex-wrap: wrap; }
#session-user { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 700; }
#logout { min-height: 38px; padding: 7px 12px; }
h1, h2, h3 { font-family: "Space Grotesk", ui-sans-serif, sans-serif; letter-spacing: -.025em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
.eyebrow { margin-bottom: 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; font-weight: 800; }
.muted, small { color: var(--muted); }
.icon-button, .theme-button { min-height: 44px; border: 1px solid var(--line-strong); color: var(--text); background: var(--panel); box-shadow: var(--shadow-1); }
.icon-button { display: none; width: 44px; padding: 10px; border-radius: 50%; }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.theme-button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; }
.theme-button:hover, .icon-button:hover { background: var(--panel-2); border-color: var(--primary); }
.theme-icon { width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 5px -4px 0 -3px var(--panel), 5px -4px 0 -1px currentColor; }
:root[data-theme="dark"] .theme-icon { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: var(--shadow-1); }
.card:hover { border-color: var(--line-strong); }
.metric { margin: 6px 0 0; font-family: "Space Grotesk", sans-serif; font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -.04em; }
.metric.accent { color: var(--primary); }
.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-1); }
.toolbar label { flex: 1 1 180px; }
label { display: grid; align-content: start; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; }
input:not([type="checkbox"]):not([type="radio"]), select { height: 44px; }
input:hover, select:hover, textarea:hover { border-color: var(--primary); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
textarea { min-height: 96px; resize: vertical; }
button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--primary); border-radius: 999px; color: var(--primary-text); background: var(--primary); font-weight: 700; }
button:hover { opacity: .88; }
button.secondary { color: var(--text); background: var(--panel); border-color: var(--line-strong); }
button.secondary:hover { color: var(--primary); border-color: var(--primary); opacity: 1; }
button.danger { color: var(--accent-ink); background: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: wait; }
.button-link { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 16px; border: 1px solid var(--primary); border-radius: 999px; color: var(--primary-text); background: var(--primary); font-weight: 700; text-decoration: none; }
.button-link:hover { opacity: .88; }
.button-link.secondary { color: var(--text); background: var(--panel); border-color: var(--line-strong); }
.button-link.secondary:hover { color: var(--primary); border-color: var(--primary); opacity: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
tr:last-child td { border-bottom: 0; }
.job-row:hover { background: var(--panel-2); }
.jobs-board { display: grid; gap: 24px; }
.job-window { min-width: 0; }
.job-window .card { overflow-x: auto; }
.job-window table { min-width: 720px; }
.job-window th:first-child, .job-window td:first-child { width: 64px; text-align: center; white-space: nowrap; overflow-wrap: normal; }
.job-window-head { cursor: pointer; }
.job-window-head h2 { margin: 0; font-size: 18px; }
.job-window-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.job-window-content { margin-top: 10px; }
.job-window-actions { display: flex; justify-content: end; margin: 0 0 10px; }
.dismiss-window { flex: 0 0 auto; min-height: 38px; padding-block: 7px; border-radius: 10px; color: var(--danger); }
.dismiss-window:hover { border-color: var(--danger); color: var(--danger); }
.score { color: var(--primary); font-family: "Space Grotesk", sans-serif; font-size: 23px; font-weight: 700; }
.tag { display: inline-block; margin: 2px 3px 2px 0; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag.good { color: var(--primary); background: var(--success-soft); }
.tag.warn { color: var(--warning); background: var(--warning-soft); }
.tag.bad { color: var(--danger); background: var(--danger-soft); }
.status { font-weight: 800; font-size: 11px; letter-spacing: .02em; }
.status.HEALTHY, .status.SUCCEEDED, .status.COMPLETE, .status.ENABLED, .status.TELEGRAM { color: var(--primary); }
.status.DEGRADED, .status.PARTIAL, .status.PENDING, .status.GENERATING { color: var(--warning); }
.status.BROKEN, .status.FAILED, .status.FILTERED, .status.DISABLED { color: var(--danger); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 12px; }
.section-head h2 { margin: 0; }
.profile-section-head { margin-top: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.profile-section-head p { margin: 3px 0 0; }
.profile-card { display: grid; align-content: start; gap: 13px; }
.profile-card h2 { margin: 8px 0 0; }
.profile-card p { margin: 0; }
.profile-card-actions { display: flex; align-items: center; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.profile-card-actions button { border-radius: 10px; }
.profile-card-actions small { margin-left: auto; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.search-focus-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.schedule-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 18px; }
.schedule-toggle { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.profile-form { display: grid; gap: 16px; }
.form-section { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.form-section:hover { border-color: var(--line-strong); }
.form-section-head { display: flex; align-items: center; gap: 13px; padding: 16px 20px; border-bottom: 1px solid transparent; background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); cursor: pointer; }
.form-section[open] > .form-section-head { border-bottom-color: var(--line); }
.form-section-head::after { width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); content: ""; transform: rotate(-45deg); transition: transform .2s ease; }
.form-section[open] > .form-section-head::after { transform: rotate(45deg); }
.form-section-head:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: -3px; }
.form-section-head h3 { margin: 0 0 2px; font-size: 17px; }
.form-section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.form-section-copy { flex: 1 1 280px; }
.ai-trigger { flex: 0 0 auto; margin-left: auto; border-radius: 10px; }
.section-tools { display: flex; justify-content: flex-end; }
.section-index { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--primary); background: var(--panel); font: 700 10px/1 "Space Grotesk", sans-serif; letter-spacing: .06em; }
.form-section-body { padding: 20px; }
.form-section-body textarea { line-height: 1.55; }
.candidate-profile-builder { display: grid; gap: 14px; }
.profile-builder-group { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.profile-builder-group legend { padding: 0 7px; color: var(--text); font: 700 13px/1.2 "Space Grotesk", sans-serif; }
.profile-builder-group textarea { min-height: 88px; }
.experience-list { display: grid; gap: 12px; }
.experience-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.experience-card-head { cursor: pointer; color: var(--text); font-size: 13px; font-weight: 700; }
.experience-card[open] .experience-card-head { margin-bottom: 12px; }
.experience-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.experience-remove { margin-top: 12px; }
.date-field { display: grid; align-content: start; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.date-picker { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--bg); font-weight: 600; text-align: left; }
.date-picker:hover { border-color: var(--primary); background: var(--panel-2); opacity: 1; }
.date-picker svg, .calendar-icon-button svg { flex: 0 0 19px; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.date-dialog { width: min(340px, calc(100vw - 28px)); margin: auto; padding: 16px; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-2); }
.date-dialog::backdrop { background: rgba(8, 17, 13, .5); backdrop-filter: blur(3px); }
.date-dialog-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; margin-bottom: 12px; }
.date-dialog-head h3 { margin: 0; text-align: center; }
.calendar-icon-button { display: grid; width: 40px; min-height: 40px; padding: 0; place-items: center; border-radius: 9px; color: var(--text); background: var(--bg); border-color: var(--line-strong); }
.calendar-icon-button:hover { color: var(--primary); background: var(--success-soft); opacity: 1; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-day { min-width: 0; min-height: 36px; padding: 0; border-color: transparent; border-radius: 9px; color: var(--text); background: transparent; font-size: 12px; }
.calendar-day:hover { color: var(--accent-ink); background: var(--accent); opacity: 1; }
.calendar-day.outside { color: var(--muted); opacity: .42; }
.calendar-day.today { border-color: var(--primary); }
.calendar-day[aria-pressed="true"] { color: var(--primary-text); background: var(--primary); border-color: var(--primary); opacity: 1; }
.date-dialog-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.date-dialog-actions button { min-width: 96px; border-radius: 10px; }
.compact-button { min-height: 36px; padding: 7px 11px; border-radius: 8px; }
.add-experience { margin-top: 12px; border-radius: 9px; }
.generated-profile-preview { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.generated-profile-preview summary { cursor: pointer; color: var(--text); font-weight: 700; }
.generated-profile-preview textarea { width: 100%; min-height: 260px; margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ai-dialog { width: min(720px, calc(100vw - 32px)); max-height: min(80vh, 760px); margin: auto; padding: 0; overflow: hidden; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-2); }
.ai-dialog::backdrop { background: rgba(8, 17, 13, .56); backdrop-filter: blur(4px); }
.ai-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.ai-dialog-head h3 { margin: 2px 0 0; font-size: 19px; }
.ai-dialog-head button { flex: 0 0 auto; border-radius: 10px; }
.ai-dialog-content { max-height: calc(min(80vh, 760px) - 80px); overflow: auto; padding: 20px; }
.ai-dialog-content > p:first-child { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.dialog-actions button { border-radius: 10px; }
.suggestion-summary { max-width: 68ch; line-height: 1.65; }
.suggestion-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 12px; }
.suggestion-group { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.suggestion-role-group { grid-column: 1 / -1; }
.suggestion-group h4 { margin: 0 0 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.suggestion-text-list { margin: 0; padding-left: 22px; }
.suggestion-text-list li { padding: 7px 4px; overflow-wrap: anywhere; }
.suggestion-text-list li + li { border-top: 1px solid var(--line); }
.suggestion-chips { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; }
.suggestion-chips .tag { max-width: 100%; margin: 0; border-radius: 8px; white-space: normal; overflow-wrap: anywhere; }
.suggestion-note { display: block; color: var(--muted); }
.option-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.option-group legend { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { display: flex; min-height: 48px; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--bg); cursor: pointer; }
.choice:hover { border-color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--success-soft); }
.choice input { flex: 0 0 18px; width: 18px; min-height: 18px; margin: 0; accent-color: var(--primary); }
.choice span { display: grid; gap: 1px; }
.choice strong { color: var(--text); font-size: 12px; }
.choice small { font-weight: 500; }
.choice.compact { min-height: 58px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }
.form-actions button { min-width: 150px; border-radius: 10px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0; }
.checks label { display: flex; min-height: 44px; align-items: center; gap: 8px; cursor: pointer; }
.checks input { width: 18px; min-height: 18px; accent-color: var(--primary); }
pre { max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin-bottom: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--bg); }
.description { max-height: 560px; overflow: auto; white-space: pre-wrap; line-height: 1.72; }
#notice { position: fixed; z-index: 12; top: 20px; right: 20px; max-width: min(420px, calc(100vw - 40px)); }
#notice:not(:empty) { padding: 12px 16px; border: 1px solid var(--primary); border-radius: 14px; color: var(--text); background: var(--success-soft); box-shadow: var(--shadow-2); }
#notice.error { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.loading-state { display: flex; min-height: 150px; grid-column: 1 / -1; align-items: center; justify-content: center; gap: 10px; }
.loading-state::before { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--primary); border-radius: 50%; content: ""; animation: loading-spin .7s linear infinite; }
@keyframes loading-spin { to { transform: rotate(1turn); } }
.login-card { width: min(100%, 430px); margin: auto; padding: clamp(24px, 5vw, 38px); box-shadow: var(--shadow-2); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.login-brand > span { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: var(--accent-ink); background: var(--accent); font: 700 22px/1 "Space Grotesk", sans-serif; }
.login-brand h1 { font-size: clamp(26px, 5vw, 34px); }
.login-card form { display: grid; gap: 15px; margin-top: 24px; }
.login-card form button { width: 100%; }
.login-error { min-height: 22px; margin: 0; color: var(--danger); font-size: 12px; font-weight: 700; }
body.logged-out aside, body.logged-out #nav-backdrop, body.logged-out .header-title, body.logged-out #header-meta, body.logged-out #session-user, body.logged-out #logout { display: none; }
body.logged-out main { display: grid; width: 100%; min-height: 100vh; margin: 0; padding: 24px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
body.logged-out header { width: 100%; justify-content: flex-end; margin: 0; }
body.logged-out #app { width: 100%; align-self: center; padding-bottom: 72px; }
.kv { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.score-breakdown { margin: 20px 0; padding: 18px 0; border-block: 1px solid var(--line); }
.score-breakdown h3 { margin-bottom: 12px; }
.score-facts { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 10px; }
.score-facts > div { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.score-facts strong { color: var(--text); font: 700 22px/1.2 "Space Grotesk", sans-serif; }
.score-table-scroll { max-width: 100%; margin-top: 14px; overflow-x: auto; }
.score-table { min-width: 500px; }
.score-table caption { padding: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
.score-table th:not(:first-child), .score-table td:not(:first-child) { text-align: right; }
.score-cap { display: grid; gap: 4px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--danger); border-radius: 12px; background: var(--danger-soft); }
.score-cap.warn { border-color: var(--warning); background: var(--warning-soft); }
.score-cap-clear, .score-confidence { margin: 12px 0 0; }
.legacy-score { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--warning); border-radius: 12px; color: var(--warning); background: var(--warning-soft); font-weight: 700; }
.assessment-evidence { margin-top: 18px; }
.resume-card { margin-bottom: 16px; border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.resume-card-head, .resume-action, .resume-links { display: flex; align-items: center; gap: 10px; }
.resume-card-head { justify-content: space-between; }
.resume-card-head h2, .resume-message { margin-bottom: 0; }
.resume-action { flex: 0 0 auto; }
.resume-links { flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.resume-error { color: var(--danger); font-weight: 700; }
#nav-backdrop { display: none; }

@media (max-width: 1100px) {
  aside { width: 248px; }
  main { margin-left: 248px; width: calc(100% - 248px); padding-inline: 24px; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  aside { width: min(86vw, 300px); transform: translateX(-105%); box-shadow: var(--shadow-2); transition: transform .24s ease; }
  body.nav-open aside { transform: translateX(0); }
  #nav-backdrop { position: fixed; z-index: 7; inset: 0; display: block; visibility: hidden; opacity: 0; background: rgba(8, 17, 13, .48); transition: opacity .24s ease, visibility .24s ease; }
  body.nav-open #nav-backdrop { visibility: visible; opacity: 1; }
  main { width: 100%; margin: 0; padding: 22px 18px 60px; }
  .icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: 1 / -1; }
  .card { padding: 18px; }
  table { display: block; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
}

@media (max-width: 560px) {
  main { padding: 18px 14px 48px; }
  header { align-items: flex-start; }
  .header-title { align-items: flex-start; min-width: 0; }
  .header-actions { gap: 8px; }
  #header-meta { display: none; }
  .theme-button { width: 44px; padding: 10px; justify-content: center; }
  #theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  h1 { font-size: 30px; }
  .grid.cards, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .search-focus-grid, .schedule-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head > button, .section-head > select { width: 100%; }
  .profile-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .profile-card-actions button { width: 100%; }
  .profile-card-actions small { grid-column: 1 / -1; margin-left: 0; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .job-window-actions { justify-content: stretch; }
  .dismiss-window { width: 100%; }
  .toolbar button, .form-grid > .span-3 > button, .form-grid > button { width: 100%; }
  .form-grid > .span-3 > button + button { margin-top: 8px; }
  .profile-builder-group { padding: 13px; }
  .experience-card { padding: 12px; }
  .experience-grid { grid-template-columns: 1fr; }
  .form-section-head { align-items: flex-start; padding: 15px 16px; }
  .form-section-head:has(.ai-trigger) { flex-wrap: wrap; }
  .ai-trigger { width: 100%; margin-left: 0; }
  .form-section-body { padding: 16px; }
  .ai-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .ai-dialog-head { align-items: flex-start; padding: 15px 16px; }
  .ai-dialog-content { max-height: calc(100dvh - 100px); padding: 16px; }
  .suggestion-groups { grid-template-columns: 1fr; }
  .suggestion-role-group { grid-column: auto; }
  .dialog-actions button { width: 100%; }
  .choice-grid { grid-template-columns: 1fr; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions button { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .score-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resume-card-head, .resume-action { align-items: stretch; flex-direction: column; }
  .resume-action button, .resume-links .button-link { width: 100%; }
  #notice { top: 12px; right: 12px; max-width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
