:root {
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-subtle: #eef1f5;
  --bg-glass: rgba(255, 255, 255, 0.86);
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-soft: rgba(249, 115, 22, 0.11);
  --accent-ring: rgba(249, 115, 22, 0.25);
  --accent-grad: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.12);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 44px -12px rgba(15, 23, 42, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-accent="indigo"] {
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-ring: rgba(99, 102, 241, 0.25);
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
}

[data-accent="emerald"] {
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-ring: rgba(16, 185, 129, 0.25);
  --accent-grad: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
}

[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-elevated: #131a27;
  --bg-subtle: #1b2436;
  --bg-glass: rgba(19, 26, 39, 0.86);
  --border: #232f45;
  --border-strong: #32415c;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #8b9bb4;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 28px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.72);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.tabular { font-variant-numeric: tabular-nums; }
.hk-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.menu-btn svg { width: 20px; height: 20px; }
.import-tile svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.badge svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Boot Loader */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.boot-logo {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}
.boot-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Auth Screen */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(600px circle at 15% 15%, var(--accent-soft), transparent 60%),
    radial-gradient(500px circle at 85% 85%, rgba(59, 130, 246, 0.08), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.28s ease;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}
.auth-brand img {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 14px;
}
.auth-brand h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.auth-brand p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.auth-tab {
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.16s ease;
}
.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-header {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.sidebar-brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.nav-badge.soft {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.user-mini-meta { min-width: 0; flex: 1; }
.user-mini-email {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-mini-plan {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.menu-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.topbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-area {
  padding: 24px 28px 40px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.22s ease;
}

/* Mobile bottom nav & overlay */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 35;
}
.drawer-backdrop.open { display: block; }
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 32;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
}
.mobile-nav-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.mobile-nav-item svg { width: 20px; height: 20px; }
.mobile-nav-item.active { color: var(--accent); }

/* Cards & Grid */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; color: var(--accent); }
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0 0;
}

.bento-2 {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Hero Welcome / Onboarding Banner */
.onboarding-banner {
  background:
    radial-gradient(460px circle at 95% 20%, rgba(249, 115, 22, 0.2), transparent 65%),
    var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.onboarding-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}
.onboarding-left img {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.onboarding-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 3px;
}
.onboarding-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Notice Bar */
.notice-bar {
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.notice-bar:hover { filter: brightness(0.98); }
.notice-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.notice-bar-text {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subscription Gauge & Metrics */
.sub-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.gauge-wrap {
  position: relative;
  width: 136px;
  height: 136px;
  flex-shrink: 0;
}
.gauge-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--bg-subtle); stroke-width: 11; }
.gauge-fill { fill: none; stroke: url(#hkGaugeGrad); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 0.65s ease; }
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.gauge-pct { font-size: 24px; font-weight: 800; line-height: 1.1; }
.gauge-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sub-details { flex: 1; min-width: 220px; }
.sub-plan-name {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sub-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.mini-stat {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.mini-stat-label { font-size: 11px; color: var(--text-muted); }
.mini-stat-val { font-size: 15px; font-weight: 700; margin-top: 2px; }

/* Import Matrix */
.import-primary-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.import-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
}
.import-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.import-tile-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.import-tile-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Node Cards & Connectivity */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.kpi-value { font-size: 20px; font-weight: 800; margin-top: 3px; line-height: 1.2; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.node-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: var(--bg);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.node-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.node-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--success);
  animation: pulseDot 2.2s infinite;
}
.status-dot.offline { background: #94a3b8; }
.node-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.privacy-note {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.privacy-note svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--success); }

/* Traffic Chart */
.chart-box {
  width: 100%;
  overflow-x: auto;
}
.chart-svg {
  width: 100%;
  min-width: 440px;
  height: 176px;
  display: block;
}

/* Tutorials Page */
.stepper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.step-overview-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  position: relative;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.platform-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.platform-tab {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.platform-tab:hover { border-color: var(--accent); color: var(--text); }
.platform-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -4px var(--accent-ring);
}
.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.tutorial-step {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tutorial-step-idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.code-snippet {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 9px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
}
.alert-box {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.alert-box svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}
.alert-box.warn {
  background: var(--warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: var(--text);
}
.alert-box.warn svg { color: var(--warning); }
.alert-box.info {
  background: var(--info-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
}
.alert-box.info svg { color: var(--info); }

/* FAQ Accordion */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.faq-q {
  width: 100%;
  border: none;
  background: transparent;
  padding: 13px 15px;
  text-align: left;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.faq-a {
  padding: 0 15px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
  display: none;
}
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-chevron { width: 18px; height: 18px; transition: transform 0.2s ease; flex-shrink: 0; color: var(--text-muted); }

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 12px -2px var(--accent-ring);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-soft:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-muted { background: var(--bg-subtle); color: var(--text-muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.textarea { min-height: 92px; resize: vertical; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }

/* Plan Cards */
.plan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}
.plan-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.plan-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}
.plan-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}
.plan-content ul, .plan-content ol { padding-left: 18px; margin: 6px 0; }
.period-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.period-pill {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.period-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Ticket Chat */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.chat-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.me {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.chat-msg.other {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.chat-meta { font-size: 10.5px; opacity: 0.72; margin-top: 4px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  animation: fadeIn 0.16s ease;
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 680px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.modal-title { margin: 0; font-size: 16px; font-weight: 800; }
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0 auto 14px;
  width: fit-content;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: 0.2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider { background: var(--accent); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* Empty state & Toast */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state h4 { margin: 10px 0 4px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 0 14px; font-size: 13px; }

.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  animation: fadeIn 0.2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

.rich-body {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  word-break: break-word;
}
.rich-body img { max-width: 100%; border-radius: 10px; }
.rich-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
}

@media (max-width: 1024px) {
  .bento-2 { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; padding-bottom: 68px; }
  .menu-btn { display: inline-flex; }
  .mobile-nav { display: grid; }
  .topbar { padding: 0 14px; }
  .content-area { padding: 16px 14px 30px; }
  .grid-2, .grid-3, .grid-4, .import-grid { grid-template-columns: 1fr; }
}
