@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=JetBrains+Mono:wght@300;400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

/* ═══════════════════════════════════════════════
   GLOBAL RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds */
  --bg:        #060708;
  --bg1:       #0c0d0f;
  --bg2:       #131416;
  --bg3:       #1a1b1e;
  --bg4:       #222426;
  --bg5:       #2a2c2f;
  --bg6:       #333538;

  /* Borders */
  --line:      rgba(255,255,255,0.055);
  --line-hi:   rgba(255,255,255,0.13);
  --line-med:  rgba(255,255,255,0.08);

  /* Text */
  --white:     #eeeae3;
  --mute1:     #8a8780;
  --mute2:     #5a5855;
  --mute3:     #333230;

  /* Accent Colors */
  --green:     #00e87a;
  --green-d:   rgba(0,232,122,0.09);
  --green-m:   rgba(0,232,122,0.18);
  --green-hi:  rgba(0,232,122,0.28);

  --red:       #ff4d4d;
  --red-d:     rgba(255,77,77,0.09);
  --red-m:     rgba(255,77,77,0.18);

  --amber:     #f5a623;
  --amber-d:   rgba(245,166,35,0.09);
  --amber-m:   rgba(245,166,35,0.18);

  --blue:      #4dabf7;
  --blue-d:    rgba(77,171,247,0.09);
  --blue-m:    rgba(77,171,247,0.18);

  --purple:    #b197fc;
  --purple-d:  rgba(177,151,252,0.09);
  --purple-m:  rgba(177,151,252,0.18);
  --purple-color: #a78bfa;

  --cyan:      #00d4ff;
  --cyan-d:    rgba(0,212,255,0.09);

  --yellow:    #f5c542;

  /* Layout */
  --sidebar:   230px;
  --topbar-h:  58px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:   0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 20px 50px rgba(0,0,0,0.5);
  --shadow-xl:   0 40px 80px rgba(0,0,0,0.6);

  /* Transitions */
  --trans:      0.18s ease;
  --trans-slow: 0.35s cubic-bezier(0.4,0,0.2,1);

  /* Fonts */
  --font-h:    'Syne', sans-serif;
  --font-b:    'Syne', sans-serif;
  --font-m:    'JetBrains Mono', monospace;
  --font-s:    'Instrument Serif', serif;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-b);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; opacity: 0.5;
}

img { display: block; max-width: 100%; }
button { font-family: var(--font-b); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-b); }
a { text-decoration: none; color: inherit; }
svg { display: block; }
mark { background: rgba(0,232,122,0.2); color: var(--green); border-radius: 2px; padding: 0 2px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--mute2); }

/* ── HELPERS ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }
.hidden { display: none !important; }
.mono { font-family: var(--font-m); }
.muted { color: var(--mute1); }
.danger { color: var(--red); }
.success { color: var(--green); }
.warning { color: var(--amber); }

/* ═══════════════════════════════════════════════
   GLOBAL LOADING OVERLAY
═══════════════════════════════════════════════ */
#global-loading {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(6,7,8,0.92); backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--trans-slow);
}
#global-loading.visible { opacity: 1; pointer-events: all; }
.loading-spinner {
  width: 36px; height: 36px;
  border: 2.5px solid var(--line-hi);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px rgba(0,232,122,0.2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   TOAST SYSTEM
═══════════════════════════════════════════════ */
#toast-wrap {
  position: fixed; bottom: 22px; right: 22px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: var(--bg1); border: 1px solid var(--line-hi);
  border-radius: 11px; padding: 13px 16px;
  font-size: 13px; color: var(--mute1);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto; max-width: 320px;
  animation: toastIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: var(--shadow-lg);
  transition: transform var(--trans), opacity var(--trans);
}
.toast.out { animation: toastOut 0.22s ease forwards; }
.toast.success { border-color: rgba(0,232,122,0.35); }
.toast.error   { border-color: rgba(255,77,77,0.35); }
.toast.warn    { border-color: rgba(245,166,35,0.35); }
.toast.info    { border-color: rgba(77,171,247,0.35); }
.toast-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.toast.success .toast-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.toast.error .toast-dot   { background: var(--red); box-shadow: 0 0 8px var(--red); }
.toast.warn .toast-dot    { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.toast.info .toast-dot    { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.toast-msg { font-size: 13px; color: var(--white); line-height: 1.4; }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateX(24px); opacity: 0; } }

/* ═══════════════════════════════════════════════
   CONFIRM DIALOG
═══════════════════════════════════════════════ */
#confirm-dialog {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(20px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#confirm-dialog.open { display: flex; }
.confirm-box {
  background: var(--bg1); border: 1px solid var(--line-hi);
  border-radius: var(--radius-xl); padding: 40px 36px; max-width: 400px; width: 100%;
  text-align: center; animation: modalIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04);
}
.confirm-icon {
  font-size: 36px; margin-bottom: 16px; line-height: 1;
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; border: 1px solid;
}
.confirm-icon.danger {
  background: var(--red-d); border-color: rgba(255,77,77,0.25);
}
.confirm-title {
  font-family: var(--font-h); font-size: 22px; font-weight: 700;
  color: var(--white); margin-bottom: 10px;
}
.confirm-msg {
  font-size: 13px; color: var(--mute1); line-height: 1.7; margin-bottom: 28px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ═══════════════════════════════════════════════
   SCREENSHOT PREVIEW MODAL
═══════════════════════════════════════════════ */
#modal-screenshot .modal-box { text-align: center; }
#scr-img {
  max-width: 100%; max-height: 70vh; border-radius: 10px;
  margin-top: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

/* ═══════════════════════════════════════════════
   DRAWER BACKDROP
═══════════════════════════════════════════════ */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--trans-slow);
}
.drawer-backdrop.visible { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════════
   USER EDIT DRAWER
═══════════════════════════════════════════════ */
#user-drawer {
  position: fixed; top: 0; right: -640px; bottom: 0; z-index: 300;
  width: 620px; max-width: 100vw;
  background: var(--bg1);
  border-left: 1px solid var(--line-hi);
  display: flex; flex-direction: column;
  transition: right var(--trans-slow);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
#user-drawer.open { right: 0; }

.drawer-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0; position: relative;
  background: var(--bg1);
}
.drawer-title {
  font-family: var(--font-h); font-size: 18px; font-weight: 700;
  color: var(--white); flex: 1;
}
.drawer-unsaved {
  font-family: var(--font-m); font-size: 9px; letter-spacing: 0.1em;
  color: var(--amber); background: var(--amber-d);
  border: 1px solid rgba(245,166,35,0.25); border-radius: 99px;
  padding: 4px 10px; opacity: 0; pointer-events: none;
  transition: opacity var(--trans);
}
.drawer-unsaved.visible { opacity: 1; pointer-events: all; }
.drawer-close {
  width: 32px; height: 32px; background: var(--bg3); border: 1px solid var(--line);
  border-radius: 8px; color: var(--mute1); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); line-height: 1; flex-shrink: 0;
}
.drawer-close:hover { color: var(--white); background: var(--bg4); border-color: var(--line-hi); }

