/* ============================================================
   ВІЛЬНО / FinZero — Design System
   ============================================================ */

:root {
  --bg-deep:    #060910;
  --bg-base:    #0b1018;
  --bg-raised:  #111b28;
  --bg-input:   #0f1a26;
  --border:     #1c2b3e;
  --border-dim: #243549;
  --accent:      #6366f1;
  --accent-glow: #4f52d4;
  --green:       #10b981;
  --red:         #ef4444;
  --amber:       #f59e0b;
  --cyan:        #06b6d4;
  --text-1: #dde8f5;
  --text-2: #7a96b4;
  --text-3: #3d5570;
  --r-card: 14px;
  --r-btn:  8px;
  --r-pill: 20px;
  --font-sans:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;
  --font-display: 'Unbounded', var(--font-sans);
  --t: 150ms ease;
  --sidebar-w: 220px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-deep:    #eef1f7;
  --bg-base:    #ffffff;
  --bg-raised:  #f3f6fb;
  --bg-input:   #f1f4fa;
  --border:     #e3e8f0;
  --border-dim: #d2dbe8;
  --accent:      #4f46e5;
  --accent-glow: #4338ca;
  --green:       #059669;
  --red:         #dc2626;
  --amber:       #d97706;
  --cyan:        #0891b2;
  --text-1: #0e1a2b;
  --text-2: #51647d;
  --text-3: #8395ac;
  color-scheme: light;
}

:root[data-theme="light"] .btn--primary { color: #fff; }

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

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

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--bg-deep);
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(99,102,241,0.32); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg-deep); }
::-webkit-scrollbar-thumb:hover { background: var(--border-dim); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.t-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-1);
}
.t-num { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; }
.t-section {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
}
.t-label { font-size: 11px; color: var(--text-3); }
.t-meta  { font-size: 11px; color: var(--text-3); }
.c-green { color: var(--green); }
.c-red   { color: var(--red); }
.c-amber { color: var(--amber); }
.c-cyan  { color: var(--cyan); }
.c-accent{ color: var(--accent); }
.c-2 { color: var(--text-2); }
.c-3 { color: var(--text-3); }

.card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 20px;
  position: relative;
}
.card--topline { border-top: none; }
.card--topline::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--r-card) var(--r-card) 0 0;
  background: var(--topline, var(--accent));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-raised);
  transition: background var(--t), border-color var(--t), opacity var(--t), transform var(--t);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-glow); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover { border-color: var(--border-dim); color: var(--text-1); }
.btn--danger { background: transparent; border-color: rgba(239,68,68,0.4); color: var(--red); }
.btn--danger:hover { background: rgba(239,68,68,0.1); }
.btn--block { width: 100%; height: 48px; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border-dim);
  color: var(--text-2);
  background: var(--bg-raised);
  white-space: nowrap;
}
.badge--green { color: var(--green); border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.08); }
.badge--red   { color: var(--red);   border-color: rgba(239,68,68,0.35);  background: rgba(239,68,68,0.08); }
.badge--amber { color: var(--amber); border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.08); }
.badge--cyan  { color: var(--cyan);  border-color: rgba(6,182,212,0.35);  background: rgba(6,182,212,0.08); }
.badge--accent{ color: var(--accent);border-color: rgba(99,102,241,0.4);  background: rgba(99,102,241,0.1); }
.badge--src { height: 18px; padding: 0 7px; font-size: 9px; letter-spacing: 0.06em; }

.bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 20px;
  overflow: hidden;
}
.bar--sm { height: 4px; }
.bar--lg { height: 40px; border-radius: 10px; }
.bar__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  width: 0;
  transition: width 800ms cubic-bezier(.2,.7,.2,1);
}
.bar__fill--green { background: var(--green); }
.bar__fill--red   { background: var(--red); }
.bar__fill--amber { background: var(--amber); }
.bar__fill--cyan  { background: var(--cyan); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  color: var(--text-1);
  font-size: 14px;
  transition: border-color var(--t);
  outline: none;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 64px; line-height: 1.5; }
.input--amount {
  height: 72px;
  font-family: var(--font-mono);
  font-size: 32px;
  letter-spacing: -0.01em;
  padding: 0 18px;
}

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-1); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--bg-raised); }

.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border-dim);
  color: var(--text-1);
}
.toast--success { border-color: rgba(16,185,129,0.4); }
.toast--success .toast__dot { background: var(--green); }
.toast--error   { border-color: rgba(239,68,68,0.4); }
.toast--error .toast__dot { background: var(--red); }
.toast--info    { border-color: rgba(6,182,212,0.4); }
.toast--info .toast__dot { background: var(--cyan); }
.toast__dot { width: 8px; height: 8px; border-radius: 50%; }

.row { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.stack { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
