/* ==========================================================================
   AfterUs design system
   Neutral ink and paper base, deep teal primary, warm copper accent.
   Spacing on an 8px grid. Body 150% line height, headings 120%.
   ========================================================================== */

:root {
  --n-0: #ffffff;
  --n-50: #f7f6f3;
  --n-100: #eeece7;
  --n-200: #dcd9d1;
  --n-400: #8f8b83;
  --n-600: #5f5b54;
  --n-800: #22211f;
  --n-900: #141413;
  --n-950: #0b0b0a;

  --p-100: #c9e9e1;
  --p-300: #6fc1ae;
  --p-500: #2f9c86;
  --p-700: #1b6456;
  --p-900: #0d3129;

  --a-100: #f7e3d2;
  --a-300: #e7b68c;
  --a-400: #dd9a66;
  --a-600: #a9632f;
  --a-800: #5e3416;

  --s-100: #e4eaf1;
  --s-400: #7d93ab;
  --s-600: #4b6583;
  --s-800: #2c3e54;

  --ok-300: #7fd6a2;
  --ok-600: #1f7a45;
  --warn-300: #f0c26b;
  --warn-600: #8a5a0b;
  --err-300: #ff9b8a;
  --err-600: #b3321f;

  --bg: var(--n-950);
  --surface: var(--n-900);
  --surface-2: var(--n-800);
  --track-off: #3a3935;
  --text: #f4f2ec;
  --text-muted: #b0aba2;
  --border: rgba(244, 242, 236, 0.1);
  --border-strong: rgba(244, 242, 236, 0.22);
  --primary: var(--p-300);
  --primary-fill: var(--p-300);
  --on-primary: var(--n-950);
  --accent: var(--a-400);
  --accent-soft: rgba(221, 154, 102, 0.14);
  --focus: var(--p-300);
  --success: var(--ok-300);
  --success-fill: var(--ok-300);
  --danger: var(--err-300);
  --glass: rgba(20, 20, 19, 0.82);
  --shadow-lg: 0 32px 80px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.3);

  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: dark;
  accent-color: var(--primary);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: var(--n-100);
    --surface: var(--n-0);
    --surface-2: var(--n-100);
    --track-off: #d6d3cb;
    --text: var(--n-900);
    --text-muted: var(--n-600);
    --border: rgba(20, 20, 19, 0.08);
    --border-strong: rgba(20, 20, 19, 0.18);
    --primary: var(--p-700);
    --primary-fill: var(--p-700);
    --on-primary: var(--n-0);
    --accent: var(--a-600);
    --accent-soft: var(--a-100);
    --focus: var(--p-700);
    --success: var(--ok-600);
    --success-fill: var(--ok-600);
    --danger: var(--err-600);
    --glass: rgba(255, 255, 255, 0.86);
    --shadow-lg: 0 32px 80px rgba(20, 20, 19, 0.14);
    --shadow-md: 0 16px 40px rgba(20, 20, 19, 0.08);
    color-scheme: light;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface-2);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ==========================================================================
   Shared atoms
   ========================================================================== */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--text);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-fill);
  border-color: transparent;
  color: var(--on-primary);
}

