:root {
  color-scheme: light;
  --ink: #1f2a28;
  --ink-soft: #53605d;
  --ink-faint: #77817e;
  --paper: #f6f4ef;
  --surface: #fffefa;
  --surface-soft: #eeece5;
  --line: #d9d7d0;
  --accent: #176b5b;
  --accent-strong: #0f594b;
  --accent-soft: #dcece7;
  --warning: #9b5d13;
  --danger: #a33930;
  --shadow: 0 10px 30px rgba(31, 42, 40, 0.07);
  --radius: 16px;
  --page: 880px;
  --bulk-bar-space: 0px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button, select, label, input[type="checkbox"] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.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; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; color: white; background: var(--accent-strong); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.page-width { width: min(calc(100% - 32px), var(--page)); margin-inline: auto; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 0.72rem; font-weight: 760; letter-spacing: 0.09em; line-height: 1.2; text-transform: uppercase; }
.muted { color: var(--ink-soft); }

.site-header { position: sticky; z-index: 30; top: 0; border-bottom: 1px solid rgba(217, 215, 208, 0.8); background: rgba(246, 244, 239, 0.92); backdrop-filter: blur(14px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; width: min(calc(100% - 32px), var(--page)); min-height: 64px; margin: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 1.25rem; font-weight: 650; letter-spacing: -0.02em; }
.brand .eyebrow { margin-bottom: 1px; font-size: 0.61rem; }
.brand-mark { display: grid; width: 48px; aspect-ratio: 1; place-items: center; color: white; background: var(--accent); border-radius: 14px; font-family: ui-serif, Georgia, serif; font-weight: 700; }
.brand-mark-small { width: 38px; border-radius: 11px; font-size: 0.8rem; }
.header-actions { display: flex; align-items: center; gap: 5px; }
.sync-status { margin-right: 5px; color: var(--ink-faint); font-size: 0.75rem; }
.sync-status.is-busy::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 0; border-radius: 11px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--surface-soft); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-button-outline { flex: 0 0 auto; color: var(--accent); border: 1px solid var(--line); }

.mode-nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.mode-nav-inner { display: flex; width: min(calc(100% - 32px), var(--page)); margin: auto; }
.mode-tab { display: flex; min-height: 54px; padding: 0 18px; align-items: center; gap: 8px; color: var(--ink-soft); border: 0; border-bottom: 2px solid transparent; background: transparent; font-weight: 680; cursor: pointer; }
.mode-tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-count { min-width: 23px; padding: 3px 7px; border-radius: 999px; background: var(--surface-soft); font-size: 0.72rem; text-align: center; }
.mode-tab.is-active .tab-count { background: var(--accent-soft); }

.panel { min-height: calc(100vh - 119px); padding-bottom: calc(42px + var(--bulk-bar-space)); }
.bulk-heading { display: flex; padding-block: 30px 20px; align-items: end; justify-content: space-between; gap: 20px; }
.bulk-heading h2, .empty-state h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: clamp(1.65rem, 5vw, 2.1rem); font-weight: 620; letter-spacing: -0.035em; }
.section-copy { max-width: 580px; margin: 8px 0 0; color: var(--ink-soft); line-height: 1.5; }
.progress-compact { display: grid; flex: 0 0 auto; text-align: right; }
.progress-compact strong { color: var(--accent); font-family: ui-serif, Georgia, serif; font-size: 1.8rem; }
.progress-compact span { color: var(--ink-faint); font-size: 0.72rem; }

