/* ══════════════════════════════════════════════════════════════════
   TG Scheduler — KISS Design System v2
   Premium Dark Theme · Glassmorphism · Responsive
   ══════════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:          #08080d;
  --bg2:         #0f0f17;
  --bg3:         #161622;
  --bg-elevated: #1c1c2b;
  --bg-glass:    rgba(15, 15, 23, 0.75);
  --bg-hover:    rgba(255, 255, 255, 0.03);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Text */
  --text:   #e4e4ef;
  --text2:  #9ca3af;
  --text3:  #43434f;

  /* Accent — Indigo */
  --accent:      #6366f1;
  --accent-dim:  rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-text: #a5b4fc;

  /* Semantic */
  --green:       #22c55e;
  --green-dim:   rgba(34, 197, 94, 0.12);
  --red:         #ef4444;
  --red-dim:     rgba(239, 68, 68, 0.12);
  --orange:      #f59e0b;
  --orange-dim:  rgba(245, 158, 11, 0.12);
  --purple:      #a855f7;
  --purple-dim:  rgba(168, 85, 247, 0.12);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Sidebar */
  --sidebar-width: 240px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
  --duration-slow: 0.35s;

  /* Fallback / Compatibility Variables */
  --text-secondary: var(--text2);
  --text-muted:     var(--text2);
  --surface:        var(--bg2);
  --bg-secondary:   var(--bg3);
  --success:        var(--green);
  --danger:         var(--red);
  --danger-bg:      var(--red-dim);
  --bg1:            var(--bg);
  --text1:          var(--text);
}

/* ── Base ────────────────────────────────────────────────────────── */
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-text);
}

/* ══ LAYOUT ═══════════════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform var(--duration-slow) var(--ease);
}

.sidebar-logo {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-2) 0;
  overflow-y: auto;
}

/* Section labels inside nav */
.nav-section {
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text2);
  user-select: none;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-2) var(--sp-5);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-5);
  color: var(--text2);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-left-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  margin: 1px 0;
  position: relative;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:focus {
  outline: none;
  background: var(--bg-hover);
  border-left-color: var(--border-focus);
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-left-color: rgba(255,255,255,0.08);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

/* ── Inbox badge ─────────────────────────────────────────────────── */
.inbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.sidebar-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
}

.user-info {
  font-size: 12px;
  color: var(--text2);
}
.user-info strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

/* ── Mobile hamburger ────────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-3);
}

.hamburger {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.hamburger:hover {
  background: var(--bg3);
  border-color: var(--border-hover);
}

.mobile-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 45;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease);
}
.sidebar-overlay.open {
  opacity: 1;
}

/* ── Main Content ────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--sp-8) var(--sp-8);
  min-height: 100vh;
  max-width: 1200px;
}

/* ── Page Titles ─────────────────────────────────────────────────── */
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--sp-5);
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-header {
  margin-bottom: var(--sp-6);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-top: var(--sp-1);
}

/* ── Tab bar (inbox filter) ─────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.tab-btn {
  padding: 6px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.tab-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border-hover); }
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ══ CARDS ════════════════════════════════════════════════════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.card:hover {
  border-color: var(--border-hover);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              opacity var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover::before {
  opacity: 1;
}

/* Dashboard KPI cards */
.kpi-card { cursor: pointer; }
.kpi-card:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.kpi-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dashboard 3-column layout */
.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 1400px) {
  .dash-cols { grid-template-columns: 1.4fr 1fr; }
  #dash-tasks-card { grid-column: 1 / -1; }
}
@media (max-width: 1024px) {
  .dash-cols { grid-template-columns: 1fr; }
  #dash-tasks-card { grid-column: auto; }
}

.stat-label {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: var(--sp-1);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.accent { color: var(--accent); }
.stat-value.orange { color: var(--orange); }

/* ══ TABLES ══════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: var(--bg-hover);
}

/* Fallback styling for classes .data-table and .table used in DOM templates */
.data-table, .table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.data-table td, .table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tr:hover td, .table tr:hover td {
  background: var(--bg-hover);
}
.data-table tr:last-child td, .table tr:last-child td {
  border-bottom: none;
}


/* ══ BUTTONS ═════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  /* chỉ animate các property thực sự đổi khi hover/active — tránh quét toàn bộ
     property như `transition: all` (gây lag khi hover, đặc biệt trên nhiều nút) */
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
  background: #7c7ff7;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid transparent;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-green {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid transparent;
}
.btn-green:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-group {
  display: flex;
  gap: 6px;
}

