/* ==========================================================================
   Anvitation design system (CDN Vault Core Asset)
   --------------------------------------------------------------------------
   One token layer, one type scale, one spacing rhythm.
   Naming: --{group}-{role}-{variant}. Never hardcode a hex in a component.
   ========================================================================== */

:root {
  /* ---- Type families ------------------------------------------------- */
  --font-ui: 'Archivo', 'Archivo Variable', system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  /* Invitation artifact faces (self-hosted, see layout.tsx imports) */
  --font-display: 'Cormorant Garamond Variable', 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Alex Brush', 'Great Vibes', cursive;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- Type scale (1.2 minor third, rounded to px) ------------------- */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: clamp(28px, 3.4vw, 38px);
  --text-5xl: clamp(34px, 5.2vw, 54px);

  --leading-tight: 1.18;
  --leading-snug: 1.35;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  --tracking-tight: -0.018em;
  --tracking-display: -0.028em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-label: 0.07em;

  --weight-regular: 420;
  --weight-medium: 520;
  --weight-semibold: 620;
  --weight-bold: 700;

  /* ---- Palette ------------------------------------------------------
     Neutral ramp is deliberately short (6 steps) so hierarchy is decided by
     weight/space, not by 20 near-identical grays.                        */
  --ink-900: #14151a; /* headings */
  --ink-700: #35383f; /* body strong */
  --ink-600: #4b4f57; /* body */
  --ink-500: #6b7079; /* secondary / meta (AA on white at 12px+) */
  --ink-400: #8b909a; /* disabled / decorative only */
  --ink-300: #c6c9d0; /* borders strong */

  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f6f6f8;
  --surface-sunken-2: #eeeef1;
  --surface-inverse: #14151a;
  /* Foreground for anything placed on --surface-inverse (a dark band, the
     auth aside, a selected chip). Aliased so intent is obvious at the call site. */
  --on-inverse: #ffffff;

  --border: #e6e7eb;
  --border-subtle: #eff0f3;
  --border-strong: #d3d5db;

  /* Brand: deep petrol — reads as premium stationery, still AA on white */
  --brand: #0f4c81;
  --brand-hover: #0b3c67;
  --brand-subtle: #eef4fa;
  --brand-border: #c6dcf0;
  --brand-ink: #0b3c67;

  /* Accent: warm brass, used *only* for purchase intent + price */
  --accent: #a97530;
  --accent-hover: #8d5f22;
  --accent-subtle: #fbf4e9;
  --accent-border: #ecd6b4;

  /* Semantic */
  --success: #17663f;
  --success-bg: #ecf7f0;
  --success-border: #bfe3cd;
  --warning: #8a5a00;
  --warning-bg: #fdf6e7;
  --warning-border: #f2dfb2;
  --danger: #b42318;
  --danger-bg: #fdf1f0;
  --danger-border: #f3c8c3;
  --info: var(--brand);
  --info-bg: var(--brand-subtle);
  --info-border: var(--brand-border);

  /* ---- Space (4px base + 2px half-steps for optical alignment) ------ */
  --space-0-5: 2px;
  --space-1: 4px;
  --space-1-5: 6px;
  --space-2: 8px;
  --space-2-5: 10px;
  --space-3: 12px;
  --space-3-5: 14px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ---- Mockup scale (landing illustrations only) --------------------
     The landing page shows scaled-down pictures of the real console. Those
     glyph sizes are physical sizes of a drawing, not of UI text, so they live
     on their own ramp instead of polluting the UI type scale.               */
  --mock-2xs: 8.5px;
  --mock-xs: 9px;
  --mock-sm: 10px;
  --mock-md: 10.5px;
  --mock-base: 11px;
  --mock-lg: 12px;
  --mock-xl: 15px;
  --mock-2xl: 22px;

  /* ---- Radius ------------------------------------------------------- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ---- Elevation (tinted, never pure black) ------------------------- */
  --shadow-xs: 0 1px 2px rgb(20 21 26 / 0.05);
  --shadow-sm: 0 1px 2px rgb(20 21 26 / 0.05), 0 2px 6px -2px rgb(20 21 26 / 0.06);
  --shadow-md: 0 2px 4px -2px rgb(20 21 26 / 0.06), 0 8px 20px -8px rgb(20 21 26 / 0.14);
  --shadow-lg: 0 12px 32px -12px rgb(20 21 26 / 0.22), 0 2px 6px -2px rgb(20 21 26 / 0.06);

  /* ---- Layout ------------------------------------------------------- */
  --container: 1160px;
  --container-narrow: 760px;
  --container-console: 1280px;
  --nav-h: 64px;
  --topbar-h: 58px;
  --rail-w: 240px;

  /* ---- Motion ------------------------------------------------------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 320ms;

  /* ---- Invitation artifact palette -----------------------------------
     The wedding page has its own material language (warm paper, sepia ink).
     It is intentionally different from the product UI, but it still belongs
     to the token layer so previews, thumbnails and the real page agree.    */
  --artifact-paper: #faf7f2;
  --artifact-paper-deep: #e6ddd1;
  --artifact-ink: #382e25;
  --artifact-ink-soft: #755b46;
  --artifact-ink-muted: #786755;
  --artifact-accent: #8c735b;
  --artifact-accent-deep: #79624c;
  --artifact-line: #d5c6b1;
  --artifact-card: #faf5ee;

  /* ---- Back-compat aliases (invitation artifact + older markup) ------ */
  --bg-primary: var(--surface);
  --bg-secondary: var(--surface-sunken);
  --bg-tertiary: var(--surface-sunken-2);
  --bg-card: var(--surface);
  --text-primary: var(--ink-900);
  --text-secondary: var(--ink-600);
  --text-muted: var(--ink-500);
  --primary: var(--brand);
  --primary-hover: var(--brand-hover);
  --border-default: var(--border);
  --border-subtle: var(--border-subtle);
  --radius-full: var(--radius-pill);
  --font-body: var(--font-ui);
  --font-heading: var(--font-ui);
  --ink: var(--ink-900);
  --ink-2: var(--ink-600);
  --ink-3: var(--ink-500);
  --ink-inverse: #ffffff;
  --canvas: var(--surface-sunken);
  --surface-hover: #fafafb;
  --brand-subtle-ink: var(--brand-ink);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--space-4));
  background: var(--surface);
  color-scheme: light;
}

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

