:root {
  --bg: #eef2f7;
  --bg-accent: #e0ebff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #dbe3ef;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 4px 16px rgba(99, 102, 241, 0.08);
  --radius: 16px;
  --sidebar-width: 220px;
  --gradient-brand: linear-gradient(135deg, #2563eb 0%, #6366f1 50%, #8b5cf6 100%);
  --gradient-sidebar: linear-gradient(180deg, #1e3a8a 0%, #3730a3 42%, #312e81 100%);
  --gradient-page: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 40%, #eff6ff 100%);
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --gradient-primary-hover: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --sidebar-text: rgba(255, 255, 255, 0.86);
  --sidebar-text-muted: rgba(255, 255, 255, 0.52);
  --glass: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.65);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  background: var(--gradient-page);
  background-attachment: fixed;
  color: var(--text);
}

/* ── 背景装饰 ── */
.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.app-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.app-bg-orb--1 {
  width: 480px;
  height: 480px;
  top: -120px;
  right: 8%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}

.app-bg-orb--2 {
  width: 360px;
  height: 360px;
  bottom: -80px;
  left: 22%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.28) 0%, transparent 70%);
}

.app-bg-orb--3 {
  width: 280px;
  height: 280px;
  top: 40%;
  left: 55%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
}

.app-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
}

