/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 55% at 50% -8%, rgba(224,82,122,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 55% 40% at 85% 90%, rgba(167,139,250,0.06) 0%, transparent 50%),
    var(--bg);
  padding: var(--sp-8);
  padding-top: calc(var(--sp-8) + var(--safe-top));
  padding-bottom: calc(var(--sp-8) + var(--safe-bottom));
}
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: var(--sp-8); }
.login-logo .k,
.login-logo .icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
  border-radius: var(--radius-xl); font-size: 1.8rem; margin-bottom: var(--sp-4);
  box-shadow:
    0 0 0 1px rgba(224,82,122,0.20),
    0 8px 32px rgba(224,82,122,0.30),
    inset 0 1px 0 rgba(255,255,255,0.10);
}
.login-logo h1 {
  font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -1.2px;
  color: var(--text); line-height: 1;
}
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--muted2); font-size: var(--fs-base); margin-top: var(--sp-2); }

/* ═══════════════════════════════════════════════════════
   SETUP BOX
═══════════════════════════════════════════════════════ */
.box {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% -8%, rgba(224,82,122,0.10) 0%, transparent 60%),
    var(--bg);
  padding: var(--sp-8);
}
.box .logo { text-align: center; margin-bottom: var(--sp-8); }
.box .logo .icon,
.box .logo .k {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
  border-radius: 16px; font-size: 1.5rem; margin-bottom: var(--sp-3);
  box-shadow: 0 8px 28px rgba(224,82,122,0.28);
}
.box .logo h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -1px; }
.box .logo h1 span { color: var(--accent); }
.box .logo p  { color: var(--muted2); font-size: var(--fs-base); margin-top: var(--sp-1); }
.box .card    { width: 100%; max-width: 400px; }

/* ═══════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100dvh; }

/* ═══════════════════════════════════════════════════════
   SIDEBAR — 256px desktop
═══════════════════════════════════════════════════════ */
.sidebar {
  width: 256px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh; overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--radius-pill); }

.sidebar-logo {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0;
}
.sidebar-logo .brand {
  font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.5px; color: var(--text);
}
.sidebar-logo .brand span { color: var(--accent); }
.sidebar-logo .role-badge {
  display: inline-block; margin-top: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(224,82,122,0.18);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-pill);
  align-self: flex-start;
}

.sidebar-nav {
  padding: var(--sp-2); flex: 1;
  overflow-y: auto; min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.nav-label {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted);
  padding: var(--sp-3) var(--sp-3) var(--sp-1); margin-top: var(--sp-1);
  display: block; opacity: .55;
}

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius);
  cursor: pointer; color: var(--muted2); font-size: var(--fs-base);
  font-weight: 500; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  margin-bottom: 1px; border: 1px solid transparent; background: transparent;
  width: 100%; text-align: left;
  position: relative; min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent); font-weight: 600;
  border-color: rgba(224,82,122,0.16);
  box-shadow: 0 1px 6px rgba(224,82,122,0.08);
}

/* Icon wrapper inside nav-item */
.nav-item .icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; line-height: 1;
  opacity: .7; transition: opacity var(--t-fast);
}
.nav-item:hover .icon,
.nav-item.active .icon { opacity: 1; }
.nav-item .icon svg { width: 15px; height: 15px; }

.nav-item .count-badge {
  margin-left: auto;
  font-size: var(--fs-xs); font-weight: 800;
  padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-pill);
  min-width: 18px; text-align: center; line-height: 1.4;
}
.count-badge.red   { background: rgba(248,113,113,0.18); color: var(--danger); }
.count-badge.blue  { background: rgba(96,165,250,0.18); color: var(--blue); }
.count-badge.green { background: rgba(52,211,153,0.18); color: var(--green); }

.sidebar-footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-account-name {
  font-size: var(--fs-sm); color: var(--muted2); font-weight: 500;
  margin-bottom: var(--sp-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  padding: var(--sp-2) var(--sp-3);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.connected-indicator {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--muted2); margin-bottom: var(--sp-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 4px var(--green); }
  50%       { box-shadow: 0 0 10px var(--green); }
}
.dot.green { background: var(--green); animation: pulseGreen 2.4s ease-in-out infinite; }
.dot.red   { background: var(--danger); }

/* Mobile overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 999;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* Lang switcher */
.lang-switcher { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-2); justify-content: center; }
.lang-btn {
  padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-sm);
  font-size: var(--fs-xs); font-weight: 700;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.lang-btn:hover { border-color: var(--border2); color: var(--text); }
