:root {
  color-scheme: light;
  --ink: #171a1f;
  --muted: #6c706f;
  --paper: #f3f2ed;
  --card: #fffefa;
  --line: #deddd7;
  --accent: #ff5a36;
  --accent-soft: #ffe4db;
  --green: #24765a;
  --green-soft: #dfeee6;
  --nav: rgba(255, 254, 250, .92);
  --shadow: 0 14px 40px rgba(27, 30, 30, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: #d9d8d2; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.hidden { display: none !important; }

.app-shell {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 110% -5%, rgba(255, 90, 54, .13), transparent 28%),
    var(--paper);
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 66px;
  padding: max(14px, env(safe-area-inset-top)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(243,242,237,.98), rgba(243,242,237,.82));
  backdrop-filter: blur(16px);
}

.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 850; letter-spacing: .11em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 9px; letter-spacing: 0; font: 800 15px/1 Georgia, serif; }
.mode-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; color: #4c504f; background: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; }
.mode-pill i { width: 7px; height: 7px; background: #e39b19; border-radius: 50%; box-shadow: 0 0 0 3px #faedcf; }

main { padding: 16px 16px calc(106px + env(safe-area-inset-bottom)); }
.app-shell.auth-mode main { padding-bottom: 16px; }
.view { animation: enter .28s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font: 650 clamp(34px, 10vw, 49px)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
p { line-height: 1.5; }

.hero { padding: 18px 2px 24px; }
.hero-copy { margin: 15px 0 18px; max-width: 390px; color: var(--muted); font-size: 15px; }
.role-row { display: flex; flex-wrap: wrap; gap: 7px; }
.role-chip { padding: 8px 11px; border: 1px solid #d5d4ce; border-radius: 999px; background: rgba(255,255,255,.45); font-size: 12px; font-weight: 700; }
.role-chip.remote { color: var(--green); border-color: #bcd9cb; background: var(--green-soft); }

.setup-card { margin: 0 0 18px; padding: 17px; display: flex; gap: 13px; align-items: flex-start; border-radius: 17px; border: 1px solid #ecc8bb; background: #fff5ef; }
.setup-card.ready { border-color: #bcd9cb; background: #edf7f1; }
.setup-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: white; font-weight: 850; }
.setup-card.ready .setup-icon { background: var(--green); }
.setup-card strong { display: block; margin: 1px 0 4px; font-size: 14px; }
.setup-card p { margin: 0; color: var(--muted); font-size: 12px; }
.text-button { margin: 9px 0 0; padding: 0; border: 0; color: var(--accent); background: none; font-size: 12px; font-weight: 800; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 24px; }
.metric { min-height: 118px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.metric.accent { color: #fff; border-color: #1f2328; background: #1f2328; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.metric.accent .metric-label { color: #b7bcbf; }
.metric-value { display: block; margin-top: 13px; font: 600 38px/1 Georgia, serif; letter-spacing: -.04em; }
.metric-note { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.metric.accent .metric-note { color: #c5c8ca; }

.section-head { margin: 25px 2px 12px; display: flex; justify-content: space-between; align-items: baseline; }
.section-head button { padding: 0; border: 0; color: var(--accent); background: none; font-size: 12px; font-weight: 750; cursor: pointer; }

.vacancy-list, .resume-list, .settings-list { display: grid; gap: 10px; }
.vacancy-card { display: block; padding: 16px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 8px 24px rgba(25,28,28,.045); }
.vacancy-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.vacancy-card h3 { margin: 0; font-size: 16px; line-height: 1.2; letter-spacing: -.018em; }
.company { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.score { flex: 0 0 auto; min-width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 13px; font-weight: 850; }
.score.low { color: #b13d28; background: var(--accent-soft); }
.vacancy-meta { margin-top: 15px; display: flex; justify-content: space-between; gap: 10px; color: #525655; font-size: 12px; }
.status-tag { padding: 5px 8px; border-radius: 8px; background: #ecebe6; font-weight: 700; }

.page-title { padding: 15px 2px 21px; }
.page-title h1 { font-size: 39px; }
.page-title p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.resume-card { padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.resume-head { display: flex; align-items: center; gap: 12px; }
.resume-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #ecebe6; font: 650 18px/1 Georgia, serif; }
.resume-card h3 { margin: 0 0 4px; font-size: 15px; }
.resume-state { color: var(--muted); font-size: 12px; }
.resume-score { margin-left: auto; color: var(--green); font-size: 13px; font-weight: 800; }
.resume-progress { width: 100%; height: 5px; margin-top: 15px; display: block; border: 0; border-radius: 6px; background: #e9e8e2; overflow: hidden; appearance: none; }
.resume-progress::-webkit-progress-bar { background: #e9e8e2; }
.resume-progress::-webkit-progress-value { background: var(--green); border-radius: 6px; }
.resume-progress::-moz-progress-bar { background: var(--green); border-radius: 6px; }

.setting-card { padding: 15px 16px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.setting-copy { flex: 1; min-width: 0; }
.setting-copy strong { display: block; font-size: 14px; }
.setting-copy span { color: var(--muted); font-size: 11px; }
.stepper { display: flex; align-items: center; border: 1px solid #d6d5cf; border-radius: 12px; overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: #f5f4ef; color: var(--ink); font-size: 20px; cursor: pointer; }
.stepper output { min-width: 42px; text-align: center; font-size: 13px; font-weight: 800; }
.stepper button:disabled { color: #b8b8b3; }
.settings-note { margin: 15px 2px; padding: 14px; border-radius: 14px; color: #5d5f5d; background: #e8e7e1; font-size: 12px; }
.settings-heading { margin-top: 25px; }
.criteria-card { padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.criteria-card > label:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 800; }
.criteria-card > label:first-child span { color: var(--muted); font-size: 10px; font-weight: 500; text-align: right; }
.criteria-card textarea { width: 100%; min-height: 112px; margin: 10px 0 14px; padding: 12px; resize: vertical; border: 1px solid #d6d5cf; border-radius: 12px; color: var(--ink); background: #faf9f5; font-family: inherit; font-size: 14px; line-height: 1.45; }
.criteria-card textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2px 0 12px; }
.field { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 750; }
.field.wide { margin-top: 13px; }
.field input, .field select { width: 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid #d6d5cf; border-radius: 11px; color: var(--ink); background: #faf9f5; font-family: inherit; font-size: 13px; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.filter-group { margin-top: 9px; border: 1px solid #d6d5cf; border-radius: 12px; background: #faf9f5; overflow: hidden; }
.filter-group summary { min-height: 45px; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 800; }
.filter-group summary::-webkit-details-marker { display: none; }
.filter-group summary b { color: var(--muted); font-size: 10px; font-weight: 600; }
.filter-options { max-height: 230px; padding: 4px 10px 10px; display: grid; gap: 2px; overflow: auto; border-top: 1px solid #e3e2dc; }
.check-option { min-height: 38px; display: flex; align-items: center; gap: 9px; color: #414543; font-size: 12px; font-weight: 600; }
.check-option input { width: 18px; height: 18px; accent-color: var(--green); }
.catalog-warning { margin: 3px 0 12px; padding: 12px; border-radius: 11px; color: #72591d; background: #fff0c9; font-size: 11px; line-height: 1.45; }
.toggle-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 13px; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i { flex: 0 0 auto; width: 46px; height: 27px; padding: 3px; border-radius: 999px; background: #cfcec8; transition: .18s ease; }
.toggle-row i::after { content: ""; display: block; width: 21px; height: 21px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: .18s ease; }
.toggle-row input:checked + i { background: var(--green); }
.toggle-row input:checked + i::after { transform: translateX(19px); }
.toggle-row input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.save-button { width: 100%; min-height: 46px; margin-top: 16px; border: 0; border-radius: 13px; color: white; background: var(--ink); font-size: 13px; font-weight: 800; cursor: pointer; }
.save-button:disabled { opacity: .55; cursor: wait; }

.empty-card { padding: 27px 18px; text-align: center; border: 1px dashed #cfcec7; border-radius: 18px; color: var(--muted); background: rgba(255,255,255,.35); }
.empty-card strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 14px; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(520px, 100%); padding: 8px 8px max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid rgba(207,206,199,.82); background: var(--nav); backdrop-filter: blur(18px); }
.nav-item { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 13px; color: #8a8d8b; background: transparent; cursor: pointer; }
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nav-item span { font-size: 10px; font-weight: 700; }
.nav-item.active { color: var(--ink); background: #e9e8e2; }

.auth-screen { min-height: calc(100dvh - 98px); padding: 35px 5px; display: flex; flex-direction: column; justify-content: center; }
.auth-art { width: 90px; height: 90px; margin-bottom: 35px; position: relative; display: grid; place-items: center; border-radius: 28px; color: white; background: var(--accent); transform: rotate(-6deg); box-shadow: 18px 18px 0 #22262b; }
.auth-art span { font: 650 42px/1 Georgia, serif; transform: rotate(6deg); }
.auth-screen p:not(.eyebrow) { margin: 20px 0 25px; color: var(--muted); font-size: 15px; }
.primary-button { width: 100%; min-height: 52px; display: grid; place-items: center; border-radius: 15px; color: white; background: var(--ink); text-decoration: none; font-size: 14px; font-weight: 800; }

.loading-screen { padding-top: 18px; }
.skeleton { background: linear-gradient(90deg, #e7e5df 25%, #f1f0eb 50%, #e7e5df 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 18px; }
.skeleton-hero { height: 180px; margin-bottom: 18px; }
.skeleton-metric { height: 118px; }
.skeleton-card { height: 130px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); padding: 11px 14px; border-radius: 12px; color: #fff; background: #24282d; opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 600px) {
  body { padding: 18px 0; }
  .app-shell { min-height: calc(100dvh - 36px); border-radius: 24px; box-shadow: 0 20px 70px rgba(25,28,28,.16); overflow: clip; }
  .bottom-nav { bottom: 18px; border-radius: 0 0 24px 24px; }
}

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