/* ============================================================
   CloakMe Web Portal — design system
   app.css  |  loaded by every portal page (and the login page)
   Palette comes from the CloakMe app icon: ink #1C1C2E, blue #2B88EB.
   ============================================================ */

/* ── Cross-document view transitions (Chrome 126+, Safari 18.2+) ── */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}

.global-header { view-transition-name: global-header; }
aside.sidebar  { view-transition-name: sidebar; }
.tabbar        { view-transition-name: tabbar; }

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  /* Brand (from the app icon) */
  --ink:           #1C1C2E;
  --ink-2:         #262640;
  --ink-3:         #33335A;
  --on-ink:        #FFFFFF;
  --on-ink-2:      rgba(255, 255, 255, 0.68);
  --on-ink-3:      rgba(255, 255, 255, 0.45);

  /* Backgrounds */
  --bg-primary:    #F3F5F9;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #FFFFFF;
  --bg-sunken:     #EEF1F6;
  --bg-overlay:    rgba(10, 10, 20, 0.45);

  /* Labels */
  --label:         #15152A;
  --label-2:       rgba(21, 21, 42, 0.78);
  --label-3:       rgba(21, 21, 42, 0.58);
  --label-4:       rgba(21, 21, 42, 0.38);

  /* Separator */
  --separator:     rgba(21, 21, 42, 0.10);
  --border:        rgba(21, 21, 42, 0.12);

  /* System colors */
  --accent:        #2B88EB;
  --accent-strong: #1F6FCB;
  --accent-soft:   #5AA6F2;
  --accent-bg:     rgba(43, 136, 235, 0.10);
  --accent-ring:   rgba(43, 136, 235, 0.35);
  --destructive:   #E5484D;
  --destructive-bg: rgba(229, 72, 77, 0.10);
  --green:         #1DB97F;
  --green-text:    #11875B;
  --green-bg:      rgba(29, 185, 127, 0.13);
  --orange:        #F59E0B;
  --orange-text:   #A86400;
  --orange-bg:     rgba(245, 158, 11, 0.15);
  --gray:          #8A8FA3;
  --gray-bg:       rgba(138, 143, 163, 0.15);

  /* Geometry */
  --radius-card:   18px;
  --radius-sm:     10px;
  --radius-btn:    14px;
  --radius-pill:   999px;
  --nav-height:    44px;
  --gh-height:     56px;
  --tabbar-height: 64px;
  --sidebar-w:     264px;

  /* Elevation */
  --shadow-card:   0 1px 2px rgba(21, 21, 42, .04), 0 4px 14px rgba(21, 21, 42, .05);
  --shadow-lift:   0 14px 34px rgba(21, 21, 42, .16);
  --shadow-blue:   0 10px 24px rgba(43, 136, 235, .32);

  /* Typography — system stack: no third-party font requests */
  --font:          -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-display:  -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-mono:     ui-monospace, "SF Mono", "Menlo", "Consolas", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary:    #14141F;
    --bg-surface:    #1E1E2D;
    --bg-elevated:   #262638;
    --bg-sunken:     #191927;
    --label:         #F4F5FA;
    --label-2:       rgba(244, 245, 250, 0.78);
    --label-3:       rgba(244, 245, 250, 0.56);
    --label-4:       rgba(244, 245, 250, 0.34);
    --separator:     rgba(255, 255, 255, 0.09);
    --border:        rgba(255, 255, 255, 0.14);
    --accent-strong: #5AA6F2;
    --green-text:    #4ADE9F;
    --orange-text:   #FBBF4D;
    --shadow-card:   0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}

:root[data-theme="dark"] {
  --bg-primary:    #14141F;
  --bg-surface:    #1E1E2D;
  --bg-elevated:   #262638;
  --bg-sunken:     #191927;
  --label:         #F4F5FA;
  --label-2:       rgba(244, 245, 250, 0.78);
  --label-3:       rgba(244, 245, 250, 0.56);
  --label-4:       rgba(244, 245, 250, 0.34);
  --separator:     rgba(255, 255, 255, 0.09);
  --border:        rgba(255, 255, 255, 0.14);
  --accent-strong: #5AA6F2;
  --green-text:    #4ADE9F;
  --orange-text:   #FBBF4D;
  --shadow-card:   0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--label);
  line-height: 1.45;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }
:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }

/* ── Page shell ─────────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Content column of every portal page */
body.portal .page-wrap,
body.portal .numbers-wrap,
body.portal .profile-wrap {
  width: 100%;
  padding: 8px 40px 56px;
}

/* Desktop: ink sidebar | title bar over content */
@media (min-width: 900px) {
  body.portal {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
  }
  body.portal .page-body { display: contents; }
  body.portal #sidebar-placeholder { grid-column: 1; grid-row: 1 / span 2; }
  body.portal .global-header { grid-column: 2; grid-row: 1; }
  body.portal .page-main { grid-column: 2; grid-row: 2; }
}

/* Phone: room for the bottom tab bar */
@media (max-width: 899px) {
  body.portal { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px)); }
  body.portal .page-wrap,
  body.portal .numbers-wrap,
  body.portal .profile-wrap { padding: 16px 16px 32px; }
}

/* ── Sidebar (desktop) ──────────────────────────────────────── */
.sidebar { display: none; }

@media (min-width: 900px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    padding: 24px 14px 18px;
    background:
      radial-gradient(120% 50% at 0% 0%, rgba(43, 136, 235, .18), transparent 60%),
      var(--ink);
    color: var(--on-ink);
  }
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 6px;
  color: var(--on-ink);
  text-decoration: none;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .10), 0 6px 18px rgba(43, 136, 235, .28);
}
.sidebar__brand span {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--on-ink-2);
  text-decoration: none;
  text-align: left;
  line-height: 1.2;
  position: relative;
  transition: background .12s, color .12s;
}
.sidebar__item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar__item:hover { background: rgba(255, 255, 255, .06); color: var(--on-ink); text-decoration: none; }
.sidebar__item--active,
.sidebar__item--active:hover {
  background: rgba(43, 136, 235, .18);
  color: var(--on-ink);
}
.sidebar__item--active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar__item--active svg { color: var(--accent-soft); }

.sidebar__sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 8px 12px; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
}
.sidebar__avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}
.sidebar__who { min-width: 0; flex: 1; }
.sidebar__name,
.sidebar__email {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__name  { font-size: 14px; font-weight: 700; color: var(--on-ink); }
.sidebar__email { font-size: 12px; color: var(--on-ink-3); }

.sidebar__signout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-ink-2);
  text-align: left;
}
.sidebar__signout svg { width: 18px; height: 18px; }
.sidebar__signout:hover { background: rgba(229, 72, 77, .14); color: #FF8A8E; }

/* ── Bottom tab bar (phone) ─────────────────────────────────── */
.tabbar { display: none; }

@media (max-width: 899px) {
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 290;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    padding: 6px 4px env(safe-area-inset-bottom, 0px);
    background: rgba(28, 28, 46, .96);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, .08);
  }
}
.tabbar__item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--on-ink-3);
  text-decoration: none;
}
.tabbar__item svg { width: 22px; height: 22px; }
.tabbar__item:hover { text-decoration: none; color: var(--on-ink-2); }
.tabbar__item--active,
.tabbar__item--active:hover { color: var(--accent-soft); }

/* ── Global header ──────────────────────────────────────────── */
.global-header {
  position: sticky;
  top: 0;
  z-index: 300;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: env(safe-area-inset-top, 0px) 12px 0;
  height: calc(var(--gh-height) + env(safe-area-inset-top, 0px));
  background: var(--ink);
  color: var(--on-ink);
}

.gh-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
.gh-brand:hover { text-decoration: none; }
.gh-brand img { width: 32px; height: 32px; border-radius: 8px; }
.gh-wordmark {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-ink);
}
.gh-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
  color: var(--on-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
  pointer-events: none;
  margin: 0;
}

