/* ═══════════════════════════════════════
   BLOGENT — Global Design System (unified)

   Accent (#A177F0 orange) used ONLY for:
   - Primary CTA buttons (Generate, Submit)
   - Active indicator bars (sidebar)
   - Important badges (score, status)
   - Links / icons on hover

   Everything else: grays, glass, subtle borders.
   Single source of truth — synced with landing.html
═══════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* ════════════════════════════════════════════════════════════
     ACCENT — single orange (no blue, no pink). Structured like the
     Magnific accent system: base / light / subtle / glow / pressed.
     ──────────────────────────────────────────────────────────── */
  --accent:         #A177F0;                 /* solid mid (violet) — active, icons, links */
  --accent-hover:   #B89BF5;
  --accent-dim:     rgba(161,119,240,.12);   /* subtle highlight fill */
  --accent-glow:    rgba(161,119,240,.30);
  --accent-pressed: #7C5AD6;
  --accent-text:    #160E22;                 /* DARK text/icon on the light-violet fill (unified) */
  --accent-grad:      linear-gradient(135deg,#FF7EB3 0%,#A177F0 100%);   /* pink → violet */
  --accent-grad-soft: linear-gradient(135deg,rgba(255,126,179,.16),rgba(161,119,240,.16));
  /* legacy aliases — keep, all point to the one accent */
  --ac: #A177F0;
  --accent-primary: #A177F0;

  /* ════════════════════════════════════════════════════════════
     ELEVATION — neutral grayscale ramp (Magnific-style: opacity
     layers over true black, no hue tint). Single source of truth.
     Re-tint the whole app by editing --bg + the 4 surface steps.
     ──────────────────────────────────────────────────────────── */
  --bg:            #0A0A0C;            /* L0 — app / main work area, body (near-black) */
  --bg-deep:       #060608;            /* below L0 — deepest fills, modal scrim base */
  --surface:       #141416;            /* L1 — panels, sidebar, result containers */
  --surface-2:     #191A1D;            /* L2 — cards, inputs, chips */
  --surface-3:     #202124;            /* L3 — hover */
  --surface-4:     #2A2B2F;            /* L4 — active / pressed / elevated */
  --surface-active:rgba(255,255,255,.15); /* selected-item highlight overlay */

  /* Semantic aliases — components should prefer these so intent stays clear */
  --panel-bg:      var(--surface);     /* any panel / column / result container */
  --card-bg:       var(--surface-2);   /* cards, inputs, chips */
  --hover-bg:      var(--surface-3);   /* hover state on cards/buttons/items */
  --active-bg:     var(--surface-4);   /* active / pressed */

  /* Borders — semi-transparent white, three weights (Magnific .10 / .15 / .20) */
  --border:        rgba(255,255,255,.055);
  --border-2:      rgba(255,255,255,.09);
  --border-3:      rgba(255,255,255,.13);

  /* Translucent surface for sticky topbars — matches --surface (#161616) @ 85% */
  --topbar-bg:     rgba(22,22,22,.85);
  --topbar-bg-soft:rgba(22,22,22,.55);

  /* Text — Magnific neutral ladder */
  --text:          #F5F5F6;            /* primary body text */
  --text-strong:   #FFFFFF;            /* headings, active items */
  --text-2:        #BABABF;            /* secondary text, icons */
  --text-3:        #7B7B82;            /* placeholder / muted */

  /* Radius — squircle scale (apple corner-smoothing via --corner) */
  --r: 14px; --r-sm: 12px; --r-md: 18px; --r-lg: 22px; --r-full: 9999px;
  --corner: superellipse(2.4);        /* apple corner-smoothing; degrades to radius */

  /* Text-on-dark opacity ladder — synced with landing */
  --fonts-100:#FFFFFF;
  --fonts-64:rgba(255,255,255,.64);
  --fonts-50:rgba(255,255,255,.50);
  --fonts-30:rgba(255,255,255,.30);
  --fonts-20:rgba(255,255,255,.20);

  /* Shadows */
  --shadow: 0 8px 40px rgba(0,0,0,.6);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.6);
  --shadow-accent: 0 4px 24px rgba(161,119,240,.28);
  --shadow-raised: inset 0 1px 0 rgba(255,255,255,.05), 0 12px 36px -10px rgba(0,0,0,.55);
  --elevated: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0)), var(--surface-2);

  /* Glass */
  --glass: rgba(255,255,255,.03);
  --glass-bg: rgba(20,20,23,.62);
  --glass-border: rgba(255,255,255,.08);
  --glass-blur: blur(14px);
  --glass-hi: rgba(255,255,255,.04);

  /* Easing */
  --ease: cubic-bezier(.16,1,.3,1);

  /* Status colors — functional only (success/warning/danger). No blue/pink. */
  --success: #00CC88;
  --warning: #FFD60A;
  --danger: #FF453A;
  --blue: var(--accent);   /* legacy alias → orange (no blue in the palette) */

  /* Extended radius */
  --r-xl: 28px; --r-2xl: 34px;

  /* Layout */
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
  --shell-gap: 10px;
  --shell-radius: 18px;

  /* ════════════════════════════════════════════════════════════
     SPACING scale — 4px base grid. Use for gaps/padding/margins so
     rhythm stays consistent (was ad-hoc 6/8/10/12/14/16/20/24px).
     ──────────────────────────────────────────────────────────── */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  /* Semantic paddings — the canonical insets every panel/card should reuse */
  --pad-card: 14px;      /* inner padding of a standard card/panel body */
  --pad-panel: 16px;     /* larger column/panel header + body inset */
  --pad-tight: 10px;     /* compact controls / list rows */
  --gap-row: 10px;       /* default gap between controls in a row */
  --gap-grid: 8px;       /* default gap in tile/media grids */

  /* ════════════════════════════════════════════════════════════
     TYPOGRAPHY scale (rem, 16px root). px stays only for framework
     constants (sidebar width, icon sizes). Adopt gradually.
     ──────────────────────────────────────────────────────────── */
  --fs-2xs: .625rem;  /* 10px — micro labels */
  --fs-xs:  .75rem;   /* 12px — meta / captions */
  --fs-sm:  .8125rem; /* 13px — controls, body-sm */
  --fs-base:.875rem;  /* 14px — body */
  --fs-md:  1rem;     /* 16px — emphasis */
  --fs-lg:  1.125rem; /* 18px — section titles */
  --fs-xl:  1.375rem; /* 22px — page titles */
  --fs-2xl: 1.75rem;  /* 28px — hero */
  --fw-regular:400; --fw-medium:500; --fw-semibold:600; --fw-bold:700;

  /* TIMING — one set of durations, pair with --ease */
  --dur-fast: .15s; --dur-base: .2s; --dur-slow: .3s; --dur-slower: .45s;
  --ease-out: cubic-bezier(.22,.61,.36,1);

  /* Z-INDEX ladder — stop the 9999 arms-race */
  --z-base: 1; --z-sticky: 20; --z-dock: 40; --z-overlay: 50;
  --z-modal: 100; --z-toast: 9000; --z-float: 9999;

  /* CONTROL heights — one ladder so sibling controls in a row match
     (was ad-hoc 28/30/32/36). --ctrl-md is the default for buttons/inputs. */
  --ctrl-sm: 32px; --ctrl-md: 38px; --ctrl-lg: 44px;

  /* OVERLAYS — black scrims over media/modals (was raw rgba(0,0,0,.x)) */
  --overlay-1: rgba(0,0,0,.4);
  --overlay-2: rgba(0,0,0,.55);
  --overlay-3: rgba(0,0,0,.7);
}