body {
  min-height: 100vh;
  overflow-x: clip;
  background: var(--surface);
  color: var(--ink-700);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ink-900);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-4xl);
}
h2 {
  font-size: var(--text-3xl);
}
h3 {
  font-size: var(--text-xl);
}
h4 {
  font-size: var(--text-lg);
}

p {
  color: var(--ink-600);
  text-wrap: pretty;
}

strong,
b {
  font-weight: var(--weight-semibold);
  color: inherit;
}

small {
  font-size: var(--text-xs);
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img,
svg,
video {
  max-width: 100%;
}

img {
  height: auto;
}

ul,
ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--brand);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--space-4);
  z-index: 999;
  padding: var(--space-2) var(--space-4);
  background: var(--ink-900);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  top: var(--space-3);
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 640px) {
  .container,
  .container-narrow {
    padding-inline: var(--space-4);
  }
}

.stack {
  display: flex;
  flex-direction: column;
}
.stack-1 {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.stack-2 {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stack-3 {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.stack-4 {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stack-6 {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
/* legacy names kept so nothing silently loses spacing */
.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.row-nowrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.divider {
  height: 1px;
  border: 0;
  background: var(--border);
}

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

/* ==========================================================================
   Typography helpers
   ========================================================================== */

.display {
  font-size: var(--text-5xl);
  line-height: 1.04;
  letter-spacing: var(--tracking-display);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--ink-600);
  max-width: 58ch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--brand);
}

.eyebrow-neutral {
  color: var(--ink-500);
}

.meta {
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: var(--leading-snug);
}

.label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-500);
}

.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 6px 12px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-900);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.4;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-buy {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}
.btn-buy:hover:not(:disabled) {
  background: #000;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-900);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-sunken);
  border-color: var(--ink-300);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-600);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-sunken);
  color: var(--ink-900);
}

.btn-ghost-accent {
  color: var(--brand);
  background: transparent;
}
.btn-ghost-accent:hover:not(:disabled) {
  background: var(--brand-subtle);
}

