.page {
  width: min(calc(100% - 2 * var(--gutter)), 480px);
  margin: 0 auto;
  padding-block: var(--space-8) var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
}

.brand-lockup:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  color: var(--on-accent);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}

.otp-card {
  padding: clamp(var(--space-5), 7vw, var(--space-8));
}

.eyebrow {
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.otp-card h1 {
  font-size: clamp(26px, 7vw, 32px);
}

.intro {
  margin-bottom: var(--space-6);
  color: var(--muted);
  line-height: 1.65;
}

.verification-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
}

.verification-steps li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.step-index {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--fill);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.verification-steps .is-current {
  color: var(--text);
  font-weight: 500;
}

.verification-steps .is-current .step-index {
  background: var(--accent);
  color: var(--on-accent);
}

.verification-steps .is-complete .step-index {
  background: var(--success-soft);
  color: var(--success);
}

.field-label {
  margin-bottom: var(--space-2);
}

.phone-field {
  display: flex;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--fill);
}

.country-code {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: var(--space-2);
  padding-inline: var(--space-3);
  border-right: 1px solid var(--separator);
  color: var(--muted);
  font-size: var(--text-md);
  white-space: nowrap;
}

.country-code span {
  color: var(--text);
  font-weight: 500;
}

.phone-field .input {
  border-radius: 0;
  background: transparent;
}

.phone-field:focus-within {
  box-shadow: 0 0 0 4px var(--focus);
}

.phone-field .input:focus {
  box-shadow: none;
}

.hint {
  display: block;
  margin-top: var(--space-2);
}

#send-button {
  margin-top: var(--space-4);
}

.mode-banner,
.notice {
  margin-bottom: var(--space-4);
}

.mode-banner {
  background: var(--info-soft);
  color: var(--info);
}

.mode-banner .badge {
  flex: 0 0 auto;
}

.mode-banner > span:last-child {
  color: var(--text);
}

.demo-code-panel {
  gap: var(--space-2);
  margin-block: var(--space-5);
  padding: var(--space-5);
  text-align: center;
}

.demo-code-panel span {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.demo-code-panel strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
}

.demo-code-panel p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

#verify-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--separator);
}

.turnstile {
  margin-top: var(--space-4);
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-1) var(--space-2);
  padding-block: var(--space-5);
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
}

footer a {
  display: inline-flex;
}

.brand-divider {
  margin-inline: var(--space-1);
  color: var(--muted);
  font-weight: 400;
}

#auth-layout[hidden],
#dashboard[hidden] {
  display: none;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.auth-story {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  background: #0a0a0a;
  color: #fff;
}

.auth-story::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(560px 380px at 88% 4%, rgb(255 255 255 / 0.14), transparent 70%),
    radial-gradient(520px 420px at 0% 100%, rgb(255 255 255 / 0.07), transparent 70%),
    linear-gradient(rgb(255 255 255 / 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgb(255 255 255 / 0.04) 1px, transparent 1px) 0 0 / 32px 32px;
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
  content: "";
}

.auth-brand,
.auth-mobile-brand,
.dashboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
}

.auth-brand:hover,
.auth-mobile-brand:hover,
.dashboard-brand:hover {
  text-decoration: none;
}

.auth-story .brand-mark {
  color: #0a0a0a;
  background: #fff;
}

.auth-story-content {
  width: min(100%, 520px);
  margin: auto 0;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-4);
  color: rgb(255 255 255 / 0.66);
  font-size: var(--text-sm);
  font-weight: 500;
}

.auth-kicker > span,
.auth-preview-status i,
.topbar-status i,
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
}

.auth-story h1 {
  max-width: 500px;
  margin: 0 0 var(--space-4);
  color: #fff;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-story-content > p {
  max-width: 440px;
  margin: 0;
  color: rgb(255 255 255 / 0.68);
  font-size: var(--text-lg);
  line-height: 1.55;
}

.auth-preview {
  max-width: 460px;
  margin-top: clamp(24px, 5vh, 48px);
  padding: 18px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 0.06);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.38);
  backdrop-filter: blur(8px);
}

