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

:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --panel-2: #16213b;
  --border: #1f2b47;
  --text: #e6edf7;
  --muted: #8896b3;
  --primary: #4f8cff;
  --primary-hover: #3a78ec;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.break-all { word-break: break-all; }

.mobile-only { display: none; }
.desktop-only { display: block; }

/* ─── AUTH OVERLAY ─── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
}
.overlay-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.overlay-card h2 { margin-bottom: 8px; font-size: 1.2rem; }
.overlay-card input, .overlay-card button { width: 100%; margin-top: 12px; }
.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }

/* ─── LAYOUT ─── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── TOP BAR ─── */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  padding-top: calc(12px + var(--safe-top));
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

body:not(.is-admin) .topbar {
  justify-content: flex-start;
}
.topbar:not(:has(.tabs:not(.hidden))) {
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.15s;
}
.logo:active { transform: scale(0.95); }
.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  pointer-events: none;
}
.brand h1 { font-size: 1.05rem; line-height: 1.2; }

.tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--border);
}

.stats { display: flex; gap: 8px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 10px;
  border-left: 1px solid var(--border);
  min-width: 80px;
}
.stat-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-weight: 700; font-size: 1.05rem; color: var(--text); }

/* ─── BOTTOM NAV (mobile only) ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.bottom-tab {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 6px 4px;
    transition: color 0.15s;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.bottom-tab:not([style*="display: none"]) { display: flex; }
.bottom-tab[style*="display: none"] { display: none !important; }
.bottom-tab .bottom-icon { font-size: 1.2rem; line-height: 1; }
.bottom-tab .bottom-label { font-size: 0.68rem; font-weight: 500; }
.bottom-tab:active { background: var(--panel-2); }
.bottom-tab.active { color: var(--primary); }

/* ─── CONTAINER ─── */
.container {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* ─── TABS / PANELS ─── */
.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ─── CARDS ─── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
}
.card h2 { font-size: 1.1rem; margin-bottom: 4px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 10px; flex-wrap: wrap;
}
.card p.muted { margin-bottom: 16px; }

/* ─── FORMS ─── */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row input { flex: 1; min-width: 200px; }

input[type="text"], input[type="password"], input[type="number"], input[type="tel"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
input:focus { border-color: var(--primary); }

/* ─── BUTTONS ─── */
.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover:not(:disabled) { background: #1d2a4a; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ─── STATUS BOX ─── */
.status {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
  font-size: 0.92rem;
}
.status.loading { border-color: var(--primary); }
.status.success { border-color: var(--success); }
.status.error   { border-color: var(--danger); }
.status.info    { border-color: var(--warning); }

.status .spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.otp-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.otp-row input {
  flex: 1;
  min-width: 140px;
  font-family: ui-monospace, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 14px;
}

.kv {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.kv-label { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; }
.kv-value { font-weight: 600; text-align: right; }

/* ─── TABLE (desktop) ─── */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table tbody tr:hover { background: var(--panel-2); }

/* ─── ACCOUNTS CARDS ─── */
.accounts-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.acc-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  position: relative;
}
.acc-card.selected {
  border-color: var(--primary);
  background: rgba(79,140,255,0.06);
}
.acc-card .acc-phone {
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-right: 80px;
}
.acc-card .acc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 0.88rem;
}
.acc-card .acc-row .acc-label { color: var(--muted); }
.acc-card .acc-row .acc-value {
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

/* ─── ACCOUNT CARD — ADMIN CONTROLS ─── */
.acc-card-admin-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.acc-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}
.acc-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  margin: 0;
  padding: 0;
  min-height: auto;
}
.acc-delete-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.acc-delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.acc-delete-btn:active { transform: scale(0.92); }

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.success { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); color: #6ee7b7; }
.badge.muted { color: var(--muted); }
.badge.primary { background: rgba(79,140,255,0.15); border-color: rgba(79,140,255,0.3); color: #93c5fd; }

/* ─── WARNING BANNER ─── */
.warning-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ─── TOASTS ─── */
#toasts {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  max-width: 340px;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideIn 0.25s ease;
  font-size: 0.9rem;
  pointer-events: auto;
  word-break: break-word;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.info    { border-left-color: var(--warning); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════
   📱 MOBILE (≤ 780px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 780px) {
  .mobile-only { display: block; }
  .desktop-only { display: none; }

  .topbar {
    padding: 10px 16px;
    padding-top: calc(10px + var(--safe-top));
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  .brand { flex: 1; min-width: 0; }
  .brand-text { min-width: 0; }
  .brand h1 { font-size: 0.95rem; }
  .brand p { font-size: 0.72rem; }

  .tabs { display: none; }

  .logo { width: 36px; height: 36px; }

  .stats { gap: 0; }
  .stat {
    min-width: auto;
    padding: 2px 8px;
    border-left: 1px solid var(--border);
  }
  .stat:first-child { border-left: none; }
  .stat-label { font-size: 0.6rem; white-space: nowrap; }
  .stat-value { font-size: 0.95rem; }

  .bottom-nav { display: flex; }

  .container {
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }
  body.is-admin .container {
    padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 16px);
  }

  .card { padding: 18px 16px; border-radius: 12px; }
  .card h2 { font-size: 1.05rem; }
  .card p.muted { font-size: 0.88rem; }

  .form-row { flex-direction: column; gap: 10px; }
  .form-row input { min-width: 0; width: 100%; }
  .form-row .btn { width: 100%; padding: 14px 18px; font-size: 1rem; }

  .otp-row { flex-direction: column; }
  .otp-row input { width: 100%; min-width: 0; }
  .otp-row .btn { width: 100%; padding: 14px 18px; font-size: 1rem; }

  .kv { padding: 12px 0; }
  .kv-label { font-size: 0.82rem; }
  .kv-value { font-size: 0.9rem; }

  .card-header { gap: 8px; }
  .card-header h2 { font-size: 1rem; }
  #refreshAccountsBtn { padding: 8px 14px; font-size: 0.85rem; min-height: 40px; }

  #toasts {
    right: 12px;
    left: 12px;
    bottom: calc(12px + var(--safe-bottom));
    max-width: none;
  }
  body.is-admin #toasts {
    bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 12px);
  }
  .toast { font-size: 0.85rem; padding: 10px 14px; }

  .overlay-card { padding: 24px 20px; }
  .overlay-card h2 { font-size: 1.1rem; }
}

