:root {
  --bg: #0f1013; --panel: #17191e; --panel-2: #1d2027; --line: #262a33; --line-2: #313642;
  --text: #e7e9ee; --muted: #8b92a1; --faint: #5d6472;
  --accent: #f08c2e; --accent-2: #ffb15c; --accent-bg: rgba(240, 140, 46, .12);
  --green: #3fbf7f; --red: #ef5b5b; --yellow: #f2c14e; --blue: #5b9cef; --purple: #a77bf0;
  --radius: 10px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent-2); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #000; }

/* ---------- Boot / login ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(800px 400px at 20% 0%, rgba(240,140,46,.14), transparent 60%),
  radial-gradient(700px 400px at 100% 100%, rgba(91,156,239,.08), transparent 60%), var(--bg); }
.login-card { width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px; text-align: center; box-shadow: var(--shadow); }
.login-card .logo { font-size: 46px; }
.login-card h1 { margin: 10px 0 4px; font-size: 22px; letter-spacing: -.01em; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card .error { background: rgba(239,91,91,.12); color: #ffb3b3; border: 1px solid rgba(239,91,91,.3); padding: 10px 12px; border-radius: 8px; margin-bottom: 18px; font-size: 13px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand img, .brand .ph { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-bg); display: grid; place-items: center; font-size: 20px; object-fit: cover; }
.brand .name { font-weight: 700; line-height: 1.2; }
.brand .sub { color: var(--muted); font-size: 12px; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav .group { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--accent-2); }
.nav a .ic { width: 20px; text-align: center; }
.nav a .badge { margin-left: auto; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me .who { flex: 1; min-width: 0; } .me .who div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who div:last-child { color: var(--muted); font-size: 12px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 32px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(15,16,19,.85); backdrop-filter: blur(8px); z-index: 5; }
.topbar h1 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.topbar .desc { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 26px 32px 60px; max-width: 1280px; }

/* ---------- Components ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 15px; } .card h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; } .card-head h2 { margin: 0; } .card-head .spacer { flex: 1; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .foot { color: var(--muted); font-size: 12px; }
.mt { margin-top: 16px; } .mt2 { margin-top: 26px; } .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: Consolas, monospace; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: #252932; border-color: #3b4150; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1006; } .btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: #ffb3b3; border-color: rgba(239,91,91,.4); background: rgba(239,91,91,.08); } .btn.danger:hover { background: rgba(239,91,91,.18); }
.btn.success { color: #b3f0d0; border-color: rgba(63,191,127,.4); background: rgba(63,191,127,.08); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; } .btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; padding: 11px 20px; font-size: 14px; width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.green { color: #9be8c2; background: rgba(63,191,127,.12); border-color: rgba(63,191,127,.3); }
.badge.red { color: #ffb3b3; background: rgba(239,91,91,.12); border-color: rgba(239,91,91,.3); }
.badge.yellow { color: #f7dc9b; background: rgba(242,193,78,.12); border-color: rgba(242,193,78,.3); }
.badge.blue { color: #b4d1fa; background: rgba(91,156,239,.12); border-color: rgba(91,156,239,.3); }
.badge.purple { color: #d3bdf8; background: rgba(167,123,240,.12); border-color: rgba(167,123,240,.3); }
.badge.accent { color: var(--accent-2); background: var(--accent-bg); border-color: rgba(240,140,46,.35); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(63,191,127,.2); } .dot.off { background: var(--red); }

/* Forms */
.field { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .lbl { font-weight: 600; } .field .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,140,46,.15); }
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select option, select optgroup { background: var(--panel); }
input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); padding: 3px; cursor: pointer; }
label.inline { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(18px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; }
.chip .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 5px; font-size: 14px; line-height: 1; } .chip .x:hover { color: var(--red); }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.list-editor .item { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; display: grid; gap: 10px; }
.list-editor .item-head { display: flex; align-items: center; gap: 8px; } .list-editor .item-head .n { font-weight: 700; color: var(--muted); font-size: 12px; }
.list-editor .item-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.savebar { position: sticky; bottom: 16px; margin-top: 18px; display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.savebar.hidden { display: none; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: rgba(255,255,255,.015); }
.user { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; } .user img { width: 26px; height: 26px; border-radius: 50%; background: var(--line); } .user:hover .uname { text-decoration: underline; }
.user .uname { font-weight: 600; } .user .utag { color: var(--muted); font-size: 12px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); padding: 4px; border-radius: 9px; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.tabs button.active { background: var(--panel-2); color: var(--text); }
.clamp { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Staff ladder */
.ladder { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(175px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.rank-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 160px; }
.rank-col header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.rank-col header .lvl { color: var(--faint); font-size: 11px; font-weight: 700; }
.rank-col header .t { font-weight: 700; } .rank-col header .c { margin-left: auto; }
.rank-col .people { padding: 8px; display: grid; gap: 6px; align-content: start; }
.person { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; }
.person img { width: 28px; height: 28px; border-radius: 50%; } .person .nm { font-weight: 600; font-size: 13px; line-height: 1.2; } .person .since { color: var(--muted); font-size: 11px; }
.person .acts { margin-left: auto; display: flex; gap: 2px; opacity: .35; transition: opacity .15s; } .person:hover .acts { opacity: 1; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); font-size: 13px; } .icon-btn:hover { background: var(--panel-2); color: var(--text); }
.timeline { display: grid; gap: 0; } .tl { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; } .tl:last-child { border-bottom: 0; }
.tl .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); }