/* ═══ INLINE SVG ICONS (window.IC) ═══ */
.ic{display:inline-block;vertical-align:-0.16em;flex-shrink:0;line-height:0}

/* ═══ RESET ═══ */
*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth;height:100%}
body{
  font-family:'Urbanist',-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  background:var(--bg);color:var(--text);letter-spacing:-.006em;
  -webkit-font-smoothing:antialiased;overflow-x:hidden;height:100%;
  display:flex;gap:var(--shell-gap);padding:var(--shell-gap);
}
::-webkit-scrollbar{width:4px;height:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.08);border-radius:var(--r-full)}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit}
a{text-decoration:none;color:inherit}
.hidden{display:none!important}

/* ═══ UNIFIED FOCUS RING ═══
   Kill the browser/OS default focus outline (renders in the macOS system accent —
   e.g. orange — which leaks into upload zones, inputs, buttons and breaks the palette).
   One violet ring for every focusable element, so focus is consistent system-wide. */
:focus{outline:none}
:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}
/* Overlaid file inputs (opacity:0, inset:0) — ring the visible wrapper, not the hidden input */
label:not(.mp-switch):focus-within,.upload-zone:focus-within{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-color:rgba(161,119,240,.5);
}
.upload-zone:focus-within:not(.filled){background:var(--accent-dim)}
input[type=file]:focus,input[type=file]:focus-visible{outline:none}
/* Toggle switches manage their own focus visual (the track) — no wrapper outline */
.mp-switch:focus-within{outline:none}
::selection{background:var(--accent-dim);color:var(--text-strong)}

