:root {
  --ink: #14233d;
  --muted: #667085;
  --line: #dfe4ea;
  --paper: #f5f7f9;
  --white: #ffffff;
  --navy: #13243e;
  --navy-2: #1c3152;
  --mint: #54ddb5;
  --mint-soft: #dff8ef;
  --blue-soft: #e8f0ff;
  --orange: #ef8d5a;
  --orange-soft: #fff0e8;
  --red: #d85353;
  --shadow: 0 14px 38px rgba(20, 35, 61, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 20px;
  color: #eef4ff; background: var(--navy);
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 34px; font-weight: 780; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--navy); background: var(--mint); }
.brand-mark svg, .icon svg { width: 20px; height: 20px; }
.nav-label { margin: 0 12px 10px; color: #8495af; font-size: .75rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.nav { display: grid; gap: 7px; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: #afbdd2; font-weight: 650; }
.nav a:hover, .nav a.active { color: white; background: var(--navy-2); }
.nav a.active { box-shadow: inset 3px 0 var(--mint); }
.nav svg { width: 19px; height: 19px; }
.sidebar-foot { margin-top: auto; padding: 16px; border-radius: 15px; background: rgba(255,255,255,.055); color: #aebbd0; font-size: .84rem; }
.sidebar-foot strong { color: white; display: block; margin-bottom: 5px; }

.main { min-width: 0; padding: 34px 42px 56px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 5px; color: #62708a; font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1 { margin: 0; color: var(--navy); font-size: clamp(1.7rem, 2.7vw, 2.35rem); line-height: 1.1; letter-spacing: -.04em; }
.subtitle { margin: 8px 0 0; color: var(--muted); max-width: 680px; }
.source-link { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: white; text-decoration: none; font-weight: 700; white-space: nowrap; }
.source-link:hover { border-color: #abb7c8; }
.source-link svg { width: 16px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.metric { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 17px 18px; }
.metric strong { display: block; font-size: 1.55rem; letter-spacing: -.035em; }
.metric span { color: var(--muted); font-size: .86rem; }
.metric.accent { background: var(--navy); color: white; border-color: var(--navy); }
.metric.accent span { color: #b8c6d9; }

.filters { display: grid; grid-template-columns: minmax(250px, 1.55fr) repeat(3, minmax(145px, .62fr)); gap: 10px; margin-bottom: 18px; }
.filters .btn { width: fit-content; }
.control { position: relative; }
.control svg { position: absolute; left: 14px; top: 50%; width: 18px; transform: translateY(-50%); color: #728099; pointer-events: none; }
.control input, .control select, .field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); min-height: 46px; padding: 0 13px; outline: none;
}
.control input { padding-left: 42px; }
.control input:focus, .control select:focus, .field input:focus, .field textarea:focus { border-color: #6a8db8; box-shadow: 0 0 0 3px rgba(72,110,157,.12); }
.btn { border: 0; border-radius: 12px; min-height: 46px; padding: 0 16px; cursor: pointer; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { color: var(--navy); background: var(--mint); }
.btn-primary:hover { filter: brightness(.96); }
.btn-secondary { color: var(--ink); background: white; border: 1px solid var(--line); }
.btn-secondary:hover { border-color: #aeb9c9; }
.btn-quiet { color: #52617a; background: transparent; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 22px 0 12px; }
.result-head h2 { margin: 0; font-size: 1.05rem; }
.result-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.results { display: grid; gap: 12px; }
.job {
  display: grid; grid-template-columns: 58px minmax(0,1.7fr) minmax(145px,.65fr) minmax(150px,.72fr) 120px 38px;
  align-items: center; gap: 16px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 16px; transition: transform .16s, box-shadow .16s, border-color .16s;
}
.job.is-hidden, .job[hidden] { display: none !important; }
.job:hover { transform: translateY(-1px); border-color: #bdc7d5; box-shadow: 0 9px 26px rgba(20,35,61,.065); }
.rank { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #eef2f6; color: #42516a; font-weight: 800; }
.job-title { margin: 0 0 4px; font-size: 1rem; line-height: 1.28; }
.company { color: var(--muted); font-size: .88rem; }
.meta { color: #34425a; font-size: .86rem; }
.meta strong { display: block; color: #7b8799; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 3px; }
.badge { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 29px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.badge-very { color: #075d47; background: var(--mint-soft); }
.badge-strong { color: #224f8e; background: var(--blue-soft); }
.badge-relevant { color: #9b532f; background: var(--orange-soft); }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 11px; color: #758197; background: #f3f5f7; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover, .icon-btn.saved { color: var(--orange); background: var(--orange-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.empty { display: none; padding: 46px 20px; border: 1px dashed #c4ccd8; border-radius: 18px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); }
.empty.visible { display: block; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(9,21,39,.44); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; z-index: 31; width: min(540px, 100%); height: 100vh; overflow: auto; background: white; transform: translateX(102%); transition: transform .25s ease; box-shadow: -20px 0 60px rgba(11,25,48,.2); }
.drawer.open { transform: translateX(0); }
.drawer-inner { padding: 30px 30px 44px; }
.drawer-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.drawer h2 { margin: 12px 0 4px; font-size: 1.55rem; line-height: 1.2; letter-spacing: -.03em; }
.drawer-company { color: var(--muted); margin-bottom: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 19px 0 24px; }
.detail-chip { padding: 13px; border-radius: 13px; background: #f4f6f8; font-size: .86rem; }
.detail-chip strong { display: block; color: #7d8796; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.detail-block { padding: 18px 0; border-top: 1px solid var(--line); }
.detail-block h3 { margin: 0 0 8px; font-size: .86rem; text-transform: uppercase; letter-spacing: .07em; color: #5e6d83; }
.detail-block p { margin: 0; }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .7fr); gap: 18px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel h2 { margin: 0; font-size: 1.08rem; }
.panel-desc { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.field label { display: block; margin-bottom: 7px; font-size: .84rem; font-weight: 750; }
.field small { display: block; color: var(--muted); margin-top: 6px; }
.field textarea { min-height: 94px; padding: 12px 13px; resize: vertical; }
.span-2 { grid-column: 1 / -1; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 9px; background: #edf2f7; color: #34445e; font-size: .82rem; font-weight: 700; }
.tag button { padding: 0; border: 0; background: none; color: #8b96a6; cursor: pointer; font-size: 1rem; line-height: 1; }
.tag-editor input { flex: 1; min-width: 140px; border: 0; outline: none; min-height: 31px; }
.savebar { position: sticky; bottom: 14px; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.priority { display: flex; gap: 8px; flex-wrap: wrap; }
.priority span { padding: 8px 10px; border-radius: 10px; background: #f1f4f7; font-weight: 700; font-size: .82rem; }
.priority span:first-child { color: #075d47; background: var(--mint-soft); }
.profile-list { display: grid; gap: 14px; }
.profile-item { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.profile-item:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-item strong { display: block; font-size: .78rem; color: #788497; text-transform: uppercase; letter-spacing: .07em; }
.profile-item span { display: block; margin-top: 4px; }
.notice { display: flex; gap: 10px; padding: 14px; border-radius: 13px; background: var(--mint-soft); color: #165f4d; font-size: .84rem; }
.notice svg { flex: 0 0 auto; width: 18px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 11px; background: var(--navy); color: white; box-shadow: var(--shadow); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1.2fr 1fr 1fr; }
  .job { grid-template-columns: 48px minmax(0, 1.4fr) minmax(130px, .7fr) 110px 38px; }
  .job .salary { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { display: block; padding-bottom: 74px; }
  .sidebar { position: fixed; z-index: 20; inset: auto 0 0; height: 70px; padding: 8px 14px; flex-direction: row; align-items: center; }
  .brand, .nav-label, .sidebar-foot { display: none; }
  .nav { width: 100%; grid-template-columns: 1fr 1fr; }
  .nav a { justify-content: center; padding: 10px; }
  .nav a.active { box-shadow: inset 0 -3px var(--mint); }
  .main { padding: 24px 16px 32px; }
  .topbar { display: block; }
  .source-link { margin-top: 16px; }
  .metrics { gap: 8px; }
  .metric { padding: 14px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .control:first-child { grid-column: 1 / -1; }
  .job { grid-template-columns: 42px minmax(0, 1fr) 38px; gap: 10px; padding: 14px; }
  .job .meta, .job .badge { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .panel { padding: 19px; }
  .drawer-inner { padding: 20px 18px 36px; }
}

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

.user-menu { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-menu form { margin: 0; }
.logout { border: 0; background: none; color: #afbdd2; padding: 0; cursor: pointer; text-decoration: underline; }
.loading { padding: 46px 20px; border-radius: 18px; text-align: center; color: var(--muted); background: white; border: 1px solid var(--line); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy); }
.login-card { width: min(440px, 100%); background: white; border-radius: 24px; padding: 34px; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
.login-card .brand { color: var(--navy); margin: 0 0 28px; }
.login-card h1 { font-size: 2rem; }
.login-card p { color: var(--muted); }
.login-card .btn { width: 100%; margin-top: 14px; text-decoration: none; }
.error-banner { margin: 14px 0; padding: 12px; border-radius: 11px; color: #842b2b; background: #ffebeb; }
.save-state { margin-right: auto; color: var(--muted); font-size: .84rem; }

