/* ============================================================
   Voicecord — themed with "Lily" romantic dark/light skin
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root,
[data-theme="light"] {
  --bg: #FBF6F0;
  --bg-soft: #F4ECE2;
  --surface: #FFFFFF;
  --surface-2: #FDF9F5;
  --ink: #2A1633;
  --ink-soft: #5E4A70;
  --muted: #93819F;
  --brand: #D4006E;
  --brand-soft: #FF6FA5;
  --gold: #DF9E00;
  --line: rgba(42, 22, 51, 0.10);
  --line-strong: rgba(42, 22, 51, 0.18);
  --grad: linear-gradient(120deg, #D4006E 0%, #FF3D8F 55%, #FF6FA5 100%);
  --glow: rgba(212, 0, 110, 0.14);
  --shadow-card: 0 20px 45px -18px rgba(80, 20, 70, 0.28);
  --header-bg: rgba(251, 246, 240, 0.82);
  --star: rgba(212, 0, 110, 0.35);

  --green: #2E9E6B;
  --green-dim: rgba(46, 158, 107, 0.14);
  --red: #E5484D;
  --red-dim: rgba(229, 72, 77, 0.13);
  --yellow: #DF9E00;
  --yellow-dim: rgba(223, 158, 0, 0.16);

  /* Compatibility aliases (used by app.js inline styles) */
  --bg-primary: var(--bg);
  --bg-secondary: var(--surface-2);
  --bg-tertiary: var(--surface);
  --bg-card: var(--surface);
  --bg-elevated: var(--surface-2);
  --bg-input: var(--bg);
  --text-normal: var(--ink-soft);
  --text-muted: var(--muted);
  --text-header: var(--ink);
  --blurple: var(--brand);
  --blurple-hover: var(--brand-soft);
  --blurple-light: var(--brand-soft);
  --blurple-glow: var(--glow);
  --blurple-dim: var(--glow);
  --nitro-blue: var(--brand-soft);
  --nitro-dim: var(--glow);

  --divider: var(--line);
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow: 0 18px 42px -16px rgba(80, 20, 70, 0.4);
  --shadow-lg: 0 26px 70px -20px rgba(40, 10, 40, 0.55);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #100A1A;
  --bg-soft: #181025;
  --surface: #1D1430;
  --surface-2: #231939;
  --ink: #F7F2EA;
  --ink-soft: #D3C6E2;
  --muted: #9C8CAD;
  --brand: #FF4DA6;
  --brand-soft: #FF8FC0;
  --gold: #FFD056;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --grad: linear-gradient(120deg, #FF4DA6 0%, #FF6FA5 55%, #FFB0CE 100%);
  --glow: rgba(255, 77, 166, 0.22);
  --shadow-card: 0 22px 50px -18px rgba(0, 0, 0, 0.6);
  --header-bg: rgba(16, 10, 26, 0.78);
  --star: rgba(255, 143, 192, 0.55);

  --green: #3BDF8E;
  --green-dim: rgba(59, 223, 142, 0.14);
  --red: #FF5C60;
  --red-dim: rgba(255, 92, 96, 0.14);
  --yellow: #FFCE54;
  --yellow-dim: rgba(255, 206, 84, 0.15);

  --bg-primary: var(--bg);
  --bg-secondary: var(--surface-2);
  --bg-tertiary: var(--surface);
  --bg-card: var(--surface);
  --bg-elevated: var(--surface-2);
  --bg-input: var(--bg);
  --text-normal: var(--ink-soft);
  --text-muted: var(--muted);
  --text-header: var(--ink);
  --blurple: var(--brand);
  --blurple-hover: var(--brand-soft);
  --blurple-light: var(--brand-soft);
  --blurple-glow: var(--glow);
  --blurple-dim: var(--glow);
  --nitro-blue: var(--brand-soft);
  --nitro-dim: var(--glow);

  --divider: var(--line);
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 28px 80px -20px rgba(0, 0, 0, 0.8);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  background: var(--bg);
  transition: background 0.35s ease;
}

body {
  height: 100%;
  font-family: 'Alexandria', 'Segoe UI', Tahoma, sans-serif;
  background: transparent;
  color: var(--ink-soft);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: color 0.35s ease;
}

