/* Pager PWA — Production Mobile Stylesheet (Round-1 Hardened)
 * Implements the approved Final UX ("Speed-Dial Tiles & Hold-to-Page") design system.
 * Strict CSP compatible (external stylesheet only, zero external URLs).
 */

:root {
  --bg-canvas: #0f1115;
  --bg-tile: #1a1f27;
  --bg-tile-pressed: #222833;
  --bg-tile-dim: #14181f;
  --bg-sheet: #161b23;
  --bg-chip: #212733;
  --bg-chip-active: #2a1c20;
  --bg-input: #11141b;
  --bg-pill: #1b2029;

  --border-subtle: #28303d;
  --border-strong: #364152;
  --border-dim: #212731;

  --text-primary: #f5f7fa;
  --text-secondary: #9ca6b5;
  --text-muted: #6f7a8b;

  --accent-page: #f04438;
  --accent-page-deep: #d92d20;
  --accent-sent: #22c55e;
  --accent-sent-text: #4ade80;
  --accent-sent-bg: rgba(34, 197, 94, 0.14);
  --accent-wait: #f59e0b;
  --accent-wait-deep: #d97706;
  --accent-wait-text: #fbbf24;
  --accent-wait-bg: rgba(245, 158, 11, 0.14);
  --accent-auth-top: #3b82f6;
  --accent-auth-bot: #2563eb;
  --accent-error-bg: rgba(240, 68, 56, 0.14);
  --accent-error-border: rgba(240, 68, 56, 0.4);
  --accent-error-text: #fca5a5;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
 * APP SHELL & VIEWS
 * ========================================================================= */
.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  padding-right: 20px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  padding-left: 20px;
}

.view-center {
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2.5px solid #28303d;
  border-top-color: #9ca6b5;
  animation: spin 0.75s linear infinite;
}

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

.loading-label {
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-secondary);
}

.offline-title {
  margin-top: 6px;
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.offline-sub {
  max-width: 280px;
  font-size: 15px;
  line-height: 22px;
  color: var(--text-secondary);
}

.offline-retry-btn {
  margin-top: 10px;
  max-width: 280px;
}

/* =========================================================================
 * SHARED EMBLEMS, AVATARS & ERROR BANNERS
 * ========================================================================= */
.app-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #252d3b 0%, #171c25 100%);
  border: 1px solid #323c4d;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.45);
  position: relative;
  flex-shrink: 0;
}

.app-emblem-sm { width: 28px; height: 28px; border-radius: 8px; }
.app-emblem-md { width: 58px; height: 58px; border-radius: 17px; }
.app-emblem-lg { width: 76px; height: 76px; border-radius: 22px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  user-select: none;
}

.avatar-md { width: 60px; height: 60px; font-size: 24px; }
.avatar-lg { width: 76px; height: 76px; font-size: 30px; }
.avatar-sm { width: 48px; height: 48px; font-size: 19px; }