/* ══ TOGGLE ══════════════════════════════════════════════════════ */
.toggle {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text2, #9ca3af);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

.toggle input:checked + .toggle-slider::after {
  left: 22px;
  background: #ffffff;
}

/* ══ BADGES ══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--accent-dim); color: var(--accent); }

.seg-control { display:flex; gap:4px; padding:4px; background:var(--bg-secondary); border-radius:9px; width:max-content; }
.seg-btn { border:1px solid transparent; border-radius:7px; padding:8px 14px; background:transparent; color:var(--text2); cursor:pointer; font-size:13px; transition:background .15s,color .15s; }
.seg-btn:hover, .seg-btn.active { background:var(--accent-dim); border-color:var(--accent); color:var(--accent-text); }
.badge-gray   { background: rgba(107,107,128,0.12); color: var(--text2); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }

/* ══ FORMS ═══════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
  color: var(--text2);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b80' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.form-hint {
  font-size: 11px;
  color: var(--text2);
  margin-top: var(--sp-1);
  line-height: 1.5;
}

/* ══ MODALS ══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98);
  transition: transform var(--duration-slow) var(--ease);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 16px;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg3);
  border-color: var(--border-hover);
}

.modal-body {
  padding: var(--sp-5);
}

.modal-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  position: sticky;
  bottom: 0;
  background: var(--bg2);
}

/* ══ LOGIN PAGE ══════════════════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-5);
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.06) 0%, transparent 70%);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-icon {
  text-align: center;
  font-size: 48px;
  margin-bottom: var(--sp-4);
  filter: drop-shadow(0 4px 16px var(--accent-glow));
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--sp-1);
  letter-spacing: -0.5px;
}

.login-subtitle {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  margin-bottom: var(--sp-6);
}

/* ══ TOASTS ══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastSlideIn var(--duration-slow) var(--ease);
  max-width: 380px;
  backdrop-filter: blur(8px);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--orange); }

@keyframes toastSlideIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ══ CHAT PICKER ═════════════════════════════════════════════════ */
.chat-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  border-bottom: 1px solid var(--border);
}

.chat-item:last-child { border-bottom: none; }
.chat-item:hover { background: var(--bg3); }
.chat-item.selected { background: var(--accent-dim); }

.chat-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.chat-type-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.chat-name {
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-type-badge {
  font-size: 10px;
  color: var(--text2);
  background: var(--bg3);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ══ MESSAGE BUILDER ═════════════════════════════════════════════ */
.msg-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  position: relative;
  transition: border-color var(--duration) var(--ease);
}

.msg-item:hover {
  border-color: var(--border-hover);
}

.msg-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.msg-item-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.msg-remove {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  transition: color var(--duration) var(--ease);
}
.msg-remove:hover { color: var(--red); }

/* ══ EMPTY STATE ═════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-5);
  color: var(--text2);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--sp-3);
  opacity: 0.4;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: var(--sp-4);
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ══ PAGINATION ══════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ══ TOOLBAR ═════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ══ SCROLLBAR ═══════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.28);
}

/* ══ LOADING ═════════════════════════════════════════════════════ */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
  color: var(--text2);
  gap: var(--sp-3);
}

/* ══ DAYS PICKER ═════════════════════════════════════════════════ */
.days-picker {
  display: flex;
  gap: 6px;
}

.day-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent-glow);
}

.day-btn:hover:not(.active) {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ══ SEARCH ══════════════════════════════════════════════════════ */
.search-input {
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 220px;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-input::placeholder {
  color: var(--text2);
}

/* ══ POLL OPTIONS ════════════════════════════════════════════════ */
.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poll-option-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.poll-option-row .form-input {
  flex: 1;
}

.poll-option-remove {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color var(--duration) var(--ease);
}
.poll-option-remove:hover { color: var(--red); }

/* ══ ACCOUNT CARDS ═══════════════════════════════════════════════ */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.account-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.account-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.account-card-body {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: var(--sp-3);
  line-height: 1.8;
}

.account-card-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ══ VIEW TRANSITIONS ════════════════════════════════════════════ */
[id^="view-"] {
  animation: viewFadeIn var(--duration-slow) var(--ease);
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══ UTILITY ═════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text2); }

/* ══ RESPONSIVE ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 68px var(--sp-4) var(--sp-4);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .accounts-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-top: auto;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 60px var(--sp-3) var(--sp-3);
  }

  .stat-value {
    font-size: 22px;
  }
}

/* ══ EXTRA — Discord card subclasses ═════════════════════════════ */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.card-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.8;
}

