/* =========================================================
   3T Dial — Midnight Violet design system
   A Product of Tech Talk Titans
   ========================================================= */

:root {
  --bg:           #0B0E14;
  --header-bg:    rgba(11, 14, 20, 0.94);
  --surface:      #131720;
  --surface-2:    #1A1F2E;
  --border:       #252B3A;
  --text:         #E8EAF0;
  --muted:        #8B93A7;
  --primary:      #7C5CFF;
  --primary-h:    #9179FF;
  --primary-soft: rgba(124, 92, 255, 0.14);
  --success:      #22C55E;
  --success-soft: rgba(34, 197, 94, 0.14);
  --danger:       #EF4444;
  --danger-soft:  rgba(239, 68, 68, 0.14);
  --cyan:         #22D3EE;
  --warning:      #F59E0B;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --t: 150ms ease-out;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
[x-cloak] { display: none !important; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--primary); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }

/* ---------- Typography ---------- */
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
p  { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.tabular { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.full { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.stack { display: grid; gap: 12px; }
a { color: var(--primary); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--primary-h); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  border: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), transform var(--t), color var(--t), border-color var(--t);
  min-height: 44px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-h); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 12px; min-height: 32px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: transparent; border: 0; color: var(--text);
  border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t);
}
.icon-btn:hover { background: var(--surface-2); }

.link {
  background: none; border: 0; color: var(--primary);
  cursor: pointer; padding: 8px 0; font-size: 13px;
  font-family: inherit; text-align: left;
}
.link:hover { color: var(--primary-h); }

/* ---------- Inputs ---------- */
input, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), background var(--t);
}
input::placeholder { color: var(--muted); }
input:focus, textarea:focus { border-color: var(--primary); }
input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Auth screens ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
}

/* ---------- 3T Dial brand block ---------- */
.brand {
  text-align: center;
  margin-bottom: 20px;
}
.brand-logo {
  width: 72px; height: 72px;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(124, 92, 255, 0.35));
}
.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  background: linear-gradient(135deg, #E8EAF0 0%, #9179FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-slogan {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0;
}
.brand-parent {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 0;
  letter-spacing: 0.02em;
}

/* Profile footer */
.brand-footer {
  text-align: center;
  margin-top: 32px;
  padding: 20px 0 4px;
}
.brand-footer-logo {
  width: 48px; height: 48px;
  margin: 0 auto 8px;
  display: block;
  object-fit: contain;
  opacity: 0.9;
}
.brand-footer-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.brand-footer-slogan {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 2px;
}
.brand-footer-parent {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  opacity: 0.75;
}

/* ---------- OTP blocks ---------- */
.otp-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-top: 16px;
}
.otp-block.done { border-color: var(--success); }
.otp-head {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 8px; color: var(--muted);
}
.err { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.ok  { color: var(--success); font-size: 13px; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding-bottom: 88px;
}
.app-main { flex: 1; max-width: 960px; width: 100%; margin: 0 auto; }
.page { padding: 20px 16px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  min-height: 32px;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 2px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(19, 23, 32, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
}
.nav-item {
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 11px; font-weight: 500;
  transition: color var(--t), background var(--t);
  text-decoration: none;
  min-height: 52px;
}
.nav-item:hover { color: var(--text); }
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- Segmented tabs ---------- */
.seg {
  display: flex; gap: 2px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.seg-btn {
  flex: 1; padding: 10px 12px;
  border: 0; background: transparent;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600;
  transition: background var(--t), color var(--t);
}
.seg-btn.active { background: var(--surface); color: var(--text); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.li-body { flex: 1; min-width: 0; }
.li-title { font-weight: 600; font-size: 14px; }
.li-sub { font-size: 12px; color: var(--muted); }

.avatar-sm {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 100px;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  animation: toastIn var(--t) ease-out;
  max-width: 340px;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Empty states ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { max-width: 280px; font-size: 13px; margin: 0; }

/* ---------- Icons ---------- */
[data-lucide] { display: inline-block; vertical-align: middle; stroke-width: 2; }

/* ---------- Responsive ---------- */
.hidden-mobile { display: none; }
@media (min-width: 721px) { .hidden-mobile { display: block; } }
.mobile-only { display: inline-flex; }
@media (min-width: 721px) { .mobile-only { display: none; } }

/* =========================================================
   3T Dial — Phase 2 components
   ========================================================= */

/* ---------- Country picker ---------- */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.country-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text);
  font-family: inherit;
  transition: background var(--t), border-color var(--t);
}
.country-btn:hover { background: var(--surface-2); border-color: var(--primary); }
.country-flag { font-size: 32px; line-height: 1; }
.country-name { font-weight: 600; font-size: 13px; }

/* ---------- Filters ---------- */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 12px;
}
.chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.chip {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  text-transform: capitalize;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- Badges ---------- */
.badge-sm {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-sm.ok {
  background: var(--success-soft);
  color: var(--success);
}

/* ---------- Price tag ---------- */
.price-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Dialer ---------- */
.dialer { text-align: center; padding: 12px 0 20px; }
.dialer-number {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-height: 42px;
  margin-bottom: 24px;
  word-break: break-all;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
}
.key {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t), transform var(--t);
  font-family: inherit;
}
.key:hover { background: var(--surface-2); }
.key:active { background: var(--primary); transform: scale(0.95); }
.key-num { font-size: 22px; font-weight: 500; }
.key-sub { font-size: 9px; letter-spacing: 0.1em; color: var(--muted); margin-top: 2px; }
.dialer-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 40px;
  margin-top: 28px;
}
.key-flat {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; padding: 10px;
}
.btn.big-round {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--success);
  padding: 0;
}
.btn.big-round.danger { background: var(--danger); }

.dir-in    { color: var(--success) !important; }
.dir-out   { color: var(--cyan) !important; }
.dir-missed{ color: var(--danger) !important; }

.play-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--primary);
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
}