.auth-preview-head,
.auth-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-preview-head {
  color: rgb(255 255 255 / 0.86);
  font-size: var(--text-sm);
  font-weight: 600;
}

.auth-preview-period {
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.1);
  color: rgb(255 255 255 / 0.68);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.auth-preview-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-block: 16px;
}

.auth-preview-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.18);
}

.auth-preview-stats > div > span {
  color: rgb(255 255 255 / 0.56);
  font-size: var(--text-xs);
}

.auth-preview-stats strong {
  color: #fff;
  font-size: var(--text-lg);
}

.auth-preview-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm) !important;
}

.auth-preview-status i {
  display: inline-block;
}

.auth-preview-row {
  padding-top: 11px;
  border-top: 1px solid rgb(255 255 255 / 0.1);
}

.auth-preview-row + .auth-preview-row {
  margin-top: 11px;
}

.auth-preview-phone {
  color: rgb(255 255 255 / 0.82);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.auth-preview-badge {
  padding: 4px 8px;
  border-radius: var(--radius-full);
  background: rgb(59 158 255 / 0.16);
  color: #8bc7ff;
  font-size: 10px;
  font-weight: 600;
}

.auth-story-note {
  margin: 0;
  color: rgb(255 255 255 / 0.48);
  font-size: var(--text-xs);
}

.auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 76px clamp(24px, 6vw, 80px) 32px;
}

.auth-topbar {
  position: absolute;
  top: 20px;
  right: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
}

.auth-mobile-brand {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  margin-inline: auto;
  padding: clamp(24px, 4vw, 36px);
}

.login-card .eyebrow {
  margin-bottom: 8px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.login-intro {
  margin: 0 0 var(--space-5);
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  --gap: var(--space-4);
}

.login-form .btn {
  min-height: 44px;
  margin-top: 4px;
}

.privacy-note,
.dashboard-subtitle {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.privacy-note {
  margin: var(--space-4) 0 0;
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: min(420px, 100%);
  margin: auto auto 0;
  padding-top: var(--space-8);
  color: var(--muted);
  font-size: var(--text-xs);
}

.auth-footer a {
  color: inherit;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--separator);
  background: var(--surface);
}

.dashboard-brand {
  padding-inline: 5px;
  color: var(--text);
}

.dashboard-brand .brand-mark {
  width: 30px;
  height: 30px;
}

.workspace-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--surface);
}

.workspace-mark {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.workspace-switch > span:nth-child(2),
.sidebar-mode > span:last-child,
.sidebar-account-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.workspace-switch strong,
.sidebar-mode strong,
.sidebar-account-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-switch small,
.sidebar-mode small,
.sidebar-account-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-switch > svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-label {
  margin: 4px 10px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.side-link:hover {
  background: var(--fill);
  color: var(--text);
  text-decoration: none;
}

.side-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.side-link svg {
  flex: 0 0 auto;
}

.sidebar-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 10px;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.sidebar-mode .status-dot {
  flex: 0 0 auto;
}

.dashboard-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--separator);
}

.dashboard-sidebar-foot .theme-switch {
  align-self: flex-start;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 4px;
}

.admin-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--separator);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.logout-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.logout-button:hover {
  background: var(--fill);
  color: var(--text);
}

.dashboard-main {
  min-width: 0;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--separator);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.breadcrumbs a {
  color: inherit;
}

.breadcrumbs strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: var(--text-xs);
}

.topbar-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
}

