/* worksearch — мобильный интерфейс.
   Крупные цели нажатия, минимум текста, читается на солнце и в перчатках. */

:root {
  --bg: #0f1319;
  --surface: #171c24;
  --surface-2: #1e242e;
  --line: #2a3240;
  --text: #e8edf4;
  --muted: #97a3b4;
  --accent: #ffb020;
  --accent-ink: #1a1206;
  --good: #3ddc84;
  --warn: #ff8a5b;
  --radius: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f0f2f6;
    --line: #dde2ea;
    --text: #141a22;
    --muted: #5d6b7d;
    --accent: #e07b00;
    --accent-ink: #ffffff;
    --good: #1a8f4c;
    --warn: #c2410c;
  }
}

* { box-sizing: border-box; }

/* display у .sheet и .toast перебивает атрибут hidden — возвращаем ему силу */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ─── шапка ─── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em;
}
.brand-mark {
  display: grid; place-items: center; width: 26px; height: 26px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 7px; font-size: 15px; font-weight: 800;
}
.tabs { display: flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.tab {
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 15px; padding: 8px 9px; border-radius: 8px; cursor: pointer;
  white-space: nowrap;
}

/* На узких экранах слово в логотипе уступает место вкладкам. */
@media (max-width: 420px) {
  .brand-word { display: none; }
}
.tab.is-active { color: var(--text); background: var(--surface-2); font-weight: 600; }

main { padding-top: 20px; padding-bottom: 40px; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

h2 { font-size: 21px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -0.01em; }
h3 { font-size: 18px; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.hint em { font-style: normal; opacity: .7; }

/* ─── прогресс ─── */
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.progress-label { color: var(--muted); font-size: 13px; margin: 8px 0 18px; }

/* ─── форма ─── */
.step { display: none; border: 0; padding: 0; margin: 0 0 24px; }
.step.is-active { display: block; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, textarea {
  width: 100%; padding: 13px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: 16px; /* 16px — иначе iOS зумит при фокусе */
}
.field input:focus, .field select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.row { display: flex; gap: 10px; }
.row .grow { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 11px 14px; border-radius: 999px; font: inherit; font-size: 15px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--muted); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.check { display: flex; align-items: center; gap: 9px; font-size: 15px; padding: 7px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.btn {
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 13px 18px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  min-height: 48px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.small { padding: 9px 13px; font-size: 14px; min-height: 40px; }
.btn:disabled { opacity: .45; cursor: default; }

.step-nav { display: flex; gap: 10px; }
.step-nav .btn { flex: 1; }
.save-state { color: var(--muted); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ─── места работы ─── */
.job-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.job-card .duties { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.job-remove { background: none; border: 0; color: var(--warn); font: inherit; font-size: 14px; cursor: pointer; padding: 4px 0; }

/* ─── лента вакансий ─── */
.feed-head { margin-bottom: 14px; }
.filters { margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filters summary { padding: 13px 14px; cursor: pointer; font-weight: 600; font-size: 15px; }
.filters-body { padding: 0 14px 14px; }

.feed { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px;
}
.card-title { font-size: 17px; font-weight: 700; margin: 0 0 3px; line-height: 1.3; }
.card-company { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.card-pay { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.card-pay .per { font-size: 14px; font-weight: 500; color: var(--muted); }
.card-travel { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.card-travel strong { color: var(--text); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge {
  font-size: 12.5px; padding: 4px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

.reasons { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.reasons b { color: var(--text); font-weight: 600; }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.phone-box {
  margin-top: 10px; padding: 11px 13px; background: var(--surface-2);
  border-radius: var(--radius); font-size: 16px;
}
.phone-box a { color: var(--accent); text-decoration: none; font-weight: 700; font-size: 19px; }
.transparency { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ─── резюме ─── */
.resume-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.resume-view { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.resume-view:empty { display: none; }
.resume-view h1 { font-size: 22px; margin: 0 0 2px; }
.resume-view .position { color: var(--muted); margin: 0 0 4px; }
.resume-view .contacts { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.resume-view section { margin-bottom: 16px; }
.resume-view h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin: 0 0 8px;
}
.resume-view ul { margin: 0; padding-left: 18px; }
.resume-view li { margin: 3px 0; }
.resume-view .job-head { font-weight: 600; }
.resume-view .period { color: var(--muted); font-size: 14px; }

.notice {
  padding: 12px 14px; border-radius: var(--radius); font-size: 14px;
  background: color-mix(in srgb, var(--good) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 35%, transparent);
  margin-bottom: 14px;
}
.notice.bad {
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

/* ─── шторка письма ─── */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-inner {
  background: var(--bg); width: 100%; max-width: 720px;
  max-height: 88vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  position: relative;
}
.sheet-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: 0; color: var(--muted); font-size: 30px; line-height: 1; cursor: pointer;
}
.letter-variant {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.letter-variant.is-assigned { border-color: var(--accent); }
.letter-variant h4 { margin: 0 0 4px; font-size: 15px; }
.letter-variant .tagline { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.letter-text {
  white-space: pre-wrap; background: var(--surface-2);
  padding: 12px; border-radius: 10px; font-size: 15px; line-height: 1.55; margin-bottom: 10px;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; z-index: 60;
}

.foot { color: var(--muted); font-size: 13px; padding-bottom: 28px; }
.foot a { color: var(--muted); }

.empty { color: var(--muted); text-align: center; padding: 40px 16px; }
.spinner { text-align: center; padding: 32px; color: var(--muted); }

@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-inner { border-radius: 16px; max-height: 84vh; }
}

/* ─── экран входа ─── */
.gate-body { display: flex; min-height: 100vh; min-height: 100dvh; }
.gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 400px; }

.gate-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 19px; margin-bottom: 10px; }
.gate-lead { color: var(--muted); font-size: 15px; margin: 0 0 22px; }

.gate-switch {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--surface-2); border-radius: 10px;
}
.gate-tab {
  flex: 1; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 15px; padding: 10px; border-radius: 7px; cursor: pointer;
}
.gate-tab.is-active { background: var(--surface); color: var(--text); font-weight: 600; }

.gate-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.gate-error {
  font-size: 14px; padding: 11px 13px; border-radius: var(--radius); margin: 0 0 14px;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.gate-submit { width: 100%; }
.gate-foot { color: var(--muted); font-size: 13px; margin: 20px 0 0; }

/* ─── админка ─── */
.admin { padding-top: 20px; padding-bottom: 60px; }
.admin section { margin-bottom: 34px; }
.admin .tab { text-decoration: none; display: inline-block; }

.fstep { margin-bottom: 12px; }
.fstep-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.fstep-head b { font-size: 17px; }
.fbar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 5px 0 3px; }
.fbar i { display: block; height: 100%; background: var(--accent); }
.fstep-foot { color: var(--muted); font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.tile b { display: block; font-size: 24px; line-height: 1.1; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: 13px; }
.tile-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.tile-warn b { color: var(--warn); }

.grid {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.grid th, .grid td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); font-weight: 500; font-size: 13px; }
.grid tr:last-child td { border-bottom: 0; }
.grid .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }

/* ─── меню аккаунта ─── */
.account { position: relative; margin-left: 6px; }
.account summary {
  list-style: none; cursor: pointer; color: var(--muted);
  padding: 6px 8px; border-radius: 8px; font-size: 20px; line-height: 1;
}
.account summary::-webkit-details-marker { display: none; }
.account[open] summary { background: var(--surface-2); color: var(--text); }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; min-width: 190px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
.account-login {
  margin: 0 0 10px; font-size: 14px; color: var(--muted);
  overflow-wrap: anywhere;
}
.account-menu .btn { width: 100%; margin-bottom: 6px; text-align: center; text-decoration: none; }
.account-menu .btn:last-child { margin-bottom: 0; }
