:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --primary: #0f172a;
  --accent: #0284c7;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--fg);
  background: radial-gradient(ellipse at top left, #ffffff 0%, #f1f5f9 42%, #e2e8f0 100%);
  min-height: 100vh;
}
.hidden { display: none !important; }
.category-add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.page { min-height: 100vh; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand.row { margin: 18px 0 20px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: #0f172a; color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}
.brand-mark.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 650; cursor: pointer;
  font-size: 14px;
}
.btn.primary { background: #0f172a; color: #fff; }
.btn.primary:hover { background: #1e293b; }
.btn.outline { background: #fff; border: 1px solid var(--border); color: var(--fg); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn.ok { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.btn.warn { background: #fff7ed; color: var(--warn); border: 1px solid #fed7aa; }
.btn.lg { padding: 12px 18px; font-size: 15px; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.list-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.list-filters input[type="search"],
.list-filters input[type="date"] {
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px;
  min-width: 140px;
}
.list-filters input[type="search"] { flex: 1 1 180px; }
.list-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; flex-wrap: wrap;
}
.list-meta { font-size: 13px; }
.text-link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }

.site-header {
  max-width: 1120px; margin: 0 auto; padding: 24px 24px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.landing-main { max-width: 1120px; margin: 0 auto; padding: 64px 24px 80px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em; font-size: 12px;
  color: var(--muted); font-weight: 600; margin-bottom: 16px;
}
.landing-main h1 {
  max-width: 760px; font-size: clamp(36px, 6vw, 56px); line-height: 1.05;
  letter-spacing: -0.03em; margin: 0;
}
.lead { max-width: 560px; color: var(--muted); font-size: 18px; line-height: 1.65; margin: 20px 0 28px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.feature-grid {
  margin-top: 72px; display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr);
}
.feature-card, .mini-card, .stat-card, .panel-card {
  background: rgba(255,255,255,0.82); border: 1px solid rgba(226,232,240,0.9);
  border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.feature-card { padding: 24px; }
.feature-card h3 { margin: 14px 0 8px; font-size: 16px; }
.feature-card p, .mini-card span, .muted, .hint { color: var(--muted); line-height: 1.55; }
.icon-box {
  width: 36px; height: 36px; border-radius: 10px; background: #f8fafc;
  display: grid; place-items: center; border: 1px solid var(--border);
}
.foot-note { margin-top: 40px; color: var(--muted); font-size: 13px; }

.auth-shell {
  min-height: 100vh; max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px;
  align-items: center; padding: 40px 24px;
}
.auth-marketing h1 {
  font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 14px;
}
.auth-marketing > p { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 480px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.mini-card { padding: 14px; display: grid; gap: 6px; }
.mini-card strong { font-size: 13px; }
.mini-card span { font-size: 12px; }

.auth-panel { width: 100%; }
.tabs {
  display: flex; gap: 6px; background: rgba(255,255,255,0.7);
  border: 1px solid var(--border); border-radius: 14px; padding: 6px; margin-bottom: 14px;
}
.tab {
  flex: 1; border: 0; background: transparent; border-radius: 10px;
  padding: 10px; font-weight: 650; color: var(--muted); cursor: pointer;
}
.tab.active { background: #fff; color: var(--fg); box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.auth-card {
  background: #fff; border: 1px solid rgba(226,232,240,0.9); border-radius: 18px;
  padding: 24px; box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; font-size: 20px; }
label {
  display: grid; gap: 6px; margin: 14px 0; font-size: 13px; font-weight: 650; color: var(--muted);
}
input, select {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: 14px; color: var(--fg); background: #fff;
}
input:focus, select:focus { outline: 2px solid #cbd5e1; border-color: #94a3b8; }
.hint { font-size: 12px; margin-top: 14px; }

.dash { min-height: 100vh; display: flex; background: radial-gradient(ellipse at top, #f8fafc 0%, #eef2f7 45%, #f8fafc 100%); }
.sidebar {
  width: 232px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.sidebar-brand { display: flex; gap: 10px; align-items: center; color: #fff; flex-shrink: 0; }
.sidebar-brand span, #sideRole { display: block; color: #94a3b8; font-size: 11px; font-weight: 500; }
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: flex-start;
}
.side-nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
  flex-shrink: 0;
}
.side-nav button.active, .side-nav button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-foot {
  flex-shrink: 0;
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.side-user { font-size: 11px; color: #94a3b8; line-height: 1.35; white-space: pre-line; }
.sidebar .btn.ghost {
  color: #e2e8f0;
  border-color: rgba(226, 232, 240, 0.28);
  background: rgba(255, 255, 255, 0.04);
}
.sidebar .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.dash-main { flex: 1; min-width: 0; }
.dash-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 28px 8px; border-bottom: 1px solid rgba(226,232,240,0.8);
  background: rgba(255,255,255,0.65); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.dash-top h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.dash-content { padding: 20px 28px 40px; max-width: 1400px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px; }
.stat-card .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-card .value { margin-top: 8px; font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.stat-card .desc { margin-top: 4px; font-size: 12px; color: var(--muted); }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.panel-card { padding: 18px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.badge {
  display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge.on { background: #ecfdf5; color: var(--ok); }
.badge.off { background: #fef2f2; color: var(--danger); }
.roster { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.roster li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover td { background: rgba(15, 23, 42, 0.04); }
.mobile-only { display: none; }

@media (max-width: 960px) {
  .feature-grid, .mini-grid, .stats, .split, .auth-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-105%); transition: .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .landing-main { padding-top: 40px; }
}
