/* Hallmark · genre: modern-minimal · macrostructure: Workbench · design-system: design.md · designed-as-app
 * NAT Battle — единый каркас пользовательской части. Токены → база → компоненты.
 * Страничные <style> переопределяют только специфику. */
:root {
  --c-paper: oklch(98.4% 0.004 270);
  --c-card: #fff;
  --c-ink: oklch(26% 0.035 270);
  --c-ink-2: oklch(52% 0.025 270);
  --c-rule: oklch(93% 0.008 270);
  --c-accent: #667eea;
  --c-accent-2: #764ba2;
  --c-accent-soft: oklch(95% 0.03 277);
  --c-success: #10b981;
  --c-danger: #ef4444;
  --c-warn: #f59e0b;
  --c-focus: #667eea;
  --grad-brand: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --sh-card: 0 1px 2px oklch(26% 0.035 270 / .05), 0 4px 16px oklch(26% 0.035 270 / .06);
  --sh-pop: 0 8px 30px oklch(26% 0.035 270 / .14);
  --r-card: 18px; --r-el: 14px; --r-in: 12px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --ease-out: cubic-bezier(.16, 1, .3, 1); --dur: 220ms;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  /* legacy-алиасы для инлайн-стилей страниц */
  --primary: #667eea; --primary-dark: #5a67d8; --secondary: #764ba2;
  --success: #10b981; --danger: #ef4444; --warning: #f59e0b; --info: #3b82f6;
  --light: #f7f8fc; --dark: #1e2338; --gray: #6b7191;
  --shadow: 0 1px 2px oklch(26% 0.035 270 / .05), 0 4px 16px oklch(26% 0.035 270 / .06);
  --radius: 18px;
  --c-glass: oklch(100% 0 0 / .86);
  --c-card-bd: oklch(100% 0 0 / .7);
}
/* ---------- Тёмная тема (по системной настройке) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --c-paper: oklch(16.5% 0.02 270);
    --c-card: oklch(21.5% 0.028 270);
    --c-ink: oklch(93% 0.01 270);
    --c-ink-2: oklch(66% 0.025 270);
    --c-rule: oklch(30% 0.022 270);
    --c-accent-soft: oklch(30% 0.07 277);
    --c-glass: oklch(17% 0.02 270 / .86);
    --c-card-bd: oklch(100% 0 0 / .08);
    --sh-card: 0 1px 2px oklch(0% 0 0 / .25), 0 4px 16px oklch(0% 0 0 / .3);
    --sh-pop: 0 8px 30px oklch(0% 0 0 / .45);
    /* legacy-алиасы */
    --light: #262938; --dark: #f0f1f7; --gray: #8a8fa3;
    --shadow: 0 1px 2px oklch(0% 0 0 / .25), 0 4px 16px oklch(0% 0 0 / .3);
  }
}
/* ---------- база ---------- */
html, body { overflow-x: clip; }
body {
  font-family: var(--font); color: var(--c-ink); background: var(--c-paper);
  font-size: 15px; line-height: 1.5; margin: 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { color: var(--c-ink); font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin: 0 0 var(--s-3); }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
a { color: var(--c-accent); text-decoration: none; }
img, svg { max-width: 100%; }
::selection { background: oklch(62% 0.17 277 / .18); }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }
/* ---------- шапка ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: oklch(100% 0 0 / .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--c-rule);
  padding: var(--s-3) var(--s-4);
}
.header-content { display: flex; align-items: center; gap: var(--s-3); max-width: 720px; margin: 0 auto; }
.header-title { flex: 1; min-width: 0; }
.header-title h1, .header-title .app-name {
  font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-title .header-sub, .header-sub {
  font-size: 12px; font-weight: 600; color: var(--c-ink-2); margin-top: 1px;
}
/* ---------- каркас ---------- */
.content, .page-content, .container { max-width: 720px; margin: 0 auto; padding: var(--s-4); }
/* ---------- карточки ---------- */
.card {
  background: var(--c-card); border: 1px solid var(--c-rule); border-radius: var(--r-card);
  box-shadow: var(--sh-card); padding: var(--s-4); margin-bottom: var(--s-3);
}
.section-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-ink-2); margin: var(--s-5) var(--s-1) var(--s-2);
}
/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 15px; font-weight: 700; line-height: 1;
  border: 0; border-radius: var(--r-el); padding: 14px 20px; cursor: pointer;
  background: var(--grad-brand); color: #fff; text-align: center;
  box-shadow: 0 6px 18px oklch(62% 0.17 277 / .30);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), filter var(--dur) var(--ease-out);
}
.btn:active { transform: scale(.97); box-shadow: 0 2px 8px oklch(62% 0.17 277 / .25); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-secondary, .btn.outline {
  background: var(--c-accent-soft); color: var(--c-accent); box-shadow: none;
}
.btn-ghost {
  background: transparent; color: var(--c-ink-2); box-shadow: none;
  border: 1px solid var(--c-rule);
}
.btn-danger { background: var(--c-danger); box-shadow: 0 6px 18px oklch(58% 0.21 27 / .28); }
.btn-success { background: var(--c-success); box-shadow: 0 6px 18px oklch(66% 0.15 165 / .28); }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 12px; }
.back-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px;
  background: var(--c-accent-soft); color: var(--c-accent); border: 0; cursor: pointer;
  font-size: 15px; transition: transform var(--dur) var(--ease-out);
}
.back-btn:active { transform: scale(.94); }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--c-rule); background: var(--c-card); color: var(--c-ink); cursor: pointer;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.page-btn.active { background: var(--c-accent-soft); border-color: transparent; color: var(--c-accent); }
/* ---------- формы ---------- */
.form-group { margin-bottom: var(--s-4); }
.form-group label, .form-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--c-ink-2); margin-bottom: 6px;
}
.form-input, .input, .form-group input, .form-group select, .form-group textarea, :where(input[type=text], input[type=number], input[type=password], input[type=date], input[type=time]), select, textarea {
  width: 100%; box-sizing: border-box;
  font-family: var(--font); font-size: 16px; color: var(--c-ink);
  background: var(--c-paper); border: 1.5px solid var(--c-rule); border-radius: var(--r-in);
  padding: 12px 14px; outline: none;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.form-input:focus, .input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--c-accent); box-shadow: 0 0 0 3px oklch(62% 0.17 277 / .14);
}
textarea { resize: vertical; min-height: 88px; }
/* ---------- статистика ---------- */
.stat-card, .stats-grid { /* сетка задаёт страница */ }
.stat-item {
  background: var(--c-card); border: 1px solid var(--c-rule); border-radius: var(--r-el);
  padding: var(--s-3); box-shadow: var(--sh-card);
}
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--c-ink); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--c-ink-2); }
.stat-icon {
  width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--c-accent-soft); color: var(--c-accent); font-size: 15px; flex: 0 0 38px;
}
/* ---------- списки/детали ---------- */
.detail-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  padding: 10px 0; border-bottom: 1px solid var(--c-rule);
}
.detail-row:last-child { border-bottom: 0; }
.detail-label { font-size: 13px; font-weight: 600; color: var(--c-ink-2); }
.detail-value { font-size: 15px; font-weight: 700; color: var(--c-ink); text-align: right; min-width: 0; overflow-wrap: anywhere; }
/* ---------- notice / empty ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--c-accent-soft); color: oklch(40% 0.12 277);
  border-radius: var(--r-el); padding: 12px 14px; font-size: 14px; font-weight: 600; margin-bottom: var(--s-3);
}
.notice.success { background: oklch(95% 0.045 165); color: oklch(45% 0.12 165); }
.notice.error, .notice.err { background: oklch(95% 0.04 27); color: oklch(48% 0.18 27); }
.notice.warning { background: oklch(96% 0.06 85); color: oklch(45% 0.12 70); }
.empty-state { text-align: center; padding: var(--s-8) var(--s-4); }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto var(--s-3); border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-accent-soft); color: var(--c-accent); font-size: 24px;
}
.empty-title { font-size: 16px; font-weight: 800; color: var(--c-ink); margin-bottom: 4px; }
.empty-text { font-size: 14px; color: var(--c-ink-2); max-width: 300px; margin: 0 auto; }
/* ---------- нижняя навигация ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: stretch;
  background: oklch(100% 0 0 / .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--c-rule);
  padding: 6px max(8px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-bottom));
  max-width: none;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 6px; border-radius: 12px; min-width: 46px; flex: 1;
  color: var(--c-ink-2); font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
  transition: color var(--dur) var(--ease-out);
}
.nav-item .nav-icon {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: 15px; transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.nav-item.active { color: var(--c-accent); }
.nav-item.active .nav-icon { background: var(--c-accent-soft); }
.nav-label { white-space: nowrap; }
/* ---------- бейджи/пиллы ---------- */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--c-accent-soft); color: var(--c-accent); white-space: nowrap;
}
.badge.success, .pill.success { background: oklch(94% 0.05 165); color: oklch(45% 0.12 165); }
.badge.danger, .pill.danger { background: oklch(94% 0.045 27); color: oklch(50% 0.19 27); }
.badge.warning, .pill.warning { background: oklch(96% 0.06 85); color: oklch(46% 0.12 70); }
.badge.gray, .pill.gray { background: oklch(94% 0.008 270); color: var(--c-ink-2); }
/* ---------- прогресс ---------- */
.progress-track { height: 8px; border-radius: 999px; background: oklch(94% 0.008 270); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--grad-brand); transition: width var(--dur) var(--ease-out); }
/* ---------- анимация появления ---------- */
.fade-in, .slide-up { animation: nbIn .45s var(--ease-out) both; }
@keyframes nbIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .fade-in, .slide-up { animation: none; }
}
/* ---------- desktop ---------- */
@media (min-width: 768px) {
  body { font-size: 15px; }
  .content, .page-content, .container { padding: var(--s-6) var(--s-5); }
  .bottom-nav {
    left: 50%; right: auto; transform: translateX(-50%);
    width: 100%; max-width: 480px; bottom: 14px;
    border: 1px solid var(--c-rule); border-radius: 22px;
    box-shadow: var(--sh-pop); padding: 8px;
  }
}

/* ---------- Скелетоны (загрузка) ---------- */
.skl {
  border-radius: 10px;
  background: linear-gradient(100deg, oklch(94% 0.008 270) 40%, oklch(97% 0.004 270) 50%, oklch(94% 0.008 270) 60%);
  background-size: 200% 100%;
  animation: sklShimmer 1.2s linear infinite;
}
@keyframes sklShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skl-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-rule); }
.skl-row:last-child { border-bottom: 0; }
.skl-row .skl-ic { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; }
.skl-row .skl-l { flex: 1; }
.skl-l .skl-a { height: 12px; width: 55%; }
.skl-l .skl-b { height: 9px; width: 80%; margin-top: 7px; }
.skl-row .skl-v { width: 56px; height: 14px; }
.skl-ic, .skl-a, .skl-b, .skl-v { background: oklch(93% 0.008 270); border-radius: 8px; background-image: linear-gradient(100deg, oklch(93% 0.008 270) 40%, oklch(96% 0.004 270) 50%, oklch(93% 0.008 270) 60%); background-size: 200% 100%; animation: sklShimmer 1.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .skl, .skl-ic, .skl-l .skl-a, .skl-l .skl-b, .skl-v { animation: none; } }