@media (max-width: 400px) {
  .container { padding: 12px; padding-bottom: calc(12px + var(--safe-bottom)); }
  body.is-admin .container { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 12px); }
  .card { padding: 16px 14px; }
  .brand p { display: none; }
  .stat-label { font-size: 0.55rem; }
  .stat-value { font-size: 0.88rem; }
  .bottom-label { font-size: 0.62rem; }
  .acc-card .acc-phone { font-size: 0.95rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 6px 16px; padding-top: calc(6px + var(--safe-top)); }
  .bottom-nav { height: calc(52px + var(--safe-bottom)); }
  .container { padding: 12px 16px; padding-bottom: calc(12px + var(--safe-bottom)); }
  body.is-admin .container { padding-bottom: calc(52px + var(--safe-bottom) + 12px); }
}

/* ─── PHONE HINT ─── */
.phone-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: -4px 0 12px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.phone-hint code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #93c5fd;
}
.phone-hint.match { color: #6ee7b7; }
.phone-hint.match code { color: #6ee7b7; border-color: rgba(34,197,94,0.3); }
.phone-hint.error { color: #fca5a5; }

/* ─── TWO-COLUMN FORM ROW ─── */
.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row.two-col input { min-width: 0; width: 100%; }
@media (max-width: 600px) {
  .form-row.two-col { grid-template-columns: 1fr; }
}

/* ─── REQUIRED MARKER ─── */
input.required-empty { border-color: var(--danger) !important; }
input.required-empty::placeholder { color: #fca5a5; }

/* ─── ADMIN STYLES ─── */
.admin-logout-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    min-height: 0;
    margin-top: 2px;
}
.admin-logout-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

body.is-admin .brand h1::after {
    content: ' ADMIN';
    font-size: 0.6rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.admin-only.hidden { display: none !important; }

#adminLoginOverlay .overlay-card { border-color: rgba(251, 191, 36, 0.3); }
#adminLoginOverlay h2 { color: #fbbf24; }
#adminLoginOverlay input[type="text"],
#adminLoginOverlay input[type="password"] {
    width: 100%;
    margin-top: 10px;
}
#adminLoginOverlay .btn { width: 100%; margin-top: 10px; }

/* ─── CAPACITY BAR ─── */
.capacity-bar {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.capacity-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 8px;
    gap: 12px;
    flex-wrap: wrap;
}
.capacity-track {
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
}
.capacity-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 999px;
    transition: width 0.4s ease;
}
.capacity-bar.warn .capacity-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.capacity-bar.danger .capacity-fill { background: linear-gradient(90deg, #ef4444, #f87171); }
.capacity-bar.warn #capRemaining { color: #fbbf24; }
.capacity-bar.danger #capRemaining { color: #fca5a5; }

/* ─── DASHBOARD STATS ─── */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.dash-stat-sub {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.dash-stat {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.dash-stat-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.dash-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.dash-capacity-section {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── LEADERBOARD ─── */
.leader-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.leader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
}
.leader-rank {
    color: var(--muted);
    font-size: 0.78rem;
    min-width: 32px;
    font-weight: 600;
}
.leader-name {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.leader-count {
    color: #6ee7b7;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
    .dash-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 780px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
    .dash-stat-value { font-size: 1.3rem; }
    .dash-stat-sub { font-size: 0.68rem; }
    .dash-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   ACCOUNTS TOOLBAR + GROUPED VIEW
   ═══════════════════════════════════════════════════════ */
.accounts-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.accounts-toolbar input[type="search"] {
    flex: 1;
    min-width: 200px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    min-height: 44px;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.accounts-toolbar input[type="search"]:focus { border-color: var(--primary); }
.accounts-toolbar input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    height: 16px;
    width: 16px;
    background: var(--muted);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center/contain no-repeat;
}

.group-toggle {
    display: flex;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}
.group-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    border-right: 1px solid var(--border);
}
.group-btn:last-child { border-right: none; }
.group-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.group-btn.active { background: var(--primary); color: #fff; }

.accounts-summary {
    padding: 10px 14px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 14px;
}
.accounts-summary b { color: var(--text); }

/* ─── GROUPS ─── */
.account-group {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel);
}
.account-group-header {
    width: 100%;
    background: var(--panel-2);
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}
.account-group-header:hover { background: #1d2a4a; }
.account-group-header:active { background: #253154; }
.group-chevron {
    color: var(--muted);
    font-size: 0.75rem;
    width: 14px;
    display: inline-block;
    transition: transform 0.15s;
}
.group-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.group-count {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}
.account-group-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
}

.account-flat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.accounts-grouped .acc-card { margin: 0; }

@media (max-width: 780px) {
    .accounts-toolbar { flex-direction: column; align-items: stretch; }
    .accounts-toolbar input[type="search"] { min-width: 0; width: 100%; }
    .group-toggle { width: 100%; }
    .group-btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 0.78rem; }
    .account-group-header { padding: 12px 14px; font-size: 0.9rem; }
    .account-group-body { padding: 8px; }
}

/* ─── PHONE CHECK STATUS ─── */
.phone-check {
    margin: 8px 0 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
    background: var(--panel-2);
    border: 1px solid var(--border);
}
.phone-check.loading {
    border-color: var(--primary);
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.phone-check.ok {
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.35);
    color: #6ee7b7;
}
.phone-check.error {
    background: rgba(239,68,68,0.10);
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}
.phone-check.warn {
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.35);
    color: #fcd34d;
}
.phone-check .spinner {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ─── HEADER ACTIONS ─── */
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
@media (max-width: 780px) {
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; min-width: 0; }
}

/* ─── BULK ACTION BAR ─── */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.bulk-select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.bulk-select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
    padding: 0;
    min-height: auto;
}
.bulk-count {
    flex: 1;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}
.bulk-action-bar .btn.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 38px;
}
.bulk-action-bar .btn.danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

@media (max-width: 780px) {
    .bulk-action-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .bulk-action-bar .btn.danger { width: 100%; }
    .bulk-count { text-align: center; }
    .acc-card-admin-controls { top: 8px; right: 8px; }
    .acc-card .acc-phone { padding-right: 70px; }
}

/* ─── OTP ERROR HINT ─── */
.otp-error-msg {
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.35);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ─── BULK CREATE (multi-card OTP) ─── */
.bulk-create-header {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}
.bulk-create-header input[type="tel"] { flex: 1; min-width: 0; }
.bulk-create-header .btn { white-space: nowrap; }
.bulk-create-counter {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 4px 0 16px;
    font-weight: 500;
}
.bulk-create-counter.full { color: #fca5a5; }

.bulk-flow-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.bulk-flow-card {
    position: relative;
    background: #0d1526;
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: 10px;
    padding: 16px 18px;
    padding-right: 50px;
    transition: border-color 0.15s;
}
.bulk-flow-card.stage-done            { border-left-color: var(--success); }
.bulk-flow-card.stage-done_no_password{ border-left-color: var(--primary); }
.bulk-flow-card.stage-error           { border-left-color: var(--danger); }

.bulk-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: inherit;
    padding: 0;
    min-height: 0;
}
.bulk-close-btn:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
    color: #fca5a5;
}

.bulk-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 0;
    font-size: 0.88rem;
    min-height: 30px;
    flex-wrap: wrap;
}
.bulk-label {
    width: 100px;
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.bulk-value {
    color: var(--text);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    word-break: break-all;
}
.bulk-value.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.bulk-status {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bulk-status.pending { color: var(--warning); }
.bulk-status.success { color: var(--success); }
.bulk-status.warn    { color: var(--warning); }
.bulk-status.error   { color: var(--danger); }
.bulk-error { color: #fca5a5; font-size: 0.82rem; }
.bulk-info { color: #fcd34d; font-size: 0.82rem; }

.bulk-otp-group {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: center;
    min-width: 0;
}
.bulk-otp-input {
    flex: 1;
    min-width: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 8px;
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
    outline: none;
    min-height: 42px;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.bulk-otp-input:focus { border-color: var(--primary); }
.bulk-otp-input::placeholder {
    letter-spacing: 0.1em;
    color: var(--muted);
    opacity: 0.6;
}
.bulk-verify-btn {
    padding: 8px 20px;
    min-height: 38px;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.bulk-flow-card .spinner {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@media (max-width: 600px) {
    .bulk-create-header { flex-direction: column; }
    .bulk-create-header .btn { width: 100%; }
    .bulk-flow-card { padding: 14px; padding-right: 46px; }
    .bulk-label { width: 68px; font-size: 0.66rem; }
    .bulk-value.mono { font-size: 0.95rem; }
    .bulk-row { gap: 8px; }

    /* ✅ OTP: side-by-side, input compact */
    .bulk-otp-group {
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }
    .bulk-otp-input {
        flex: 1;
        min-width: 0;
        font-size: 1rem;
        letter-spacing: 0.08em;
        padding: 10px 6px;
        min-height: 44px;
    }
    .bulk-verify-btn {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 0.78rem;
        min-height: 44px;
        white-space: nowrap;
    }
}

/* Extra small phones (≤ 400px) */
@media (max-width: 400px) {
    .bulk-label { width: 58px; font-size: 0.6rem; }
    .bulk-otp-input {
        font-size: 0.95rem;
        letter-spacing: 0.05em;
        padding: 10px 4px;
    }
    .bulk-verify-btn {
        padding: 10px 10px;
        font-size: 0.72rem;
    }
}

/* ─── CREATE STATS BAR (Today + Yesterday + All) ─── */
.create-stats {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 16px;
    gap: 16px;
}
.create-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
}
.create-stat-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.create-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.create-stat-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 4px 0;
}
@media (max-width: 780px) {
    .create-stats { padding: 14px 12px; border-radius: 12px; gap: 8px; }
    .create-stat-value { font-size: 1.3rem; }
    .create-stat-label { font-size: 0.62rem; letter-spacing: 0.05em; }
}
@media (max-width: 400px) {
    .create-stat-value { font-size: 1.15rem; }
    .create-stat-label { font-size: 0.58rem; }
}

/* ═══════════════════════════════════════════════════════
   ROLE SELECTION (modern redesign)
   ═══════════════════════════════════════════════════════ */

.role-select-card {
    max-width: 460px;
    padding: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #131e38 0%, #0d1526 100%);
    border: 1px solid rgba(79, 140, 255, 0.15);
}

.role-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(79, 140, 255, 0.25) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: roleGlowPulse 4s ease-in-out infinite;
}

@keyframes roleGlowPulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.role-hero {
    position: relative;
    z-index: 1;
    padding: 36px 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.role-logo-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
}

.role-logo-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #4f8cff, #a855f7, #4f8cff);
    opacity: 0.5;
    animation: roleRingSpin 6s linear infinite;
    filter: blur(6px);
}

@keyframes roleRingSpin {
    to { transform: rotate(360deg); }
}

.role-logo-img {
    position: relative;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(79, 140, 255, 0.4);
    background: #0b1220;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.role-hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.2;
    margin: 0;
}

.role-hero-sub {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

.role-buttons {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 20px 24px;
    margin-top: 4px;
}

.role-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(22, 33, 59, 0.6);
    border: 1px solid rgba(79, 140, 255, 0.15);
    border-radius: 14px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-align: left;
    overflow: hidden;
}

.role-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.role-btn:hover::before { opacity: 1; }

.role-btn:hover {
    border-color: rgba(79, 140, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(79, 140, 255, 0.15);
}

.role-btn:active {
    transform: translateY(0) scale(0.99);
}

.role-btn[data-role="agent"]:hover {
    border-color: rgba(79, 140, 255, 0.5);
    box-shadow: 0 12px 32px rgba(79, 140, 255, 0.2);
}

.role-btn[data-role="maker"]:hover {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 12px 32px rgba(168, 85, 247, 0.2);
}

/* Icon bubble */
.role-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s;
}

.role-btn[data-role="agent"] .role-icon {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.18) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(79, 140, 255, 0.25);
}

.role-btn[data-role="maker"] .role-icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18) 0%, rgba(236, 72, 153, 0.1) 100%);
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.role-btn:hover .role-icon {
    transform: scale(1.08) rotate(-3deg);
}

.role-icon-emoji {
    font-size: 1.4rem;
    line-height: 1;
}

/* Content */
.role-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.role-label {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.role-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.3;
    transition: color 0.2s;
}

/* Arrow */
.role-arrow {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
}

.role-btn:hover .role-arrow {
    color: #93c5fd;
    transform: translateX(4px);
}

.role-btn[data-role="maker"]:hover .role-arrow {
    color: #d8b4fe;
}

/* Remembered state */
.role-btn.remembered {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(22, 33, 59, 0.6) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.role-btn.remembered .role-desc {
    color: #6ee7b7;
    font-weight: 600;
}

.role-btn.remembered .role-arrow {
    color: #6ee7b7;
}

.role-btn.remembered::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 44px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
    animation: rememberedPulse 1.5s ease-in-out infinite;
}

@keyframes rememberedPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

/* Forget button */
.role-forget-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: inherit;
    padding: 0;
    z-index: 2;
}

.role-forget-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    transform: scale(1.1);
}