.lang-btn.active {
  background: var(--accent-glow);
  border-color: rgba(224,82,122,0.25);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   MAIN AREA
═══════════════════════════════════════════════════════ */
.main-area { flex: 1; overflow-y: auto; min-width: 0; }
.main-area::-webkit-scrollbar { width: 4px; }
.main-area::-webkit-scrollbar-track { background: transparent; }
.main-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: var(--radius-pill); }

/* ═══════════════════════════════════════════════════════
   TOPBAR — sticky glass
═══════════════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(9,9,14,0.85);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-6);
  display: flex; align-items: center;
  justify-content: space-between; gap: var(--sp-4);
  min-height: 56px;
}
.topbar-title {
  font-size: var(--fs-lg); font-weight: 700; color: var(--text);
  letter-spacing: -.2px;
}
.topbar-event {
  font-size: var(--fs-sm); color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(224,82,122,0.18);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill);
  font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}

/* ═══════════════════════════════════════════════════════
   CONTENT
═══════════════════════════════════════════════════════ */
.content { padding: var(--sp-6) var(--sp-8); max-width: 1060px; }
.content::-webkit-scrollbar { width: 4px; }

/* ═══════════════════════════════════════════════════════
   SECTIONS
═══════════════════════════════════════════════════════ */
.section { display: none; }
.section.active {
  display: block;
  animation: sectionIn .2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes sectionIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════ */
.page-header { margin-bottom: var(--sp-6); }
.page-header h2 {
  font-size: var(--fs-xl); font-weight: 800; color: var(--text);
  letter-spacing: -.4px; line-height: 1.2;
}
.page-header p {
  margin-top: var(--sp-1); font-size: var(--fs-base);
  color: var(--muted2); line-height: 1.5;
}
.page-header-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-1);
}
.page-header-row h2 { margin: 0; }

/* ═══════════════════════════════════════════════════════
   MOBILE MENU
═══════════════════════════════════════════════════════ */
.mobile-menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border2);
  border-radius: var(--radius); cursor: pointer; font-size: 1rem; color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast);
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.08); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — 2 breakpoints only
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex !important; }
  .sidebar {
    position: fixed !important; z-index: 9999 !important;
    top: 0 !important; left: 0 !important;
    height: 100dvh !important; width: 280px !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s cubic-bezier(0.25,0.8,0.25,1) !important;
    box-shadow: 20px 0 60px rgba(0,0,0,0.5) !important;
  }
  .sidebar.open { transform: translateX(0) !important; }
  .content { padding: var(--sp-4); }
  .topbar  { padding: var(--sp-3) var(--sp-4); }
}

/* ═══════════════════════════════════════════════════════
   DIALOGS & OVERLAYS
═══════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.60); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: var(--sp-5);
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl); padding: var(--sp-6);
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04);
  max-height: 90vh; overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════
   PLAN BADGE / CREDIT BADGE
═══════════════════════════════════════════════════════ */
.plan-badge {
  display: inline-block; margin-top: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-pill);
  align-self: flex-start;
}
.credit-badge {
  display: block; margin-top: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--muted2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3);
  text-align: center;
}
.credit-badge.low { color: var(--danger); border-color: var(--danger-border); background: var(--danger-bg); }

/* Notification prefs panel */
.notif-prefs-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 340px; max-width: 100vw;
  background: var(--bg2); border-left: 1px solid var(--border2);
  box-shadow: -12px 0 40px rgba(0,0,0,0.5);
  z-index: 8001; padding: var(--sp-6);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; gap: var(--sp-4);
  overflow-y: auto;
}
.notif-prefs-panel.open { transform: translateX(0); }
.notif-prefs-header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: var(--sp-4);
}
.notif-prefs-title { font-size: var(--fs-lg); font-weight: 700; }
.notif-prefs-close {
  background: var(--surface2); border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted2); transition: background var(--t-fast);
}
.notif-prefs-close:hover { background: var(--border2); color: var(--text); }
.notif-disable-btn { margin-top: auto; }