/* ═══ CREDIT COST ON SPEND BUTTONS ═══
   A coin at rest, the number on hover. A permanent "5 cr" next to every Generate
   reads as a running meter and makes people hesitate before every click; the coin
   still marks the action as paid, and the amount appears the moment you reach for
   the button — when it is actually useful. Keyboard focus reveals it too, and the
   amount stays in `title`, so it is never hover-only information.
   Mirrored in the React app as <CostHint> (src/components/cost-hint.tsx). */
.cost-hint{display:inline-flex;align-items:center}
.cost-hint i{
  font-style:normal;max-width:0;opacity:0;overflow:hidden;white-space:nowrap;
  transition:max-width .25s var(--ease),opacity .25s var(--ease),margin-left .25s var(--ease);
}
button:hover > .cost-hint i,
button:focus-visible > .cost-hint i,
.cost-hint:hover i{max-width:70px;opacity:1;margin-left:4px}

/* ═══ UNIFIED CUSTOM DROPDOWN (ui-select.js) ═══
   Replaces the OS-rendered <select> popup with an app-styled glass menu. */
.uisel{position:relative;display:inline-flex}
.uisel--block{display:flex;width:100%}
.uisel-trigger{
  display:inline-flex;align-items:center;gap:8px;
  background:var(--surface-2);border:1px solid var(--border-2);color:var(--text);
  font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;
  padding:9px 12px;border-radius:var(--r-md);line-height:1;
  transition:border-color var(--dur-fast) var(--ease);
}
.uisel-trigger:hover{border-color:var(--border-3)}
.uisel-trigger.is-open{border-color:var(--accent)}
.uisel--block .uisel-trigger{width:100%;justify-content:space-between}
/* Inline inside an existing pill (e.g. carousel .cx-pill) — pill supplies the box */
.cx-pill .uisel-trigger{background:none;border:none;padding:0}
.cx-pill .uisel-trigger:hover,.cx-pill .uisel-trigger.is-open{border:none}
.uisel-chev{display:inline-flex;color:var(--text-3);transition:transform var(--dur-fast) var(--ease)}
.uisel-trigger.is-open .uisel-chev{transform:rotate(180deg)}
/* Menu — matches AI Video .vg-drop exactly; fixed to <body>, positioned by JS */
.uisel-menu{
  position:fixed;z-index:1500;min-width:200px;padding:6px;
  background:var(--surface-3);border:1px solid var(--border-2);
  border-radius:var(--r-md);
  box-shadow:0 12px 48px rgba(0,0,0,.75);
  max-height:min(340px,60vh);overflow-y:auto;
  animation:uisel-pop .15s var(--ease);
}
@keyframes uisel-pop{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}
.uisel-opt{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:8px 11px;border-radius:7px;cursor:pointer;transition:background .12s;
}
.uisel-opt:hover{background:var(--surface-4)}
.uisel-opt.on{background:rgba(161,119,240,.10)}
.uisel-opt.is-disabled{opacity:.4;cursor:not-allowed}
.uisel-opt-lbl{font-size:12px;font-weight:700;color:var(--text);white-space:nowrap}
.uisel-opt-desc{font-size:10px;color:var(--text-3);white-space:nowrap}

/* ═══ GLASS SURFACE — reusable premium glass (stronger, visible border) ═══
   Diagonal sheen + base fill + blur + a clearly visible hairline + top highlight. */
.glass-surface{
  border:1px solid rgba(255,255,255,.12);
  background:
    linear-gradient(124deg,rgba(255,255,255,.07),rgba(255,255,255,0) 46%),
    var(--glass-bg);
  -webkit-backdrop-filter:blur(40px) saturate(1.4);
  backdrop-filter:blur(40px) saturate(1.4);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.09), 0 10px 40px -14px rgba(0,0,0,.6);
}