/* Drawer draft tabs */
.drawer-drafts {
  display: flex; gap: 2px; padding: 8px 16px 0;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
  overflow-x: auto; min-height: 0;
  background: var(--bg2);
}
.drawer-drafts:empty { display: none; }
.draft-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px 8px 0 0;
  font-family: var(--font-m); font-size: 10px; color: var(--mute1);
  cursor: pointer; transition: all var(--trans); white-space: nowrap;
  border: 1px solid transparent; border-bottom: none;
  background: transparent;
}
.draft-tab.active {
  background: var(--bg1); color: var(--white);
  border-color: var(--line); border-bottom-color: var(--bg1);
}
.draft-tab:hover:not(.active) { background: var(--bg3); color: var(--white); }
.draft-tab-close {
  width: 14px; height: 14px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; font-size: 12px; color: var(--mute2);
  transition: all var(--trans); background: none; border: none; cursor: pointer;
}
.draft-tab-close:hover { background: var(--bg5); color: var(--white); }

/* Drawer section tabs nav */
.drawer-tabs-nav {
  padding: 0 16px; border-bottom: 1px solid var(--line);
  flex-shrink: 0; overflow-x: auto; background: var(--bg1);
}
.drawer-tabs { display: flex; gap: 0; }
.drawer-tab {
  padding: 12px 14px; font-family: var(--font-m); font-size: 10px;
  letter-spacing: 0.06em; color: var(--mute1); cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent;
  transition: all var(--trans); white-space: nowrap;
  margin-bottom: -1px;
}
.drawer-tab:hover { color: var(--white); }
.drawer-tab.active { color: var(--white); border-bottom-color: var(--green); }

/* Drawer body */
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-tab-content { display: none; }
.drawer-tab-content.active { display: block; animation: fadeIn 0.18s ease; }
.drawer-section-title {
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.24em;
  color: var(--mute2); text-transform: uppercase;
  margin: 22px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.drawer-section-title:first-child { margin-top: 0; }
.drawer-field-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  min-height: 40px;
}
.drawer-field-row:last-child { border-bottom: none; }
.dfr-label {
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
  letter-spacing: 0.06em; flex-shrink: 0; padding-right: 16px; min-width: 120px;
}
.dfr-val {
  font-size: 13px; color: var(--white); text-align: right;
  word-break: break-all; max-width: 70%;
}

/* Drawer footer */
.drawer-footer {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; flex-shrink: 0;
  background: var(--bg1); gap: 8px;
}

/* ═══════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════ */
#login-screen {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.login-bg-orb {
  position: absolute; border-radius: 50%;
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.login-bg-orb:nth-child(1) {
  width: 600px; height: 600px; top: -200px; left: -150px;
  background: radial-gradient(circle, rgba(0,232,122,0.06) 0%, transparent 70%);
  animation-delay: 0s;
}
.login-bg-orb:nth-child(2) {
  width: 500px; height: 500px; bottom: -150px; right: -100px;
  background: radial-gradient(circle, rgba(77,171,247,0.05) 0%, transparent 70%);
  animation-delay: -3s;
}
@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -40px) scale(1.06); }
}
.login-grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 0%, transparent 100%);
}
.login-wrap {
  width: 440px;
  background: var(--bg1);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius-xl);
  padding: 54px 46px;
  position: relative;
  overflow: hidden;
  animation: loginFadeIn 0.5s cubic-bezier(0.34,1.2,0.64,1);
  z-index: 1;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04);
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-wrap::before {
  content: '';
  position: absolute; top: -80px; right: -80px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(0,232,122,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.login-wrap::after {
  content: '';
  position: absolute; bottom: -60px; left: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(77,171,247,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.login-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 36px;
}
.login-logo-icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 20px rgba(255,255,255,0.1);
}
.login-logo-icon svg {
  width: 22px; height: 22px;
  stroke: var(--bg); fill: none; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.login-logo-name { font-family: var(--font-h); font-size: 18px; font-weight: 700; }
.login-logo-tag {
  font-family: var(--font-m); font-size: 8px; color: var(--green);
  letter-spacing: 0.2em; text-transform: uppercase; margin-top: 2px;
}
.login-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-m); font-size: 9px; letter-spacing: 0.18em;
  color: var(--mute1); text-transform: uppercase; margin-bottom: 14px;
}
.login-badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 10px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; box-shadow: 0 0 8px var(--green); }
  50%      { opacity: 0.5; box-shadow: 0 0 3px var(--green); }
}
.login-title {
  font-family: var(--font-h); font-size: 34px; font-weight: 700;
  line-height: 1.1; margin-bottom: 8px;
}
.login-title em {
  font-family: var(--font-s); font-style: italic;
  font-weight: 400; color: var(--green);
}
.login-sub { font-size: 13px; color: var(--mute1); margin-bottom: 36px; line-height: 1.6; }