::selection {
  background: var(--brand);
  color: #fff;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--brand-soft);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Gradient text */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================================
   AMBIENT BACKDROP (fixed, ultra-light)
   ============================================================ */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 85% -5%, var(--glow), transparent 65%),
    radial-gradient(700px 480px at 0% 45%, var(--glow), transparent 70%),
    var(--bg);
  transition: background 0.35s ease;
}

.sky-star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--star);
  animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.15;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.3);
  }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 264px;
  min-width: 264px;
  background:
    radial-gradient(340px 220px at 10% -10%, var(--glow), transparent 70%),
    var(--header-bg);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 8px 0 34px -18px rgba(40, 10, 40, 0.45);
  transition: background 0.35s ease;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo .logo-icon {
  width: 44px;
  height: 44px;
  background: var(--grad);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  box-shadow: 0 10px 24px -8px var(--glow);
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.sidebar-logo .logo-text em,
.sidebar-logo .logo-text .grad-text {
  font-style: normal;
}

.sidebar-logo .logo-version {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}

.nav-section-label {
  padding: 18px 18px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.nav-item {
  position: relative;
  margin: 3px 10px;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.nav-item .nav-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--glow);
  color: var(--brand);
  transform: translateX(3px);
}

.nav-item.active {
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 26px -10px var(--glow);
}

.nav-item.danger {
  color: var(--red);
}

.nav-item.danger:hover {
  background: var(--red-dim);
  color: var(--red);
}

/* --------------------------------------------
   ORBITING LIGHT TAIL AROUND NAV ITEMS
   (stays on while the section is active)
   -------------------------------------------- */
.nav-item::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 19px;
  padding: 5px;
  background:
    linear-gradient(var(--line), var(--line)) border-box,
    conic-gradient(from var(--beam-rot) at 50% 50%,
      transparent 0grad,
      var(--tail-c, rgba(255, 77, 166, 0.55)) 68grad,
      var(--tail-soft, rgba(255, 143, 192, 0.35)) 88grad,
      transparent 112grad) border-box;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  filter: drop-shadow(0 0 4px var(--glow));
  z-index: 1;
}

.nav-item:hover::after {
  opacity: 1;
  animation: beamOrbit 2.6s linear infinite;
}

.nav-item.active {
  --tail-c: rgba(255, 255, 255, 0.78);
  --tail-soft: rgba(255, 255, 255, 0.3);
}

.nav-item.active::after {
  opacity: 1;
  animation: beamOrbit 2.6s linear infinite;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.side-lang {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.side-lang .lang-btn {
  width: 100%;
  justify-content: center;
}

.side-lang .lang-menu {
  inset-inline-start: auto;
  inset-inline-end: 0;
  top: auto;
  bottom: calc(100% + 6px);
  min-width: 100%;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
  padding: 3px;
}

.section-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 24px;
  z-index: 0;
}

.section-view.active {
  display: flex;
  min-height: 0;
}

/* --------------------------------------------
   ORBITING LIGHT TAIL AROUND THE SECTION FRAME
   -------------------------------------------- */
.section-view::after {
  content: '';
  position: absolute;
  inset: -1.6px;
  border-radius: 25.6px;
  padding: 1.6px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) border-box,
    conic-gradient(from var(--beam-rot) at 50% 50%,
      transparent 0grad,
      var(--brand) 18grad,
      var(--brand-soft) 24grad,
      transparent 32grad) border-box;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  filter: drop-shadow(0 0 4px var(--glow));
  z-index: 1;
}

.section-view:hover::after,
.section-view:focus-within::after {
  opacity: 1;
  animation: beamOrbit 3.2s linear infinite;
}

