:root {
  --bg: #0e0e10;
  --panel: #151518;
  --panel-2: #1b1b1f;
  --line: #26262c;
  --line-2: #33333a;
  --text: #ecebe8;
  --muted: #8d8c93;
  --faint: #5c5b62;
  --accent: #e8b04b;
  --accent-ink: #1a1306;
  --accent-soft: rgba(232, 176, 75, 0.14);
  --ok: #5fbf8a;
  --danger: #e5675c;
  --radius: 10px;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* knappar & fält */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #222227; border-color: #3d3d45; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #f0bd5e; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }
.input, .select, .textarea { width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: #101013; outline: none; }
.textarea { height: auto; padding: 10px 12px; resize: none; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238d8c93' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* toppfält */
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: .2px; text-decoration: none; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: #141416; border: 1px solid var(--line-2); display: grid; place-items: center; }
.brand-mark svg { width: 12px; height: 12px; fill: var(--accent); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }

/* sidor */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 680; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #3a3a42; transform: translateY(-1px); }
.thumb { aspect-ratio: 16/9; background: #0a0a0b center/cover no-repeat; position: relative; display: grid; place-items: center; color: var(--faint); }
.thumb svg { width: 34px; height: 34px; opacity: .5; }
.thumb .badge { position: absolute; bottom: 8px; right: 8px; }
.thumb .badge.left { right: auto; left: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: rgba(0,0,0,.72); color: #ddd; font-family: var(--mono); }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.card-body { padding: 12px 14px 14px; display: flex; gap: 8px; align-items: flex-start; }
.card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 10px; }
.card-meta .open { color: var(--accent); }
.card .menu-btn { margin-left: auto; width: 28px; height: 28px; opacity: 0; }
.card:hover .menu-btn, .card .menu-btn:focus { opacity: 1; }
.empty { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 60px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.dropzone-overlay { position: fixed; inset: 0; background: rgba(14,14,16,.86); border: 2px dashed var(--accent); z-index: 50; display: grid; place-items: center; font-size: 20px; font-weight: 600; color: var(--accent); pointer-events: none; }

/* inloggning / gäst */
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 16px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.auth-card .brand { margin-bottom: 4px; }

/* granskningsvy */
.review { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.review-main { flex: 1; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #08080a; }
.stage { flex: 1; position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage canvas.draw { position: absolute; pointer-events: none; }
.stage canvas.draw.drawing { pointer-events: auto; cursor: crosshair; }
.stage .stage-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.draw-tools { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: rgba(21,21,24,.94); border: 1px solid var(--line-2); border-radius: 10px; z-index: 5; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.active { border-color: #fff; }
.draw-tools .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }

.controls { background: var(--panel); border-top: 1px solid var(--line); padding: 6px 14px 8px; }
.timeline { position: relative; height: 30px; cursor: pointer; user-select: none; touch-action: none; }
.track { position: absolute; left: 0; right: 0; top: 13px; height: 4px; border-radius: 2px; background: #2a2a31; }
.timeline:hover .track { height: 6px; top: 12px; }
.track .buffered { position: absolute; left: 0; top: 0; bottom: 0; background: #3a3a43; border-radius: 2px; }
.track .progress { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
.track .range-sel { position: absolute; top: -4px; bottom: -4px; background: rgba(232,176,75,.25); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.playhead { position: absolute; top: 8px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }
.markers { position: absolute; left: 0; right: 0; top: 0; height: 10px; }
.marker { position: absolute; top: 0; height: 8px; min-width: 8px; margin-left: -4px; border-radius: 4px; background: var(--accent); cursor: pointer; border: 1.5px solid #151518; }
.marker.range { margin-left: 0; border-radius: 3px; opacity: .85; }
.marker.resolved { background: #4c4c55; }
.marker.sel { background: #fff; z-index: 2; }
.hover-tip { position: absolute; bottom: 34px; transform: translateX(-50%); background: #000; border: 1px solid var(--line-2); padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 10; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.ctrl-row { display: flex; align-items: center; gap: 4px; }
.tc-display { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; padding: 0 10px; letter-spacing: .3px; }
.tc-display .dur { color: var(--faint); }
.ctrl-row .select { height: 30px; width: auto; font-size: 12.5px; background-color: transparent; border-color: var(--line); }
.vol { width: 80px; accent-color: var(--accent); }

.sidebar { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.side-head .filters { display: flex; gap: 6px; margin-left: auto; }
.side-head h2 { margin: 0; font-size: 14px; font-weight: 650; white-space: nowrap; }
.side-head .count { color: var(--muted); font-weight: 500; }
.side-head .select { height: 30px; font-size: 12.5px; width: auto; }
.comment-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.comment { padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
.comment:hover { background: #18181c; }
.comment.sel { background: #1d1b16; box-shadow: inset 3px 0 0 var(--accent); }
.comment.resolved > .c-main { opacity: .5; }
.c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #111; flex: none; }
.c-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.c-time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.tag { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); }
.tc-btn { margin-right: 4px; vertical-align: 1px; font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); border: 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.tc-btn:hover { background: rgba(232,176,75,.25); }
.c-body { white-space: pre-wrap; word-wrap: break-word; margin: 6px 0 2px; }
.c-actions { display: flex; gap: 2px; margin-top: 6px; margin-left: -8px; }
.c-actions .btn { height: 26px; padding: 0 8px; font-size: 12.5px; color: var(--muted); }
.c-actions .btn:hover { color: var(--text); }
.c-actions .btn.on { color: var(--ok); }
.replies { margin: 8px 0 0 32px; border-left: 2px solid var(--line-2); padding-left: 12px; display: grid; gap: 10px; }
.reply .c-body { margin-top: 2px; }
.reply-box { margin-top: 8px; display: grid; gap: 6px; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px 14px; display: grid; gap: 8px; background: var(--panel); }
.composer-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 12.5px; }
.chip.off { background: var(--panel-2); color: var(--muted); padding-right: 10px; cursor: pointer; font-family: var(--sans); }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.composer .hint { font-size: 11.5px; color: var(--faint); }
kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); }

/* popover-meny */
.menu { position: fixed; z-index: 80; min-width: 190px; background: #1d1d21; border: 1px solid var(--line-2); border-radius: 10px; padding: 5px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: #2a2a30; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.menu .menu-label { font-size: 11px; color: var(--faint); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .6px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal.wide { max-width: 580px; }
.modal-head { padding: 18px 20px 0; font-size: 16px; font-weight: 650; }
.modal-body { padding: 14px 20px; display: grid; gap: 14px; }
.modal-foot { padding: 4px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.share-list { display: grid; gap: 8px; }
.share-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #121215; }
.share-item .url { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.share-item .lbl { font-weight: 600; font-size: 13px; }
.divider { border-top: 1px solid var(--line); }

/* uppladdningar */
.uploads { position: fixed; right: 18px; bottom: 18px; width: 320px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 60; overflow: hidden; }
.uploads-head { padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.upload-item { padding: 10px 14px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.upload-item:last-child { border-bottom: 0; }
.upload-item .row { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.upload-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; background: #2a2a31; border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.upload-item.done .bar > div { background: var(--ok); }
.upload-item.error .bar > div { background: var(--danger); }

/* toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { background: #23232a; border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 9px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: tin .18s ease-out; }
.toast.err { border-color: rgba(229,103,92,.5); }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 900px) {
  .review { height: auto; min-height: 100vh; overflow: visible; }
  .review-main { grid-template-columns: 1fr; }
  .stage { height: 56vw; flex: none; }
  .sidebar { border-left: 0; border-top: 1px solid var(--line); min-height: 60vh; }
  .vol, .hide-sm, .tc-display .dur, .tc-display .dur + span, .composer .hint { display: none; }
  .tc-display { white-space: nowrap; }
}
@media print { body { background: #fff; color: #000; } }