.btn-danger {
  background: var(--surface);
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger-solid:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-sm {
  padding: 3px 9px;
  min-height: 26px;
  font-size: var(--text-xs);
  gap: var(--space-1);
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 11px 20px;
  min-height: 44px;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 0;
  width: 34px;
  height: 34px;
  min-height: 0;
  gap: 0;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-block {
  width: 100%;
}

/* legacy aliases */
.btn-gold {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-gold:hover:not(:disabled) {
  background: var(--brand-hover);
}
.btn-outline-gold,
.btn-glass {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink-900);
}
.btn-outline-gold:hover:not(:disabled),
.btn-glass:hover:not(:disabled) {
  background: var(--surface-sunken);
}
.btn-subtle {
  color: var(--ink-600);
}
.btn-subtle:hover:not(:disabled) {
  background: var(--surface-sunken);
  color: var(--ink-900);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--ink-700);
  letter-spacing: 0;
  line-height: 1.5;
}

.form-label .req {
  color: var(--danger);
  margin-left: 2px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  line-height: 1.5;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-900);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.5;
  outline: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.form-input,
.form-select {
  min-height: 34px;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-400);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--ink-300);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(15 76 129 / 0.14);
}

.form-input[aria-invalid='true'],
.form-textarea[aria-invalid='true'] {
  border-color: var(--danger);
}

.form-textarea {
  min-height: 84px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7079' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.input-icon-left {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-left > svg {
  position: absolute;
  left: 10px;
  color: var(--ink-400);
  pointer-events: none;
}

.input-icon-left > .form-input {
  padding-left: 32px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .form-input {
  padding-left: 32px;
  padding-right: 30px;
}

.search-box > .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
}

.search-box > .search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  padding: 3px;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--ink-400);
  cursor: pointer;
}

.search-box > .search-clear:hover {
  color: var(--ink-900);
  background: var(--surface-sunken);
}

/* ==========================================================================
   Surfaces
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.card-hover {
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  line-height: 1.35;
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* legacy aliases */
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   Badges & status
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--ink-600);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  line-height: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: middle;
}

.badge svg {
  flex-shrink: 0;
}

.badge-blue,
.badge-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--brand-ink);
}

.badge-success,
.badge-emerald {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.badge-warning,
.badge-amber {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.badge-danger,
.badge-rose {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.badge-gold {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.badge-dark {
  background: var(--surface-sunken);
  border-color: var(--border);
  color: var(--ink-600);
}

.badge-solid-dark {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}

.status-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-400);
}

.status-dot-live {
  background: #1a9b52;
  box-shadow: 0 0 0 3px rgb(26 155 82 / 0.16);
}

.status-dot-draft {
  background: var(--ink-400);
}

.status-dot-locked {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgb(180 35 24 / 0.14);
}

/* ==========================================================================
   Tabs / segmented / chips
   ========================================================================== */

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.segmented > button {
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.segmented > button:hover {
  color: var(--ink-900);
}

.segmented > button.is-active,
.segmented > button.active {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--shadow-xs);
}

.tabs-row {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs-row::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-600);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.tab:hover {
  color: var(--ink-900);
}

.tab.active,
.tab.is-active {
  color: var(--ink-900);
  border-bottom-color: var(--brand);
  font-weight: var(--weight-semibold);
}

.tab-count {
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken-2);
  color: var(--ink-600);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  line-height: 17px;
}

.tab.active .tab-count {
  background: var(--brand);
  color: #fff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.chip:hover {
  border-color: var(--ink-300);
  color: var(--ink-900);
}

.chip.active,
.chip.is-active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-sm);
}

.table th {
  padding: 7px 12px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  color: var(--ink-500);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--ink-600);
  vertical-align: middle;
}

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

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

.table-empty {
  padding: var(--space-10) var(--space-5) !important;
  text-align: center;
  color: var(--ink-500);
}