.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-family: var(--font-m); font-size: 9px;
  letter-spacing: 0.18em; color: var(--mute2); text-transform: uppercase; margin-bottom: 8px;
}
.login-field input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 13px 15px;
  color: var(--white); font-family: var(--font-b); font-size: 14px;
  outline: none; transition: all var(--trans);
}
.login-field input:focus {
  border-color: rgba(0,232,122,0.4);
  box-shadow: 0 0 0 3px rgba(0,232,122,0.06);
}
.login-field input::placeholder { color: var(--mute3); }

.btn-login {
  width: 100%; padding: 15px;
  background: var(--white); color: var(--bg);
  font-family: var(--font-h); font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
  border: none; border-radius: 9px; cursor: pointer;
  transition: all var(--trans); margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover {
  background: var(--green); color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,232,122,0.28);
}
.btn-login:active { transform: translateY(0); }
.login-err {
  font-size: 12px; color: var(--red); font-family: var(--font-m);
  margin-top: 12px; text-align: center; display: none;
  padding: 10px 14px; background: var(--red-d);
  border: 1px solid rgba(255,77,77,0.22); border-radius: 8px;
  animation: fadeIn 0.18s ease;
}
.login-footer-note {
  text-align: center; font-family: var(--font-m); font-size: 10px;
  color: var(--mute3); margin-top: 28px; letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════ */
#app {
  display: flex; min-height: 100vh;
  position: relative; z-index: 1;
}
#sidebar {
  width: var(--sidebar); min-height: 100vh;
  background: var(--bg1);
  border-right: 1px solid var(--line);
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
  display: flex; flex-direction: column;
  transition: transform var(--trans-slow);
}
#main {
  margin-left: var(--sidebar); flex: 1;
  display: flex; flex-direction: column; min-width: 0;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */
.sb-logo {
  padding: 22px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 11px;
  flex-shrink: 0;
}
.sb-logo-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--white);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 14px rgba(255,255,255,0.08);
}
.sb-logo-icon svg {
  width: 18px; height: 18px;
  stroke: var(--bg); fill: none; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sb-logo-text { font-family: var(--font-h); font-size: 14px; font-weight: 700; }
.sb-logo-tag {
  font-family: var(--font-m); font-size: 8px; color: var(--green);
  letter-spacing: 0.14em; margin-top: 1px; text-transform: uppercase;
}
.sb-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sb-group {
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.24em;
  color: var(--mute3); text-transform: uppercase; padding: 14px 20px 5px;
  user-select: none;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; cursor: pointer; transition: all var(--trans);
  color: var(--mute1); font-size: 13px; font-weight: 500;
  border-left: 2px solid transparent; text-decoration: none;
  user-select: none; position: relative;
}
.sb-item svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0; transition: stroke var(--trans);
}
.sb-item:hover { color: var(--white); background: rgba(255,255,255,0.03); }
.sb-item.active {
  color: var(--white); background: rgba(0,232,122,0.06);
  border-left-color: var(--green);
}
.sb-item.active svg { stroke: var(--green); }
.sb-badge {
  margin-left: auto; font-family: var(--font-m); font-size: 9px;
  background: var(--red-d); color: var(--red);
  padding: 2px 7px; border-radius: 99px;
  border: 1px solid rgba(255,77,77,0.2);
  animation: pulse 2s infinite;
}
.sb-foot {
  padding: 16px 20px; border-top: 1px solid var(--line); flex-shrink: 0;
}
.sb-admin-info {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--green-m); border: 1px solid rgba(0,232,122,0.2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-h); font-size: 14px; font-weight: 700; color: var(--green);
  flex-shrink: 0;
}
.sb-admin-name { font-size: 13px; font-weight: 600; color: var(--white); }
.sb-admin-role {
  font-family: var(--font-m); font-size: 9px;
  color: var(--green); letter-spacing: 0.1em; margin-top: 1px; text-transform: uppercase;
}
.sb-logout {
  width: 100%; padding: 9px; background: transparent;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--mute1); font-family: var(--font-m); font-size: 10px;
  letter-spacing: 0.08em; cursor: pointer; transition: all var(--trans); text-align: center;
}
.sb-logout:hover {
  border-color: var(--red); color: var(--red); background: var(--red-d);
}

