/* =========================================================================
   LobbyQuest design system — "Ready Room"
   Struktur token mengikuti shadcn/ui (background/foreground, card, muted,
   primary, secondary, accent, destructive, border, input, ring) ditambah
   token merek (brand = Volt) dan token status ready check.
   Semua nilai kontras sudah diukur; lihat docs/design-system.md.
   ========================================================================= */

@layer base, components, layout, pages, utilities;

/* ---------- Font (di-host sendiri, di-subset) ---------- */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/geist-sans.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/geist-mono.woff2") format("woff2");
}

/* Fallback dengan metrik disesuaikan agar teks tidak "melompat" saat font
   web selesai dimuat (Geist ±8,6% lebih lebar dari Arial). */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Roboto");
  size-adjust: 108.6%;
  ascent-override: 92.5%;
  descent-override: 27.2%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Geist Mono Fallback";
  src: local("Menlo"), local("Consolas"), local("Courier New"), local("DejaVu Sans Mono");
  ascent-override: 100.5%;
  descent-override: 29.5%;
  line-gap-override: 0%;
}

/* ---------- Token: nilai yang sama di kedua tema ---------- */

:root {
  --font-sans: "Geist", "Geist Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "Geist Mono Fallback", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Skala tipografi */
  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: clamp(1.75rem, 1.45rem + 1.4vw, 2.25rem);
  --text-4xl: clamp(2rem, 1.55rem + 2.2vw, 3rem);
  --text-display: clamp(2.5rem, 1.55rem + 4.4vw, 4.5rem);
  --leading-none: 1;
  --leading-tight: 1.12;
  --leading-snug: 1.35;
  --leading-normal: 1.6;
  --tracking-tighter: -0.04em;
  --tracking-tight: -0.022em;
  --tracking-normal: 0;
  --tracking-wide: 0.08em;

  /* Skala spacing (basis 4px) */
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius: 0.75rem;
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: var(--radius);
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Ukuran kontrol: minimal 44px agar nyaman disentuh */
  --control: 2.75rem;
  --control-lg: 3.25rem;

  /* Gerak */
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Tata letak */
  --container: 72rem;
  --container-narrow: 42rem;
  --gutter: clamp(1rem, 0.6rem + 2vw, 2rem);
  --header-h: 3.75rem;

  /* Lapisan */
  --z-header: 40;
  --z-dialog: 50;
  --z-toast: 60;
}

/* ---------- Token warna: terang (bawaan) ---------- */

:root {
  color-scheme: light;

  --background: #fafafa;
  --foreground: #0a0a0c;
  --card: #ffffff;
  --card-foreground: #0a0a0c;
  --popover: #ffffff;
  --popover-foreground: #0a0a0c;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f2f2f4;
  --secondary-foreground: #18181b;
  --muted: #f2f2f4;
  --muted-foreground: #5d5d68;
  --accent: #ebebee;
  --accent-foreground: #18181b;
  --destructive: #c81e1e;
  --destructive-foreground: #ffffff;
  --destructive-text: #a8173f;
  --destructive-soft: #fdeaf0;
  --border: #e4e4e7;
  --input: #8a8a95;
  --ring: #18181b;

  /* Merek: Volt. Isian terang dengan teks gelap; brand-text untuk teks. */
  --brand: #c3ed4c;
  --brand-hover: #b5e23a;
  --brand-foreground: #10160a;
  --brand-text: #3d6b09;
  --brand-soft: #eef8dc;

  /* Status ready check: mark (ikon/segmen), text (label), soft (latar) */
  --ready: #3a7d0c;
  --ready-text: #2f6406;
  --ready-soft: #eef8dc;
  --maybe: #f2b705;
  --maybe-text: #94400a;
  --maybe-soft: #fdf1dc;
  --absent: #e24a6b;
  --absent-text: #a8173f;
  --absent-soft: #fdeaf0;
  --afk: #a1a1aa;
  --afk-text: #55555f;
  --afk-soft: #f0f0f2;
  --info: #2563eb;
  --info-text: #1d4fc4;
  --info-soft: #e8effd;

  /* Visualisasi hasil voting (bentuk "emphasis": satu sorotan, sisanya netral) */
  --chart-lead: #5a9a12;
  --chart-rest: #a1a1aa;
  --chart-track: #ececef;

  --shadow-xs: 0 1px 2px 0 rgb(10 10 12 / 5%);
  --shadow-sm: 0 1px 3px 0 rgb(10 10 12 / 8%), 0 1px 2px -1px rgb(10 10 12 / 8%);
  --shadow-md: 0 4px 12px -2px rgb(10 10 12 / 8%), 0 2px 4px -2px rgb(10 10 12 / 6%);
  --shadow-lg: 0 16px 40px -12px rgb(10 10 12 / 22%), 0 4px 10px -4px rgb(10 10 12 / 8%);
  --overlay: rgb(10 10 12 / 45%);
  --glow: rgb(195 237 76 / 45%);
}

/* ---------- Token warna: gelap ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --background: #0b0b0d;
    --foreground: #f4f4f5;
    --card: #131316;
    --card-foreground: #f4f4f5;
    --popover: #18181c;
    --popover-foreground: #f4f4f5;
    --primary: #f4f4f5;
    --primary-foreground: #18181b;
    --secondary: #1f1f24;
    --secondary-foreground: #f4f4f5;
    --muted: #1c1c21;
    --muted-foreground: #a1a1aa;
    --accent: #222228;
    --accent-foreground: #f4f4f5;
    --destructive: #c81e1e;
    --destructive-foreground: #ffffff;
    --destructive-text: #fda4af;
    --destructive-soft: #2c1418;
    --border: #26262c;
    --input: #62626d;
    --ring: #c3ed4c;

    --brand: #c3ed4c;
    --brand-hover: #d0f566;
    --brand-foreground: #10160a;
    --brand-text: #c3ed4c;
    --brand-soft: #1c2410;

    --ready: #c3ed4c;
    --ready-text: #c8f05a;
    --ready-soft: #1c2410;
    --maybe: #f59e0b;
    --maybe-text: #fbc44a;
    --maybe-soft: #2a1f0c;
    --absent: #fb7185;
    --absent-text: #fda4af;
    --absent-soft: #2c1418;
    --afk: #63636e;
    --afk-text: #b0b0ba;
    --afk-soft: #1f1f24;
    --info: #60a5fa;
    --info-text: #9bbcff;
    --info-soft: #141c2e;

    --chart-lead: #c3ed4c;
    --chart-rest: #55555f;
    --chart-track: #1f1f25;

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 40%);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 45%), 0 1px 2px -1px rgb(0 0 0 / 45%);
    --shadow-md: 0 6px 16px -4px rgb(0 0 0 / 55%), 0 2px 4px -2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 20px 48px -12px rgb(0 0 0 / 70%), 0 6px 12px -6px rgb(0 0 0 / 50%);
    --overlay: rgb(0 0 0 / 62%);
    --glow: rgb(195 237 76 / 30%);
  }
}

/* Pilihan manual (toggle tema) — salinan blok gelap di atas. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --background: #0b0b0d;
  --foreground: #f4f4f5;
  --card: #131316;
  --card-foreground: #f4f4f5;
  --popover: #18181c;
  --popover-foreground: #f4f4f5;
  --primary: #f4f4f5;
  --primary-foreground: #18181b;
  --secondary: #1f1f24;
  --secondary-foreground: #f4f4f5;
  --muted: #1c1c21;
  --muted-foreground: #a1a1aa;
  --accent: #222228;
  --accent-foreground: #f4f4f5;
  --destructive: #c81e1e;
  --destructive-foreground: #ffffff;
  --destructive-text: #fda4af;
  --destructive-soft: #2c1418;
  --border: #26262c;
  --input: #62626d;
  --ring: #c3ed4c;

  --brand: #c3ed4c;
  --brand-hover: #d0f566;
  --brand-foreground: #10160a;
  --brand-text: #c3ed4c;
  --brand-soft: #1c2410;

  --ready: #c3ed4c;
  --ready-text: #c8f05a;
  --ready-soft: #1c2410;
  --maybe: #f59e0b;
  --maybe-text: #fbc44a;
  --maybe-soft: #2a1f0c;
  --absent: #fb7185;
  --absent-text: #fda4af;
  --absent-soft: #2c1418;
  --afk: #63636e;
  --afk-text: #b0b0ba;
  --afk-soft: #1f1f24;
  --info: #60a5fa;
  --info-text: #9bbcff;
  --info-soft: #141c2e;

  --chart-lead: #c3ed4c;
  --chart-rest: #55555f;
  --chart-track: #1f1f25;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 40%);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 45%), 0 1px 2px -1px rgb(0 0 0 / 45%);
  --shadow-md: 0 6px 16px -4px rgb(0 0 0 / 55%), 0 2px 4px -2px rgb(0 0 0 / 40%);
  --shadow-lg: 0 20px 48px -12px rgb(0 0 0 / 70%), 0 6px 12px -6px rgb(0 0 0 / 50%);
  --overlay: rgb(0 0 0 / 62%);
  --glow: rgb(195 237 76 / 30%);
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Base ---------- */

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

  html {
    /* Jaring pengaman: pseudo-elemen (misalnya tooltip) tidak boleh
       membuat halaman bisa digeser ke samping. */
    overflow-x: hidden;
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Elemen yang difokus/di-anchor tidak tertutup header sticky (WCAG 2.4.11). */
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
    scroll-padding-bottom: var(--space-24);
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--foreground);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  h4 {
    margin: 0;
    font-weight: 650;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
  }

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

  a {
    color: inherit;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
  }

  a:hover {
    text-decoration-thickness: 2px;
  }

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

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

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  svg {
    flex-shrink: 0;
  }

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

  [hidden] {
    display: none !important;
  }

  code,
  kbd,
  samp {
    font-family: var(--font-mono);
    font-size: 0.92em;
  }
}

