/* ─── Cascade Layers ─────────────────────────────────────────────────────── */
@layer reset, tokens, base, layout, components, utilities, animations;

/* ─── Reset ──────────────────────────────────────────────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  img, video { display: block; max-width: 100%; }
}

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
@layer tokens {
  :root {
    /* ── Backgrounds ── */
    --color-bg-base:        oklch(0.09 0.018 270);
    --color-bg-subtle:      oklch(0.12 0.020 270);
    --color-bg-elevated:    oklch(0.15 0.022 270);
    --color-bg-overlay:     oklch(0.18 0.020 270);
    --color-bg-inset:       oklch(0.07 0.015 270);

    /* ── Borders ── */
    --color-border-subtle:  oklch(0.22 0.018 270);
    --color-border-default: oklch(0.28 0.020 270);
    --color-border-strong:  oklch(0.38 0.022 270);

    /* ── Text ── */
    --color-text-primary:   oklch(0.94 0.008 270);
    --color-text-secondary: oklch(0.72 0.012 270);
    --color-text-tertiary:  oklch(0.52 0.014 270);
    --color-text-inverse:   oklch(0.10 0.018 270);

    /* ── Gold accent (brand) ── */
    --color-gold:           oklch(0.79 0.14 85);
    --color-gold-subtle:    oklch(0.85 0.10 85);
    --color-gold-muted:     oklch(0.65 0.10 85);
    --color-gold-glow:      oklch(0.79 0.14 85 / 0.25);
    --color-gold-bg:        oklch(0.79 0.14 85 / 0.08);

    /* ── Status ── */
    --color-success:        oklch(0.72 0.18 155);
    --color-success-subtle: oklch(0.72 0.18 155 / 0.12);
    --color-warning:        oklch(0.78 0.15 68);
    --color-warning-subtle: oklch(0.78 0.15 68 / 0.12);
    --color-danger:         oklch(0.65 0.22 25);
    --color-danger-subtle:  oklch(0.65 0.22 25 / 0.12);
    --color-info:           oklch(0.72 0.14 240);
    --color-info-subtle:    oklch(0.72 0.14 240 / 0.12);
    --color-purple:         oklch(0.70 0.18 295);
    --color-purple-subtle:  oklch(0.70 0.18 295 / 0.14);

    /* ── Radius ── */
    --radius-xs:   4px;
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    /* ── Spacing ── */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-16: 64px;

    /* ── Shadows ── */
    --shadow-sm:    0 1px 2px oklch(0 0 0 / 0.4), 0 0 0 1px oklch(0 0 0 / 0.15);
    --shadow-md:    0 4px 16px oklch(0 0 0 / 0.35), 0 0 0 1px oklch(0 0 0 / 0.12);
    --shadow-lg:    0 8px 32px oklch(0 0 0 / 0.45), 0 0 0 1px oklch(0 0 0 / 0.10);
    --shadow-gold:  0 0 20px var(--color-gold-glow), 0 0 40px oklch(0.79 0.14 85 / 0.12);
    --shadow-inset: inset 0 1px 0 oklch(1 0 0 / 0.04);

    /* ── Animation ── */
    --duration-fast: 100ms;
    --duration-base: 180ms;
    --duration-slow: 320ms;
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);

    /* ── Typography ── */
    --font-sans:    'Inter', system-ui, sans-serif;
    --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

    /* ── Backwards-compat aliases (keeps existing JS inline var() refs working) ── */
    --navy:        var(--color-bg-elevated);
    --navy-light:  var(--color-bg-overlay);
    --gold:        var(--color-gold);
    --gold-light:  var(--color-gold-subtle);
    --bg:          var(--color-bg-base);
    --surface:     var(--color-bg-subtle);
    --border:      var(--color-border-subtle);
    --text:        var(--color-text-primary);
    --text-muted:  var(--color-text-secondary);
    --text-light:  var(--color-text-tertiary);
    --success:     var(--color-success);
    --danger:      var(--color-danger);
    --warning:     var(--color-warning);
    --success-bg:  var(--color-success-subtle);
    --danger-bg:   var(--color-danger-subtle);
    --warning-bg:  var(--color-warning-subtle);
    --info-bg:     var(--color-info-subtle);
    --radius:      var(--radius-md);
    --shadow:      var(--shadow-sm);

    /* ── Missing component tokens ── */
    --color-surface-raised: var(--color-bg-elevated);
  }
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
@layer base {
  body {
    font-family: var(--font-sans);
    background: var(--color-bg-base);
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--duration-fast);
  }
  a:hover { color: var(--color-gold-subtle); text-decoration: underline; }

  button {
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  button:active { transform: scale(0.97); }
  button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

  input, textarea, select {
    font-family: var(--font-sans);
    font-size: 13.5px;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    color: var(--color-text-primary);
    background: var(--color-bg-inset);
    outline: none;
    width: 100%;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  }
  input::placeholder, textarea::placeholder {
    color: var(--color-text-tertiary);
  }
  input:focus, textarea:focus, select:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px var(--color-gold-bg);
  }
  select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
  }
  select option {
    background: #1e2030;
    color: var(--color-text-primary);
  }
  code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xs);
    padding: 1px 6px;
    color: var(--color-gold);
  }
  details > summary {
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gold);
    padding: 4px 0;
  }
  details > summary:hover { color: var(--color-gold-subtle); }
  details pre {
    font-family: var(--font-mono);
    font-size: 11.5px;
    white-space: pre-wrap;
    background: var(--color-bg-inset);
    color: var(--color-text-secondary);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle);
    overflow: auto;
    margin-top: var(--space-3);
  }
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
@layer layout {
  .app-header {
    background: linear-gradient(105deg, var(--color-bg-base) 0%, oklch(0.11 0.028 275) 50%, var(--color-bg-base) 100%);
    background-size: 200% 100%;
    animation: headerShimmer 8s ease-in-out infinite alternate;
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 0 var(--space-8);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: var(--color-gold);
    letter-spacing: -0.01em;
    transition: text-shadow var(--duration-base);
  }
  .brand-name:hover {
    text-shadow: 0 0 14px var(--color-gold-glow);
  }

  .brand-sub {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-left: 10px;
    font-weight: 400;
  }

  .header-nav { display: flex; align-items: center; gap: var(--space-1); margin-left: var(--space-6); }
  .header-nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .header-nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-overlay);
    text-decoration: none;
  }
  .header-nav-link.active {
    color: var(--color-gold);
    background: var(--color-gold-bg);
    font-weight: 600;
  }

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

  .page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
  }

  .page-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
  }

  .page-subtitle {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin-bottom: var(--space-6);
  }

  /* ── Admin layout ── */
  .admin-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: calc(100vh - 60px);
  }

  .admin-nav {
    background: var(--color-bg-subtle);
    border-right: 1px solid var(--color-border-subtle);
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: var(--space-4) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-default) transparent;
  }

  .admin-content { padding: var(--space-8); }

  /* ── Post detail layout ── */
  .post-detail-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-8);
    align-items: start;
  }

  .post-detail-sidebar { position: sticky; top: 80px; }
}