/* ---------- In-call overlay ---------- */
.incall {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at top, #1a1f35 0%, #05070d 70%);
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 24px 40px;
  animation: fade .25s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.incall-top { text-align: center; margin-bottom: auto; }
.incall-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: grid; place-items: center;
  font-size: 36px; font-weight: 700; color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 8px rgba(124, 92, 255, 0.15);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(124, 92, 255, 0.15); }
  50%      { box-shadow: 0 0 0 16px rgba(124, 92, 255, 0.05); }
}
.incall-name   { font-size: 24px; font-weight: 700; }
.incall-number { color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.incall-status { color: var(--cyan); margin-top: 12px; font-size: 14px; min-height: 20px; }

.incall-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%; max-width: 380px;
  margin-bottom: 40px;
}
.call-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t), border-color var(--t), color var(--t);
  min-height: 76px;
}
.call-btn:hover { background: var(--surface-2); }
.call-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.cb-label { font-size: 12px; font-weight: 500; }
.incall-end { display: flex; justify-content: center; }

/* ---------- SMS ---------- */
.sms-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 20px 16px;
  height: calc(100vh - 88px);
}
@media (max-width: 720px) {
  /* SMS: single-panel mode on mobile — only one panel visible at a time */
  .sms-page {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding: 0 !important;
    height: calc(100vh - 88px) !important;
    height: calc(100dvh - 88px) !important;
    overflow: hidden !important;
  }
  /* List view (default): hide the thread entirely */
  .sms-page > .sms-thread,
  .sms-page > .sms-thread.empty {
    display: none !important;
  }
  /* Chat view: hide list, show thread as full screen */
  .sms-page.thread-open > .sms-list {
    display: none !important;
  }
  .sms-page.thread-open > .sms-thread,
  .sms-page.thread-open > .sms-thread.empty {
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  /* Compact thread header so more room for messages */
  .sms-page.thread-open .thread-head {
    padding: 10px 12px !important;
    gap: 10px !important;
  }
  .sms-page.thread-open .thread-head .avatar-sm {
    width: 34px !important;
    height: 34px !important;
    font-size: 13px !important;
  }
  .sms-page.thread-open .thread-head .li-title {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }
  .sms-page.thread-open .thread-head .li-sub {
    font-size: 11px !important;
    line-height: 1.2 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 62vw !important;
    display: block !important;
  }
  /* Messages area — scrolls independently */
  .sms-page.thread-open .thread-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 12px !important;
  }
  /* Input row stays pinned at bottom */
  .sms-page.thread-open .thread-input {
    flex-shrink: 0 !important;
    padding: 10px 12px !important;
  }
  /* Slightly smaller bubbles */
  .sms-page.thread-open .bubble {
    max-width: 84% !important;
    font-size: 13.5px !important;
    padding: 8px 11px !important;
  }
}
.sms-list {
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.sms-list .list { overflow-y: auto; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  color: var(--muted);
}
.search input {
  border: 0; background: transparent; padding: 0;
  color: var(--text);
}
.badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.sms-thread {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 0;
}
.sms-thread.empty { display: grid; place-items: center; }
.thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.bubble {
  max-width: 76%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}
.bubble.in {
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.bubble.out {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.bubble-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}
.thread-input {
  display: flex; gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.btn.round {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
}

/* ---------- Wallet ---------- */
.balance-card {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(34, 211, 238, 0.15));
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.balance { font-size: 32px; font-weight: 700; margin-top: 4px; }
.tx-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  flex-shrink: 0;
}
.tx-icon.in      { color: var(--success); background: var(--success-soft); }
.tx-icon.out     { color: var(--danger);  background: var(--danger-soft); }
.tx-icon.neutral { color: var(--primary); background: var(--primary-soft); }
.amount { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.amount.pos { color: var(--success); }
.amount.neg { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  width: 100%; max-width: 380px;
  animation: modalIn .15s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.modal input { margin-bottom: 14px; }

/* ---------- Profile ---------- */
.profile-head {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 20px;
}
.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.profile-info .profile-name {
  font-size: 20px; font-weight: 700;
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
}
.stat-val { font-size: 22px; font-weight: 700; margin-top: 4px; }
.logout { margin-top: 24px; }

/* ---------- Docs / legal ---------- */
.doc { line-height: 1.65; font-size: 14px; }
.doc h3 { margin-top: 20px; color: var(--text); }
.doc p, .doc li { color: var(--muted); }
.doc ul { padding-left: 20px; }
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.pricing-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.pricing-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Admin table ---------- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table input,
.admin-table select {
  padding: 6px 8px;
  font-size: 12px;
  min-height: 32px;
}
.admin-table input[type="checkbox"] {
  width: 18px; height: 18px; min-height: auto;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- Skeleton / loading ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row {
  height: 56px;
  border-radius: var(--r-md);
  margin-bottom: 6px;
}

/* ---------- Divider / row-between ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}
.row-between {
  display: flex; justify-content: space-between; align-items: center;
}

/* ========================================================
   3T Dial — Home + section tiles + smaller dialer
   ======================================================== */

.home-hero {
  text-align: center;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.home-logo {
  width: 64px; height: 64px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 20px rgba(124, 92, 255, 0.35));
}
.home-title {
  font-size: 26px; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  background: linear-gradient(135deg, #E8EAF0 0%, #9179FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.home-slogan {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0;
}
.home-parent { font-size: 10px; color: var(--muted); margin: 4px 0 0; }
.home-greeting { font-size: 22px; font-weight: 700; margin: 0 0 4px; }

.news-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
}
.news-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.news-card .li-sub { color: var(--muted); font-size: 12px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text); text-decoration: none;
  font-size: 13px; font-weight: 600;
  transition: background var(--t), border-color var(--t);
}
.quick-btn:hover { background: var(--surface-2); border-color: var(--primary); color: var(--text); }
.quick-btn i { color: var(--primary); }

/* ---------- Beautiful colored section tiles ---------- */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  min-height: 122px;
  overflow: hidden;
  background: var(--surface);
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.section-tile:active { transform: scale(0.97); }

/* Subtle colored glow in the corner */
.section-tile::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  opacity: 0.18;
  filter: blur(30px);
  pointer-events: none;
  transition: opacity var(--t);
}
.section-tile:hover::before { opacity: 0.32; }

/* Colored icon chip */
.section-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: #fff;
  margin-bottom: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: transform var(--t);
}
.section-tile:hover .section-icon { transform: translateY(-2px) scale(1.05); }

.section-tile-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-tile-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Individual tile colors ---------- */

/* Dialer — emerald green (action / call) */
.tile-dialer::before { background: #10B981; }
.tile-dialer:hover { border-color: rgba(16, 185, 129, 0.6); }
.tile-dialer .section-icon {
  background: linear-gradient(135deg, #34D399 0%, #059669 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

/* History — sky blue (time / past) */
.tile-history::before { background: #3B82F6; }
.tile-history:hover { border-color: rgba(59, 130, 246, 0.6); }
.tile-history .section-icon {
  background: linear-gradient(135deg, #60A5FA 0%, #2563EB 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

/* Numbers — violet (identity) */
.tile-numbers::before { background: #7C5CFF; }
.tile-numbers:hover { border-color: rgba(124, 92, 255, 0.6); }
.tile-numbers .section-icon {
  background: linear-gradient(135deg, #A78BFA 0%, #6D28D9 100%);
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.4);
}

/* Voicemail — amber/orange (messages) */
.tile-voicemail::before { background: #F59E0B; }
.tile-voicemail:hover { border-color: rgba(245, 158, 11, 0.6); }
.tile-voicemail .section-icon {
  background: linear-gradient(135deg, #FBBF24 0%, #D97706 100%);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

/* Slightly stronger glow in light theme */
[data-theme="light"] .section-tile::before { opacity: 0.12; }
[data-theme="light"] .section-tile:hover::before { opacity: 0.22; }
[data-theme="light"] .section-icon {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* Smaller dialer */
.dialer { padding: 8px 0 12px; text-align: center; }
.dialer-number {
  font-size: 22px; font-weight: 600;
  min-height: 32px; margin-bottom: 16px;
  word-break: break-all;
}
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; max-width: 260px; margin: 0 auto;
}
.key {
  aspect-ratio: 1;
  border: 0; border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t), transform var(--t);
  font-family: inherit;
}
.key:hover { background: var(--surface-2); }
.key:active { background: var(--primary); transform: scale(0.94); }
.key-num { font-size: 18px; font-weight: 500; }
.key-sub { font-size: 8px; letter-spacing: 0.1em; color: var(--muted); margin-top: 1px; }
.dialer-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 28px; margin-top: 20px;
}
.key-flat {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; padding: 8px;
}
.btn.big-round {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success);
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
/* ========================================================
   3T Dial — Theme system (dark default, light optional)
   ======================================================== */

/* Chrome colors that need to swap with theme */
:root {
  --nav-bg:         rgba(19, 23, 32, 0.92);
  --overlay-top:    #1a1f35;
  --overlay-bottom: #05070d;
  --modal-scrim:    rgba(0, 0, 0, 0.6);
}

/* ---------- Light theme overrides ---------- */
[data-theme="light"] {
  --bg:           #F5F6F9;
  --header-bg:    rgba(245, 246, 249, 0.94);
  --surface:      #FFFFFF;
  --surface-2:    #EEF0F6;
  --border:       #E2E5ED;
  --text:         #0B0E14;
  --muted:        #626A7A;

  --primary:      #6B4BFF;
  --primary-h:    #7C5CFF;
  --primary-soft: rgba(107, 75, 255, 0.10);

  --success:      #16A34A;
  --success-soft: rgba(22, 163, 74, 0.10);

  --danger:       #DC2626;
  --danger-soft:  rgba(220, 38, 38, 0.10);

  --cyan:         #0891B2;
  --warning:      #D97706;

  --nav-bg:         rgba(255, 255, 255, 0.92);
  --overlay-top:    #E8EAF0;
  --overlay-bottom: #F5F6F9;
  --modal-scrim:    rgba(15, 20, 35, 0.45);
}

/* Redirect hard-coded chrome to variables */
.bottom-nav { background: var(--nav-bg); }
.incall {
  background: radial-gradient(circle at top, var(--overlay-top) 0%, var(--overlay-bottom) 70%);
}
.modal-back { background: var(--modal-scrim); }

/* Gradient headings need to stay legible on light bg */
[data-theme="light"] .brand h1,
[data-theme="light"] .home-title {
  background: linear-gradient(135deg, #0B0E14 0%, #6B4BFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Slightly stronger scrollbar in light */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C9CED8; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #A8AFBC; }

/* In-call avatar ring — light variant */
[data-theme="light"] .incall-avatar {
  box-shadow: 0 0 0 8px rgba(107, 75, 255, 0.18);
}
[data-theme="light"] .incall-status { color: var(--primary); }

/* Toast on light bg */
[data-theme="light"] .toast {
  background: #FFFFFF;
  box-shadow: 0 6px 20px rgba(15, 20, 35, 0.08);
}

/* ---------- Theme switch UI ---------- */
.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
}
.theme-switch button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  min-height: 44px;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active {
  background: var(--primary);
  color: #FFFFFF;
}
.theme-switch button.active [data-lucide] {
  color: #FFFFFF;
}
/* ========================================================
   3T Dial — Home topbar + portfolio + announcements
   ======================================================== */

/* ---------- Top bar ---------- */
.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.home-brand-logo {
  width: 40px; height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.home-brand-text { min-width: 0; }
.home-brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  background: linear-gradient(135deg, #E8EAF0 0%, #9179FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.home-brand-parent {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
[data-theme="light"] .home-brand-name {
  background: linear-gradient(135deg, #0B0E14 0%, #6B4BFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color var(--t);
}
.home-avatar:hover { border-color: var(--primary); }
.home-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Greeting ---------- */
.home-greeting-block {
  margin-bottom: 20px;
  padding: 4px 0;
}
.home-greeting {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.home-subgreeting {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* ---------- Big balance card ---------- */
.balance-card.big {
  padding: 22px;
  margin-bottom: 12px;
}
.balance-card.big .balance { font-size: 34px; }

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.stat-grid .stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  position: relative;
}
.stat-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  margin-bottom: 8px;
}
.stat-icon.in      { background: var(--success-soft); color: var(--success); }
.stat-icon.out     { background: var(--danger-soft);  color: var(--danger); }
.stat-icon.neutral { background: var(--primary-soft); color: var(--primary); }
.stat-grid .stat-val {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}
.stat-grid .stat-val.pos { color: var(--success); }

/* ---------- Announcements ---------- */
.announcement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.announcement-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.announcement-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.announcement-date {
  flex-shrink: 0;
  font-size: 11px;
}
.announcement-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.announcement-body p { margin: 0 0 8px; }
.announcement-body p:last-child { margin-bottom: 0; }
.announcement-body a { color: var(--primary); }
.announcement-body ul, .announcement-body ol { padding-left: 20px; margin: 6px 0; }
.announcement-body code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.announcement-body img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.announcement-body h1, .announcement-body h2, .announcement-body h3 {
  font-size: 15px;
  margin: 10px 0 6px;
}

/* ---------- FX preview in topup modal ---------- */
.fx-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.fx-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
}
.fx-usd { font-weight: 700; color: var(--text); }
.fx-inr { font-weight: 700; color: var(--cyan); }
.fx-rate { letter-spacing: 0.02em; }


/* ========================================================
   3T Dial — Admin tabs + row states
   ======================================================== */

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
  overflow-x: auto;
}
.admin-tab {
  flex: 1 0 auto;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), color var(--t);
  min-height: 40px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ---------- Incoming call ---------- */
.incall.incoming-ring {
  background: radial-gradient(circle at top, #0f2a1e 0%, #05070d 70%);
}
.pulse-ring {
  animation: pulse-ring 1.5s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.15); }
  50%      { box-shadow: 0 0 0 22px rgba(34, 197, 94, 0.02); }
}
.incoming-actions {
  display: flex;
  gap: 60px;
  justify-content: center;
  margin-top: auto;
  margin-bottom: 20px;
}
.incoming-actions > div {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.incoming-actions .btn.success {
  background: var(--success);
}
.incoming-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.btn.success.big-round {
  width: 72px; height: 72px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  padding: 0;
}
.btn.danger.big-round {
  width: 72px; height: 72px;
}
/* ---------- Call history directions ---------- */
.avatar-sm .dir-in,
.avatar-sm .dir-out,
.avatar-sm .dir-missed {
  display: grid;
  place-items: center;
}

.avatar-sm:has(.dir-in)      { background: rgba(34, 197, 94, 0.20); color: #22C55E; }
.avatar-sm:has(.dir-out)     { background: rgba(34, 211, 238, 0.20); color: #22D3EE; }
.avatar-sm:has(.dir-missed)  { background: rgba(239, 68, 68, 0.20); color: #EF4444; }

.call-dir-label {
  font-size: 12px;
  font-weight: 600;
}
.call-dir-label.dir-in     { color: var(--success); }
.call-dir-label.dir-out    { color: var(--cyan); }
.call-dir-label.dir-missed { color: var(--danger); }

/* ---------- Dialer input (keyboard) ---------- */
.dialer-hint {
  text-align: center;
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.dialer-number {
  display: flex;
  justify-content: center;
  padding: 0 8px;
}
.dialer-input {
  width: 100%;
  max-width: 320px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  font-size: 26px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  color: var(--text);
  padding: 8px 4px;
  outline: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: border-color 150ms ease-out;
}
.dialer-input:focus {
  border-bottom-color: var(--primary);
}
.dialer-input::placeholder {
  color: var(--muted);
  font-weight: 500;
}
/* Voicemail audio player */
.list-item audio {
  accent-color: var(--primary);
  border-radius: 8px;
}
/* ---------- DTMF panel ---------- */
.dtmf-panel, .add-call-panel {
  position: fixed;
  left: 0; right: 0; top: 50%;
  margin: 0 auto;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  z-index: 200;
  width: 280px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  pointer-events: auto;
}
.dtmf-head, .add-call-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 14px; font-weight: 600;
}
.dtmf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dtmf-key {
  aspect-ratio: 1.4;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.dtmf-key:hover { background: var(--primary); color: #fff; }
.dtmf-key:active { transform: scale(0.96); }

/* ---------- Add-call panel ---------- */
.add-call-number {
  font-size: 22px; font-weight: 600;
  text-align: center; padding: 8px;
  min-height: 36px;
  background: var(--surface-2);
  border-radius: 10px;
}
.add-call-actions {
  display: flex; gap: 8px; margin-top: 12px;
  justify-content: space-between;
}

/* ---------- Second call card ---------- */
.second-call {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
  max-width: 380px;
}
.second-call-info { flex: 1; min-width: 0; }
.second-call-name { font-weight: 700; font-size: 14px; }
.second-call-status { font-size: 12px; color: var(--muted); margin-top: 2px; }
.swap-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--primary); color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.swap-btn:hover { background: var(--primary-h); }
.swap-btn:active { transform: scale(0.95); }

/* ---------- incall layout tweaks ---------- */
.incall { padding: 40px 20px 40px; overflow-y: auto; }
.incall-grid { margin-top: 12px; }

.caller-id-select {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 12px;
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
}

.tile-recordings .section-icon {
  background: linear-gradient(135deg, #F472B6 0%, #BE185D 100%);
  box-shadow: 0 6px 20px rgba(244, 114, 182, 0.35);
}
.tile-callerids .section-icon {
  background: linear-gradient(135deg, #FBBF24 0%, #B45309 100%);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.35);
}
/* ---------- Minimize button (in-call) ---------- */
.incall-minimize {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s;
}
.incall-minimize:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- Minimized call pill ---------- */
.call-pill {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  background: linear-gradient(135deg, var(--primary), #5a3dd9);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  max-width: 92vw;
  animation: pillIn 0.2s ease-out;
}
@keyframes pillIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.call-pill-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.call-pill-info {
  min-width: 0;
  cursor: pointer;
  padding: 2px 4px;
  flex: 1;
}
.call-pill-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  line-height: 1.1;
}
.call-pill-timer {
  font-size: 11px;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.call-pill-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.call-pill-btn:hover { background: rgba(255, 255, 255, 0.28); }
.call-pill-btn:active { transform: scale(0.94); }
.call-pill-btn.active { background: rgba(255, 255, 255, 0.4); }
.call-pill-btn.danger { background: var(--danger); }
.call-pill-btn.danger:hover { background: #dc2626; }

@media (max-width: 380px) {
  .call-pill-name { max-width: 110px; }
  .call-pill { gap: 6px; padding: 6px 10px 6px 6px; }
}
/* Caller ID picker modal — highlight selected row */
.modal .list-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
/* ---------- Signup consent checkboxes ---------- */
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.consent-check {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.consent-check:hover {
  border-color: var(--primary);
}
.consent-check:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.consent-check:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.consent-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.consent-text a {
  color: var(--primary);
  text-decoration: none;
}
.consent-text a:hover {
  text-decoration: underline;
}
/* SMS list header — push + button to the right */
.sms-list .page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Textarea styling to match inputs */
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t);
}
textarea::placeholder { color: var(--muted); }
textarea:focus { border-color: var(--primary); }
/* =========================================================
   Mobile sticky headers — Home + all page titles stay fixed
   while only the content scrolls
   ========================================================= */
@media (max-width: 720px) {

  /* Home page top bar (logo + avatar) — sticky to top */
  .home-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    /* Override .page's 20px/16px padding so the bar sits flush */
    margin: -20px -16px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  /* Every page title header inside .page — sticky to top */
  .page .page-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin: -20px -16px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }

  /* Sub-view headers with back button (Dialer, History, Profile docs…) */
  .page .page-head.with-back {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}
/* =========================================================
   Mobile SMS: pin headers to viewport with position: fixed
   — Only the content scrolls, headers stay put
   ========================================================= */
@media (max-width: 720px) {

  /* ---- LIST VIEW ---- */

  /* Remove outer height constraint — let body scroll naturally */
  .sms-page {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sms-page > .sms-list {
    padding: 0 16px !important;
    display: block !important;
  }

  /* "Messages" title + New SMS button — pinned to viewport top */
  .sms-page > .sms-list > .page-head {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 40 !important;
    background: var(--bg) !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    min-height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  /* Search bar — pinned just below the title */
  .sms-page > .sms-list > .search {
    position: fixed !important;
    top: 56px !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 40 !important;
    background: var(--surface-2) !important;
    margin: 12px 0 !important;
  }

  /* Conversation list — no scroll here; body scrolls */
  .sms-page > .sms-list > .list {
    padding-top: 130px !important;  /* room for fixed title + search */
    padding-bottom: 100px !important;
    overflow: visible !important;
    align-content: start !important;
    grid-auto-rows: min-content !important;
  }

  .sms-page > .sms-list > .list .list-item {
    padding: 10px 12px !important;
  }

  /* Hide thread when list is visible */
  .sms-page > .sms-thread,
  .sms-page > .sms-thread.empty {
    display: none !important;
  }

  /* ---- CHAT VIEW ---- */

  .sms-page.thread-open > .sms-list {
    display: none !important;
  }

  .sms-page.thread-open > .sms-thread {
    display: block !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    height: auto !important;
    background: var(--surface) !important;
  }

  .sms-page.thread-open > .sms-thread > div {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Recipient number header — pinned to viewport top */
  .sms-page.thread-open .thread-head {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 40 !important;
    background: var(--surface) !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    gap: 10px !important;
  }

  .sms-page.thread-open .thread-head .avatar-sm {
    width: 34px !important;
    height: 34px !important;
    font-size: 13px !important;
  }

  .sms-page.thread-open .thread-head .li-title {
    font-size: 14px !important;
    line-height: 1.2 !important;
  }

  .sms-page.thread-open .thread-head .li-sub {
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 62vw !important;
    display: block !important;
  }

  /* Messages area — padding for fixed header + input */
  .sms-page.thread-open .thread-body {
    padding: 80px 12px 90px 12px !important;
    overflow: visible !important;
  }

  /* Input row — pinned to bottom of viewport (above bottom nav) */
  .sms-page.thread-open .thread-input {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 76px !important;
    z-index: 40 !important;
    background: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
    padding: 10px 12px !important;
    margin: 0 !important;
  }

  /* Bubbles on mobile */
  .sms-page.thread-open .bubble {
    max-width: 84% !important;
    font-size: 13.5px !important;
    padding: 8px 11px !important;
  }
}
/* =========================================================
   Mobile SMS chat: match page background to thread background
   so no color split when messages are short
   ========================================================= */
@media (max-width: 720px) {
  /* Whole page adopts the thread background while chat is open */
  .sms-page.thread-open {
    background: var(--surface) !important;
    min-height: calc(100dvh - 88px) !important;
  }
  /* Also stretch the thread container itself */
  .sms-page.thread-open > .sms-thread {
    background: var(--surface) !important;
    min-height: calc(100dvh - 88px) !important;
  }
  .sms-page.thread-open > .sms-thread > div {
    background: var(--surface) !important;
    min-height: calc(100dvh - 88px) !important;
  }
  /* The Alpine wrapper ends before the input row — pin its bottom */
  .sms-page.thread-open .thread-body {
    min-height: calc(100dvh - 88px - 140px) !important;   /* header ~60 + input ~80 */
  }
}
/* =========================================================
   Desktop sticky headers — Home + all pages
   Mobile SMS is unchanged (already handled by earlier block)
   ========================================================= */
@media (min-width: 721px) {

  /* Home top bar (logo + avatar) — pinned to top */
  .home-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    /* Cancel .page padding so the header is flush with the container */
    margin: -20px -16px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  /* Every page title header inside .page — pinned to top */
  .page .page-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin: -20px -16px 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }

  /* Sub-view headers with back button (Dialer, History, Profile docs…) */
  .page .page-head.with-back {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}