/* ---------- Utilitas ---------- */

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

  .mono {
    font-family: var(--font-mono);
  }

  .tabular {
    font-variant-numeric: tabular-nums;
  }

  .text-muted {
    color: var(--muted-foreground);
  }
}

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

/* ---------- Token avatar (8 warna, terang/gelap) ---------- */

:root {
  --av-0-bg: #e9f7cf; --av-0-fg: #3d6b09;
  --av-1-bg: #fdefd2; --av-1-fg: #8a4a00;
  --av-2-bg: #fde4ec; --av-2-fg: #a3173d;
  --av-3-bg: #ddf0fc; --av-3-fg: #0b5f99;
  --av-4-bg: #ece6fd; --av-4-fg: #5b35b0;
  --av-5-bg: #d8f5f1; --av-5-fg: #0b6b63;
  --av-6-bg: #feeadc; --av-6-fg: #a13d06;
  --av-7-bg: #e9e9ee; --av-7-fg: #3f3f4a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --av-0-bg: #24300f; --av-0-fg: #d4f57e;
    --av-1-bg: #33260c; --av-1-fg: #fcd27a;
    --av-2-bg: #381521; --av-2-fg: #fda4bd;
    --av-3-bg: #0f2a3d; --av-3-fg: #93d0fb;
    --av-4-bg: #261c45; --av-4-fg: #c9b8fd;
    --av-5-bg: #0d302c; --av-5-fg: #7fe3d6;
    --av-6-bg: #3a1d0b; --av-6-fg: #fdba8c;
    --av-7-bg: #2a2a31; --av-7-fg: #d4d4dc;
  }
}

:root[data-theme="dark"] {
  --av-0-bg: #24300f; --av-0-fg: #d4f57e;
  --av-1-bg: #33260c; --av-1-fg: #fcd27a;
  --av-2-bg: #381521; --av-2-fg: #fda4bd;
  --av-3-bg: #0f2a3d; --av-3-fg: #93d0fb;
  --av-4-bg: #261c45; --av-4-fg: #c9b8fd;
  --av-5-bg: #0d302c; --av-5-fg: #7fe3d6;
  --av-6-bg: #3a1d0b; --av-6-fg: #fdba8c;
  --av-7-bg: #2a2a31; --av-7-fg: #d4d4dc;
}

/* =========================================================================
   Komponen
   ========================================================================= */

