/* ── Design tokens — beige & blue monochromatic palette ── */
    :root {
      /* Beige core */
      --beige-50: #fefaf5;
      --beige-100: #fdf3e8;
      --beige-200: #f9e6d3;
      --beige-300: #f4d9be;
      --beige-400: #edc8a3;
      --beige-500: #e2b17d;
      --beige-600: #ca8f5a;
      --beige-700: #a36e3f;
      /* Blue monochromatic anchor */
      --blue-50: #eef4ff;
      --blue-100: #d9e6ff;
      --blue-200: #bcd1ff;
      --blue-300: #8eb2ff;
      --blue-400: #5c8eff;
      --blue-500: #3b6eff;
      --blue-600: #2554e0;
      --blue-700: #1c41b3;
      --blue-800: #1a348c;
      
      /* Surfaces & text */
      --bg:    var(--beige-50);
      --bg2:   #fffaf5;
      --bg3:   #ffffff;
      --bg4:   var(--beige-100);
      --line:  rgba(148, 163, 184, 0.12);
      --line2: rgba(148, 163, 184, 0.18);
      --line3: rgba(59, 110, 255, 0.22);
      --hi:    var(--blue-500);
      --hi2:   var(--blue-600);
      --hig:   rgba(59, 110, 255, 0.08);
      --txt:   #2c241a;
      --mu:    #6b5a48;
      --mu2:   #9b8977;
      --ok:    var(--blue-500);
      --err:   #c75c5c;
      --warn:  #e2b17d;
      --r:     12px;
      --r2:    8px;
      --mono:  'DM Mono', monospace;
      --head:  'Syne', sans-serif;
      --body:  'Instrument Sans', sans-serif;
      --nav-h: 52px;
    }

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

    html { scroll-behavior: smooth; }

    body {
      background: var(--bg);
      color: var(--txt);
      font-family: var(--body);
      font-size: 14px;
      line-height: 1.6;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    /* ── Scrollbar (beige/blue) ── */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: var(--beige-100); }
    ::-webkit-scrollbar-thumb { background: rgba(107, 90, 72, 0.35); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(107, 90, 72, 0.55); }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       NAV (beige & blue)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .nav {
      position: sticky; top: 0; z-index: 200;
      height: var(--nav-h);
      background: rgba(255, 250, 245, 0.96);
      border-bottom: 1px solid var(--line);
      display: flex; align-items: center;
      padding: 0 20px; gap: 4px;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .nav-brand {
      font-family: var(--head); font-size: .95rem; font-weight: 800;
      color: var(--hi); letter-spacing: -.03em; text-decoration: none;
      margin-right: 8px; white-space: nowrap;
    }
    .nav-brand span { color: var(--txt); }

    .nav-sep { width: 1px; height: 20px; background: var(--line2); margin: 0 4px; flex-shrink: 0; }

    .nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }

    .nav-link {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 5px 11px; border-radius: var(--r2);
      font-size: .78rem; font-weight: 500; color: var(--mu);
      text-decoration: none; transition: all .12s; white-space: nowrap;
      border: 1px solid transparent;
    }
    .nav-link:hover  { color: var(--txt); background: var(--beige-100); }
    .nav-link.active { color: var(--hi2); background: var(--hig); border-color: var(--line3); }
    .nav-link i { font-size: .72rem; }

    .nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

    .nav-user {
      display: flex; align-items: center; gap: 8px;
      font-size: .76rem; color: var(--mu);
    }
    .nav-avatar {
      width: 28px; height: 28px; border-radius: 50%;
      background: linear-gradient(135deg, var(--beige-100), var(--blue-50));
      border: 1px solid var(--line3);
      display: grid; place-items: center;
      font-size: .7rem; font-weight: 700; color: var(--hi2);
      font-family: var(--head);
    }

    .nav-btn {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 5px 12px; border-radius: var(--r2); font-size: .76rem;
      font-weight: 600; cursor: pointer; text-decoration: none;
      border: none; font-family: var(--body); transition: all .12s;
      white-space: nowrap;
    }
    .nav-btn-hi    { background: linear-gradient(135deg, var(--hi), var(--hi2)); color: #fff; box-shadow: 0 8px 18px rgba(59,110,255,.18); }
    .nav-btn-hi:hover  { filter: brightness(1.04); transform: translateY(-1px); }
    .nav-btn-ghost { background: rgba(255,255,255,.7); color: var(--mu); border: 1px solid var(--line2); }
    .nav-btn-ghost:hover { background: var(--bg3); color: var(--txt); }

    /* Mobile hamburger */
    .nav-ham {
      display: none; background: transparent; border: none;
      color: var(--mu); font-size: 1rem; cursor: pointer; padding: 4px;
    }
    @media (max-width: 768px) {
      .nav-ham { display: block; }
      .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
                   background: rgba(255,250,245,.98); border-bottom: 1px solid var(--line);
                   flex-direction: column; align-items: stretch; padding: 8px 12px 12px;
                   gap: 2px; }
      .nav-links.open { display: flex; }
      .nav-link { padding: 8px 12px; }
    }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       MAIN CONTENT WRAPPER
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .main-wrap {
      flex: 1;
      width: 100%;
    }

    /* Standard padded container for regular pages */
    .page-container {
      max-width: 1280px;
      margin: 0 auto;
      padding: 28px 20px 48px;
    }

    /* Full-width (no padding) for pages like the editor that manage their own layout */
    .page-full {
      height: calc(100vh - var(--nav-h));
      overflow: hidden;
    }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       FOOTER (beige/blue)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .footer {
      border-top: 1px solid var(--line);
      padding: 16px 20px;
      display: flex; align-items: center; justify-content: space-between;
      gap: 12px; flex-wrap: wrap;
      background: rgba(255,250,245,0.8);
    }
    .footer-brand {
      font-family: var(--head); font-size: .8rem; font-weight: 700;
      color: var(--mu);
    }
    .footer-copy {
      font-size: .7rem; color: var(--mu); font-family: var(--mono);
    }
    .footer-links { display: flex; gap: 14px; }
    .footer-links a {
      font-size: .7rem; color: var(--mu); text-decoration: none;
      transition: color .1s;
    }
    .footer-links a:hover { color: var(--hi2); }

    /* Hide footer on full-layout pages (editor) */
    .page-full ~ .footer { display: none; }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       SHARED COMPONENTS (beige/blue themed)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

    /* Card */
    .card {
      background: var(--bg2); border: 1px solid var(--line);
      box-shadow: 0 14px 30px rgba(44, 36, 26, 0.04);
      border-radius: var(--r); padding: 20px;
    }
    .card-sm { padding: 14px; }

    /* Page header row */
    .page-hdr {
      display: flex; align-items: center; gap: 12px;
      margin-bottom: 24px; padding-bottom: 16px;
      border-bottom: 1px solid var(--line);
    }
    .page-hdr h1 {
      font-family: var(--head); font-size: 1.35rem; font-weight: 800;
      letter-spacing: -.03em; flex: 1;
      background: linear-gradient(135deg, var(--txt) 20%, var(--blue-800) 80%);
      background-clip: text;
      -webkit-background-clip: text;
      color: transparent;
    }
    .page-hdr p { font-size: .78rem; color: var(--mu); margin-top: 2px; }

    /* Buttons */
    .btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 8px 16px; border-radius: var(--r2); border: none;
      cursor: pointer; font-family: var(--body); font-size: .8rem;
      font-weight: 600; transition: all .15s; text-decoration: none;
      white-space: nowrap;
    }
    .btn-hi    { background: linear-gradient(135deg, var(--hi), var(--hi2)); color: #fff; box-shadow: 0 8px 16px rgba(59,110,255,.16); }
    .btn-hi:hover { filter: brightness(1.04); transform: translateY(-1px); }
    .btn-ghost { background: rgba(255,255,255,.82); color: var(--mu); border: 1px solid var(--line2); }
    .btn-ghost:hover { background: var(--bg3); color: var(--txt); }
    .btn-ok    { background: var(--hig); color: var(--hi2); border: 1px solid var(--line3); }
    .btn-ok:hover { background: rgba(59,110,255,.12); }
    .btn-err   { background: rgba(199,92,92,.08); color: var(--err); border: 1px solid rgba(199,92,92,.18); }
    .btn-err:hover { background: rgba(199,92,92,.14); }
    .btn-edit  { background: var(--hig); color: var(--hi2); border: 1px solid var(--line3); }
    .btn-edit:hover { background: rgba(59,110,255,.12); }
    .btn-sm { padding: 5px 10px; font-size: .72rem; }
    .btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

    /* Form fields */
    .field { margin-bottom: 14px; }
    .field label {
      display: block; font-size: .72rem; color: var(--mu);
      margin-bottom: 5px; font-weight: 500;
    }
    .fi {
      width: 100%; background: var(--bg3); border: 1px solid var(--line2);
      border-radius: var(--r2); padding: 8px 12px; font-family: var(--body);
      font-size: .82rem; color: var(--txt); outline: none;
      transition: border-color .15s;
    }
    .fi:focus { border-color: var(--hi); box-shadow: 0 0 0 3px rgba(59,110,255,.10); }
    select.fi { cursor: pointer; }
    textarea.fi { height: 80px; resize: vertical; line-height: 1.5; }

    /* Badge */
    .badge {
      font-size: .62rem; font-family: var(--mono); font-weight: 600;
      padding: 2px 8px; border-radius: 20px;
      background: var(--hig); color: var(--hi2); border: 1px solid var(--line3);
    }
    .badge-ok   { background: rgba(59,110,255,.10); color: var(--hi2);  border-color: var(--line3); }
    .badge-warn { background: rgba(226,177,125,.1); color: var(--warn); border-color: rgba(226,177,125,.2); }

    /* Toast */
    #toastArea {
      position: fixed; bottom: 20px; right: 20px; z-index: 9999;
      display: flex; flex-direction: column; gap: 6px; pointer-events: none;
    }
    .toast {
      padding: 9px 16px; border-radius: 40px; font-size: .76rem; font-weight: 600;
      pointer-events: auto; transform: translateY(10px); opacity: 0;
      transition: all .25s cubic-bezier(.34,1.56,.64,1);
      box-shadow: 0 12px 24px rgba(44,36,26,.1);
    }
    .toast.show { transform: translateY(0); opacity: 1; }
    .t-ok   { background: #fefaf5; color: var(--hi2);  border: 1px solid var(--line3); }
    .t-err  { background: #fff5f5; color: var(--err); border: 1px solid rgba(199,92,92,.16); }
    .t-info { background: #fefaf5; color: var(--hi2); border: 1px solid var(--line3); }

    /* Alert banners */
    .alert {
      padding: 12px 16px; border-radius: var(--r); font-size: .8rem;
      display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
    }
    .alert-ok  { background: var(--hig); color: var(--hi2);  border: 1px solid var(--line3); }
    .alert-err { background: #fff5f5; color: var(--err); border: 1px solid rgba(199,92,92,.16); }
    .alert-info{ background: var(--hig); color: var(--hi2); border: 1px solid var(--line3); }

    /* Spinner */
    .spinner {
      width: 15px; height: 15px; border: 2px solid rgba(107,90,72,.2);
      border-top-color: currentColor; border-radius: 50%;
      animation: spin .6s linear infinite; flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* Separator */
    .sep-h { height: 1px; background: var(--line); margin: 16px 0; }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       POSTER GRID  (list.html)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .poster-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 16px;
    }
    .poster-card {
      background: var(--bg2); border: 1px solid var(--line2);
      border-radius: var(--r); overflow: hidden;
      transition: border-color .15s, transform .15s, box-shadow .15s;
    }
    .poster-card:hover {
      border-color: var(--line3); transform: translateY(-2px);
      box-shadow: 0 18px 30px rgba(44,36,26,.06);
    }
    .poster-thumb {
      position: relative; padding-top: 56.25%; /* 16:9 default */
      overflow: hidden; background: var(--bg3);
    }
    .poster-thumb iframe, .poster-thumb img {
      position: absolute; inset: 0; width: 100%; height: 100%;
      border: none; object-fit: cover; pointer-events: none;
    }
    .poster-thumb .fav-btn {
      position: absolute; top: 8px; right: 8px; z-index: 2;
      width: 30px; height: 30px; border-radius: 50%;
      background: rgba(255,255,255,.9); border: 1px solid var(--line2);
      display: grid; place-items: center; cursor: pointer;
      font-size: .78rem; transition: all .12s; backdrop-filter: blur(4px);
    }
    .poster-thumb .fav-btn:hover { background: var(--bg2); }
    .poster-thumb .fav-btn.active { color: var(--hi2); border-color: var(--line3); }
    .poster-body { padding: 14px; }
    .poster-title {
      font-size: .8rem; font-weight: 600; color: var(--txt);
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      margin-bottom: 6px;
    }
    .poster-meta {
      display: flex; align-items: center; gap: 10px;
      font-size: .68rem; color: var(--mu); font-family: var(--mono);
      margin-bottom: 10px;
    }
    .poster-meta i { margin-right: 3px; }
    .poster-actions { display: flex; gap: 6px; }
    .poster-actions .btn { flex: 1; justify-content: center; }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       EMPTY STATE
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .empty-state {
      text-align: center; padding: 64px 20px;
      color: var(--mu);
    }
    .empty-state .es-icon { font-size: 2.5rem; margin-bottom: 14px; opacity: .35; }
    .empty-state h3 { font-family: var(--head); font-size: 1.1rem; font-weight: 700; color: var(--txt); margin-bottom: 8px; }
    .empty-state p  { font-size: .82rem; margin-bottom: 20px; }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       PAGINATION
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .pagination {
      display: flex; align-items: center; justify-content: space-between;
      flex-wrap: wrap; gap: 12px; margin-top: 24px;
      font-size: .76rem;
    }
    .pg-info { color: var(--mu); font-family: var(--mono); }
    .pg-btns { display: flex; gap: 3px; }
    .pg-btn {
      min-width: 32px; height: 32px; padding: 0 8px;
      display: inline-flex; align-items: center; justify-content: center;
      border-radius: var(--r2); border: 1px solid var(--line2);
      background: var(--bg3); color: var(--mu); font-size: .74rem;
      text-decoration: none; transition: all .1s; font-weight: 500;
    }
    .pg-btn:hover { background: var(--beige-100); color: var(--txt); }
    .pg-btn.on { background: linear-gradient(135deg, var(--hi), var(--hi2)); color: #fff; border-color: var(--hi); }
    .pg-btn:disabled, .pg-btn.disabled {
      opacity: .3; cursor: not-allowed; pointer-events: none;
    }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       FILTER BAR
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .filter-bar {
      display: flex; align-items: center; gap: 8px;
      flex-wrap: wrap; margin-bottom: 20px;
    }
    .filter-bar .fi { width: auto; }
    .filter-bar .fi-search { flex: 1; min-width: 180px; }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       LANDING PAGE  (index.html) - beige/blue themed
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    .hero {
      min-height: calc(100vh - var(--nav-h));
      display: flex; align-items: center; justify-content: center;
      text-align: center; padding: 60px 20px;
      background:
        radial-gradient(ellipse 70% 60% at 50% 0%, rgba(59,110,255,.08), transparent),
        linear-gradient(180deg, #fffaf5 0%, #fefaf5 100%);
    }
    .hero h1 {
      font-family: var(--head); font-size: clamp(2rem, 6vw, 4rem);
      font-weight: 800; letter-spacing: -.04em; line-height: 1.1;
      margin-bottom: 16px;
      background: linear-gradient(135deg, var(--txt) 20%, var(--blue-700) 80%);
      background-clip: text;
      -webkit-background-clip: text;
      color: transparent;
    }
    .hero h1 em { font-style: normal; color: var(--hi2); }
    .hero p { font-size: 1rem; color: var(--mu); max-width: 480px; margin: 0 auto 28px; line-height: 1.7; }
    .hero-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
    .features { padding: 60px 20px; max-width: 1000px; margin: 0 auto; }
    .features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 32px; }
    .feat-card {
      background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--r);
      padding: 20px; transition: border-color .15s;
    }
    .feat-card:hover { border-color: var(--line3); }
    .feat-icon {
      width: 38px; height: 38px; border-radius: 10px;
      background: var(--hig); border: 1px solid var(--line3);
      display: grid; place-items: center; font-size: .9rem;
      color: var(--hi2); margin-bottom: 12px;
    }
    .feat-card h3 { font-family: var(--head); font-size: .88rem; font-weight: 700; margin-bottom: 6px; }
    .feat-card p  { font-size: .76rem; color: var(--mu); line-height: 1.6; }

    /* Steps */
    .steps { display: flex; gap: 0; max-width: 700px; margin: 32px auto 0; position: relative; }
    .steps::before {
      content: ''; position: absolute; top: 24px; left: 60px; right: 60px;
      height: 1px; background: var(--line2);
    }
    .step { flex: 1; text-align: center; padding: 0 16px; }
    .step-num {
      width: 48px; height: 48px; border-radius: 50%;
      background: var(--hig); border: 2px solid var(--line3);
      display: grid; place-items: center; margin: 0 auto 12px;
      font-family: var(--head); font-size: 1.1rem; font-weight: 800; color: var(--hi2);
      position: relative; z-index: 1;
    }
    .step h3 { font-size: .82rem; font-weight: 700; margin-bottom: 4px; }
    .step p   { font-size: .74rem; color: var(--mu); }
    @media (max-width: 600px) {
      .steps { flex-direction: column; gap: 20px; }
      .steps::before { display: none; }
    }

    /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
       EDITOR: overrides to remove padding so the
       editor shell fills the viewport
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
    body.editor-page .main-wrap { display: contents; }
    body.editor-page .footer    { display: none; }

    /* Queue badge styling (beige/blue) */
    .queue-badge {
      background: linear-gradient(135deg, var(--hi), var(--hi2));
      color: white;
      font-size: 0.65rem;
      font-weight: bold;
      padding: 2px 6px;
      border-radius: 12px;
      margin-left: 6px;
      display: inline-block;
      line-height: 1;
      vertical-align: middle;
    }

    .nav-link {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    /* Optional: Add animation when count changes */
    @keyframes badgePulse {
      0% { transform: scale(1); }
      50% { transform: scale(1.1); }
      100% { transform: scale(1); }
    }

    .queue-badge.updated {
      animation: badgePulse 0.3s ease;
    }

    /* Instagram status styling (beige/blue) */
    .instagram-status {
      display: flex;
      align-items: center;
      margin-right: 12px;
    }

    .connected-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--hig);
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 0.75rem;
      color: var(--hi2);
      border: 1px solid var(--line3);
    }

    .connected-badge i {
      font-size: 0.9rem;
    }

    /* Make the connect button more noticeable */
    #connectInstagramBtn {
      background: linear-gradient(135deg, var(--hi), var(--hi2));
      color: white;
      border: none;
      padding: 6px 14px;
      border-radius: 20px;
      font-weight: 500;
    }

    #connectInstagramBtn:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 20px rgba(59,110,255,.2);
    }

    #connectInstagramBtn i {
      margin-right: 4px;
    }

    /* Responsive adjustments */
    @media (max-width: 768px) {
      .instagram-status {
        margin-right: 8px;
      }
      
      #connectInstagramBtn span {
        display: none;
      }
      
      #connectInstagramBtn {
        padding: 6px 10px;
      }
      
      .connected-badge span {
        display: none;
      }
      
      .connected-badge {
        padding: 6px 10px;
      }
    }