.avatar-tone-0 { background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%); }
.avatar-tone-1 { background: linear-gradient(145deg, #a855f7 0%, #7e22ce 100%); }
.avatar-tone-2 { background: linear-gradient(145deg, #14b8a6 0%, #0f766e 100%); }
.avatar-tone-3 { background: linear-gradient(145deg, #f97316 0%, #c2410c 100%); }
.avatar-tone-4 { background: linear-gradient(145deg, #ec4899 0%, #be185d 100%); }
.avatar-tone-5 { background: linear-gradient(145deg, #6366f1 0%, #4338ca 100%); }
.avatar-tone-6 { background: linear-gradient(145deg, #10b981 0%, #047857 100%); }

.avatar-dim {
  opacity: 0.52;
  filter: saturate(0.65);
}

.avatar-pair {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-pair-lg {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-pair .avatar-sm {
  border: 3px solid var(--bg-tile);
}

.avatar-pair .avatar-sm + .avatar-sm {
  margin-left: -14px;
}

.avatar-pair-lg .avatar-md {
  border: 3.5px solid var(--bg-sheet);
}

.avatar-pair-lg .avatar-md + .avatar-md {
  margin-left: -16px;
}

.banner-error {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-error-bg);
  border: 1px solid var(--accent-error-border);
  color: var(--accent-error-text);
  font-size: 13.5px;
  line-height: 19px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.banner-action {
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.sheet-error { margin-top: 16px; }
.card-error { margin-top: 16px; }
.dialog-error { margin-top: 14px; }
.sent-error { margin-top: 16px; max-width: 340px; }
.unlock-error { margin-top: 20px; max-width: 340px; }

/* =========================================================================
 * SCREEN 1: HOME — 2-COLUMN SPEED-DIAL TILES
 * ========================================================================= */
.top-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 26px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.user-pill:active {
  background: #232a36;
  border-color: var(--border-strong);
}

.user-pill-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #2b3444;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-subtitle {
  margin-top: 10px;
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 400;
  color: var(--text-secondary);
}

.speed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.speed-tile-wrap {
  display: flex;
}

.speed-tile {
  min-height: 168px;
  width: 100%;
  border-radius: 24px;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.28);
  padding: 20px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.speed-tile:not(.cooldown):active {
  transform: scale(0.97);
  background: var(--bg-tile-pressed);
}

.speed-tile.cooldown {
  background: var(--bg-tile-dim);
  border-color: var(--border-dim);
  box-shadow: none;
}

.tile-name {
  margin-top: 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.speed-tile.cooldown .tile-name {
  color: var(--text-secondary);
}

.status-pill {
  margin-top: 8px;
  height: 24px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill.ready {
  background: var(--accent-sent-bg);
  color: var(--accent-sent-text);
}

.status-pill.ready .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-sent);
  flex-shrink: 0;
}

.status-pill.wait {
  background: var(--accent-wait-bg);
  color: var(--accent-wait-text);
}

.status-pill.group {
  background: #222834;
  color: var(--text-secondary);
}

.empty-state {
  margin: 48px auto;
  text-align: center;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.home-footer-note {
  margin-top: auto;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.055);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* =========================================================================
 * SUBTLE SIGN-OUT DIALOG
 * ========================================================================= */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dialog-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 340px;
  border-radius: 24px;
  background: var(--bg-sheet);
  border: 1px solid #303949;
  padding: 24px 20px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.dialog-title {
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.dialog-sub {
  margin-top: 6px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
}

.dialog-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-danger {
  width: 100%;
  height: 50px;
  border-radius: 15px;
  background: #2b1d22;
  border: 1px solid rgba(240, 68, 56, 0.45);
  color: #ff8a80;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-danger:disabled {
  opacity: 0.6;
}

/* =========================================================================
 * SCREEN 2: CONFIRM PAGE BOTTOM SHEET (HOLD-TO-PAGE)
 * ========================================================================= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.confirm-scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 11, 15, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.confirm-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  background: var(--bg-sheet);
  border-top: 1px solid #303949;
  border-radius: 32px 32px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 28px);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sheetUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetUp {
  from {
    transform: translateY(28px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: #3b4557;
  margin-bottom: 22px;
}

.confirm-avatar-slot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-title {
  margin-top: 16px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  text-align: center;
}

.confirm-sub {
  margin-top: 6px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.section-label {
  width: 100%;
  margin-top: 24px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.preset-chips {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.preset-chip {
  height: 46px;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--bg-chip);
  border: 1.5px solid #303949;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex: 1 1 auto;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.preset-chip .chip-check {
  display: none;
}

.preset-chip.selected {
  background: var(--bg-chip-active);
  border-color: var(--accent-page);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(240, 68, 56, 0.25);
}

.preset-chip.selected .chip-check {
  display: inline-block;
}

.note-input {
  width: 100%;
  height: 50px;
  margin-top: 14px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 16px;
  line-height: 20px;
  font-weight: 400;
  color: var(--text-primary);
  appearance: none;
}

.note-input::placeholder {
  color: var(--text-muted);
}

/* Message controls while a retry must repeat the first attempt exactly. */
.preset-chip:disabled,
.note-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.locked-note {
  width: 100%;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
}

.locked-note-action {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.hold-btn {
  --hold-pct: 0%;
  width: 100%;
  height: 68px;
  margin-top: 22px;
  padding: 0 20px 0 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f04438 0%, #d92d20 100%);
  box-shadow:
    0 12px 28px rgba(240, 68, 56, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: transform 0.12s ease;
}

.hold-btn.holding {
  transform: scale(0.985);
}

.hold-btn.sending {
  opacity: 0.85;
}

.hold-btn-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--hold-pct);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.08) 100%);
  pointer-events: none;
}

.hold-btn-track {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3.5px;
  background: rgba(0, 0, 0, 0.24);
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
}

.hold-btn-track-bar {
  display: block;
  width: var(--hold-pct);
  height: 100%;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
}

.hold-arc-icon {
  width: 34px;
  height: 34px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  pointer-events: none;
}

.hold-btn-label {
  position: relative;
  z-index: 2;
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  pointer-events: none;
}

.hold-caption {
  margin-top: 11px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.cancel-btn {
  margin-top: 10px;
  height: 44px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* =========================================================================
 * SCREEN 3: ALERT SENT (FULL SUCCESS + AMBER PARTIAL STATE)
 * ========================================================================= */
.view-sent {
  align-items: center;
}

.sent-center {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 20px;
}

.sent-halo {
  width: 136px;
  height: 136px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.22) 0%, rgba(34, 197, 94, 0.04) 68%, transparent 100%);
  border: 1px solid rgba(34, 197, 94, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sent-circle {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
  box-shadow:
    0 12px 30px rgba(34, 197, 94, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-sent.partial .sent-halo {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.24) 0%, rgba(245, 158, 11, 0.04) 68%, transparent 100%);
  border-color: rgba(245, 158, 11, 0.28);
}

.view-sent.partial .sent-circle {
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
  box-shadow:
    0 12px 30px rgba(245, 158, 11, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sent-title {
  margin-top: 24px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.sent-meta-pill {
  margin-top: 14px;
  min-height: 34px;
  max-width: 100%;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.sent-meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent-sent);
  flex-shrink: 0;
}

.view-sent.partial .sent-meta-dot {
  background: var(--accent-wait);
}

.sent-sub {
  margin-top: 16px;
  max-width: 270px;
  font-size: 16px;
  line-height: 23px;
  font-weight: 400;
  color: var(--text-secondary);
  text-wrap: balance;
}

.partial-card {
  width: 100%;
  max-width: 340px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--bg-tile);
  border: 1px solid rgba(245, 158, 11, 0.32);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.partial-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  line-height: 20px;
}

.partial-label {
  font-weight: 600;
  white-space: nowrap;
}

.partial-ok { color: var(--accent-sent-text); }
.partial-warn { color: var(--accent-wait-text); }

.partial-names {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.sent-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-partial-retry {
  width: 100%;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--accent-wait) 0%, var(--accent-wait-deep) 100%);
  box-shadow:
    0 10px 24px rgba(245, 158, 11, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
  color: #11141b;
}

.btn-partial-retry:disabled {
  opacity: 0.65;
}

.btn-secondary {
  width: 100%;
  height: 58px;
  border-radius: 18px;
  background: var(--bg-tile);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-secondary:active {
  background: var(--bg-tile-pressed);
}

/* =========================================================================
 * SCREEN 4: FIRST-TIME SETUP (8-CHAR CROCKFORD CODE)
 * ========================================================================= */
.view-setup {
  align-items: center;
}

.a2hs-tip {
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  background: #142033;
  border: 1px solid #243b5e;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 600;
  color: #93c5fd;
  text-align: center;
}

.setup-card,
.unsupported-card {
  width: 100%;
  margin-top: 28px;
  padding: 28px 16px 26px;
  border-radius: 28px;
  background: var(--bg-sheet);
  border: 1px solid var(--border-subtle);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.setup-title {
  margin-top: 18px;
  font-size: 27px;
  line-height: 33px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.setup-sub {
  margin-top: 8px;
  font-size: 15.5px;
  line-height: 22px;
  font-weight: 400;
  color: var(--text-secondary);
}

.code-row {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.code-box {
  width: 34px;
  height: 48px;
  min-width: 0;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1.5px solid #354155;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  color: var(--text-primary);
  appearance: none;
}

.code-box:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.code-dash {
  width: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

.code-hint {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 500;
  color: var(--accent-wait-text);
}

.btn-auth {
  width: 100%;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--accent-auth-top) 0%, var(--accent-auth-bot) 100%);
  box-shadow:
    0 10px 24px rgba(37, 99, 235, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn-auth:active:not(:disabled) {
  transform: scale(0.985);
}

.btn-auth:disabled {
  opacity: 0.65;
}

.setup-card .btn-auth {
  margin-top: 24px;
}

.setup-footnote {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 17px;
  font-weight: 500;
  color: var(--text-muted);
}

.text-link-btn {
  margin-top: 18px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  border-radius: 12px;
}

.text-link-btn:active {
  color: var(--text-primary);
}

.text-link-btn.prominent {
  margin-top: 14px;
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-tile);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 15px;
}

/* =========================================================================
 * SCREEN 5: QUICK UNLOCK
 * ========================================================================= */
.view-unlock {
  align-items: center;
}

.unlock-center {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 24px;
}

.lock-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #1b2230;
  border: 2.5px solid var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
}

.unlock-title {
  margin-top: 24px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.unlock-sub {
  margin-top: 8px;
  font-size: 16px;
  line-height: 23px;
  font-weight: 400;
  color: var(--text-secondary);
}

.unlock-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================================================================
 * COMPACT 320px–360px SCREENS (iPhone SE / Zoomed Display)
 * ========================================================================= */
@media (max-width: 360px) {
  .view {
    padding-left: 14px;
    padding-right: 14px;
  }
  .setup-card {
    padding: 24px 12px 22px;
  }
  .code-row {
    gap: 3px;
  }
  .code-box {
    width: 28px;
    height: 44px;
    font-size: 17px;
    border-radius: 8px;
  }
  .code-dash {
    width: 9px;
    font-size: 14px;
  }
  .preset-chip {
    font-size: 13px;
    padding: 0 7px;
    gap: 4px;
  }
  .home-footer-note {
    font-size: 11.5px;
    padding: 11px 10px;
  }
}