@media (max-width: 899px) {
  body.portal .gh-wordmark { display: none; }
}

/* Desktop: the header is the page's title bar, over the content */
@media (min-width: 900px) {
  body.portal .global-header {
    position: static;
    height: auto;
    padding: 36px 40px 18px;
    background: transparent;
    color: var(--label);
  }
  body.portal .gh-brand,
  body.portal .gh-menu-wrap { display: none; }
  body.portal .gh-title {
    text-align: left;
    padding: 0;
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--label);
  }
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 650;
  padding: 10px 2px;
  background: none;
  border: none;
  cursor: pointer;
}
.detail-back:hover { color: var(--accent); }

.gh-menu-wrap { position: relative; flex-shrink: 0; }
.gh-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--on-ink);
  padding: 0;
  background: none;
}
.gh-menu-btn:hover { background: rgba(255, 255, 255, .10); }

/* ── Portal hamburger menu ─────────────────────────────────── */
.nav-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--label-2);
  transition: background 0.15s;
}
.nav-menu-btn:hover { background: var(--bg-primary); color: var(--label); }

.portal-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow-lift);
  z-index: 200;
}
.portal-menu[hidden] { display: none; }

.portal-menu__item {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 550;
  color: var(--label);
  text-decoration: none;
  text-align: left;
  line-height: 1.2;
  transition: background 0.1s;
}
.portal-menu__item:hover { background: var(--accent-bg); text-decoration: none; }
.portal-menu__sep { height: 1px; background: var(--separator); margin: 4px 8px; }
.portal-menu__signout { color: var(--destructive); }
.portal-menu__signout:hover { background: var(--destructive-bg); color: var(--destructive); }

/* ── Legacy narrow content column ───────────────────────────── */
.content {
  width: 100%;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}
@media (min-width: 768px)  { .content { max-width: 560px; margin: 0 auto; padding: 0; } }
@media (min-width: 1280px) { .content { max-width: 680px; } }

/* ── Grouped lists ──────────────────────────────────────────── */
.section-list { padding-top: 4px; }

.section { margin-bottom: 24px; }

.section-header {
  font-size: 12px;
  font-weight: 750;
  color: var(--label-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0 6px 9px;
}

.section-footer {
  font-size: 13px;
  color: var(--label-3);
  padding: 9px 6px 0;
  line-height: 1.5;
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--separator);
}