/* ═══ SEGMENTED CONTROL (seg.js) — glass + gradient + sliding pill ═══ */
.seg{
  position:relative;display:inline-flex;align-items:center;gap:2px;
  padding:4px;border-radius:var(--r-full);
  border:1px solid rgba(255,255,255,.12);
  background:
    linear-gradient(124deg,rgba(255,255,255,.06),rgba(255,255,255,0) 46%),
    var(--glass-bg);
  -webkit-backdrop-filter:blur(24px) saturate(1.4);
  backdrop-filter:blur(24px) saturate(1.4);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07), 0 8px 26px -14px rgba(0,0,0,.6);
}
.seg-pill{
  position:absolute;z-index:0;top:4px;left:0;height:calc(100% - 8px);
  border-radius:var(--r-full);
  background:linear-gradient(135deg,rgba(255,255,255,.12),rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.10);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10), 0 6px 18px -8px rgba(0,0,0,.7);
  transition:transform .34s var(--ease), width .34s var(--ease), opacity .2s var(--ease);
  pointer-events:none;
}
/* children become pill-riding buttons */
.seg > button,.seg > a,.seg > .seg-btn{
  position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;gap:6px;
  border:none;background:none;cursor:pointer;font-family:inherit;
  color:var(--text-2);font-size:13px;font-weight:600;line-height:1;
  padding:7px 14px;border-radius:var(--r-full);white-space:nowrap;
  transition:color .25s var(--ease);
}
.seg > button:hover,.seg > a:hover,.seg > .seg-btn:hover{color:var(--text)}
.seg > .active,.seg > .on,.seg > .is-active,.seg > [aria-selected="true"],.seg > [data-state="active"]{color:var(--text-strong)}

/* ═══ SIDEBAR ═══ */
.sidebar{
  width:var(--sidebar-w);flex-shrink:0;
  height:calc(100vh - var(--shell-gap)*2);overflow:hidden;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--shell-radius);
  display:flex;flex-direction:column;position:sticky;top:var(--shell-gap);
  transition:width .25s var(--ease);
}
body.sidebar-collapsed .sidebar{width:var(--sidebar-w-collapsed)}

.sidebar-logo{
  padding:14px 16px;display:flex;align-items:center;gap:10px;
  font-size:17px;font-weight:900;letter-spacing:-.5px;
  border-bottom:1px solid var(--border);flex-shrink:0;min-height:54px;
}
.sidebar-logo-text{flex:1;white-space:nowrap;overflow:hidden}
.sidebar-collapse-btn{
  width:28px;height:28px;border-radius:8px;border:none;
  background:transparent;color:var(--text-2);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;transition:all .12s;flex-shrink:0;
}
.sidebar-collapse-btn:hover{background:var(--surface-3);color:var(--text)}
.sidebar-collapse-btn svg{width:16px;height:16px;transition:transform .25s var(--ease)}
body.sidebar-collapsed .sidebar-logo-text{display:none}
body.sidebar-collapsed .sidebar-logo{
  flex-direction:column;justify-content:center;align-items:center;
  gap:8px;padding:12px 8px 12px;min-height:auto;
}
body.sidebar-collapsed .sidebar-collapse-btn{
  width:40px;height:28px;border:1px solid var(--border-2);
  background:var(--surface-2);color:var(--text);
}
body.sidebar-collapsed .sidebar-collapse-btn:hover{
  background:var(--surface-3);border-color:var(--border-3);color:var(--accent);
}
body.sidebar-collapsed .sidebar-collapse-btn svg{transform:rotate(180deg)}

/* Collapsed nav items — center icons, hide text */
body.sidebar-collapsed .nav-item{justify-content:center;padding:9px 0}
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .user-pill-info,
body.sidebar-collapsed .sidebar-signout span,
body.sidebar-collapsed .project-selector-name,
body.sidebar-collapsed .project-selector-chev{display:none}
body.sidebar-collapsed .nav-section-label{height:8px;padding:8px 0 0}
body.sidebar-collapsed .sidebar-signout{justify-content:center;padding:8px 0}
body.sidebar-collapsed .sidebar-bottom{padding:12px 8px}
body.sidebar-collapsed .user-pill{justify-content:center}

/* Tooltip on collapsed icons */
body.sidebar-collapsed .nav-item{position:relative}
body.sidebar-collapsed .nav-item[data-label]:hover::after{
  content:attr(data-label);position:absolute;left:calc(100% + 12px);top:50%;transform:translateY(-50%);
  background:var(--surface-4);color:var(--text);border:1px solid var(--border-2);
  border-radius:8px;padding:6px 10px;font-size:12px;font-weight:500;
  white-space:nowrap;z-index:200;pointer-events:none;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
}
.sidebar-logo-mark{
  width:28px;height:28px;border-radius:6px;
  display:flex;align-items:center;justify-content:center;
  color:var(--text);flex-shrink:0;
}
.sidebar-logo-mark svg{width:100%;height:100%;display:block}
.sidebar-logo-text{
  color:var(--text);
}
.sidebar-nav{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:12px 10px;display:flex;flex-direction:column;gap:1px}
.nav-section-label{
  font-size:10px;font-weight:600;letter-spacing:.6px;color:var(--text-3);
  padding:14px 10px 6px;text-transform:uppercase;
}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:9px 12px;border-radius:var(--r-sm);
  font-size:13px;font-weight:500;color:var(--text-2);
  background:transparent;border:none;width:100%;text-align:left;
  position:relative;cursor:pointer;transition:all .12s;
  text-decoration:none;
}
.nav-svg{width:16px;height:16px;flex-shrink:0;stroke:currentColor;opacity:.6;transition:opacity .12s}
.nav-item:hover{background:var(--surface-3);color:var(--text)}
.nav-item:hover .nav-svg{opacity:.9}
.nav-item.active{background:var(--surface-3);color:var(--text);font-weight:600}
.nav-item.active .nav-svg{opacity:1}
.nav-item.active::before{
  content:'';position:absolute;left:0;top:50%;transform:translateY(-50%);
  width:2px;height:18px;border-radius:0 2px 2px 0;background:var(--accent);
}
/* Второй уровень навигации (режимы страницы) */
.nav-sub{display:flex;flex-direction:column;gap:1px;margin:1px 0 3px;padding-left:11px;
  border-left:1px solid var(--border);margin-left:20px}