/* ==========================================================================
   Modals (with focus + Esc semantics handled in Modal.tsx)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgb(20 21 26 / 0.52);
  backdrop-filter: blur(3px);
  animation: fadeIn var(--dur-fast) var(--ease-out);
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - var(--space-12));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--dur-base) var(--ease-out);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
}

.modal-subtitle {
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  width: min(420px, calc(100vw - var(--space-8)));
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-stack {
    left: 50%;
    right: auto;
    bottom: var(--space-4);
    transform: translateX(-50%);
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink-900);
  font-size: var(--text-sm);
  line-height: 1.5;
  animation: toastIn var(--dur-base) var(--ease-out);
  pointer-events: auto;
}

.toast svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: -2px -4px -2px 2px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--surface-sunken);
  color: var(--ink-900);
}
.toast-success svg {
  color: var(--success);
}
.toast-error svg {
  color: var(--danger);
}
.toast-info svg {
  color: var(--brand);
}

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

/* ==========================================================================
   Console shell
   ========================================================================== */

.shell {
  display: flex;
  min-height: 100dvh;
  background: var(--surface-sunken);
}

.rail {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: var(--rail-w);
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

/* legacy name */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: var(--rail-w);
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-brand,
.rail-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--topbar-h);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}

.sidebar-nav,
.rail-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-3) var(--space-2);
  overflow-y: auto;
}

.rail-nav-top {
  flex: 0 0 auto;
  padding-bottom: 0;
}

.sidebar-item,
.rail-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-600);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.sidebar-item:hover,
.rail-item:hover {
  background: var(--surface-sunken);
  color: var(--ink-900);
}

.sidebar-item.active,
.rail-item[aria-current='page'] {
  background: var(--brand-subtle);
  color: var(--brand-ink);
  font-weight: var(--weight-semibold);
}

.sidebar-item svg,
.rail-item svg {
  flex-shrink: 0;
}

.sidebar-section-label {
  padding: var(--space-3) 10px 4px;
  color: var(--ink-400);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--topbar-h);
  padding: 7px var(--space-6);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.topbar-title h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-500);
  font-size: var(--text-2xs);
  line-height: 1.35;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .topbar {
    gap: var(--space-2);
    padding: 6px var(--space-3);
  }
  .topbar-desc {
    display: none;
  }
  .topbar-actions .btn {
    padding-inline: 8px;
  }
}

@media (max-width: 520px) {
  .topbar-actions .btn-label {
    display: none;
  }
  .topbar-actions .btn {
    padding-inline: 8px;
  }
}

.page-content {
  width: 100%;
  max-width: var(--container-console);
  margin-inline: auto;
  padding: var(--space-5) var(--space-6) var(--space-16);
  flex: 1;
}

@media (max-width: 640px) {
  .page-content {
    padding: var(--space-4) var(--space-4) var(--space-12);
  }
}

.sidebar-mobile-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgb(20 21 26 / 0.45);
}

@media (max-width: 960px) {
  .sidebar,
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 288px;
    max-width: calc(100vw - 48px);
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open,
  .rail.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .sidebar-mobile-toggle {
    display: inline-flex;
  }
}

/* ==========================================================================
   Stats
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  text-align: left;
}

.stat-card-label {
  color: var(--ink-500);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.stat-card-value {
  color: var(--ink-900);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card-desc {
  color: var(--ink-500);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink-500);
}

/* ==========================================================================
   Misc components
   ========================================================================== */

.progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken-2);
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  transition: width var(--dur-slow) var(--ease-out);
}

.progress-bar.complete {
  background: var(--success);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--ink-500);
}

.empty-state h3 {
  font-size: var(--text-md);
  color: var(--ink-900);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--ink-500);
  max-width: 42ch;
}

.kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--ink-600);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--brand-subtle);
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

/* ==========================================================================
   Marketing page
   ========================================================================== */

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--nav-h);
}

.landing-nav-links {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

.landing-nav-links a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.landing-nav-links a:hover {
  background: var(--surface-sunken);
  color: var(--ink-900);
}

@media (max-width: 560px) {
  .landing-nav .nav-login {
    display: none;
  }
}

@media (max-width: 420px) {
  .landing-nav .nav-cta-label {
    display: none;
  }
}

.landing-mobile-btn {
  display: inline-flex;
}

@media (min-width: 900px) {
  .landing-nav-links {
    display: flex;
  }
  .landing-mobile-btn {
    display: none;
  }
}

.landing-mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.landing-mobile-menu a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.landing-mobile-menu a:hover {
  background: var(--surface-sunken);
  color: var(--ink-900);
}

@media (min-width: 900px) {
  .landing-mobile-menu {
    display: none;
  }
}

/* Section rhythm: weight is expressed by spacing, not by decoration */
.section {
  padding-block: var(--space-20);
  border-top: 1px solid var(--border-subtle);
}

.section-flush {
  border-top: 0;
}

.section-sunken {
  background: var(--surface-sunken);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-10);
}

