:root {
  --bg: #0f1115;
  --bg-deep: #0a0c10;
  --surface: #1a1e26;
  --surface-2: #141820;
  --surface-3: #202633;
  --line: #2a3140;
  --line-soft: #222836;
  --text: #e8ecf4;
  --text-soft: #c3cad7;
  --muted: #8b95a7;
  --muted-2: #6d7789;
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --primary-line: rgba(59, 130, 246, 0.35);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 420px at 82% -8%, rgba(59, 130, 246, 0.14), transparent 62%),
    radial-gradient(620px 380px at 0% 108%, rgba(99, 102, 241, 0.08), transparent 60%);
  z-index: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection {
  background: rgba(59, 130, 246, 0.35);
}

/* ---------- Shared bits ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
}

.brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 8px;
  object-fit: contain;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #e9b949;
  border: 1px solid rgba(240, 192, 74, 0.38);
  border-radius: 4px;
  padding: 2px 5px;
  transform: translateY(-1px);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: none;
}

.dot-green {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.dot-amber {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}

.dot-red {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.dot-blue {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.eyebrow {
  margin: 0 0 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--primary);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.btn:hover {
  background: #272e3d;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(180deg, #4b8df8, var(--primary-strong));
  border-color: rgba(96, 165, 250, 0.4);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5b97fa, #2f6fe8);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #394355;
  color: var(--text);
}

.btn-sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
  min-height: 44px;
}

.btn-danger {
  background: linear-gradient(180deg, #f16868, #dc3030);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fff;
  box-shadow: 0 6px 18px rgba(220, 48, 48, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #f47a7a, #e13b3b);
}

.btn-warning {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.32);
  color: #fbbf24;
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.2);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.refresh-icon {
  display: inline-block;
  font-size: 15px;
  line-height: 1;
}

/* ---------- Inputs ---------- */

.input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(9, 12, 17, 0.55);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input::placeholder {
  color: #5d6676;
}

.input:hover {
  border-color: #384255;
}

.input:focus {
  border-color: var(--primary);
  background: rgba(9, 12, 17, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

select.input {
  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) 18px, calc(100% - 11px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

textarea.input {
  min-height: 84px;
  padding-top: 10px;
  resize: vertical;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.form-error {
  margin-top: 2px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: var(--red-soft);
  color: #fca5a5;
  font-size: 12.5px;
}

.form-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.form-stack .field-label {
  margin-bottom: -5px;
}

/* ---------- Login ---------- */

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 18px;
  overflow: hidden;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
}

.login-orb-a {
  width: 420px;
  height: 420px;
  top: -160px;
  right: -80px;
  background: rgba(37, 99, 235, 0.22);
}

.login-orb-b {
  width: 360px;
  height: 360px;
  left: -120px;
  bottom: -140px;
  background: rgba(124, 58, 237, 0.13);
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px 34px 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(32, 38, 51, 0.88), rgba(20, 24, 32, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
}

.brand-login {
  margin-bottom: 26px;
}

.login-card h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 8px 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form .field-label:not(:first-child) {
  margin-top: 8px;
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 44px;
}

.password-wrap .icon-btn {
  position: absolute;
  top: 4px;
  right: 4px;
}

.login-form .btn-block {
  margin-top: 16px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 11.5px;
}

/* ---------- App shell ---------- */

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15, 17, 21, 0.82);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  width: min(1380px, calc(100% - 40px));
  min-height: 66px;
  margin: 0 auto;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 66px;
}

.tab {
  position: relative;
  height: 100%;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.tab:hover {
  color: var(--text-soft);
}

.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.7);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.admin-name {
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.main {
  flex: 1;
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.page-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 17px 18px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(30, 35, 46, 0.8), rgba(24, 28, 37, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -36px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.055);
}

.stat-accent-green::after {
  background: rgba(34, 197, 94, 0.07);
}

.stat-accent-blue {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(155deg, rgba(37, 67, 122, 0.32), rgba(24, 28, 37, 0.95));
}

.stat-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stat-value {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(22px, 2.1vw, 29px);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--text);
}

.stat-accent-blue .stat-value {
  color: #93c5fd;
}

.stat-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 9px 0 0;
  color: var(--muted-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Panels ---------- */

.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 0;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}

.panel-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  padding-top: 3px;
}

.legend-swatch {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.65);
}

.count-badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  color: #93c5fd;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

/* ---------- Chart ---------- */

