:root {
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --bg: #f6f8fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green-bg: #ecfdf5; --green: #047857;
  --red-bg: #fef2f2;   --red: #b91c1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'DM Sans', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar-inner { max-width: 880px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 700; font-size: .82rem; letter-spacing: .02em; }
.brand-name { font-weight: 700; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--ink-soft); font-size: .9rem; font-weight: 500; }
.help-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--primary); font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s; }
.help-btn:hover { background: #eff6ff; border-color: #bfdbfe; }

/* ---------- Layout ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin-bottom: 10px; }
.lead { color: var(--ink-soft); margin-bottom: 18px; }
.muted { color: var(--muted); font-size: .88rem; }
.hint { color: var(--ink-soft); font-size: .84rem; margin-top: 6px; }
.footnote { margin-top: 36px; color: var(--muted); font-size: .8rem; text-align: center; }

/* ---------- Flashes ---------- */
.flashes { margin-bottom: 18px; display: grid; gap: 8px; }
.flash { padding: 11px 14px; border-radius: 10px; font-size: .9rem; border: 1px solid transparent; }
.flash.success { background: var(--green-bg); color: var(--green); border-color: #a7f3d0; }
.flash.danger  { background: var(--red-bg);   color: var(--red);   border-color: #fecaca; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.placeholder p { margin-bottom: 8px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 28px; max-width: 400px; margin: 24px auto; }
.auth-card h1 { font-size: 1.35rem; margin-bottom: 6px; }

/* ---------- Forms ---------- */
label { display: block; font-size: .84rem; color: var(--ink-soft); margin: 14px 0 5px; font-weight: 500; }
input { width: 100%; padding: 11px 13px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: .94rem; font-family: inherit; color: var(--ink); background: #fff; }
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.form-card section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-card section:last-of-type { border-bottom: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

.btn { display: inline-block; margin-top: 20px; padding: 11px 20px; border: none; border-radius: 10px; font-family: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--line); margin-left: 10px; }
.btn-ghost:hover { background: #eff6ff; }

/* ---------- Availability grid ---------- */
.grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.weeknav { display: flex; gap: 6px; }
.btn-nav { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; color: var(--ink-soft); background: #fff; }
.btn-nav:hover { background: var(--bg); text-decoration: none; }
.weeklabel { font-weight: 600; color: var(--ink); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); margin-bottom: 10px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dot-free { background: #d1fae5; } .dot-busy { background: #fee2e2; } .dot-lead { background: #eef2f7; } .dot-past { background: #f1f5f9; }
.grid-scroll { overflow-x: auto; }
table.avail { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.avail th, table.avail td { border: 1px solid #eef2f7; padding: 7px 6px; text-align: center; }
table.avail thead th { background: #f8fafc; color: var(--ink-soft); font-weight: 600; position: sticky; top: 0; }
table.avail th.today { background: #dbeafe; color: #1e40af; }
.tcol { background: #f8fafc; color: var(--ink-soft); font-weight: 600; white-space: nowrap; width: 58px; }
td.cell { font-weight: 600; }
td.free { background: #d1fae5; color: #065f46; }
td.busy { background: #fee2e2; color: #991b1b; }
td.lead { background: #eef2f7; color: #cbd5e1; }
td.past { background: #f1f5f9; color: #e2e8f0; }

/* ---------- Lists / blocks ---------- */
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 10px; }
table.list th, table.list td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.list th { color: var(--muted); font-weight: 500; font-size: .82rem; }
table.list td.right, table.list th.right { text-align: right; }
.link-danger { background: none; border: none; color: var(--red); cursor: pointer; font: inherit; padding: 0; }
.link-danger:hover { text-decoration: underline; }
.seg { display: flex; gap: 16px; margin: 6px 0 14px; flex-wrap: wrap; }
.seg-opt { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--ink); margin: 0; cursor: pointer; }
.seg-opt input { width: auto; }

/* ---------- Dispatcher ---------- */
.badge-warn { background: #fef3c7; color: #92400e; }
.row-open { background: #fffbeb; }
.bang { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #f59e0b; color: #fff; font-weight: 700; font-size: .85rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pill-free { background: #d1fae5; color: #065f46; }
.pill-busy { background: #fee2e2; color: #991b1b; }
.btn-assign { padding: 6px 14px; border: none; border-radius: 8px; background: var(--primary); color: #fff; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.btn-assign:hover { background: var(--primary-dark); }
.btn-assign-warn { background: #d97706; }
.btn-assign-warn:hover { background: #b45309; }
.notiz { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.notiz p { margin-top: 6px; color: var(--ink-soft); white-space: pre-wrap; }

/* ---------- Info list ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin-top: 10px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; } }
.chip { display: inline-block; padding: 2px 9px; margin: 0 5px 5px 0; background: #eff6ff; color: var(--primary-dark); border-radius: 999px; font-size: .82rem; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-admin { background: #eef2ff; color: #4338ca; }

/* ---------- FAQ slide-in ---------- */
.faq-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .28); z-index: 40; }
.faq-panel { position: fixed; top: 0; right: 0; height: 100%; width: 360px; max-width: 90vw; background: var(--card); box-shadow: -12px 0 40px rgba(15, 23, 42, .14); transform: translateX(100%); transition: transform .22s ease; z-index: 50; display: flex; flex-direction: column; }
.faq-panel.open { transform: translateX(0); }
.faq-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.faq-head h2 { margin: 0; font-size: 1.05rem; }
.faq-close { width: 30px; height: 30px; border: none; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; }
.faq-close:hover { color: var(--ink); }
.faq-body { padding: 8px 20px 24px; overflow-y: auto; }
.faq-body details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq-body summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--ink); list-style: none; }
.faq-body summary::-webkit-details-marker { display: none; }
.faq-body summary::before { content: '+'; color: var(--primary); font-weight: 700; margin-right: 8px; }
.faq-body details[open] summary::before { content: '–'; }
.faq-body p { margin-top: 8px; color: var(--ink-soft); font-size: .88rem; }