.section-head-center {
  margin-inline: auto;
  text-align: center;
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--ink-900);
  line-height: var(--leading-snug);
}

.section-subtitle {
  margin-top: var(--space-3);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--ink-600);
  max-width: 60ch;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-3);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .section {
    padding-block: var(--space-12);
  }
  .section-head {
    margin-bottom: var(--space-6);
  }
}

/* ==========================================================================
   Phone frame (shared by preview + marketing)
   ========================================================================== */

.phone-mockup {
  position: relative;
  width: min(375px, 100%);
  max-width: 100%;
  height: 720px;
  padding: 5px;
  margin-inline: auto;
  overflow: hidden;
  background: #0f1115;
  border: 6px solid #14161a;
  border-radius: 38px;
  box-shadow: 0 24px 48px -16px rgb(20 21 26 / 0.35);
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-x: clip;
  overflow-y: auto;
  border-radius: 30px;
  background: #faf7f2;
  scrollbar-width: thin;
  transform: translateZ(0);
  overscroll-behavior: contain;
}

.phone-screen::-webkit-scrollbar {
  width: 4px;
}
.phone-screen::-webkit-scrollbar-thumb {
  background: rgb(0 0 0 / 0.16);
  border-radius: 4px;
}

.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 50;
  width: 86px;
  height: 16px;
  border-radius: 20px;
  background: #0f1115;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.spin {
  animation: spinSlow 1.1s linear infinite;
}

.music-spinning {
  animation: spinSlow 1.1s linear infinite;
}

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

.animate-float {
  animation: floatAnim 4s var(--ease-in-out) infinite;
}

@keyframes pulseSoft {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse-soft {
  animation: pulseSoft 2s var(--ease-in-out) infinite;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-sunken) 25%,
    var(--surface-sunken-2) 50%,
    var(--surface-sunken) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--ink-300);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-400);
  background-clip: content-box;
}

/* ==========================================================================
   Modal size variants + dialog specifics
   ========================================================================== */

.modal-sm {
  max-width: 420px;
}
.modal-md {
  max-width: 560px;
}
.modal-lg {
  max-width: 760px;
}

/* ==========================================================================
   Two-column marketing blocks (kept generic so pages stay declarative)
   ========================================================================== */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-12);
  align-items: start;
}

.split-tight {
  gap: var(--space-8);
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* ==========================================================================
   Price block (used by template cards, checkout, receipt)
   ========================================================================== */

.price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.price-amount {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

.price-compare {
  font-size: var(--text-sm);
  color: var(--ink-500);
  text-decoration: line-through;
}

.price-note {
  font-size: var(--text-xs);
  color: var(--ink-500);
}

/* ==========================================================================
   Feature list (tick rows)
   ========================================================================== */

.tick-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tick-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--ink-600);
}

.tick-list svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--success);
}

/* ==========================================================================
   Callout / notice
   ========================================================================== */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink-600);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.notice svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.notice-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--brand-ink);
}

.notice-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.notice-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.notice-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

/* ==========================================================================
   Console section scaffolding (studio)
   ========================================================================== */

.studio-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: none;
}

.studio-section-block {
  display: flex;
  flex-direction: column;
}

.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
}

.studio-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 1180px) {
  .studio-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.preview-sticky {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-4));
}

@media (max-width: 1180px) {
  .preview-sticky {
    position: static;
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
  }
}

.content-preview {
  height: 560px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.content-preview-inner {
  width: 375px;
  height: 596px;
  margin-inline: auto;
  transform: scale(0.94);
  transform-origin: top center;
}

@media (max-width: 420px) {
  .content-preview {
    height: 480px;
  }
  .content-preview-inner {
    height: 511px;
    transform: scale(0.8);
  }
}

/* Editor sub-navigation */
.editor-subnav {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.editor-subnav::-webkit-scrollbar {
  display: none;
}

.editor-subnav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-600);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.editor-subnav button:hover {
  color: var(--ink-900);
}

.editor-subnav button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: var(--shadow-xs);
}

