:root {
  --bg: #070d1a;
  --bg2: #0c1526;
  --card: #111d33;
  --card2: #16243f;
  --line: #22355a;
  --text: #e7eefb;
  --muted: #8ea3c7;
  --accent: #1a8cff;
  --accent2: #00c8ff;
  --ok: #2ecc71;
  --warn: #f5a623;
  --bad: #ff5c5c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, #0f2a55 0, var(--bg) 55%); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- logowanie --- */
.login { max-width: 400px; width: 100%; text-align: center; padding: 36px 28px; }
.login-logo { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 18px; box-shadow: 0 0 40px #1a8cff55; }
.login p { color: var(--muted); }
.btn-discord { background: #5865f2; border-color: #5865f2; width: 100%; justify-content: center; margin-top: 12px; }
.btn-discord:hover { background: #4752c4; }

/* --- układ --- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand b { display: block; font-size: 15px; }
.brand span { color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); margin-bottom: 2px; }
.nav a:hover { background: var(--card); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, #1a8cff33, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.nav .sep { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.user { display: flex; align-items: center; gap: 10px; }
.user img { width: 34px; height: 34px; border-radius: 50%; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: #2ecc7155; }
.badge.warn { color: var(--warn); border-color: #f5a62355; }
.badge.bad { color: var(--bad); border-color: #ff5c5c55; }
.badge.accent { color: var(--accent2); border-color: #1a8cff55; }

/* --- karty i siatki --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: 340px 1fr; align-items: start; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* --- formularze --- */
label.field { display: block; margin-bottom: 14px; }
label.field > .lbl { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 5px; flex-wrap: wrap; }
label.field > .help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input, select, textarea { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #1a8cff33; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--accent); transform: scale(1.2); }
input[type=color] { width: 46px; height: 38px; padding: 3px; }
.inline { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--card2); }
.btn.danger { background: transparent; color: var(--bad); border-color: #ff5c5c66; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); font-size: 13px; }
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 14px; }
.chip button:hover { color: var(--text); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }

/* --- tabele --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

/* --- wykres --- */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.chart .day { flex: 1; display: flex; align-items: flex-end; gap: 1px; height: 100%; min-width: 4px; }
.chart .bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bar.o { background: var(--accent); }
.chart .bar.c { background: var(--ok); opacity: .75; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.legend i.lo { background: var(--accent); }
.legend i.lc { background: var(--ok); opacity: .75; }
.meter { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }

/* --- transkrypt i listy --- */
.transcript { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 560px; overflow: auto; font: 13px/1.55 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; word-break: break-word; }
.list-item { padding: 11px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.list-item:hover { background: var(--card2); }
.list-item.active { background: var(--card2); border-color: var(--accent); }
.list-item .t { font-weight: 600; }
.qa dt { color: var(--muted); font-size: 13px; margin-top: 10px; }
.qa dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.question { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.tabs a.active { border-color: var(--accent); background: #1a8cff22; }
.tabs a:hover { text-decoration: none; background: var(--card2); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.notice { border-left: 3px solid var(--warn); background: #f5a62312; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.answer { background: var(--bg2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px; white-space: pre-wrap; margin-top: 10px; }

/* --- powiadomienia --- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 32px); }
.toast { background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 30px #0008; animation: pop .2s ease-out; }
.toast.error { border-left-color: var(--bad); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 16px; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav .sep { display: none; }
  .nav a { padding: 6px 10px; margin: 0; }
  .main { padding: 16px; }
  .grid.two, .grid.side { grid-template-columns: 1fr; }
}