/* ── Rows ───────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 13px 20px;
  gap: 12px;
  position: relative;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--separator);
}

.row__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 16px;
}

.row__body { flex: 1; min-width: 0; }

.row__label { font-size: 16px; color: var(--label); font-weight: 550; }
.row__sublabel { font-size: 13.5px; color: var(--label-3); margin-top: 2px; }
.row__value { font-size: 15.5px; color: var(--label-2); text-align: right; flex-shrink: 0; font-weight: 550; }
.row__mono { font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.01em; }

.row--chevron .row__value::after,
.row--chevron::after {
  content: "";
  width: 8px;
  height: 13px;
  flex-shrink: 0;
  background: var(--label-4);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1 1l6 5.5L1 12' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1 1l6 5.5L1 12' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  margin-left: 6px;
}

.row--tappable { cursor: pointer; transition: background .12s; }
.row--tappable:hover { background: var(--bg-sunken); }
.row--tappable:active { background: var(--accent-bg); }

/* ── Status badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--active    { color: var(--green-text);  background: var(--green-bg); }
.badge--suspended { color: var(--orange-text); background: var(--orange-bg); }
.badge--pending   { color: var(--accent-strong); background: var(--accent-bg); }
.badge--cancelled { color: var(--gray);        background: var(--gray-bg); }
.badge--paid      { color: var(--green-text);  background: var(--green-bg); }
.badge--refunded  { color: var(--orange-text); background: var(--orange-bg); }
.badge--failed    { color: var(--destructive); background: var(--destructive-bg); }

/* ── Capsule (Line N, AI state) ─────────────────────────────── */
.capsule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 750;
  background: var(--accent-bg);
  color: var(--accent-strong);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 13px 22px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-blue);
}
.btn--primary:hover { background: var(--accent-strong); color: #fff; }

.btn--destructive {
  background: var(--destructive);
  color: #fff;
  box-shadow: 0 8px 20px rgba(229, 72, 77, .25);
}
.btn--destructive:hover { background: #CF3A3F; color: #fff; }

.btn--ghost {
  background: var(--bg-surface);
  color: var(--accent-strong);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { border-color: var(--accent); }

.btn--row {
  background: var(--bg-surface);
  color: var(--accent-strong);
  width: auto;
  padding: 8px 14px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Plan cards ─────────────────────────────────────────────── */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.plan-card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  border: 2px solid var(--separator);
  transition: border-color 0.15s, box-shadow .15s, transform .12s;
  box-shadow: var(--shadow-card);
}
.plan-card:hover { border-color: var(--accent-ring); }

.plan-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg), var(--shadow-card);
}

.plan-card__radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.plan-card--selected .plan-card__radio { border-color: var(--accent); background: var(--accent); }
.plan-card--selected .plan-card__radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.plan-card__body { flex: 1; }
.plan-card__name { font-size: 17px; font-weight: 750; color: var(--label); }
.plan-card__savings { font-size: 13px; color: var(--green-text); margin-top: 3px; font-weight: 650; }
.plan-card__price {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--label);
  text-align: right;
}
.plan-card__period { font-size: 12.5px; color: var(--label-3); text-align: right; }

/* ── Login provider buttons ─────────────────────────────────── */
.provider-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  transition: transform .12s, box-shadow .15s, border-color .15s;
  text-decoration: none;
}
.provider-btn:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 6px 16px rgba(21, 21, 42, .08); }
.provider-btn:active { transform: translateY(1px); }

.provider-btn--apple,
.provider-btn--google,
.provider-btn--amazon,
.provider-btn--microsoft {
  background: var(--bg-surface);
  color: var(--label);
  border: 1.5px solid var(--border);
}

.provider-btn__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .provider-btn__icon img[src*="apple-logo"] { filter: invert(1); }
}
:root[data-theme="dark"] .provider-btn__icon img[src*="apple-logo"] { filter: invert(1); }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(90vw, 380px);
}
@media (max-width: 899px) {
  body.portal #toast-container { bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom, 0px)); }
}

.toast {
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: rgba(28, 28, 46, 0.96);
  box-shadow: var(--shadow-lift);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: toast-in 0.25s ease, toast-out 0.25s ease 2.75s forwards;
  pointer-events: auto;
  max-width: 100%;
  text-align: center;
}
.toast--error { background: rgba(207, 58, 63, 0.97); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ── Spinner ────────────────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  gap: 16px;
  color: var(--label-3);
  font-size: 15px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--accent-bg);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  gap: 12px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: 24px;
}
.empty-state__icon { font-size: 44px; }
.empty-state__title { font-family: var(--font-display); font-size: 21px; font-weight: 750; color: var(--label); }
.empty-state__body  { font-size: 15px; color: var(--label-3); max-width: 420px; line-height: 1.55; }

/* ── Hero phone number (fallback) ───────────────────────────── */
.hero-number {
  text-align: center;
  padding: 24px 16px 12px;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 650;
  color: var(--label);
  letter-spacing: 0.02em;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 550;
}
.alert--warning     { background: var(--orange-bg); color: var(--orange-text); }
.alert--destructive { background: var(--destructive-bg); color: var(--destructive); }
.alert--info        { background: var(--accent-bg); color: var(--accent-strong); }

/* ── Step dots (generic) ────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--separator); }
.step-dot--active { background: var(--accent); width: 20px; border-radius: var(--radius-pill); }

/* ── Success ────────────────────────────────────────────────── */
.success-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  gap: 14px;
  text-align: center;
  background: var(--bg-surface);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--separator);
}