/* ═══════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  padding: 0 28px;
  height: var(--topbar-h);
  background: rgba(6,7,8,0.88); backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-breadcrumb {
  font-family: var(--font-m); font-size: 11px; color: var(--mute2);
  display: flex; align-items: center; gap: 7px;
}
.topbar-breadcrumb-root { color: var(--mute2); }
.topbar-breadcrumb-sep { color: var(--mute3); }
#topbar-page { color: var(--white); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-time {
  font-family: var(--font-m); font-size: 11px; color: var(--mute2);
  letter-spacing: 0.04em;
}
.topbar-chip {
  font-family: var(--font-m); font-size: 9px; letter-spacing: 0.14em;
  background: var(--green-d); color: var(--green);
  border: 1px solid rgba(0,232,122,0.2); padding: 5px 12px; border-radius: 99px;
  display: flex; align-items: center; gap: 5px; text-transform: uppercase;
}
.topbar-chip::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); animation: pulse 2s infinite;
}
.topbar-refresh {
  width: 32px; height: 32px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--trans); color: var(--mute1);
}
.topbar-refresh:hover { border-color: var(--line-hi); color: var(--white); }
.topbar-refresh svg {
  width: 14px; height: 14px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.topbar-refresh.spinning svg { animation: spin 0.6s linear; }

/* ═══════════════════════════════════════════════
   PAGES SYSTEM
═══════════════════════════════════════════════ */
#pages { flex: 1; }
.page { display: none; padding: 28px; animation: fadeIn 0.22s ease; }
.page.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sec-hd {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
  flex-wrap: wrap; gap: 12px;
}
h2.sec-title {
  font-family: var(--font-h); font-size: 16px; font-weight: 700; margin: 0;
}
.sec-title {
  font-family: var(--font-h); font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.sec-title svg {
  width: 16px; height: 16px; stroke: var(--mute1); fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.sec-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 14px; margin-bottom: 26px;
}
.stat-card {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  transition: all var(--trans); position: relative; overflow: hidden;
  cursor: default;
}
.stat-card:hover { border-color: var(--line-hi); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, var(--accent-glow, transparent) 0%, transparent 70%);
  pointer-events: none;
}
.stat-card.c-green { --accent-glow: rgba(0,232,122,0.14); }
.stat-card.c-red   { --accent-glow: rgba(255,77,77,0.12); }
.stat-card.c-amber { --accent-glow: rgba(245,166,35,0.12); }
.stat-card.c-blue  { --accent-glow: rgba(77,171,247,0.12); }
.stat-card.c-purple{ --accent-glow: rgba(177,151,252,0.12); }
.stat-label {
  font-family: var(--font-m); font-size: 9px; letter-spacing: 0.18em;
  color: var(--mute2); text-transform: uppercase; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.stat-label svg {
  width: 14px; height: 14px; stroke: currentColor; fill: none;
  stroke-width: 1.5; flex-shrink: 0;
}
.stat-val {
  font-family: var(--font-h); font-size: 36px; font-weight: 800;
  line-height: 1; margin-bottom: 5px; letter-spacing: -0.02em;
}
.stat-val.green  { color: var(--green); text-shadow: 0 0 30px rgba(0,232,122,0.28); }
.stat-val.red    { color: var(--red); text-shadow: 0 0 30px rgba(255,77,77,0.22); }
.stat-val.amber  { color: var(--amber); text-shadow: 0 0 30px rgba(245,166,35,0.22); }
.stat-val.blue   { color: var(--blue); text-shadow: 0 0 30px rgba(77,171,247,0.22); }
.stat-val.purple { color: var(--purple); text-shadow: 0 0 30px rgba(177,151,252,0.22); }
.stat-sub { font-size: 11px; color: var(--mute2); line-height: 1.5; }
.stat-mini-chart {
  display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 14px;
}
.smb { flex: 1; border-radius: 2px; background: var(--bg4); min-width: 4px; transition: all var(--trans); }
.smb.hi { background: currentColor; opacity: 0.35; }
.stat-card.c-green .smb { color: var(--green); }
.stat-card.c-red   .smb { color: var(--red); }
.stat-card.c-amber .smb { color: var(--amber); }
.stat-card.c-blue  .smb { color: var(--blue); }
.stat-card.c-purple .smb { color: var(--purple); }
.stat-card:hover .smb.hi { opacity: 0.7; }

/* Mini key breakdown */
#stat-key-breakdown { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.key-mini {
  font-family: var(--font-m); font-size: 8px;
  padding: 2px 7px; border-radius: 99px; letter-spacing: 0.04em;
}
.key-mini.unused  { background: var(--blue-d); color: var(--blue); border: 1px solid rgba(77,171,247,0.15); }
.key-mini.active  { background: var(--green-d); color: var(--green); border: 1px solid rgba(0,232,122,0.15); }
.key-mini.expired { background: var(--amber-d); color: var(--amber); border: 1px solid rgba(245,166,35,0.15); }
.key-mini.revoked { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.15); }

/* Dashboard mini grid */
.dash-mini-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 14px; margin-bottom: 26px;
}
.mini-stat { padding: 18px 20px; }

/* Dashboard chips row */
.dash-chips-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px;
}
.dash-chip {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 18px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--trans); min-width: 130px;
}
.dash-chip:hover { border-color: var(--line-hi); }
.dash-chip-label {
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.16em;
  color: var(--mute2); text-transform: uppercase;
}
.dash-chip-val {
  font-family: var(--font-h); font-size: 14px; font-weight: 700; color: var(--white);
}
.dash-chip-val.red   { color: var(--red); }
.dash-chip-val.amber { color: var(--amber); }
.dash-chip-val.green { color: var(--green); }

/* Status dot */
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
}
.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-dot.red   { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* Dashboard 2-col layout */
.dash-2col {
  display: grid; grid-template-columns: 1fr 340px;
  gap: 20px; margin-bottom: 26px;
}
.recent-activity-wrap {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}

/* Dashboard alerts */
.dash-alerts { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  background: var(--amber-d); border: 1px solid rgba(245,166,35,0.2);
  border-radius: 9px; padding: 12px 16px;
  font-size: 13px; color: var(--amber); display: flex; align-items: center; gap: 10px;
}

/* Force update status */
#dash-force-update-status { font-family: var(--font-m); font-size: 11px; }

/* ═══════════════════════════════════════════════
   BUTTON SYSTEM
═══════════════════════════════════════════════ */
.btn {
  font-family: var(--font-m); font-size: 10px; letter-spacing: 0.06em;
  padding: 8px 15px; border-radius: 8px; cursor: pointer;
  transition: all var(--trans); border: 1px solid; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; line-height: 1;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--mute1); border-color: var(--line); }
.btn-ghost:hover { color: var(--white); border-color: var(--line-hi); background: rgba(255,255,255,0.03); }
.btn-primary { background: var(--white); color: var(--bg); border-color: var(--white); font-weight: 700; }
.btn-primary:hover { background: var(--green); border-color: var(--green); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,232,122,0.22); }
.btn-primary:active { transform: translateY(0); }
.btn-approve { background: var(--green-d); color: var(--green); border-color: rgba(0,232,122,0.22); }
.btn-approve:hover { background: var(--green-m); border-color: rgba(0,232,122,0.38); }
.btn-reject { background: var(--red-d); color: var(--red); border-color: rgba(255,77,77,0.22); }
.btn-reject:hover { background: var(--red-m); border-color: rgba(255,77,77,0.38); }
.btn-edit { background: var(--blue-d); color: var(--blue); border-color: rgba(77,171,247,0.22); }
.btn-edit:hover { background: var(--blue-m); border-color: rgba(77,171,247,0.38); }
.btn-danger { background: var(--red-d); color: var(--red); border-color: rgba(255,77,77,0.22); }
.btn-danger:hover { background: var(--red-m); border-color: rgba(255,77,77,0.38); }
.btn-amber { background: var(--amber-d); color: var(--amber); border-color: rgba(245,166,35,0.22); }
.btn-amber:hover { background: var(--amber-m); border-color: rgba(245,166,35,0.38); }
.btn-sm { padding: 5px 11px; font-size: 9px; border-radius: 7px; }
.btn-copy {
  background: none; border: none; cursor: pointer;
  color: var(--mute2); padding: 4px; transition: color var(--trans);
  display: inline-flex; align-items: center;
}
.btn-copy:hover { color: var(--green); }
.btn-copy svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.btn-icon {
  width: 32px; height: 32px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--trans); color: var(--mute1);
}
.btn-icon:hover { border-color: var(--line-hi); color: var(--white); }
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* ═══════════════════════════════════════════════
   FORM CONTROLS