/* ==========================================================================
   Console polish — compact layout primitives
   --------------------------------------------------------------------------
   Everything below is the shared vocabulary the console screens are built
   from. Keeping layout in classes (instead of per-component inline styles) is
   what makes the responsive rules below actually apply.
   ========================================================================== */

/* ---- Page sections ---------------------------------------------------- */

.page-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-height: 30px;
}

.section-bar h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.section-bar p {
  font-size: var(--text-xs);
  color: var(--ink-500);
}

/* ---- Active invitation hero ------------------------------------------ */

.invite-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  overflow: hidden;
}

.invite-hero-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  min-width: 0;
}

.invite-hero-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}

.invite-hero-title {
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.invite-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.invite-hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.stat-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-4);
  min-width: 0;
}

.stat-tile:nth-child(odd) {
  border-right: 1px solid var(--border-subtle);
}

.stat-tile:nth-child(-n + 2) {
  border-bottom: 1px solid var(--border-subtle);
}

.stat-tile-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (max-width: 1080px) {
  .invite-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .stat-quad {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
}

/* ---- Thumbnails ------------------------------------------------------- */

.thumb {
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.thumb-portrait {
  width: 38px;
  height: 48px;
}

.thumb-square {
  width: 40px;
  height: 40px;
}

/* ---- Record list (undangan, lisensi) --------------------------------- */

.record-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.record {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  min-width: 0;
}

.record-main {
  flex: 1;
  min-width: 0;
}

.record-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
}

.record-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.record-title:hover {
  color: var(--brand);
}

.record-meta {
  margin-top: 1px;
  font-size: var(--text-xs);
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.record-stat {
  min-width: 42px;
  text-align: right;
}

.record-stat b {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  line-height: 1.3;
}

.record-stat span {
  display: block;
  font-size: var(--text-2xs);
  color: var(--ink-500);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.record-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 46px;
  padding: var(--space-3);
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  color: var(--ink-500);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.record-add:hover {
  border-color: var(--ink-300);
  background: var(--surface);
  color: var(--ink-900);
}

.quick-link {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2-5);
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.quick-link:hover {
  background: var(--surface-sunken);
  border-color: var(--border);
}

.quick-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--brand-subtle);
  color: var(--brand);
}

.quick-link-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  line-height: 1.4;
}

.quick-link-body {
  display: block;
  margin-top: 1px;
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .record {
    flex-wrap: wrap;
    row-gap: var(--space-2);
  }
  .record-stats {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    gap: var(--space-5);
  }
  .record-actions {
    margin-left: auto;
  }
}

/* ---- RSVP & check-in records ----------------------------------------- */

.rsvp-item .record-main {
  padding: 2px 0;
}

.rsvp-name {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

.rsvp-quote {
  margin-top: 6px;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--ink-700);
  overflow-wrap: anywhere;
}

.rsvp-time {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.checkin-row.is-done {
  border-color: var(--success-border);
  background: var(--success-bg);
}

/* ---- Catering metrics ------------------------------------------------- */

.catering-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  overflow: hidden;
}

.catering-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
}

.catering-metric + .catering-metric {
  border-left: 1px solid var(--border-subtle);
}

.catering-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

.catering-split {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-600);
}

.catering-split b {
  color: var(--ink-900);
  font-weight: var(--weight-semibold);
}

@media (max-width: 760px) {
  .catering-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .catering-metric + .catering-metric {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
}

/* ---- Template cards --------------------------------------------------- */

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

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

.template-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}

.template-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.template-card-media {
  position: relative;
  height: 168px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-subtle);
}

.template-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  flex: 1;
}

.template-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.template-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  line-height: 1.3;
}

.template-card-tagline {
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}

.template-card-price {
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

.template-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  flex-wrap: wrap;
}

/* ---- Form layout ------------------------------------------------------ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
  align-items: end;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.9fr) auto;
  gap: var(--space-3);
  align-items: end;
}

.form-grid-3 > .btn {
  justify-self: start;
}

@media (max-width: 960px) {
  .form-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid-3 > .btn {
    justify-self: stretch;
  }
}

@media (max-width: 540px) {
  .form-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Toolbars & filters ---------------------------------------------- */

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.editor-toolbar .search-box {
  flex: 1 1 240px;
  max-width: 340px;
}