/* ─── Components ──────────────────────────────────────────────────────────── */
@layer components {

  /* ── Cards ── */
  .card {
    background: var(--color-bg-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), var(--shadow-inset);
    padding: var(--space-6);
    border: 1px solid var(--color-border-subtle);
  }

  .card-elevated {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    box-shadow: var(--shadow-md), var(--shadow-inset);
    border-radius: var(--radius-md);
  }

  .card-glass {
    background: oklch(1 0 0 / 0.03);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border: 1px solid oklch(1 0 0 / 0.07);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md), inset 0 1px 0 oklch(1 0 0 / 0.06);
  }

  .card-header {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-inset);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .card-header h3 {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
  }

  /* ── Buttons ── */
  .btn {
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  .btn-primary {
    background: var(--color-gold);
    color: var(--color-text-inverse);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.3), var(--shadow-gold);
  }
  .btn-primary:hover {
    background: var(--color-gold-subtle);
    box-shadow: 0 2px 8px oklch(0 0 0 / 0.4), 0 0 28px var(--color-gold-glow);
    transform: translateY(-1px);
  }

  .btn-gold {
    background: var(--color-gold);
    color: var(--color-text-inverse);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.3), var(--shadow-gold);
  }
  .btn-gold:hover {
    background: var(--color-gold-subtle);
    box-shadow: 0 2px 8px oklch(0 0 0 / 0.4), 0 0 28px var(--color-gold-glow);
    transform: translateY(-1px);
  }

  .btn-success {
    background: var(--color-success);
    color: oklch(0.10 0.02 155);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 0 16px oklch(0.72 0.18 155 / 0.25);
  }
  .btn-success:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px oklch(0 0 0 / 0.3), 0 0 24px oklch(0.72 0.18 155 / 0.35);
  }

  .btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.3);
  }
  .btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px oklch(0 0 0 / 0.3), 0 0 16px oklch(0.65 0.22 25 / 0.25);
  }

  .btn-outline {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-default);
  }
  .btn-outline:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
    background: var(--color-gold-bg);
  }

  .btn-ghost {
    background: transparent;
    color: var(--color-text-tertiary);
    border: 1px solid transparent;
  }
  .btn-ghost:hover {
    background: var(--color-bg-overlay);
    color: var(--color-text-secondary);
  }

  .btn-sm { padding: 6px 13px; font-size: 12px; }
  .btn-lg { padding: 13px 26px; font-size: 15px; }

  /* ── Status pills ── */
  .pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .pill::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
  }

  .pill-draft {
    background: oklch(0.28 0.01 270 / 0.6);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-subtle);
  }
  .pill-approved {
    background: var(--color-success-subtle);
    color: var(--color-success);
    border: 1px solid oklch(0.72 0.18 155 / 0.25);
    box-shadow: 0 0 8px oklch(0.72 0.18 155 / 0.15);
    animation: pillPulse 2.5s ease-in-out infinite;
  }
  .pill-rejected {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
    border: 1px solid oklch(0.65 0.22 25 / 0.25);
  }
  .pill-scheduled {
    background: oklch(0.30 0.12 270 / 0.5);
    color: oklch(0.78 0.14 270);
    border: 1px solid oklch(0.70 0.14 270 / 0.25);
    box-shadow: 0 0 8px oklch(0.70 0.14 270 / 0.12);
  }
  .pill-posted {
    background: var(--color-info-subtle);
    color: var(--color-info);
    border: 1px solid oklch(0.72 0.14 240 / 0.25);
    box-shadow: 0 0 8px oklch(0.72 0.14 240 / 0.12);
  }
  .pill-app {
    background: var(--color-purple-subtle);
    color: var(--color-purple);
    border: 1px solid oklch(0.70 0.18 295 / 0.25);
  }
  .pill-binder {
    background: var(--color-gold-bg);
    color: var(--color-gold);
    border: 1px solid oklch(0.79 0.14 85 / 0.25);
  }

  /* ── Filters bar ── */
  .filters-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
  }

  .filter-btn {
    padding: 6px 15px;
    border-radius: var(--radius-full);
    font-size: 12.5px;
    font-weight: 600;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .filter-btn:hover {
    border-color: var(--color-border-default);
    color: var(--color-text-primary);
    background: var(--color-bg-overlay);
  }
  .filter-btn.active {
    background: var(--color-gold-bg);
    color: var(--color-gold);
    border-color: oklch(0.79 0.14 85 / 0.35);
    box-shadow: 0 0 12px var(--color-gold-glow);
  }

  /* ── Stats bar ── */
  .stats-bar {
    display: flex;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
    font-size: 12px;
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
  }
  .stats-bar b {
    color: var(--color-text-primary);
    font-weight: 700;
  }

  /* ── Queue header ── */
  .queue-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  /* ── Post grid ── */
  .queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-5);
  }

  /* ── Post card ── */
  .post-card {
    background: var(--color-bg-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-subtle);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--duration-base), box-shadow var(--duration-base), transform var(--duration-base) var(--ease-out);
    animation: cardEnter var(--duration-slow) var(--ease-out) both;
  }
  .post-card:hover {
    border-color: var(--color-gold);
    box-shadow: var(--shadow-md), 0 0 24px var(--color-gold-glow);
    transform: translateY(-3px);
  }

  .post-card:nth-child(1)  { animation-delay: 0ms; }
  .post-card:nth-child(2)  { animation-delay: 40ms; }
  .post-card:nth-child(3)  { animation-delay: 80ms; }
  .post-card:nth-child(4)  { animation-delay: 120ms; }
  .post-card:nth-child(5)  { animation-delay: 160ms; }
  .post-card:nth-child(6)  { animation-delay: 200ms; }
  .post-card:nth-child(7)  { animation-delay: 240ms; }
  .post-card:nth-child(8)  { animation-delay: 280ms; }
  .post-card:nth-child(9)  { animation-delay: 320ms; }
  .post-card:nth-child(10) { animation-delay: 360ms; }

  .post-card-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 200px;
    overflow: hidden;
    background: var(--color-bg-inset);
    position: relative;
  }
  .post-card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-slow) var(--ease-out);
  }
  .post-card:hover .post-card-thumb img { transform: scale(1.04); }

  .post-card-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, oklch(0.09 0.018 270 / 0.8) 0%, transparent 60%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: var(--space-3);
    opacity: 0;
    transition: opacity var(--duration-base) var(--ease-out);
  }
  .post-card:hover .post-card-thumb-overlay { opacity: 1; }
  .thumb-overlay-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-gold);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px oklch(0 0 0 / 0.6);
  }

  .post-card-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: 12px;
    font-family: var(--font-mono);
  }

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

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

  .post-card-pillar {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .post-card-hook {
    font-size: 12.5px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .post-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
  }

  /* ── Phone frame (carousel wrapper) ── */
  .phone-frame {
    background: oklch(0.08 0.015 270);
    border-radius: 28px;
    border: 2px solid var(--color-border-default);
    padding: 12px 8px 8px;
    box-shadow:
      var(--shadow-lg),
      inset 0 1px 0 oklch(1 0 0 / 0.06),
      0 0 0 6px oklch(0.12 0.018 270);
    max-width: 280px;
    margin: 0 auto;
  }

  .phone-notch {
    width: 60px;
    height: 8px;
    background: oklch(0.13 0.018 270);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-2);
  }

  .phone-home-bar {
    width: 48px;
    height: 4px;
    background: var(--color-border-default);
    border-radius: var(--radius-full);
    margin: var(--space-2) auto 0;
  }

  /* ── Slide carousel ── */
  .slide-carousel {
    position: relative;
  }

  .slide-carousel-track {
    position: relative;
    aspect-ratio: 9/16;
    background: var(--color-bg-inset);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }
  .slide-carousel-track img {
    width: 100%; height: 100%;
    object-fit: contain;
  }

  .carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
  }

  .carousel-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-secondary);
    padding: 0;
    transition: all var(--duration-fast);
  }
  .carousel-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
    box-shadow: 0 0 10px var(--color-gold-glow);
  }

  .carousel-dots { display: flex; gap: 6px; align-items: center; }

  .carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-border-default);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
  }
  .carousel-dot:hover {
    background: var(--color-border-strong);
    transform: scale(1.2);
  }
  .carousel-dot.active {
    width: 24px;
    background: var(--color-gold);
    box-shadow: 0 0 6px var(--color-gold-glow);
  }

  .carousel-counter {
    font-size: 12px;
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
    font-weight: 500;
    min-width: 44px;
    text-align: center;
  }

  /* ── Slide editor ── */
  .slide-editor {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .slide-field { display: flex; flex-direction: column; gap: 5px; }
  .slide-field label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
  }
  .slide-field:focus-within label { color: var(--color-gold); }
  .slide-field textarea { resize: vertical; min-height: 80px; }

  .field-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--space-4); }
  .field-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
  }
  .field-group:focus-within label { color: var(--color-gold); }

  /* ── Action bar ── */
  .action-bar {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    flex-wrap: wrap;
    padding: var(--space-5);
    background: var(--color-bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-subtle);
  }

  .reject-panel {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-3);
  }
  .reject-panel.visible { display: flex; }

  /* ── Rerender notice ── */
  .rerender-notice {
    display: none;
    padding: 12px 16px;
    background: oklch(0.78 0.15 68 / 0.14);
    border: 1px solid oklch(0.78 0.15 68 / 0.45);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-warning);
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-3);
    box-shadow: 0 0 16px oklch(0.78 0.15 68 / 0.18);
  }
  .rerender-notice.visible {
    display: flex;
    animation: rerenderPulse 3s ease-in-out infinite;
  }

  /* ── Warning button variant ── */
  .btn-warning {
    background: var(--color-warning);
    color: var(--color-text-inverse);
    box-shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 0 12px oklch(0.78 0.15 68 / 0.25);
  }
  .btn-warning:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px oklch(0 0 0 / 0.3), 0 0 20px oklch(0.78 0.15 68 / 0.4);
  }

  /* ── Section title ── */
  .section-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* ── Admin nav ── */
  .admin-nav-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    padding: var(--space-2) var(--space-6);
    margin-top: var(--space-4);
    margin-bottom: var(--space-1);
  }

  .admin-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-right: var(--space-3);
    transition: all var(--duration-base) var(--ease-out);
  }
  .admin-nav-item:hover {
    background: var(--color-bg-overlay);
    color: var(--color-text-primary);
    border-left-color: var(--color-border-default);
  }
  .admin-nav-item.active {
    background: var(--color-gold-bg);
    color: var(--color-gold);
    border-left-color: var(--color-gold);
    font-weight: 600;
  }

  .nav-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    opacity: 0.8;
    flex-shrink: 0;
  }

  /* ── Table ── */
  .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .data-table th {
    text-align: left;
    padding: 10px 16px;
    background: var(--color-bg-inset);
    color: var(--color-text-tertiary);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--color-border-subtle);
  }
  .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-subtle);
    vertical-align: middle;
    color: var(--color-text-primary);
  }
  .data-table tr:last-child td { border-bottom: none; }
  .data-table tr:hover td { background: var(--color-bg-overlay); }
  .data-table .mono {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--color-text-secondary);
  }

  /* ── JSON editor ── */
  .json-editor {
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    min-height: 280px;
    background: var(--color-bg-inset);
    color: oklch(0.88 0.05 270);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    resize: vertical;
    caret-color: var(--color-gold);
  }
  .json-editor:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px var(--color-gold-bg), inset 0 0 30px oklch(0.79 0.14 85 / 0.02);
  }

  /* ── Terminal ── */
  .terminal-header {
    background: oklch(0.08 0.018 270);
    border: 1px solid var(--color-border-subtle);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .terminal-dot-red    { background: oklch(0.65 0.22 25); }
  .terminal-dot-yellow { background: oklch(0.78 0.15 68); }
  .terminal-dot-green  { background: oklch(0.72 0.18 155); }

  .terminal-title {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-left: var(--space-2);
  }

  .terminal {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    background: var(--color-bg-inset);
    border: 1px solid var(--color-border-subtle);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: var(--space-4);
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-default) transparent;
  }

  /* ── Progress track ── */
  .progress-track {
    background: var(--color-bg-inset);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
    margin-bottom: var(--space-4);
  }

  #batch-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--color-gold), oklch(0.85 0.12 75));
    transition: width 0.4s var(--ease-out);
    width: 0%;
    position: relative;
    overflow: hidden;
  }
  #batch-progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.2), transparent);
    animation: progressShimmer 1.5s linear infinite;
  }

  /* ── Drop zone ── */
  .drop-zone {
    border: 1.5px dashed var(--color-border-default);
    border-radius: var(--radius-md);
    padding: var(--space-10) var(--space-8);
    text-align: center;
    cursor: pointer;
    background: var(--color-bg-inset);
    transition: all var(--duration-base) var(--ease-out);
    margin-bottom: var(--space-3);
  }
  .drop-zone:hover {
    border-color: var(--color-gold);
    background: var(--color-gold-bg);
    box-shadow: inset 0 0 0 1px var(--color-gold-bg), 0 0 20px var(--color-gold-glow);
  }
  .drop-zone-icon {
    font-size: 32px;
    margin-bottom: var(--space-3);
    opacity: 0.5;
    transition: opacity var(--duration-base);
  }
  .drop-zone:hover .drop-zone-icon { opacity: 0.9; }

  /* ── Status grid ── */
  .status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
  }
  .status-card { padding: var(--space-5); }

  .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: 13px;
  }
  .stat-row:last-child { border-bottom: none; }
  .stat-label { color: var(--color-text-tertiary); font-size: 12px; }
  .stat-value { font-weight: 600; color: var(--color-text-primary); font-family: var(--font-mono); }

  /* ── Toast ── */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .toast {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    box-shadow: var(--shadow-lg);
    animation: toastIn var(--duration-slow) var(--ease-out) forwards;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-left-width: 3px;
  }
  .toast-success { border-left-color: var(--color-success); }
  .toast-error   { border-left-color: var(--color-danger); }

  /* ── Guide panel ── */
  .guide-panel {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    overflow: hidden;
  }
  .guide-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: color var(--duration-fast);
  }
  .guide-toggle:hover { color: var(--color-gold); }
  .guide-toggle:active { transform: none; }
  .guide-toggle-icon {
    transition: transform var(--duration-base) var(--ease-out);
    font-size: 12px;
  }
  .guide-panel.open .guide-toggle-icon { transform: rotate(180deg); }
  .guide-body {
    display: none;
    padding: 0 var(--space-5) var(--space-5);
  }
  .guide-panel.open .guide-body { display: block; }
  .guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
  }
  .guide-step {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
  }
  .guide-step-num {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--color-gold-bg);
    color: var(--color-gold);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid oklch(0.79 0.14 85 / 0.25);
  }
  .guide-step-text {
    font-size: 12.5px;
    color: var(--color-text-secondary);
    line-height: 1.5;
  }
  .guide-step-text strong {
    color: var(--color-text-primary);
    font-weight: 600;
  }

  /* ── Rejection note display ── */
  .rejection-note-display {
    padding: var(--space-3) var(--space-4);
    background: var(--color-danger-subtle);
    border: 1px solid oklch(0.65 0.22 25 / 0.25);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-danger);
    margin-top: var(--space-3);
  }
  .rejection-note-display .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    opacity: 0.8;
  }

  /* ── Loading ── */
  .loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    color: var(--color-text-tertiary);
    font-size: 14px;
    gap: var(--space-3);
  }

  .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-default);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
  }

  /* ── Empty state ── */
  .empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-10);
    color: var(--color-text-tertiary);
  }
  .empty-state .icon {
    font-size: 40px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
  }
  .empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
  }
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */
@layer utilities {
  .mono { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-secondary); }
  .text-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-tertiary);
  }
  .text-heading {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
  }
  .text-display {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
@layer animations {
  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  @keyframes toastIn {
    from { transform: translateX(calc(100% + 24px)); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  @keyframes pillPulse {
    0%, 100% { box-shadow: 0 0 6px oklch(0.72 0.18 155 / 0.25); }
    50%       { box-shadow: 0 0 14px oklch(0.72 0.18 155 / 0.50); }
  }

  @keyframes progressShimmer {
    from { transform: translateX(-200%); }
    to   { transform: translateX(200%); }
  }

  @keyframes headerShimmer {
    from { background-position: 0% 50%; }
    to   { background-position: 100% 50%; }
  }

  @keyframes cardEnter {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes rerenderPulse {
    0%, 100% { box-shadow: 0 0 8px oklch(0.78 0.15 68 / 0.18); }
    50%       { box-shadow: 0 0 24px oklch(0.78 0.15 68 / 0.45); }
  }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header { padding: 0 var(--space-4); }
  .header-nav { margin-left: var(--space-2); }
  .header-nav-link { padding: 5px 10px; font-size: 12px; }
  .brand-sub { display: none; }
  .page-container { padding: var(--space-5) var(--space-4); }
}

@media (max-width: 900px) {
  .post-detail-layout {
    grid-template-columns: 1fr;
  }
  .post-detail-sidebar {
    position: static;
  }
  .phone-frame {
    max-width: 220px;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin-nav {
    position: static;
    height: auto;
    width: 100%;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border-subtle);
    padding: var(--space-2) 0;
    scrollbar-width: none;
    gap: 0;
  }
  .admin-nav-group-label { display: none; }
  .admin-nav-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 0;
    padding: var(--space-3) var(--space-4);
  }
  .admin-nav-item:hover,
  .admin-nav-item.active {
    border-bottom-color: var(--color-gold);
    border-left-color: transparent;
    background: transparent;
  }
  .nav-label { font-size: 12px; }
  .admin-content { padding: var(--space-5); }
  .queue-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .filters-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
  }
}
