:root {
  --bg: #0a0c11;
  --panel: #11141b;
  --panel-2: #161a23;
  --panel-3: #1d2230;
  --border: #232937;
  --border-2: #2e3546;
  --text: #e9ecf3;
  --muted: #8b94a8;
  --faint: #5d6579;
  --accent: #7c5cff;
  --accent-hover: #8f74ff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --pink: #ff2d55;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.13);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.13);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.13);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.13);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code { background: var(--panel-3); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 750; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--pink)); display: grid; place-items: center; font-size: 15px; box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--muted); font-weight: 520; transition: background .15s, color .15s; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .nav-icon { color: var(--accent-hover); }
.nav-icon { width: 18px; text-align: center; font-size: 15px; }
.nav-badge { margin-left: auto; background: var(--danger); color: white; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 650; }
.sidebar-footer { margin-top: auto; padding: 8px; color: var(--faint); font-size: 12px; display: flex; flex-direction: column; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(10, 12, 17, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .title { font-weight: 650; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 26px 28px 80px; max-width: 1400px; width: 100%; margin: 0 auto; }
.menu-btn { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; }

/* ---------- primitives */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mono { font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); font-weight: 560; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; user-select: none; }
.btn:hover { background: var(--panel-3); border-color: #3a4256; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.success { background: var(--success); border-color: var(--success); color: #04130a; }
.btn.danger { color: #ff8a8a; border-color: rgba(239, 68, 68, 0.35); background: var(--danger-soft); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.22); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn.icon { padding: 7px; width: 34px; height: 34px; }
.btn.block { width: 100%; }

.input, .select, .textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; color: var(--muted); font-weight: 560; }
.field .hint { font-size: 12px; color: var(--faint); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel-2); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }

.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 560; }
.segmented button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.4); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 620; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: #4ade80; }
.badge.warning { background: var(--warning-soft); color: #fbbf24; }
.badge.danger { background: var(--danger-soft); color: #f87171; }
.badge.info { background: var(--info-soft); color: #7dd3fc; }
.badge.accent { background: var(--accent-soft); color: #b3a2ff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.progress { height: 8px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--pink)); border-radius: 99px; transition: width .4s ease; }
.progress.thin { height: 4px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 38px; margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--panel-2); font-size: 13px; line-height: 1.5; }
.alert.warning { border-color: rgba(245, 158, 11, 0.35); background: var(--warning-soft); }
.alert.danger { border-color: rgba(239, 68, 68, 0.35); background: var(--danger-soft); }
.alert.info { border-color: rgba(56, 189, 248, 0.3); background: var(--info-soft); }
.alert.success { border-color: rgba(34, 197, 94, 0.3); background: var(--success-soft); }

/* ---------- stats */
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 560; }
.stat .v { font-size: 28px; font-weight: 720; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--faint); font-size: 12px; margin-top: 2px; }

/* ---------- lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 560; font-size: 12px; padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,0.015); }

/* ---------- platforms */
.pf { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 10.5px; font-weight: 800; color: white; flex: none; letter-spacing: -0.02em; }
.pf.lg { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }
.pf.tiktok { background: #000; box-shadow: inset 2px 0 0 #25f4ee, inset -2px 0 0 #fe2c55; }
.pf.instagram { background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.pf.youtube { background: #ff0033; }
.pf.facebook { background: #1877f2; }
.pf.local { background: #3b4254; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--panel-3); flex: none; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .pf { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; font-size: 8px; border-radius: 5px; border: 2px solid var(--panel); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--panel-2); cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; transition: all .15s; }
.chip:hover { border-color: #3a4256; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.chip .pf { width: 18px; height: 18px; font-size: 8.5px; border-radius: 6px; }
.chip.disabled { opacity: .5; cursor: not-allowed; }

/* ---------- upload */
.dropzone { border: 2px dashed var(--border-2); border-radius: 18px; padding: 48px 24px; text-align: center; cursor: pointer; transition: all .2s; background: linear-gradient(180deg, rgba(124,92,255,0.04), transparent); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .big { font-size: 44px; margin-bottom: 8px; }
.file-pill { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; }

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.option-card { border: 1px solid var(--border-2); background: var(--panel-2); border-radius: 12px; padding: 12px; cursor: pointer; transition: all .15s; text-align: left; }
.option-card:hover { border-color: #3a4256; }
.option-card.on { border-color: var(--accent); background: var(--accent-soft); }
.option-card .t { font-weight: 640; }
.option-card .d { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.preview-frame { display: grid; place-items: center; height: 92px; }
.pv { position: relative; border-radius: 6px; overflow: hidden; background: #222; border: 1px solid #3a4256; }
.pv .bgblur { position: absolute; inset: 0; background: linear-gradient(135deg, #6f5bd6, #d24f7a, #3aa3c9); filter: blur(5px); opacity: .7; transform: scale(1.3); }
.pv .pv-cam { position: absolute; left: 0; right: 0; top: 0; display: grid; place-items: center; background: #3b3f52; color: #fde68a; font-size: 18px; }
.facecam-stage { position: relative; display: inline-block; max-width: 100%; border-radius: 8px; overflow: hidden; line-height: 0; }
.facecam-stage img { max-width: 100%; display: block; }
.facecam-box { position: absolute; border: 3px solid #22c55e; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border-radius: 3px; pointer-events: none; }
.pv .fg { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); background: linear-gradient(135deg, #7c5cff, #ff2d55); border-top: 1px solid rgba(255,255,255,.4); border-bottom: 1px solid rgba(255,255,255,.4); }

/* ---------- project */
.project-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; cursor: pointer; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.project-thumb { aspect-ratio: 16 / 9; background: var(--panel-3) center / cover no-repeat; display: grid; place-items: center; color: var(--faint); font-size: 30px; position: relative; }
.project-thumb .badge { position: absolute; top: 10px; left: 10px; }
.project-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

.timeline { position: relative; height: 38px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.timeline .seg { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: white; border-right: 2px solid var(--panel); cursor: pointer; transition: filter .15s; overflow: hidden; }
.timeline .seg:hover { filter: brightness(1.2); }
.timeline .seg.approved { box-shadow: inset 0 -3px 0 var(--success); }
.timeline .excluded { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(239,68,68,.25) 0 6px, rgba(239,68,68,.1) 6px 12px); display: grid; place-items: center; font-size: 10.5px; color: #fca5a5; font-weight: 650; }
.timeline .gap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(245,158,11,.35) 0 4px, transparent 4px 8px); }
.timeline-legend { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-size: 11.5px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sticky-toolbar { position: sticky; top: 61px; z-index: 10; background: rgba(10,12,17,.92); backdrop-filter: blur(8px); padding: 12px 0; margin: 0 0 8px; border-bottom: 1px solid var(--border); }

.clips { display: flex; flex-direction: column; gap: 16px; }
.clip { display: grid; grid-template-columns: 210px 1fr; gap: 20px; padding: 16px; }
.clip.approved { border-color: rgba(34,197,94,.35); }
.clip-video { position: relative; width: 210px; border-radius: 12px; overflow: hidden; background: #000; align-self: start; }
.clip-video video, .clip-video img { width: 100%; display: block; }
.clip-video .ph { display: grid; place-items: center; color: var(--muted); gap: 10px; padding: 12px; text-align: center; }
.clip-video.v916 { aspect-ratio: 9 / 16; }
.clip-video.v11 { aspect-ratio: 1; }
.clip-video.v45 { aspect-ratio: 4 / 5; }
.clip-video.v169 { aspect-ratio: 16 / 9; }
.part-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 74px; padding: 5px 12px; border-radius: 9px; background: linear-gradient(135deg, var(--pink), #ff6b81); color: white; font-weight: 800; font-size: 13px; letter-spacing: 0.02em; }
.clip-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.clip-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.clip-meta b { color: var(--text); font-weight: 600; }
.caption-box { position: relative; }
.caption-box .count { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--faint); pointer-events: none; }
.clip-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.time-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 160px)) auto; gap: 10px; align-items: end; padding: 12px; background: var(--panel-2); border-radius: 11px; border: 1px solid var(--border-2); }
.post-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.post-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border-2); font-size: 11.5px; }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal-head { padding: 10px; font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: rgba(0,0,0,.18); }
.cal-day.other .num { color: var(--faint); }
.cal-day.today .num { background: var(--accent); color: white; }
.cal-day .num { font-size: 12px; font-weight: 650; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-event { display: flex; align-items: center; gap: 5px; padding: 3px 6px 3px 3px; border-radius: 7px; background: var(--panel-3); font-size: 11.5px; cursor: pointer; min-width: 0; border-left: 3px solid var(--accent); }
.cal-event:hover { filter: brightness(1.15); }
.cal-event .pf { width: 16px; height: 16px; font-size: 7.5px; border-radius: 5px; }
.cal-event.published { border-left-color: var(--success); }
.cal-event.failed { border-left-color: var(--danger); }
.cal-event.waiting { border-left-color: var(--warning); }
.cal-event.cancelled { opacity: .45; text-decoration: line-through; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }

/* ---------- modal / toast / drawer */
.overlay { position: fixed; inset: 0; background: rgba(3, 4, 8, 0.7); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); animation: pop .18s ease; }
.modal.wide { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--panel); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: pop .2s; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }
.toast.success { border-color: rgba(34, 197, 94, 0.5); }
.toast.warning { border-color: rgba(251, 191, 36, 0.6); }

.bell { position: relative; }
.bell .count { position: absolute; top: -3px; right: -3px; background: var(--pink); color: white; font-size: 10px; font-weight: 700; border-radius: 99px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; }
.notif-panel { position: absolute; right: 0; top: 44px; width: min(380px, calc(100vw - 30px)); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow); z-index: 50; }
.notif { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; cursor: pointer; }
.notif:hover { background: var(--panel-2); }
.notif.unread { background: rgba(124,92,255,.06); }
.notif .lvl { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }

/* ---------- auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, rgba(124,92,255,.18), transparent), radial-gradient(900px 500px at 110% 110%, rgba(255,45,85,.12), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); }

/* ---------- responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; width: 260px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 80px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sticky-toolbar { top: 59px; }
  .cal-day { min-height: 76px; padding: 4px; }
  .cal-event .lbl { display: none; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clip { grid-template-columns: 1fr; }
  .clip-video { width: 100%; max-width: 280px; margin: 0 auto; }
  .time-editor { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 22px; }
  .page-head h1 { font-size: 20px; }
  .modal-body, .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
}
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; }
.btn.disabled { opacity: .45; pointer-events: none; }
@media (max-width: 640px) { .sticky-toolbar { position: static; } }

/* ---------- phone app */
.tabbar { display: none; }
.home-hero { margin-bottom: 16px; }
.home-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.home-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); color: var(--text); text-align: left; cursor: pointer; transition: transform .1s, border-color .15s; min-height: 118px; }
.home-tile:active { transform: scale(.98); }
.home-tile:hover { border-color: var(--border-2); }
.home-tile.accent { border-color: rgba(124,92,255,.55); background: linear-gradient(160deg, rgba(124,92,255,.18), var(--panel)); }
.home-tile.warn { border-color: rgba(245,158,11,.55); background: linear-gradient(160deg, rgba(245,158,11,.16), var(--panel)); }
.home-tile.live { border-color: rgba(239,68,68,.5); background: linear-gradient(160deg, rgba(239,68,68,.16), var(--panel)); }
.home-icon { font-size: 22px; }
.home-count { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.home-title { font-weight: 700; font-size: 15px; margin-top: auto; }
.home-sub { color: var(--muted); font-size: 12.5px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; }
.thumb-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.thumb { position: relative; flex: none; width: 96px; aspect-ratio: 9 / 16; border-radius: 12px; border: 1px solid var(--border-2); background: var(--panel-3) center / cover no-repeat; cursor: pointer; scroll-snap-align: start; }
.q-badge { position: absolute; top: 6px; right: 6px; min-width: 26px; padding: 2px 6px; border-radius: 99px; font-size: 11px; font-weight: 800; color: #0a0c11; background: #94a3b8; }
.q-badge.great { background: #4ade80; } .q-badge.good { background: #7dd3fc; } .q-badge.weak { background: #fbbf24; } .q-badge.poor { background: #f87171; }
.q-badge.big { top: 10px; right: 10px; font-size: 14px; padding: 4px 10px; }
.review { max-width: 480px; margin: 0 auto; }
.review-video { position: relative; width: 100%; max-height: 64vh; margin: 0 auto; background: #000; border-radius: 18px; overflow: hidden; display: flex; justify-content: center; }
.review-video video { height: 100%; width: 100%; object-fit: contain; display: block; }
.review-checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.review-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 16px; }
.review-actions .btn { padding: 14px 8px; font-size: 15px; }
.caption-preview { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.pair-input { font-size: 30px; letter-spacing: 12px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pair-code { font-size: 38px; font-weight: 800; letter-spacing: 6px; margin: 10px 0 2px; font-variant-numeric: tabular-nums; color: #fff; }
.phone-setup { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qr { width: 190px; height: 190px; background: #fff; border-radius: 14px; padding: 6px; flex: none; }
.qr svg { width: 100%; height: 100%; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; line-height: 1.5; flex: 1; min-width: 240px; }

@media (max-width: 900px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: rgba(13,15,21,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .tabbar a.on { color: var(--text); }
  .tabbar a.on .tab-icon { color: var(--accent-hover); }
  .tab-icon { position: relative; font-size: 20px; line-height: 1.1; }
  .tab-badge { position: absolute; top: -4px; right: -14px; background: var(--pink); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 5px; min-width: 16px; text-align: center; }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) { .topbar { padding-top: calc(10px + env(safe-area-inset-top)); } }

/* ---------- bot control room */
.scanner { display: flex; flex-direction: column; gap: 12px; }
.score-bar { position: relative; height: 12px; background: var(--panel-3); border-radius: 99px; overflow: visible; margin-top: 6px; }
.score-bar > div { height: 100%; border-radius: 99px; transition: width .6s ease, background .3s; }
.score-line { position: absolute; top: -3px; bottom: -3px; right: 0; width: 2px; background: #f59e0b; }
.sig-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.sig { display: grid; grid-template-columns: 110px 1fr 52px; align-items: center; gap: 8px; }
.sig-bar { height: 6px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.sig-bar > div { height: 100%; border-radius: 99px; transition: width .6s ease; }
.feed { overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); font-size: 12.5px; }
.feed-row { display: grid; grid-template-columns: 70px 120px 1fr; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--border); line-height: 1.45; }
.feed-row:last-child { border-bottom: 0; }
.feed-time { color: var(--faint); }
.feed-bot { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checks { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.check-row { display: grid; grid-template-columns: 18px 150px 1fr; gap: 6px; font-size: 12.5px; padding: 4px 8px; border-radius: 7px; background: var(--panel-2); }
.check-row.pass > span:first-child { color: #4ade80; } .check-row.warn > span:first-child { color: #fbbf24; } .check-row.fail > span:first-child { color: #f87171; }
@media (max-width: 640px) {
  .feed-row { grid-template-columns: 58px 1fr; }
  .feed-row .feed-msg { grid-column: 1 / -1; }
  .check-row { grid-template-columns: 18px 1fr; }
  .check-row > span:last-child { grid-column: 2; }
}
.feed-time { white-space: nowrap; }
@media (max-width: 640px) { .feed-row { grid-template-columns: auto 1fr; } }
.clip-video .ph.cleaned { background-size: cover; background-position: center; box-shadow: inset 0 0 0 2000px rgba(0, 0, 0, .62); color: #e5e7eb; }
.guide { padding: 0; overflow: hidden; }
.guide.done { border-color: rgba(74, 222, 128, .35); }
.guide-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; cursor: pointer; }
.guide-head:hover { background: var(--panel-2); }
.guide-icon { font-size: 22px; width: 30px; text-align: center; flex: none; }
.guide-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.guide-body .steps { margin-top: 12px; font-size: 14px; }
.guide-fields { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.guide-fields .grid { width: 100%; }
.copy-box { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: 4px 6px 0 0; padding: 4px 4px 4px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border-2); }
.copy-box code { overflow-wrap: anywhere; font-size: 12.5px; }
.level-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.level-btn { all: unset; box-sizing: border-box; cursor: pointer; text-align: center; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.level-btn:hover { border-color: var(--accent); }
.level-btn.on { border-color: var(--accent); background: rgba(139, 92, 246, .18); box-shadow: 0 0 0 1px var(--accent) inset; }
.level-dots { color: var(--accent-hover); letter-spacing: 2px; font-size: 11px; }
.output-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.output-stats > div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.output-stats .k { font-size: 12px; color: var(--muted); }
.output-stats .v { font-size: 22px; font-weight: 800; margin: 2px 0; }
@media (max-width: 600px) { .level-row { grid-template-columns: repeat(3, 1fr); } .output-stats { grid-template-columns: 1fr; } }
.autopilot { border: 1px solid var(--border-2); border-radius: 12px; padding: 10px 12px; background: var(--panel); }
.ap-counts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 10px; text-align: center; }
.ap-counts div { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.ap-counts b { font-size: 16px; color: var(--text); }