.editor-toolbar .toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-scroll {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-scroll > .chip {
  flex-shrink: 0;
}

.filter-scroll .chip {
  padding: 4px 10px;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
}

/* ---- Responsive table columns --------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .col-md {
    display: none;
  }
}

.only-sm {
  display: none;
}

@media (max-width: 680px) {
  .col-sm {
    display: none;
  }
  .only-sm {
    display: block;
  }
  .table th,
  .table td {
    padding-inline: 10px;
  }
  .editor-subnav,
  .filter-scroll {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
}

/* ---- Stats ----------------------------------------------------------- */

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: var(--space-3);
}

.stat-card {
  padding: var(--space-4);
  gap: 2px;
}

.stat-card-value {
  font-size: var(--text-xl);
}

.stat-icon {
  width: 28px;
  height: 28px;
}

.studio-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--ink-500);
  font-size: var(--text-2xs);
  line-height: 1.4;
}

.studio-strip.is-warning {
  background: var(--warning-bg);
  border-bottom-color: var(--warning-border);
  color: var(--warning);
}

@media (max-width: 640px) {
  .studio-strip {
    padding-inline: var(--space-4);
  }
}

/* ---- Rail extras ----------------------------------------------------- */

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--topbar-h);
  padding: 0 var(--space-3) 0 var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.rail-close {
  display: none;
}

@media (max-width: 960px) {
  .rail-close {
    display: inline-flex;
  }
}

.rail-context {
  margin: var(--space-3) var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.rail-context-label {
  display: block;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-500);
}

.rail-context-title {
  margin-top: 2px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.rail-context-slug {
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-account {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.rail-account-name {
  min-width: 0;
  flex: 1;
}

.rail-account-name b {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-account-name span {
  display: block;
  font-size: var(--text-2xs);
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-account-name .rail-account-hint {
  line-height: 1.35;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

/* ---- Auth shell ------------------------------------------------------ */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
}

.auth-aside {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-10);
  background: var(--ink-900);
  position: relative;
  overflow: hidden;
}

.auth-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgb(15 76 129 / 0.55), transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 90%, rgb(169 117 48 / 0.35), transparent 70%);
}

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  background: var(--surface);
}

.auth-panel {
  width: 100%;
  max-width: 392px;
}

.auth-mobile-brand {
  display: block;
  margin-bottom: var(--space-6);
}

@media (min-width: 940px) {
  .auth-shell {
    grid-template-columns: 460px minmax(0, 1fr);
  }
  .auth-aside {
    display: flex;
  }
  .auth-mobile-brand {
    display: none;
  }
}

@media (max-width: 520px) {
  .auth-main {
    padding: var(--space-8) var(--space-4);
  }
}

/* ---- Landing nav compact CTA ---------------------------------------- */

.nav-cta-short {
  display: none;
}

@media (max-width: 420px) {
  .nav-cta-short {
    display: inline;
  }
}

@media (max-width: 560px) {
  .cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .cta-row > .btn {
    width: 100%;
  }
}

/* ---- Public invitation frame ----------------------------------------- */

.invite-stage {
  min-height: 100dvh;
  background: var(--artifact-paper-deep);
  display: flex;
  justify-content: center;
}

.invite-column {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  position: relative;
}

@media (min-width: 700px) {
  .invite-stage {
    padding: 0;
    background:
      radial-gradient(ellipse 90% 60% at 50% 0%, #efe6da 0%, transparent 60%),
      var(--artifact-paper-deep);
  }
  .invite-column {
    box-shadow: 0 0 0 1px rgb(60 45 30 / 0.08), 0 24px 80px -24px rgb(60 45 30 / 0.35);
  }
}

/* ---- Utility --------------------------------------------------------- */

.mobile-only {
  display: none;
}

@media (max-width: 760px) {
  .mobile-only {
    display: initial;
  }
  .desktop-only {
    display: none;
  }
}

.nowrap {
  white-space: nowrap;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Modal on small screens ------------------------------------------ */

@media (max-width: 560px) {
  .modal-backdrop {
    padding: var(--space-3);
    align-items: flex-end;
  }
  .modal {
    max-height: calc(100dvh - var(--space-6));
  }
}
