:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7ee;
  --accent: #5b5bd6;
  --accent-2: #4646b8;
  --accent-soft: #eeeefc;
  --danger: #d64545;
  --ok: #1f9d55;
  --warn: #c98a12;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 8px 24px -12px rgba(20, 20, 40, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: #c9cbdc; background: #fafaff; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fdf1f1; border-color: #f2c6c6; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.lg { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 80px; resize: vertical; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { width: auto; }

/* layout */
.topbar { flex-wrap: wrap; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 10px 24px; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.nav a.active, .nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

/* video cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: .15s; display: block; color: inherit; }
.card:hover { transform: translateY(-2px); text-decoration: none; border-color: #cfd1e6; }
.card .thumb { aspect-ratio: 16/9; background: #1c1d26 center/cover no-repeat; position: relative; }
.card .thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.card .body { padding: 12px 14px; }
.card .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; margin-top: 4px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: #e6f6ec; color: var(--ok); }
.pill.warn { background: #fff5e0; color: var(--warn); }
.pill.gray { background: #eef0f5; color: var(--muted); }

/* retention chart */
.chart { position: relative; height: 140px; }
.chart svg { width: 100%; height: 100%; display: block; }

/* transcript */
.transcript { max-height: 380px; overflow: auto; }
.seg { display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.seg:hover, .seg.active { background: var(--accent-soft); }
.seg .t { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 42px; font-size: 13px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: none; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* toast & modal */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #16181d; color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 100; box-shadow: var(--shadow); }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 16, 30, .5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 480px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.dropdown { position: absolute; right: 0; top: 44px; width: 340px; max-height: 420px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 30; }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.notif.unread { background: var(--accent-soft); }
.notif .when { color: var(--muted); font-size: 12px; }
.bell { position: relative; }
.bell .badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

.code { background: #f1f2f8; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.player-wrap video { width: 100%; height: 100%; display: block; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.timeline-item { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.timeline-item .when { color: var(--muted); min-width: 120px; }
.ranges { position: relative; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; min-width: 120px; }
.ranges i { position: absolute; top: 0; bottom: 0; background: var(--accent); }

@media (max-width: 720px) { .nav { display: none; } .topbar { padding: 8px 14px; gap: 8px; } .container { padding: 18px 14px 50px; } }