.chart-panel {
  padding-bottom: 8px;
}

.chart-wrap {
  position: relative;
  padding: 12px 14px 4px;
  min-height: 250px;
}

.traffic-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 236px;
  overflow: visible;
}

.chart-label {
  fill: var(--muted-2);
  font-family: var(--mono);
  font-size: 10.5px;
}

.chart-grid {
  stroke: #252c39;
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-axis {
  stroke: #333c4c;
  stroke-width: 1;
}

.chart-area {
  fill: url(#trafficGradient);
  opacity: 0.9;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.45));
}

.chart-dot {
  fill: #0f1115;
  stroke: #60a5fa;
  stroke-width: 2;
}

.chart-cross {
  stroke: rgba(147, 197, 253, 0.55);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-tip-box {
  fill: #0b0e14;
  stroke: #334155;
  stroke-width: 1;
  rx: 7;
}

.chart-tip-text {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

.chart-tip-sub {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* ---------- Tables ---------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 14px 6px 6px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 780px;
}

.rooms-table {
  min-width: 1030px;
}

.online-table {
  min-width: 1020px;
}

.data-table th {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.5);
  color: var(--text-soft);
  font-size: 12.5px;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.13s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

.data-table .num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.actions-col {
  text-align: right !important;
  width: 1%;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.action-link {
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: color 0.13s ease, background 0.13s ease, border-color 0.13s ease;
}

.action-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.action-link.is-primary {
  color: #93c5fd;
}

.action-link.is-primary:hover {
  color: #bfdbfe;
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.action-link.is-danger {
  color: #fca5a5;
}

.action-link.is-danger:hover {
  color: #fecaca;
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.3);
}

.action-link.is-warn {
  color: #fcd34d;
}

.action-link.is-warn:hover {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.3);
}

.room-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.room-code {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.room-sub {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.platform-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.platform-android {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.08);
}

.platform-ios {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.24);
  background: rgba(167, 139, 250, 0.08);
}

.platform-windows {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.24);
  background: rgba(59, 130, 246, 0.08);
}

.platform-macos {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.08);
}

.platform-linux {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.08);
}

.version-text {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.muted-text {
  color: var(--muted-2);
}

.mono-text {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* 电脑码（房间号派生）与电脑 IP：等宽、IP 可截断，hover/长按看全量 */
.pc-code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text);
  white-space: nowrap;
}

.ip-text {
  display: inline-block;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}

.ip-text.is-empty {
  color: var(--muted-2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-online {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.26);
  background: var(--green-soft);
}

.status-blocked {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.28);
  background: var(--red-soft);
}

.status-limited {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.28);
  background: var(--amber-soft);
}

.status-offline {
  color: var(--muted);
}

.limit-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.limit-text.is-set {
  color: var(--text-soft);
}

.queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  font-size: 9.5px;
  font-family: var(--mono);
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.search-wrap {
  position: relative;
  flex: 1 1 260px;
  max-width: 390px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search-input {
  min-height: 38px;
  padding-left: 36px;
  font-size: 12.5px;
}

.search-input::-webkit-search-cancel-button {
  filter: invert(0.6);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.chip:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.chip.is-active {
  color: #bfdbfe;
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.toolbar-count {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

/* ---------- Empty / pagination ---------- */

.empty-state {
  padding: 52px 20px 58px;
  text-align: center;
}

.empty-title {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

.empty-sub {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px 15px;
  border-top: 1px solid var(--line-soft);
}

.page-info {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}

.page-buttons {
  display: flex;
  gap: 6px;
}

.loading-row td {
  padding: 42px 14px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 16px 0 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(5px);
  animation: fade-in 0.14s ease;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  border-radius: 16px;
  border: 1px solid #333c4c;
  background: linear-gradient(170deg, #1d222c, #171b23 60%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: modal-in 0.16s ease;
}

.modal-wide {
  width: min(880px, 100%);
}

.modal-sm {
  width: min(460px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-head-main {
  min-width: 0;
}

.modal-eyebrow {
  margin: 0 0 3px;
  color: var(--primary);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.modal-desc {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-head .icon-btn {
  margin-left: auto;
  flex: none;
}

.modal-body {
  overflow-y: auto;
  padding: 18px 22px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-soft);
}

.modal-foot .modal-foot-note {
  margin-right: auto;
  color: var(--muted-2);
  font-size: 11px;
}

.hash-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.55);
  margin-bottom: 16px;
}

.hash-line code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: #bfdbfe;
  overflow-wrap: anywhere;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--line-soft);
  margin-bottom: 18px;
}

.meta-item {
  padding: 11px 13px;
  background: var(--surface-2);
}

.meta-label {
  margin: 0 0 3px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meta-value {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.meta-value.mono-text {
  font-size: 11.5px;
}

.detail-section {
  margin-bottom: 18px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 13px;
  color: var(--text-soft);
}

.detail-section h3::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--primary);
}

.detail-note {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-left: 2px solid var(--primary-line);
  background: rgba(59, 130, 246, 0.05);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.session-table {
  min-width: 720px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  border-collapse: separate;
  border-spacing: 0;
}

.session-table th {
  background: var(--surface-2);
}

.session-table td {
  padding: 9px 11px;
  font-size: 11.5px;
}

.session-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
}

.session-role-pc {
  color: #93c5fd;
}

.session-role-phone {
  color: #86efac;
}

.limit-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--surface-2);
  margin-bottom: 16px;
}

.limit-current-label {
  color: var(--muted);
  font-size: 11.5px;
}

.limit-current-value {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
}

.limit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 15px;
}

.limit-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.limit-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 7px;
}

.limit-combo .input {
  min-width: 0;
}

.danger-note {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 9px;
  background: var(--red-soft);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.6;
}

.warn-note {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 9px;
  background: var(--amber-soft);
  color: #fcd34d;
  font-size: 12px;
  line-height: 1.6;
}

.info-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

/* ---------- Toasts ---------- */

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(390px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(26, 30, 38, 0.96);
  color: var(--text-soft);
  font-size: 12.5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  animation: toast-in 0.18s ease;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  flex: none;
}

.toast.is-success::before {
  background: var(--green);
}

.toast.is-error {
  border-color: rgba(239, 68, 68, 0.35);
}

.toast.is-error::before {
  background: var(--red);
}

.toast.is-warn::before {
  background: var(--amber);
}

/* ---------- Loading spinner ---------- */

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- Animations ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

.shake {
  animation: shake 0.35s ease;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stat-card:nth-child(1),
  .stat-card:nth-child(2) {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    gap: 14px;
    width: calc(100% - 28px);
  }
  .tabs {
    order: 3;
    width: 100%;
    height: 44px;
    border-top: 1px solid var(--line-soft);
  }
  .topbar-inner {
    flex-wrap: wrap;
    padding-top: 8px;
  }
  .top-actions {
    margin-left: auto;
  }
  .main,
  .footer {
    width: calc(100% - 28px);
  }
  .main {
    padding-top: 24px;
  }
  .page-head h1 {
    font-size: 23px;
  }
  .panel-head {
    flex-wrap: wrap;
  }
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    font-size: 13px;
  }
  .login-card {
    padding: 26px 22px 20px;
  }
  .login-card h1 {
    font-size: 23px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-card {
    padding: 14px 14px 12px;
  }
  .stat-value {
    font-size: 22px;
  }
  .stat-foot {
    font-size: 10px;
  }
  .top-actions .admin-name,
  .top-actions .live-pill {
    display: none;
  }
  .live-pill {
    padding: 3px 7px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }
  .page-head .btn {
    align-self: flex-end;
    margin-top: -38px;
  }
  .chart-wrap {
    padding: 6px 4px 0;
    min-height: 190px;
  }
  .traffic-chart {
    min-height: 180px;
  }
  .panel-head {
    padding: 15px 15px 0;
  }
  .table-wrap {
    padding-top: 10px;
  }
  .col-hide-sm,
  .col-hide-md {
    display: none;
  }
  .online-table {
    min-width: 0;
  }
  .ip-text {
    max-width: 118px;
  }
  .toolbar {
    padding: 12px 14px;
  }
  .search-wrap {
    max-width: none;
    flex-basis: 100%;
  }
  .toolbar-count {
    margin-left: 0;
  }
  .pagination {
    padding: 12px 14px;
  }
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  .modal {
    max-height: 92vh;
    border-radius: 14px;
  }
  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .limit-fields {
    grid-template-columns: 1fr;
  }
  .modal-foot {
    flex-wrap: wrap;
  }
  .modal-foot .modal-foot-note {
    width: 100%;
    order: 3;
  }
  .toast-root {
    left: 14px;
    right: 14px;
    bottom: 14px;
    align-items: stretch;
  }
  .toast {
    max-width: none;
  }
  .footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