.nav-subitem{
  display:flex;align-items:center;gap:8px;
  padding:6px 10px;border-radius:var(--r-sm);
  font-size:12.5px;font-weight:500;color:var(--text-2);
  text-decoration:none;position:relative;transition:all .12s;
}
.nav-subitem .nav-sub-dot{width:4px;height:4px;border-radius:50%;background:currentColor;opacity:.45;flex-shrink:0}
.nav-subitem:hover{background:var(--surface-3);color:var(--text)}
.nav-subitem.active{color:var(--text);font-weight:600}
.nav-subitem.active .nav-sub-dot{background:var(--accent);opacity:1}
/* В свёрнутом сайдбаре подпункты прячем (переключение доступно на самой странице через ?mode) */
body.sidebar-collapsed .nav-sub{display:none}

.sidebar-bottom{
  padding:12px 14px 14px;border-top:1px solid var(--border);
  flex-shrink:0;display:flex;flex-direction:column;gap:8px;
}
.user-pill{display:flex;align-items:center;gap:10px;padding:4px 0}
.user-pill-avatar{
  width:30px;height:30px;border-radius:var(--r-full);
  background:var(--surface-3);display:flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:700;color:var(--text);
}
.user-pill-info{flex:1;min-width:0}
.user-pill-name{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-pill-plan{font-size:10px;color:var(--text-3)}
.sidebar-signout{
  display:flex;align-items:center;gap:8px;padding:8px 10px;
  border-radius:var(--r-sm);font-size:12px;font-weight:500;
  color:var(--text-3);background:transparent;border:none;
  width:100%;text-align:left;cursor:pointer;transition:all .12s;
}
.sidebar-signout:hover{background:rgba(255,255,255,.05);color:var(--text-2)}
/* Иконки Settings + Sign Out справа от имени юзера */
.user-pill-actions{display:flex;align-items:center;gap:2px;margin-left:auto;flex-shrink:0}
.user-icon-btn{
  width:30px;height:30px;border-radius:var(--r-sm);border:none;background:transparent;
  color:var(--text-3);display:flex;align-items:center;justify-content:center;cursor:pointer;
  transition:background .12s,color .12s;text-decoration:none;flex-shrink:0;
}
.user-icon-btn svg{width:16px;height:16px}
.user-icon-btn:hover{background:var(--surface-3);color:var(--text)}
.user-icon-btn.active{color:var(--text)}
body.sidebar-collapsed .user-pill-actions{display:none}

/* ═══ v2 premium (apple-glass) — shell + sidebar refinements ═══ */
.sidebar,.main{corner-shape:var(--corner)}
.sidebar{background:var(--glass-bg);
  -webkit-backdrop-filter:var(--glass-blur) saturate(1.4); backdrop-filter:var(--glass-blur) saturate(1.4);
  box-shadow:var(--shadow-raised)}
.nav-item,.nav-subitem,.user-icon-btn,.sidebar-collapse-btn,.nav-item.active::after{corner-shape:var(--corner)}
.nav-section-label{font-family:'Geist Mono',ui-monospace,monospace;font-size:10px;letter-spacing:.14em}
.nav-item.active{background:var(--accent-grad-soft);color:var(--text-strong)}
.nav-item.active::before{display:none}
.nav-item.active .nav-svg{opacity:1;stroke:var(--accent-hover)}
.user-pill-avatar{background:var(--accent-grad);color:#fff}

/* ═══ PAGE TRANSITIONS ═══ */
.main{animation:pageIn .25s ease both}
@keyframes pageIn{
  from{opacity:0;transform:translateY(4px)}
  to{opacity:1;transform:translateY(0)}
}

/* ═══ SKELETON LOADER ═══ */
.skeleton{position:relative;overflow:hidden;background:var(--surface-2);border-radius:var(--r)}
.skeleton::after{
  content:'';position:absolute;inset:0;
  background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.03) 40%,rgba(255,255,255,.03) 60%,transparent 100%);
  animation:shimmer 1.5s infinite;
}
@keyframes shimmer{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
.skeleton-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);overflow:hidden}
.skeleton-thumb{width:100%;aspect-ratio:4/3;background:var(--surface-2);position:relative;overflow:hidden}
.skeleton-thumb::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.03) 40%,rgba(255,255,255,.03) 60%,transparent 100%);animation:shimmer 1.5s infinite}