.btn-primary:hover:not(:disabled) {
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(111, 193, 174, 0.25);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: transparent;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  min-height: 52px;
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  border-radius: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-verified {
  background: transparent;
  color: var(--success);
  box-shadow: inset 0 0 0 1px currentColor;
}

.tag-guard {
  background: transparent;
  color: var(--primary);
  box-shadow: inset 0 0 0 1px currentColor;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}

.eyebrow-inverse {
  color: var(--p-300);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--success-fill);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(127, 214, 162, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(127, 214, 162, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(127, 214, 162, 0);
  }
}

.text-accent {
  color: var(--accent);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.note {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.note strong {
  color: var(--text);
}

/* ==========================================================================
   Marketing header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 8px 12px;
}

.nav-bar {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 28px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
}

@media (min-width: 960px) {
  .nav-bar {
    border-radius: 999px;
    padding: 8px 8px 8px 20px;
  }
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 24px;
}

@media (min-width: 960px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-cta {
  display: none;
}

@media (min-width: 600px) {
  .nav-cta {
    display: inline-flex;
  }
}

.mode-switcher {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.mode-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Landing
   ========================================================================== */
.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 96px;
}

.hero {
  display: grid;
  gap: 48px;
  align-items: center;
  padding: 48px 0 32px;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 64px;
    padding-top: 96px;
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.hero-title {
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-title-accent {
  display: block;
  color: var(--primary);
}

.hero-lead {
  max-width: 52ch;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-metrics {
  list-style: none;
  margin: 16px 0 0;
  padding: 24px 0 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  border-top: 1px solid var(--border);
}

.hero-metrics strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.hero-metrics span {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.phone {
  width: 100%;
  max-width: 340px;
  padding: 12px;
  border-radius: 48px;
  background: linear-gradient(160deg, #3a3a37, #161615 50%, #2a2a27);
  box-shadow: var(--shadow-lg), inset 0 1px 2px rgba(255, 255, 255, 0.18);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.phone-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 620px;
  padding: 16px;
  border-radius: 38px;
  background: var(--n-950);
  color: var(--n-50);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dynamic-island {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #000;
  color: var(--p-300);
  font-size: 0.6875rem;
  font-weight: 600;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.phone-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
}

.phone-sub {
  font-size: 0.75rem;
  color: var(--n-400);
}

.phone-header .tag {
  color: var(--n-200);
  background: rgba(255, 255, 255, 0.06);
}

.hero-mock-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.hero-mock-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: var(--n-800);
}

.hero-mock-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: filter 0.45s ease, transform 0.45s ease;
}

.hero-mock-card.is-sealed img {
  filter: blur(14px) brightness(0.4);
  transform: scale(1.08);
}

.hero-mock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  background: rgba(11, 11, 10, 0.5);
  color: var(--p-300);
  font-size: 0.6875rem;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

.hero-mock-card.is-sealed .hero-mock-overlay {
  opacity: 1;
}

.hero-mock-sub {
  color: var(--n-400);
  font-size: 0.625rem;
}

.phone-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 24px;
  background: var(--n-900);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.phone-footer .btn-ghost {
  color: var(--n-200);
}

.guard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--n-200);
}

.section {
  padding: 96px 0 0;
}

.section-header {
  max-width: 720px;
  margin: 0 auto 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.section-title {
  font-size: clamp(1.875rem, 1.3rem + 2vw, 2.75rem);
  font-weight: 700;
}

.section-sub {
  color: var(--text-muted);
  font-size: 1.0625rem;
  max-width: 60ch;
}

.card-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 860px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card h3 {
  font-size: 1.25rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

@media (min-width: 860px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

.step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0;
  border-top: 2px solid var(--border);
  transition: border-color 0.3s ease;
}

.step:hover {
  border-top-color: var(--primary);
}

.step-num {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
}

.step h3 {
  font-size: 1.25rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.security-band {
  display: grid;
  gap: 32px;
  padding: 48px 32px;
  border-radius: 32px;
  background: var(--n-950);
  color: var(--n-50);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 860px) {
  .security-band {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 64px;
    gap: 64px;
  }
}

.security-band .section-title {
  color: var(--n-50);
}

.security-band .section-sub {
  text-align: left;
  color: var(--n-400);
  margin-top: 16px;
}

.security-copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.security-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.security-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.2s ease;
}

.security-list li:hover {
  background: rgba(255, 255, 255, 0.07);
}

.security-list strong {
  font-size: 1rem;
  color: var(--n-50);
}

.security-list span {
  font-size: 0.875rem;
  color: var(--n-400);
}

.matrix-card {
  overflow-x: auto;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.matrix-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.matrix-table th,
.matrix-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.matrix-table thead th {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
}

.matrix-table tbody th {
  font-weight: 600;
}

.matrix-table tbody tr:last-child th,
.matrix-table tbody tr:last-child td {
  border-bottom: none;
}

.matrix-table tbody tr {
  transition: background 0.2s ease;
}

.matrix-table tbody tr:hover {
  background: var(--surface-2);
}

.col-highlight {
  background: var(--accent-soft);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.mark::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--n-400);
}

.mark-yes {
  color: var(--text);
  font-weight: 600;
}

.mark-yes::before {
  background: var(--success-fill);
}

.mark-no::before {
  background: var(--danger);
}

.pricing-grid {
  display: grid;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
}

@media (min-width: 780px) {
  .pricing-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px;
  border-radius: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.price-card-featured {
  border: 2px solid var(--primary);
  box-shadow: 0 24px 60px rgba(111, 193, 174, 0.14);
}

.price-card h3 {
  font-size: 1.5rem;
}

.price-amount {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 1.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.price-period {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.price-note {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.price-list {
  list-style: none;
  margin: 8px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9375rem;
}

.price-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.check {
  color: var(--success);
  font-weight: 700;
}

.price-card .btn {
  margin-top: auto;
}

.faq {
  max-width: 760px;
  margin: 48px auto 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  padding: 16px 24px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.site-footer {
  margin-top: 96px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   Vault app shell
   ========================================================================== */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
}

.app-title-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--border);
}

.app-tab-btn {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 6px 4px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.app-tab-btn.active {
  color: var(--primary);
}

.tab-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.app-tab-btn.active .tab-icon {
  transform: translateY(-2px);
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px calc(104px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-card {
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 12px 16px;
}

.status-row + .status-row {
  border-top: 1px solid var(--border);
}

.status-toggle {
  cursor: pointer;
}

.status-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
}

.status-value {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.tab-section {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-section.active {
  display: flex;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title {
  font-size: 1.25rem;
}

.panel-sub {
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(111, 193, 174, 0.2);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row .btn {
  flex: 1 1 auto;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-tile {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--bg);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.photo-tile:active {
  transform: scale(0.97);
}

.photo-tile.selected {
  border-color: var(--primary);
}

.photo-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.photo-tile:not(.selected) img {
  filter: saturate(0.6);
  opacity: 0.75;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(11, 11, 10, 0.75);
  color: var(--n-50);
  backdrop-filter: blur(6px);
}

.photo-tile.selected .photo-badge {
  background: var(--primary);
  color: var(--n-950);
}

.photo-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 8px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: var(--n-50);
  font-size: 0.8125rem;
}

.photo-meta strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-meta span {
  font-size: 0.6875rem;
  color: var(--n-200);
}

input[type="checkbox"][switch] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background-color: var(--track-off);
  background-image: radial-gradient(circle, #fff 0 13px, transparent 14px);
  background-size: 27px 27px;
  background-repeat: no-repeat;
  background-position: 2px center;
  cursor: pointer;
  transition: background-position 0.22s ease, background-color 0.22s ease;
}

input[type="checkbox"][switch]:checked {
  background-color: var(--success-fill);
  background-position: right 2px center;
}

input[type="checkbox"][switch]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 0.9375rem;
}

.check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 8px;
  border: 2px solid var(--border-strong);
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
  opacity: 1;
}

.check-item input[type="checkbox"]:checked {
  background-color: var(--success-fill);
  border-color: var(--success-fill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}

.check-item span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-muted);
}

.check-item span strong {
  font-weight: 600;
  color: var(--text);
}

.capsule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capsule-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.capsule-item.result-ok {
  border-color: var(--success);
}

.capsule-item.result-fail {
  border-color: var(--danger);
}

.capsule-empty {
  align-items: center;
  text-align: center;
  padding: 32px 16px;
}

.capsule-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.capsule-title {
  font-size: 1rem;
}

.capsule-meta {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.capsule-tags,
.capsule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.capsule-actions .btn {
  flex: 1 1 auto;
}

.code-block {
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-x: auto;
  overflow-wrap: anywhere;
}

.restored-thumb {
  width: 120px;
  border-radius: 16px;
}

.mt-2 {
  margin-top: 16px;
}

.share-preview {
  display: flex;
  justify-content: center;
  padding: 16px;
  border-radius: 20px;
  background: var(--bg);
}

#receiptCanvas {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  display: block;
  box-shadow: var(--shadow-md);
}

.toast {
  position: fixed;
  z-index: 60;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  animation: rise-in 0.3s ease;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Desktop: top segmented bar and two-column tabs */
@media (min-width: 900px) {
  .tabbar {
    position: static;
    width: fit-content;
    margin: 24px auto 0;
    padding: 4px;
    grid-template-columns: repeat(4, auto);
    gap: 4px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: none;
  }

  .app-tab-btn {
    flex-direction: row;
    min-height: 40px;
    padding: 8px 20px;
    font-size: 0.875rem;
  }

  .app-tab-btn.active {
    background: var(--surface-2);
  }

  .app-tab-btn.active .tab-icon {
    transform: none;
  }

  .tab-icon {
    width: 18px;
    height: 18px;
  }

  .app-content {
    padding: 24px 32px 64px;
  }

  #tab-seal,
  #tab-vault {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: start;
  }

  #tab-share {
    display: grid;
    grid-template-columns: 1fr 360px;
    align-items: start;
  }

  #tab-platforms {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }

  .photo-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .toast {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(420px, calc(100vw - 48px));
  }
}

/* ==========================================================================
   Dialogs as bottom sheets on phones, centered on desktop
   ========================================================================== */
dialog:modal,
dialog.modal {
  width: min(520px, 92vw);
  max-width: 92vw;
  margin: auto;
  padding: 24px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

dialog.modal[open] {
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

dialog::backdrop,
dialog.modal::backdrop {
  background: rgba(5, 5, 4, 0.6);
  backdrop-filter: blur(8px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.login-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-input-row .field-input {
  flex: 1;
}

.login-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(214, 90, 90, 0.14);
  border: 1px solid rgba(214, 90, 90, 0.4);
  color: #f4a4a4;
  font-size: 0.875rem;
}

@media (max-width: 899px) {
  dialog.modal {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 28px 28px 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.modal-body {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body .capsule-item p {
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Motion
   ========================================================================== */
.hero-copy > *,
.hero-visual {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-copy > *:nth-child(2) {
  animation-delay: 0.08s;
}

.hero-copy > *:nth-child(3) {
  animation-delay: 0.16s;
}

.hero-copy > *:nth-child(4) {
  animation-delay: 0.24s;
}

.hero-copy > *:nth-child(5) {
  animation-delay: 0.32s;
}

.hero-visual {
  animation-delay: 0.2s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .phone {
    animation: none;
  }
}