.bulk-tools { display: flex; align-items: center; gap: 12px; }
.search-field { display: flex; min-height: 48px; flex: 1; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field svg { width: 19px; flex: 0 0 auto; fill: none; stroke: var(--ink-faint); stroke-width: 1.8; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; }
.switch-row { display: flex; min-height: 48px; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.switch-row input { position: absolute; opacity: 0; }
.switch { position: relative; width: 40px; height: 24px; border-radius: 99px; background: #c9c8c2; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 0.2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.selection-row { display: flex; min-height: 50px; align-items: center; gap: 14px; color: var(--ink-soft); font-size: 0.82rem; }
.check-control { display: flex; align-items: center; gap: 9px; cursor: pointer; }
input[type="checkbox"] { width: 19px; height: 19px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.text-button { padding: 7px 4px; color: var(--accent); border: 0; background: transparent; font-size: 0.82rem; font-weight: 680; cursor: pointer; }
.selection-meta { margin-left: auto; color: var(--ink-faint); }

.bulk-list { width: min(calc(100% - 32px), var(--page)); margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 16px rgba(31, 42, 40, 0.035); }
.bulk-row { display: grid; min-height: 78px; padding: 13px 15px; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #e9e7e1; cursor: pointer; }
.bulk-row:last-child { border-bottom: 0; }
.bulk-row:hover { background: #fbfaf6; }
.bulk-row.is-labeled { cursor: default; }
.bulk-row-body { display: grid; min-width: 0; }
.bulk-company { margin-bottom: 2px; color: var(--accent); font-size: 0.7rem; font-weight: 760; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-role { overflow: hidden; font-size: 0.94rem; font-weight: 680; line-height: 1.28; text-overflow: ellipsis; white-space: nowrap; }
.bulk-meta { margin-top: 4px; overflow: hidden; color: var(--ink-faint); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.label-score { display: grid; width: 31px; height: 31px; place-items: center; color: var(--accent-strong); border-radius: 9px; background: var(--accent-soft); font-weight: 780; }
.row-status { color: var(--warning); font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.list-empty { padding: 45px 20px; color: var(--ink-faint); text-align: center; }

.bulk-action-bar, .single-action-bar { position: fixed; z-index: 25; right: 0; bottom: 0; left: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,254,250,.95); box-shadow: 0 -8px 24px rgba(31,42,40,.08); backdrop-filter: blur(14px); }
.bulk-action-inner { display: flex; width: min(100%, var(--page)); margin: auto; align-items: center; gap: 18px; }
.selected-summary { display: grid; flex: 1; }
.selected-summary span { color: var(--ink-faint); font-size: 0.75rem; }
.bulk-tag-field { display: grid; gap: 3px; }
.bulk-tag-field > span, .note-field > span { color: var(--ink-soft); font-size: 0.72rem; font-weight: 680; }
.bulk-tag-field em, .note-field em { color: var(--ink-faint); font-style: normal; font-weight: 500; }
.bulk-tag-field select { min-width: 190px; height: 42px; padding: 0 34px 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }

.button { min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 730; cursor: pointer; transition: transform .12s, background .12s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-secondary { color: var(--ink); border-color: var(--line); background: var(--surface); }
.button-secondary:hover:not(:disabled) { background: var(--surface-soft); }
.button-small { min-height: 40px; padding-inline: 13px; font-size: .8rem; }
.button-wide { width: 100%; }
.button-grow { flex: 1; }

.single-progress-row { display: flex; padding-block: 18px 12px; align-items: center; justify-content: space-between; gap: 20px; color: var(--ink-soft); font-size: .78rem; }
.single-progress-row > div { flex: 1; max-width: 360px; }
.progress-track { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 10px; background: #dedcd5; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }
.job-card { margin-bottom: 96px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.job-header { display: flex; padding: 22px 24px 16px; align-items: start; justify-content: space-between; gap: 16px; }
.job-title-block h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 620; letter-spacing: -.03em; line-height: 1.12; }
.facts { display: flex; padding: 0 24px 20px; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid #e9e7e1; }
.fact { display: inline-flex; min-height: 32px; padding: 5px 10px; align-items: center; gap: 6px; color: var(--ink-soft); border-radius: 9px; background: var(--surface-soft); font-size: .77rem; }
.fact svg { width: 16px; fill: none; stroke: var(--ink-faint); stroke-width: 1.7; }
.jd-section, .score-section, .model-panel { padding: 22px 24px; }
.jd-section { border-bottom: 1px solid #e9e7e1; }
.section-title-row { display: flex; margin-bottom: 14px; align-items: center; justify-content: space-between; gap: 12px; }
.section-title-row h3, .model-heading h3 { margin: 0; font-size: 1rem; }
.jd-text { max-height: none; overflow: hidden; color: #384441; font-family: ui-serif, Georgia, serif; font-size: .94rem; line-height: 1.64; white-space: pre-wrap; }
.jd-text.is-collapsed { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 12; }
.jd-missing { display: grid; gap: 5px; padding: 18px; color: var(--ink-soft); border: 1px dashed var(--line); border-radius: 12px; background: var(--paper); font-size: .86rem; }
.jd-missing strong { color: var(--ink); }
.keyboard-hint { color: var(--ink-faint); font-size: .72rem; }
.score-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.score-button { min-width: 0; min-height: 62px; padding: 7px 3px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.score-button strong, .score-button span { display: block; }
.score-button strong { color: var(--ink); font-family: ui-serif, Georgia, serif; font-size: 1.35rem; }
.score-button span { margin-top: 2px; font-size: .64rem; }
.score-button:hover { border-color: #99afa9; }
.score-button.is-selected { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(23,107,91,.08); }
.score-button.is-selected strong { color: var(--accent-strong); }
.score-anchor { min-height: 20px; margin: 10px 0 20px; color: var(--ink-soft); font-size: .79rem; text-align: center; }
.tag-fieldset { padding: 0; border: 0; }
.tag-fieldset legend { margin-bottom: 10px; font-size: .8rem; font-weight: 730; }
.tag-fieldset legend span { margin-left: 4px; color: var(--ink-faint); font-size: .7rem; font-weight: 500; }
.tag-fieldset legend span.is-required { color: var(--danger); }
.tag-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-button { min-height: 38px; padding: 7px 11px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .75rem; cursor: pointer; }
.tag-button:hover { border-color: #9baca8; }
.tag-button.is-selected { color: var(--accent-strong); border-color: #86b4a8; background: var(--accent-soft); font-weight: 680; }
.note-field { display: grid; margin-top: 18px; gap: 6px; }
.note-field input, .auth-form input { min-height: 46px; padding: 0 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; }
.note-field input:focus, .auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { margin: 10px 0 0; color: var(--danger); font-size: .8rem; }

.model-panel { background: linear-gradient(180deg, #f0f5f2 0%, #fffefa 100%); }
.model-heading { display: flex; margin-bottom: 16px; align-items: start; justify-content: space-between; gap: 16px; }
.score-comparison { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
.comparison-pill { display: flex; min-width: 62px; padding: 6px 9px; align-items: center; justify-content: space-between; gap: 8px; border-radius: 9px; font-size: .67rem; }
.comparison-pill strong { font-size: 1rem; }
.comparison-user { color: var(--accent-strong); background: var(--accent-soft); }
.comparison-model { color: #53505c; background: #e7e4eb; }
.model-verdict { margin-bottom: 18px; color: var(--ink); font-family: ui-serif, Georgia, serif; font-size: 1.05rem; line-height: 1.5; }
.model-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.model-details section { padding: 13px; border: 1px solid rgba(217,215,208,.8); border-radius: 11px; background: rgba(255,255,255,.7); }
.model-details h4 { margin: 0 0 8px; font-size: .76rem; }
.model-details ul { margin: 0; padding-left: 16px; color: var(--ink-soft); font-size: .76rem; line-height: 1.45; }
.model-details li + li { margin-top: 5px; }
.single-action-inner { display: flex; width: min(100%, 620px); margin: auto; gap: 10px; }

.empty-state { display: grid; min-height: 55vh; place-content: center; justify-items: center; text-align: center; }
.empty-state p { margin: 8px 0 20px; color: var(--ink-soft); }
.empty-icon { display: grid; width: 50px; height: 50px; margin-bottom: 14px; place-items: center; color: var(--accent); border-radius: 50%; background: var(--accent-soft); font-size: 1.4rem; }

.auth-shell, .loading-view { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.auth-card { width: min(100%, 390px); padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card .brand-mark { margin-bottom: 22px; }
.auth-card h1 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 2rem; letter-spacing: -.035em; }
.auth-card .muted { margin: 8px 0 24px; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { font-size: .8rem; font-weight: 700; }
.auth-form .button { margin-top: 8px; }
.loading-view { color: var(--ink-soft); font-size: .85rem; }
.loading-mark { width: 34px; height: 34px; margin: 0 auto 12px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

.toast-region { position: fixed; z-index: 100; top: 76px; right: 16px; pointer-events: none; }
.toast { max-width: 340px; padding: 11px 14px; color: white; border-radius: 10px; background: var(--ink); box-shadow: var(--shadow); font-size: .82rem; }
.toast-warning { background: var(--warning); }
.toast-error { background: var(--danger); }

.confirm-dialog { width: min(calc(100% - 32px), 420px); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 20px 60px rgba(31,42,40,.2); }
.confirm-dialog::backdrop { background: rgba(25,32,30,.45); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 0; font-family: ui-serif, Georgia, serif; font-size: 1.5rem; }
.confirm-dialog .muted { line-height: 1.5; }
.dialog-actions { display: flex; margin-top: 22px; justify-content: end; gap: 8px; }

:focus-visible { outline: 3px solid rgba(23,107,91,.28); outline-offset: 2px; }

@media (max-width: 680px) {
  .page-width, .header-inner, .mode-nav-inner, .bulk-list { width: min(calc(100% - 24px), var(--page)); }
  .sync-status { display: none; }
  .mode-nav-inner { width: 100%; }
  .mode-tab { flex: 1; justify-content: center; }
  .bulk-heading { padding-top: 24px; align-items: start; }
  .progress-compact strong { font-size: 1.45rem; }
  .progress-compact span { max-width: 82px; }
  .bulk-tools { align-items: stretch; flex-direction: column; gap: 4px; }
  .switch-row { min-height: 42px; }
  .bulk-row { min-height: 76px; padding-inline: 12px; gap: 10px; }
  .row-status { display: none; }
  .bulk-action-inner { align-items: stretch; flex-wrap: wrap; gap: 8px 12px; }
  .selected-summary { min-width: calc(45% - 6px); }
  .bulk-tag-field { min-width: calc(55% - 6px); }
  .bulk-tag-field select { width: 100%; min-width: 0; }
  .bulk-action-inner > .button { width: 100%; }
  .job-card { width: 100%; border-right: 0; border-left: 0; border-radius: 0; box-shadow: none; }
  .job-header, .jd-section, .score-section, .model-panel { padding-right: 16px; padding-left: 16px; }
  .facts { padding-right: 16px; padding-left: 16px; }
  .job-title-block h2 { font-size: 1.55rem; }
  .score-buttons { gap: 5px; }
  .score-button { min-height: 60px; border-radius: 10px; }
  .score-button span { font-size: .59rem; }
  .keyboard-hint { display: none; }
  .model-heading { flex-direction: column; }
  .score-comparison { justify-content: start; }
  .model-details { grid-template-columns: 1fr; }
  .single-action-bar, .bulk-action-bar { padding-inline: 12px; }
  .auth-card { padding: 27px 22px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (max-width: 420px) {
  .bulk-heading { gap: 8px; }
  .section-copy { font-size: .87rem; }
  .progress-compact span { display: none; }
  .selection-row { gap: 10px; }
  .fact { max-width: 100%; }
  .fact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

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