/* VoiceEli design tokens + bazowe komponenty. Jedyny plik tokenów. */
:root {
  --font-ui: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1b1a17;
  --text-muted: #6b675e;
  --border: #dedad1;
  --accent: #0f766e;
  --accent-contrast: #ffffff;
  --accent-soft: #d9f0ec;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --record: #d92d20;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem; --fs-2xl: 2rem;
  --touch: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2,.8,.2,1);
}
[data-theme="dark"] {
  --bg: #0f1114; --surface: #171a1f; --surface-2: #1f2329; --text: #ecebe7;
  --text-muted: #9a978f; --border: #2c3138; --accent: #2dd4bf; --accent-contrast: #0b1211;
  --accent-soft: #143d38; --danger: #f97066; --danger-soft: #3b1512; --record: #f04438;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #0f1114; --surface: #171a1f; --surface-2: #1f2329; --text: #ecebe7;
    --text-muted: #9a978f; --border: #2c3138; --accent: #2dd4bf; --accent-contrast: #0b1211;
    --accent-soft: #143d38; --danger: #f97066; --danger-soft: #3b1512; --record: #f04438;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: 1.5;
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--space-3); font-weight: 700; }
h1 { font-size: var(--fs-xl); } h2 { font-size: var(--fs-lg); } h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--space-3); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch); padding: 0 var(--space-4); border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { width: var(--touch); padding: 0; border-radius: var(--radius-pill); }
.btn-block { width: 100%; }

/* formularze */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.field .hint { color: var(--text-muted); font-size: var(--fs-sm); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--touch); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font: inherit;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.switch { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

/* karty, listy */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row .grow { flex: 1; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.badge { display: inline-block; padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-sm); font-weight: 600; }
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--surface-2); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--accent-soft); color: var(--accent); }

/* układ strony z topbarem */
.page { max-width: 720px; margin: 0 auto; padding: var(--space-4) var(--space-4) calc(var(--space-6) + var(--safe-bottom)); }
.topbar { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: var(--space-2) var(--space-3); }
.topbar .title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* wysuwany panel (hamburger) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 85vw); background: var(--surface); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .25s var(--ease); z-index: 41; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); min-height: 56px; }
.drawer-new { padding: 0 var(--space-3) var(--space-3); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none; font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-name b { color: var(--accent); font-weight: 800; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-2); }
.drawer-foot { border-top: 1px solid var(--border); padding: var(--space-2); display: flex; flex-direction: column; gap: var(--space-1); }
.drawer-item { display: flex; align-items: center; gap: var(--space-2); min-height: var(--touch); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.drawer-item:hover, .drawer-item.active { background: var(--surface-2); }
.drawer-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-item .meta { color: var(--text-muted); font-size: var(--fs-sm); }

.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Szeroki ekran: panel z lewej zawsze widoczny, hamburger znika */
@media (min-width: 900px) {
  body:has(.drawer) { padding-left: 300px; }
  .drawer { width: 300px; transform: none; transition: none; }
  .drawer-backdrop, [data-drawer-open], [data-drawer-close] { display: none !important; }
}
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }
html[data-theme="system"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .theme-toggle .icon-moon { display: none; }
  html[data-theme="system"] .theme-toggle .icon-sun { display: block; }
}