/* ── 嵌套布局：侧栏 + 内容区 ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.app-sidebar {
  flex: 0 0 var(--sidebar-width, 240px);
  width: var(--sidebar-width, 240px);
  background: var(--gradient-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 32px rgba(30, 58, 138, 0.22);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 20;
}

.sidebar-brand,
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.sidebar-brand-link:hover {
  opacity: 0.92;
}

.sidebar-brand .brand-icon,
.sidebar-brand-link .brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
  background: var(--gradient-brand);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  color: #fff;
}

.sidebar-brand-text strong {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.sidebar-brand-text span {
  font-size: 11px;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section + .nav-section {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-section--bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-section-label {
  padding: 0 14px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 0 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #93c5fd, 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sidebar-brand .brand-icon svg,
.sidebar-brand-link .brand-icon svg {
  width: 24px;
  height: 24px;
}

.sidebar-brand-text,
.sidebar-brand-link .sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0;
  padding: 12px 0 8px;
  overflow-y: auto;
}

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.04em;
}

.sidebar-footer--api {
  gap: 10px;
}

.sidebar-settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
}

.sidebar-settings-toggle.is-open {
  color: #fff;
}

.sidebar-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 2px;
}

.sidebar-settings-panel[hidden] {
  display: none !important;
}

.sidebar-settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--sidebar-text);
}

.sidebar-settings-field input:not(.sidebar-api-input) {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.35);
  color: #fff;
  font-size: 12px;
}

.sidebar-settings-field input:not(.sidebar-api-input)::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-settings-hint,
.sidebar-settings-current {
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--sidebar-text-muted);
}

.sidebar-settings-current code {
  font-size: 10px;
  word-break: break-all;
  color: #cbd5e1;
}

.sidebar-settings-actions {
  display: flex;
  gap: 8px;
}

.page-main:not(.panel-wide) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.page-main.panel-wide.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.page-main.panel-wide > .page-panel > .card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow: hidden;
}

.page-main.panel-wide .page-head-bar,
.page-main.panel-wide .sub-tabs {
  flex-shrink: 0;
}

.page-main.panel-wide .table-wrap:not(.dashboard-table-wrap) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.page-main.panel-wide > .page-panel > .card > .pager {
  flex-shrink: 0;
  margin-top: 8px;
}

.page-main.panel-wide .tyc-filter {
  flex-shrink: 0;
}

.sidebar-footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.85); }
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f2f5;
}

.nav-group-label {
  padding: 6px 12px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 0.02em;
}

.app-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
}

.page-head-bar {
  flex-shrink: 0;
  width: 100%;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
}

.page-head-bar--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-head-bar--split .page-head-mount {
  flex: 1 1 auto;
  min-width: 0;
}

.page-head-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.page-head-path .breadcrumb-item,
.page-head-path .breadcrumb-sep,
.page-head-path .breadcrumb-current {
  font-size: inherit;
  line-height: inherit;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  color: inherit;
}

.page-head-path .breadcrumb-item {
  font-weight: 500;
  color: var(--muted);
}

.page-head-path .breadcrumb-sep {
  font-weight: 400;
  color: #cbd5e1;
}

.page-head-path .breadcrumb-current {
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.page-main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.breadcrumb-item {
  color: var(--muted);
}

.breadcrumb-sep {
  color: #cbd5e1;
}

.page-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0;
}

.page-card-head,
.card-title.toolbar-title.page-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-card-head .page-head-mount,
.users-head-title .page-head-mount {
  flex: 1 1 auto;
  min-width: 0;
}

.panel-wide .sub-tabs {
  flex-shrink: 0;
  margin-bottom: 8px;
}

.page-card-head {
  margin-bottom: 8px;
}

.page-card-head h2 {
  margin: 0;
  font-size: 18px;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.header {
  margin-bottom: 16px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.brand-icon svg {
  width: 28px;
  height: 28px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

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

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

.tab-icon {
  width: 18px;
  height: 18px;
}

.panel {
  display: none;
}

.panel.active:not(.panel-wide) {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.panel-wide.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.panel-wide > .page-panel > .card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow: hidden;
}

.panel-wide .page-head-bar,
.panel-wide .sub-tabs {
  flex-shrink: 0;
}

.panel-wide .users-head-row {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 20px;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 20px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.9) 0%, rgba(238, 242, 255, 0.85) 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dashboard-hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.dashboard-hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.dashboard-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dashboard-refresh-countdown {
  font-size: 13px;
  color: var(--muted);
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.dashboard-actions {
  margin-left: auto;
}

.dashboard-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.dashboard-top .status-badge {
  margin-bottom: 0;
}

.dashboard-uptime {
  color: var(--muted);
  font-size: 14px;
}

.dashboard-uptime strong {
  color: var(--text);
  font-weight: 600;
}

.dashboard-kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 20px;
}

.stat-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.stat-card--api::before { background: var(--gradient-accent); }
.stat-card--msg::before { background: var(--gradient-primary); }
.stat-card--evt::before { background: linear-gradient(180deg, #8b5cf6, #6366f1); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

.stat-card dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stat-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  background: var(--primary-soft);
}

.stat-icon--api {
  background: linear-gradient(135deg, #ecfeff, #cffafe);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.stat-icon--msg {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.stat-icon--evt {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.2);
}

.stat-icon--api::after,
.stat-icon--msg::after,
.stat-icon--evt::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
}

.stat-icon--api { color: #0891b2; }
.stat-icon--msg { color: #2563eb; }
.stat-icon--evt { color: #7c3aed; }

.stat-icon--msg::after { border-radius: 50% 50% 50% 2px; }
.stat-icon--evt::after { border-radius: 50%; box-shadow: -4px 0 0 -1px currentColor; }

.stat-card dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.dashboard-table-wrap {
  margin-bottom: 16px;
}

.dashboard-conn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dashboard-conn-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-conn-title::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--gradient-primary);
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.dashboard-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-table tbody tr:last-child td {
  border-bottom: none;
}

.dashboard-table .conn-detail,
.dashboard-table .conn-address {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.dashboard-error-wrap {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.dashboard-error-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.conn-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.conn-badge.connected {
  background: var(--success-soft);
  color: var(--success);
}

.conn-badge.connected::before {
  background: var(--success);
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
}

.conn-badge.connecting::before,
.conn-badge.reconnecting::before {
  background: var(--warning);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.conn-badge.connecting,
.conn-badge.reconnecting {
  background: var(--warning-soft);
  color: var(--warning);
}

.conn-badge.offline::before {
  background: #94a3b8;
}

.conn-badge.offline {
  background: #f1f5f9;
  color: var(--muted);
}

.error-box {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: #334155;
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
}

.error-box.has-error {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title h2 {
  margin: 0;
  font-size: 18px;
}

.title-icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
  flex-shrink: 0;
}

.card-note ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 0;
}

.status-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.running {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.18);
}

.status-badge.running::before {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-badge.stopped {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-badge.stopped::before {
  background: #94a3b8;
}

.status-badge.stopping,
.status-badge.starting {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.status-badge.stopping::before,
.status-badge.starting::before {
  background: var(--warning);
  animation: pulse-dot 1s ease-in-out infinite;
}

.meta {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
}

.meta div {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 8px;
  font-size: 14px;
}

.meta dt {
  color: var(--muted);
}

.meta-group {
  margin: 0 0 20px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.meta-group .meta {
  margin: 0;
}

.cursor-value {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 600;
}

.meta dd {
  margin: 0;
  word-break: break-word;
}

.error-text {
  color: var(--danger);
}

.actions,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-primary-hover);
}

.btn-danger {
  background: var(--gradient-danger);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.05);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.form-card {
  width: 100%;
}

.config-panel {
  width: 100%;
}

.config-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.config-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1 1 280px;
}

.config-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.config-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.config-block--hardware {
  max-width: 100%;
}

.config-version-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(520px, calc(100vh - 320px));
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.config-version-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.config-version-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: #f8fafc;
}

.config-version-item.is-active {
  border-color: rgba(99, 102, 241, 0.45);
  background: linear-gradient(180deg, #eef2ff 0%, #f5f7ff 100%);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.config-version-item-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.config-version-item-time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.config-version-empty {
  padding: 16px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.config-main > .config-row--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.config-row--split .config-block {
  min-width: 0;
}

.config-fields--cursor {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-aside {
  min-width: 240px;
  max-width: 280px;
}

.config-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-card--enhanced .config-desc.page-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.page-hero--config + .config-desc.page-hint {
  padding-left: 2px;
}

.config-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
}

.config-badge--version {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  border-color: rgba(99, 102, 241, 0.25);
}

.config-badge--muted {
  color: var(--muted);
  font-weight: 600;
}

.config-history-hint {
  margin: -6px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid #fde68a;
}

.config-desc {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.config-form-readonly .config-block {
  opacity: 0.92;
}

.config-form-readonly input,
.config-form-readonly select,
.config-form-readonly textarea {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}

.config-footer {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.config-footer .form-message {
  margin: 0 0 12px;
}

.config-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.config-body {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.config-block {
  padding: 18px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.config-block-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.config-fields {
  display: grid;
  gap: 12px;
}

.config-fields--stack {
  grid-template-columns: 1fr;
}

.config-fields--corp {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-fields--hid {
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
}

.config-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.config-field > span {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.config-field--full {
  grid-column: 1 / -1;
}

.config-field--wide {
  min-width: 0;
}

.config-field input,
.config-field select {
  font-weight: 500;
  color: var(--text);
}

.page-hero--config .page-stat {
  align-items: center;
  text-align: center;
}

.page-hero--config .page-stat-label,
.page-hero--config .page-stat strong {
  width: 100%;
  text-align: center;
}

.config-aside #config-version-select {
  text-align: center;
  text-align-last: center;
}

@media (max-width: 1100px) {
  .config-fields--hid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .config-body {
    grid-template-columns: 1fr;
  }

  .config-aside {
    max-width: none;
  }

  .config-fields--corp {
    grid-template-columns: 1fr;
  }

  .config-row--split {
    grid-template-columns: 1fr;
  }
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.form-grid .full {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: white;
}

.form-message {
  margin-top: 12px;
  color: var(--success);
  font-size: 14px;
}

.toolbar-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.toolbar-title {
  margin-bottom: 16px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 24px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.filter-group--chips {
  flex: 1 1 320px;
}

.filter-group--select {
  flex: 0 1 160px;
}

.filter-group--search {
  flex: 1 1 260px;
  max-width: 420px;
}

.filter-group--range {
  flex: 0 1 auto;
}

.filter-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chip {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 0 12px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.chip:hover {
  border-color: var(--border);
  color: var(--text);
  background: #f8fafc;
}

.chip.active {
  background: var(--primary-soft);
  border-color: #93c5fd;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-range input[type="date"] {
  width: 150px;
}

.date-sep {
  color: var(--muted);
  font-size: 13px;
  line-height: 32px;
}

.filter-toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.filter-item {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.filter-item svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.filter-actions {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.table-wrap--data {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.panel-wide .table-wrap:not(.dashboard-table-wrap) {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.msg-panel .pager,
.users-footer,
.panel-wide > .page-panel > .card > .pager {
  flex-shrink: 0;
  margin-top: 8px;
  padding-top: 0;
}

.msg-panel table {
  min-width: 1280px;
}

.msg-panel table.msg-table--realbot {
  width: max(100%, max-content);
  min-width: 1080px;
}

.msg-panel table.msg-table--ws {
  width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.02em;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.6);
}

tbody tr:hover {
  background: #f0f4ff !important;
}

.log-level {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.logs-table {
  table-layout: fixed;
  width: 100%;
  min-width: 920px;
}

.logs-table .col-log-select {
  width: 44px;
}

.logs-table .col-log-id {
  width: 100px;
}

.logs-table .col-log-level {
  width: 64px;
}

.logs-table .col-log-module {
  width: 200px;
}

.logs-table .col-log-time {
  width: 176px;
}

.logs-table .col-log-message {
  width: auto;
}

.logs-table .cell-log-level,
.logs-table .cell-log-module,
.logs-table .cell-log-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-table .cell-log-message.log-message {
  min-width: 0;
  max-width: none;
  white-space: pre-wrap;
  word-break: break-word;
}

#log-level-chips .chip {
  min-width: 56px;
  white-space: nowrap;
}

.log-level.ERROR {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: var(--danger);
}

.log-level.WARNING {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: var(--warning);
}

.log-level.INFO {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--primary);
}

.log-level.DEBUG {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--muted);
}

.log-module {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #475569;
}

.log-message {
  max-width: none;
  min-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 32px !important;
}

.tyc-filter .chip.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #93c5fd;
  font-weight: 600;
}

.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: fit-content;
}

.sub-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.sub-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.sub-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
  font-weight: 600;
}

.sub-tab.active::after {
  display: none;
}

.msg-panel {
  display: none;
}

.msg-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.panel-wide .filter-toolbar,
.panel-wide .filter-bar {
  flex-shrink: 0;
  margin-bottom: 8px;
  padding: 10px 12px;
}

.panel-wide .toolbar-title {
  margin-bottom: 8px;
}

.panel-wide .users-filter-toolbar {
  margin-bottom: 8px;
}

.panel-wide th,
.panel-wide td {
  padding: 8px 10px;
}

/* 天眼查风格筛选（消息记录） */
.tyc-filter {
  --tyc-accent: #6366f1;
  --tyc-accent-soft: #eef2ff;
  flex-shrink: 0;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.tyc-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
  border-bottom: 1px solid #eef1f6;
}