@layer components {
  /* ---------- Ikon ---------- */

  .icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: -0.125em;
  }

  /* ---------- Teks pendukung ---------- */

  .kicker {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--muted-foreground);
  }

  .lead {
    font-size: var(--text-lg);
    line-height: 1.55;
    color: var(--muted-foreground);
  }

  .hint {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--muted-foreground);
  }

  .link {
    color: var(--foreground);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--foreground) 35%, transparent);
    text-underline-offset: 0.22em;
    transition: text-decoration-color var(--duration-fast) var(--ease-out);
  }

  .link:hover {
    text-decoration-color: currentColor;
  }

  /* ---------- Button ---------- */

  .btn {
    --btn-h: var(--control);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--btn-h);
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    font-weight: 550;
    line-height: 1.15;
    letter-spacing: -0.005em;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    color: var(--foreground);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
      background-color var(--duration-fast) var(--ease-out),
      border-color var(--duration-fast) var(--ease-out),
      color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out),
      transform var(--duration-fast) var(--ease-out);
  }

  .btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.985);
  }

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

  .btn-primary {
    color: var(--primary-foreground);
    background: var(--primary);
    box-shadow: var(--shadow-xs);
  }

  .btn-primary:hover {
    background: color-mix(in srgb, var(--primary) 88%, var(--background));
  }

  .btn-brand {
    color: var(--brand-foreground);
    background: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 70%, var(--brand-foreground));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%), var(--shadow-xs);
  }

  .btn-brand:hover {
    background: var(--brand-hover);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%), 0 0 0 4px var(--glow);
  }

  .btn-secondary {
    color: var(--secondary-foreground);
    background: var(--secondary);
  }

  .btn-secondary:hover {
    background: var(--accent);
  }

  .btn-outline {
    color: var(--foreground);
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
  }

  .btn-outline:hover {
    background: var(--accent);
  }

  .btn-ghost:hover {
    background: var(--accent);
  }

  .btn-destructive {
    color: var(--destructive-foreground);
    background: var(--destructive);
    box-shadow: var(--shadow-xs);
  }

  .btn-destructive:hover {
    background: color-mix(in srgb, var(--destructive) 88%, black);
  }

  .btn-link {
    min-height: auto;
    padding: 0;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 0.22em;
  }

  .btn-link:active:not(:disabled) {
    transform: none;
  }

  /* Ukuran kecil tetap punya area sentuh 44px lewat ::after. */
  /* Secara visual lebih ringkas (padding lebih tipis), tapi tingginya tetap
     penuh 44px: ekstensi area klik lewat pseudo-elemen tidak diandalkan
     karena bisa tertutup elemen tetangga di beberapa tata letak. */
  .btn-sm {
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
  }

  .btn-lg {
    --btn-h: var(--control-lg);
    padding: 0 var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
  }

  .btn-icon {
    width: var(--btn-h);
    padding: 0;
  }

  .btn-block {
    width: 100%;
  }

  .btn .icon {
    width: 1rem;
    height: 1rem;
  }

  .btn-lg .icon {
    width: 1.125rem;
    height: 1.125rem;
  }

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

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

  .field {
    display: grid;
    gap: var(--space-1-5);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .label {
    display: flex;
    align-items: baseline;
    gap: var(--space-1-5);
    padding: 0;
    font-size: var(--text-sm);
    font-weight: 550;
    line-height: 1.4;
    color: var(--foreground);
  }

  .label .optional {
    font-weight: 400;
    color: var(--muted-foreground);
  }

  .field-error {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--destructive-text);
  }

  .field-error .icon {
    margin-top: 0.15em;
  }

  .input,
  .textarea,
  .select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: var(--control);
    padding: 0 var(--space-3);
    /* 16px mencegah zoom otomatis di iOS. */
    font-size: max(16px, 1rem);
    line-height: 1.4;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition:
      border-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out);
  }

  .input::placeholder,
  .textarea::placeholder {
    color: var(--muted-foreground);
    opacity: 1;
  }

  .input:hover,
  .textarea:hover,
  .select:hover {
    border-color: color-mix(in srgb, var(--input) 55%, var(--foreground));
  }

  .input:focus-visible,
  .textarea:focus-visible,
  .select:focus-visible {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 28%, transparent);
  }

  .input[aria-invalid="true"],
  .textarea[aria-invalid="true"],
  .select[aria-invalid="true"] {
    border-color: var(--destructive-text);
  }

  .input[aria-invalid="true"]:focus-visible,
  .textarea[aria-invalid="true"]:focus-visible {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive-text) 25%, transparent);
  }

  .input[readonly] {
    background: var(--muted);
    box-shadow: none;
  }

  .input-mono {
    font-family: var(--font-mono);
    font-size: max(15px, 0.9375rem);
    letter-spacing: -0.01em;
  }

  .textarea {
    min-height: 6.5rem;
    padding: var(--space-2-5) var(--space-3);
    line-height: 1.5;
    resize: vertical;
  }

  .select-wrap,
  .input-wrap {
    position: relative;
    display: block;
  }

  .select {
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
  }

  .select-wrap > .icon {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    color: var(--muted-foreground);
    pointer-events: none;
  }

  .input-wrap > .icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    color: var(--muted-foreground);
    pointer-events: none;
  }

  .input-wrap > .input {
    padding-left: 2.5rem;
  }

  input[type="datetime-local"].input {
    padding-right: var(--space-2);
  }

  /* Checkbox & radio kustom; input asli tetap ada untuk aksesibilitas. */
  .checkbox,
  .radio {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
  }

  .checkbox input,
  .radio input {
    appearance: none;
    width: 100%;
    height: 100%;
    margin: 0;
    background: var(--card);
    border: 1px solid var(--input);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition:
      background-color var(--duration-fast) var(--ease-out),
      border-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration-fast) var(--ease-out);
  }

  .radio input {
    border-radius: 50%;
  }

  .checkbox .icon {
    position: absolute;
    width: 0.875rem;
    height: 0.875rem;
    color: var(--primary-foreground);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transition:
      opacity var(--duration-fast) var(--ease-out),
      transform var(--duration) var(--ease-spring);
  }

  .checkbox input:checked {
    background: var(--primary);
    border-color: var(--primary);
  }

  .checkbox input:checked + .icon {
    opacity: 1;
    transform: scale(1);
  }

  .radio input:checked {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px var(--card);
  }

  .checkbox input:focus-visible,
  .radio input:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  /* Baris pilihan besar (label penuh bisa diketuk). */
  .choice {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--control);
    padding: var(--space-3);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
      border-color var(--duration-fast) var(--ease-out),
      background-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out);
  }

  .choice:hover {
    border-color: color-mix(in srgb, var(--input) 60%, var(--border));
  }

  .choice:has(input:checked) {
    border-color: var(--foreground);
    box-shadow: 0 0 0 1px var(--foreground);
  }

  .choice:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
  }

  .choice-body {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
    flex: 1;
  }

  .choice-title {
    font-size: var(--text-sm);
    font-weight: 550;
    line-height: 1.35;
  }

  .choice-meta {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  /* ---------- Card ---------- */

  .card {
    position: relative;
    min-width: 0;
    color: var(--card-foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
  }

  .card-header {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-5) var(--space-5) 0;
  }

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

  .card-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: 600;
    letter-spacing: -0.012em;
  }

  .card-title .icon {
    color: var(--muted-foreground);
  }

  .card-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .card-content {
    padding: var(--space-5);
  }

  .card-header + .card-content {
    padding-top: var(--space-4);
  }

  .card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-5) var(--space-5);
  }

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

  @media (min-width: 40rem) {
    .card-header {
      padding: var(--space-6) var(--space-6) 0;
    }

    .card-content {
      padding: var(--space-6);
    }

    .card-header + .card-content {
      padding-top: var(--space-5);
    }

    .card-footer {
      padding: 0 var(--space-6) var(--space-6);
    }
  }

  /* ---------- Badge ---------- */

  .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 1.5rem;
    padding: 0.125rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 550;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--secondary-foreground);
    background: var(--secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
  }

  .badge .icon {
    width: 0.8125rem;
    height: 0.8125rem;
  }

  .badge-primary {
    color: var(--primary-foreground);
    background: var(--primary);
  }

  .badge-outline {
    color: var(--foreground);
    background: transparent;
    border-color: var(--border);
  }

  .badge-brand {
    color: var(--brand-foreground);
    background: var(--brand);
  }

  .badge-ready,
  .badge-yes {
    color: var(--ready-text);
    background: var(--ready-soft);
    border-color: color-mix(in srgb, var(--ready) 28%, transparent);
  }

  .badge-maybe {
    color: var(--maybe-text);
    background: var(--maybe-soft);
    border-color: color-mix(in srgb, var(--maybe) 35%, transparent);
  }

  .badge-absent,
  .badge-no {
    color: var(--absent-text);
    background: var(--absent-soft);
    border-color: color-mix(in srgb, var(--absent) 30%, transparent);
  }

  .badge-afk,
  .badge-pending {
    color: var(--afk-text);
    background: var(--afk-soft);
    border-color: color-mix(in srgb, var(--afk) 35%, transparent);
  }

  .badge-info {
    color: var(--info-text);
    background: var(--info-soft);
    border-color: color-mix(in srgb, var(--info) 28%, transparent);
  }

  /* Titik "live" untuk status yang sedang berjalan. */
  .dot {
    position: relative;
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: currentColor;
  }

  .dot-live::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: currentColor;
    animation: pulse-ring 1.8s var(--ease-out) infinite;
  }

  /* ---------- Alert ---------- */

  .alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--card-foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .alert > .icon {
    grid-row: span 2;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.1rem;
  }

  .alert-title {
    font-weight: 600;
    line-height: 1.45;
  }

  .alert-description {
    color: var(--muted-foreground);
    line-height: 1.55;
  }

  .alert-description ul {
    margin: var(--space-1) 0 0;
    padding-left: 1.1rem;
  }

  .alert-description a {
    color: inherit;
    font-weight: 550;
  }

  .alert:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  .alert-destructive {
    background: var(--destructive-soft);
    border-color: color-mix(in srgb, var(--destructive-text) 30%, transparent);
  }

  .alert-destructive > .icon,
  .alert-destructive .alert-title {
    color: var(--destructive-text);
  }

  .alert-destructive .alert-description {
    color: var(--foreground);
  }

  .alert-success {
    background: var(--ready-soft);
    border-color: color-mix(in srgb, var(--ready) 28%, transparent);
  }

  .alert-success > .icon,
  .alert-success .alert-title {
    color: var(--ready-text);
  }

  .alert-warning {
    background: var(--maybe-soft);
    border-color: color-mix(in srgb, var(--maybe) 35%, transparent);
  }

  .alert-warning > .icon,
  .alert-warning .alert-title {
    color: var(--maybe-text);
  }

  .alert-info > .icon {
    color: var(--info-text);
  }

  /* ---------- Toast ---------- */

  .toaster {
    position: fixed;
    z-index: var(--z-toast);
    inset-inline: var(--space-3);
    bottom: max(var(--space-3), env(safe-area-inset-bottom));
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    pointer-events: none;
  }

  .toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-3);
    width: min(100%, 24rem);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    color: var(--popover-foreground);
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: toast-in var(--duration-slow) var(--ease-out) both;
  }

  .toast > .icon {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.15rem;
  }

  .toast-success > .icon {
    color: var(--ready);
  }

  .toast-error > .icon {
    color: var(--destructive-text);
  }

  .toast-title {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.45;
  }

  .toast-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    line-height: 1.45;
  }

  .toast-close {
    margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) 0 0;
  }

  .toast[data-state="closing"] {
    animation: toast-out 180ms var(--ease-in-out) forwards;
  }

  @media (min-width: 40rem) {
    .toaster {
      inset-inline: auto var(--space-6);
      bottom: var(--space-6);
      justify-items: end;
    }
  }

  /* ---------- Dialog & sheet (native <dialog>) ---------- */

  .dialog {
    width: min(calc(100% - 2rem), 28rem);
    max-height: calc(100dvh - 2rem);
    padding: 0;
    color: var(--popover-foreground);
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: auto;
  }

  .dialog::backdrop {
    background: var(--overlay);
    backdrop-filter: blur(3px);
  }

  .dialog[open] {
    animation: dialog-in var(--duration-slow) var(--ease-out);
  }

  .dialog[open]::backdrop {
    animation: fade-in var(--duration) var(--ease-out);
  }

  .dialog-content {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-6);
  }

  .dialog-header {
    display: grid;
    gap: var(--space-2);
  }

  .dialog-title {
    font-size: var(--text-lg);
    font-weight: 600;
  }

  .dialog-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .dialog-footer {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
  }

  .dialog-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
  }

  @media (min-width: 40rem) {
    .dialog-footer {
      flex-direction: row;
      justify-content: flex-end;
    }
  }

  /* Di layar kecil dialog bertanda .dialog-sheet muncul dari bawah. */
  @media (max-width: 39.99rem) {
    .dialog-sheet {
      width: 100%;
      max-width: none;
      margin: auto 0 0;
      border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
      border-bottom: 0;
      padding-bottom: env(safe-area-inset-bottom);
    }

    .dialog-sheet[open] {
      animation: sheet-in var(--duration-slow) var(--ease-out);
    }
  }

  /* Fallback tanpa JavaScript: dialog berbentuk <details>. */
  .disclosure {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
  }

  .disclosure > summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control);
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 550;
    cursor: pointer;
    list-style: none;
    border-radius: inherit;
  }

  .disclosure > summary::-webkit-details-marker {
    display: none;
  }

  .disclosure > summary .icon-chevron {
    margin-left: auto;
    color: var(--muted-foreground);
    transition: transform var(--duration) var(--ease-out);
  }

  .disclosure[open] > summary .icon-chevron {
    transform: rotate(180deg);
  }

  .disclosure > summary:hover {
    background: var(--accent);
  }

  .disclosure-body {
    padding: 0 var(--space-3) var(--space-3);
  }

  .disclosure-danger > summary {
    color: var(--destructive-text);
  }

  /* ---------- Tabs ---------- */

  .tabs-list {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--muted);
    border-radius: var(--radius-md);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tab {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1-5);
    min-height: var(--control);
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--muted-foreground);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--duration-fast), background-color var(--duration-fast), box-shadow var(--duration-fast);
  }

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

  .tab[aria-selected="true"] {
    color: var(--foreground);
    background: var(--card);
    box-shadow: var(--shadow-sm);
  }

  .tabs-panel {
    display: grid;
    gap: var(--space-4);
  }

  .tabs-panel + .tabs-panel {
    margin-top: var(--space-6);
  }

  .tabs.is-enhanced .tabs-panel + .tabs-panel {
    margin-top: 0;
  }

  .tabs.is-enhanced .tabs-panel {
    padding-top: var(--space-4);
  }

  .tabs.is-enhanced .tabs-panel-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tabs-panel-title {
    font-size: var(--text-sm);
    font-weight: 600;
  }

  /* ---------- Avatar ---------- */

  .avatar {
    --avatar-size: 2.5rem;
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--avatar-size);
    height: var(--avatar-size);
    font-size: calc(var(--avatar-size) * 0.4);
    font-weight: 600;
    line-height: 1;
    color: var(--av-7-fg);
    background: var(--av-7-bg);
    border-radius: calc(var(--avatar-size) * 0.3);
  }

  .avatar-sm {
    --avatar-size: 1.75rem;
  }

  .avatar-lg {
    --avatar-size: 3rem;
  }

  .avatar-0 { color: var(--av-0-fg); background: var(--av-0-bg); }
  .avatar-1 { color: var(--av-1-fg); background: var(--av-1-bg); }
  .avatar-2 { color: var(--av-2-fg); background: var(--av-2-bg); }
  .avatar-3 { color: var(--av-3-fg); background: var(--av-3-bg); }
  .avatar-4 { color: var(--av-4-fg); background: var(--av-4-bg); }
  .avatar-5 { color: var(--av-5-fg); background: var(--av-5-bg); }
  .avatar-6 { color: var(--av-6-fg); background: var(--av-6-bg); }
  .avatar-7 { color: var(--av-7-fg); background: var(--av-7-bg); }

  /* Indikator status di pojok avatar (selalu didampingi label teks). */
  .avatar-status {
    position: absolute;
    right: -0.25rem;
    bottom: -0.25rem;
    display: grid;
    place-items: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    color: var(--background);
    background: var(--afk);
    box-shadow: 0 0 0 2px var(--card);
  }

  .avatar-status .icon {
    width: 0.6875rem;
    height: 0.6875rem;
  }

  .avatar-status.status-yes { background: var(--ready); }
  .avatar-status.status-maybe { background: var(--maybe); color: #1c1305; }
  .avatar-status.status-no { background: var(--absent); }

  /* Tumpukan avatar dengan cincin warna permukaan (pemisah antar-mark). */
  .avatar-stack {
    display: flex;
    align-items: center;
  }

  .avatar-stack > .avatar {
    box-shadow: 0 0 0 2px var(--card);
  }

  .avatar-stack > .avatar + .avatar {
    margin-left: -0.375rem;
  }

  .avatar-more {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: 500;
  }

  /* ---------- Progress, bar data & segmented bar ---------- */

  .progress {
    position: relative;
    display: block;
    height: 0.5rem;
    overflow: hidden;
    background: var(--chart-track);
    border-radius: var(--radius-full);
  }

  .progress-value {
    display: block;
    height: 100%;
    background: var(--chart-lead);
    border-radius: var(--radius-full);
    transform-origin: left center;
  }

  /* Bar hasil voting: tumbuh dari baseline (ujung kiri siku), ujung data
     membulat 4px; tebal 10px (≤24px). */
  .bar {
    display: block;
    height: 0.625rem;
    background: var(--chart-track);
    border-radius: 2px var(--radius-xs) var(--radius-xs) 2px;
    overflow: hidden;
  }

  .bar-value {
    display: block;
    height: 100%;
    background: var(--chart-rest);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    transform-origin: left center;
    animation: bar-grow 700ms var(--ease-out) both;
  }

  .bar-value.is-lead {
    background: var(--chart-lead);
  }

  /* Segmented bar tipis untuk komposisi ready check (siap/mungkin/absen/AFK). */
  .segbar {
    display: flex;
    gap: 2px;
    height: 0.5rem;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: var(--chart-track);
  }

  .segbar > span {
    flex-basis: 0;
    min-width: 0;
  }

  .seg-yes { background: var(--ready); }
  .seg-maybe { background: var(--maybe); }
  .seg-no { background: var(--absent); }
  .seg-pending { background: var(--afk); }

  /* ---------- Skeleton ---------- */

  .skeleton {
    display: block;
    border-radius: var(--radius-sm);
    background:
      linear-gradient(90deg, transparent, color-mix(in srgb, var(--card) 70%, transparent), transparent)
        0 0 / 200% 100% no-repeat,
      var(--muted);
    animation: shimmer 1.6s linear infinite;
  }

  /* ---------- Empty state ---------- */

  .empty {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: var(--space-8) var(--space-5);
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
  }

  .empty-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-1);
    color: var(--muted-foreground);
    background: var(--muted);
    border-radius: var(--radius-lg);
  }

  .empty-title {
    font-size: var(--text-base);
    font-weight: 600;
  }

  .empty-description {
    max-width: 22rem;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .empty .btn {
    margin-top: var(--space-2);
  }

  /* ---------- Tooltip (CSS; Esc menutup lewat app.js) ---------- */

  [data-tooltip] {
    position: relative;
  }

  [data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: calc(100% + 0.5rem);
    padding: 0.375rem 0.625rem;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--primary-foreground);
    background: var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translate(-50%, 4px);
    pointer-events: none;
    transition:
      opacity var(--duration-fast) var(--ease-out),
      transform var(--duration-fast) var(--ease-out);
  }

  [data-tooltip]:hover::before,
  [data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 300ms;
  }

  [data-tooltip][data-tooltip-hidden]::before {
    opacity: 0 !important;
  }

  [data-tooltip-side="bottom"]::before {
    top: calc(100% + 0.5rem);
    bottom: auto;
  }

  /* Untuk pemicu di tepi kanan: tooltip rata kanan agar tidak keluar layar. */
  [data-tooltip-align="end"]::before {
    left: auto;
    right: 0;
    transform: translate(0, 4px);
  }

  [data-tooltip-align="end"]:hover::before,
  [data-tooltip-align="end"]:focus-visible::before {
    transform: none;
  }

  /* ---------- Menu (dropdown) ---------- */

  .menu-anchor {
    position: relative;
  }

  .menu {
    position: absolute;
    z-index: 45;
    top: calc(100% + 0.375rem);
    right: 0;
    min-width: 12rem;
    padding: var(--space-1);
    color: var(--popover-foreground);
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: menu-in var(--duration) var(--ease-out);
    transform-origin: top right;
  }

  .menu-label {
    padding: var(--space-2) var(--space-2) var(--space-1);
  }

  .menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: var(--control);
    padding: 0 var(--space-2-5);
    font-size: var(--text-sm);
    text-align: left;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
  }

  .menu-item:hover,
  .menu-item:focus-visible {
    outline: none;
    background: var(--accent);
  }

  .menu-item .menu-check {
    margin-left: auto;
    opacity: 0;
  }

  .menu-item[aria-checked="true"] {
    font-weight: 550;
  }

  .menu-item[aria-checked="true"] .menu-check {
    opacity: 1;
  }

  /* ---------- Kbd / kode ---------- */

  .code-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.125rem 0.375rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--foreground);
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
  }
}