/* Picker dropdown */
.picker { position: relative; } .picker .results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.picker .results div { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; } .picker .results div:hover { background: var(--accent-bg); }
.picker .results img { width: 22px; height: 22px; border-radius: 50%; }
.picked { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; } .picked img { width: 24px; height: 24px; border-radius: 50%; }

/* Modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); }
.modal.wide { width: min(820px, 100%); }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; } .modal header h2 { margin: 0; font-size: 16px; flex: 1; }
.modal .body { padding: 18px 20px; display: grid; gap: 14px; } .modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 8px; padding: 11px 16px; box-shadow: var(--shadow); max-width: 380px; animation: slide .2s; }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

/* Discord-style preview */
.dc-preview { background: #313338; border-radius: 8px; padding: 14px 16px; color: #dbdee1; font-family: "gg sans", var(--font); }
.dc-msg { display: flex; gap: 14px; } .dc-msg > img { width: 40px; height: 40px; border-radius: 50%; }
.dc-name { font-weight: 600; color: #f2f3f5; } .dc-name .bot { background: #5865f2; color: #fff; font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-left: 4px; vertical-align: 1px; }
.dc-embed { margin-top: 6px; border-left: 4px solid var(--accent); background: #2b2d31; border-radius: 4px; padding: 10px 14px; max-width: 480px; }
.dc-embed .et { font-weight: 700; color: #fff; margin-bottom: 4px; } .dc-embed .ed { white-space: pre-wrap; font-size: 14px; } .dc-embed img.ei { max-width: 100%; border-radius: 4px; margin-top: 10px; } .dc-embed .ef { font-size: 12px; color: #b5bac1; margin-top: 8px; }

.chart { width: 100%; height: 170px; } .chart .bar-c { fill: var(--accent); } .chart .bar-t { fill: var(--blue); } .chart text { fill: var(--faint); font-size: 10px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; } .legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--c); }
.checklist div { display: flex; align-items: center; gap: 10px; padding: 7px 0; } .checklist .ok { color: var(--green); } .checklist .no { color: var(--yellow); }
.status-hero { display: flex; align-items: center; gap: 14px; } .status-hero .big { font-size: 26px; font-weight: 700; }
.lb-row { display: grid; grid-template-columns: 44px 1fr 120px; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lb-row .pos { font-weight: 800; color: var(--muted); text-align: center; } .progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; } .progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 260px; left: -270px; transition: left .2s; } .sidebar.open { left: 0; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; } .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; gap: 8px; } .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
