/* South Side Projects · LEO Duty — Windows 11 (Fluent) inspired dashboard */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --radius-sm: 4px; --radius: 8px; --radius-lg: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --dept: #4cc2ff; --dept-accent: #4cc2ff;
  --sidebar-w: 288px;
}
[data-theme="dark"] {
  --bg: #1c1c1c; --bg-mica: radial-gradient(1200px 600px at 10% -10%, #26324a 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #2a2033 0%, transparent 55%), #1b1b1f;
  --layer: rgba(255,255,255,.045); --layer-2: rgba(255,255,255,.07); --layer-hover: rgba(255,255,255,.085);
  --card: rgba(39,39,44,.72); --card-solid: #2b2b30; --stroke: rgba(255,255,255,.08); --stroke-strong: rgba(255,255,255,.14);
  --text: #ffffff; --text-2: rgba(255,255,255,.79); --text-3: rgba(255,255,255,.55);
  --accent: #4cc2ff; --accent-fg: #00253a;
  --success: #6ccb5f; --warning: #fce100; --danger: #ff99a4; --info: #99ebff;
  --shadow: 0 8px 16px rgba(0,0,0,.26), 0 0 0 1px rgba(255,255,255,.03);
  --grid: rgba(255,255,255,.07);
}
[data-theme="light"] {
  --bg: #f3f3f3; --bg-mica: radial-gradient(1200px 600px at 10% -10%, #dfe8f7 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #efe4f4 0%, transparent 55%), #f3f3f3;
  --layer: rgba(255,255,255,.5); --layer-2: rgba(255,255,255,.7); --layer-hover: rgba(0,0,0,.04);
  --card: rgba(255,255,255,.78); --card-solid: #ffffff; --stroke: rgba(0,0,0,.07); --stroke-strong: rgba(0,0,0,.13);
  --text: #1a1a1a; --text-2: rgba(0,0,0,.72); --text-3: rgba(0,0,0,.5);
  --accent: #005fb8; --accent-fg: #ffffff;
  --success: #0f7b0f; --warning: #9d5d00; --danger: #c42b1c; --info: #005fb8;
  --shadow: 0 2px 6px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --grid: rgba(0,0,0,.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 20px; color: var(--text);
  background: var(--bg-mica); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; transition: background .3s var(--ease), color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- boot / centered states ---------- */
.boot { display: grid; place-items: center; min-height: 100vh; }
.boot-spinner, .spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--stroke-strong); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.center-card {
  width: min(440px, calc(100vw - 32px)); padding: 40px 36px; text-align: center;
  background: var(--card); backdrop-filter: blur(30px) saturate(140%); -webkit-backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid var(--stroke); border-radius: var(--radius-lg); box-shadow: var(--shadow); animation: rise .5s var(--ease);
}
.center-card h1 { font-family: var(--font-display); font-size: 28px; line-height: 36px; font-weight: 600; margin: 16px 0 6px; }
.center-card p { color: var(--text-2); margin: 0 0 24px; }
.brand-mark { width: 56px; height: 56px; margin: 0 auto; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #8a6cff); color: #fff; box-shadow: 0 6px 20px rgba(76,194,255,.35); }
.brand-mark svg { width: 30px; height: 30px; }
.fine { color: var(--text-3); font-size: 12px; margin-top: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--stroke-strong); background: var(--layer-2);
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--layer-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.discord { background: #5865f2; color: #fff; border-color: transparent; height: 40px; padding: 0 22px; font-weight: 600; width: 100%; }
.btn.discord:hover { background: #4752c4; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--layer-hover); }
.btn.icon { width: 32px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px;
  background: var(--layer); backdrop-filter: blur(40px) saturate(150%); -webkit-backdrop-filter: blur(40px) saturate(150%);
  border-right: 1px solid var(--stroke); z-index: 20; transition: transform .3s var(--ease);
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.sb-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; margin: 0; }
.sb-brand .brand-mark svg { width: 20px; height: 20px; }
.sb-brand b { display: block; font-size: 14px; }
.sb-brand span { font-size: 12px; color: var(--text-3); }
.sb-section { font-size: 12px; color: var(--text-3); padding: 12px 12px 6px; font-weight: 600; letter-spacing: .02em; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: 6px;
  color: var(--text); text-decoration: none; transition: background .12s;
}
.nav a:hover { background: var(--layer-hover); }
.nav a.active { background: var(--layer-2); }
.nav a.active::before {
  content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--accent);
  animation: pill .25s var(--ease);
}
@keyframes pill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.nav .sub a { height: 32px; padding-left: 46px; font-size: 13px; color: var(--text-2); }
.nav .sub a.active { color: var(--text); }
.dept-chip {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--c, #555);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.sb-spacer { flex: 1; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; border-top: 1px solid var(--stroke); margin-top: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--layer-2); display: grid; place-items: center; font-weight: 600; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sb-user .who { flex: 1; min-width: 0; }
.sb-user .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who span { font-size: 11px; color: var(--text-3); }

.main { min-width: 0; padding: 24px 32px 48px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.menu-btn { display: none; }
.page-title { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 260px; }
.dept-badge {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(140deg, var(--dept), color-mix(in srgb, var(--dept) 55%, #000)); box-shadow: 0 6px 18px color-mix(in srgb, var(--dept) 45%, transparent);
  border: 1px solid color-mix(in srgb, var(--dept-accent) 60%, transparent);
}
.page-title h1 { font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; margin: 0; }
.page-title p { margin: 0; color: var(--text-3); font-size: 13px; }
.crumbs { font-size: 12px; color: var(--text-3); }
.crumbs a { color: var(--text-3); }

/* ---------- controls ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--layer); border: 1px solid var(--stroke); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--card-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); font-weight: 600; }
.field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); }
.input, .select {
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--stroke-strong);
  border-bottom-color: color-mix(in srgb, var(--text) 40%, transparent); background: var(--layer-2); min-width: 0;
}
.input:focus, .select:focus { outline: none; border-bottom: 2px solid var(--accent); }
.input.search { padding-left: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; }
.select option { background: var(--card-solid); color: var(--text); }
input[type="date"] { color-scheme: inherit; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.charts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  padding: 18px 20px; min-width: 0; animation: rise .45s var(--ease) both;
}
.card h2 { font-size: 15px; line-height: 20px; font-weight: 600; margin: 0 0 2px; }
.card .sub { font-size: 12px; color: var(--text-3); margin: 0 0 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--dept-accent) 22%, transparent), transparent 70%); pointer-events: none; }
.kpi .label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--font-display); font-size: clamp(22px, 2.2vw, 30px); line-height: 38px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.kpi .hint { font-size: 12px; color: var(--text-3); }
.kpi .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .arrow { opacity: .8; margin-left: 4px; }
td { padding: 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--layer-hover); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 28px; height: 28px; font-size: 12px; background: color-mix(in srgb, var(--dept) 35%, var(--layer-2)); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ACTIVE { color: var(--success); background: color-mix(in srgb, var(--success) 15%, transparent); }
.pill.COMPLETED { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.pill.INTERRUPTED { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.pill.AUTO_CLOSED { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.reason { font-size: 11px; color: var(--text-3); margin-left: 6px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; color: var(--text-3); font-size: 12px; }
.pager .btns { display: flex; gap: 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .grow { flex: 1 1 220px; }
.filters .grow .input { width: 100%; }

.leader { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); }
.leader:last-child { border-bottom: 0; }
.leader .rank { width: 22px; text-align: center; font-weight: 700; color: var(--text-3); }
.leader .bar { flex: 1; min-width: 0; }
.leader .bar b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader .track { height: 4px; border-radius: 2px; background: var(--layer-2); margin-top: 5px; overflow: hidden; }
.leader .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--dept), var(--dept-accent)); border-radius: 2px; transition: width .8s var(--ease); }
.leader .hrs { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- states ---------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 36px 16px; color: var(--text-3); text-align: center; }
.state svg { width: 40px; height: 40px; opacity: .6; }
.state b { color: var(--text-2); }
.state.error { color: var(--danger); }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--layer) 25%, var(--layer-hover) 50%, var(--layer) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton.kpi-sk { height: 106px; }
.skeleton.chart-sk { height: 310px; }

.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { min-width: 260px; max-width: 380px; padding: 12px 16px; border-radius: var(--radius); background: var(--card-solid); border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow); border-left: 3px solid var(--accent); animation: rise .3s var(--ease); }
.toast.error { border-left-color: var(--danger); }

.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 24px; background: linear-gradient(140deg, var(--dept), color-mix(in srgb, var(--dept) 50%, #000)); color: #fff; }
.profile-head h2 { font-size: 22px; line-height: 28px; margin: 0; }
.kv { display: flex; gap: 22px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.kv b { color: var(--text-2); font-weight: 600; }

.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); background: var(--card-solid); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 40px; }
  .page-title h1 { font-size: 22px; line-height: 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