.badge-success   { background: var(--green-dim);  color: var(--green); }
.badge-secondary { background: rgba(107,107,128,0.12); color: var(--text2); }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 600;
}
.status-badge.success { background: var(--green-dim); color: var(--green); }
.status-badge.failed  { background: var(--red-dim);   color: var(--red); }

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--sp-3);
  opacity: 0.4;
  text-align: center;
}

/* ══ CONFIRM MODAL ═══════════════════════════════════════════════ */
#confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease);
}

#confirm-modal.open {
  opacity: 1;
  pointer-events: all;
}

#confirm-modal > div {
  background: var(--bg2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

#confirm-msg {
  font-size: 14px;
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

/* ══ AI KEY INPUT ════════════════════════════════════════════════ */
.ai-key-input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}
.ai-key-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ══ FILE INPUT ══════════════════════════════════════════════════ */
.msg-file {
  width: 100%;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text2);
}

.msg-media-path {
  display: none;
}

/* ══════════════════════════════════════════════════════════════════
   CHANGELOG PAGE
   ══════════════════════════════════════════════════════════════════ */

.cl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.cl-subtitle {
  color: var(--text2);
  font-size: 14px;
  margin-top: 6px;
}

.cl-current-version {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.cl-cv-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  font-weight: 600;
}

.cl-cv-number {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ── Timeline ──────────────────────────────────────────────────── */
.cl-timeline {
  position: relative;
  padding-left: 28px;
}

.cl-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--border) 40%, transparent 100%);
  border-radius: 2px;
}

.cl-entry {
  position: relative;
  margin-bottom: 24px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cl-entry:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.cl-entry::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 24px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--text3);
  z-index: 1;
}

.cl-entry-latest {
  border-color: rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.04));
}

.cl-entry-latest::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow), 0 0 16px rgba(99, 102, 241, 0.15);
}

.cl-entry-latest:hover {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 4px 32px rgba(99, 102, 241, 0.12);
}

.cl-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cl-version-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cl-version {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Inter', monospace;
}

.cl-tag-latest {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  padding: 3px 10px;
  border-radius: 20px;
  animation: cl-pulse 2s ease-in-out infinite;
}

@keyframes cl-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 12px rgba(99, 102, 241, 0.6); }
}

.cl-date {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

/* ── Change Items ──────────────────────────────────────────────── */
.cl-changes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cl-change {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.cl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cl-badge-new {
  background: var(--accent-dim);
  color: var(--accent-text);
}

.cl-badge-fix {
  background: var(--red-dim);
  color: #fca5a5;
}

.cl-badge-improve {
  background: var(--orange-dim);
  color: #fcd34d;
}

.cl-badge-security {
  background: var(--green-dim);
  color: #86efac;
}

.cl-badge-breaking {
  background: var(--purple-dim);
  color: #d8b4fe;
}

.cl-change-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  padding-top: 1px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cl-header { flex-direction: column; }
  .cl-current-version { align-items: flex-start; }
  .cl-entry { padding: 16px; }
  .cl-entry-header { flex-direction: column; gap: 6px; align-items: flex-start; }
  .cl-change { flex-direction: column; gap: 6px; }
  .cl-timeline { padding-left: 22px; }
}

/* ══ AI Agents Cards ══════════════════════════════════════════════ */
.ai-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.ai-agent-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.2s ease,
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.ai-agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  opacity: 0;
  transition: opacity 0.3s;
}

.ai-agent-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.ai-agent-card:hover::before { opacity: 1; }

.ai-agent-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-agent-avatar {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border-radius: 12px;
  flex-shrink: 0;
}

.ai-agent-info {
  flex: 1;
  min-width: 0;
}

.ai-agent-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-agent-provider {
  font-size: 12px;
  color: var(--text2);
}

.ai-agent-status {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text2);
  white-space: nowrap;
}

.ai-agent-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.ai-agent-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-agent-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ai-agent-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-agent-actions .btn-sm {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
}

.ai-agent-actions .btn-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.ai-agent-actions .btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text2);
}

/* Accessibility Tooltips */
.hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 11px;
  font-weight: bold;
  cursor: help;
  margin-left: 6px;
  position: relative;
}