═══════════════════════════════════════════════ */
.m-field { margin-bottom: 16px; }
.m-field label {
  display: block; font-family: var(--font-m); font-size: 9px;
  letter-spacing: 0.16em; color: var(--mute2); text-transform: uppercase; margin-bottom: 8px;
}
.m-field input,
.m-field textarea,
.m-field select,
.login-field input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 14px; color: var(--white);
  font-family: var(--font-b); font-size: 13px; outline: none;
  transition: all var(--trans); resize: vertical; appearance: none;
  -webkit-appearance: none;
}
.m-field input:focus,
.m-field textarea:focus,
.m-field select:focus {
  border-color: rgba(0,232,122,0.35);
  box-shadow: 0 0 0 3px rgba(0,232,122,0.06);
}
.m-field input::placeholder,
.m-field textarea::placeholder { color: var(--mute3); }
.m-field select option { background: var(--bg2); color: var(--white); }
.m-field textarea { line-height: 1.6; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.m-actions {
  display: flex; gap: 10px; margin-top: 24px; justify-content: flex-end;
  flex-wrap: wrap;
}
.m-note {
  font-size: 11px; color: var(--mute2); font-family: var(--font-m);
  margin-top: 6px; line-height: 1.6;
}
.key-display {
  background: var(--bg2); border: 1px solid rgba(0,232,122,0.25);
  border-radius: 9px; padding: 14px 16px;
  font-family: var(--font-m); font-size: 14px; color: var(--green);
  display: flex; align-items: center; justify-content: space-between;
  letter-spacing: 0.06em; word-break: break-all; margin-bottom: 8px;
  box-shadow: 0 0 20px rgba(0,232,122,0.05);
}
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* Date range */
.date-range-wrap { display: flex; align-items: center; gap: 6px; }
.date-range-sep { color: var(--mute2); font-family: var(--font-m); font-size: 11px; }
.date-range-wrap input {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
  color: var(--white); font-family: var(--font-m); font-size: 11px;
  outline: none; transition: all var(--trans); appearance: none; -webkit-appearance: none;
  color-scheme: dark;
}
.date-range-wrap input:focus { border-color: rgba(0,232,122,0.35); }

/* ═══════════════════════════════════════════════
   TABLE SYSTEM
═══════════════════════════════════════════════ */
.tbl-wrap {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 26px;
}
.tbl-toolbar {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(255,255,255,0.008);
}
.t-search {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
  color: var(--white); font-family: var(--font-b); font-size: 13px;
  outline: none; width: 210px; transition: all var(--trans);
}
.t-search:focus { border-color: rgba(0,232,122,0.3); box-shadow: 0 0 0 3px rgba(0,232,122,0.05); }
.t-search::placeholder { color: var(--mute3); }
.t-sel {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px;
  color: var(--mute1); font-family: var(--font-m); font-size: 11px;
  outline: none; cursor: pointer; transition: all var(--trans);
  appearance: none; -webkit-appearance: none;
}
.t-sel:focus { border-color: var(--line-hi); }
.t-sel option { background: var(--bg2); color: var(--white); }
.tbl-count {
  margin-left: auto; font-family: var(--font-m); font-size: 10px; color: var(--mute2);
}
.tbl-overflow { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.012); }
th {
  padding: 11px 16px; text-align: left;
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.18em;
  color: var(--mute2); text-transform: uppercase; font-weight: 400; white-space: nowrap;
}
td {
  padding: 13px 16px; font-size: 13px; color: var(--mute1);
  border-bottom: 1px solid rgba(255,255,255,0.03); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--trans); }
tbody tr:hover { background: rgba(255,255,255,0.018); }
.td-name { font-weight: 600; color: var(--white); font-size: 13px; }
.td-email { font-family: var(--font-m); font-size: 11px; color: var(--mute2); margin-top: 2px; }
.td-mono { font-family: var(--font-m); font-size: 11px; color: var(--mute1); }
.empty-row td { text-align: center; padding: 52px; color: var(--mute2); font-family: var(--font-m); font-size: 12px; }

/* Pagination */
.tbl-pagination {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 12px 16px; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.tbl-pagination button {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 7px; padding: 5px 10px;
  font-family: var(--font-m); font-size: 10px; color: var(--mute1);
  cursor: pointer; transition: all var(--trans);
}
.tbl-pagination button:hover { border-color: var(--line-hi); color: var(--white); }
.tbl-pagination button.active { background: var(--green-d); color: var(--green); border-color: rgba(0,232,122,0.25); }
.tbl-pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════
   BADGES / STATUS UI
═══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.08em;
  padding: 4px 9px; border-radius: 99px; white-space: nowrap;
}
.badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.badge-active    { background: var(--green-d); color: var(--green); border: 1px solid rgba(0,232,122,0.18); }
.badge-active::before { background: var(--green); box-shadow: 0 0 4px var(--green); }
.badge-pending   { background: var(--amber-d); color: var(--amber); border: 1px solid rgba(245,166,35,0.18); }
.badge-pending::before { background: var(--amber); }
.badge-rejected  { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.18); }
.badge-rejected::before { background: var(--red); }
.badge-disabled  { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.18); }
.badge-disabled::before { background: var(--red); }
.badge-none { background: rgba(255,255,255,0.04); color: var(--mute2); border: 1px solid var(--line); }
.badge-none::before { background: var(--mute3); }
.badge-blue { background: var(--blue-d); color: var(--blue); border: 1px solid rgba(77,171,247,0.18); }
.badge-blue::before { background: var(--blue); }
.badge-trial { background: var(--purple-d); color: var(--purple); border: 1px solid rgba(177,151,252,0.18); }
.badge-trial::before { background: var(--purple); }
.badge-suspended { background: var(--amber-d); color: var(--amber); border: 1px solid rgba(245,166,35,0.18); }
.badge-suspended::before { background: var(--amber); }
.badge-blocked { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.18); }
.badge-blocked::before { background: var(--red); }
.badge-inactive { background: rgba(255,255,255,0.04); color: var(--mute2); border: 1px solid var(--line); }
.badge-inactive::before { background: var(--mute3); }
.badge-expired { background: var(--amber-d); color: var(--amber); border: 1px solid rgba(245,166,35,0.18); }
.badge-expired::before { background: var(--amber); }
.badge-revoked { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.18); }
.badge-revoked::before { background: var(--red); }
.badge-unused { background: var(--blue-d); color: var(--blue); border: 1px solid rgba(77,171,247,0.18); }
.badge-unused::before { background: var(--blue); }

