:root {
  --bg: #0d1117; --bg2: #121823; --panel: #161d2a; --panel2: #1c2535; --line: #263145; --line2: #32405a;
  --text: #e7ecf3; --muted: #8a97ab; --accent: #f5a524; --accent2: #ffbf4d; --accent-ink: #1a1203;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa; --done: #a78bfa;
  --r: 12px; --r-sm: 8px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.35rem; } h3 { font-size: 1rem; font-weight: 650; } h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .3rem; }
p { margin: .4rem 0; }
code { font-family: var(--mono); background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .block { display: block; } .mono { font-family: var(--mono); font-size: .9em; }
.nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--bg2) 248px, var(--bg) 248px); }
.side { background: var(--bg2); border-right: 1px solid var(--line); align-self: start; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 1.02rem; letter-spacing: .01em; }
.brand small { color: var(--accent); font-weight: 700; letter-spacing: .14em; font-size: .7rem; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm); color: var(--muted); font-weight: 520; }
.side nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.side nav a.on { background: linear-gradient(90deg, rgba(245,165,36,.16), rgba(245,165,36,.04)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side nav a.on .ico { color: var(--accent); }
.ico { width: 19px; height: 19px; flex: none; }
.dot { margin-left: auto; background: var(--bad); color: #fff; font-style: normal; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
.me div { flex: 1; min-width: 0; } .me b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); font-size: .76rem; }
.avatar { border-radius: 50%; vertical-align: middle; background: var(--panel2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; }
.top h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.menu { display: none; }
.content { padding: 14px 28px 48px; max-width: 1180px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.content.wide { max-width: 1500px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--r-sm); padding: 9px 15px; font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent2); text-decoration: none; }
.btn .ico { width: 17px; height: 17px; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 6px 11px; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px rgba(248,113,113,.45); }
.btn.danger:hover { background: rgba(248,113,113,.12); }
.btn.discord { background: #5865f2; color: #fff; padding: 12px 22px; font-size: 1rem; }
.btn.discord:hover { background: #6d78f5; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; width: 34px; height: 34px; border-radius: var(--r-sm); display: inline-grid; place-items: center; font-size: 1.3rem; }
.icon-btn:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.link-btn:hover { color: var(--bad); text-decoration: underline; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-h.pad, .pad { padding: 14px 18px; }
.card-h a { font-size: .85rem; }
.card-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg2); }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--accent); transition: transform .15s; }
details.card[open] > summary::before { transform: rotate(90deg); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid2.tight { gap: 12px; }
.span2 { grid-column: 1 / -1; }
.empty { text-align: center; color: var(--muted); padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty p { margin: 0; }
.note, .briefing { background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 10px 14px; white-space: pre-wrap; }
.briefing h4 { margin-top: 0; }

/* Hello + stats */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: radial-gradient(circle at 100% 0, rgba(245,165,36,.18), transparent 50%), var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.hello-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.stat span { color: var(--muted); font-size: .8rem; display: block; }
.stat b { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat.ok b { color: var(--ok); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list.compact li { padding: 7px 0; }
.list small.muted { display: block; font-size: .8rem; }
.list li > small.muted { display: inline; }
.date-tile { width: 44px; flex: none; text-align: center; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px 0; }
.date-tile b { display: block; font-size: 1.1rem; line-height: 1.1; }
.date-tile small { color: var(--accent); font-size: .68rem; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }
.date-sm { color: var(--muted); font-size: .82rem; width: 84px; flex: none; }
.readies { display: flex; gap: 5px; margin-top: 4px; }
.ready { font-size: .72rem; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); }
.ready.y { color: var(--ok); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.ready.y::before { content: "✓ "; }
.ready.n { color: var(--muted); }

/* Badges & chips */
.badge { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--panel2); color: var(--muted); vertical-align: middle; }
.badge.ok { color: var(--ok); background: rgba(52,211,153,.12); }
.badge.warn { color: var(--warn); background: rgba(251,191,36,.12); }
.badge.bad { color: var(--bad); background: rgba(248,113,113,.12); }
.badge.info { color: var(--info); background: rgba(96,165,250,.13); }
.badge.done { color: var(--done); background: rgba(167,139,250,.13); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 650; padding: 2px 10px 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--text); white-space: nowrap; vertical-align: middle; }
.chip.team { background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 75%, white); }
.chip.team::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,.015); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.hl td { background: rgba(251,191,36,.06); }
.table.review input, .table.review select { width: 100%; min-width: 120px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form > .btn { align-self: flex-start; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid-form .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--muted); font-weight: 550; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(245,165,36,.5); outline-offset: 0; border-color: var(--accent); }
input[type=color] { padding: 2px; width: 44px; height: 36px; }
input[type=file] { padding: 6px; }
.inline-form, .form.inline-form { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; }
.w-sm { width: 100px; } .w-md { width: 160px; }
.upload { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.upload input[name=note] { flex: 1; min-width: 160px; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 12px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 560; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--panel2); color: var(--text); box-shadow: 0 0 0 1px var(--line2); }
.filters { display: flex; gap: 8px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav b { min-width: 140px; text-align: center; font-size: 1.05rem; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-h h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Flash */
.flash { margin: 0 28px; padding: 10px 14px; border-radius: var(--r-sm); background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.35); color: #b7f5dc; }
.content .flash, .bare .flash, .login .flash { margin: 0; }
.flash.bad { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.4); color: #fecaca; }
.flash.warn { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.35); color: #fde68a; }
.flash.info { background: rgba(96,165,250,.08); border-color: rgba(96,165,250,.35); color: #bfdbfe; }

/* Login */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% -10%, rgba(245,165,36,.18), transparent 60%), var(--bg); }
.login { max-width: 420px; width: 100%; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 36px 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login h1 { font-size: 1.5rem; }
.devlogin { border-top: 1px dashed var(--line2); padding-top: 12px; font-size: .85rem; }

/* Calendar */
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg2); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.off { background: rgba(0,0,0,.18); }
.cal-cell.today { background: rgba(245,165,36,.06); }
.cal-cell.today .cal-d { background: var(--accent); color: var(--accent-ink); }
.cal-d { font-size: .8rem; color: var(--muted); font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-ev { display: block; font-size: .76rem; padding: 3px 7px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); border-left: 3px solid var(--info); background: rgba(96,165,250,.12); }
.cal-ev:hover { text-decoration: none; filter: brightness(1.2); }
.cal-ev b { font-weight: 700; color: var(--muted); }
.s-draft { border-color: var(--muted); background: rgba(138,151,171,.12); }
.s-confirmed { border-color: var(--ok); background: rgba(52,211,153,.12); }
.s-completed { border-color: var(--done); background: rgba(167,139,250,.12); }
.s-cancelled { border-color: var(--bad); background: rgba(248,113,113,.1); text-decoration: line-through; opacity: .7; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend .cal-ev { display: inline-block; }

/* Event page */
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.file { margin: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; display: flex; flex-direction: column; }
.file img { width: 100%; height: 130px; object-fit: cover; display: block; background: #000; }
.file .doc { height: 130px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--panel2), var(--panel2) 8px, var(--panel) 8px, var(--panel) 16px); }
.file .doc span { background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 6px 12px; border-radius: 6px; font-size: .85rem; }
.file figcaption { padding: 8px 10px; font-size: .82rem; word-break: break-word; }
.tasks li.done span.grow { text-decoration: line-through; color: var(--muted); }
.check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line2); background: transparent; cursor: pointer; padding: 0; display: grid; place-items: center; flex: none; }
.check:hover:not(:disabled) { border-color: var(--accent); }
.check.on { background: var(--ok); border-color: var(--ok); }
.check.on::after { content: "✓"; color: #062; font-size: .8rem; font-weight: 900; }
.check:disabled { opacity: .5; cursor: default; }

/* Attendance */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); border-top: 1px solid var(--line); }
.att { display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; flex-direction: row; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 5px 10px; font-size: .8rem; color: var(--muted); display: block; border-right: 1px solid var(--line2); }
.seg label:last-child span { border-right: 0; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg-attended input:checked + span { background: rgba(52,211,153,.2); color: var(--ok); font-weight: 700; }
.seg-excused input:checked + span { background: rgba(251,191,36,.18); color: var(--warn); font-weight: 700; }
.seg-absent input:checked + span { background: rgba(248,113,113,.18); color: var(--bad); font-weight: 700; }
.seg-none input:checked + span { background: var(--panel2); color: var(--text); }

/* Reports */
.team-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.team-card { color: var(--text); border-top: 3px solid var(--c); }
.team-card:hover { text-decoration: none; border-color: var(--line2); border-top-color: var(--c); background: var(--panel2); }
.mini-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.mini-stats b { color: var(--text); font-size: 1rem; }
.mini-stats .ok b { color: var(--ok); } .mini-stats .warn b { color: var(--warn); } .mini-stats .bad b { color: var(--bad); }
.report-text p { white-space: normal; }
.role-help { margin: 0; padding-left: 18px; color: var(--muted); font-size: .84rem; display: grid; gap: 3px; }
.role-help b { color: var(--text); }

/* Responsive */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: fixed; z-index: 20; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .menu { display: inline-grid; }
  .top { padding: 14px 16px 4px; }
  .content { padding: 12px 16px 40px; }
  .flash { margin: 0 16px; }
  .grid2, .grid-form { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .cal-cell { min-height: 74px; padding: 3px; }
  .cal-ev { font-size: .68rem; padding: 2px 4px; }
  .cal-ev b { display: none; }
  .att-grid { grid-template-columns: 1fr; }
  .att { flex-wrap: wrap; }
  .card.flush { overflow-x: auto; }
}

@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .side, .top .menu, .no-print, .flash, .card-f { display: none !important; }
  .shell { display: block; }
  .card, .stat { background: #fff; border-color: #ccc; color: #000; }
  .table th { background: #f2f2f2; color: #333; }
  .badge, .chip { background: #eee !important; color: #000 !important; }
  a { color: #000; }
}