.role-forget-btn.hidden { display: none; }


/* Entrance animation */
.role-select-card {
    animation: roleCardIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes roleCardIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.role-btn {
    animation: roleBtnIn 0.35s ease backwards;
}

.role-btn:nth-child(1) { animation-delay: 0.08s; }
.role-btn:nth-child(2) { animation-delay: 0.16s; }

@keyframes roleBtnIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Light mode adjustments */
body.light-mode .role-select-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: rgba(79, 140, 255, 0.2);
}
body.light-mode .role-glow {
    background: radial-gradient(circle, rgba(79, 140, 255, 0.15) 0%, transparent 70%);
}
body.light-mode .role-hero-title {
    background: linear-gradient(135deg, #0f172a 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
body.light-mode .role-btn {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}
body.light-mode .role-btn:hover {
    border-color: rgba(79, 140, 255, 0.4);
    box-shadow: 0 12px 32px rgba(79, 140, 255, 0.12);
}

/* Mobile */
@media (max-width: 480px) {
    .role-select-card { max-width: calc(100vw - 32px); }
    .role-hero { padding: 28px 20px 16px; }
    .role-hero-title { font-size: 1.3rem; }
    .role-buttons { padding: 8px 16px 20px; gap: 8px; }
    .role-btn { padding: 14px 14px; gap: 12px; }
    .role-icon { width: 42px; height: 42px; }
    .role-icon-emoji { font-size: 1.25rem; }
    .role-label { font-size: 0.92rem; }
    .role-desc { font-size: 0.72rem; }
}
.role-btn.remembered {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.05);
}
.role-btn.remembered .role-desc {
    color: #6ee7b7;
    font-weight: 600;
}

/* ─── ROLE FORGET BUTTON ─── */
.role-forget-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: inherit;
    padding: 0;
}
.role-forget-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}
.role-forget-btn.hidden { display: none; }