.tyc-filter-head--clickable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.tyc-filter-head--clickable:hover {
  background: linear-gradient(180deg, #f5f7fa 0%, #eef2f6 100%);
}

.tyc-filter.is-collapsed .tyc-filter-head {
  border-bottom: none;
}

.tyc-filter.is-collapsed .tyc-filter-body {
  display: none;
}

.tyc-filter-summary {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tyc-filter.is-collapsed .tyc-filter-summary.has-active {
  color: var(--primary);
  font-weight: 600;
}

.tyc-filter-toggle {
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, color 0.15s ease;
}

.tyc-filter-head--clickable:hover .tyc-filter-toggle {
  color: var(--text);
}

.tyc-filter:not(.is-collapsed) .tyc-filter-toggle {
  transform: rotate(180deg);
}

.tyc-filter-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tyc-filter-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.tyc-filter-title::before {
  display: inline-block;
  content: "";
  width: 3px;
  height: 12px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--gradient-primary);
  vertical-align: -1px;
}

.tyc-filter-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tyc-filter-head-actions .btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-wide .tyc-filter {
  flex-shrink: 0;
}

.tyc-filter-refresh {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.tyc-filter-refresh:hover {
  background: #f8fafc;
  color: var(--text);
  border-color: #cbd5e1;
  box-shadow: none;
}

.tyc-filter-body {
  padding: 0;
}

.tyc-filter-body--compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.tyc-filter-body--compact .tyc-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f5;
  min-height: 32px;
  flex: none;
  width: 100%;
  box-sizing: border-box;
}

.tyc-filter-body--compact .tyc-filter-row--grow,
.tyc-filter-body--compact .tyc-filter-row--full {
  flex: none;
  width: 100%;
  min-width: 0;
}

.tyc-filter-body--compact .tyc-filter-label {
  flex: 0 0 72px;
  padding-top: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

.tyc-filter-body--compact .tyc-filter-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex: none;
  margin-left: 0;
  min-height: 32px;
  padding: 10px 14px;
  border-top: 1px solid #eef1f6;
  background: #fafbfc;
  box-sizing: border-box;
}

.tyc-filter-control--time {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.tyc-filter-control--time .filter-chips {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-chips .tyc-time-range {
  margin-left: 4px;
}

.tyc-time-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tyc-filter-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.tyc-filter-row-actions .btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tyc-filter-actions .btn {
  min-height: 32px;
  padding-top: 0;
  padding-bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tyc-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid #f0f2f5;
  min-height: 0;
}

.tyc-filter-row--last {
  border-bottom: none;
}

.tyc-filter-label {
  flex: 0 0 auto;
  padding-top: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
}

.tyc-filter-options,
.tyc-filter-control {
  flex: 1 1 auto;
  min-width: 0;
}

.tyc-filter-control--grow {
  max-width: 560px;
}

.tyc-filter .filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.tyc-filter .chip {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 0 10px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.tyc-filter .chip:hover {
  color: var(--text);
  background: #f8fafc;
  border-color: var(--border);
}

.tyc-filter .chip.active {
  color: var(--text);
  background: #f1f5f9;
  border-color: #cbd5e1;
  font-weight: 500;
}

.tyc-filter-input,
.tyc-filter-select,
.tyc-filter .date-range input[type="date"],
.tyc-time-range input[type="date"] {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.tyc-filter-input::placeholder {
  color: #64748b;
  opacity: 1;
}

.tyc-filter-input {
  width: 100%;
  max-width: 560px;
}

.tyc-filter-select {
  min-width: 180px;
  max-width: 320px;
}

.tyc-filter-input:focus,
.tyc-filter-select:focus,
.tyc-filter .date-range input[type="date"]:focus {
  outline: none;
  border-color: var(--tyc-accent);
  box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.12);
}

.tyc-filter .date-range,
.tyc-time-range {
  align-items: center;
  gap: 8px;
}

.tyc-filter .date-range input[type="date"],
.tyc-time-range input[type="date"] {
  width: 148px;
}

.tyc-btn-search {
  min-width: 72px;
  padding: 7px 14px !important;
  font-size: 13px;
  background: var(--gradient-primary) !important;
  border-radius: 6px;
  border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tyc-btn-search:hover:not(:disabled) {
  background: var(--gradient-primary-hover) !important;
}

.msg-panel .table-wrap--data {
  border-radius: 0 0 12px 12px;
  border: none;
  box-shadow: none;
}

/* ── 统一主页增强样式 ── */
.page-card--enhanced,
.page-card--messages {
  gap: 0;
}

.page-hero,
.msg-page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 20px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, rgba(238, 242, 255, 0.9) 100%);
  border: 1px solid rgba(99, 102, 241, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.page-hero-main,
.msg-page-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 320px;
}

.page-icon,
.msg-page-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.28);
}

.page-icon svg,
.msg-page-icon svg {
  width: 24px;
  height: 24px;
}

.page-icon--dash {
  background: var(--gradient-primary);
}

.page-icon--ws,
.msg-page-icon--ws {
  background: var(--gradient-primary);
}

.page-icon--ws-events {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}

.page-icon--config {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
}

.page-icon--users {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.page-icon--logs {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.page-icon--rb,
.msg-page-icon--rb {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.page-title,
.msg-page-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.page-desc,
.msg-page-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.page-stat-bar,
.msg-stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.page-stat-bar--inline {
  margin-right: 4px;
}

.page-stat,
.msg-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 72px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.page-stat--wide {
  min-width: 160px;
}

.page-stat--muted strong,
.msg-stat--muted strong {
  color: var(--muted);
  font-weight: 600;
}

.page-stat-label,
.msg-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.page-stat strong,
.msg-stat strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.page-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.page-hint {
  margin: 0 0 14px;
}

.page-filter,
.page-card--enhanced .msg-filter {
  margin-bottom: 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.page-table-card,
.msg-table-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.page-table-head,
.msg-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
  border-bottom: 1px solid #eef1f6;
  flex-shrink: 0;
}

.page-table-head-title,
.msg-table-head-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-table-head-title::before,
.msg-table-head-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--gradient-primary);
}

.page-table-head-meta,
.msg-table-head-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.page-table-wrap,
.msg-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0 !important;
}

.page-pager,
.msg-pager {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
}

.table-scroll-status {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.page-panel-card {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.page-panel-card--error .error-box {
  margin: 0;
}

.page-panel-card-head {
  margin-bottom: 10px;
}

.page-panel-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.page-panel-card-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--gradient-danger);
}

.dashboard-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.dashboard-control-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.dashboard-device-meta {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.dashboard-device-meta .page-stat {
  min-width: 0;
}

.dashboard-device-meta-item--corp strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .dashboard-device-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-device-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.page-card--enhanced .dashboard-kv {
  margin-bottom: 16px;
}

.page-card--enhanced .dashboard-table-wrap {
  margin-bottom: 0;
  border: none;
  box-shadow: none;
}

.page-content-body {
  margin-top: 4px;
}

.page-card--enhanced .config-desc.page-hint {
  margin-top: 8px;
}

.config-block--hardware .config-fields--stack {
  max-width: 100%;
}

.logs-table tbody tr.log-row--error {
  background: rgba(254, 242, 242, 0.45);
}

.logs-table tbody tr.log-row--error:hover {
  background: rgba(254, 226, 226, 0.55) !important;
}

.logs-table .cell-log-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.page-card--enhanced .msg-panel .pager,
.page-card--enhanced .pager {
  margin-top: 10px;
  padding-top: 0;
}

.msg-sub-tabs-bar {
  margin-bottom: 12px;
}

.msg-sub-tabs {
  width: fit-content;
}

.msg-sub-tabs .sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sub-tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.msg-table {
  min-width: 1280px;
}

.msg-table-wrap--horizontal {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  overscroll-behavior: contain;
}

.msg-table-wrap--fit {
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: 100%;
}

.msg-table--ws {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.msg-table--ws thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f1f5f9;
  box-shadow: 0 1px 0 #e2e8f0;
}

.msg-table--ws tbody td {
  background: #fff;
}

.msg-table--ws tbody tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.96);
}

.msg-table--ws tbody tr:hover td {
  background: #f0f4ff !important;
}

.msg-table--ws .col-seq,
.msg-table--ws .cell-msg-seq {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-type,
.msg-table--ws .cell-type {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-external,
.msg-table--ws .cell-external {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-nickname,
.msg-table--ws .cell-nickname {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-platform,
.msg-table--ws .cell-platform {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-forward,
.msg-table--ws .cell-forward {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-note,
.msg-table--ws .cell-note {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--ws .col-time,
.msg-table--ws .cell-msg-time {
  width: 152px;
  min-width: 152px;
  max-width: 152px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.msg-table--ws .col-content,
.msg-table--ws .cell-content {
  width: auto;
  min-width: 0;
  text-align: left;
  vertical-align: middle;
}

.msg-table--ws .cell-external,
.msg-table--ws .cell-platform,
.msg-table--ws .cell-nickname,
.msg-table--ws .cell-note.cell-message--ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-table--ws .cell-type .msg-type-tag,
.msg-table--ws .cell-forward .msg-status {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.3;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.msg-table--ws .cell-content.cell-message--ellipsis {
  max-width: none;
}

.msg-table--realbot {
  table-layout: auto;
  width: max(100%, max-content);
  min-width: 1116px;
  border-collapse: separate;
  border-spacing: 0;
}

.msg-table--realbot col.col-id {
  width: 72px;
}

.msg-table--realbot col.col-direction {
  width: 96px;
}

.msg-table--realbot col.col-compact {
  width: 56px;
}

.msg-table--realbot col.col-type {
  width: 84px;
}

.msg-table--realbot col.col-user {
  width: 168px;
}

.msg-table--realbot col.col-status {
  width: 76px;
}

.msg-table--realbot col.col-time {
  width: 152px;
}

.msg-table--realbot col.col-body {
  width: auto;
}

.msg-table--realbot thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f1f5f9;
  box-shadow: 0 1px 0 #e2e8f0;
}

.msg-table--realbot tbody td {
  background: #fff;
}

.msg-table--realbot tbody tr:nth-child(even) td {
  background: rgba(248, 250, 252, 0.96);
}

.msg-table--realbot tbody tr:hover td {
  background: #f0f4ff !important;
}

.msg-table--realbot .col-id,
.msg-table--realbot .cell-msg-id {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-direction,
.msg-table--realbot .cell-direction {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  box-sizing: border-box;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-compact,
.msg-table--realbot .cell-compact {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  box-sizing: border-box;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-type,
.msg-table--realbot .cell-type {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-status,
.msg-table--realbot .cell-status {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  box-sizing: border-box;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-user,
.msg-table--realbot .cell-user {
  width: 168px;
  min-width: 168px;
  max-width: 168px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-time,
.msg-table--realbot .cell-msg-time {
  width: 152px;
  min-width: 152px;
  max-width: 152px;
  box-sizing: border-box;
  text-align: center;
  vertical-align: middle;
}

.msg-table--realbot .col-body,
.msg-table--realbot .cell-body {
  width: auto;
  min-width: 472px;
  max-width: none;
  text-align: left;
  white-space: pre;
  word-break: normal;
  overflow: visible;
  text-overflow: clip;
  vertical-align: top;
}
.msg-table--realbot .cell-direction .msg-status,
.msg-table--realbot .cell-compact .msg-status,
.msg-table--realbot .cell-status .msg-status,
.msg-table--realbot .cell-compact .msg-type-tag,
.msg-table--realbot .cell-type .msg-type-tag {
  display: inline-block;
  max-width: 100%;
  padding: 2px 4px;
  font-size: 10px;
  line-height: 1.3;
  border-radius: 4px;
  vertical-align: middle;
}

.msg-table--realbot .cell-direction .msg-status {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.msg-table--realbot .cell-compact .msg-status,
.msg-table--realbot .cell-status .msg-status,
.msg-table--realbot .cell-compact .msg-type-tag,
.msg-table--realbot .cell-type .msg-type-tag {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-table--realbot .cell-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-table tbody tr.msg-row {
  transition: background 0.12s ease;
}

.msg-table tbody tr.msg-row--failed {
  background: rgba(254, 242, 242, 0.45);
}

.msg-table tbody tr.msg-row--failed:hover {
  background: rgba(254, 226, 226, 0.55) !important;
}

.msg-table tbody tr.msg-row--pending {
  background: rgba(255, 251, 235, 0.35);
}

.msg-table .cell-msg-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.msg-table .cell-msg-seq {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.msg-table .cell-msg-time {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.msg-type-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.msg-type-tag.msg-type--text {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.msg-type-tag.msg-type--image {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.msg-type-tag.msg-type--file {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.msg-type-tag.msg-type--voice {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}

.msg-type-tag.msg-type--emotion {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.msg-user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.msg-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.msg-user-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ack-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.ack-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ack-pill--yes {
  background: var(--success-soft);
  color: var(--success);
}

.ack-pill--yes::before {
  background: var(--success);
}

.ack-pill--no {
  background: #f1f5f9;
  color: var(--muted);
}

.ack-pill--no::before {
  background: #94a3b8;
}

.msg-empty {
  text-align: center;
  padding: 48px 24px !important;
  color: var(--muted);
}

.msg-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.msg-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #6366f1;
}

.msg-empty-icon svg {
  width: 26px;
  height: 26px;
}

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

.msg-empty-desc {
  font-size: 13px;
  color: var(--muted);
}

.msg-status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.msg-status.forwarded,
.msg-status.sent,
.msg-status.dispatched,
.msg-status.processed {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: var(--success);
}

.msg-status.pending {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: var(--warning);
}

.msg-status.skipped {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: var(--muted);
}

.msg-status.failed {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: var(--danger);
}

.msg-status.inbound {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--primary);
}

.msg-status.outbound {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  color: #7c3aed;
}

.cell-message {
  min-width: 220px;
  max-width: 480px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-size: 12px;
  font-family: Consolas, "Courier New", monospace;
}

.cell-message--ellipsis {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  user-select: text;
  cursor: default;
}

.message-preview-popover {
  position: fixed;
  z-index: 200;
  max-height: min(320px, 60vh);
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: auto;
  user-select: text;
}

.cell-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #475569;
}

.ack-yes {
  color: var(--success);
  font-weight: 700;
}

.ack-no {
  color: var(--muted);
}

.user-row-select {
  min-width: 96px;
  padding: 6px 8px;
  font-size: 13px;
}

.user-row-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Users panel ── */
.users-card .toolbar-title {
  margin-bottom: 0;
}

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

.users-summary {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 999px;
  white-space: nowrap;
}

.users-filter-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.users-filter-grid {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) minmax(240px, 1.2fr);
  gap: 10px 12px;
  align-items: end;
}

.filter-bar--compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.filter-bar--compact .filter-item {
  flex: none;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f5;
  box-sizing: border-box;
}

.filter-bar--compact .filter-item svg {
  display: none;
}

.filter-bar--compact .filter-item span {
  flex: 0 0 72px;
  font-weight: 600;
  color: var(--text);
}

.filter-bar--compact .filter-item select,
.filter-bar--compact .filter-item input {
  flex: 1 1 auto;
  max-width: 360px;
}

.filter-bar--compact .filter-actions {
  flex: none;
  padding: 10px 14px;
  margin-left: 0;
  justify-content: flex-end;
  width: 100%;
  border-top: 1px solid #eef1f6;
  background: #fafbfc;
  box-sizing: border-box;
}

.filter-bar--compact .filter-actions .btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.filter-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-height: 32px;
}

.filter-group--inline .filter-label {
  flex-shrink: 0;
  margin: 0;
}

.users-filter-toolbar--compact {
  padding: 0;
}

.users-filter-toolbar--compact .users-filter-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.users-filter-toolbar--compact .filter-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f5;
  min-height: 32px;
}

.users-filter-toolbar--compact .filter-group--inline .filter-label {
  flex: 0 0 72px;
}

.users-filter-toolbar--compact .users-filter-search {
  flex: 1 1 auto;
  max-width: none;
}

.users-filter-toolbar--compact .users-filter-actions {
  border-top: 1px solid #eef1f6;
  background: #fafbfc;
  padding: 10px 14px;
  margin-left: 0;
  justify-content: flex-end;
  width: 100%;
  box-sizing: border-box;
}

.users-filter-toolbar--compact .users-filter-search input[type="search"] {
  height: 32px;
  box-sizing: border-box;
  width: 100%;
}

.users-filter-actions {
  margin-left: 0;
  justify-content: flex-end;
  padding-top: 2px;
  border-top: 1px dashed var(--border);
}

.users-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.users-table {
  min-width: 1180px;
  table-layout: fixed;
}

.users-table .col-user-id {
  width: 16%;
}

.users-table .col-user-nickname {
  width: 10%;
}

.users-table .col-user-platform {
  width: 14%;
}

.users-table .col-user-phone {
  width: 10%;
}

.users-table .col-user-created,
.users-table .col-user-updated {
  width: 12%;
}

.users-table .col-user-status,
.users-table .col-user-forward {
  width: 13%;
}

.users-table td {
  vertical-align: middle;
}

.users-table .cell-user-nickname {
  font-weight: 600;
  color: var(--text);
}

.users-table .cell-user-phone {
  font-variant-numeric: tabular-nums;
  color: #475569;
}

.users-table tbody tr.user-row--deleted {
  background: #fafafa;
}

.users-table tbody tr.user-row--deleted .cell-user-nickname {
  color: var(--muted);
  text-decoration: line-through;
}

.users-table tbody tr.user-row--updating {
  opacity: 0.55;
  pointer-events: none;
}

.user-actions-cell {
  white-space: nowrap;
  overflow: visible;
}

.user-toggle-wrap {
  display: inline-block;
}

.user-toggle.is-pending,
.btn.is-pending {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.tyc-filter-row-actions .btn-danger {
  min-height: 32px;
}

.user-toggle-confirm {
  position: fixed;
  z-index: 1000;
  width: 188px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  box-sizing: border-box;
}

.user-toggle-confirm-text {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.user-toggle-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.user-toggle-confirm-actions .btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.user-toggle-group {
  display: inline-flex;
  padding: 3px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 2px;
}

.user-toggle {
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.user-toggle:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.user-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-toggle.is-on.user-toggle--active {
  background: #dcfce7;
  color: #15803d;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.user-toggle.is-on.user-toggle--deleted {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.user-toggle.is-on.user-toggle--yes {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.user-toggle.is-on.user-toggle--no {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.users-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.users-pager-info {
  color: var(--muted);
  font-size: 14px;
  min-width: 180px;
  text-align: center;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: toast-in 0.3s ease;
}

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

/* 滚动条 */
.table-wrap::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.panel.active::-webkit-scrollbar,
.config-version-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.panel.active::-webkit-scrollbar-thumb,
.config-version-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.panel.active::-webkit-scrollbar-thumb:hover,
.config-version-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex: none;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 14px;
    overflow: visible;
  }

  .nav-section {
    display: contents;
  }

  .nav-section-label,
  .sidebar-footer {
    display: none;
  }

  .nav-section + .nav-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .nav-item {
    width: auto;
    margin: 0;
  }

  .nav-group {
    width: 100%;
    margin-top: 4px;
    padding-top: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .nav-group-label {
    width: 100%;
    padding: 4px 8px;
  }

  .page-content {
    padding: 16px;
  }

  .cards,
  .form-grid,
  .dashboard-kv {
    grid-template-columns: 1fr;
  }

  .config-top .actions {
    width: 100%;
  }

  .filter-toolbar-actions {
    margin-left: 0;
    width: 100%;
  }

  .filter-group--search {
    max-width: none;
    flex-basis: 100%;
  }

  .users-filter-grid {
    grid-template-columns: 1fr;
  }

  .users-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .users-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .tyc-filter-row {
    flex-direction: column;
    gap: 8px;
  }

  .tyc-filter-label {
    flex: none;
    padding-top: 0;
  }

  .tyc-filter-input,
  .tyc-filter-control--grow {
    max-width: none;
  }

  .tyc-filter .date-range input[type="date"] {
    width: 100%;
    flex: 1 1 140px;
  }

  .page-hero,
  .msg-page-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .page-stat-bar,
  .msg-stat-bar {
    width: 100%;
  }

  .page-stat,
  .msg-stat {
    flex: 1 1 auto;
  }

  .page-hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-device-meta {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-device-meta-item {
    min-width: 0;
  }

  .dashboard-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

/* 侧栏后端地址输入框：仅作用于此，覆盖上方全局 input 样式 */
.sidebar-footer--api .sidebar-api-label {
  font-size: 11px;
  color: rgba(203, 213, 225, 0.82);
  letter-spacing: 0.04em;
}

.app-sidebar .sidebar-footer--api input.sidebar-api-input {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  caret-color: #c7d2fe;
  box-shadow: none;
}

.app-sidebar .sidebar-footer--api input.sidebar-api-input[readonly] {
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.02em;
}

.app-sidebar .sidebar-footer--api input.sidebar-api-input:hover,
.app-sidebar .sidebar-footer--api input.sidebar-api-input:focus,
.app-sidebar .sidebar-footer--api input.sidebar-api-input:focus-visible,
.app-sidebar .sidebar-footer--api input.sidebar-api-input:active {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22);
  outline: none;
}

.app-sidebar .sidebar-device-select {
  cursor: pointer;
}

.sidebar-device-summary {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(203, 213, 225, 0.72);
}

.rpa-device-grid {
  margin-top: 8px;
}

.rpa-device-card--clickable {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rpa-device-card--clickable:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.rpa-device-card--clickable:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.55);
  outline-offset: 2px;
}

.rpa-device-card .devices-enter-hint {
  color: #6366f1;
  font-weight: 600;
  font-size: 13px;
}

.config-hid-readonly {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(241, 245, 249, 0.9);
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-panel {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.modal-title {
  margin: 0 0 16px;
  font-size: 18px;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