/* ---------- Animasi ---------- */

@keyframes pulse-ring {
  0% { opacity: 0.55; transform: scale(1); }
  80%, 100% { opacity: 0; transform: scale(2.6); }
}

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

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

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

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes shimmer {
  from { background-position: 150% 0, 0 0; }
  to { background-position: -50% 0, 0 0; }
}

/* Lebar mark data dalam langkah 2% dan bobot segmen 0–50. Dibuat oleh
   presenters.js (widthClass/growClass) karena CSP melarang style="". */
@layer components {
  .w-0 { width: 0%; }
  .w-2 { width: 2%; }
  .w-4 { width: 4%; }
  .w-6 { width: 6%; }
  .w-8 { width: 8%; }
  .w-10 { width: 10%; }
  .w-12 { width: 12%; }
  .w-14 { width: 14%; }
  .w-16 { width: 16%; }
  .w-18 { width: 18%; }
  .w-20 { width: 20%; }
  .w-22 { width: 22%; }
  .w-24 { width: 24%; }
  .w-26 { width: 26%; }
  .w-28 { width: 28%; }
  .w-30 { width: 30%; }
  .w-32 { width: 32%; }
  .w-34 { width: 34%; }
  .w-36 { width: 36%; }
  .w-38 { width: 38%; }
  .w-40 { width: 40%; }
  .w-42 { width: 42%; }
  .w-44 { width: 44%; }
  .w-46 { width: 46%; }
  .w-48 { width: 48%; }
  .w-50 { width: 50%; }
  .w-52 { width: 52%; }
  .w-54 { width: 54%; }
  .w-56 { width: 56%; }
  .w-58 { width: 58%; }
  .w-60 { width: 60%; }
  .w-62 { width: 62%; }
  .w-64 { width: 64%; }
  .w-66 { width: 66%; }
  .w-68 { width: 68%; }
  .w-70 { width: 70%; }
  .w-72 { width: 72%; }
  .w-74 { width: 74%; }
  .w-76 { width: 76%; }
  .w-78 { width: 78%; }
  .w-80 { width: 80%; }
  .w-82 { width: 82%; }
  .w-84 { width: 84%; }
  .w-86 { width: 86%; }
  .w-88 { width: 88%; }
  .w-90 { width: 90%; }
  .w-92 { width: 92%; }
  .w-94 { width: 94%; }
  .w-96 { width: 96%; }
  .w-98 { width: 98%; }
  .w-100 { width: 100%; }
  .g-0 { flex-grow: 0; }
  .g-1 { flex-grow: 1; }
  .g-2 { flex-grow: 2; }
  .g-3 { flex-grow: 3; }
  .g-4 { flex-grow: 4; }
  .g-5 { flex-grow: 5; }
  .g-6 { flex-grow: 6; }
  .g-7 { flex-grow: 7; }
  .g-8 { flex-grow: 8; }
  .g-9 { flex-grow: 9; }
  .g-10 { flex-grow: 10; }
  .g-11 { flex-grow: 11; }
  .g-12 { flex-grow: 12; }
  .g-13 { flex-grow: 13; }
  .g-14 { flex-grow: 14; }
  .g-15 { flex-grow: 15; }
  .g-16 { flex-grow: 16; }
  .g-17 { flex-grow: 17; }
  .g-18 { flex-grow: 18; }
  .g-19 { flex-grow: 19; }
  .g-20 { flex-grow: 20; }
  .g-21 { flex-grow: 21; }
  .g-22 { flex-grow: 22; }
  .g-23 { flex-grow: 23; }
  .g-24 { flex-grow: 24; }
  .g-25 { flex-grow: 25; }
  .g-26 { flex-grow: 26; }
  .g-27 { flex-grow: 27; }
  .g-28 { flex-grow: 28; }
  .g-29 { flex-grow: 29; }
  .g-30 { flex-grow: 30; }
  .g-31 { flex-grow: 31; }
  .g-32 { flex-grow: 32; }
  .g-33 { flex-grow: 33; }
  .g-34 { flex-grow: 34; }
  .g-35 { flex-grow: 35; }
  .g-36 { flex-grow: 36; }
  .g-37 { flex-grow: 37; }
  .g-38 { flex-grow: 38; }
  .g-39 { flex-grow: 39; }
  .g-40 { flex-grow: 40; }
  .g-41 { flex-grow: 41; }
  .g-42 { flex-grow: 42; }
  .g-43 { flex-grow: 43; }
  .g-44 { flex-grow: 44; }
  .g-45 { flex-grow: 45; }
  .g-46 { flex-grow: 46; }
  .g-47 { flex-grow: 47; }
  .g-48 { flex-grow: 48; }
  .g-49 { flex-grow: 49; }
  .g-50 { flex-grow: 50; }
}