@property --beam-rot {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes beamOrbit {
  to {
    --beam-rot: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section-view::after,
  .nav-item::after {
    filter: none;
  }
  .section-view:hover::after,
  .section-view:focus-within::after,
  .nav-item:hover::after,
  .nav-item.active::after {
    animation: none;
  }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: 64px;
  min-height: 64px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 26px;
  justify-content: space-between;
  gap: 16px;
  transition: background 0.35s ease;
}

.topbar-title h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.topbar h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-area {
  padding: 26px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 13px;
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 10px 24px -10px var(--glow);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -10px var(--glow);
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: 11px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
  box-shadow: none;
}

.btn-secondary:hover {
  border-color: var(--brand-soft);
  color: var(--brand);
  background: var(--surface);
  box-shadow: 0 12px 26px -12px var(--glow);
}

.btn-danger {
  background: var(--red);
  box-shadow: 0 10px 24px -10px var(--red-dim);
}

.btn-danger:hover {
  background: var(--red);
}

.btn-success {
  background: var(--green);
  box-shadow: 0 10px 24px -10px var(--green-dim);
}

.btn-success:hover {
  background: var(--green);
}

.btn-warning {
  background: linear-gradient(120deg, var(--yellow), #f5b91e);
  color: #3b2a00;
  box-shadow: 0 10px 24px -10px var(--yellow-dim);
}

.btn-warning:hover {
  background: linear-gradient(120deg, var(--yellow), #f5b91e);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--line);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--glow);
  color: var(--brand);
  border-color: var(--brand-soft);
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.idle { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-dot.dnd { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status-dot.offline,
.status-dot.unknown { background: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.online { background: var(--green-dim); color: var(--green); }
.badge.idle { background: var(--yellow-dim); color: var(--yellow); }
.badge.dnd { background: var(--red-dim); color: var(--red); }
.badge.offline,
.badge.unknown { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.mobile,
.badge.connected { background: var(--glow); color: var(--brand); }
.badge.manager { background: rgba(250, 204, 21, 0.16); color: #f5c518; border: 1px solid rgba(250, 204, 21, 0.45); }
.badge.disconnected { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ============================================================
   SUMMARY BAR
   ============================================================ */
.summary-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.summary-item,
.premium-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 6px 20px -16px rgba(40, 10, 40, 0.4);
}

.summary-item:hover,
.premium-stat:hover {
  transform: translateY(-4px);
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-card);
}

.summary-item .si-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--glow);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-item .si-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

.summary-item .si-lbl {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

/* ============================================================
   BULK ACTIONS PANEL
   ============================================================ */
.bulk-actions-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 22px;
  margin-bottom: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 20px -16px rgba(40, 10, 40, 0.4);
}

.bulk-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bulk-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================
   TOKEN CARDS
   ============================================================ */
.tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.token-card,
.stat-card {
  background: var(--surface);
  border-radius: 22px;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  position: relative;
  box-shadow: 0 6px 20px -16px rgba(40, 10, 40, 0.4);
}

.token-card:hover,
.stat-card:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-card);
  transform: translateY(-6px);
}

.token-card-accent {
  height: 4px;
  background: var(--muted);
  transition: background var(--transition);
}

.token-card.online .token-card-accent { background: var(--green); }
.token-card.idle .token-card-accent { background: var(--yellow); }
.token-card.dnd .token-card-accent { background: var(--red); }

.token-card-body {
  padding: 18px;
}

.token-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.token-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.token-avatar-placeholder {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -8px var(--glow);
}

.token-card-name {
  flex: 1;
  min-width: 0;
}

.token-card-name .name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-card-name .sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.token-card-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 12px 14px;
}

.token-card-meta .row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.token-card-meta .row .val {
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.token-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   VC MANAGER
   ============================================================ */
.vc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 14px;
}

.vc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  transition: all var(--transition);
  box-shadow: 0 6px 20px -16px rgba(40, 10, 40, 0.4);
}

.vc-card:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-card);
  transform: translateY(-3px);
}

.vc-card-user {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.vc-card-user img,
.vc-card-avatar-ph {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.vc-card-avatar-ph {
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 0.9rem;
}

.vc-card-user .vc-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vc-card-status {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.vc-state-info {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  color: var(--muted);
}

.vc-state-info .icon {
  font-size: 1rem;
}

.vc-state-info .val {
  color: var(--ink);
  font-weight: 700;
}

.vc-card-controls {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.vc-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.vc-input-row input {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.82rem;
}

.vc-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.vc-picker-row select {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.82rem;
}

.vc-picker-row select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.vc-btn-row {
  display: flex;
  gap: 8px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 5, 25, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border-radius: 26px;
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-soft);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.modal-close {
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  transform: rotate(90deg);
}

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-soft);
  flex-shrink: 0;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-section {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.form-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title::before {
  content: '';
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad);
}

.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group .hint {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--glow);
}

/* Animated sweeping light (left → right) when entering a field */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
textarea:focus {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-input), var(--bg-input)) padding-box,
    linear-gradient(90deg,
      transparent 25%,
      var(--brand) 48%,
      var(--brand-soft) 50%,
      var(--brand) 52%,
      transparent 75%)
      border-box;
  background-size: 100% 100%, 200% 100%;
  background-position: 0 0, -100% 0;
  animation: fieldSweep 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  box-shadow: 0 0 0 3px var(--glow), inset 0 0 14px -8px var(--glow);
}

@keyframes fieldSweep {
  from {
    background-position: 0 0, -100% 0;
  }
  to {
    background-position: 0 0, 100% 0;
  }
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%239C8CAD'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

[dir="rtl"] select {
  background-position: left 12px center;
  padding-right: 13px;
  padding-left: 34px;
}

textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  margin: 0;
}

.checkbox-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-width: 17px;
  cursor: pointer;
  accent-color: var(--brand);
}

.checkbox-row .cb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.checkbox-row .cb-icon svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.checkbox-row .cb-label {
  font-size: 0.86rem;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 600;
}

/* ============================================================
   INFO BOX
   ============================================================ */
.info-box {
  background: var(--glow);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
  line-height: 1.6;
}

.info-box.warn {
  background: var(--yellow-dim);
  border-color: rgba(223, 158, 0, 0.25);
}

.info-box.danger {
  background: var(--red-dim);
  border-color: rgba(229, 72, 77, 0.25);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
}

.empty-state .icon {
  font-size: 3.2rem;
  opacity: 0.6;
  filter: drop-shadow(0 8px 18px var(--glow));
}

.empty-state h3 {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 360px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page,
.login-container {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 22px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 44px 40px;
  width: 100%;
  max-width: 430px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(14px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  overflow: hidden;
}

.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-page .login-box {
  opacity: 0;
}

.btn-login {
  width: 100%;
  justify-content: center;
  padding: 14px;
  margin-top: 10px;
  border-radius: 14px;
  font-size: 0.95rem;
}

.login-lang {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 5;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.lang-btn:hover {
  border-color: var(--brand-soft);
  color: var(--brand);
}

.lang-menu {
  display: none;
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 6px;
  list-style: none;
  margin: 0;
  z-index: 20;
}

.lang-menu.open {
  display: block;
}

.lang-menu li {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.lang-menu li:hover {
  background: var(--bg-soft);
  color: var(--brand);
}

.lang-menu li.active {
  color: var(--brand);
  background: var(--glow);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  justify-content: center;
}

.login-logo .icon,
.login-logo .logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 12px 28px -8px var(--glow);
  flex-shrink: 0;
}

.login-box h2 {
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}

.login-box .sub {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 28px;
}

.error-msg {
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(229, 72, 77, 0.25);
  border-radius: 13px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: none;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  z-index: 9999;
}

[dir="rtl"] #toast-container {
  right: auto;
  left: 24px;
  align-items: flex-start;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 15px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  min-width: 260px;
  max-width: 400px;
}

.toast.success {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}

.toast.error {
  border-color: var(--red);
  background: var(--red-dim);
  color: var(--red);
}

.toast.info {
  border-color: var(--brand);
  background: var(--glow);
  color: var(--brand);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================================
   CURSOR — SOFT AURA
   ============================================================ */
.cursor-aura {
  position: fixed;
  top: 0;
  left: 0;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9997;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(circle, var(--glow) 0%, var(--glow) 30%, transparent 72%);
  will-change: transform;
}

.cursor-aura.on {
  opacity: 1;
}

@media (hover: none) {
  .cursor-aura {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-aura {
    display: none !important;
  }
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: rotate(20deg);
}

.login-theme-toggle {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 5;
}

/* ============================================================
   PROFILE MANAGER
   ============================================================ */
.pm-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pm-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: stretch;
  padding: 20px 22px;
}

.pm-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.pm-user {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  flex: none;
}

.pm-user .vc-card-avatar-ph,
.pm-user img.vc-card-avatar-ph {
  width: 72px;
  height: 72px;
  font-size: 1.6rem;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.pm-user .vc-name {
  font-size: 1.2rem;
  white-space: normal;
  overflow: visible;
  line-height: 1.25;
  font-weight: 800;
}

.pm-nick-inline {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  margin-inline-start: 2px;
}

.pm-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  flex: none;
  min-width: 0;
}

.pm-banner-chip {
  width: 100%;
  aspect-ratio: 5 / 2;
  align-self: center;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: linear-gradient(135deg, var(--bg-soft), var(--surface));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  overflow: hidden;
}

.pm-banner-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}

@media (max-width: 760px) {
  .pm-card {
    grid-template-columns: 1fr;
  }
}

.pm-files {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pm-file {
  display: none;
}

.pm-avat-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 14px;
  outline: 2px dotted color-mix(in srgb, var(--ink-soft) 55%, transparent);
  outline-offset: 1px;
}

.pm-nick-all-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 14px;
  outline: 2px dotted color-mix(in srgb, var(--ink-soft) 55%, transparent);
  outline-offset: 1px;
}

.pm-nick-all-wrap:hover {
  outline-color: var(--brand);
}

.pm-bnr-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 14px;
  outline: 2px dotted color-mix(in srgb, var(--ink-soft) 55%, transparent);
  outline-offset: 1px;
}

.pm-bnr-wrap:hover {
  outline-color: var(--brand);
}

.pm-op-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pm-nick-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pm-nick-row input {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.82rem;
}

.pm-bio-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.pm-bio-row textarea {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.82rem;
  min-height: 56px;
  resize: vertical;
}

.pm-toolbar .bulk-btns {
  align-items: center;
}

.pm-toolbar .bulk-btns .btn {
  padding: 12px 22px;
  font-size: 0.95rem;
  border-radius: 14px;
  user-select: none;
  -webkit-user-select: none;
}

.pm-toolbar .bulk-btns .btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.pm-toolbar input[type="text"] {
  width: 180px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.pm-all-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.pm-all-bio-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-all-bio-col textarea {
  flex: 1;
  width: 100%;
  min-height: 150px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

@media (max-width: 760px) {
  .pm-all-grid {
    grid-template-columns: 1fr;
  }
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    width: 210px;
    min-width: 210px;
  }
  .content-area {
    padding: 18px;
  }
  .tokens-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar {
    width: 64px;
    min-width: 64px;
  }
  .sidebar-logo .logo-text,
  .sidebar-logo .logo-version,
  .nav-section-label,
  .nav-item {
    font-size: 0;
  }
  .nav-item {
    justify-content: center;
    padding: 12px 0;
  }
  .nav-item .nav-icon {
    font-size: 1.15rem;
    width: auto;
  }
  .topbar {
    padding: 0 14px;
  }
  .topbar-title h2 {
    font-size: 1rem;
  }
  .topbar-sub {
    display: none;
  }
  .content-area {
    padding: 14px;
  }
  .vc-card-controls {
    min-width: 100%;
  }
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  .modal-content {
    max-width: 96vw;
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  #toast-container {
    left: 16px;
    right: 16px;
    align-items: center;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .login-page .login-box {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   COMMANDS & SETTINGS
   ============================================================ */
.cmd-global-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

.cmd-prefix-group {
  min-width: 110px;
}

.cmd-prefix-input {
  width: 60px;
  text-align: center;
  font-weight: 800;
}

.cmd-hint {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cmd-perms {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.cmd-perm-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cmd-who-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
}

.cmd-perm-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.cmd-perm-row .vc-picker {
  min-width: 200px;
}

.cmd-user-input {
  min-width: 240px;
  flex: 1;
  padding: 10px 12px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
}

.chip.role {
  background: rgba(114, 137, 218, 0.14);
  border-color: rgba(114, 137, 218, 0.4);
}

.chip.user {
  background: rgba(67, 181, 129, 0.14);
  border-color: rgba(67, 181, 129, 0.4);
}

.chip-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.chip-sub {
  opacity: 0.7;
  font-weight: 500;
}

.chip-x {
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 2px;
}

.chip-x:hover {
  opacity: 1;
}

.cmd-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cmd-card {
  padding: 14px 16px;
}

.cmd-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cmd-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  flex: 1;
}

.cmd-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--brand);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.cmd-kind {
  font-size: 0.64rem;
}

.cmd-kind.voice { background: var(--glow); color: var(--brand); }
.cmd-kind.avatar { background: rgba(250, 204, 21, 0.16); color: #f5c518; }
.cmd-kind.banner { background: rgba(232, 65, 66, 0.14); color: #e84142; }
.cmd-kind.nick { background: rgba(114, 137, 218, 0.16); color: #7289da; }
.cmd-kind.bio { background: rgba(67, 181, 129, 0.14); color: #43b581; }

.cmd-enable {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
}

.cmd-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.cmd-row-ctl {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cmd-alias {
  width: 220px;
  padding: 9px 12px;
}

.cmd-nopfx {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
}

.cmd-footer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 6px;
}

.cmd-autosave {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cmd-save-status {
  min-width: 130px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  padding-bottom: 6px;
}

.cmd-save-status.loading {
  color: #8792a8;
}

.cmd-save-status.loading::before {
  content: "↻ ";
  animation: cmd-spin 0.9s linear infinite;
  display: inline-block;
}

.cmd-save-status.ok {
  color: #43b581;
}

.cmd-save-status.ok::before {
  content: "✓ ";
}

@keyframes cmd-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .cmd-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .cmd-alias {
    width: 100%;
  }
}

/* ─── Change Log ──────────────────────────────────────────────────────────────── */

.sidebar-bottom .nav-item {
  width: 100%;
  justify-content: flex-start;
}

.cl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cl-item {
  display: grid;
  grid-template-columns: 150px auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.cl-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cl-badge {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(212, 0, 110, 0.15);
  color: var(--brand);
}

.cl-badge-token_add,
.cl-badge-token_added_slash {
  background: rgba(67, 181, 129, 0.16);
  color: #43b581;
}

.cl-badge-token_delete {
  background: rgba(240, 71, 71, 0.16);
  color: #f04747;
}

.cl-badge-profile_update,
.cl-badge-profile_all,
.cl-badge-token_update,
.cl-badge-token_restart {
  background: rgba(250, 166, 26, 0.16);
  color: #faa61a;
}

.cl-badge-login,
.cl-badge-tokens_bulk_restart,
.cl-badge-tokens_bulk_vc_disconnect,
.cl-badge-tokens_bulk_status,
.cl-badge-settings_update,
.cl-badge-lang_update {
  background: rgba(114, 137, 218, 0.16);
  color: #7289da;
}

.cl-detail {
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
}

.cl-user {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cl-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .cl-item {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: flex-start;
  }
  .cl-user {
    white-space: normal;
  }
}

/* ============================================================
   MOBILE ORGANIZATION
   Phone-only polish; the desktop layout stays untouched.
   ============================================================ */
@media (max-width: 640px) {
  .app-container {
    overflow-x: hidden;
  }

  .main-content {
    padding: 0;
  }

  .section-view {
    border-radius: 16px;
  }

  /* icon rail adjustments */
  .sidebar {
    position: relative;
    z-index: 3;
    width: 58px;
    min-width: 58px;
    overflow: visible;
  }

  .sidebar-logo {
    justify-content: center;
    padding: 14px 8px 12px;
  }

  .sidebar-logo .logo-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .nav-item {
    margin: 2px 5px;
    padding: 11px 0;
  }

  .sidebar-bottom {
    padding: 8px 0 12px;
  }

  .sidebar-bottom .nav-item {
    justify-content: center;
    padding: 12px 0;
    margin: 0;
  }

  /* language → compact circular icon, menu opens beside the rail */
  .side-lang {
    margin-bottom: 8px;
  }

  .side-lang .lang-btn {
    width: 42px;
    height: 42px;
    justify-content: center;
    font-size: 0;
    border-radius: 50%;
    padding: 0;
  }

  .side-lang .lang-btn::before {
    content: '🌐';
    font-size: 1.15rem;
    line-height: 1;
  }

  .side-lang .lang-menu {
    top: auto;
    bottom: 0;
    min-width: 140px;
    left: auto;
    right: auto;
    inset-inline-start: calc(100% + 10px);
    inset-inline-end: auto;
  }

  /* topbar wraps instead of overflowing */
  .topbar {
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-title h2 {
    font-size: 0.98rem;
    line-height: 1.25;
  }

  /* comfortable touch targets on every button */
  .btn {
    min-height: 40px;
    padding: 9px 14px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 7px 11px;
  }

  .content-area {
    padding: 14px;
  }

  /* dashboard summary badges → tidy 2×2 grid */
  .summary-item {
    flex: 1 1 42%;
    padding: 13px 14px;
  }

  .summary-item .si-icon {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }

  /* panels & forms breathe better on narrow screens */
  .bulk-actions-panel {
    padding: 14px;
    margin-bottom: 18px;
  }

  .cmd-global-row {
    width: 100%;
    align-items: stretch;
  }

  .cmd-prefix-group {
    min-width: 100%;
  }

  .cmd-perm-row {
    flex-wrap: wrap;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1 1 100%;
  }
}