:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #3d6b8c;
  --accent-soft: #dcebf3;
  --past: #eef0f2;
  --current-bg: #fff7d6;
  --current-line: #f0c14b;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h1, h2 { margin: 0; font-weight: 600; }
button, input, textarea, select { font: inherit; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--panel); padding: 32px; border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.08); width: min(360px, 90vw); display: flex; flex-direction: column; gap: 16px; }
.login-box h1 { font-size: 20px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=time], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); background: #fff; width: 100%;
}
.error { color: var(--danger); font-size: 13px; }

/* ---------- topbar / tabs ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 18px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 18px; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.view-tab { border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 7px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
.view-tab.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft); }

.view { padding: 18px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- btn ---------- */
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.btn:hover { background: #f1f3f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); border-color: #f3c7c7; }
.btn.icon { width: 34px; padding: 6px 0; font-size: 18px; line-height: 1; }

/* ---------- Teraz ---------- */
.now-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 10px; }
.now-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.now-card h2 { font-size: 16px; margin-bottom: 12px; }
.now-card .klasa { color: var(--muted); font-weight: 400; font-size: 13px; }
.now-current { background: var(--current-bg); border: 1px solid var(--current-line); border-radius: 10px; padding: 12px; }
.now-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.now-title { font-size: 17px; font-weight: 600; margin: 2px 0; }
.now-sub { font-size: 13px; color: var(--muted); }
.now-empty { color: var(--muted); font-style: italic; padding: 12px 0; }
.now-next { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ---------- Dzien ---------- */
.day-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.day-label { font-weight: 600; }
.day-cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.day-col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.day-col h2 { font-size: 15px; margin-bottom: 10px; }
.day-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: none; }
.day-row-time { width: 90px; flex: 0 0 90px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-row-title { font-weight: 600; }
.day-row-sub { color: var(--muted); font-size: 12.5px; }
.day-row.past { opacity: .45; }
.day-row.current { background: var(--current-bg); border-radius: 8px; margin: 0 -8px; padding: 8px; border-bottom-color: transparent; }
.day-row.extra .day-row-title { color: var(--accent); }


/* ---------- Edycja ---------- */
.edit-table { border-collapse: collapse; width: 100%; margin-bottom: 8px; background: var(--panel); }
.edit-table th, .edit-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; font-size: 12.5px; }
.edit-table th.sub { font-weight: 400; color: var(--muted); }
.cell-btn { border: none; background: none; cursor: pointer; font: inherit; color: var(--text); width: 100%; padding: 2px; }
.cell-btn:hover { background: var(--accent-soft); border-radius: 6px; }
.edit-table.extra td { text-align: left; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-box { background: var(--panel); border-radius: 14px; padding: 22px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.spacer { flex: 1; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 100; }
.toast.err { background: #b91c1c; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .view-tabs { justify-content: center; }
}