/* =========================================================================
   Tata letak: header, footer, kontainer
   ========================================================================= */

@layer layout {
  .container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin-inline: auto;
    padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  }

  .container-narrow {
    max-width: calc(var(--container-narrow) + var(--gutter) * 2);
  }

  .app-main {
    flex: 1;
    width: 100%;
    padding-bottom: var(--space-16);
  }

  .app-main:focus {
    outline: none;
  }

  .skip-link {
    position: absolute;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    min-height: var(--control);
    top: var(--space-2);
    left: var(--space-2);
    padding: 0 var(--space-4);
    font-weight: 600;
    color: var(--primary-foreground);
    background: var(--primary);
    border-radius: var(--radius-md);
    transform: translateY(-160%);
    transition: transform var(--duration) var(--ease-out);
  }

  .skip-link:focus {
    transform: none;
  }

  /* Header */
  .app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: color-mix(in srgb, var(--background) 82%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    view-transition-name: app-header;
  }

  .app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--header-h);
  }

  .logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2-5);
    min-height: var(--control);
    font-size: 1.0625rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--foreground);
    text-decoration: none;
    border-radius: var(--radius-sm);
  }

  .logo-mark {
    width: 1.875rem;
    height: 1.875rem;
  }

  .logo-word span {
    color: var(--muted-foreground);
    font-weight: 500;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }

  .header-actions .btn-brand {
    margin-left: var(--space-1);
  }

  /* Ikon toggle tema mengikuti tema yang sedang aktif. */
  .theme-icon-dark {
    display: none;
  }

  :root[data-theme="dark"] .theme-icon-light {
    display: none;
  }

  :root[data-theme="dark"] .theme-icon-dark {
    display: inline-block;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-light {
      display: none;
    }

    :root:not([data-theme="light"]) .theme-icon-dark {
      display: inline-block;
    }
  }

  /* Footer */
  .app-footer {
    margin-top: auto;
    padding-block: var(--space-10) var(--space-8);
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    border-top: 1px solid var(--border);
    background: var(--background);
  }

  .footer-grid {
    display: grid;
    gap: var(--space-6);
  }

  .footer-brand {
    display: grid;
    gap: var(--space-3);
    max-width: 24rem;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .footer-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    min-height: var(--control);
    padding: 0 var(--space-2);
    margin-left: calc(var(--space-2) * -1);
    color: var(--foreground);
    text-decoration: none;
    border-radius: var(--radius-sm);
  }

  .footer-links a:hover {
    background: var(--accent);
  }

  .footer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    padding-top: var(--space-6);
    border-top: 1px dashed var(--border);
  }

  @media (min-width: 48rem) {
    .footer-grid {
      grid-template-columns: 1.4fr 1fr;
      align-items: start;
    }

    .footer-links {
      justify-content: flex-end;
    }
  }

  /* Judul halaman */
  .page-header {
    display: grid;
    gap: var(--space-3);
    padding-block: var(--space-8) var(--space-6);
  }

  .page-title {
    font-size: var(--text-4xl);
    font-weight: 650;
    letter-spacing: var(--tracking-tighter);
  }

  .section-title {
    font-size: var(--text-2xl);
    font-weight: 650;
    letter-spacing: var(--tracking-tight);
  }

  .stack {
    display: grid;
    gap: var(--space-4);
    align-content: start;
  }

  .stack-lg {
    gap: var(--space-6);
  }
}

/* Transisi lintas halaman (Chrome/Safari terbaru); diabaikan browser lain. */
@view-transition {
  navigation: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* =========================================================================
   Pola produk LobbyQuest
   ========================================================================= */

@layer components {
  /* ---------- Date tile ---------- */

  .date-tile {
    display: inline-grid;
    justify-items: center;
    align-content: center;
    flex: none;
    width: 3.25rem;
    min-height: 3.5rem;
    padding: var(--space-1-5) 0;
    line-height: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .date-tile-wd,
  .date-tile-mo {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-foreground);
  }

  .date-tile-day {
    margin: 0.2rem 0 0.15rem;
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.03em;
  }

  .date-tile-brand {
    border-color: color-mix(in srgb, var(--brand) 70%, var(--border));
    box-shadow: inset 0 3px 0 var(--brand), var(--shadow-xs);
  }

  .date-tile-lg {
    width: 4.25rem;
    min-height: 4.5rem;
    border-radius: var(--radius-lg);
  }

  .date-tile-lg .date-tile-day {
    font-size: 1.75rem;
  }

  /* ---------- Quest tracker (tahapan agenda) ---------- */

  .quest {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .quest-step {
    position: relative;
    display: grid;
    justify-items: start;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 550;
    color: var(--muted-foreground);
  }

  /* Garis penghubung antar-node. */
  .quest-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 0.9375rem;
    left: 2.25rem;
    right: 0.5rem;
    height: 2px;
    background: var(--border);
    border-radius: 2px;
  }

  .quest-step.is-done:not(:last-child)::after {
    background: var(--brand);
  }

  .quest-node {
    display: grid;
    place-items: center;
    width: 1.875rem;
    height: 1.875rem;
    color: var(--muted-foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
  }

  .quest-node .icon {
    width: 0.9375rem;
    height: 0.9375rem;
  }

  .quest-step.is-done .quest-node {
    color: var(--brand-foreground);
    background: var(--brand);
    border-color: var(--brand);
  }

  .quest-step.is-current {
    color: var(--foreground);
  }

  .quest-step.is-current .quest-node {
    color: var(--foreground);
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 55%, transparent);
  }

  /* ---------- Stat tile ---------- */

  .stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .stat {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-3);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .stat-label {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: var(--text-xs);
    font-weight: 550;
    color: var(--muted-foreground);
  }

  .stat-label .icon {
    width: 0.875rem;
    height: 0.875rem;
  }

  .stat-value {
    font-size: var(--text-2xl);
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--foreground);
  }

  .stat-names {
    font-size: var(--text-xs);
    line-height: 1.4;
    color: var(--muted-foreground);
    overflow-wrap: anywhere;
  }

  .stat-yes .stat-label .icon { color: var(--ready); }
  .stat-maybe .stat-label .icon { color: var(--maybe-text); }
  .stat-no .stat-label .icon { color: var(--absent); }
  .stat-pending .stat-label .icon { color: var(--afk-text); }

  @media (min-width: 40rem) {
    .stats-4 {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  /* ---------- Kontrol segmen (radio) ---------- */

  .segmented {
    display: grid;
    grid-template-columns: repeat(var(--segments, 3), minmax(0, 1fr));
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--muted);
    border-radius: var(--radius-lg);
  }

  .segment {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: var(--space-1);
    min-height: 4rem;
    padding: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 550;
    text-align: center;
    color: var(--muted-foreground);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
      color var(--duration-fast) var(--ease-out),
      background-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out),
      transform var(--duration) var(--ease-spring);
  }

  .segment input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .segment .icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .segment:hover {
    color: var(--foreground);
  }

  .segment:has(input:checked) {
    color: var(--foreground);
    background: var(--card);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
  }

  .segment:has(input:focus-visible) {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  .segment-yes:has(input:checked) .icon { color: var(--ready); }
  .segment-maybe:has(input:checked) .icon { color: var(--maybe-text); }
  .segment-no:has(input:checked) .icon { color: var(--absent); }

  .segment-yes:has(input:checked) {
    border-color: color-mix(in srgb, var(--ready) 45%, var(--border));
  }

  .segment-maybe:has(input:checked) {
    border-color: color-mix(in srgb, var(--maybe) 55%, var(--border));
  }

  .segment-no:has(input:checked) {
    border-color: color-mix(in srgb, var(--absent) 45%, var(--border));
  }

  /* ---------- Kartu opsi waktu (checkbox/radio) ---------- */

  .option-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 4.25rem;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition:
      border-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out),
      background-color var(--duration-fast) var(--ease-out);
  }

  .option-card:hover {
    border-color: color-mix(in srgb, var(--input) 55%, var(--border));
  }

  .option-card:has(input:checked) {
    border-color: var(--foreground);
    box-shadow: 0 0 0 1px var(--foreground), var(--shadow-sm);
  }

  .option-card:has(input:focus-visible) {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  .option-card:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .option-card .checkbox,
  .option-card .radio {
    margin-left: auto;
  }

  .option-time {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
  }

  .option-time-range {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    letter-spacing: -0.02em;
  }

  .option-time-date {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  /* ---------- Daftar lobby (party) ---------- */

  .lobby-list {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .lobby-member {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 3.25rem;
    padding: var(--space-1-5) var(--space-2);
    border-radius: var(--radius-md);
  }

  .lobby-member.is-you {
    background: var(--muted);
  }

  .lobby-name {
    flex: 1;
    min-width: 0;
    font-size: var(--text-sm);
    font-weight: 550;
    overflow-wrap: anywhere;
  }

  .lobby-you {
    font-weight: 400;
    color: var(--muted-foreground);
  }

  .lobby-slot-empty {
    color: var(--muted-foreground);
  }

  .lobby-slot-empty .avatar {
    color: var(--muted-foreground);
    background: transparent;
    border: 1px dashed var(--input);
  }

  /* ---------- Field undangan (tautan + salin) ---------- */

  .invite-field {
    display: flex;
    gap: var(--space-2);
  }

  .invite-field .input {
    flex: 1;
  }

  .btn[data-copied] .icon-copy,
  .btn:not([data-copied]) .icon-copied {
    display: none;
  }
}

/* =========================================================================
   Halaman: sistem desain (/desain)
   ========================================================================= */

@layer pages {
  .ds-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-8);
  }

  .ds-nav ul {
    display: flex;
    gap: var(--space-1);
    margin: 0;
    padding: 0 0 var(--space-2);
    list-style: none;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .ds-nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--control);
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    white-space: nowrap;
    color: var(--muted-foreground);
    text-decoration: none;
    border-radius: var(--radius-md);
  }

  .ds-nav a:hover {
    color: var(--foreground);
    background: var(--accent);
  }

  .ds-sections {
    display: grid;
    gap: var(--space-12);
    min-width: 0;
  }

  .ds-section {
    display: grid;
    gap: var(--space-4);
    align-content: start;
  }

  .ds-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: var(--space-3);
  }

  .ds-swatch {
    display: grid;
    gap: var(--space-1);
  }

  .ds-swatch-chip {
    height: 3.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .ds-swatch-name {
    font-size: var(--text-xs);
  }

  .ds-swatch-note {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  .swatch-background { background: var(--background); }
  .swatch-card { background: var(--card); }
  .swatch-muted { background: var(--muted); }
  .swatch-foreground { background: var(--foreground); }
  .swatch-muted-foreground { background: var(--muted-foreground); }
  .swatch-primary { background: var(--primary); }
  .swatch-brand { background: var(--brand); }
  .swatch-brand-text { background: var(--brand-text); }
  .swatch-border { background: var(--border); }
  .swatch-input { background: var(--input); }
  .swatch-ring { background: var(--ring); }
  .swatch-destructive { background: var(--destructive); }
  .swatch-ready { background: var(--ready); }
  .swatch-maybe { background: var(--maybe); }
  .swatch-absent { background: var(--absent); }
  .swatch-afk { background: var(--afk); }
  .swatch-info { background: var(--info); }
  .swatch-chart-lead { background: var(--chart-lead); }

  .ds-type-display {
    font-size: var(--text-display);
    font-weight: 650;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
  }

  .ds-type-4xl {
    font-size: var(--text-4xl);
    font-weight: 650;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
  }

  .ds-type-2xl {
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
  }

  .ds-type-mono {
    font-size: var(--text-sm);
  }

  .ds-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ds-icons li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .ds-icons span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-foreground);
  }

  .ds-form-grid {
    display: grid;
    gap: var(--space-5);
  }

  .ds-choices {
    display: grid;
    gap: var(--space-2);
  }

  .ds-toast-demo {
    display: grid;
    justify-items: start;
    gap: var(--space-3);
  }

  .ds-static-toast {
    animation: none;
  }

  .ds-bars {
    display: grid;
    gap: var(--space-2);
  }

  .ds-bars .kicker {
    margin-top: var(--space-2);
  }

  .ds-skeleton-line {
    height: 0.75rem;
  }

  .ds-skeleton-short {
    width: 60%;
  }

  @media (min-width: 40rem) {
    .ds-form-grid,
    .ds-choices {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ds-span {
      grid-column: 1 / -1;
    }
  }

  @media (min-width: 64rem) {
    .ds-layout {
      grid-template-columns: 12rem minmax(0, 1fr);
      align-items: start;
    }

    .ds-nav {
      position: sticky;
      top: calc(var(--header-h) + var(--space-6));
    }

    .ds-nav ul {
      flex-direction: column;
      overflow: visible;
    }
  }
}