/* Unified content-tile skeleton — used across every photo/video grid (Skeleton.grid in icons.js).
   Fills its grid cell; aspect ratio is inherited from the grid, override with --skel-ar. */
.skel-tile{position:relative;overflow:hidden;background:var(--surface-2);border-radius:var(--r-md);aspect-ratio:var(--skel-ar,1);width:100%}
.skel-tile::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.05) 45%,rgba(255,255,255,.05) 55%,transparent 100%);transform:translateX(-100%);animation:shimmer 1.4s infinite}
.skel-fade{opacity:0;transition:opacity .35s var(--ease,ease)}
.skel-fade.loaded{opacity:1}

/* Shimmer BEHIND a loading <img> — add class "imgskel" to the card/wrapper that holds the img,
   and on the img: onload add "img-ready" to that wrapper. Pure background animation → no z-index
   conflicts with overlays/action buttons. Works on any grid tile. */
.imgskel{background:var(--surface-2)}
.imgskel:not(.img-ready){background-image:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 37%,var(--surface-2) 63%);background-size:400% 100%;animation:skelbg 1.4s ease-in-out infinite}
@keyframes skelbg{0%{background-position:100% 0}100%{background-position:0 0}}
.skeleton-line{height:10px;border-radius:5px;background:var(--surface-2);position:relative;overflow:hidden;margin:10px 14px 0}
.skeleton-line::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.03) 40%,rgba(255,255,255,.03) 60%,transparent 100%);animation:shimmer 1.5s infinite}
.skeleton-line.short{width:60%}
.skeleton-line:last-child{margin-bottom:14px}

/* ═══ IMAGE LAZY LOAD FADE ═══ */
img[loading="lazy"]{opacity:0;transition:opacity .3s ease}
img[loading="lazy"].loaded,img[loading="lazy"][complete]{opacity:1}

/* ═══ SMOOTH CONTENT TRANSITIONS ═══ */
.content,.chat-wrap,.board,.studio-grid{animation:fadeContent .2s ease both}
@keyframes fadeContent{from{opacity:0}to{opacity:1}}

/* ═══ TOOLTIP ═══ */
.tooltip-trigger{
  display:inline-flex;align-items:center;justify-content:center;
  width:14px;height:14px;border-radius:50%;
  background:var(--surface-3);color:var(--text-3);
  font-size:9px;font-weight:800;cursor:help;
  position:relative;vertical-align:middle;margin-left:3px;
}
.tooltip-trigger:hover::after{
  content:attr(title);position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);
  background:var(--surface-4);color:var(--text);border:1px solid var(--border-2);
  border-radius:var(--r-sm);padding:8px 12px;font-size:11px;font-weight:500;
  white-space:normal;width:220px;line-height:1.5;z-index:9999;
  box-shadow:0 8px 24px rgba(0,0,0,.5);pointer-events:none;
}
.tooltip-trigger:hover{background:var(--surface-4);color:var(--text)}

/* ═══ SIDEBAR LOGO (inner anchor) ═══ */
.sidebar-logo-link{
  display:flex;align-items:center;gap:10px;flex:1;min-width:0;
  color:inherit;text-decoration:none;
}

/* ═══ PROJECT SELECTOR (sidebar, under logo) ═══ */
.project-selector{
  margin:10px 10px 4px;display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:var(--r-sm);
  background:var(--surface-2);border:1px solid var(--border);
  color:var(--text);font-size:13px;font-weight:600;
  cursor:pointer;width:calc(100% - 20px);text-align:left;
  transition:all .12s;
}
.project-selector:hover{background:var(--surface-3);border-color:var(--border-2)}
.project-selector-icon{font-size:16px;line-height:1;flex-shrink:0}
.project-selector-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.project-selector-chev{opacity:.6;flex-shrink:0;stroke:currentColor}
body.sidebar-collapsed .project-selector{
  justify-content:center;padding:8px 0;margin:8px 6px;width:calc(100% - 12px);
}

