/* Romelior Staff Portal. Blue and black: dark by default, light via [data-theme="light"]. */
:root, [data-theme="dark"] {
  --bg: #06080c;
  --bg-dots: #131a26;
  --surface: #0c1018;
  --surface-2: #111724;
  --line: #1b2332;
  --line-strong: #2a3548;
  --text: #e9eef7;
  --muted: #9ba7ba;
  --faint: #637088;
  --accent: #3d8bff;
  --accent-ink: #03101f;
  --accent-soft: #0e2242;
  --accent-glow: rgba(61, 139, 255, .2);
  --crimson: #f0605a;
  --crimson-soft: #351518;
  --teal: #2fc4b2;
  --teal-soft: #0d2c2a;
  --brass: #6aa8ff;
  --ok: #3ecf8e;
  --ok-soft: #0e2a1e;
  --warn: #7cc7ff;
  --warn-soft: #0f2a3d;
  --sidebar: #04060a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}
[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-dots: #dbe3ef;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --line: #dbe2ec;
  --line-strong: #c3cddc;
  --text: #0a111e;
  --muted: #536077;
  --faint: #8691a6;
  --accent: #1a62d6;
  --accent-ink: #ffffff;
  --accent-soft: #dfeafc;
  --accent-glow: rgba(26, 98, 214, .18);
  --crimson: #c43a33;
  --crimson-soft: #fbe0de;
  --teal: #12786c;
  --teal-soft: #d3efeb;
  --brass: #1f5fc4;
  --ok: #1f8a55;
  --ok-soft: #d9f2e5;
  --warn: #0369a1;
  --warn-soft: #e0f2fe;
  --sidebar: #ffffff;
  --shadow: 0 1px 2px rgba(10, 20, 40, .05), 0 6px 20px rgba(10, 20, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
.ico { width: 18px; height: 18px; flex: none; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .sidebar { transform: translateX(-100%); }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  transition: transform .25s ease;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand strong { display: block; font-family: var(--font-display); font-size: 16px; }
.brand small { display: block; color: var(--accent); font-weight: 600; font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 9px; color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.active .ico { color: var(--accent); }
.nav-item.sub { padding-left: 18px; }
.nav-item.soon { opacity: .6; }
.nav-item .count, .pill {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--muted);
}
.nav-item .count { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.dept summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; font-weight: 600;
}
.dept summary::-webkit-details-marker { display: none; }
.dept summary:hover { background: var(--surface-2); }
.dept .caret { margin-left: auto; width: 14px; height: 14px; color: var(--faint); transition: transform .2s; }
.dept[open] .caret { transform: rotate(90deg); }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dot-crimson { background: var(--crimson); }
.dot-teal { background: var(--teal); }
.dot-brass { background: var(--brass); }
.me { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: 10px; }
.me-link:hover { background: var(--surface-2); }
.me-link strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-link small { display: block; color: var(--muted); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
}
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.i-moon { display: none; }
[data-theme="light"] .i-moon { display: inline; }
[data-theme="light"] .i-sun { display: none; }
.badge-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--crimson); }
.search {
  display: flex; align-items: center; gap: 8px;
  width: 240px; height: 36px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--faint); font: inherit; cursor: pointer;
}
.search span { flex: 1; text-align: left; }
kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-2); }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 28px 64px; }
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 800; }
.page-head h1 em { font-style: normal; color: var(--accent); }
.ph-ico .ico { width: 26px; height: 26px; color: var(--accent); }
.lead { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 { font-size: 18px; font-weight: 700; }
.card h3 { font-size: 16px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card.warm { background: linear-gradient(135deg, var(--surface) 55%, var(--accent-soft)); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 18px; }
.mt { margin-top: 18px; }

.hero {
  display: flex; align-items: center; gap: 22px;
  padding: 28px; border-radius: 18px;
  background: linear-gradient(120deg, var(--surface) 30%, var(--accent-soft) 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero h1 { font-size: 30px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .clock { margin-left: auto; text-align: right; }
.hero .clock strong { font-family: var(--font-display); font-size: 26px; display: block; }
.hero .clock small { color: var(--muted); display: block; font-size: 13px; }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); background: var(--surface-2); }
.avatar.sm { width: 34px; height: 34px; border-width: 2px; }
.avatar.xs { width: 26px; height: 26px; border-width: 0; }
.avatar.fallback { display: inline-grid; place-items: center; font-weight: 700; color: var(--accent); }
.avatar-lg.fallback { font-size: 32px; }

.stat-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; }
.stat-label .chip-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-top: 12px; }
.stat-note { color: var(--muted); font-size: 13px; }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--crimson-soft); color: var(--crimson); border-color: transparent; }
.badge.teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.badge.dept-moderation { background: var(--crimson-soft); color: var(--crimson); border-color: transparent; }
.badge.dept-events { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.badge.dept-development { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: transform .1s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--crimson); }
.btn.danger:hover { border-color: var(--crimson); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.inline { display: inline; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 12px; color: var(--muted); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
input[type="text"], input[type="url"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
input[type="file"] { font: inherit; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; background: var(--surface-2); }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters .field { min-width: 160px; }

/* Tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab .ico { width: 16px; height: 16px; }

/* Empty state */
.empty { text-align: center; padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 2px solid currentColor; margin-bottom: 12px; }
.empty-ico.ok { color: var(--ok); }
.empty-ico.neutral { color: var(--faint); }
.empty-ico .ico { width: 24px; height: 24px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); margin-top: 6px; max-width: 46ch; margin-left: auto; margin-right: auto; }

/* Progress and ring */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ring { --p: 0; position: relative; width: 150px; height: 150px; margin: 10px auto; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.ring-inner { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.ring-inner strong { font-family: var(--font-display); font-size: 34px; line-height: 1; }
.ring-inner small { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.tier b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); font-size: 12px; }
.tier.got b { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.tier span { display: block; font-weight: 700; font-size: 13px; margin-top: 4px; }
.tier small { color: var(--muted); font-size: 11px; }

/* Lists */
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.item .grow { flex: 1; min-width: 0; }
.item h4 { font-size: 15px; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--crimson-soft); color: var(--crimson); }
.flash-info { background: var(--accent-soft); color: var(--accent); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.cal-h { padding: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-d { min-height: 112px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-d:nth-child(7n) { border-right: 0; }
.cal-d.other { background: var(--surface-2); color: var(--faint); }
.cal-d.today .num { background: var(--accent); color: var(--accent-ink); }
.cal-d .num { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.cal-ev { display: block; margin-top: 4px; padding: 3px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--teal-soft); color: var(--teal); }
.cal-ev.deadline { background: var(--crimson-soft); color: var(--crimson); }
.cal-ev.other { background: var(--accent-soft); color: var(--accent); }

/* Bracket */
.bracket { display: flex; gap: 22px; overflow-x: auto; padding-bottom: 6px; }
.round { min-width: 220px; display: grid; gap: 12px; align-content: start; }
.round h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.match { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.match .slot { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.match .slot:last-child { border-bottom: 0; }
.match .slot input[type="text"] { padding: 5px 8px; border-radius: 6px; }
.match .slot.win { background: var(--accent-soft); }

/* Login */
.login { width: 100%; max-width: 420px; text-align: center; }
.login .card { padding: 32px; }
.login h1 { font-size: 28px; margin-top: 14px; }
.discord-btn { width: 100%; height: 46px; background: #5865f2; border-color: #5865f2; color: #fff; }
.dev-users { display: grid; gap: 8px; margin-top: 12px; text-align: left; }

/* Palette */
.palette { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 14, .6); display: grid; place-items: start center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette-box { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.25); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.palette-input input { border: 0; box-shadow: none !important; padding: 6px 0; background: transparent; }
#paletteList { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
#paletteList a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); }
#paletteList a small { margin-left: auto; color: var(--faint); }
#paletteList li.sel a, #paletteList a:hover { background: var(--accent-soft); color: var(--text); }

.prose { white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }

@media (max-width: 1000px) {
  .g3, .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 264px; transform: translateX(-100%); box-shadow: var(--shadow); }
  .shell.mobile-open .sidebar { transform: none; }
  .shell.collapsed { grid-template-columns: 1fr; }
  .search { width: auto; }
  .search span, .search kbd { display: none; }
  .content { padding: 22px 16px 48px; }
  .g2 { grid-template-columns: 1fr; }
  .hero { flex-wrap: wrap; }
  .hero .clock { margin-left: 0; text-align: left; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .cal-d { min-height: 72px; }
}
