:root {
  --bg: #f1f5f9; --card: #fff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --primary: #0369a1; --primary-d: #075985; --green: #15803d; --blue: #1d4ed8; --red: #b91c1c; --orange: #c2410c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }

.topbar { display: flex; align-items: center; gap: 1.5rem; background: #0f172a; color: #e2e8f0; padding: .6rem 1.25rem; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: #cbd5e1; padding: .4rem .7rem; border-radius: .4rem; }
.topbar nav a:hover { background: #1e293b; text-decoration: none; }
.topbar nav a.active { background: #1e293b; color: #fff; }
.topbar .user { margin-left: auto; display: flex; gap: .75rem; align-items: center; font-size: .9rem; color: #94a3b8; }
.topbar .user button.link { color: #cbd5e1; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.actions, .btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-row { margin-top: .75rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: .6rem; padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.card.narrow.wide { max-width: 720px; }
.card.highlight { border-color: #7dd3fc; background: #f0f9ff; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .5rem; }
.danger-zone { border-color: #fecaca; margin-top: 1rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 > div > .card { margin-bottom: 1rem; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: .8rem; font-size: .9rem; color: #334155; }
label.check { display: flex; gap: .5rem; align-items: center; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; font: inherit; color: inherit;
  border: 1px solid #cbd5e1; border-radius: .4rem; background: #fff;
}
label.check input { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #7dd3fc; border-color: var(--primary); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.indent { margin: -.3rem 0 1rem 1.6rem; }
fieldset.seg { border: 0; padding: 0; margin: 0 0 .8rem; display: flex; gap: 1rem; }
fieldset.seg label { display: flex; gap: .4rem; align-items: center; margin: 0; padding: .5rem .9rem; border: 1px solid #cbd5e1; border-radius: .4rem; cursor: pointer; }
fieldset.seg input { width: auto; margin: 0; }
.form-actions { display: flex; gap: .5rem; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters label { margin: 0; min-width: 160px; }
.filters .quick { display: flex; gap: .75rem; font-size: .9rem; margin-left: auto; align-self: center; }

.btn { display: inline-block; padding: .5rem .9rem; border-radius: .4rem; border: 1px solid #cbd5e1; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--red); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }
button.link.danger { color: var(--red); }
form.inline { display: inline; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tfoot th { color: var(--text); font-size: .95rem; text-transform: none; }
.table tr.inactive td { opacity: .5; }
.table tr.warn-row td { background: #fff7ed; }
.table tr.weekend td { background: #f8fafc; color: var(--muted); }
.table tr.deleted td { text-decoration: line-through; color: var(--muted); }
.table tr.current td { background: #e0f2fe; }
.table tr.flash-new td { animation: newrow 4s ease-out; }
@keyframes newrow { 0% { background: #bbf7d0; } 100% { background: transparent; } }
.right { text-align: right !important; }
.nowrap { white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.session { display: inline-block; margin-right: 1rem; white-space: nowrap; }
.time { font-variant-numeric: tabular-nums; }
.time.admin { font-style: italic; color: #7c3aed; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.blue { background: #dbeafe; color: var(--blue); }
.badge.red { background: #fee2e2; color: var(--red); }
.badge.orange { background: #ffedd5; color: var(--orange); }
.badge.grey { background: #f1f5f9; color: var(--muted); }
a.badge:hover { text-decoration: none; filter: brightness(.95); }

.flash { padding: .75rem 1rem; border-radius: .5rem; margin-bottom: 1rem; background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash.error { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.flash ul { margin: 0; padding-left: 1.2rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
input.copy { font-size: .85rem; background: #fff; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: .6rem; padding: 1rem 1.25rem; }
.stat-num { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .85rem; }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .grow { flex: 1; }
.muted-list li .grow { color: #475569; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; flex: none; background: #cbd5e1; }
.dot.green { background: #22c55e; } .dot.red { background: #ef4444; } .dot.orange { background: #f97316; } .dot.grey { background: #cbd5e1; }

.checks { list-style: none; padding: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.checks .ok { color: var(--green); } .checks .bad { color: var(--red); }
[hidden] { display: none !important; }
