@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #e9ecef;
  --surface: #ffffff;
  --sunk: #f3f5f7;
  --ink: #17202a;
  --muted: #5a6572;
  --line: #d2d8de;
  --steel: #2b5876;
  --steel-ink: #ffffff;
  --signal: #e3a812;
  --signal-soft: #fdf4dc;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --ok: #2e7d4f;
  --ok-soft: #e7f3ec;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 2px 10px rgb(23 32 42 / .07), 0 1px 2px rgb(23 32 42 / .06);
  --shadow-lg: 0 16px 40px rgb(23 32 42 / .18), 0 4px 10px rgb(23 32 42 / .1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171c;
    --surface: #1b2228;
    --sunk: #161c21;
    --ink: #e4e9ee;
    --muted: #97a3af;
    --line: #2f3a44;
    --steel: #6fa3c7;
    --steel-ink: #0e1418;
    --signal: #e8b634;
    --signal-soft: #2c2614;
    --danger: #ef7d74;
    --danger-soft: #35201e;
    --ok: #6cc292;
    --ok-soft: #1c2f24;
    --shadow: 0 2px 10px rgb(0 0 0 / .4), 0 1px 2px rgb(0 0 0 / .3);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / .55), 0 4px 10px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.55 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--steel); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 44px; padding: .5em 1.1em; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink);
  font-weight: 500; font-size: 15px;
}
.btn:hover { border-color: var(--steel); }
.btn.primary { background: var(--steel); color: var(--steel-ink); border-color: var(--steel); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--sunk); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: .3em .8em; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=password], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: .6em .8em; min-height: 44px;
}

.top {
  display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 16px; letter-spacing: -.01em; }
.top .subtitle { color: var(--muted); font-size: 14px; }
.top nav { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: .35em; font-size: 12.5px; font-weight: 600;
  padding: .22em .65em; border-radius: 999px; line-height: 1.5; white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.wait { background: var(--sunk); color: var(--muted); }
.pill .dot { width: .5em; height: .5em; border-radius: 50%; background: currentColor; flex: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: .7em 1.2em; border-radius: var(--radius);
  max-width: min(90vw, 560px); z-index: 80; box-shadow: var(--shadow-lg); font-size: 14px;
}
.toast.err { background: var(--danger); color: #fff; }

/* nakładka pełnoekranowa / dolny panel (wybór katalogu na telefonie, itp.) */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgb(10 14 18 / .45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--surface); width: 100%; max-width: 480px; max-height: min(82vh, 640px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; padding: 1rem; }
  .sheet { max-height: min(78vh, 600px); border-radius: var(--radius-lg); }
}

dialog {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
  padding: 1.3rem; width: min(92vw, 440px); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgb(10 14 18 / .45); }
dialog h3 { margin: 0 0 .9rem; font-size: 17px; }
dialog p.hint { margin: -.5rem 0 1rem; color: var(--muted); font-size: 13.5px; }
dialog select, dialog input { width: 100%; }
dialog .row { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