/* ─── REMEMBER ME ─── */
.remember-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    width: 100%;
    box-sizing: border-box;
}
.remember-row input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
    display: inline-block !important;
    position: static !important;
}
.remember-row span {
    flex: 1 1 auto;
    line-height: 1.4;
    word-break: break-word;
}

/* ─── USER MANAGEMENT ─── */
.form-label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.03em;
}
.form-select {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    width: 100%;
    min-height: 44px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238896b3' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px;
    padding-right: 36px;
}
.form-select:focus { border-color: var(--primary); }

/* ─── USERS SEARCH ─── */
.users-search-wrap { margin-bottom: 12px; }
.users-search-input {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    min-height: 44px;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.users-search-input:focus { border-color: var(--primary); }
.users-search-input::placeholder { color: var(--muted); opacity: 0.7; }
.users-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    height: 16px;
    width: 16px;
    background: var(--muted);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center/contain no-repeat;
}

.users-filter {
    display: flex;
    gap: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
    width: fit-content;
}
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.user-card-main { flex: 1; min-width: 0; }
.user-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.user-card-username { font-weight: 700; font-size: 0.95rem; }
.user-card-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text);
    align-items: center;
}
.user-card-actions { display: flex; gap: 4px; }
.user-card-actions .btn { padding: 6px 10px; min-height: 34px; font-size: 0.9rem; }

