/* SmartReels studio design system: tokens, base, components. Shared by every page of the studio. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f6f6f8; --surface: #ffffff; --surface-2: #f2f2f5; --surface-3: #e9e9ee;
  --border: #e4e4e9; --border-strong: #d2d2da;
  --text: #17171c; --text-2: #50505c; --text-3: #8a8a96;
  --accent: #6b54f8; --accent-hover: #5a43ea; --accent-soft: rgba(107, 84, 248, .1); --accent-text: #ffffff;
  --success: #15924a; --success-soft: rgba(21, 146, 74, .1);
  --warn: #c76a00; --warn-soft: rgba(199, 106, 0, .12);
  --danger: #d92d3a; --danger-soft: rgba(217, 45, 58, .1);
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, .05);
  --shadow-md: 0 4px 16px rgba(16, 16, 24, .08), 0 1px 3px rgba(16, 16, 24, .06);
  --shadow-lg: 0 24px 60px rgba(16, 16, 24, .18), 0 4px 12px rgba(16, 16, 24, .08);
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  --side: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* legacy names still used by inline markup */
  --bd: var(--border); --ac: var(--accent); --mut: var(--surface-3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d10; --surface: #151519; --surface-2: #1c1c22; --surface-3: #26262e;
    --border: #26262d; --border-strong: #34343d;
    --text: #ededf2; --text-2: #a9a9b6; --text-3: #6f6f7c;
    --accent: #8571ff; --accent-hover: #9a89ff; --accent-soft: rgba(133, 113, 255, .14);
    --success: #3fbf74; --success-soft: rgba(63, 191, 116, .14);
    --warn: #f0a33a; --warn-soft: rgba(240, 163, 58, .14);
    --danger: #ff5c68; --danger-soft: rgba(255, 92, 104, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d10; --surface: #151519; --surface-2: #1c1c22; --surface-3: #26262e;
  --border: #26262d; --border-strong: #34343d;
  --text: #ededf2; --text-2: #a9a9b6; --text-3: #6f6f7c;
  --accent: #8571ff; --accent-hover: #9a89ff; --accent-soft: rgba(133, 113, 255, .14);
  --success: #3fbf74; --success-soft: rgba(63, 191, 116, .14);
  --warn: #f0a33a; --warn-soft: rgba(240, 163, 58, .14);
  --danger: #ff5c68; --danger-soft: rgba(255, 92, 104, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
[hidden] { display: none !important; }
a { color: var(--accent); }
img, video { max-width: 100%; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { color: var(--text); letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 22px 0 10px; text-transform: none; opacity: 1; }
h3 { font-size: 13px; font-weight: 600; margin: 18px 0 8px; color: var(--text-2); }
section > h2:first-child, .c > h2:first-child { margin-top: 0; }
small { color: var(--text-3); }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
details > summary { cursor: pointer; color: var(--text-2); font-weight: 500; list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s var(--ease); flex: none; }
details[open] > summary::before { transform: rotate(45deg); }
pre { font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin: 14px 0 6px; opacity: 1; }
textarea, input[type=text], input[type=number], input[type=url], input[type=email], input[type=search], input[type=password], input[type=date], input:not([type]), select {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 9px 12px; min-height: 40px;
  transition: border-color .15s, box-shadow .15s; }
textarea { line-height: 1.5; resize: vertical; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a8a96' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea:hover, input:hover, select:hover { border-color: var(--text-3); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea:disabled, input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
::placeholder { color: var(--text-3); }
input[type=color] { width: 100%; height: 40px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.ck { display: inline-flex; gap: 8px; align-items: center; margin: 10px 16px 0 0; font-size: 13px; color: var(--text-2); }
.ck label { margin: 0; font-weight: 500; cursor: pointer; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.g2 > div > label:first-child { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; }

/* ---------- buttons ---------- */
button { font: inherit; }
.btn, .sm, .chips button, .seg button { -webkit-tap-highlight-color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 16px; min-height: 42px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: var(--r-md); background: var(--accent); color: var(--accent-text);
  font: 600 14px/1.2 "Inter", system-ui, sans-serif; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled, .sm:disabled, button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.sm { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 12px;
  font: 500 13px/1.2 "Inter", system-ui, sans-serif; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s; }
.sm:hover { background: var(--surface-2); border-color: var(--text-3); }
.sm.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.sm.primary:hover { background: var(--accent-hover); }
.sm.danger, #pdel { color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 40%, transparent) !important; }
.sm.danger:hover, #pdel:hover { background: var(--danger-soft); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* chips & segmented control */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chips:empty { display: none; }
.chips button { min-height: 34px; padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; transition: all .15s; }
.chips button:hover { color: var(--text); border-color: var(--text-3); }
.chips button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.seg { display: flex; padding: 3px; gap: 3px; margin-top: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg button { flex: 1; min-height: 34px; padding: 6px 10px; font-size: 13px; font-weight: 500; color: var(--text-2); background: transparent; border: 0; border-radius: 7px; cursor: pointer; transition: all .15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- surfaces ---------- */
.c { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; min-width: 0; box-shadow: var(--shadow-sm); }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; min-width: 0; cursor: pointer; transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease); }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card b { display: block; font-size: 14px; font-weight: 600; margin-top: 8px; line-height: 1.35; }
.card small { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card video, .card img { border-radius: 10px; }
.card video { margin: 0; aspect-ratio: 9/16; max-height: 300px; width: 100%; object-fit: cover; background: #000; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.empty { color: var(--text-3); font-size: 13px; padding: 22px 16px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2); line-height: 1.55; }
.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 22px 18px; text-align: center; font-size: 14px; font-weight: 500; color: var(--text); background: var(--surface-2); cursor: pointer; transition: all .15s; }
.drop small { display: block; margin-top: 4px; font-weight: 400; }
.drop:hover { border-color: var(--text-3); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.files div { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.files div:last-child { border-bottom: 0; }
.files a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.files a:hover { color: var(--accent); }
.mut { color: var(--text-3); font-size: 13px; opacity: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
video { border-radius: var(--r-lg); background: #000; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; cursor: pointer; color: var(--text); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #a855f7); color: #fff; flex: none; box-shadow: 0 4px 12px var(--accent-soft); }
.side .proj-pick { padding: 0 2px 12px; }
.side .proj-pick label { margin: 0 0 6px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { margin: 14px 0 4px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.nav button, .nav a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); font: 500 14px/1.2 "Inter", system-ui, sans-serif; text-align: left; cursor: pointer; text-decoration: none; transition: background .12s, color .12s; }
.nav button:hover, .nav a:hover { background: var(--surface-2); color: var(--text); }
.nav button.on { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
.nav .count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; text-align: center; }
.paused .count { background: var(--warn) !important; color: #fff !important; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot small { padding-left: 8px; }
.main { min-width: 0; padding: 28px 36px 64px; }
.page { max-width: 1240px; margin: 0 auto; }
.pagehead { max-width: 1240px; margin: 0 auto 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.pagehead p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; max-width: 680px; }
.w { display: grid; grid-template-columns: 400px 1fr; gap: 20px; max-width: 1240px; margin: 0 auto; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.mobile-bar { display: none; }

@media (max-width: 1100px) { .w { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .app.menu-open .side { transform: none; }
  .app.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 10px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .mobile-bar .brand { padding: 0; }
  .main { padding: 18px 16px 48px; }
  .pagehead h1 { font-size: 20px; }
  .c { padding: 16px; border-radius: var(--r-lg); }
  .g2 { grid-template-columns: 1fr; }
}

/* ---------- popover / modal / toast ---------- */
.pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-lg); }
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--text); color: var(--bg); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.45; animation: toastIn .25s var(--ease); white-space: pre-wrap; overflow-wrap: anywhere; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--success); color: #fff; }
.toast button { margin-left: auto; flex: none; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(10, 10, 14, .45); backdrop-filter: blur(2px); animation: fadeIn .15s; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-lg); animation: toastIn .2s var(--ease); }
.modal p { margin: 0 0 18px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.modal .row { justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- credits ---------- */
.credits { margin: 10px 2px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.cr-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text-2); font-weight: 500; }
.cr-top b { font-size: 18px; color: var(--text); letter-spacing: -.01em; }
.cr-top b.low { color: var(--warn); }
.cr-bar { height: 5px; margin: 8px 0; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.cr-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s var(--ease); }
.cr-sub { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.me-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.me-t { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.me-t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-link { background: none; border: 0; padding: 0; font: 600 12px "Inter", system-ui, sans-serif; color: var(--accent); cursor: pointer; }
/* what an action costs, on its button */
[data-cost]::after { content: attr(data-cost); margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.btn[data-cost]::after, .sm.primary[data-cost]::after { background: rgba(255,255,255,.2); color: inherit; }

/* ---------- a compact sidebar: the workspace links fold away ---------- */
.side { gap: 2px; padding: 14px 12px; }
.brand { padding: 2px 8px 12px; }
.side .proj-pick { padding: 0 2px 8px; }
.nav button, .nav a { min-height: 32px; padding: 6px 10px; font-size: 13.5px; }
.nav-h { margin: 10px 0 2px 10px; }
.ws { margin-top: 8px; }
.ws > summary { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.ws > summary:hover { background: var(--surface-2); color: var(--text-2); }
.ws > summary::before { order: 2; margin-left: auto; }
.ws[open] > summary { margin-bottom: 2px; }
.ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.ws[open] .ws-dot { display: none; }
.credits { margin: 8px 2px 0; padding: 10px 12px; }
.cr-top b { font-size: 16px; }
.cr-bar { margin: 6px 0; }
.side-foot { padding-top: 10px; }
/* the breakdown of a video example */
.watch-modal { width: min(920px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.watch-modal h4 { margin: 20px 0 8px; font-size: 14px; color: var(--text); }
.wchips { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 14px; }
.wchips span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2, rgba(127,127,127,.08)); }
.wchips b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.wchips small { font-size: 11.5px; color: var(--text-2); }
.wimg { display: block; width: 100%; height: auto; border-radius: var(--r-md); background: #000; }
.wtext { font-size: 14px; line-height: 1.6; color: var(--text); }
.wtext p { margin: 0 0 10px; white-space: normal; }
.wtext .wl { margin: 0 0 10px; padding-left: 0; list-style: none; }
.wtext .wl li { margin: 4px 0; }
.wtext .wn { display: inline-block; min-width: 1.6em; font-weight: 600; color: var(--accent); }
.wtext code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: rgba(127,127,127,.12); }
.watch-modal details { margin-top: 14px; }
.watch-modal summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); }