.hint-badge:focus {
  outline: 2px solid var(--accent);
  color: var(--text);
}

.hint-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: normal;
  white-space: normal;
  width: 200px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease);
  z-index: 10;
  text-transform: none;
}

.hint-badge:hover::after, .hint-badge:focus::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
/* ══════════════════════════════════════════════════════════════════
   v3 POLISH — accessibility + modern shell (additive, no JS changes)
   ══════════════════════════════════════════════════════════════════ */

/* ── Keyboard focus (WCAG 2.1 AA) ──────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.form-input:focus-visible, .form-select:focus-visible, .form-textarea:focus-visible,
.search-input:focus-visible, .ai-key-input:focus-visible {
  outline: none; /* already have box-shadow ring */
}

/* ── Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Sidebar: modern pill active state ─────────────────────────── */
.nav-item {
  border-left: none;
  border-radius: var(--radius-sm);
  margin: 2px var(--sp-3);
  padding: 9px var(--sp-3);
}
.nav-item:hover {
  border-left: none;
  background: var(--bg-hover);
}
.nav-item.active {
  border-left: none;
  background: var(--accent-dim);
  color: var(--accent-text);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 2px;
  background: var(--accent);
}
.nav-section {
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
}

/* ── Tables: softer header, better row scan ────────────────────── */
th {
  background: transparent;
  border-bottom: 1px solid var(--border-hover);
  color: var(--text3);
}
.data-table th, .table th {
  background: transparent;
  border-bottom: 1px solid var(--border-hover);
  color: var(--text3);
}
td { border-bottom-color: var(--border); }
tr:hover td { background: rgba(255,255,255,0.025); }

/* ── Buttons: focus ring + disabled state ──────────────────────── */
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn:disabled:active { transform: none; }

/* ── Cards: subtle lift consistency ────────────────────────────── */
.card {
  background: var(--bg2);
}

/* ── Better text selection ─────────────────────────────────────── */
::selection {
  background: var(--accent-dim);
  color: var(--text);
}

/* ── Stat value tabular numbers ────────────────────────────────── */
.stat-value {
  font-variant-numeric: tabular-nums;
}

/* ── Client-side table pagination ─────────────────────────────── */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 4px 2px;
  font-size: 12px;
  color: var(--text2);
}
.pager-info { color: var(--text2); font-variant-numeric: tabular-nums; }
.pager-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text2);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text1); }
.pager-btn:disabled { opacity: .4; cursor: default; }

/* ── Help / Guide Page ── */
.help-search { max-width: 280px; }
.help-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.help-toc {
  position: sticky;
  top: var(--sp-4);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.help-toc-item {
  display: block;
  color: var(--text2);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  word-break: break-word;
}
.help-toc-item:hover {
  background: var(--bg3);
  color: var(--text1);
}
.help-toc-item.level-1 { font-weight: 700; color: var(--text1); margin-top: 4px; }
.help-toc-item.level-2 { font-weight: 600; color: var(--text1); margin-top: 4px; }
.help-toc-item.level-3 { padding-left: 18px; font-size: 12px; }
.help-toc-item.level-4 { padding-left: 28px; font-size: 11.5px; }

.help-body {
  padding: 28px;
  line-height: 1.7;
  color: var(--text1);
  font-size: 14px;
}
.help-body h1, .help-body h2, .help-body h3, .help-body h4 {
  color: var(--text1);
  scroll-margin-top: 24px;
}
.help-body h1 { font-size: 22px; margin: 0 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.help-body h2 { font-size: 18px; margin: 28px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; color: var(--accent); }
.help-body h3 { font-size: 15px; margin: 20px 0 8px; }
.help-body h4 { font-size: 13.5px; margin: 16px 0 6px; }
.help-body p { margin: 0 0 12px; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 22px; }
.help-body li { margin-bottom: 4px; }
.help-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.help-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.help-body pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 0 0 14px;
}
.help-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .9em;
  background: var(--bg3);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}
.help-body pre code { background: transparent; padding: 0; border: none; font-size: 12.5px; }
.help-table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.help-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help-body th, .help-body td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.help-body th { background: var(--bg3); font-weight: 600; }
.help-body tr:last-child td { border-bottom: none; }
.help-status, .help-error { color: var(--text2); font-style: italic; }
.help-error { color: var(--red); }

@media (max-width: 768px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { max-height: 220px; position: static; }
  .help-search { max-width: 100%; width: 100%; }
}

