/* 180 Degrees brand: navy #152949, beige #D8B9AA, panel #F6F7F9, typeface Lama Sans.
   Lama Sans is a licensed font and is NOT bundled; it is used when installed on the viewer's computer. */
@font-face { font-family: "LamaSans"; font-weight: 400; src: local("Lama Sans Regular"), local("LamaSans-Regular"); }
@font-face { font-family: "LamaSans"; font-weight: 500; src: local("Lama Sans Medium"), local("LamaSans-Medium"); }
@font-face { font-family: "LamaSans"; font-weight: 700; src: local("Lama Sans Bold"), local("LamaSans-Bold"); }
@font-face { font-family: "LamaSans"; font-weight: 800; src: local("Lama Sans ExtraBold"), local("LamaSans-ExtraBold"); }
@font-face { font-family: "LamaSans"; font-weight: 900; src: local("Lama Sans Black"), local("LamaSans-Black"); }

:root {
  --navy: #152949;
  --beige: #D8B9AA;
  --bg: #FFFFFF;
  --surface: #F6F7F9;
  --surface-2: #FFFFFF;
  --ink: #152949;
  --ink-2: #4A5873;
  --muted: #69748C;
  --line: #E1E4EA;
  --accent: #152949;
  --accent-ink: #FFFFFF;
  --mark: #152949;
  --track: #E4E7ED;
  --chip: #ECEEF3;
  --focus: #5C6B86;
  --good: #1F7A4D;
  --warn: #8A5A00;
  --bad: #B3261E;
  --good-bg: #E6F2EC;
  --warn-bg: #FBF1DE;
  --bad-bg: #FBE9E7;
  --shadow: 0 1px 2px rgba(21, 41, 73, .06), 0 6px 24px rgba(21, 41, 73, .06);
  --radius: 18px;
  --font: "LamaSans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1528; --surface: #111F38; --surface-2: #162745; --ink: #F2F3F6; --ink-2: #C8CEDA; --muted: #97A2B8;
    --line: #243858; --accent: #D8B9AA; --accent-ink: #152949; --mark: #D8B9AA; --track: #24375A; --chip: #1C2F51;
    --focus: #D8B9AA; --good: #7FD3A6; --warn: #F2C46B; --bad: #FF9C92;
    --good-bg: #16362A; --warn-bg: #3A2E14; --bad-bg: #3E1E1E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1528; --surface: #111F38; --surface-2: #162745; --ink: #F2F3F6; --ink-2: #C8CEDA; --muted: #97A2B8;
  --line: #243858; --accent: #D8B9AA; --accent-ink: #152949; --mark: #D8B9AA; --track: #24375A; --chip: #1C2F51;
  --focus: #D8B9AA; --good: #7FD3A6; --warn: #F2C46B; --bad: #FF9C92;
  --good-bg: #16362A; --warn-bg: #3A2E14; --bad-bg: #3E1E1E; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar (always navy, logo only on navy) ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.topbar-inner { max-width: 1480px; margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 64px; }
.topbar .logo { height: 30px; width: auto; display: block; }
.topbar .product { color: var(--beige); font-weight: 700; letter-spacing: .02em; font-size: 13px; padding-left: 16px; border-left: 1px solid rgba(216, 185, 170, .35); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { text-decoration: none; color: rgba(255, 255, 255, .78); padding: 8px 12px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--beige); border-radius: 10px 10px 0 0; }
.top-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #fff; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7FD3A6; }
.status-pill.offline::before { background: #FF9C92; }
.user-btn { background: transparent; border: 1px solid rgba(216, 185, 170, .45); color: var(--beige); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.user-btn:hover { background: rgba(216, 185, 170, .12); }

.offline-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); }
.offline-banner div { max-width: 1480px; margin: 0 auto; padding: 10px 24px; font-weight: 500; }

/* ---------- layout ---------- */
main { max-width: 1480px; margin: 0 auto; padding: 28px 24px 64px; }
.page-title { display: flex; align-items: center; gap: 14px; margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.chev { width: 13px; height: 25px; fill: var(--beige); flex: none; }
.page-sub { color: var(--muted); margin: 0 0 22px 27px; max-width: 820px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-h { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.section-h .chev { width: 8px; height: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- stat tiles ---------- */
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 34px; font-weight: 800; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- bar lists & meters (single series: --mark) ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 46%) 1fr 44px; gap: 10px; align-items: center; }
.bar-row .name { color: var(--ink-2); line-height: 1.25; overflow-wrap: anywhere; }
.bar-track { height: 12px; border-radius: 0 4px 4px 0; position: relative; }
.bar-track::before { content: ""; position: absolute; inset: 5px 0; background: var(--line); border-radius: 1px; }
.bar-fill { position: relative; height: 12px; background: var(--mark); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.meter { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--mark); border-radius: 0 4px 4px 0; }

/* ---------- forms ---------- */
label.field { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 11px; outline: none;
}
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
textarea.input { resize: vertical; min-height: 70px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { border-color: var(--focus); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.check input { margin-top: 2px; accent-color: var(--navy); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; max-width: 100%; }
.chip button { border: 0; background: none; cursor: pointer; padding: 0 0 0 2px; color: var(--muted); font-size: 14px; line-height: 1; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip-input { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-input input { border: 0; outline: none; background: transparent; flex: 1; min-width: 120px; padding: 3px 4px; }
.unknown { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px dashed var(--muted); border-radius: 6px; padding: 0 6px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.notice { border-left: 3px solid var(--beige); background: var(--surface); padding: 10px 12px; border-radius: 0 10px 10px 0; color: var(--ink-2); font-size: 12px; }

/* ---------- candidates ---------- */
.search-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { display: grid; gap: 12px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.searchbar { display: flex; gap: 10px; margin-bottom: 14px; }
.searchbar .input { font-size: 15px; padding: 11px 14px; }
.table-wrap { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 2px solid var(--focus); }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: var(--surface); }
table.data tr.snippet-row td { padding-top: 0; color: var(--ink-2); font-size: 12px; cursor: pointer; }
mark { background: color-mix(in srgb, var(--beige) 55%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.cand-name { font-weight: 700; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(11, 21, 40, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(980px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .2); }
.drawer-head { background: var(--navy); color: #fff; padding: 20px 24px 0; }
.drawer-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.drawer-head .sub { color: var(--beige); margin-top: 2px; }
.drawer-head .close { position: absolute; top: 14px; right: 16px; background: transparent; color: #fff; border: 0; font-size: 26px; cursor: pointer; line-height: 1; }
.tabs { display: flex; gap: 4px; margin-top: 14px; }
.tabs button { background: transparent; border: 0; color: rgba(255, 255, 255, .75); padding: 10px 12px; cursor: pointer; font-weight: 600; }
.tabs button[aria-selected="true"] { color: #fff; box-shadow: inset 0 -3px 0 var(--beige); }
.drawer-body { overflow-y: auto; padding: 20px 24px 40px; flex: 1; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.fact .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.fact .v { margin-top: 2px; word-break: break-word; }
.timeline { display: grid; gap: 12px; }
.tl-item { border-left: 2px solid var(--line); padding-left: 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--mark); box-shadow: 0 0 0 2px var(--bg); }
.tl-item .when { font-size: 12px; color: var(--muted); }
.tl-item .what { font-weight: 700; }
.preview-frame { width: 100%; height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.preview-img { max-width: 100%; border: 1px solid var(--line); border-radius: 12px; }
pre.cv-text { white-space: pre-wrap; word-break: break-word; background: var(--surface); padding: 16px; border-radius: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.55; }

/* ---------- matching ---------- */
.match-layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 20px; align-items: start; }
.match-form { display: grid; gap: 12px; }
.weights { display: grid; gap: 8px; }
.weight-row { display: grid; grid-template-columns: 1fr 120px 42px; gap: 8px; align-items: center; font-size: 12px; }
.weight-row input[type=range] { width: 100%; accent-color: var(--navy); }
.result { display: grid; grid-template-columns: 44px minmax(0, 1fr) 120px; gap: 14px; align-items: start; }
.rank { width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: var(--beige); display: grid; place-items: center; font-weight: 800; }
.score { text-align: right; }
.score .pct { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score .meter { margin-top: 8px; }
.breakdown { display: grid; gap: 6px; margin-top: 10px; }
.breakdown .b-row { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.breakdown .b-row .meter { height: 6px; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 12px; color: var(--ink-2); }
.evidence { display: grid; gap: 6px; margin-top: 8px; }
.evidence .ev { font-size: 12px; background: var(--surface); border-radius: 8px; padding: 6px 10px; }
.evidence .ev b { color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 700; font-size: 12px; padding: 0 6px; }

/* ---------- import ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: 16px; padding: 28px; text-align: center; color: var(--ink-2); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--focus); background: var(--surface); }
.progress { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--mark); transition: width .3s; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--navy); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff; }
.login-art img.logo { width: 220px; height: auto; }
.login-art .outline { position: absolute; right: -120px; bottom: -120px; width: 620px; opacity: .17; pointer-events: none; }
.login-art h1 { font-size: 46px; font-weight: 900; line-height: 1.05; margin: 0; max-width: 520px; position: relative; }
.login-art p { color: var(--beige); max-width: 460px; position: relative; }
.login-form { display: grid; place-items: center; padding: 32px 24px; }
.login-form form { width: min(380px, 100%); display: grid; gap: 14px; }
.error { color: var(--bad); font-size: 13px; }

#tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; max-width: 280px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; }
#toast .t { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; margin-top: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--track); border-top-color: var(--mark); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .match-layout, .search-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; max-height: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  main { padding: 20px 16px 48px; }
  .topbar-inner { padding: 12px 16px 0; gap: 8px 12px; height: auto; flex-wrap: wrap; justify-content: space-between; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .user-btn { padding: 4px 10px; font-size: 12px; }
  .topbar .product, .status-pill span { display: none; }
  .two-col, .three-col, .facts { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px 16px; min-height: 240px; }
  .login-art h1 { font-size: 30px; }
  .result { grid-template-columns: 36px minmax(0, 1fr); }
  .result .score { grid-column: 1 / -1; text-align: left; }
  .breakdown .b-row { grid-template-columns: 120px 1fr 56px; }
  .page-sub { margin-left: 0; }
}
