:root {
  --bg: #F4F1EA;
  --card: #FFFFFF;
  --ink: #141210;
  --ink-2: #2E2A25;
  --muted: #6B6458;
  --line: #E4DED2;
  --chip: #EDE8DD;
  --accent: #FF7A45;
  --ok-bg: #DDF3E4; --ok: #146C36;
  --warn-bg: #FFF1DC; --warn: #8A4B00;
  --bad-bg: #FDE3E1; --bad: #9B1C1C;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --nav-h: 76px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen { max-width: 520px; margin: 0 auto; padding: 20px 20px calc(var(--nav-h) + 28px); display: flex; flex-direction: column; gap: 14px; }
.loader { padding: 80px 0; text-align: center; color: var(--muted); }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logo { font-family: var(--display); font-size: 15px; font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.back { width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid var(--ink); background: transparent; display: flex; align-items: center; justify-content: center; flex: none; }
.title { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 0; }
.row { display: flex; align-items: center; gap: 10px; }

/* крупный блок */
.hero { padding: 10px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.hero .label { font-size: 14px; color: var(--muted); font-weight: 500; }
.hero .big { font-family: var(--display); font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.hero .sub { font-family: var(--display); font-size: 20px; font-weight: 500; line-height: 1.2; }

/* карточки */
.card { background: var(--card); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.accent { background: var(--accent); }
.card h2 { font-family: var(--display); font-size: 17px; font-weight: 700; margin: 0; }
.card .meta { font-size: 13px; color: var(--muted); }
.card.accent .meta { color: var(--ink-2); }
.card p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-family: var(--display); font-size: 22px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--muted); }
.soon { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 10px; background: var(--chip); }

/* кнопки */
.btn { height: 52px; border-radius: 26px; border: none; background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.accent { background: var(--accent); color: var(--ink); font-weight: 700; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.small { height: 40px; border-radius: 20px; font-size: 13px; padding: 0 14px; }
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); }
.btn.wide { width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

/* чипы */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1.5px solid var(--ink); background: transparent; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.tag { padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--chip); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.pro { background: var(--accent); color: var(--ink); }

/* поля */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; height: 52px; border-radius: 26px; border: 1.5px solid transparent; background: var(--card); padding: 0 20px; font-size: 16px; }
.input:focus { border-color: var(--ink); outline: none; }
.input.code { text-align: center; font-family: var(--display); font-size: 28px; letter-spacing: 12px; height: 64px; }
.note { border-radius: 18px; padding: 12px 14px; font-size: 13px; line-height: 1.45; background: var(--warn-bg); color: var(--warn); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.steps div { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.steps div::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); }
.steps .on { color: var(--ink); font-weight: 600; }
.steps .on::before, .steps .done::before { background: var(--ink); }

/* списки */
.list { display: flex; flex-direction: column; }
.item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.item:last-child { border-bottom: none; }
.item .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item .name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .time { font-size: 12px; color: var(--muted); flex: none; }
.item .text { font-size: 14px; color: var(--ink-2); line-height: 1.4; word-break: break-word; }
.k-login, .k-new_user { color: #146C36; } .k-logout { color: var(--muted); }
.k-error, .k-session_lost, .k-ban { color: var(--bad); } .k-admin { color: #1E4FA8; }
.kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 0; }
.search { height: 48px; border-radius: 24px; border: none; background: var(--card); padding: 0 18px; width: 100%; font-size: 15px; }

/* нижнее меню */
.nav { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); display: flex; justify-content: center; }
.nav .bar { max-width: 488px; width: 100%; background: var(--ink); border-radius: 30px; padding: 6px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.nav a { height: 46px; border-radius: 24px; display: flex; align-items: center; justify-content: center; color: #E9E4D8; text-decoration: none; font-size: 13px; font-weight: 600; }
.nav a[aria-current="page"] { background: var(--accent); color: var(--ink); }

.toast { position: fixed; left: 16px; right: 16px; top: 16px; margin: 0 auto; max-width: 488px; background: var(--ink); color: var(--bg); border-radius: 18px; padding: 14px 16px; font-size: 14px; line-height: 1.4; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--bad); color: #fff; }