/* =========================================================================
   Halaman: beranda
   ========================================================================= */

@layer pages {
  .hero {
    position: relative;
    overflow: hidden;
    padding-block: var(--space-10) var(--space-12);
    border-bottom: 1px solid var(--border);
    background:
      radial-gradient(60rem 28rem at 85% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
      radial-gradient(color-mix(in srgb, var(--foreground) 9%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
      var(--background);
  }

  .hero::after {
    /* Pudarkan pola titik ke bawah agar menyatu dengan section berikutnya. */
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 40%;
    background: linear-gradient(transparent, var(--background));
    pointer-events: none;
  }

  .hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--space-10);
    align-items: center;
  }

  .hero-copy {
    display: grid;
    justify-items: start;
    gap: var(--space-5);
  }

  .hero-badge {
    gap: var(--space-2);
    padding-inline: var(--space-2-5);
    background: var(--card);
  }

  .hero-dot {
    color: var(--ready);
  }

  .hero-title {
    font-size: var(--text-display);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: var(--tracking-tighter);
  }

  /* Sorotan stabilo Volt di belakang kata kunci. */
  .hl {
    background: linear-gradient(transparent 66%, color-mix(in srgb, var(--brand) 65%, transparent) 66%, color-mix(in srgb, var(--brand) 65%, transparent) 90%, transparent 90%);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    padding-inline: 0.04em;
  }

  .hero-lead {
    max-width: 34rem;
  }

  .hero-lead strong {
    color: var(--foreground);
    font-weight: 600;
  }

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

  .hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .hero-trust li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
  }

  .hero-trust .icon {
    color: var(--foreground);
  }

  .hero-visual {
    display: grid;
    place-items: center;
  }

  .hero-art {
    width: 100%;
    max-width: 34rem;
    height: auto;
    overflow: visible;
  }

  /* Ilustrasi: semua warna dari token, jadi otomatis mengikuti tema. */
  .ha-card {
    fill: var(--card);
    stroke: var(--border);
    stroke-width: 1;
    filter: drop-shadow(0 18px 30px rgb(10 10 12 / 12%));
  }

  .ha-card-pop {
    stroke: var(--input);
    stroke-opacity: 0.45;
  }

  .ha-orbit {
    fill: none;
    stroke: var(--input);
    stroke-width: 1.5;
    stroke-dasharray: 2 7;
    stroke-linecap: round;
    opacity: 0.7;
  }

  .ha-orbit-dot {
    fill: var(--brand);
    stroke: var(--brand-foreground);
    stroke-width: 1;
  }

  .ha-kicker {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    fill: var(--muted-foreground);
  }

  .ha-title {
    font-family: var(--font-sans);
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -0.03em;
    fill: var(--foreground);
  }

  .ha-badge {
    fill: var(--info-soft);
  }

  .ha-live {
    fill: var(--info);
  }

  .ha-badge-text {
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    fill: var(--info-text);
  }

  .ha-tile {
    fill: var(--card);
    stroke: var(--border);
  }

  .ha-tile-brand {
    stroke: color-mix(in srgb, var(--brand) 70%, var(--border));
  }

  .ha-tile-strip {
    fill: var(--brand);
  }

  .ha-tile-wd {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.08em;
    text-anchor: middle;
    fill: var(--muted-foreground);
  }

  .ha-tile-day {
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 650;
    text-anchor: middle;
    fill: var(--foreground);
  }

  .ha-time {
    font-family: var(--font-mono);
    font-size: 11.5px;
    fill: var(--foreground);
  }

  .ha-track {
    fill: var(--chart-track);
  }

  .ha-bar {
    fill: var(--chart-rest);
  }

  .ha-bar-lead {
    fill: var(--chart-lead);
  }

  .ha-count {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 650;
    fill: var(--foreground);
  }

  .ha-crown {
    fill: var(--brand);
    stroke: var(--brand-foreground);
    stroke-width: 1.5;
    stroke-linejoin: round;
  }

  .ha-av {
    stroke: var(--card);
    stroke-width: 2.5;
  }

  .ha-av-0 { fill: var(--av-0-bg); }
  .ha-av-1 { fill: var(--av-1-bg); }
  .ha-av-3 { fill: var(--av-3-bg); }
  .ha-av-4 { fill: var(--av-4-bg); }

  .ha-av-slot {
    fill: var(--card);
    stroke: var(--input);
    stroke-width: 1.2;
    stroke-dasharray: 3 3;
  }

  .ha-av-t {
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 650;
    text-anchor: middle;
  }

  .ha-av-t0 { fill: var(--av-0-fg); }
  .ha-av-t1 { fill: var(--av-1-fg); }
  .ha-av-t3 { fill: var(--av-3-fg); }
  .ha-av-t4 { fill: var(--av-4-fg); }

  .ha-plus {
    stroke: var(--muted-foreground);
    stroke-width: 1.6;
    stroke-linecap: round;
  }

  .ha-party-text,
  .ha-muted-sm {
    font-family: var(--font-sans);
    font-size: 11.5px;
    fill: var(--muted-foreground);
  }

  .ha-big {
    font-family: var(--font-sans);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.04em;
    fill: var(--foreground);
  }

  .ha-muted {
    font-family: var(--font-sans);
    font-size: 13px;
    fill: var(--muted-foreground);
  }

  .ha-lock-text {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    fill: var(--foreground);
  }

  .ha-lock {
    fill: none;
    stroke: var(--brand-text);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ha-seg-yes { fill: var(--ready); }
  .ha-seg-maybe { fill: var(--maybe); }
  .ha-seg-afk { fill: var(--afk); }

  .ha-ready-ring {
    fill: var(--brand);
    stroke: color-mix(in srgb, var(--brand) 40%, transparent);
    stroke-width: 6;
    paint-order: stroke;
  }

  .ha-ready-check {
    fill: none;
    stroke: var(--brand-foreground);
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ha-sparkle {
    fill: var(--brand);
    stroke: var(--brand-foreground);
    stroke-width: 1;
    stroke-linejoin: round;
  }

  @media (prefers-reduced-motion: no-preference) {
    .ha-float-a { animation: float 7s var(--ease-in-out) infinite; }
    .ha-float-b { animation: float 6s var(--ease-in-out) -2s infinite; }
    .ha-float-c { animation: float 8s var(--ease-in-out) -4s infinite; }
    .ha-ready-ring { animation: ready-pulse 2.4s var(--ease-out) infinite; }
    .ha-sparkle { animation: twinkle 3.2s var(--ease-in-out) infinite; transform-box: fill-box; transform-origin: center; }
    .ha-sparkle-sm { animation-delay: -1.6s; }
  }

  /* Section umum */
  .section {
    padding-block: var(--space-16) 0;
  }

  .section-head {
    display: grid;
    gap: var(--space-3);
    max-width: 40rem;
    margin-bottom: var(--space-8);
  }

  /* Quest log: langkah bernomor */
  .steps {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
  }

  .step {
    position: relative;
    display: grid;
    align-content: start;
    gap: var(--space-2);
    padding: var(--space-5);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
  }

  .step-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
  }

  .step-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: var(--radius-md);
    box-shadow: inset 0 -2px 0 rgb(0 0 0 / 12%);
  }

  .step-num {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  .step-title {
    font-size: var(--text-lg);
    font-weight: 600;
  }

  .step-text {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  /* Bento fitur */
  .bento {
    display: grid;
    gap: var(--space-3);
  }

  .bento-body {
    display: grid;
    align-content: start;
    gap: var(--space-2);
    height: 100%;
  }

  .bento-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: var(--space-2);
    color: var(--foreground);
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  .bento-title {
    font-size: var(--text-base);
    font-weight: 600;
  }

  .bento-demo {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding: var(--space-4);
    background: var(--muted);
    border-radius: var(--radius-md);
  }

  .bento-bars {
    gap: var(--space-2-5);
  }

  .bento-wide {
    background:
      radial-gradient(28rem 14rem at 100% 0, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
      var(--card);
  }

  /* Pita CTA akhir */
  .cta-band {
    position: relative;
    display: grid;
    gap: var(--space-6);
    padding: var(--space-8) var(--space-6);
    overflow: hidden;
    color: #f4f4f5;
    background:
      radial-gradient(36rem 18rem at 100% 100%, rgb(195 237 76 / 22%), transparent 70%),
      radial-gradient(rgb(255 255 255 / 7%) 1px, transparent 1px) 0 0 / 20px 20px,
      #111114;
    border: 1px solid #26262c;
    border-radius: var(--radius-2xl);
  }

  .cta-copy {
    display: grid;
    gap: var(--space-3);
  }

  .cta-kicker {
    color: #c3ed4c;
  }

  .cta-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tighter);
  }

  .cta-text {
    max-width: 30rem;
    color: #a1a1aa;
  }

  .cta-band .btn {
    justify-self: start;
  }

  @media (min-width: 40rem) {
    .hero-actions .btn {
      flex: 0 0 auto;
    }

    .steps,
    .bento {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bento-wide {
      grid-column: 1 / -1;
    }
  }

  @media (min-width: 64rem) {
    .hero {
      padding-block: var(--space-20) var(--space-24);
    }

    .hero-grid {
      grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
      gap: var(--space-12);
    }

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

    /* Garis quest yang menghubungkan langkah di desktop. */
    .step:not(:last-child)::after {
      content: "";
      position: absolute;
      top: 2.5rem;
      right: calc(var(--space-3) * -1);
      width: var(--space-3);
      height: 2px;
      background: var(--border);
    }

    .bento {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bento-wide {
      grid-column: span 2;
      grid-row: span 2;
    }

    .cta-band {
      grid-template-columns: 1fr auto;
      align-items: center;
      padding: var(--space-12);
    }

    .cta-band .btn {
      justify-self: end;
    }
  }
}

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

@keyframes ready-pulse {
  0% { stroke-width: 0; stroke-opacity: 0.6; }
  70%, 100% { stroke-width: 14; stroke-opacity: 0; }
}

@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(0.75) rotate(20deg); opacity: 0.7; }
}

/* =========================================================================
   Halaman: form buat agenda
   ========================================================================= */

@layer pages {
  .form-header {
    padding-bottom: var(--space-4);
  }

  .form-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
  }

  .form-steps a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control);
    padding: 0 var(--space-3) 0 var(--space-1-5);
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--muted-foreground);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--card);
  }

  .form-steps a:hover {
    color: var(--foreground);
    border-color: var(--input);
  }

  .form-step-num,
  .form-card-num {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: 50%;
  }

  .form-card-num {
    width: 1.5rem;
    height: 1.5rem;
  }

  .form-layout {
    display: grid;
    gap: var(--space-6);
    align-items: start;
  }

  .form-main {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
  }

  .form-card .card-title {
    font-size: var(--text-lg);
  }

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

  .counter {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  .counter.is-near {
    color: var(--maybe-text);
  }

  /* Pilihan jenis: kartu besar dengan ikon */
  .kind-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .kind-card {
    position: relative;
    display: grid;
    gap: var(--space-1);
    padding: var(--space-4);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition:
      border-color var(--duration-fast) var(--ease-out),
      box-shadow var(--duration) var(--ease-out),
      transform var(--duration) var(--ease-spring);
  }

  .kind-card input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }

  .kind-card:hover {
    border-color: var(--input);
  }

  .kind-card-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: var(--space-2);
    color: var(--foreground);
    background: var(--muted);
    border-radius: var(--radius-md);
    transition: background-color var(--duration) var(--ease-out), color var(--duration) var(--ease-out);
  }

  .kind-card-label {
    font-weight: 600;
  }

  .kind-card-hint {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .kind-card-check {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    display: grid;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration) var(--ease-spring);
  }

  .kind-card:has(input:checked) {
    border-color: var(--foreground);
    box-shadow: 0 0 0 1px var(--foreground), var(--shadow-sm);
  }

  .kind-card:has(input:checked) .kind-card-icon {
    color: var(--brand-foreground);
    background: var(--brand);
  }

  .kind-card:has(input:checked) .kind-card-check {
    opacity: 1;
    transform: scale(1);
  }

  .kind-card:has(input:focus-visible) {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  /* Isi cepat */
  .presets {
    display: grid;
    gap: var(--space-2);
  }

  .preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Baris pilihan waktu */
  .slots {
    display: grid;
    gap: var(--space-3);
  }

  .slot {
    position: relative;
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-4);
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 0;
  }

  .slot.is-filled {
    animation: slot-flash 900ms var(--ease-out);
  }

  .slot-legend {
    float: left;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
  }

  .slot-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 var(--space-1-5);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }

  .slot-fields {
    clear: both;
    display: grid;
    gap: var(--space-3);
  }

  .slot-field {
    display: grid;
    gap: var(--space-1-5);
    min-width: 0;
  }

  .slot-label {
    font-size: var(--text-sm);
    font-weight: 550;
  }

  .slot-remove {
    position: absolute;
    top: var(--space-2-5);
    right: var(--space-2-5);
  }

  .slot-error {
    margin-top: calc(var(--space-1) * -1);
  }

  .add-slot {
    justify-self: start;
  }

  /* Stepper kuota */
  .stepper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .stepper-input {
    width: 6.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
  }

  .stepper-input::-webkit-outer-spin-button,
  .stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* Bilah kirim: menempel di bawah layar HP */
  .submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--space-3) var(--gutter) max(var(--space-3), env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--background) 88%, transparent);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .submit-bar .btn {
    flex: 1 1 auto;
  }

  .submit-note {
    display: none;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  /* Pratinjau (desktop) */
  .form-aside {
    display: none;
  }

  .preview-card .card-header {
    padding-bottom: 0;
  }

  .preview-title {
    font-size: var(--text-xl);
    font-weight: 650;
    letter-spacing: var(--tracking-tight);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .preview-title.is-empty {
    color: var(--muted-foreground);
  }

  .preview-meta,
  .next-steps {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .preview-meta li,
  .next-steps li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .next-steps .icon {
    color: var(--brand-text);
  }

  [data-preview-kind] .preview-kind-mabar,
  [data-preview-kind] .preview-kind-nongkrong {
    display: none;
  }

  [data-kind="mabar"] .preview-kind-mabar,
  [data-kind="nongkrong"] .preview-kind-nongkrong {
    display: inline-block;
  }

  @media (min-width: 40rem) {
    .slot-fields {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      padding-right: var(--space-10);
    }

    .slot {
      padding-right: var(--space-4);
    }

    .submit-bar {
      position: static;
      margin-inline: 0;
      padding: var(--space-4) var(--space-5);
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      backdrop-filter: none;
    }

    .submit-bar .btn {
      flex: 0 0 auto;
    }

    .submit-note {
      display: inline-flex;
    }
  }

  @media (min-width: 64rem) {
    .form-layout {
      grid-template-columns: minmax(0, 1fr) 20rem;
      gap: var(--space-8);
    }

    .form-aside {
      display: block;
      position: sticky;
      top: calc(var(--header-h) + var(--space-6));
    }
  }
}

@keyframes slot-flash {
  0% { box-shadow: 0 0 0 0 var(--glow); border-color: var(--brand); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

/* =========================================================================
   Halaman: agenda (lobby)
   ========================================================================= */

@layer pages {
  .agenda-page {
    display: grid;
    gap: var(--space-4);
    padding-top: var(--space-6);
  }

  .agenda-layout {
    display: grid;
    gap: var(--space-4);
    align-items: start;
  }

  .agenda-main,
  .agenda-aside {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
  }

  /* Kartu "lobby siap" setelah agenda dibuat */
  .created-card {
    border-color: color-mix(in srgb, var(--brand) 60%, var(--border));
    background:
      radial-gradient(30rem 12rem at 0 0, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%),
      var(--card);
  }

  .created-body {
    display: grid;
    gap: var(--space-4);
  }

  .created-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: var(--radius-lg);
    animation: pop-in 520ms var(--ease-spring) both;
  }

  .created-copy {
    display: grid;
    gap: var(--space-1);
  }

  /* Header lobby */
  .lobby-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .lobby-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tighter);
    overflow-wrap: anywhere;
  }

  .lobby-description {
    max-width: 44rem;
    color: var(--muted-foreground);
    white-space: pre-line;
    overflow-wrap: anywhere;
  }

  .lobby-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .lobby-meta li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .lobby-meta .icon {
    color: var(--foreground);
  }

  .lobby-hero .quest {
    margin-top: var(--space-2);
    padding-top: var(--space-5);
    border-top: 1px dashed var(--border);
  }

  /* Jadwal dikunci */
  .final-card {
    overflow: hidden;
  }

  .final-scheduled {
    border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
    background:
      radial-gradient(34rem 16rem at 100% 0, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
      var(--card);
  }

  .final-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .final-copy {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
  }

  .final-time {
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
  }

  .final-zone {
    font-size: 0.55em;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted-foreground);
  }

  .final-date {
    color: var(--muted-foreground);
  }

  .local-time {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--info-text);
  }

  .countdown {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    justify-self: start;
    margin-top: var(--space-2);
    padding: 0.25rem 0.625rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: var(--radius-full);
  }

  .countdown::before {
    content: "";
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: currentColor;
    animation: blink 1.6s steps(2, start) infinite;
  }

  .countdown.is-live {
    color: #fff;
    background: var(--ready);
  }

  .final-actions {
    padding-top: 0;
  }

  /* Ready check */
  .ready-score {
    display: inline-flex;
    align-items: baseline;
    gap: 0.125rem;
  }

  .ready-score-num {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
  }

  .ready-score-of {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .segbar-lg {
    height: 0.625rem;
  }

  .ready-card .hint .icon {
    vertical-align: -0.15em;
  }

  .party-slots {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .party-slots strong {
    color: var(--foreground);
  }

  .party-slots.is-full {
    color: var(--ready-text);
  }

  .slot-pips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3125rem;
  }

  .pip {
    width: 0.75rem;
    height: 0.75rem;
    border: 1.5px solid var(--input);
    border-radius: 3px;
    transform: rotate(45deg);
  }

  .pip.is-filled {
    background: var(--ready);
    border-color: var(--ready);
  }

  .segment-label {
    font-weight: 600;
    color: var(--foreground);
  }

  .segment-hint {
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--muted-foreground);
  }

  .rsvp-form {
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border);
  }

  /* Hasil voting */
  .results {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .result {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color var(--duration) var(--ease-out);
  }

  .result.is-top {
    border-color: color-mix(in srgb, var(--chart-lead) 45%, var(--border));
  }

  .result.is-final {
    border-color: color-mix(in srgb, var(--brand) 70%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 70%, var(--border));
  }

  .result-body {
    display: grid;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
  }

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

  .result-when {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
  }

  .result-range {
    font-size: var(--text-base);
    font-weight: 600;
    letter-spacing: -0.03em;
  }

  .result-date {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  .result-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .result-count {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
  }

  .result-count strong {
    font-size: var(--text-base);
    color: var(--foreground);
  }

  .result-names {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    overflow-wrap: anywhere;
  }

  .results > li:nth-child(1) .bar-value { animation-delay: 60ms; }
  .results > li:nth-child(2) .bar-value { animation-delay: 120ms; }
  .results > li:nth-child(3) .bar-value { animation-delay: 180ms; }
  .results > li:nth-child(4) .bar-value { animation-delay: 240ms; }
  .results > li:nth-child(5) .bar-value { animation-delay: 300ms; }
  .results > li:nth-child(n + 6) .bar-value { animation-delay: 360ms; }

  /* Form voting */
  .option-list,
  .choice-list {
    display: grid;
    gap: var(--space-2);
  }

  /* Lobby (party) */
  .lobby-member .badge {
    margin-left: auto;
  }

  .leave {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border);
  }

  .leave-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    min-height: var(--control);
    color: var(--destructive-text);
  }

  /* Undangan */
  .invite {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
  }

  .share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .share-buttons .btn {
    flex: 1 1 8rem;
  }

  /* Panel pengelola */
  .manage-card {
    border-style: dashed;
    border-color: var(--input);
  }

  .fine-print {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    max-width: 48rem;
    margin-top: var(--space-4);
    font-size: var(--text-xs);
    color: var(--muted-foreground);
  }

  .fine-print .icon {
    margin-top: 0.15em;
  }

  @media (min-width: 40rem) {
    .created-body {
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
    }

    .created-body .invite {
      grid-column: 1 / -1;
    }
  }

  @media (min-width: 64rem) {
    .agenda-page {
      padding-top: var(--space-8);
    }

    .agenda-layout {
      grid-template-columns: minmax(0, 1fr) 22rem;
      gap: var(--space-6);
    }

    .agenda-aside {
      position: sticky;
      top: calc(var(--header-h) + var(--space-6));
      max-height: calc(100dvh - var(--header-h) - var(--space-8));
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-width: thin;
      padding-bottom: var(--space-2);
    }
  }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes blink {
  to { opacity: 0.25; }
}

