/* Veyro Web console: light and dark themes (data-theme on <html>, set by theme.js). */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --hover: #eef2f6;
  --border: #e2e7ee;
  --text: #1c2433;
  --muted: #687589;
  --accent: #0b9fb3;
  --accent-strong: #08879a;
  --accent-ink: #ffffff;
  --accent-soft: #e4f6f8;
  --accent-line: #b5e5ec;
  --danger: #d6364a;
  --danger-soft: #fdecee;
  --warning: #b26b00;
  --warning-soft: #fff4e0;
  --success: #15944f;
  --success-soft: #e6f6ed;
  --shadow: 0 1px 2px #1c243310, 0 1px 3px #1c24330a;
  --chart-grid: #e7ebf0;
  --chart-session: #c3ccd8;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080c13;
  --surface: #0f1621;
  --surface-2: #151e2c;
  --hover: #18222f;
  --border: #223047;
  --text: #e8eef6;
  --muted: #8a9ab0;
  --accent: #19e3f2;
  --accent-strong: #00c2d4;
  --accent-ink: #04212a;
  --accent-soft: #19e3f214;
  --accent-line: #19e3f255;
  --danger: #ff5c6c;
  --danger-soft: #ff5c6c1a;
  --warning: #ffb547;
  --warning-soft: #ffb54714;
  --success: #3ddc97;
  --success-soft: #3ddc9714;
  --shadow: none;
  --chart-grid: #223047;
  --chart-session: #3a4a62;
}
:root {
  --radius: 12px;
  --sidebar: 236px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
.legal { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; line-height: 1.55; }
.legal .brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--text); }
.legal .brand img { width: 36px; height: 36px; }
.legal h2 { font-size: 1.1rem; margin: 1.4em 0 0.4em; }
.legal li { margin: 0.25em 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0; letter-spacing: -0.01em; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0 0 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
h2 .icon { color: var(--accent); }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { --sidebar: 72px; }
.shell.signed-out { grid-template-columns: minmax(0, 1fr); }
.shell.signed-out .sidebar, .shell.signed-out .menu-button { display: none; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; object-fit: cover; border-radius: 10px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: 0.78rem; }
nav#nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { margin-top: 14px; }
.nav-title { padding: 6px 10px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 2px 0; border-radius: 9px; color: var(--text); font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--hover); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
[data-theme="dark"] .nav-link.active { color: var(--accent); }
.nav-link.active .icon { color: inherit; }
.sidebar-foot { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }
.shell.collapsed .brand-text, .shell.collapsed .nav-title span, .shell.collapsed .nav-link span { display: none; }
.shell.collapsed .nav-link { justify-content: center; }
.shell.collapsed .nav-title { height: 1px; padding: 0; margin: 10px 8px; background: var(--border); }
.shell.collapsed .brand { justify-content: center; padding-inline: 0; }
.shell.collapsed #collapse .icon { transform: rotate(180deg); }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.context { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.context .muted { font-weight: 400; }
.context .brand-inline { display: flex; align-items: center; gap: 10px; color: var(--text); }
.context .brand-inline img { width: 32px; height: 32px; border-radius: 8px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-button:hover { background: var(--hover); }
.menu-button { display: none; }
.user { position: relative; }
.user-button { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-weight: 500; }
.user-button:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.8rem; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.large { width: 72px; height: 72px; font-size: 1.4rem; }
.profile-row { gap: 16px; align-items: center; }
.context .compact-brand { display: none; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px #0003; padding: 6px; display: none; }
.user-menu.open { display: block; }
.user-menu .who { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: none; font: inherit; cursor: pointer; text-align: left; }
.user-menu a:hover, .user-menu button:hover { background: var(--hover); text-decoration: none; }

main { width: 100%; max-width: 1280px; padding: 32px; }
/* Session page: video, charts and side panel use the full width of the screen. */
main.session-page { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.section-title { font-size: 1.05rem; font-weight: 600; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.error { color: var(--danger); }
.warning { color: var(--warning); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.gap { height: 16px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 6px 8px; }
.notice { border-radius: 10px; padding: 12px 14px; background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.notice.info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.stat .label .icon { color: var(--accent); }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 0.8rem; color: var(--muted); }
.stat .hint.good { color: var(--success); }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.actions-grid .button { justify-content: center; padding: 12px 16px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin-top: 16px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list .icon { color: var(--muted); }
.list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Controls */
button, .button { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; gap: 8px; }
button:hover, .button:hover { background: var(--accent-strong); text-decoration: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { background: var(--hover); border-color: var(--accent-line); }
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
button.ghost:hover { color: var(--text); background: var(--hover); }
button.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
button.danger:hover { background: var(--danger-soft); }
button.danger.solid { background: var(--danger); color: white; }
button.small { padding: 5px 10px; font-size: 0.82rem; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; }
.chip:hover { background: var(--hover); }
.chip.selected { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-strong); }
[data-theme="dark"] .chip.selected { color: var(--accent); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill.admin { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-line); }
[data-theme="dark"] .pill.admin { color: var(--accent); }
.pill.active { color: var(--success); background: var(--success-soft); border-color: transparent; }
.pill.disabled { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill.warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.tabs:empty { display: none; }
.tabs button { flex: 1; background: transparent; color: var(--muted); }
.tabs button.selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Sign-in */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; min-height: calc(100vh - 140px); max-width: 1100px; margin: 0 auto; }
.auth .hero img { width: min(100%, 500px); display: block; border-radius: 18px; box-shadow: 0 18px 40px #0b1a2a30; }
.auth .hero p { color: var(--muted); max-width: 460px; line-height: 1.5; }
.auth form { max-width: 400px; width: 100%; justify-self: center; }

/* Sessions */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.session-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; transition: border-color 0.15s, transform 0.15s; }
.session-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.session-card .cover { display: flex; align-items: flex-end; justify-content: space-between; height: 112px; padding: 14px 16px;
  background: linear-gradient(135deg, #0d3a4a, #0f1d2c 65%); color: #e8eef6; }
.session-card .cover:hover { text-decoration: none; }
.session-card .cover .pill { background: #ffffff1a; color: #e8eef6; border-color: #ffffff33; }
.session-card .day { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.session-card .month { color: #19e3f2; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; }
.session-card .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.session-card .title { font-weight: 600; color: var(--text); }
.session-card .actions { display: flex; justify-content: space-between; align-items: center; padding: 0 12px 12px 16px; }
.empty { text-align: center; padding: 48px 20px; }
.empty img { height: 64px; border-radius: 14px; }
.empty ol { text-align: left; display: inline-block; color: var(--muted); line-height: 1.8; }

/* Player */
.back { color: var(--muted); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.session-head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.session-head h1 { font-size: 1.2rem; margin: 0; }
.session-head .back-button { width: 32px; height: 32px; margin-left: -6px; color: var(--muted); }
.player { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; margin-top: 12px; }
.video-wrap { position: relative; background: black; border-radius: var(--radius); border: 1px solid var(--border); }
.video-stage { position: relative; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.video-stage video { width: 100%; display: block; max-height: 72vh; cursor: pointer; }
/* One player bar: the session timeline over play, time, sound, speed, layers and full screen. */
.video-controls { background: #0b1017; color: #e6edf5; padding: 2px 8px 4px; border-radius: 0 0 var(--radius) var(--radius); }
.control-row { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; min-height: 34px; }
.control-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: none; border-radius: 8px;
  background: transparent; color: inherit; cursor: pointer; }
.control-button:hover { background: #ffffff1a; }
.video-controls .clock { margin-left: 4px; }
.player-time { color: #9fb0c3; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.volume { width: 72px; padding: 0; border: none; background: none; accent-color: var(--accent); }
.speed { background: transparent; color: inherit; border: 1px solid #ffffff2a; border-radius: 7px; padding: 3px 6px; font-size: 0.8rem; }
.speed option { color: #111; }
.session-bar { width: 100%; height: 26px; display: block; cursor: pointer; touch-action: none; }
/* Values on the video: one thin strip; size S/M/L from the Layers menu. */
.overlay { position: absolute; top: 10px; left: 10px; display: flex; pointer-events: none; padding: 4px 2px; border-radius: 9px;
  background: #05080d99; color: white; font-variant-numeric: tabular-nums; }
.overlay .value { display: flex; flex-direction: column; padding: 0 9px; line-height: 1.15; }
.overlay .value + .value { border-left: 1px solid #ffffff26; }
.overlay .value-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: #b8c4d4; }
.overlay .value strong { font-size: 0.95rem; }
.overlay .value.stale { opacity: 0.45; }
.overlay.size-s .value strong { font-size: 0.8rem; }
.overlay.size-s .value-label { font-size: 0.55rem; }
.overlay.size-l .value strong { font-size: 1.35rem; }
.overlay.size-l .value-label { font-size: 0.7rem; }
.mini-map { position: absolute; top: 10px; right: 10px; width: 22%; min-width: 120px; max-width: 220px; aspect-ratio: 1; border-radius: 10px;
  background: #05080d99; cursor: pointer; }
.video-chart { position: absolute; left: 10px; bottom: 10px; width: calc(100% - 20px); height: 24%; min-height: 90px; border-radius: 10px;
  background: #05080d8c; cursor: col-resize; touch-action: none; }
.video-wrap:fullscreen { display: flex; flex-direction: column; border: none; border-radius: 0; }
.video-wrap:fullscreen .video-stage { flex: 1; min-height: 0; display: flex; align-items: center; border-radius: 0; }
.video-wrap:fullscreen video { max-height: none !important; height: 100%; }
.video-wrap:fullscreen .video-controls { border-radius: 0; }
/* Popovers (Layers, ⋯) */
.popover-anchor { position: relative; display: inline-flex; }
.popover { position: absolute; right: 0; z-index: 40; min-width: 230px; max-height: 70vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px #0004; }
.popover.up { bottom: calc(100% + 8px); }
.popover.down { top: calc(100% + 6px); }
.popover-title { font-weight: 600; }
.popover label.row { flex-direction: row; align-items: center; gap: 8px; }
.popover input[type="checkbox"] { margin: 0; padding: 0; }
table.layers { border-collapse: collapse; font-size: 0.85rem; }
table.layers th, table.layers td { padding: 4px 8px; text-align: center; border: none; }
table.layers th:first-child, table.layers td:first-child { text-align: left; }
table.layers th { font-weight: 500; color: var(--muted); font-size: 0.72rem; text-transform: none; letter-spacing: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 8px; background: none;
  color: var(--text); font: inherit; cursor: pointer; text-align: left; white-space: nowrap; }
.menu-item:hover { background: var(--hover); }
.menu-item:disabled { opacity: 0.5; cursor: default; }
.menu-check { margin-left: auto; color: var(--accent); }
.layers-button { display: inline-flex; align-items: center; gap: 6px; }
table.shortcuts td { padding: 5px 8px; border: none; }
kbd { font: 600 0.8rem ui-monospace, monospace; padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; }
.side .card { padding: 14px; }
.player.side-hidden { grid-template-columns: minmax(0, 1fr); }
.player-main .charts { margin-top: 0; }
/* Cards that fold to their title */
details.fold > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary svg { color: var(--muted); transition: transform 0.15s; }
details.fold:not([open]) > summary svg { transform: rotate(-90deg); }
details.fold > .fold-body { margin-top: 12px; }
details.fold:not([open]) { padding-top: 10px; padding-bottom: 10px; }
.track { width: 100%; aspect-ratio: 1; display: block; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.clock { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
/* One card, one time axis: every chart shares it, so moments line up vertically. */
.charts { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.charts .charts-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 4px; }
.charts-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip.small-chip { padding: 3px 10px; font-size: 0.8rem; }
.chart-row { position: relative; }
.chart-label { position: absolute; top: 2px; left: 6px; z-index: 1; font-size: 0.72rem; color: var(--muted); pointer-events: none; }
.chart-actions { position: absolute; top: 2px; right: 56px; z-index: 1; display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.chart-row:hover .chart-actions, .chart-row:focus-within .chart-actions { opacity: 1; }
.icon-button.tiny { width: 24px; height: 24px; border-radius: 6px; font-size: 0.9rem; line-height: 1; background: var(--surface); }
.time-axis { width: 100%; height: 18px; display: block; }
.chart-tip { position: absolute; top: 40px; z-index: 5; pointer-events: none; padding: 6px 8px; white-space: nowrap; transform: translateX(10px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.chart-tip.left { transform: translateX(calc(-100% - 10px)); }
.frame-strip { width: 100%; height: 64px; display: block; border-radius: 6px; cursor: pointer; }
.clip-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: thin; }
.chip.clip-chip { flex: none; display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; font-size: 0.8rem; }
.chip.clip-chip strong { font-weight: 600; }
.chip.clip-chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.clip-chip.selected span { color: inherit; }
.chart { width: 100%; height: 96px; display: block; cursor: col-resize; touch-action: none; }
.chart.aligning { cursor: crosshair; height: 120px; }
/* Sync mode: a separate editing state with its own controls and an explicit Save at the bottom. */
[hidden] { display: none !important; }
.player.syncing .video-wrap { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Smaller video while syncing, so the frame and the charts below fit on one screen. */
.player.syncing .video-stage video { max-height: 42vh; }
.sync-panel { border-color: var(--accent-line); }
.sync-panel .steps { margin: 0; padding-left: 20px; line-height: 1.6; }
.sync-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.sync-controls input[type="time"] { padding: 6px 10px; min-width: 9.5em; font-variant-numeric: tabular-nums; }
.sync-controls label.row { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; }
.sync-controls input[type="checkbox"] { flex: none; margin: 0; padding: 0; }
.sync-footer { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: var(--radius); box-shadow: 0 10px 30px #0003; }
.sync-footer svg { color: var(--accent); }
.linklike { background: none; border: none; padding: 0; color: var(--accent-strong); font: inherit; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
tr.selected td { background: var(--accent-soft); }
.section-title + p.muted { margin-top: -4px; }

/* Upload */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 48px 20px; text-align: center; background: var(--surface); transition: border-color 0.15s, background 0.15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { color: var(--accent); margin-bottom: 8px; }
.dropzone strong { display: block; font-size: 1.1rem; margin-bottom: 6px; }
.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px 120px; gap: 12px; align-items: center; }
progress { width: 100%; height: 8px; appearance: none; border: none; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }
td select { padding: 6px 8px; }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.secret { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.secret code { flex: 1; user-select: all; word-break: break-all; color: var(--accent-strong); }
[data-theme="dark"] .secret code { color: var(--accent); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { display: flex; flex-direction: row; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; color: var(--text); }
.option input { margin-top: 3px; }
.option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }

/* Dialog and toasts */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 60px #0004; }
dialog::backdrop { background: #0008; backdrop-filter: blur(2px); }
dialog .row { justify-content: flex-end; margin-top: 18px; }
dialog.wide { width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
dialog h3 { font-size: 0.78rem; margin: 20px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
dialog textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; resize: vertical; }
dialog .row.share-row { justify-content: flex-start; margin-top: 0; }
.share-row input[type=email] { flex: 1; min-width: 200px; }
.share-row label.inline { flex-direction: row; align-items: center; gap: 8px; }
.share-list li { padding: 8px 0; }
.share-list select { padding: 5px 8px; }
.share-status { color: var(--success); min-height: 1.2em; margin: 8px 0 0; }
.narrow { max-width: 520px; margin: 40px auto; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--success); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px #0003; max-width: 360px; }
.toast.error { border-left-color: var(--danger); }

/* Graded video: WebGL draws the frames on a canvas over the (then invisible) video element. */
.grade-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
.video-stage.graded .grade-canvas { display: block; }
.video-stage.graded video { opacity: 0; }

/* Videos, data and edits page */
.button.small { padding: 5px 10px; font-size: 0.82rem; }
.tabular { font-variant-numeric: tabular-nums; }
.editor { border-color: var(--accent-line); margin-bottom: 16px; }
.editor h2, .editor h3 { margin: 0; }
.editor h3 { font-size: 0.95rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.editor-stage video { max-height: 46vh; }
.editor label.small { display: flex; flex-direction: column; gap: 4px; }
.editor label.row.small { flex-direction: row; }
.slider-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 5em; gap: 8px; align-items: center; font-size: 0.85rem; }
.slider-row input { padding: 0; }
.slider-row[hidden] { display: none; }
.trim .charts-card { position: relative; }
.trim-chart { cursor: pointer; }
input.point { width: 6.5em; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.notice.row .grow { flex: 1; }
.providers .button { justify-content: center; }
.divider { display: flex; align-items: center; gap: 10px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.files-page .editor { margin-bottom: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform 0.2s; box-shadow: 0 0 40px #0005; }
  .shell.menu-open .sidebar { transform: none; }
  .shell.collapsed .brand-text, .shell.collapsed .nav-link span, .shell.collapsed .nav-title span { display: initial; }
  .sidebar-foot { display: none; }
  .menu-button { display: inline-flex; }
  .context .compact-brand { display: flex; }
  .topbar { padding: 0 14px; }
  .user-button .name { display: none; }
  main { padding: 18px 14px; }
  .auth { grid-template-columns: 1fr; }
  .auth .hero { display: none; }
  .player { grid-template-columns: 1fr; }
  .side { position: static; }
  .progress-row { grid-template-columns: 1fr; }
  .charts, .two-col { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
}