.success-check {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 10px var(--green-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes pop-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.success-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--label); }
.success-sub   { font-size: 15px; color: var(--label-3); }

/* ── Search input ───────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  gap: 10px;
  border: 1.5px solid var(--border);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 16px;
  color: var(--label);
  outline: none;
}
.search-bar input::placeholder { color: var(--label-4); }

/* ── Available number row ───────────────────────────────────── */
.number-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 12px;
  cursor: pointer;
  position: relative;
}
.number-row + .number-row::before {
  content: "";
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--separator);
}
.number-row:active { background: var(--accent-bg); }
.number-row--selected { background: var(--accent-bg); }
.number-row__num { flex: 1; font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--label); }
.number-row__region { font-size: 13px; color: var(--label-3); }
.number-row__check { color: var(--accent); font-size: 20px; opacity: 0; }
.number-row--selected .number-row__check { opacity: 1; }

/* ── Invoice row ────────────────────────────────────────────── */
.invoice-row {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  gap: 14px;
  position: relative;
}
.invoice-row + .invoice-row::before {
  content: "";
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--separator);
}
.invoice-row__body { flex: 1; min-width: 0; }
.invoice-row__date { font-size: 15.5px; color: var(--label); font-weight: 650; }
.invoice-row__desc { font-size: 13px; color: var(--label-3); margin-top: 2px; }
.invoice-row > div:last-child { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.invoice-row__amount {
  font-size: 16px;
  font-weight: 800;
  color: var(--label);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.invoice-row__amount--refunded { color: var(--orange-text); }

/* ── Subscription row ───────────────────────────────────────── */
.sub-row { padding: 15px 20px; position: relative; }
.sub-row + .sub-row::before {
  content: "";
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--separator);
}
.sub-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
.sub-row__phone { font-family: var(--font-mono); font-size: 16px; font-weight: 650; color: var(--label); }
.sub-row__meta { font-size: 13.5px; color: var(--label-3); }

/* ── Card on file: a payment-card visual ────────────────────── */
.card-on-file {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px;
  padding: 22px;
  min-height: 132px;
  border-radius: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(90% 120% at 100% 100%, rgba(43, 136, 235, .55), transparent 60%),
    linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%);
  box-shadow: 0 14px 30px rgba(28, 28, 46, .28);
}
.card-on-file__brand { font-size: 22px; }
.card-on-file__details { flex: 1; }
.card-on-file__number { font-size: 21px; font-family: var(--font-mono); font-weight: 650; letter-spacing: 0.08em; color: #fff; }
.card-on-file__exp { font-size: 13px; color: rgba(255, 255, 255, .7); margin-top: 6px; }

/* ── Country picker (legacy rows) ───────────────────────────── */
.country-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 12px;
  cursor: pointer;
  position: relative;
}
.country-row + .country-row::before {
  content: "";
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--separator);
}
.country-row:active { background: var(--accent-bg); }
.country-row__flag { font-size: 24px; }
.country-row__name { flex: 1; font-size: 16px; color: var(--label); }
.country-row__check { color: var(--accent); font-size: 20px; }

/* ── Detail header (legacy) ─────────────────────────────────── */
.detail-header {
  background: var(--bg-surface);
  padding: 24px 16px 20px;
  text-align: center;
  border-bottom: 1px solid var(--separator);
}
.detail-header__number { font-family: var(--font-mono); font-size: 24px; font-weight: 650; color: var(--label); }
.detail-header__meta { font-size: 14px; color: var(--label-3); margin-top: 4px; }