/* =========================================================================
   Halaman: masuk pengelola, 404, dan error
   ========================================================================= */

@layer pages {
  .auth-page,
  .error-page {
    display: grid;
    place-items: center;
    padding-block: var(--space-12);
  }

  .auth-card {
    width: min(100%, 28rem);
  }

  .auth-head {
    display: grid;
    justify-items: start;
    gap: var(--space-2);
  }

  .auth-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-2);
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: var(--radius-lg);
  }

  .auth-title {
    font-size: var(--text-2xl);
    font-weight: 650;
    letter-spacing: var(--tracking-tight);
  }

  .auth-agenda {
    color: var(--foreground);
    overflow-wrap: anywhere;
  }

  [data-password-toggle][aria-pressed="false"] .icon-hide,
  [data-password-toggle][aria-pressed="true"] .icon-show {
    display: none;
  }

  .error-card {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    width: min(100%, 34rem);
    text-align: center;
  }

  .error-visual {
    position: relative;
    display: grid;
    place-items: center;
    width: 7rem;
    height: 7rem;
    margin-bottom: var(--space-2);
    border-radius: 50%;
    background:
      radial-gradient(circle, color-mix(in srgb, var(--brand) 30%, transparent), transparent 70%);
  }

  .error-icon {
    display: grid;
    place-items: center;
    width: 4.25rem;
    height: 4.25rem;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    animation: float 6s var(--ease-in-out) infinite;
  }

  .error-code {
    position: absolute;
    right: -0.5rem;
    bottom: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--brand-foreground);
    background: var(--brand);
    border-radius: var(--radius-full);
  }

  .error-card .lead {
    max-width: 30rem;
  }

  .error-card .hint {
    max-width: 30rem;
  }

  .error-actions {
    justify-content: center;
    margin-top: var(--space-3);
  }
}

/* =========================================================================
   Microinteraction tambahan (otomatis mati dengan prefers-reduced-motion)
   ========================================================================= */

@layer components {
  .segment:has(input:checked) .icon {
    animation: pop-in-sm 360ms var(--ease-spring);
  }

  .option-card,
  .kind-card {
    will-change: transform;
  }

  @media (hover: hover) {
    .option-card:hover,
    .kind-card:hover {
      transform: translateY(-1px);
      box-shadow: var(--shadow-sm);
    }

    .option-card:has(input:checked):hover {
      box-shadow: 0 0 0 1px var(--foreground), var(--shadow-md);
    }
  }

  .lobby-member.is-new {
    animation: join-glow 1.6s var(--ease-out) 300ms both;
  }

  .lobby-member.is-new .avatar {
    animation: pop-in 520ms var(--ease-spring) 200ms both;
  }
}

@keyframes pop-in-sm {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes join-glow {
  0% { box-shadow: 0 0 0 0 var(--glow); background: color-mix(in srgb, var(--brand) 22%, var(--muted)); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
