:root {
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

:root[data-theme="dark"] {
  --bg: #071315;
  --sidebar: #08171a;
  --card: #0d1d20;
  --card-alt: #12262a;
  --elevated: #183037;
  --border: rgba(220, 255, 250, .08);
  --border-strong: rgba(220, 255, 250, .16);
  --text: #eefbf8;
  --dim: #9db8b5;
  --faint: #6b8886;
  --accent: #5eead4;
  --accent-strong: #8ff5e4;
  --accent-soft: rgba(94, 234, 212, .12);
  --on-accent: #04201c;
  --primary-bg: #5eead4;
  --primary-text: #04201c;
  --grad-primary: linear-gradient(135deg, #5eead4 0%, #7dd3fc 100%);
  --grad-soft: linear-gradient(135deg, rgba(94, 234, 212, .16), rgba(125, 211, 252, .1));
  --hover: rgba(94, 234, 212, .08);
  --danger: #ff8fa3;
  --danger-soft: rgba(255, 143, 163, .12);
  --success: #7ee7a8;
  --warn: #ffd479;
  --shadow: 0 24px 64px rgba(0, 8, 10, .46);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, .035);
  --glass: rgba(11, 27, 30, .82);
  --glow: rgba(94, 234, 212, .1);
  --topbar: rgba(7, 19, 21, .82);
  --hero: linear-gradient(135deg, #0e2b2c 0%, #0b1d27 52%, #171b33 100%);
  --hero-border: rgba(94, 234, 212, .18);
  --hero-text: #eefbf8;
  --c1: #5eead4;
  --c2: #7dd3fc;
  --c3: #c4b5fd;
  --c4: #fdba74;
}

:root[data-theme="light"] {
  --bg: #f2faf7;
  --sidebar: #f9fdfb;
  --card: #ffffff;
  --card-alt: #eef8f5;
  --elevated: #ffffff;
  --border: #dfeee8;
  --border-strong: #cbe2da;
  --text: #0c1a18;
  --dim: #5d7671;
  --faint: #91a9a3;
  --accent: #14b8a6;
  --accent-strong: #0f8f82;
  --accent-soft: #d9f7ef;
  --on-accent: #04201c;
  --primary-bg: #14b8a6;
  --primary-text: #04201c;
  --grad-primary: linear-gradient(135deg, #14b8a6 0%, #38bdf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(20, 184, 166, .14), rgba(56, 189, 248, .1));
  --hover: rgba(20, 184, 166, .06);
  --danger: #e05d75;
  --danger-soft: rgba(224, 93, 117, .08);
  --success: #2f9e6a;
  --warn: #b7791f;
  --shadow: 0 24px 60px rgba(20, 60, 50, .1);
  --shadow-soft: 0 1px 2px rgba(20, 60, 50, .04);
  --glass: rgba(255, 255, 255, .85);
  --glow: rgba(94, 234, 212, .12);
  --topbar: rgba(242, 250, 247, .86);
  --hero: linear-gradient(135deg, #ddf8ef 0%, #e6f5ff 48%, #f0ebff 100%);
  --hero-border: #d3eee5;
  --hero-text: #0c1a18;
  --c1: #0f9f8f;
  --c2: #0284c7;
  --c3: #7c3aed;
  --c4: #ea580c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.muted { color: var(--dim); }
.right { text-align: right; }
.inline { display: inline; margin: 0; }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: 242px minmax(0, 1fr); height: 100vh; overflow: hidden; }

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  transition: background-color .3s ease, border-color .3s ease;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.logo {
  width: 40px; height: 40px;
  border-radius: 14px;
  background: radial-gradient(circle at 28% 22%, #eafffb 0%, #5eead4 38%, #38bdf8 70%, #a78bfa 100%);
  color: #04201c;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800;
  box-shadow: 0 0 28px rgba(94, 234, 212, .34);
  transition: transform .2s ease, box-shadow .2s ease;
}
.brand:hover .logo { transform: rotate(-5deg) scale(1.04); box-shadow: 0 0 34px rgba(94, 234, 212, .48); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.brand-text span { font-size: 9.5px; letter-spacing: 1.9px; color: var(--faint); margin-top: 5px; }

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 10px 10px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  text-align: left;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.nav button:hover { background: var(--hover); color: var(--text); }
.nav button.active {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav button.active .nav-icon { color: var(--accent-strong); }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; color: inherit; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.side-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.side-status-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.side-status strong { font-size: 14px; font-weight: 650; }
.side-status .mono { font-size: 11px; }
.side-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 0 4px; }
.version { font-size: 11px; color: var(--faint); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex: 0 0 auto; }
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px rgba(94, 234, 212, .15); }
.dot.warn { background: var(--warn); animation: pulse 1.5s ease-in-out infinite; }
.dot.bad { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: .5; transform: scale(.88); } 50% { opacity: 1; transform: scale(1.1); } }

.theme-switch {
  position: relative;
  display: flex;
  width: 96px; height: 36px;
  padding: 3px;
  border-radius: 999px;
  background: var(--card-alt);
  border: 1px solid var(--border);
}
.theme-switch button {
  position: relative; z-index: 1;
  flex: 1;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  border-radius: 999px;
}
.theme-switch button:hover { background: transparent; }
.theme-switch button svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.theme-pill {
  position: absolute; z-index: 0;
  top: 3px; left: 3px;
  width: calc(50% - 3px); height: 28px;
  border-radius: 999px;
  background: var(--grad-primary);
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(94, 234, 212, .24);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.theme-switch[data-active="light"] .theme-pill { transform: translateX(calc(100% + 0px)); }
.theme-switch[data-active="dark"] button:first-child,
.theme-switch[data-active="light"] button:nth-child(2) { color: var(--on-accent); }

/* ---------- topbar ---------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  background:
    radial-gradient(900px 420px at 72% -12%, var(--glow), transparent 66%),
    var(--bg);
  transition: background-color .3s ease;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 34px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: var(--topbar);
  backdrop-filter: blur(14px);
}
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.brand-mini { color: var(--text); font-weight: 650; }
.sep { color: var(--faint); }
#pageName { color: var(--text); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-user {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}
.top-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 22%, #eafffb 0%, #5eead4 38%, #38bdf8 70%, #a78bfa 100%);
  color: #04201c;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}
.top-user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.top-user-meta strong { font-size: 12px; font-weight: 650; }
.top-user-meta span { font-size: 10px; color: var(--faint); }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
}
.pill.ok { color: var(--text); border-color: rgba(94, 234, 212, .3); background: var(--accent-soft); }
.pill.ok .dot { background: var(--accent); }
.pill.warn .dot { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
.pill.bad .dot { background: var(--faint); }

.content { flex: 1; overflow-y: auto; padding: 30px 36px 44px; }
.page { display: none; max-width: 1640px; margin: 0 auto; }
.page.active { display: block; animation: pageIn .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
.page-head { margin: 2px 0 24px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 750; letter-spacing: -.7px; }
.page-head p { margin: 6px 0 0; font-size: 13.5px; color: var(--dim); }

/* ---------- base components ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: background-color .3s ease, border-color .3s ease, box-shadow .2s ease, transform .2s ease;
}
h2, h3 { margin: 0; font-weight: 650; }
h3 { font-size: 16px; letter-spacing: -.2px; }

button {
  border: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--text);
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 13.5px;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
button:hover { background: var(--elevated); border-color: var(--border-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary {
  background: var(--grad-primary);
  color: var(--primary-text);
  border-color: transparent;
  border-radius: 999px;
  font-weight: 650;
}
button.primary:hover { background: var(--grad-primary); border-color: transparent; color: var(--primary-text); filter: brightness(1.06); transform: translateY(-1px); }
button.danger { color: var(--danger); border-color: rgba(255, 143, 163, .28); background: var(--danger-soft); border-radius: 999px; }
button.danger:hover { background: rgba(255, 143, 163, .17); }
button.ghost { background: transparent; border-color: transparent; color: var(--dim); }
button.ghost:hover { background: var(--hover); color: var(--text); }
button.small { padding: 7px 12px; font-size: 12px; }
button.link { border: 0; background: none; color: var(--accent-strong); padding: 4px 0; font-size: 12.5px; }
button.link:hover { background: none; color: var(--accent); }

input, textarea {
  width: 100%;
  background: var(--card-alt);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94, 234, 212, .14); }

/* ---------- overview ---------- */

.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 30px 34px;
  min-height: 220px;
  border-radius: 24px;
  background: var(--hero);
  border-color: var(--hero-border);
  color: var(--hero-text);
  box-shadow: var(--shadow-soft);
}
.hero::before {
  content: "";
  position: absolute;
  right: -90px; top: -150px;
  width: 450px; height: 450px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 42%, rgba(94, 234, 212, .22), transparent 58%),
    radial-gradient(circle at 68% 62%, rgba(125, 211, 252, .15), transparent 60%),
    radial-gradient(circle at 84% 28%, rgba(196, 181, 253, .13), transparent 58%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  right: 8px; top: 50%;
  width: 300px; height: 300px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
    #5eead4 0deg .75deg, transparent .75deg 2.4deg,
    #7dd3fc 2.4deg 3.15deg, transparent 3.15deg 4.8deg,
    #c4b5fd 4.8deg 5.55deg, transparent 5.55deg 7.2deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  opacity: .42;
  pointer-events: none;
}
.hero-left { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; }
.hero .pill { background: var(--accent-soft); border-color: rgba(94, 234, 212, .26); color: var(--hero-text); }
.hero h2 { font-size: 30px; margin: 16px 0 8px; letter-spacing: -.7px; }
.hero .mono { font-size: 13px; }
.hero .small { margin-top: 5px; font-size: 12.5px; color: var(--dim); }
.hero-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 22px; flex-wrap: wrap; }
.hero-actions button { border-radius: 999px; }
.hero-right {
  position: relative; z-index: 1;
  min-width: 300px;
  display: flex; flex-direction: column; align-items: flex-end;
  justify-content: center;
}
.hero-right .label { font-size: 12px; letter-spacing: .6px; color: var(--dim); text-transform: uppercase; }
.hero-uptime { font-size: 54px; font-weight: 750; letter-spacing: -2px; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-right .mono { margin-top: 4px; font-size: 12.5px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.stat { position: relative; padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 7px; overflow: hidden; }
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-icon {
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid; place-items: center;
}
.stat-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat:nth-child(1) .stat-icon { background: rgba(94, 234, 212, .13); color: var(--c1); }
.stat:nth-child(2) .stat-icon { background: rgba(125, 211, 252, .14); color: var(--c2); }
.stat:nth-child(3) .stat-icon { background: rgba(196, 181, 253, .16); color: var(--c3); }
.stat:nth-child(4) .stat-icon { background: rgba(253, 186, 116, .14); color: var(--c4); }
.stat > span { font-size: 12.5px; color: var(--dim); padding-right: 52px; }
.stat b { font-size: 32px; font-weight: 750; letter-spacing: -1.1px; line-height: 1.12; }
.stat small { font-size: 12px; color: var(--faint); }

.lower { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-top: 18px; min-height: 360px; }
.recent { display: flex; flex-direction: column; padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.recent-list { display: flex; flex-direction: column; gap: 3px; }
.recent-row {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 8px;
  border-radius: 12px;
  font-size: 13.5px;
  transition: background-color .16s ease;
}
.recent-row:hover { background: var(--hover); }
.recent-row time { width: 52px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); flex: 0 0 auto; }
.recent-row .text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.quick { padding: 22px 24px; display: flex; flex-direction: column; gap: 9px; }
.quick h3 { margin-bottom: 5px; }
.quick button { width: 100%; text-align: center; border-radius: 999px; background: var(--card-alt); }
.quick button:hover { background: var(--accent-soft); border-color: transparent; color: var(--text); }

.segmented {
  display: inline-flex; gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-alt);
}
.segmented button { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; color: var(--dim); font-size: 12.5px; }
.segmented button:hover { background: var(--hover); }
.segmented button.active { background: var(--text); color: var(--card); }

/* ---------- chat ---------- */

.chat-card { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 500px; padding: 18px; border-radius: 24px; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 14px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.chat-row { display: flex; gap: 12px; padding: 10px 12px; border-radius: 14px; transition: background-color .16s ease; }
.chat-row:hover { background: var(--hover); }
.chat-row.new { animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(94, 234, 212, .2);
  color: var(--accent-strong);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
  flex: 0 0 auto;
}
.avatar.me { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chat-body { min-width: 0; flex: 1; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; }
.chat-meta .name { font-size: 13.5px; font-weight: 600; }
.chat-meta time { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.chat-text { margin-top: 3px; font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.chat-system { display: flex; align-items: center; gap: 9px; padding: 6px 10px; font-size: 12.5px; color: var(--dim); }
.chat-system.new { animation: msgIn .25s ease; }
.chat-system .dot { width: 5px; height: 5px; }
.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input input {
  flex: 1;
  height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--card-alt);
}
.chat-input .primary { height: 46px; padding: 0 26px; }

/* ---------- users ---------- */

.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.users-toolbar input { max-width: 320px; height: 42px; border-radius: 999px; padding: 0 18px; }
.users-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.table-card { overflow: hidden; padding: 8px 0 10px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  padding: 14px 18px;
}
td { font-size: 13.5px; padding: 14px 18px; border-top: 1px solid var(--border); }
tbody tr { cursor: pointer; transition: background-color .16s ease; }
tbody tr:hover, tbody tr.selected { background: var(--accent-soft); }
td .name-cell { display: flex; align-items: center; gap: 10px; }
td .mini-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(94, 234, 212, .18);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: var(--accent-strong);
}
td.rank { font-weight: 600; }
.rank-dev { color: #7dd3fc; }
.rank-admin { color: var(--accent-strong); }
.rank-user { color: var(--dim); }
.rank-custom { color: #c4a7ff; }
.state { font-size: 12px; }
.state.ok { color: var(--success); }
.state.bad { color: var(--danger); }
.state.off { color: var(--faint); }

.detail { padding: 22px; display: flex; flex-direction: column; gap: 14px; min-height: 320px; }
.detail.empty { align-items: center; justify-content: center; color: var(--faint); font-size: 13px; }
.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 22%, #eafffb 0%, #5eead4 38%, #38bdf8 70%, #a78bfa 100%);
  color: #04201c;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800;
  box-shadow: 0 0 24px rgba(94, 234, 212, .26);
}
.detail-name { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.rank-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  margin-top: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.info-grid { display: grid; grid-template-columns: 78px 1fr; gap: 9px 10px; font-size: 12.5px; }
.info-grid .k { color: var(--faint); }
.detail .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.detail .actions button { width: 100%; border-radius: 999px; }
.rank-buttons { display: flex; gap: 7px; }
.rank-buttons button { flex: 1; padding: 8px 0; }
.cmd-row { display: flex; gap: 8px; }
.cmd-row input { flex: 1; }
.admin-note { font-size: 12px; color: var(--warn); background: rgba(244, 201, 93, .09); border: 1px solid rgba(244, 201, 93, .18); border-radius: 10px; padding: 9px 11px; }
.empty-hint { color: var(--faint); font-size: 12.5px; }

/* ---------- console / config ---------- */

.console-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.console-list {
  height: calc(100vh - 240px);
  min-height: 420px;
  overflow-y: auto;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}
.log-line { display: flex; gap: 12px; white-space: pre-wrap; word-break: break-word; }
.log-line time { color: var(--faint); flex: 0 0 auto; }
.log-line .text { color: var(--dim); }
.log-line.error .text { color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--dim); cursor: pointer; }
.switch input { display: none; }
.switch .slider {
  width: 38px; height: 21px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background-color .22s ease;
}
.switch .slider::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--dim);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), background-color .22s ease;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(17px); background: var(--on-accent); }

.config-tabs { margin-bottom: 14px; }
.config-card { padding: 18px; border-radius: 22px; }
.config-path { font-size: 12px; margin-bottom: 10px; }
.config-card textarea {
  min-height: 420px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  border-radius: 14px;
  background: var(--bg);
}
.config-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; }
.config-actions .toolbar-right { gap: 8px; }

/* ---------- toasts ---------- */

.toasts { position: fixed; top: 72px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast {
  min-width: 220px; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: toastIn .26s cubic-bezier(.2, .8, .2, 1);
}
.toast.out { animation: toastOut .28s ease forwards; }
.toast .dot { width: 6px; height: 6px; background: var(--success); }
.toast.error .dot { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, .22); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(127, 127, 127, .34); }

/* ---------- MC colors ---------- */

.mc-0 { color: #8b93a5; } .mc-1 { color: #5b7cfa; } .mc-2 { color: #22c55e; }
.mc-3 { color: #14b8a6; } .mc-4 { color: #ef4444; } .mc-5 { color: #a855f7; }
.mc-6 { color: #f59e0b; } .mc-7 { color: var(--dim); } .mc-8 { color: #94a3b8; }
.mc-9 { color: #3b82f6; } .mc-a { color: #4ade80; } .mc-b { color: #22d3ee; }
.mc-c { color: #f87171; } .mc-d { color: #ec4899; } .mc-e { color: #facc15; }
.mc-f { color: var(--text); } .mc-r { color: inherit; }
.mc-l, .mc-o, .mc-n, .mc-m, .mc-k { color: inherit; }

/* ---------- login ---------- */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
  background:
    radial-gradient(900px 520px at 12% 0%, rgba(94, 234, 212, .16), transparent 60%),
    radial-gradient(720px 520px at 92% 100%, rgba(125, 211, 252, .14), transparent 62%),
    #eef9f5;
}
.login-shell {
  width: min(1240px, 100%);
  min-height: min(760px, calc(100vh - 52px));
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(380px, .88fr);
  overflow: hidden;
  border-radius: 30px;
  background: #fbfcf8;
  box-shadow: 0 34px 90px rgba(14, 60, 52, .18);
}
.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px 44px;
  color: #eefbf8;
  background:
    radial-gradient(620px 420px at 22% 8%, rgba(94, 234, 212, .22), transparent 62%),
    radial-gradient(540px 420px at 84% 18%, rgba(125, 211, 252, .18), transparent 62%),
    radial-gradient(620px 460px at 48% 94%, rgba(196, 181, 253, .14), transparent 62%),
    #061416;
}
.login-visual::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(94, 234, 212, .55) 1px, transparent 1.5px),
    radial-gradient(rgba(255, 255, 255, .28) 1px, transparent 1.5px);
  background-size: 118px 118px, 173px 173px;
  background-position: 20px 30px, 80px 90px;
  opacity: .18;
  pointer-events: none;
}
.login-visual::after {
  content: "";
  position: absolute;
  right: -120px; bottom: -160px;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125, 211, 252, .15), transparent 65%);
  pointer-events: none;
}
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.login-brand .logo { width: 40px; height: 40px; }
.login-visual .brand-text strong { color: #eefbf8; }
.login-visual .brand-text span { color: #7fa09b; }
.login-visual-main { position: relative; z-index: 1; display: flex; flex-direction: column; margin-top: 42px; }
.eyebrow { font-size: 10.5px; font-weight: 650; letter-spacing: 2px; text-transform: uppercase; color: var(--accent-strong); }
.login-visual .eyebrow { color: #5eead4; }
.login-visual h1 { margin: 16px 0 12px; font-size: 44px; font-weight: 750; line-height: 1.16; letter-spacing: -1.4px; }
.login-visual p { margin: 0; max-width: 470px; font-size: 14px; line-height: 1.7; color: #9db8b5; }

.login-orbit {
  position: relative;
  width: 250px; height: 250px;
  margin: 30px auto 8px;
  display: grid;
  place-items: center;
}
.login-orbit::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
    #5eead4 0deg .7deg, transparent .7deg 2.2deg,
    #7dd3fc 2.2deg 2.9deg, transparent 2.9deg 4.4deg,
    #c4b5fd 4.4deg 5.1deg, transparent 5.1deg 6.6deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: .8;
  animation: orbitSpin 90s linear infinite;
}
.login-orbit::after {
  content: "";
  position: absolute; inset: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 234, 212, .16), transparent 66%);
  filter: blur(18px);
}
@keyframes orbitSpin { to { transform: rotate(360deg); } }
.orbit-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.orbit-center strong { font-size: 38px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.orbit-center span { font-size: 11px; letter-spacing: 1.8px; color: #7fa09b; }

.login-features { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.login-feature {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(94, 234, 212, .08), rgba(125, 211, 252, .045));
  border: 1px solid rgba(94, 234, 212, .14);
}
.login-feature svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: #5eead4; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.login-feature:nth-child(2) svg { stroke: #7dd3fc; }
.login-feature:nth-child(3) svg { stroke: #c4b5fd; }
.login-feature:nth-child(4) svg { stroke: #fdba74; }
.login-feature div { display: flex; flex-direction: column; gap: 3px; }
.login-feature strong { font-size: 12.5px; font-weight: 600; color: #eefbf8; }
.login-feature span { font-size: 11px; color: #7fa09b; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 34px; background: #f6fbf9; }
.login-card {
  width: min(400px, 100%);
  padding: 34px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid #dfeee8;
  box-shadow: 0 22px 60px rgba(14, 60, 52, .1);
  animation: loginIn .4s cubic-bezier(.2, .8, .2, 1);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.login-card-head .eyebrow { color: #0f8f82; }
.login-card h1 { margin: 10px 0 6px; font-size: 30px; font-weight: 750; letter-spacing: -.8px; color: #0c1a18; }
.login-card-head p { margin: 0 0 24px; font-size: 13px; color: #5d7671; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 12px; font-weight: 600; color: #5d7671; }
.login-input-wrap { position: relative; }
.login-input-wrap svg {
  position: absolute; left: 14px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  fill: none; stroke: #91a9a3; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.login-input-wrap input {
  height: 48px;
  padding: 0 14px 0 44px;
  border-radius: 12px;
  background: #f6fbf9;
  border: 1px solid #dfeee8;
  color: #0c1a18;
}
.login-input-wrap input:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(94, 234, 212, .16); }
.login-card button.primary {
  height: 48px;
  margin-top: 4px;
  border-radius: 12px;
  background: var(--grad-primary);
  border-color: transparent;
  color: #04201c;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.login-card button.primary:hover { background: var(--grad-primary); border-color: transparent; color: #04201c; filter: brightness(1.06); }
.login-card button.primary span { transition: transform .18s ease; }
.login-card button.primary:hover span { transform: translateX(3px); }
.login-error { min-height: 18px; font-size: 12px; color: #e05d75; }
.login-foot { margin-top: 18px; padding-top: 15px; border-top: 1px solid #dfeee8; font-size: 11.5px; line-height: 1.6; color: #91a9a3; }
.login-foot .mono { color: #5d7671; }

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  .lower { grid-template-columns: 1fr; }
  .users-layout { grid-template-columns: 1fr; }
  .detail { min-height: 0; }
}

@media (max-width: 1024px) {
  .app { grid-template-columns: 78px minmax(0, 1fr); }
  .brand-text, .nav-label, .nav button > span:last-child, .side-status strong, .side-status .mono, .side-status-row .muted, .version { display: none; }
  .sidebar { padding-left: 10px; padding-right: 10px; align-items: center; }
  .brand { justify-content: center; padding: 2px 0 22px; }
  .nav { width: 100%; }
  .nav button { width: 46px; height: 44px; justify-content: center; padding: 0; margin: 0 auto; }
  .side-status { width: 48px; padding: 12px 0; align-items: center; }
  .side-bottom { flex-direction: column; }
  .theme-switch { width: 48px; }
  .theme-switch button:nth-child(2) { display: none; }
  .theme-pill { width: 42px; }
  .theme-switch[data-active="light"] .theme-pill { transform: none; }
  .hero { flex-direction: column; }
  .hero::after { right: -80px; opacity: .18; }
  .hero-right { align-items: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 24px; }
  .topbar { padding: 0 24px; }
  .chat-card { height: calc(100vh - 176px); }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 560px; }
  .login-form-side { padding: 30px; }
}

@media (max-width: 680px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { height: 58px; padding: 0 16px; }
  .top-user-meta { display: none; }
  .top-user { padding: 4px; }
  .content { padding: 18px 16px 28px; }
  .page-head h1 { font-size: 24px; }
  .hero { padding: 24px 22px; }
  .hero::after { display: none; }
  .hero h2 { font-size: 24px; }
  .hero-uptime { font-size: 42px; }
  .stats { grid-template-columns: 1fr; }
  .chat-card { height: calc(100vh - 150px); min-height: 420px; padding: 14px; }
  .chat-toolbar { flex-wrap: wrap; }
  .users-toolbar { flex-wrap: wrap; }
  .login-body { padding: 0; }
  .login-shell { border-radius: 0; min-height: 100vh; }
  .login-visual { min-height: 0; padding: 28px 24px 30px; }
  .login-visual-main { margin-top: 28px; }
  .login-visual h1 { font-size: 34px; }
  .login-orbit { width: 210px; height: 210px; }
  .orbit-center strong { font-size: 32px; }
  .login-features { display: none; }
  .login-form-side { padding: 26px 20px 32px; }
  .login-card { padding: 26px; }
}
