:root {
  --bg: #f4f5f9; --panel: #ffffff; --panel-2: #f1f2f7; --border: #e3e6ee; --text: #171a24; --muted: #6b7280;
  --accent: #5b4cf5; --accent-2: #4636e0; --accent-soft: #eeebff; --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06); --radius: 14px; --sidebar-w: 250px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0; }

/* sidebar */
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 12px; color: var(--text); }
.brand-icon { font-size: 26px; }
.brand-name { font-weight: 800; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; }
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-2); }
.nav-ico { width: 22px; text-align: center; }
.nav-count { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 12px 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.settings summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.settings .field { margin-bottom: 8px; }
.spend { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.spend-row { display: flex; justify-content: space-between; }
.spend-row b { font-family: var(--mono); color: var(--ok); }
.spend-sub { display: flex; justify-content: space-between; color: var(--muted); margin-top: 3px; }
.spend-sub b { font-family: var(--mono); color: var(--text); font-weight: 500; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok .status-dot { background: var(--ok); } .status.warn .status-dot { background: var(--warn); } .status.err .status-dot { background: var(--danger); }
.hint { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.45; }
.menu-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 30; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-size: 18px; cursor: pointer; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 15; }

/* main */
.main { flex: 1; min-width: 0; padding: 28px 32px 60px; max-width: 1240px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.empty { color: var(--muted); margin: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 700; }
.field em { color: var(--accent); font-style: normal; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 14px; border-radius: 10px; transition: background .15s, transform .05s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.big { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading:not(.primary)::after { border-color: rgba(0,0,0,.15); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.segmented { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg { font: inherit; font-weight: 600; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* dashboard composer (ChatGPT-like) */
.composer-wrap { max-width: 860px; margin: 8vh auto 0; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.composer-title { font-size: 34px; font-weight: 700; letter-spacing: -.4px; text-align: center; }
.composer { width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 6px 24px rgba(16,24,40,.08); padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.composer textarea { border: 0; box-shadow: none !important; padding: 8px 6px; font-size: 17px; resize: none; background: transparent; min-height: 52px; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.composer-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.send-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; font-size: 20px; font-weight: 800; cursor: pointer; flex: 0 0 44px; }
.send-btn:hover { background: var(--accent-2); } .send-btn:disabled { opacity: .5; cursor: not-allowed; }
.send-btn.loading { position: relative; color: transparent; }
.send-btn.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip.sug { cursor: pointer; font: inherit; font-size: 13px; background: var(--panel); }
.chip.sug:hover { border-color: var(--accent); color: var(--accent-2); }
/* dropdown */
.dd { position: relative; }
.dd-btn { display: flex; align-items: center; gap: 8px; font: inherit; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px 6px 8px; cursor: pointer; color: var(--text); max-width: 260px; }
.dd-btn:hover { border-color: var(--accent); }
.dd-ico { width: 28px; height: 28px; border-radius: 8px; background: #fff; display: grid; place-items: center; font-size: 14px; flex: 0 0 28px; }
.dd-text { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.dd-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.dd-value { font-size: 13px; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-caret { color: var(--muted); }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 340px; max-width: 90vw; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(16,24,40,.16); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dd-search { padding: 8px 10px; border-radius: 10px; }
.dd-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; background: none; font: inherit; text-align: left; width: 100%; color: var(--text); }
.dd-item:hover { background: var(--panel-2); }
.dd-item.active { background: var(--accent-soft); border-color: rgba(91,76,245,.35); }
.dd-item .sw { width: 34px; height: 34px; border-radius: 8px; flex: 0 0 34px; display: grid; place-items: center; font-size: 16px; background: linear-gradient(135deg, #e9e6ff, #ffe6f2); }
.dd-item .it { display: flex; flex-direction: column; min-width: 0; }
.dd-item .it b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item .it span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-footer { display: block; padding: 8px 10px; font-size: 13px; font-weight: 600; border-top: 1px solid var(--border); }
.dd-empty { color: var(--muted); font-size: 12px; padding: 8px 10px; }

/* dashboard */
.hero { background: linear-gradient(135deg, #ffffff, #f0edff); border: 1px solid var(--border); border-radius: 18px; padding: 34px 32px; box-shadow: var(--shadow); }
.hero h1 { font-size: 30px; margin-bottom: 6px; }
.hero p { color: var(--muted); margin: 0 0 18px; max-width: 640px; font-size: 15px; }
.hero-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-form input { flex: 1; min-width: 260px; padding: 12px 14px; font-size: 15px; border-radius: 12px; }
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 18px; }
.idea { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.idea h3 { margin: 0; font-size: 16px; }
.idea .hook { font-style: italic; color: var(--accent-2); }
.idea .why { color: var(--muted); font-size: 12px; }
.idea .tag { align-self: flex-start; }
.idea .btn { margin-top: auto; align-self: flex-start; }
.ideas-loading { grid-column: 1 / -1; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; }
.quick-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); color: var(--text); display: flex; flex-direction: column; gap: 4px; transition: transform .1s, border-color .15s; }
.quick-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.quick-card span:last-child { color: var(--muted); font-size: 13px; }
.q-ico { font-size: 24px; margin-bottom: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; color: var(--text); cursor: pointer; transition: transform .1s, border-color .15s; }
.pcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.pcard .thumb { aspect-ratio: 16 / 9; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 30px; overflow: hidden; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pcard .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .sub { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pcard .prog { display: flex; gap: 4px; margin-top: 6px; }
.pcard .prog i { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.pcard .prog i.on { background: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); }
.tag { font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.chip b { color: var(--accent-2); }

/* project */
.project-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.back { color: var(--muted); font-weight: 600; }
.title-input { flex: 1; min-width: 220px; font-size: 22px; font-weight: 800; border: 1px solid transparent; background: transparent; padding: 6px 8px; }
.title-input:hover, .title-input:focus { background: #fff; border-color: var(--border); }
.title-input.small { font-size: 15px; }
.project-tools { display: flex; gap: 8px; align-items: center; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.step-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.step-card.locked { opacity: .55; }
.step-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); font-weight: 800; font-size: 12px; }
.step-card.done .step-n { background: var(--ok); color: #fff; }
.step-card.active .step-n { background: var(--accent); color: #fff; }
.step-state { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.step-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.tool-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--panel-2); border-radius: 12px; padding: 8px 10px; }
.tool-group.grow { flex: 1; }
.tool-group.grow input { flex: 1; min-width: 200px; }
.tool-group b { font-size: 12px; color: var(--muted); margin-right: 2px; }
.tool-group select { width: auto; max-width: 260px; }
.cost { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.result { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--panel-2); flex-wrap: wrap; }
.result .chips { padding: 10px 14px; }
.output-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.script-md { padding: 14px 18px; border-top: 1px solid var(--border); max-height: 520px; overflow: auto; }
.progress { color: var(--muted); font-family: var(--mono); font-size: 12px; margin: 0; }

/* markdown */
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md h1 { font-size: 18px; margin: 0 0 8px; } .md h2 { font-size: 15px; margin: 16px 0 6px; color: var(--accent-2); } .md h3 { font-size: 14px; margin: 12px 0 4px; }
.md p { margin: 0 0 8px; } .md ul, .md ol { margin: 0 0 8px; padding-left: 22px; } .md li { margin: 2px 0; }
.md code { font-family: var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* scenes */
.scenes-wrap { margin-top: 8px; }
.count { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.scene-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.characters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.scene-grid { display: flex; flex-direction: column; gap: 12px; }
.scene { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 300px minmax(0, 1fr) auto; }
.scene.ar-9-16 { grid-template-columns: 190px minmax(0, 1fr) auto; }
.scene-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.scene-img { position: relative; background: var(--panel-2); aspect-ratio: 16 / 9; display: grid; place-items: center; border-right: 1px solid var(--border); align-self: start; }
.scene-img.ar-9-16 { aspect-ratio: 9 / 16; }
.scene-side { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-left: 1px solid var(--border); background: var(--panel-2); }
.ibtn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 15px; display: grid; place-items: center; }
.ibtn:hover { border-color: var(--accent); background: var(--accent-soft); }
.ibtn.danger:hover { border-color: var(--danger); background: #fef2f2; }
.ibtn:disabled { opacity: .45; cursor: not-allowed; }
.scene-block textarea.text-edit { font-size: 13px; background: var(--panel-2); border-color: transparent; min-height: 44px; padding: 6px 8px; font-style: italic; }
.scene-block textarea.text-edit:focus { border-color: var(--accent); background: #fff; }
@media (max-width: 900px) { .scene, .scene.ar-9-16 { grid-template-columns: 1fr; } .scene-img { border-right: 0; border-bottom: 1px solid var(--border); } .scene-img.ar-9-16 { max-height: 380px; } .scene-side { flex-direction: row; border-left: 0; border-top: 1px solid var(--border); } }
.scene-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.scene-img .ph { color: var(--muted); font-size: 12px; text-align: center; padding: 12px; }
.scene-img .badge-img { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.scene-img .badge-img.final { background: rgba(22,163,74,.9); }
.scene-img .cost-tag { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.scene-img.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border: 3px solid rgba(0,0,0,.1); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.scene-img.busy .ph { opacity: 0; }
.scene-head { display: flex; align-items: baseline; gap: 8px; }
.scene-num { font-family: var(--mono); font-size: 12px; color: var(--accent-2); font-weight: 700; }
.scene-title { font-weight: 700; flex: 1; }
.scene-dur { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.scene-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.scene-block { display: flex; flex-direction: column; gap: 4px; }
.scene-block .lbl { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.scene-block .lbl button { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 11px; padding: 0; }
.scene-block .txt { font-size: 13px; line-height: 1.45; }
.scene-block .txt.narration { font-style: italic; }
.scene-block textarea.prompt-edit { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border-color: transparent; min-height: 56px; padding: 8px 10px; }
.scene-block textarea.prompt-edit:focus { border-color: var(--accent); background: #fff; }
.scene-block details summary { cursor: pointer; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.scene-err { color: var(--danger); font-size: 12px; }
.scene-audio { display: flex; align-items: center; gap: 8px; }
.scene-audio audio { width: 100%; height: 32px; }
.export-log { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; max-height: 140px; overflow: auto; white-space: pre-wrap; }
#exportResult video { width: 100%; max-height: 520px; border-radius: 12px; background: #000; }
#musicResult audio { width: 100%; }
.result-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* styles page */
.style-form { margin-bottom: 18px; }
.scard { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.scard .t { font-weight: 700; }
.scard .p { color: var(--muted); font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.scard .actions { margin-top: auto; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; color: var(--muted); margin-top: 10px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dz-icon { font-size: 24px; }
.upload-status { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 8px; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ref { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ref img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--panel-2); }
.ref-meta { padding: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.ref-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-actions { display: flex; gap: 4px; }
.ref-actions .btn { padding: 3px 7px; font-size: 11px; }

.banner { background: #fff7e6; border: 1px solid #f5c66b; color: #92400e; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.banner.err { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.banner code { font-family: var(--mono); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 90vw; }
.toast.err { background: var(--danger); }

@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .backdrop { display: block; }
  .main { padding: 64px 14px 40px; }
  .hero { padding: 24px 18px; } .hero h1 { font-size: 24px; }
  .row { grid-template-columns: 1fr; }
  .tool-group select { max-width: 100%; }
}