.dashboard-content {
  width: min(100%, 1320px);
  margin-inline: auto;
  padding: clamp(24px, 4vw, 48px);
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.dashboard-heading .eyebrow {
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.dashboard-heading h1 {
  margin: 0 0 5px;
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.dashboard-subtitle {
  margin: 0;
}

.send-link {
  text-decoration: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 138px;
  padding: 18px;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.stat-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
}

.total-icon {
  background: var(--info-soft);
  color: var(--info);
}

.accepted-icon {
  background: var(--success-soft);
  color: var(--success);
}

.failed-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-card strong {
  font-size: var(--text-2xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.stat-card small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.history-card {
  overflow: hidden;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 18px 20px;
  border-bottom: 1px solid var(--separator);
}

.history-header h2 {
  margin: 0 0 5px;
  font-size: var(--text-lg);
}

.history-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.history-table-wrap {
  border-radius: 0;
  box-shadow: none;
}

.history-table-wrap .table th,
.history-table-wrap .table td {
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.empty-state {
  margin: 0;
}

.dashboard-privacy {
  margin-top: var(--space-4);
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-story {
    min-height: 0;
    gap: 22px;
    padding: 24px clamp(24px, 6vw, 48px);
  }

  .auth-story-content {
    width: 100%;
  }

  .auth-story h1 {
    max-width: 680px;
    font-size: clamp(28px, 6vw, 40px);
  }

  .auth-story-content > p {
    font-size: var(--text-base);
  }

  .auth-preview {
    max-width: 560px;
    margin-top: 20px;
    padding: 14px;
  }

  .auth-story-note {
    display: none;
  }

  .auth-main {
    min-height: 500px;
    padding: 64px 24px 28px;
  }

  .auth-topbar {
    justify-content: space-between;
  }

  .auth-mobile-brand {
    display: inline-flex;
    color: var(--text);
  }

  .auth-mobile-brand .brand-mark {
    width: 28px;
    height: 28px;
  }

  .auth-footer {
    padding-top: 24px;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-sidebar {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(160px, 220px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    height: auto;
    padding: 12px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }

  .dashboard-nav {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .sidebar-label,
  .sidebar-mode {
    display: none;
  }

  .side-link {
    min-height: 34px;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .dashboard-sidebar-foot {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
  }

  .dashboard-sidebar-foot .theme-switch {
    align-self: center;
  }
}

@media (max-width: 600px) {
  .auth-story {
    padding: 20px;
  }

  .auth-preview-stats {
    margin-block: 12px;
  }

  .auth-preview-stats > div {
    padding: 10px;
  }

  .auth-main {
    min-height: 470px;
    padding: 60px 16px 24px;
  }

  .login-card {
    padding: 22px;
  }

  .auth-footer {
    font-size: 10px;
  }

  .dashboard-sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    padding: 12px 16px;
  }

  .workspace-switch {
    display: none;
  }

  .dashboard-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dashboard-nav::-webkit-scrollbar {
    display: none;
  }

  .side-link {
    flex: 0 0 auto;
  }

  .dashboard-sidebar-foot {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-top: 8px;
  }

  .dashboard-topbar {
    min-height: 48px;
    padding-inline: 16px;
  }

  .dashboard-content {
    padding: 24px 16px 32px;
  }

  .dashboard-heading {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .dashboard-heading h1 {
    font-size: 26px;
  }

  .send-link {
    margin-top: 15px;
  }

  .stats {
    gap: 8px;
    margin-bottom: 14px;
  }

  .stat-card {
    min-height: 116px;
    gap: 7px;
    padding: 12px 10px;
  }

  .stat-label {
    align-items: flex-start;
    gap: 6px;
    font-size: 10px;
    line-height: 1.35;
  }

  .stat-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .stat-card small {
    font-size: 10px;
    line-height: 1.3;
  }

  .history-header {
    align-items: flex-start;
    padding: 14px;
  }

  .history-header p {
    max-width: 230px;
    line-height: 1.45;
  }

  .refresh-button {
    width: 34px;
    height: 34px;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .refresh-button svg {
    flex: 0 0 auto;
  }

  .history-table-wrap .table thead {
    display: none;
  }

  .history-table-wrap .table tbody {
    display: grid;
  }

  .history-table-wrap .table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-4);
  }

  .history-table-wrap .table tbody tr + tr {
    border-top: 1px solid var(--separator);
  }

  .history-table-wrap .table tbody td {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .history-table-wrap .table tbody td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
  }

  .history-table-wrap .table tbody td:not(:first-child)::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 500;
  }

  .history-table-wrap .table tbody td:last-child {
    justify-content: flex-end;
  }

  .history-table-wrap .table tbody td:last-child::before {
    display: none;
  }

  .history-table-wrap .status-badge {
    white-space: nowrap;
  }
}