/* Project dropdown */
.project-dropdown{
  position:fixed;z-index:200;
  background:var(--surface-2);border:1px solid var(--border-2);
  border-radius:12px;padding:6px;
  box-shadow:0 12px 48px rgba(0,0,0,.6);
  animation:pdIn .15s ease both;
  box-sizing:border-box;
}
@keyframes pdIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
.pd-head{padding:8px 10px 4px;font-size:11px;font-weight:700;letter-spacing:.5px;color:var(--text-3);text-transform:uppercase}
.pd-search-wrap{padding:4px 6px 8px}
.pd-search{
  width:100%;padding:7px 10px;border-radius:8px;
  background:var(--surface);border:1px solid var(--border);
  color:var(--text);font-size:13px;outline:none;
}
.pd-search:focus{border-color:var(--border-3)}
.pd-list{display:flex;flex-direction:column;gap:1px;max-height:280px;overflow-y:auto;padding:2px 0}
.pd-item{
  display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:8px;border:none;background:transparent;
  color:var(--text);font-size:13px;font-weight:500;
  cursor:pointer;text-align:left;width:100%;transition:background .12s;
}
.pd-item:hover{background:var(--surface-3)}
.pd-item.active{background:var(--surface-3);font-weight:600}
.pd-item-icon{font-size:15px;flex-shrink:0}
.pd-item-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pd-item-check{color:var(--accent);flex-shrink:0;stroke:currentColor}
.pd-new{
  display:flex;align-items:center;gap:8px;width:100%;
  margin-top:4px;padding:9px 10px;border-radius:8px;
  background:transparent;border:none;border-top:1px solid var(--border);
  color:var(--text-2);font-size:13px;font-weight:600;
  cursor:pointer;transition:all .12s;
}
.pd-new:hover{background:var(--surface-3);color:var(--text)}
.pd-new svg{stroke:currentColor;flex-shrink:0}
.pd-lock{margin-left:auto;font-size:12px;opacity:.7}