/* ── Number cards (My numbers, detail hero) ─────────────────── */
.num-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.num-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 212px;
  padding: 22px;
  border-radius: 24px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  background:
    radial-gradient(85% 110% at 100% 0%, rgba(43, 136, 235, .55), transparent 62%),
    linear-gradient(150deg, var(--ink-2) 0%, var(--ink) 70%);
  box-shadow: 0 14px 32px rgba(28, 28, 46, .22);
  transition: transform .15s, box-shadow .15s;
}
.num-card:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(28, 28, 46, .28); text-decoration: none; }
.num-card:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 3px; }
.num-card--blue {
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .22), transparent 60%),
    linear-gradient(140deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 32px rgba(43, 136, 235, .32);
}
.num-card__top,
.num-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.num-card__tier { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; opacity: .85; text-transform: uppercase; }
.num-card__country { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.num-card__country span:first-child { font-size: 18px; }
.num-card__number {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.num-card__plan { font-size: 13.5px; opacity: .78; margin-top: 4px; }
.num-card__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.num-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 750;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  white-space: nowrap;
}
.num-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.num-chip--live  { background: rgba(29, 185, 127, .22); color: #8DF5C9; }
.num-chip--warn  { background: rgba(245, 158, 11, .24); color: #FFD27A; }
.num-chip--line::before { display: none; }
.num-chip--status-active    { color: #8DF5C9; }
.num-chip--status-suspended,
.num-chip--status-pending_payment { color: #FFD27A; }
.num-chip--status-cancelled { color: rgba(255,255,255,.7); }

.num-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 212px;
  border-radius: 24px;
  border: 2px dashed var(--accent-ring);
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-weight: 750;
  font-size: 15.5px;
  text-decoration: none;
}
.num-add:hover { text-decoration: none; border-color: var(--accent); }
.num-add__plus {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  box-shadow: 0 6px 16px rgba(43, 136, 235, .22);
}

.num-hero { cursor: default; min-height: 0; margin-bottom: 22px; }
.num-hero:hover { transform: none; }
.num-hero .num-card__number { font-size: clamp(26px, 4vw, 34px); }

/* ── Inline back navigation (push-style) ─────────────────────── */
.view-stack { position: relative; }
.view-panel { display: none; }
.view-panel--active { display: block; }

/* ── Utility ────────────────────────────────────────────────── */
.mt-4  { margin-top:  4px; }
.mt-8  { margin-top:  8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom:  8px; }
.mb-16 { margin-bottom: 16px; }
.pb-safe { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }
.flex-1 { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Number card colours (picked per number) */
.num-card--c0 { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.22), transparent 60%), linear-gradient(140deg, #2B88EB 0%, #1F6FCB 100%); box-shadow: 0 14px 32px rgba(43,136,235,.32); }
.num-card--c1 { background: radial-gradient(85% 110% at 100% 0%, rgba(43,136,235,.55), transparent 62%), linear-gradient(150deg, #262640 0%, #1C1C2E 70%); }
.num-card--c2 { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(140deg, #0E7C86 0%, #13A69B 100%); box-shadow: 0 14px 32px rgba(14,124,134,.30); }
.num-card--c3 { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(140deg, #3446C4 0%, #5A6CF0 100%); box-shadow: 0 14px 32px rgba(52,70,196,.30); }
.num-card--c4 { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.16), transparent 60%), linear-gradient(140deg, #0F6E5C 0%, #19A77A 100%); box-shadow: 0 14px 32px rgba(15,110,92,.30); }
.num-card--c5 { background: radial-gradient(90% 120% at 100% 0%, rgba(255,255,255,.16), transparent 60%), linear-gradient(140deg, #134E7C 0%, #1F86B8 100%); box-shadow: 0 14px 32px rgba(19,78,124,.30); }

/* My numbers header + filter pills (as in the mock) */
.num-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: -6px 0 20px; }
.num-head__meta { font-size: 16px; color: var(--label-3); font-weight: 550; }
.num-head__add { width: auto; padding-left: 22px; padding-right: 22px; }
.num-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.num-pill {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--label-2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.num-pill span { color: var(--label-3); margin-left: 2px; }
.num-pill:hover { border-color: var(--accent); }
.num-pill--on { background: var(--ink); color: #fff; border-color: var(--ink); }
.num-pill--on span { color: rgba(255,255,255,.7); }
@media (max-width: 899px) {
  .num-head__add { width: 100%; }
}