/* Fraud flag */
.fraud-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.08em;
  background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.25);
  padding: 3px 8px; border-radius: 99px; white-space: nowrap;
}

/* Device chip */
.device-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-m); font-size: 9px; letter-spacing: 0.06em;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; color: var(--mute1);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Key row */
.key-row { display: flex; align-items: center; gap: 6px; }
.key-val {
  font-family: var(--font-m); font-size: 11px; color: var(--green);
  background: var(--green-d); border: 1px solid rgba(0,232,122,0.15);
  border-radius: 6px; padding: 4px 9px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Trial */
.trial-row { display: flex; flex-direction: column; gap: 2px; }
.trial-status { font-size: 11px; color: var(--mute2); font-family: var(--font-m); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   USERS PAGE — BULK BAR
═══════════════════════════════════════════════ */
.bulk-bar {
  background: rgba(0,232,122,0.06); border-bottom: 1px solid rgba(0,232,122,0.15);
  padding: 10px 16px; display: none; align-items: center; gap: 10px; flex-wrap: wrap;
}
.bulk-bar.visible { display: flex; animation: fadeIn 0.18s ease; }
.bulk-count {
  font-family: var(--font-m); font-size: 10px; color: var(--green);
  letter-spacing: 0.06em; font-weight: 600; margin-right: 6px;
}
input[type="checkbox"] {
  accent-color: var(--green); cursor: pointer;
  width: 14px; height: 14px; border-radius: 3px;
}

/* ═══════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(18px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--bg1); border: 1px solid var(--line-hi);
  border-radius: var(--radius-xl); padding: 36px; width: 100%; max-width: 500px;
  max-height: 92vh; overflow-y: auto;
  animation: modalIn 0.22s cubic-bezier(0.34,1.2,0.64,1);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.04);
}
.modal-box.wide { max-width: 600px; }
.modal-box.xl   { max-width: 720px; }
@keyframes modalIn {
  from { transform: scale(0.94) translateY(12px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-hd {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px;
}
.modal-title { font-family: var(--font-h); font-size: 22px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; background: var(--bg3); border: 1px solid var(--line);
  border-radius: 7px; color: var(--mute1); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); flex-shrink: 0;
}
.modal-close:hover { color: var(--white); background: var(--bg4); }
.modal-sub { font-size: 13px; color: var(--mute1); margin-bottom: 24px; line-height: 1.6; }

/* Payment detail rows */
.payment-detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.payment-detail-row:last-of-type { border-bottom: none; }
.pdr-label { color: var(--mute2); font-family: var(--font-m); font-size: 10px; letter-spacing: 0.1em; }
.pdr-val { color: var(--white); font-weight: 600; text-align: right; max-width: 70%; word-break: break-all; }

/* Screenshot thumbnail */
.scr-thumb {
  width: 40px; height: 40px; border-radius: 7px; object-fit: cover;
  border: 1px solid var(--line); cursor: pointer; transition: all var(--trans);
}
.scr-thumb:hover { border-color: var(--line-hi); transform: scale(1.06); }

/* ═══════════════════════════════════════════════
   ACTIVITY FEED
═══════════════════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; }
.act-item {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  transition: background var(--trans);
}
.act-item:hover { background: rgba(255,255,255,0.018); }
.act-item:last-child { border-bottom: none; }
.act-ico {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.act-ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.act-login   { background: var(--blue-d); color: var(--blue); border: 1px solid rgba(77,171,247,0.15); }
.act-approve { background: var(--green-d); color: var(--green); border: 1px solid rgba(0,232,122,0.15); }
.act-reject  { background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.15); }
.act-key     { background: var(--purple-d); color: var(--purple); border: 1px solid rgba(177,151,252,0.15); }
.act-user    { background: rgba(255,255,255,0.04); color: var(--mute1); border: 1px solid var(--line); }
.act-pay     { background: var(--amber-d); color: var(--amber); border: 1px solid rgba(245,166,35,0.15); }
.act-system  { background: var(--cyan-d); color: var(--cyan); border: 1px solid rgba(0,212,255,0.15); }
.act-body { flex: 1; min-width: 0; }
.act-text { font-size: 13px; color: var(--mute1); line-height: 1.5; }
.act-text strong { color: var(--white); font-weight: 600; }
.act-time { font-family: var(--font-m); font-size: 10px; color: var(--mute2); margin-top: 3px; white-space: nowrap; }
.act-tag {
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   PLANS PAGE
═══════════════════════════════════════════════ */
.plans-stat-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.plan-stat-chip {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 9px; padding: 14px 20px;
  display: flex; flex-direction: column; gap: 5px; min-width: 110px;
}
.plan-stat-label {
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.18em;
  color: var(--mute2); text-transform: uppercase;
}
.plan-stat-val {
  font-family: var(--font-h); font-size: 26px; font-weight: 800; color: var(--white);
}
.plan-stat-val.green  { color: var(--green); }
.plan-stat-val.red    { color: var(--red); }
.plan-stat-val.amber  { color: var(--amber); }

.plans-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 18px; margin-bottom: 26px;
}
.plan-card {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 26px;
  transition: all var(--trans); position: relative;
  display: flex; flex-direction: column;
}
.plan-card:hover { border-color: var(--line-hi); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plan-card.featured { border-color: rgba(0,232,122,0.3); box-shadow: 0 0 30px rgba(0,232,122,0.06); }
.plan-card.plan-inactive { opacity: 0.52; }
.plan-featured-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: var(--bg);
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.14em;
  padding: 4px 14px; border-radius: 99px; font-weight: 700; white-space: nowrap;
}
.plan-inactive-tag {
  position: absolute; top: -12px; right: 16px;
  background: var(--red-d); color: var(--red); border: 1px solid rgba(255,77,77,0.3);
  font-family: var(--font-m); font-size: 8px; letter-spacing: 0.12em;
  padding: 4px 12px; border-radius: 99px;
}
.plan-name { font-family: var(--font-h); font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.plan-price {
  font-family: var(--font-h); font-size: 36px; font-weight: 800;
  line-height: 1; margin-bottom: 4px;
}
.plan-price span { font-size: 14px; font-weight: 400; color: var(--mute1); }
.plan-strike {
  font-family: var(--font-m); font-size: 11px; color: var(--mute2);
  text-decoration: line-through; margin-bottom: 4px;
}
.plan-desc { font-size: 12px; color: var(--mute1); margin-bottom: 18px; line-height: 1.6; }
.plan-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.plan-meta-row {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
}
.plan-meta-row svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.plan-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}

/* ═══════════════════════════════════════════════
   SETTINGS PAGE
═══════════════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-card {
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
.settings-card.full-width { grid-column: 1 / -1; }
.settings-card-title {
  font-family: var(--font-h); font-size: 15px; font-weight: 700;
  margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
}
.settings-card-title svg {
  width: 15px; height: 15px; stroke: var(--mute1); fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.settings-card-sub { font-size: 12px; color: var(--mute1); margin-bottom: 20px; line-height: 1.6; }

/* QR upload */
.qr-upload {
  border: 2px dashed var(--line-hi); border-radius: 10px;
  padding: 28px; text-align: center; cursor: pointer;
  transition: all var(--trans); position: relative; overflow: hidden;
}
.qr-upload:hover { border-color: rgba(0,232,122,0.35); background: var(--green-d); }
.qr-upload-icon { font-size: 28px; margin-bottom: 8px; }
.qr-upload-text { font-size: 12px; color: var(--mute1); }
#qr-preview { max-width: 120px; border-radius: 8px; margin: 12px auto 0; display: block; border: 1px solid var(--line); }

/* Toggle row */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line); gap: 12px;
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-info { flex: 1; }
.toggle-label { font-size: 13px; color: var(--mute1); }
.toggle-desc { font-family: var(--font-m); font-size: 9px; color: var(--mute2); margin-top: 2px; }
.toggle {
  width: 38px; height: 22px; background: var(--bg4);
  border-radius: 99px; position: relative; cursor: pointer;
  border: 1px solid var(--line); transition: all var(--trans); flex-shrink: 0;
}
.toggle.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 10px rgba(0,232,122,0.3); }
.toggle::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; background: var(--white);
  border-radius: 50%; top: 2px; left: 2px;
  transition: left var(--trans); box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.toggle.on::after { left: 18px; }

