/* ================================================================
   Povion — Design System (tokens, reset, typography, utilities)
   ================================================================ */

/* ── Google Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
  /* Colours */
  --bg:             #f5f7fb;
  --surface:        #ffffff;
  --surface-2:      #f0f3f9;
  --surface-hover:  #e8ecf4;
  --ink:            #0e1626;
  --ink-2:          #46536b;
  --ink-3:          #8895a9;
  --line:           #e2e7f0;
  --line-strong:    #cdd5e3;

  --navy:           #0b1220;
  --navy-2:         #16233f;
  --navy-3:         #1e3050;

  --brand:          #2f6fed;
  --brand-2:        #1a4fbd;
  --brand-3:        #e8f0ff;

  --gold:           #f2b13d;
  --gold-3:         #fff8ec;

  --ok:             #12996b;
  --ok-3:           #ecfdf5;

  --urgent:         #e5484d;
  --urgent-3:       #fef2f2;

  --neutral:        #3b82f6;
  --neutral-3:      #eff6ff;

  --muted:          #9ca3af;
  --muted-3:        #f3f4f6;

  /* Typography */
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:           'JetBrains Mono', 'SF Mono', ui-monospace, monospace;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Borders */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 50px rgba(0,0,0,.10), 0 6px 12px rgba(0,0,0,.06);

  /* Transitions */
  --ease:   cubic-bezier(.4,0,.2,1);
  --dur:    .2s;

  /* Layout */
  --container: 1200px;
  --header-h:  64px;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; }
ul, ol { list-style: none; }

/* Focus-visible */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Typography ───────────────────────────────────────────────── */
h1 { font-size: clamp(28px, 4vw + 10px, 44px); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: clamp(22px, 3vw + 8px, 32px); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
h3 { font-size: 20px; font-weight: 700; line-height: 1.3; }
h4 { font-size: 16px; font-weight: 600; line-height: 1.35; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Container ────────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

/* ── Utility ──────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.mono-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600; font-size: 14px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
  min-height: 44px;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--brand); color: #fff;
}
.btn--primary:hover { background: var(--brand-2); box-shadow: 0 4px 14px rgba(47,111,237,.3); }

.btn--gold {
  background: var(--gold); color: var(--ink);
}
.btn--gold:hover { background: #e5a030; }

.btn--ghost {
  background: transparent; color: var(--ink-2);
  border: 1.5px solid var(--line-strong);
}
.btn--ghost:hover { background: var(--surface-hover); }

.btn--dark {
  background: var(--navy); color: #fff;
}
.btn--dark:hover { background: var(--navy-2); }

.btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: 13px; min-height: 36px;
}

.btn--full { width: 100%; }

/* ── Badges / Pills ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge--ok { background: var(--ok-3); color: var(--ok); }
.badge--urgent { background: var(--urgent-3); color: var(--urgent); }
.badge--neutral { background: var(--neutral-3); color: var(--neutral); }
.badge--finished { background: var(--muted-3); color: var(--muted); }
.badge--gold { background: var(--gold-3); color: #b8860b; }

/* ── Stat counters ───────────────────────────────────────────── */
.stat {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-4) var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  min-width: 80px;
}
.stat__value {
  font-size: 28px; font-weight: 800;
  font-family: var(--mono);
  line-height: 1;
}
.stat__label {
  font-size: 11px; color: var(--ink-3);
  margin-top: var(--space-1);
  text-align: center;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center; color: var(--ink-3);
}
.empty-state__icon {
  font-size: 48px; margin-bottom: var(--space-4); opacity: .5;
}
.empty-state__text { font-size: 16px; margin-bottom: var(--space-2); color: var(--ink-2); font-weight: 500; }
.empty-state__hint { font-size: 13px; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Notification Modal ──────────────────────────────────────── */
/* Базовые стили — самодостаточны на любой странице */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  z-index: 1000;
}
.modal.active { display: flex; }

.modal__overlay { position: absolute; inset: 0; }

.modal__content {
  position: relative;
  background: var(--surface);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 90%;
  z-index: 1001;
  box-shadow: var(--shadow-xl);
  animation: modalFade .25s var(--ease);
}

@keyframes modalFade {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal__close {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface-hover);
  border: none; width: 32px; height: 32px;
  border-radius: var(--radius-full);
  font-size: 18px; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  z-index: 1002;
}
.modal__close:hover { color: var(--ink); }

.modal__title {
  text-align: center; color: var(--ink);
  margin-bottom: var(--space-2); font-size: 18px;
}

.modal__text {
  font-size: 14px; color: var(--ink-2);
  text-align: center; margin-bottom: var(--space-4);
  line-height: 1.5;
}

.modal__content--error,
.modal__content--success,
.modal__content--info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-6) var(--space-6);
}

.modal__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  margin-bottom: var(--space-4);
}

.modal__content--error .modal__icon {
  background: var(--urgent-3);
  color: var(--urgent);
}
.modal__content--success .modal__icon {
  background: var(--ok-3);
  color: var(--ok);
}
.modal__content--info .modal__icon {
  background: var(--neutral-3);
  color: var(--neutral);
}

.modal__close-btn {
  margin-top: var(--space-4);
}

.modal__content--confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-6) var(--space-6);
}

.modal__content--confirm .modal__icon {
  background: var(--surface-hover);
  color: var(--ink-2);
}

.modal__actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.modal__actions .btn {
  min-width: 100px;
}

/* ── Responsive helpers ──────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --space-8: 20px; }
}