/* ═══ BLOGENT MODAL (project create / paywall) ═══ */
.blogent-modal-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.6);
  display:flex;align-items:center;justify-content:center;
  z-index:300;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  animation:bmOverlayIn .15s ease both;padding:20px;
}
@keyframes bmOverlayIn{from{opacity:0}to{opacity:1}}
.blogent-modal{
  background:var(--surface);border:1px solid var(--border-2);
  border-radius:18px;padding:28px;
  width:100%;max-width:440px;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
  animation:bmIn .2s var(--ease) both;
}
@keyframes bmIn{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
.blogent-modal-icon{font-size:36px;margin-bottom:10px}
.blogent-modal-title{font-size:20px;font-weight:800;letter-spacing:-.4px;margin-bottom:6px;color:var(--text)}
.blogent-modal-sub{font-size:13px;color:var(--text-2);line-height:1.5;margin-bottom:18px}
.blogent-modal-label{display:block;font-size:11px;font-weight:700;letter-spacing:.5px;color:var(--text-3);text-transform:uppercase;margin:14px 0 8px}
.blogent-modal-input{
  width:100%;padding:11px 14px;border-radius:10px;
  background:var(--surface-2);border:1px solid var(--border-2);
  color:var(--text);font-size:14px;outline:none;transition:border .12s;
}
.blogent-modal-input:focus{border-color:var(--accent)}
.blogent-modal-emoji-grid{
  display:grid;grid-template-columns:repeat(8,1fr);gap:6px;
}
.emoji-pick{
  width:36px;height:36px;border-radius:10px;border:1px solid var(--border);
  background:var(--surface-2);font-size:18px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;transition:all .12s;
}
.emoji-pick:hover{background:var(--surface-3);border-color:var(--border-2)}
.emoji-pick.active{border-color:var(--accent);background:var(--accent-dim)}
.blogent-modal-actions{display:flex;gap:10px;margin-top:22px;justify-content:flex-end}
.blogent-modal-btn{
  padding:10px 18px;border-radius:10px;border:1px solid var(--border-2);
  font-size:13px;font-weight:600;cursor:pointer;
  transition:all .12s;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;
}
.blogent-modal-btn.ghost{background:transparent;color:var(--text-2)}
.blogent-modal-btn.ghost:hover{background:var(--surface-3);color:var(--text)}
.blogent-modal-btn.primary{background:var(--accent);color:var(--accent-text);border-color:transparent}
.blogent-modal-btn.primary:hover{background:var(--accent-hover)}

/* Plan rows in paywall */
.blogent-plans{display:flex;flex-direction:column;gap:6px;margin:14px 0 8px}
.plan-row{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 14px;border-radius:12px;
  background:var(--surface-2);border:1px solid var(--border);
}
.plan-row.current{border-color:var(--accent);background:var(--accent-dim)}
.plan-row-title{font-size:14px;font-weight:700;color:var(--text)}
.plan-row-badge{font-size:10px;font-weight:600;padding:2px 6px;border-radius:var(--r-full);background:var(--accent);color:var(--accent-text);margin-left:6px;vertical-align:middle}
.plan-row-tag{font-size:11px;color:var(--text-3);margin-top:2px}
.plan-row-incl{font-size:12px;color:var(--text-2);font-weight:600;text-align:right}

/* ═══ TOPBAR — single source of truth for ALL pages ═══ */
.topbar{
  height:var(--topbar-h);flex-shrink:0;
  display:flex;align-items:center;gap:16px;padding:0 24px;
  background:var(--topbar-bg);border-bottom:1px solid var(--border);
  backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
  position:sticky;top:0;z-index:40;
}
.topbar-title{flex:1;min-width:0}
.topbar-title h1{font-size:17px;font-weight:700;letter-spacing:-.3px;color:var(--text)}
.topbar-sub,
.topbar-subtitle{font-size:12px;color:var(--text-2);margin-top:1px}
.topbar-right{display:flex;align-items:center;gap:10px;margin-left:auto}
.topbar-menu-btn{
  display:none;background:none;border:none;color:var(--text);
  padding:6px;border-radius:var(--r-sm);cursor:pointer;
  align-items:center;justify-content:center;flex-shrink:0;
  transition:background .12s;margin-right:4px;
}
.topbar-menu-btn:hover{background:var(--surface-3)}
.topbar-btn{
  padding:8px 16px;border-radius:var(--r-sm);border:1px solid var(--border-2);
  background:transparent;color:var(--text-2);font-size:12px;font-weight:600;
  cursor:pointer;transition:all .15s;font-family:inherit;
}
.topbar-btn:hover{background:var(--surface-3);color:var(--text)}
.topbar-back{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 12px;border-radius:var(--r-full);
  background:transparent;border:1px solid var(--border-2);
  color:var(--text-2);font-size:12px;font-weight:600;cursor:pointer;
  font-family:inherit;transition:all .15s;
}
.topbar-back:hover{background:var(--surface-3);color:var(--text)}
.topbar-api{
  display:flex;align-items:center;gap:7px;font-size:12px;color:var(--text-2);
  background:var(--surface-2);border:1px solid var(--border);padding:5px 14px;
  border-radius:var(--r-full);
}
.topbar-api .dot{
  width:7px;height:7px;border-radius:50%;background:var(--success);
  box-shadow:0 0 6px var(--success);animation:pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot{0%,100%{opacity:1}50%{opacity:.4}}

/* ═══ RESPONSIVE ═══ */

/* Small desktop */
@media(max-width:1024px){
  :root{--sidebar-w:190px}
  .nav-section-label{font-size:9px;padding:12px 10px 5px}
  .nav-item{font-size:12px;padding:8px 10px}
}

/* Tablets — sidebar collapse + hamburger */
@media(max-width:768px){
  body{padding:0;gap:0}
  .main{border-radius:0;border:none;height:100vh}
  .sidebar{
    position:fixed;left:-280px;top:0;z-index:100;
    transition:left .3s var(--ease);width:260px;
    height:100vh;border-radius:0;border:none;
  }
  .sidebar.open{left:0}
  .sidebar-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:99;display:none}
  .sidebar-overlay.show{display:block}
  .topbar-menu-btn{display:flex!important}
  .topbar{padding-top:env(safe-area-inset-top,0)}
  body.sidebar-collapsed .sidebar{width:260px}
  .sidebar-expand-btn{display:none!important}
}

/* Phones */
@media(max-width:480px){
  :root{--topbar-h:48px}
  .sidebar-logo{padding:12px 16px}
  .sidebar-logo-mark{width:24px;height:24px;font-size:12px}
  .user-pill-avatar{width:26px;height:26px;font-size:11px}
  input,select,textarea{font-size:16px}
}

/* Small phones */
@media(max-width:320px){
  :root{--topbar-h:44px}
  .nav-item{font-size:11px;padding:7px 8px;gap:8px}
  .nav-svg{width:14px;height:14px}
  .sidebar-bottom{padding:8px 10px}
}

/* Landscape phones */
@media(max-height:500px) and (orientation:landscape){
  :root{--topbar-h:44px}
  .sidebar{padding-top:8px}
  .sidebar-logo{padding:10px 16px}
}