/* QR code wrap */
.qr-code-wrap {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 24px; text-align: center;
}
.qr-code-wrap img { max-width: 160px; margin: 0 auto; display: block; border-radius: 8px; }

/* System info live preview */
.settings-live-preview {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px;
}

/* ═══════════════════════════════════════════════
   INFO / WARN / SUCCESS NOTES
═══════════════════════════════════════════════ */
.info-note {
  background: var(--blue-d); border: 1px solid rgba(77,171,247,0.15);
  border-radius: 9px; padding: 12px 14px;
  font-size: 12px; color: var(--mute1); line-height: 1.7; margin-top: 14px;
}
.info-note strong { color: var(--blue); }
.warn-note {
  background: var(--amber-d); border: 1px solid rgba(245,166,35,0.15);
  border-radius: 9px; padding: 12px 14px;
  font-size: 12px; color: var(--mute1); line-height: 1.7; margin-top: 14px;
}
.warn-note strong { color: var(--amber); }
.success-note {
  background: var(--green-d); border: 1px solid rgba(0,232,122,0.15);
  border-radius: 9px; padding: 12px 14px;
  font-size: 12px; color: var(--mute1); line-height: 1.7; margin-top: 14px;
}
.success-note strong { color: var(--green); }

/* Update banner */
.update-banner {
  background: linear-gradient(135deg, rgba(0,232,122,0.08) 0%, rgba(77,171,247,0.06) 100%);
  border: 1px solid rgba(0,232,122,0.2); border-radius: 12px;
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.update-banner-text { font-size: 13px; color: var(--mute1); }
.update-banner-text strong { color: var(--white); }

/* ═══════════════════════════════════════════════
   EMPTY STATES
═══════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--mute2); font-family: var(--font-m); font-size: 12px; line-height: 1.8;
}
.empty-state svg {
  width: 42px; height: 42px; stroke: var(--mute3); fill: none;
  stroke-width: 1.4; margin: 0 auto 16px; display: block;
}
.empty-state strong {
  display: block; font-size: 14px; color: var(--mute2);
  margin-bottom: 6px; font-family: var(--font-h); font-weight: 600;
}

/* ═══════════════════════════════════════════════
   SKELETON / LOADING PLACEHOLDERS
═══════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 0%, var(--bg4) 50%, var(--bg3) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-row {
  height: 14px; border-radius: 4px; margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════
   COUPONS PAGE
═══════════════════════════════════════════════ */
.coupon-stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
#cp-plans-wrap {
  background: var(--bg2); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px; padding: 12px; max-height: 160px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
#cp-plans-wrap label {
  display: flex; align-items: center; gap: 10px; border-radius: 7px;
  padding: 6px 8px; cursor: pointer; transition: background var(--trans);
  font-size: 13px; color: var(--mute1);
}
#cp-plans-wrap label:hover { background: rgba(255,255,255,0.04); color: var(--white); }
.plan-sel-grid { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.plan-sel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background var(--trans); font-size: 13px; color: var(--mute1);
}
.plan-sel-item:hover { background: rgba(255,255,255,0.04); color: var(--white); }
.plan-sel-item input { accent-color: var(--green); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .dash-mini-grid { grid-template-columns: repeat(2,1fr); }
  .plans-grid { grid-template-columns: repeat(2,1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .dash-2col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  #sidebar { transform: translateX(-230px); width: 230px; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .dash-mini-grid { grid-template-columns: repeat(2,1fr); }
  #user-drawer { width: 100vw; right: -100vw; }
  #user-drawer.open { right: 0; }
  .m-grid { grid-template-columns: 1fr; }
  .m-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .dash-mini-grid { grid-template-columns: 1fr; }
  .dash-chips-row { gap: 6px; }
  .dash-chip { min-width: 100%; }
  .modal-box { padding: 24px 18px; }
  .login-wrap { padding: 36px 24px; width: 100%; max-width: 100%; border-radius: 16px; }
  .login-title { font-size: 28px; }
  .sec-hd { flex-direction: column; align-items: flex-start; }
  .sec-actions { width: 100%; flex-wrap: wrap; }
  .tbl-toolbar { gap: 8px; }
  .t-search { width: 100%; }
  .drawer-body { padding: 16px; }
  .settings-card.full-width { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .topbar-time { display: none; }
  .bulk-bar { flex-wrap: wrap; }
  .plans-grid { grid-template-columns: 1fr; }
  .confirm-actions { flex-direction: column; }
  .m-actions { flex-direction: column; }
  .m-actions .btn { width: 100%; justify-content: center; }
  .btn-login { font-size: 12px; }
  .modal { padding: 10px; }
}

/* ═══════════════════════════════════════════════
   MISC / POLISH OVERRIDES
═══════════════════════════════════════════════ */

/* Ensure login screen hidden on app load-in */
#login-screen.hidden { display: none; }

/* App hidden before auth */
#app { display: none; }
#app.visible { display: flex; }

/* Login error shown state */
.login-err.show { display: block; }

/* SVG reset in table/action areas */
.sb-item svg, .sec-title svg, .stat-label svg,
.act-ico svg, .plan-meta-row svg, .settings-card-title svg {
  stroke-linecap: round; stroke-linejoin: round;
}

/* Fix modal backdrop click behavior */
.modal { cursor: default; }

/* Focus ring removal for mouse clicks */
button:focus:not(:focus-visible) { outline: none; }
input:focus:not(:focus-visible) { outline: none; }

/* Activity log page wrapper fix */
#activity-list { min-height: 200px; }

/* Plan features list inside card */
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-bottom: 18px; }
.plan-features li {
  font-size: 12px; color: var(--mute1); display: flex; align-items: center; gap: 7px;
  font-family: var(--font-m);
}
.plan-features li::before {
  content: '✓'; color: var(--green); font-size: 10px; font-weight: 700; flex-shrink: 0;
}

/* Reviews stars */
.stars { color: var(--amber); letter-spacing: 1px; }

/* Admin note field in payments */
.admin-note-cell {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 11px; color: var(--mute2); font-family: var(--font-m);
}

/* Approved payment key column */
.pay-key-col { display: flex; align-items: center; gap: 5px; }

/* Days left colored indicators */
.days-critical { color: var(--red); font-family: var(--font-m); font-size: 11px; font-weight: 600; }
.days-warn     { color: var(--amber); font-family: var(--font-m); font-size: 11px; font-weight: 600; }
.days-ok       { color: var(--green); font-family: var(--font-m); font-size: 11px; }

/* Update history area */
#update-history-area {
  display: flex; flex-direction: column; gap: 8px;
}
.update-hist-row {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.update-hist-ver {
  font-family: var(--font-m); font-size: 11px; color: var(--green);
  font-weight: 600;
}
.update-hist-date {
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
}
.update-hist-notes { font-size: 12px; color: var(--mute1); line-height: 1.5; flex: 1; }

/* Dashboard payment row actions */
.dash-pay-actions { display: flex; gap: 5px; }

/* Coupon recent redeemers */
.redeemers-list {
  display: flex; flex-direction: column; gap: 4px;
}
.redeemer-chip {
  font-family: var(--font-m); font-size: 10px; color: var(--mute1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Key history modal list */
#key-history-list { display: flex; flex-direction: column; gap: 8px; }
.kh-row {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.kh-key {
  font-family: var(--font-m); font-size: 12px; color: var(--green);
  letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px;
}
.kh-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
}

/* Device history area */
.device-hist-list { display: flex; flex-direction: column; gap: 6px; }
.device-hist-row {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px;
  font-family: var(--font-m); font-size: 11px; color: var(--mute1);
  display: flex; align-items: center; justify-content: space-between;
}

/* Topbar breadcrumb root */
.topbar-breadcrumb-root { color: var(--mute2); }

/* Import/export button style */
.btn-ghost[onclick*="import"],
.btn-ghost[onclick*="Import"] { border-style: dashed; }

/* Bottom spacing for last page section */
#pages .page:last-child { padding-bottom: 48px; }

/* Drawer payment item */
.drawer-pay-item {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 14px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color var(--trans);
}
.drawer-pay-item:hover { border-color: var(--line-hi); }
.drawer-pay-hd { display: flex; align-items: center; justify-content: space-between; }
.drawer-pay-plan { font-size: 13px; font-weight: 600; color: var(--white); }
.drawer-pay-amount { font-family: var(--font-m); font-size: 12px; color: var(--amber); }
.drawer-pay-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-m); font-size: 10px; color: var(--mute2);
}

/* Coupon usage in drawer */
.drawer-coupon-item {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; margin-bottom: 8px;
}
.drawer-coupon-code {
  font-family: var(--font-m); font-size: 12px; color: var(--purple);
  letter-spacing: 0.1em; margin-bottom: 4px;
}
.drawer-coupon-meta { font-family: var(--font-m); font-size: 10px; color: var(--mute2); }

/* Global body scroll lock when drawer/modal open */
body.drawer-open { overflow: hidden; }