/* ─── USER CARD COUNTS ─── */
.user-card-counts {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.count-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(79,140,255,0.12);
    border: 1px solid rgba(79,140,255,0.3);
    color: #93c5fd;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
}
.count-chip b { font-weight: 700; color: #fff; }
.count-chip.today {
    background: rgba(34,197,94,0.12);
    border-color: rgba(34,197,94,0.35);
    color: #6ee7b7;
}
.count-chip.big { padding: 6px 14px; font-size: 0.85rem; }
.count-chip.big b { font-size: 1.1rem; margin-right: 4px; }

/* ─── MINI BAR (agent summary) ─── */
.mini-bar-wrap {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}
.mini-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f8cff, #22c55e);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* Role visibility helpers */
body:not(.is-admin) .admin-only.hidden { display: none !important; }
body:not(.is-agent) .role-agent-only.hidden { display: none !important; }
body:not(.is-maker) .role-maker-only.hidden { display: none !important; }
body.is-admin .public-only,
body.is-agent .public-only,
body.is-maker .public-only { display: none !important; }

/* ═══════════════════════════════════════════════════════
   AGENT SUMMARY (single canonical block)
   ═══════════════════════════════════════════════════════ */
.agent-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.agent-summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    gap: 6px;
    transition: border-color 0.15s;
}
.agent-summary-item:hover { border-color: var(--primary); }
.agent-summary-label {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    text-align: center;
}
.agent-summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.agent-summary-value.highlight { color: #93c5fd; }
.agent-summary-value.success { color: #6ee7b7; }

@media (max-width: 600px) {
    .agent-summary { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .agent-summary-item { padding: 10px 6px; }
    .agent-summary-value { font-size: 1.3rem; }
    .agent-summary-label { font-size: 0.6rem; }
}

/* ═══════════════════════════════════════════════════════
   HISTORY TOOLBAR (agent + maker)
   ═══════════════════════════════════════════════════════ */
.history-toolbar {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.history-search-input {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    min-height: 44px;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.history-search-input:focus { border-color: var(--primary); }
.history-search-input::placeholder { color: var(--muted); opacity: 0.7; }
.history-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.history-filter-btn {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 14px;
    color: var(--muted);
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    min-height: 34px;
}
.history-filter-btn:hover {
    color: var(--text);
    background: #1d2a4a;
}
.history-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
@media (max-width: 600px) {
    .history-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .history-filter-btn { flex-shrink: 0; }
}

/* ═══════════════════════════════════════════════════════
   HISTORY LIST (single canonical block)
   ═══════════════════════════════════════════════════════ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.history-row {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.history-row:hover { border-color: var(--primary); }
.history-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(79, 140, 255, 0.12);
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 700;
}
.history-phone {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: var(--text);
}
.history-date {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
    .history-row {
        grid-template-columns: 32px 1fr;
        grid-template-rows: auto auto;
        gap: 4px 10px;
        padding: 10px 12px;
    }
    .history-num {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        grid-row: 1 / 3;
        align-self: center;
    }
    .history-phone { font-size: 0.95rem; }
    .history-date { font-size: 0.72rem; grid-column: 2; }
}

/* Hide search/toolbar for maker/agent in accounts tab */
body.is-maker #panel-accounts .accounts-toolbar,
body.is-maker #panel-accounts .bulk-action-bar,
body.is-maker #panel-accounts .group-toggle,
body.is-agent #panel-accounts .accounts-toolbar,
body.is-agent #panel-accounts .bulk-action-bar,
body.is-agent #panel-accounts .group-toggle {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════
   THEME TOGGLE
   ═══════════════════════════════════════════════════════ */
.theme-toggle {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}
.theme-toggle:hover { background: #1d2a4a; transform: scale(1.05); }
.theme-toggle:active { transform: scale(0.95); }

@media (max-width: 780px) {
    .theme-toggle { width: 36px; height: 36px; font-size: 1rem; }
}

/* ═══════════════════════════════════════════════════════
   LIGHT MODE
   ═══════════════════════════════════════════════════════ */
body.light-mode {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
}
body.light-mode .topbar,
body.light-mode .bottom-nav {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
body.light-mode .card,
body.light-mode .acc-card,
body.light-mode .user-card,
body.light-mode .history-row,
body.light-mode .status,
body.light-mode .capacity-bar,
body.light-mode .phone-check,
body.light-mode .leader-row,
body.light-mode .account-group,
body.light-mode .bulk-flow-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
body.light-mode .bulk-flow-card { background: #ffffff; }
body.light-mode .account-group-body { background: #f8fafc; }
body.light-mode .account-group-header:hover { background: #e2e8f0; }
body.light-mode .account-group-header:active { background: #cbd5e1; }
body.light-mode .btn:hover:not(:disabled) { background: #e2e8f0; }
body.light-mode .theme-toggle:hover { background: #e2e8f0; }
body.light-mode .history-filter-btn:hover { background: #e2e8f0; color: var(--text); }
body.light-mode .group-btn:hover { background: #e2e8f0; }
body.light-mode .tab:hover { background: #e2e8f0; }
body.light-mode .tab.active {
    background: #e0e7ff;
    color: var(--primary);
    border-color: #c7d2fe;
}
body.light-mode .overlay { background: rgba(15, 23, 42, 0.55); }
body.light-mode .toast { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
body.light-mode .badge.success { background: rgba(34,197,94,0.12); }
body.light-mode .badge.primary { background: rgba(59,130,246,0.12); }
body.light-mode .count-chip { background: rgba(59,130,246,0.10); }
body.light-mode .count-chip.today { background: rgba(34,197,94,0.10); }
body.light-mode .history-num { background: rgba(59,130,246,0.10); }
body.light-mode .bottom-tab:active { background: #e2e8f0; }


/* ═══════════════════════════════════════════════════════
   LOADING SKELETON (perceived performance boost)
   ═══════════════════════════════════════════════════════ */
.loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 100px;
    background: linear-gradient(
        90deg,
        var(--panel-2) 25%,
        var(--border) 50%,
        var(--panel-2) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 14px;
    border: 1px solid var(--border);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

body.light-mode .skeleton-card {
    background: linear-gradient(
        90deg,
        #f8fafc 25%,
        #e2e8f0 50%,
        #f8fafc 75%
    );
    background-size: 200% 100%;
}

/* ═══════════════════════════════════════════════════════
   LOGIN CARDS (modern redesign)
   ═══════════════════════════════════════════════════════ */

.login-card {
    max-width: 420px !important;
    padding: 0 !important;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #131e38 0%, #0d1526 100%) !important;
    border: 1px solid rgba(79, 140, 255, 0.15) !important;
    border-radius: 20px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: loginCardIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.login-card-admin { border-color: rgba(251, 191, 36, 0.25) !important; }
.login-card-agent { border-color: rgba(79, 140, 255, 0.25) !important; }
.login-card-maker { border-color: rgba(168, 85, 247, 0.25) !important; }

.login-glow {
    position: absolute;
    top: -140px; left: 50%;
    transform: translateX(-50%);
    width: 360px; height: 360px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: loginGlowPulse 4s ease-in-out infinite;
}
.login-card-admin .login-glow { background: radial-gradient(circle, rgba(251, 191, 36, 0.25) 0%, transparent 70%); }
.login-card-agent .login-glow { background: radial-gradient(circle, rgba(79, 140, 255, 0.25) 0%, transparent 70%); }
.login-card-maker .login-glow { background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, transparent 70%); }

@keyframes loginGlowPulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50%      { opacity: 1;   transform: translateX(-50%) scale(1.08); }
}

.login-hero {
    position: relative; z-index: 1;
    padding: 32px 28px 8px;
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
}

.login-icon-wrap {
    width: 64px; height: 64px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center; justify-content: center;
    position: relative;
    margin-bottom: 4px;
}

.login-icon-wrap::before {
    content: '';
    position: absolute;
    inset: -4px; border-radius: 22px;
    opacity: 0.35;
    filter: blur(10px);
    z-index: -1;
    animation: loginIconPulse 3s ease-in-out infinite;
}

@keyframes loginIconPulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50%      { opacity: 0.6;  transform: scale(1.06); }
}

.login-icon-admin {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
}
.login-icon-admin::before { background: radial-gradient(circle, rgba(251, 191, 36, 0.6) 0%, transparent 70%); }
.login-icon-agent {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(79, 140, 255, 0.4);
}
.login-icon-agent::before { background: radial-gradient(circle, rgba(79, 140, 255, 0.6) 0%, transparent 70%); }
.login-icon-maker {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(236, 72, 153, 0.1) 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
}
.login-icon-maker::before { background: radial-gradient(circle, rgba(168, 85, 247, 0.6) 0%, transparent 70%); }

.login-icon-emoji {
    font-size: 1.8rem; line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.login-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card-admin .login-title { background-image: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%); }
.login-card-agent .login-title { background-image: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%); }
.login-card-maker .login-title { background-image: linear-gradient(135deg, #ffffff 0%, #d8b4fe 100%); }

.login-sub {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
    max-width: 280px;
}

.login-body {
    position: relative; z-index: 1;
    padding: 20px 24px 24px;
    display: flex; flex-direction: column; gap: 12px;
}

/* ─── LOGIN FIELD (fixed positioning) ─── */
.login-field {
    position: relative !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 50px !important;
    background: rgba(22, 33, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.login-field:focus-within {
    background: rgba(22, 33, 59, 0.9);
}
.login-card-admin .login-field:focus-within {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}
.login-card-agent .login-field:focus-within {
    border-color: #4f8cff;
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}
.login-card-maker .login-field:focus-within {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

/* ─── LEFT ICON (👤 / 🔒) ─── */
.login-field-icon {
    position: absolute !important;
    left: 14px !important;
    top: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    line-height: 1 !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
    user-select: none !important;
    z-index: 2 !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 20px !important;
}

/* ─── INPUT (fills whole field, with padding) ─── */
.login-field input {
    display: block !important;
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 56px 0 42px !important;
    color: var(--text) !important;
    font-size: 15px !important;
    font-family: inherit !important;
    font-weight: 400 !important;
    outline: none !important;
    line-height: 50px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1 !important;
    cursor: text !important;
}
.login-field input::placeholder {
    color: var(--muted) !important;
    opacity: 0.7 !important;
}
.login-field input:focus {
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

/* ─── EYE BUTTON (fixed 48px right column) ─── */
.login-eye-btn {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 48px !important;
    height: 100% !important;
    min-width: 48px !important;
    max-width: 48px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    font-size: 15px !important;
    line-height: 1 !important;
    opacity: 0.6 !important;
    transition: opacity 0.15s, background 0.15s !important;
    color: inherit !important;
    z-index: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent !important;
    transform: none !important;
}
.login-eye-btn:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.06) !important;
}
.login-eye-btn:active {
    background: rgba(255, 255, 255, 0.12) !important;
    transform: none !important;
}

.login-remember {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 2px;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none; -webkit-user-select: none;
    text-align: left;
}
.login-remember input[type="checkbox"] {
    width: 18px !important; height: 18px !important;
    min-width: 18px !important; max-width: 18px !important;
    min-height: 18px !important; max-height: 18px !important;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0 !important; padding: 0 !important;
    flex-shrink: 0;
    -webkit-appearance: checkbox !important;
    appearance: checkbox !important;
}
.login-card-admin .login-remember input[type="checkbox"] { accent-color: #fbbf24; }
.login-card-maker .login-remember input[type="checkbox"] { accent-color: #a855f7; }

.login-remember-hint {
    margin-left: auto;
    font-size: 0.72rem;
    opacity: 0.7;
    font-style: italic;
}

.login-btn {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 50px;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
.login-btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    pointer-events: none;
}
.login-btn:active:not(:disabled) { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-btn-admin {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 8px 24px rgba(251, 191, 36, 0.25);
}
.login-btn-admin:hover:not(:disabled) {
    box-shadow: 0 12px 32px rgba(251, 191, 36, 0.4);
    transform: translateY(-1px);
}
.login-btn-agent {
    background: linear-gradient(135deg, #3b82f6 0%, #4f8cff 100%);
    box-shadow: 0 8px 24px rgba(79, 140, 255, 0.3);
}
.login-btn-agent:hover:not(:disabled) {
    box-shadow: 0 12px 32px rgba(79, 140, 255, 0.45);
    transform: translateY(-1px);
}
.login-btn-maker {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}
.login-btn-maker:hover:not(:disabled) {
    box-shadow: 0 12px 32px rgba(168, 85, 247, 0.45);
    transform: translateY(-1px);
}

.login-btn-secondary {
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
.login-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
}

.login-card .error-text {
    text-align: center;
    font-size: 0.82rem;
    margin-top: 4px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #fca5a5;
}

/* Light mode */
body.light-mode .login-card { background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important; }
body.light-mode .login-field { background: #ffffff; }
body.light-mode .login-field input { color: #0f172a; }
body.light-mode .login-card-admin .login-title { background-image: linear-gradient(135deg, #92400e 0%, #f59e0b 100%); }
body.light-mode .login-card-agent .login-title { background-image: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); }
body.light-mode .login-card-maker .login-title { background-image: linear-gradient(135deg, #6b21a8 0%, #a855f7 100%); }

@media (max-width: 480px) {
    .login-card { max-width: calc(100vw - 32px) !important; border-radius: 18px !important; }
    .login-hero { padding: 26px 20px 4px; }
    .login-body { padding: 16px 20px 22px; gap: 10px; }
    .login-icon-wrap { width: 58px; height: 58px; border-radius: 16px; }
    .login-icon-emoji { font-size: 1.55rem; }
    .login-title { font-size: 1.2rem; }
    .login-sub { font-size: 0.76rem; }
    .login-remember { font-size: 0.8rem; }
    .login-remember-hint { display: none; }
}

/* ═══════════════════════════════════════════════════════
   LIVE ACTIVITY FEED
   ═══════════════════════════════════════════════════════ */

.live-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: livePulse 1.8s infinite;
    flex-shrink: 0;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.live-badge {
    background: rgba(79, 140, 255, 0.12);
    border: 1px solid rgba(79, 140, 255, 0.3);
    color: #93c5fd;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.live-feed-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    margin-top: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.live-feed-list::-webkit-scrollbar { width: 6px; }
.live-feed-list::-webkit-scrollbar-track { background: transparent; }
.live-feed-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.live-feed-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.feed-row {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    animation: feedRowIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes feedRowIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.feed-row:hover {
    border-color: rgba(79, 140, 255, 0.4);
    transform: translateX(2px);
}
.feed-row.is-new {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, var(--panel-2) 60%);
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.feed-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.feed-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.feed-line-1 {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.feed-maker {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.feed-new-badge {
    font-size: 0.58rem;
    font-weight: 800;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.1em;
    flex-shrink: 0;
    animation: newBadgeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes newBadgeIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

.feed-line-2 {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.feed-phone {
    color: #93c5fd;
    font-weight: 600;
    font-size: 0.84rem;
    letter-spacing: 0.01em;
}

.feed-time {
    font-size: 0.72rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

@media (max-width: 600px) {
    .feed-row {
        grid-template-columns: 34px 1fr auto;
        gap: 10px;
        padding: 8px 10px;
    }
    .feed-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.82rem;
        border-radius: 8px;
    }
    .feed-maker { font-size: 0.84rem; }
    .feed-phone { font-size: 0.78rem; }
    .feed-time  { font-size: 0.66rem; }
    .live-feed-list { max-height: 420px; }
}

/* Light mode */
body.light-mode .live-feed-list::-webkit-scrollbar-thumb { background: #cbd5e1; }
body.light-mode .feed-row.is-new {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, #f8fafc 60%);
}
body.light-mode .feed-avatar { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }

/* ═══════════════════════════════════════════════════════
   PHASE 2 — DESIGN POLISH
   ═══════════════════════════════════════════════════════ */

/* ─── SECTION HEADERS ─── */
.card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-header h2::before {
    content: '';
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), #a855f7);
    flex-shrink: 0;
}

/* ─── DASHBOARD STAT CARDS (enhanced) ─── */
.dash-stat {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    cursor: default;
    padding: 16px 12px !important;
}
.dash-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0.5;
}
.dash-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.dash-stat-icon {
    font-size: 1.15rem;
    line-height: 1;
    margin-bottom: 2px;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.dash-stat-label { font-size: 0.68rem !important; }
.dash-stat-value {
    font-size: 1.65rem !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Per-card accent */
.dash-stat.stat-today       { color: #6ee7b7; }
.dash-stat.stat-yesterday   { color: #93c5fd; }
.dash-stat.stat-active      { color: #fbbf24; }
.dash-stat.stat-total       { color: #d8b4fe; }
.dash-stat.stat-capacity    { color: #fb923c; }
.dash-stat.stat-remaining   { color: #f472b6; }

.dash-stat.stat-today::before     { background: linear-gradient(90deg, transparent, #22c55e, transparent); }
.dash-stat.stat-yesterday::before { background: linear-gradient(90deg, transparent, #3b82f6, transparent); }
.dash-stat.stat-active::before    { background: linear-gradient(90deg, transparent, #f59e0b, transparent); }
.dash-stat.stat-total::before     { background: linear-gradient(90deg, transparent, #a855f7, transparent); }
.dash-stat.stat-capacity::before  { background: linear-gradient(90deg, transparent, #f97316, transparent); }
.dash-stat.stat-remaining::before { background: linear-gradient(90deg, transparent, #ec4899, transparent); }

/* ─── CREATE STATS BAR (Today/Yesterday/All sa Create tab) ─── */
.create-stat {
    position: relative;
    padding: 4px 0;
}
.create-stat-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.create-stat:nth-child(1) .create-stat-value { color: #6ee7b7; }
.create-stat:nth-child(3) .create-stat-value { color: #93c5fd; }
.create-stat:nth-child(5) .create-stat-value { color: #d8b4fe; }

/* ─── USER CARD (avatar bubbles) ─── */
.user-card {
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.user-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--border);
    transition: background 0.15s;
}
.user-card:hover {
    transform: translateX(3px);
    border-color: rgba(79, 140, 255, 0.35);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.user-card:hover::before {
    background: linear-gradient(180deg, var(--primary), #a855f7);
}

.user-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}
.user-card-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
    pointer-events: none;
}
.user-card-avatar.role-agent { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.user-card-avatar.role-maker { background: linear-gradient(135deg, #a855f7, #7e22ce); }

.user-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-card-body { flex: 1; min-width: 0; }

/* ─── ACCOUNT CARDS (copy buttons + accent) ─── */
.acc-card {
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
    padding-left: 18px !important;
}
.acc-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--border);
    transition: background 0.15s;
}
.acc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.acc-card.is-pwd-set::before    { background: linear-gradient(180deg, #22c55e, #16a34a); }
.acc-card.is-pwd-unset::before  { background: linear-gradient(180deg, #f59e0b, #d97706); }

.acc-copy-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 5px;
    line-height: 1;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    opacity: 0.5;
}
.acc-copy-btn:hover {
    opacity: 1;
    background: rgba(79, 140, 255, 0.12);
    border-color: rgba(79, 140, 255, 0.3);
    color: #93c5fd;
}
.acc-copy-btn:active { transform: scale(0.9); }
.acc-copy-btn.copied {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #6ee7b7;
    opacity: 1;
}

.acc-phone {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    padding-right: 80px;
}
.acc-phone > span:first-child { flex-shrink: 0; }
.acc-phone .acc-phone-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.acc-phone-text .mono {
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-value-with-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    max-width: 100%;
}
.acc-value-with-copy .mono {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

/* ─── HISTORY ROW (copy button) ─── */
.history-row {
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.history-row:hover {
    transform: translateX(3px);
    background: rgba(79, 140, 255, 0.04);
}
.history-copy-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}
.history-copy-btn:hover {
    opacity: 1;
    background: rgba(79, 140, 255, 0.12);
    border-color: rgba(79, 140, 255, 0.3);
    color: #93c5fd;
}
.history-copy-btn:active { transform: scale(0.9); }
.history-copy-btn.copied {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #6ee7b7;
    opacity: 1;
}

@media (max-width: 600px) {
    .history-row {
        grid-template-columns: 32px 1fr auto !important;
    }
}

/* ─── EMPTY STATES ─── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state-emoji {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 12px;
    display: block;
    opacity: 0.7;
    animation: emptyFloat 3s ease-in-out infinite;
}
@keyframes emptyFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.empty-state-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

/* ─── TOAST ENHANCEMENTS ─── */
.toast {
    position: relative;
    overflow: hidden;
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.4;
    animation: toastCountdown linear forwards;
}
.toast.success::after { background: var(--success); }
.toast.error::after   { background: var(--danger); }
.toast.info::after    { background: var(--warning); }

@keyframes toastCountdown {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ─── LEADER LIST (dashboard) ─── */
.leader-row {
    transition: transform 0.15s, background 0.15s;
    position: relative;
    overflow: hidden;
}
.leader-row:hover {
    transform: translateX(3px);
    background: rgba(79, 140, 255, 0.06);
}
.leader-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    opacity: 0;
    transition: opacity 0.15s;
}
.leader-row:nth-child(1)::before { opacity: 1; }
.leader-row:nth-child(2)::before { opacity: 0.7; background: linear-gradient(180deg, #e5e7eb, #9ca3af); }
.leader-row:nth-child(3)::before { opacity: 0.5; background: linear-gradient(180deg, #fb923c, #c2410c); }

/* ─── BULK FLOW CARD (mas refined) ─── */
.bulk-flow-card {
    transition: transform 0.15s, box-shadow 0.15s;
}
.bulk-flow-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ─── NUMBER COUNTER ANIMATION ─── */
.counting {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ─── CAPACITY BAR (mas kita) ─── */
.capacity-fill {
    position: relative;
    overflow: hidden;
}
.capacity-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.35) 50%,
        transparent 100%);
    animation: capacityShimmer 2.4s infinite;
}
@keyframes capacityShimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ─── BOTTOM NAV (mas refined) ─── */
.bottom-tab {
    transition: color 0.15s, background 0.15s, transform 0.1s;
    position: relative;
}
.bottom-tab.active::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px rgba(79, 140, 255, 0.6);
}
.bottom-tab:active { transform: scale(0.95); }

/* ─── GROUP HEADER (accounts) ─── */
.account-group-header {
    transition: background 0.15s, padding-left 0.15s;
}
.account-group-header:hover {
    padding-left: 20px;
}

/* ─── LIGHT MODE TWEAKS ─── */
body.light-mode .dash-stat:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12); }
body.light-mode .user-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
body.light-mode .acc-card:hover  { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); }
body.light-mode .leader-row:hover { background: rgba(59, 130, 246, 0.06); }
body.light-mode .card-header h2::before { background: linear-gradient(180deg, #3b82f6, #a855f7); }