/* basisvideos app: clean, one sidebar, no top bar. Light and dark follow the system unless picked (data-theme). */
:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --side: #fbfbfc;
  --line: #e7e7ea;
  --text: #16171a;
  --muted: #6b6f78;
  --soft: #f0f1f3;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --gold: #d99a0b;
  --ok: #0f9d6b;
  --bad: #d93a4f;
  --bubble: #eef0ff;
  --shadow: 0 1px 2px rgba(16, 17, 20, .06), 0 4px 16px rgba(16, 17, 20, .05);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013;
    --panel: #17181c;
    --side: #131417;
    --line: #26282e;
    --text: #ececef;
    --muted: #9a9ea8;
    --soft: #1e2026;
    --accent: #7c74ff;
    --accent-text: #0f1013;
    --bubble: #232445;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013;
  --panel: #17181c;
  --side: #131417;
  --line: #26282e;
  --text: #ececef;
  --muted: #9a9ea8;
  --soft: #1e2026;
  --accent: #7c74ff;
  --accent-text: #0f1013;
  --bubble: #232445;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button, .btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px; font-weight: 550; transition: background .15s, border-color .15s, opacity .15s; }
button:hover, .btn:hover { background: var(--soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { opacity: .9; background: var(--accent); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--soft); }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: default; }
input, textarea, select { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

/* login */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-wrap input::-ms-reveal { display: none; }
.pw-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; box-shadow: none; padding: 6px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.pw-btn:hover { color: var(--text); background: var(--soft); }
.pw-btn svg { width: 18px; height: 18px; }
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }

/* shell */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100%; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 17px; padding: 4px 8px 12px; }
.brand.big { font-size: 22px; justify-content: center; padding-bottom: 6px; }
.logo { width: 26px; height: 26px; display: block; flex: none; }
.brand.big { flex-direction: column; gap: 10px; }
.brand.big .logo { width: 64px; height: 64px; }
.new-video { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; box-shadow: var(--shadow); margin-bottom: 10px; }
.new-video:hover { border-color: var(--accent); }
.recent { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.group { display: flex; flex-direction: column; gap: 1px; }
.group summary { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 8px; cursor: pointer; list-style: none; user-select: none; }
.group summary::-webkit-details-marker { display: none; }
.group summary::before { content: ''; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 3px; }
.group[open] summary::before { transform: rotate(45deg); }
.group summary:hover { color: var(--text); }
.group summary .g-name { flex: 1; }
.group summary .count { font-size: 11px; background: var(--soft); border-radius: 99px; padding: 0 7px; }
.empty-side { padding: 6px 10px; font-size: 13px; }
.brand .lbl { flex: 1; }
.collapse-btn { padding: 5px; color: var(--muted); }
.collapse-btn svg { width: 18px; height: 18px; }
.app { transition: grid-template-columns .18s; }
@media (min-width: 821px) {
  .app.collapsed { grid-template-columns: 64px 1fr; }
  .app.collapsed .sidebar { padding: 16px 8px; align-items: center; }
  .app.collapsed .lbl, .app.collapsed .recent, .app.collapsed .who, .app.collapsed .plan { display: none; }
  .app.collapsed .recent + .side-nav { margin-top: auto; }
  .app.collapsed .brand { flex-direction: column; padding: 4px 0 12px; }
  .app.collapsed .collapse-btn svg { transform: scaleX(-1); }
  .app.collapsed .new-video { padding: 10px; }
  .app.collapsed .side-nav a { padding: 9px; justify-content: center; }
  .app.collapsed .side-nav { align-self: stretch; }
}
.recent a, .side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent a:hover, .side-nav a:hover { background: var(--soft); color: var(--text); }
.recent a.active, .side-nav a.active { background: var(--soft); color: var(--text); font-weight: 550; }
.recent a .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.recent a .dot.done { background: var(--ok); }
.recent a .dot.busy { background: var(--gold); }
.recent a span.name { overflow: hidden; text-overflow: ellipsis; }
.side-nav { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.account-link .who { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text); flex: none; }
.plan { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.plan.pro { background: linear-gradient(135deg, var(--accent), #f5b80b); color: #fff; }
.view { overflow-y: auto; min-width: 0; position: relative; }
.page { max-width: 980px; margin: 0 auto; padding: 40px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 24px; }
.chat-head .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; flex: none; }
.chat-head .spacer { flex: 1; }
.thread { flex: 1; overflow-y: auto; padding: 8px 24px 24px; }
.thread-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--bubble); padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 80%; }
.msg.assistant { align-self: flex-start; max-width: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card-head .kind { font-weight: 650; color: var(--text); }
.card h3 { font-size: 17px; margin: 0 0 8px; }
.script-text { white-space: pre-wrap; line-height: 1.65; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.card.error { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); }
.card audio { width: 100%; margin-top: 4px; }
.card video { width: 100%; max-height: 560px; border-radius: 10px; background: #000; display: block; }
.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; width: 0; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { padding: 12px 24px 22px; }
.composer form { max-width: 720px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.composer textarea { border: 0; box-shadow: none; padding: 6px 0; resize: none; max-height: 200px; background: transparent; }
.composer button[type="submit"] { border-radius: 11px; padding: 8px; display: grid; place-items: center; }
.composer form.stacked { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 10px 10px 16px; border-radius: 20px; }
.composer form.stacked textarea { min-height: 52px; font-size: 16px; }
.composer .bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.composer .bar .spacer { flex: 1; }
.composer .bar .slot:empty { display: none; }
.segmented { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented .seg { border: 0; background: transparent; padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; box-shadow: none; }
.segmented .seg.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.segmented .seg svg { width: 13px; height: 13px; }
.shape { border: 1.5px solid currentColor; border-radius: 3px; display: inline-block; }
.shape.portrait { width: 9px; height: 14px; }
.shape.landscape { width: 14px; height: 9px; }
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; user-select: none; max-width: 240px; }
.pill:hover, details.menu[open] > .pill { background: var(--soft); color: var(--text); }
.pill svg { width: 15px; height: 15px; flex: none; }
.pill .pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 8; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.styles-menu .menu-panel { padding: 10px; }
.chat-head .menu-panel { left: auto; right: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; box-shadow: none; padding: 8px 10px; border-radius: 8px; text-align: left; font-weight: 500; }
.menu-item:hover { background: var(--soft); }
.swatch { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent); }
.swatch span { width: 7px; height: 7px; border-radius: 50%; }
.sw-slot { display: inline-flex; }
.soon-badge { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.theme-btn { position: fixed; top: 10px; right: 14px; z-index: 6; padding: 7px; display: grid; place-items: center; color: var(--muted); }
.theme-btn svg { width: 18px; height: 18px; }
.chat-head { padding-right: 64px !important; }

/* start screen */
.start { min-height: 100%; display: grid; place-items: center; padding: 32px; }
.start-box { width: 100%; max-width: 720px; }
.start .composer { padding: 0; }

/* video grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.tile { display: flex; flex-direction: column; gap: 8px; }
.tile .thumb { aspect-ratio: 9 / 16; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.tile .thumb.land { aspect-ratio: 16 / 9; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .name { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 72px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }

/* assets */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs button { border-radius: 99px; font-weight: 500; color: var(--muted); }
.tabs button.active { background: var(--text); color: var(--panel); border-color: var(--text); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.asset { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.asset .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.asset .nm { font-weight: 600; }
.asset p { margin: 0; font-size: 13px; color: var(--muted); }
.asset.locked { opacity: .6; }
.lock { font-size: 11px; font-weight: 700; color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { border-radius: 99px; font-weight: 500; font-size: 13px; padding: 6px 12px; color: var(--muted); }
.chip-toggle.on { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: var(--accent); color: var(--text); }
.chip-toggle .soon { font-size: 10px; margin-left: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.asset { padding: 0; overflow: hidden; margin: 0; }
.asset figcaption { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.asset .preview { aspect-ratio: 1; background: var(--soft); }
.asset .preview.tall { aspect-ratio: 9 / 16; }
.asset .preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-grid.sets { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.asset figcaption p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-mini { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* settings */
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.section p.muted { margin: -6px 0 16px; font-size: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form .row { display: flex; gap: 10px; }
.form .row > * { flex: 1; }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.keyrow:last-of-type { border-bottom: 0; }
.keyrow .nm { flex: 1; }
.key-status { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.key-status svg { width: 15px; height: 15px; stroke-width: 2.6; }
.key-status.set { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.key-status.missing { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.key-status.unknown { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); }
.keyrow .hint { font-size: 12px; }
.keyrow small.error { display: block; font-size: 12px; }
.ok { color: var(--ok); font-weight: 550; font-size: 13px; }
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px; }
.voice { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.voice.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.voice small { color: var(--muted); }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.plan-card.current { border-color: var(--accent); }
.plan-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 10; }

/* mobile: sidebar on top as a strip */
.menu-btn { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 5; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .collapse-btn { display: none; }
  .menu-btn { display: grid; place-items: center; position: fixed; top: 10px; left: 10px; z-index: 4; padding: 7px; }
  .chat-head { padding-left: 58px; }
  .page { padding: 64px 16px 48px; }
  .thread, .composer { padding-left: 14px; padding-right: 14px; }
  .plan-cards { grid-template-columns: 1fr; }
}
