/* Portal tokens copied from review.brighterway.ai/app.css. Page styles follow. */
:root {
  /* --- Brand orange (the sun) ----------------------------- */
  --brand-orange: 17 92% 48%;        /* #EC4A0A  inner sun / primary */
  --brand-orange-ring: 24 78% 55%;   /* #E8772E  outer ring / hover  */
  --brand-orange-50: 24 100% 97%;
  --brand-orange-100: 22 100% 93%;
  --brand-orange-200: 21 96% 85%;
  --brand-orange-300: 20 95% 75%;
  --brand-orange-400: 21 90% 62%;
  --brand-orange-500: 17 92% 48%;
  --brand-orange-600: 16 88% 42%;
  --brand-orange-700: 15 82% 35%;

  /* --- Neutrals (shadcn neutral scale, HSL) --------------- */
  --neutral-0:    0 0% 100%;
  --neutral-50:   0 0% 98%;
  --neutral-100:  0 0% 96.1%;
  --neutral-200:  0 0% 89.8%;
  --neutral-300:  0 0% 83.1%;
  --neutral-400:  0 0% 63.9%;
  --neutral-500:  0 0% 45.1%;
  --neutral-600:  0 0% 32.2%;
  --neutral-700:  0 0% 25.1%;
  --neutral-800:  0 0% 14.9%;
  --neutral-900:  0 0% 9%;
  --neutral-950:  0 0% 3.9%;
  --ink:          330 4% 12%;        /* #231F20  near-black brand text */

  /* --- Status palette ------------------------------------- */
  --status-amber:        38 92% 50%;
  --status-amber-bg:     45 100% 96%;
  --status-amber-fg:     30 80% 32%;
  --status-amber-border: 42 95% 82%;

  --status-blue:         217 91% 60%;
  --status-blue-bg:      214 100% 97%;
  --status-blue-fg:      221 70% 40%;
  --status-blue-border:  213 90% 87%;

  --status-green:        142 71% 38%;
  --status-green-bg:     140 70% 96%;
  --status-green-fg:     143 64% 24%;
  --status-green-border: 142 55% 80%;

  --status-red:          0 84% 60%;
  --status-red-bg:       0 100% 97%;
  --status-red-fg:       0 70% 42%;
  --status-red-border:   0 90% 88%;

  --status-gray:         220 9% 46%;
  --status-gray-bg:      220 14% 96%;
  --status-gray-fg:      220 12% 32%;
  --status-gray-border:  220 13% 85%;

  --status-teal:         173 75% 36%;
  --status-teal-bg:      174 60% 95%;
  --status-teal-fg:      175 70% 22%;
  --status-teal-border:  174 50% 78%;

  /* ========== Semantic aliases (light mode) ============== */
  --background:            var(--neutral-0);
  --foreground:            var(--neutral-950);
  --card:                  var(--neutral-0);
  --card-foreground:       var(--neutral-950);
  --primary:               var(--brand-orange);
  --primary-foreground:    var(--neutral-50);
  --secondary:             var(--neutral-100);
  --secondary-foreground:  var(--neutral-900);
  --muted:                 var(--neutral-100);
  --muted-foreground:      var(--neutral-500);
  --accent:                var(--neutral-100);
  --accent-foreground:     var(--neutral-900);
  --destructive:           var(--status-red);
  --destructive-foreground: var(--neutral-50);
  --border:                var(--neutral-200);
  --input:                 var(--neutral-200);
  --ring:                  var(--brand-orange);

  --surface-page:    var(--neutral-50);
  --surface-card:    var(--neutral-0);
  --surface-sunk:    var(--neutral-100);
  --text-heading:    var(--ink);
  --text-body:       var(--neutral-800);
  --text-muted:      var(--neutral-500);

  /* --- Typography ----------------------------------------- */
  --font-sans: "Figtree", ui-sans-serif, system-ui, -apple-system,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, Menlo, Monaco,
               Consolas, "Liberation Mono", monospace;

  --text-2xs: 0.6875rem;
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base:1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  --leading-tight:   1.15;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;

  --tracking-caps:   0.06em;

  --type-h1:        var(--weight-bold)     var(--text-3xl)/var(--leading-tight) var(--font-sans);
  --type-h2:        var(--weight-semibold) var(--text-2xl)/var(--leading-snug)  var(--font-sans);
  --type-h3:        var(--weight-semibold) var(--text-xl)/var(--leading-snug)   var(--font-sans);
  --type-card-title:var(--weight-semibold) var(--text-lg)/var(--leading-snug)   var(--font-sans);
  --type-body:      var(--weight-normal)   var(--text-base)/var(--leading-relaxed) var(--font-sans);
  --type-small:     var(--weight-normal)   var(--text-sm)/var(--leading-normal) var(--font-sans);
  --type-meta:      var(--weight-medium)   var(--text-xs)/var(--leading-normal) var(--font-sans);
  --type-mono:      var(--weight-normal)   var(--text-sm)/var(--leading-normal) var(--font-mono);

  /* --- Spacing / radius / shadow / motion ----------------- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius:    0.5rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-lg: var(--radius);
  --radius-xl: 0.75rem;
  --radius-pill: 9999px;

  --shadow-xs: 0 1px 2px 0 hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0 hsl(0 0% 0% / 0.08), 0 1px 2px -1px hsl(0 0% 0% / 0.08);
  --shadow-md: 0 4px 8px -2px hsl(0 0% 0% / 0.08), 0 2px 4px -2px hsl(0 0% 0% / 0.06);
  --shadow-focus: 0 0 0 3px hsl(var(--brand-orange) / 0.35);

  --container-max: 1200px;
  --topbar-h: 60px;
  --env-stripe-h: 26px;

  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
}

/* ==========================================================================
   Pages. Plain and large: 16px text, 44px targets, one orange accent for the main action, the current selection,
   the timeline cursor and the claimant's box. Text on tinted surfaces uses neutral-600 (about 7:1); neutral-500 only on
   white or the page (4.5:1 and above).
   ========================================================================== */
:root {
  --text-xs: 1rem;
  --text-sm: 1rem;
  --text-base: 1.0625rem;
  --r: 8px;
  --line: hsl(var(--neutral-200));
  --line-strong: hsl(var(--neutral-400));
  --text-2: hsl(var(--neutral-600));
  --hover: hsl(var(--neutral-100));
  --accent: hsl(var(--brand-orange-600));
  --target: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; background: hsl(var(--surface-page)); }
body { min-height: 100vh; margin: 0; background: hsl(var(--surface-page)); color: hsl(var(--text-body)); font: var(--weight-normal) var(--text-sm)/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-wrap: break-word; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: underline; text-decoration-color: hsl(var(--neutral-400)); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
::selection { background: hsl(var(--brand-orange) / 0.18); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: hsl(var(--ink)); text-wrap: balance; }
h1 { margin-bottom: var(--space-3); font-size: 1.75rem; font-weight: var(--weight-bold); line-height: var(--leading-tight); letter-spacing: -0.01em; }
h2 { margin-bottom: var(--space-3); font-size: 1.25rem; font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
h3 { margin-bottom: var(--space-2); font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.muted { color: var(--text-2); }
.error { color: hsl(var(--status-red-fg)); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: var(--space-3); z-index: 100; padding: var(--space-3) var(--space-4); border-radius: var(--r); background: hsl(var(--neutral-900)); color: hsl(var(--neutral-0)); }
.skip-link:focus-visible { top: var(--space-3); }

/* Top bar: the brand only */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 clamp(var(--space-3), 3vw, var(--space-8)); border-bottom: 1px solid var(--line); background: hsl(var(--surface-card)); }
.brand { display: inline-flex; min-width: 0; align-items: center; gap: var(--space-2); color: inherit; text-decoration: none; }
.brand img { display: block; width: 28px; height: 28px; flex: 0 0 auto; }
.brand-name { color: hsl(var(--ink)); font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.brand-product { padding-left: var(--space-3); border-left: 1px solid var(--line-strong); color: var(--text-2); }

/* Page frame */
.main { width: min(100%, 860px); margin: 0 auto; padding: var(--space-6) clamp(var(--space-3), 3vw, var(--space-8)) var(--space-12); }
.main.results-page { width: min(100%, 2400px); }
.main:focus-visible { box-shadow: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-head h1 { margin-bottom: 0; }
.back { margin-bottom: var(--space-2); }
.back a { color: var(--text-2); text-decoration: none; }
.back a:hover { color: hsl(var(--ink)); text-decoration: underline; }
.loading { display: grid; min-height: 50vh; place-items: center; color: var(--text-2); }
.hero { max-width: 520px; margin: var(--space-12) auto; text-align: center; }
.hero img { width: 48px; height: 48px; margin-bottom: var(--space-3); }
.hero p { color: var(--text-2); }
.block { margin-bottom: var(--space-8); }
.block > h2 { margin-bottom: var(--space-3); }

/* Buttons and links */
.button { display: inline-flex; min-height: var(--target); align-items: center; justify-content: center; gap: var(--space-2); padding: 0 var(--space-5); border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--neutral-0)); color: hsl(var(--ink)); cursor: pointer; font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.2; text-align: center; text-decoration: none; transition: background-color var(--dur-fast) var(--ease-standard); }
.button:hover:not(:disabled) { background: var(--hover); }
.button:not(:disabled):active { background: hsl(var(--neutral-200)); }
/* Primary actions sit on the palette's orange-600 (about 5:1 with white text, AA) rather than the portal's brand orange (3.8:1). */
.button.primary { border-color: transparent; background: var(--accent); color: hsl(var(--neutral-0)); font-weight: var(--weight-semibold); }
.button.primary:hover:not(:disabled) { background: hsl(var(--brand-orange-700)); }
.button:disabled { cursor: not-allowed; opacity: 0.5; }
.button.danger { border-color: transparent; background: hsl(var(--status-red-fg)); color: hsl(var(--neutral-0)); font-weight: var(--weight-semibold); }
.button.danger:hover:not(:disabled) { background: hsl(0 70% 34%); }
.button.quiet { color: hsl(var(--ink)); }
.button.icon { width: var(--target); padding: 0; border-color: transparent; background: transparent; color: var(--text-2); font-size: 1.5rem; }
.file-button { position: relative; overflow: hidden; }
.linkish { min-height: 32px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: hsl(var(--neutral-400)); text-underline-offset: 3px; }
.linkish:hover { text-decoration-color: currentColor; }
.actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }

/* Forms and notices */
.form { max-width: 560px; }
.field { margin-bottom: var(--space-4); }
.field label { display: block; margin-bottom: var(--space-2); color: hsl(var(--ink)); font-weight: var(--weight-semibold); }
input[type="text"], textarea, select { width: 100%; min-height: var(--target); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--neutral-0)); color: hsl(var(--text-body)); font-size: var(--text-base); }
textarea { padding: var(--space-3); line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: hsl(var(--neutral-500)); }
input:focus, textarea:focus, select:focus { border-color: hsl(var(--neutral-600)); }
.form-error { margin: var(--space-2) 0; color: hsl(var(--status-red-fg)); font-weight: var(--weight-semibold); }
.notice { margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid hsl(var(--status-gray-border)); border-left-width: 4px; border-radius: 4px; background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); }
.notice.warn { border-color: hsl(var(--status-amber-border)); border-left-color: hsl(var(--status-amber-fg)); background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.notice.bad { border-color: hsl(var(--status-red-border)); border-left-color: hsl(var(--status-red-fg)); background: hsl(var(--status-red-bg)); color: hsl(var(--status-red-fg)); }
.notice h1, .notice h2 { color: inherit; }
.banners:empty { display: none; }
.toasts { position: fixed; bottom: var(--space-4); left: 50%; z-index: 50; display: flex; max-width: min(460px, calc(100vw - var(--space-6))); transform: translateX(-50%); flex-direction: column; gap: var(--space-2); pointer-events: none; }
.toast { padding: var(--space-3) var(--space-4); border: 1px solid hsl(var(--status-red-border)); border-radius: var(--r); background: hsl(var(--status-red-bg)); color: hsl(var(--status-red-fg)); font-weight: var(--weight-semibold); box-shadow: var(--shadow-md); transition: opacity var(--dur-base) var(--ease-standard); pointer-events: auto; }
.toast.gone { opacity: 0; }

/* Reviews list */
.review-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); background: hsl(var(--surface-card)); overflow: hidden; }
.review-list li + li { border-top: 1px solid var(--line); }
.review-item { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none; }
.review-item:hover { background: hsl(var(--neutral-50)); }
.review-action { color: hsl(var(--ink)); font-weight: var(--weight-semibold); white-space: nowrap; }
.review-date { white-space: nowrap; }
.review-name { display: grid; min-width: 0; flex: 1 1 12rem; gap: 2px; }
.review-claim, .claim { color: var(--text-2); }
.review-search { margin-bottom: var(--space-3); }
.optional { color: var(--text-2); font-weight: var(--weight-normal); }
.case-title h1 { margin-bottom: var(--space-1); }
.case-title .claim { margin: 0 0 var(--space-4); }
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.case-head > .case-form { width: 100%; max-width: 560px; margin-bottom: var(--space-4); }
.case-head .button.quiet { flex: 0 0 auto; }
.review-title { color: hsl(var(--ink)); font-size: var(--text-base); font-weight: var(--weight-semibold); }
.review-meta { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1) var(--space-3); color: var(--text-2); margin-left: auto; }
.review-result { color: hsl(var(--ink)); font-weight: var(--weight-semibold); }
.review-status { padding: 2px var(--space-3); border-radius: var(--radius-pill); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; }
.review-status.done { background: hsl(var(--status-green-bg)); color: hsl(var(--status-green-fg)); }
.review-status.wait { background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.review-status.bad { background: hsl(var(--status-red-bg)); color: hsl(var(--status-red-fg)); }

/* Videos and upload */
.video-list { margin: 0 0 var(--space-3); padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); background: hsl(var(--surface-card)); }
.video-row { padding: var(--space-3) var(--space-4); }
.video-row + .video-row { border-top: 1px solid var(--line); }
.video-line { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.video-name { min-width: 0; overflow-wrap: anywhere; color: hsl(var(--ink)); font-weight: var(--weight-semibold); }
.video-length { color: var(--text-2); font-weight: var(--weight-normal); white-space: nowrap; }
.video-row p { margin: var(--space-1) 0 0; }
.video-note { color: var(--text-2); }
.video-progress { display: grid; gap: var(--space-1); margin-top: var(--space-2); }
.subject-line { color: var(--text-2); }
.progress { width: 100%; height: 8px; overflow: hidden; border-radius: var(--radius-pill); background: hsl(var(--neutral-200)); }
.progress.big { height: 14px; }
.progress-bar { height: 100%; border-radius: inherit; background: hsl(var(--neutral-700)); transition: width var(--dur-base) var(--ease-standard); }
.processing .progress-bar { background: var(--accent); }
.dropzone { display: flex; min-height: 96px; align-items: center; justify-content: center; padding: var(--space-4); border: 2px dashed var(--line-strong); border-radius: var(--r); background: hsl(var(--surface-card)); color: hsl(var(--ink)); cursor: pointer; text-align: center; transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard); }
.dropzone strong { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: hsl(var(--brand-orange-50)); }
.restrictions-input { min-height: 8rem; }
#restrictions-h { margin-bottom: var(--space-2); }
#restrictions-h label { font-size: inherit; }
.spinner { display: inline-block; width: 16px; height: 16px; flex: 0 0 auto; border: 2px solid hsl(var(--neutral-200)); border-top-color: hsl(var(--neutral-700)); border-radius: var(--radius-pill); vertical-align: -3px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.run-left { margin: var(--space-3) 0 0; color: var(--text-2); }


/* Results layout, player and timeline */
.results-left, .results-right, .review-main, .review-side, .tab-panel { min-width: 0; }
.banners:empty { display: none; }
.player { margin-bottom: var(--space-4); overflow: hidden; }
.player-video { display: block; width: 100%; max-height: 62vh; aspect-ratio: 16 / 9; background: hsl(var(--neutral-950)); }
.player-stage { position: relative; margin: 0 auto; overflow: hidden; border-radius: var(--radius); background: hsl(var(--neutral-950)); }
.player-stage .player-video { display: block; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; object-fit: contain; }
.player-stage .player-empty { display: grid; width: 100%; height: 100%; padding: 0; place-items: center; }
.player-empty { padding: var(--space-8); background: hsl(var(--surface-sunk)); color: hsl(var(--text-muted)); text-align: center; }
/* video tabs: one row; each tab shrinks with an ellipsis rather than wrapping (past MANY_TABS the picker takes over) */
.results-left .video-tabs { flex-wrap: nowrap; }
.results-left .video-tabs .tab { display: inline-flex; min-width: 0; flex: 0 1 auto; align-items: baseline; overflow: hidden; }
.video-tabs .tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-tabs .tab-count { flex: 0 0 auto; font-weight: var(--weight-normal); white-space: pre; }
.video-picker { width: 100%; margin-bottom: var(--space-3); }
.video-picker-label { display: block; margin-bottom: var(--space-1); color: hsl(var(--text-muted)); font-size: var(--text-xs); }

.quote { font-style: italic; }
.statements { margin: 0; padding: 0; list-style: none; }
.statement { padding: var(--space-3) 0; border-top: 1px solid hsl(var(--border)); }
.statement:first-child { border-top: 0; }
.statement.quiet .statement-quote { color: hsl(var(--text-muted)); }
.statement-quote { margin: 0 0 var(--space-1); }
.statement-meta { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; margin: 0; color: hsl(var(--text-muted)); }
.statement-count { color: hsl(var(--text-heading)); font-weight: var(--weight-semibold); }
.sev, .sev-badge { justify-content: center; }
.sev-badge.small { padding: 1px var(--space-2); font-size: var(--text-2xs); }

.tab-panel { padding: var(--space-4); }


/* Marking the claimant */
.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); }
.candidate { display: grid; gap: var(--space-1); padding: var(--space-1); border: 1px solid var(--line); border-radius: var(--r); background: hsl(var(--surface-card)); color: hsl(var(--text-body)); cursor: pointer; text-align: left; }
.candidate img { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 3px; background: hsl(var(--neutral-950)); object-fit: contain; }
.candidate:hover { border-color: hsl(var(--neutral-600)); }
.candidate.selected { border-color: hsl(var(--brand-orange-300)); background: hsl(var(--brand-orange-50)); }
.candidate-time { padding: 0 2px; font-variant-numeric: tabular-nums; }
.candidate-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.candidate-time-input { width: 7rem; }
.subject-prompt { margin: 0; color: hsl(var(--ink)); font-weight: var(--weight-semibold); }
/* the claimant: a box over the frame, in the brand orange */
.candidate-picture { position: relative; display: block; }
.candidate.marking { border-color: hsl(var(--brand-orange-ring)); }
.candidate-box, .marker-box { position: absolute; box-sizing: border-box; border: 2px solid hsl(var(--brand-orange)); border-radius: 2px; box-shadow: 0 0 0 1px hsl(0 0% 100% / 0.7), inset 0 0 0 1px hsl(0 0% 100% / 0.7); pointer-events: none; }

/* The marking panel is a dialog: the frames, then the marker, over the page and below the sticky header. */
.subject-panel { position: fixed; top: calc(var(--topbar-h) + var(--space-4)); right: 0; left: 0; z-index: 40; display: flex; width: min(900px, calc(100% - var(--space-6))); max-height: calc(100vh - var(--topbar-h) - var(--space-8)); margin: 0 auto; flex-direction: column; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--surface-card)); box-shadow: 0 0 0 100vmax hsl(0 0% 0% / 0.42); }
body:has(.subject-panel) { overflow: hidden; }
.subject-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4); border-bottom: 1px solid var(--line); }
.subject-head h3 { margin: 0; font-size: 1.25rem; }
.subject-head h3:focus { outline: none; box-shadow: none !important; }
.subject-body { display: grid; flex: 1 1 auto; align-content: start; gap: var(--space-4); padding: var(--space-4); overflow-y: auto; }
.candidate-actions.decision { flex: 0 0 auto; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); background: hsl(var(--surface-card)); }
.subject-panel.marking .candidates, .subject-panel.marking .candidate-actions:not(.decision):not(.marker-actions), .subject-panel.marking .subject-body > .error, .subject-panel.marking .subject-body > p.muted, .subject-panel.marking .subject-prompt { display: none; }
.subject-panel.marking .candidate-actions.decision { display: none; position: static; }

/* Keyboard focus always wins over a component's own shadow. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: var(--shadow-focus) !important; }
.main:focus-visible, .subject-head h3:focus-visible { box-shadow: none !important; }

/* Top bar, right: the workspace and its menu */
.account { position: relative; min-width: 0; }
.account-button { display: inline-flex; min-height: var(--target); max-width: 100%; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--text-2); cursor: pointer; font-weight: var(--weight-medium); }
.account-button:hover, .account-button[aria-expanded="true"] { background: var(--hover); color: hsl(var(--ink)); }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { width: 8px; height: 8px; flex: 0 0 auto; margin-top: -4px; transform: rotate(45deg); border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; min-width: 180px; padding: var(--space-1); border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--surface-card)); box-shadow: var(--shadow-md); }
.menu-item { display: block; width: 100%; min-height: var(--target); padding: 0 var(--space-3); border: 0; border-radius: 4px; background: none; color: hsl(var(--ink)); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--hover); }

/* In-app confirmation */
.dialog-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--space-4); background: hsl(0 0% 0% / 0.45); }
.dialog { width: min(440px, 100%); padding: var(--space-6); border-radius: var(--r); background: hsl(var(--surface-card)); box-shadow: var(--shadow-md), 0 20px 40px hsl(0 0% 0% / 0.2); }
.dialog h2 { margin-bottom: var(--space-2); }
.dialog p { margin-bottom: 0; color: var(--text-2); overflow-wrap: anywhere; }
.dialog .actions { justify-content: flex-end; margin-top: var(--space-5); }
body:has(.dialog-backdrop) { overflow: hidden; }

/* Loading placeholders */
.skeleton { padding-top: var(--space-2); }
.sk { margin-bottom: var(--space-3); border-radius: var(--r); background: linear-gradient(90deg, hsl(var(--neutral-200)) 25%, hsl(var(--neutral-100)) 50%, hsl(var(--neutral-200)) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-title { width: 45%; height: 32px; }
.sk-line { width: 70%; height: 20px; }
.sk-row { height: 72px; }
.sk-block { height: 120px; }
.sk-video { aspect-ratio: 16 / 9; max-height: 40vh; }
.sk-results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 460px); gap: var(--space-6); }
@keyframes shimmer { to { background-position: -200% 0; } }


@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .topbar { padding: 0 var(--space-3); }
  .candidates { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .actions .button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner, .sk { animation: none; }
  * { transition: none !important; }
}

/* Verdict, caption, notes */
.notice.stale { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.stale-line { margin: 0; }
.list-note { margin: 0 0 var(--space-2); color: var(--text-2); }
.required { color: var(--text-2); font-size: var(--text-sm); font-weight: var(--weight-normal); }
.run-note { margin: var(--space-3) 0 0; color: var(--text-2); }
.video-line .button, .case-head > .button { flex: 0 0 auto; }

/* Results page rules restored from mg/rjn-upload-and-go: tabs, chips, notices, subject provenance, context */
.crumbs { margin-bottom: var(--space-1); color: hsl(var(--text-muted)); font-size: var(--text-xs); }
.crumbs a { color: hsl(var(--text-muted)); }
.card, .player, .tab-panel, .subject-panel { border: 1px solid hsl(var(--border)); border-radius: var(--radius-xl); background: hsl(var(--surface-card)); box-shadow: var(--shadow-sm); }
.card { margin-bottom: var(--space-5); padding: var(--space-5); }
.card.empty, .card.signin { max-width: 620px; margin: var(--space-8) auto; padding: var(--space-8); text-align: center; }
.card.signin img { width: 42px; height: 42px; margin-bottom: var(--space-3); }
.card.empty p, .card.signin p { max-width: 46ch; margin-right: auto; margin-left: auto; color: hsl(var(--text-muted)); }
.hint { margin-bottom: var(--space-3); color: hsl(var(--text-muted)); font-size: var(--text-xs); }
.review-side .card { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); }
.empty-line { padding: var(--space-2) 0; }
.pill, .subject-state, .sev, .sev-badge { display: inline-flex; width: fit-content; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border: 1px solid hsl(var(--status-gray-border)); border-radius: var(--radius-pill); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); font-size: var(--text-2xs); font-weight: var(--weight-semibold); line-height: var(--leading-normal); }
.pill.status-completed, .pill.ok, .subject-state.confirmed { border-color: hsl(var(--status-green-border)); background: hsl(var(--status-green-bg)); color: hsl(var(--status-green-fg)); }
.pill.status-running, .pill.status-queued, .pill.wait, .subject-state.unconfirmed { border-color: hsl(var(--status-amber-border)); background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.pill.status-draft, .pill.status-cancelled, .subject-state.pending { border-color: hsl(var(--status-gray-border)); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); }
.tag { display: inline-block; margin: 0 var(--space-1) var(--space-1) 0; padding: 2px var(--space-2); border: 1px solid hsl(var(--status-gray-border)); border-radius: var(--radius); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); font-size: var(--text-2xs); }
.tag.warn { border-color: hsl(var(--status-amber-border)); background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.tag.quiet { background: transparent; }
.video-tabs, .tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; margin-bottom: var(--space-3); border-bottom: 1px solid hsl(var(--border)); }
.tab { margin-bottom: -1px; padding: var(--space-2) var(--space-3); border: 0; border-bottom: 3px solid transparent; background: none; color: hsl(var(--text-body)); cursor: pointer; font-weight: var(--weight-semibold); }
.tab:hover { color: hsl(var(--brand-orange-700)); }
.tab.active { border-bottom-color: hsl(var(--brand-orange)); color: hsl(var(--brand-orange-700)); }
.field.inline .hint { grid-column: 1 / -1; margin: var(--space-1) 0 0; }
.notice, .run-summary, .toast, .empty-findings { padding: var(--space-3) var(--space-4); border: 1px solid hsl(var(--status-gray-border)); border-radius: var(--radius); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); font-size: var(--text-sm); }
.empty-findings { margin-bottom: var(--space-3); }
.run-history summary, .context summary { color: hsl(var(--text-heading)); cursor: pointer; font-weight: var(--weight-semibold); }
@media (max-width: 640px) {
  .card { padding: var(--space-4); }
  .card.empty, .card.signin { margin: var(--space-6) auto; padding: var(--space-5); }
}

/* ---- work status report */
.ws-entry { margin-bottom: var(--space-3); }
.ws-entry-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.ws-entry-actions .file-button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; }
.ws-paste-panel { display: grid; gap: var(--space-2); margin-top: var(--space-3); padding: var(--space-3); border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--surface-sunk)); }
.ws-paste-panel .button { justify-self: start; }
.ws-provenance { margin: 0 0 var(--space-3); }
.ws-provenance p { margin: 0; }
.ws-provenance p + p { margin-top: var(--space-1); }
.ws-note { margin-bottom: var(--space-3); }
.ws-rows { margin-bottom: var(--space-3); border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--surface-card)); }
.ws-row { display: grid; grid-template-columns: minmax(18rem, 1fr) 9.5rem 9.5rem auto; gap: var(--space-2); align-items: start; padding: var(--space-3); }
.ws-row + .ws-row { border-top: 1px solid hsl(var(--border)); }
.ws-copy { min-width: 0; }
.ws-detail { display: flex; align-items: baseline; gap: var(--space-1) var(--space-2); flex-wrap: wrap; margin-top: var(--space-1); font-size: var(--text-xs); line-height: var(--leading-normal); }
.ws-reading { flex: 1 1 18rem; }
.ws-source { flex: 1 0 100%; font-style: italic; overflow-wrap: anywhere; }
.ws-remove { min-height: var(--target); padding-inline: var(--space-3); }

@media (max-width: 640px) {
  .ws-entry-actions { align-items: stretch; flex-direction: column; }
  .ws-entry-actions .button { width: 100%; }
  .ws-row { grid-template-columns: 1fr 1fr; }
  .ws-copy { grid-column: 1 / -1; }
  .ws-remove { justify-self: start; }
}

/* ---- accounts */
.main.auth-page { display: grid; min-height: calc(100vh - var(--topbar-h)); place-items: center; }
.auth-card { width: min(100%, 460px); margin: var(--space-6) auto; padding: var(--space-8); }
.auth-card.accept-card { width: min(100%, 640px); }
.auth-card h1 { margin-bottom: var(--space-5); }
.auth-form { display: grid; max-width: none; gap: var(--space-4); }
.auth-form .field { margin: 0; }
.auth-form .button, .auth-google { width: 100%; }
.auth-error { min-height: 0; margin: 0; }
.auth-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: hsl(var(--text-muted)); font-size: var(--text-xs); text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: hsl(var(--border)); content: ""; }
.text-button { display: block; min-height: var(--target); margin: var(--space-3) auto 0; padding: var(--space-1); border: 0; background: transparent; color: hsl(var(--brand-orange-700)); cursor: pointer; font-weight: var(--weight-semibold); }
.text-button:hover { text-decoration: underline; }
.auth-muted, .password-policy, .invite-summary { color: hsl(var(--text-muted)); }
.auth-muted { margin: var(--space-4) 0 0; text-align: center; }
.auth-form .auth-muted, .invitation-finish > .auth-muted { margin-top: 0; }
.accept-preview > .button { margin-top: var(--space-2); }
.invite-summary { margin: var(--space-4) 0; }
.eyebrow { margin-bottom: var(--space-2); color: hsl(var(--text-muted)); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.invitation-finish > h1 { margin-bottom: var(--space-1); }
.finish-option { display: grid; gap: var(--space-3); }
.finish-option h2 { margin: 0; font-size: var(--text-lg); }
.finish-option .field { margin: 0; }
.finish-option .password-policy { margin-bottom: 0; }
.password-policy { margin-bottom: var(--space-3); }
.password-feedback { min-height: 1.5em; margin: 0; color: hsl(var(--text-muted)); font-size: var(--text-xs); }
.password-feedback.invalid { color: hsl(var(--status-red-fg)); }
.password-feedback.valid { color: hsl(var(--status-green-fg)); }

input[type="email"], input[type="password"], input[type="number"], input[type="date"] { width: 100%; min-height: var(--target); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--neutral-0)); color: hsl(var(--text-body)); font-size: var(--text-base); }
input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="date"]:focus { border-color: hsl(var(--neutral-600)); }

.account-identity { display: grid; min-width: 0; text-align: left; }
.account-email { overflow: hidden; color: hsl(var(--text-muted)); font-size: var(--text-xs); font-weight: var(--weight-normal); text-overflow: ellipsis; white-space: nowrap; }
.menu { min-width: 240px; }
.menu-item { display: flex; align-items: center; text-decoration: none; }
.menu-switch { padding: var(--space-2) var(--space-3); border-top: 1px solid hsl(var(--border)); border-bottom: 1px solid hsl(var(--border)); }
.menu-switch label { display: block; margin-bottom: var(--space-1); color: hsl(var(--text-muted)); font-size: var(--text-xs); }
.org-switch { min-height: 40px; font-size: var(--text-sm); }

.account-pages { width: min(100%, 1100px); margin: 0 auto; }
.account-pages .table-scroll { overflow-x: auto; width: 100%; max-width: 100%; }   /* the member and invitation tables scroll inside their card on a phone */
.account-page-head { align-items: flex-start; }
.account-page-head p { margin: 0; }
.account-card { margin-bottom: var(--space-5); }
.account-card > h2 { margin-bottom: var(--space-4); }
.account-form { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 var(--space-4); }
.account-form > .button { margin-top: var(--space-2); }
.account-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: var(--text-sm); }
.account-table th { color: hsl(var(--text-muted)); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-align: left; }
.account-table th, .account-table td { padding: var(--space-3) var(--space-2); border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.account-table tbody tr:last-child td { border-bottom: 0; }
.account-table td { overflow-wrap: anywhere; }
.account-table select { min-width: 130px; }
.row-actions { display: flex; min-width: 230px; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.button.compact { min-height: 40px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.copy-link { flex: 1 0 100%; min-width: 200px; }
.review-danger { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid hsl(var(--border)); }
.read-only-list { padding-left: var(--space-5); }
.document-page { max-width: 780px; }
.document-copy h2, .document-copy h3 { margin-top: var(--space-6); }
.document-copy p { white-space: pre-wrap; }

@media (max-width: 640px) {
  .auth-card { margin: var(--space-3) auto; padding: var(--space-5); }
  .account-button { max-width: 180px; padding: 0 var(--space-2); }
  .account-identity { max-width: 130px; }
  .menu { position: fixed; top: calc(var(--topbar-h) - 1px); right: var(--space-2); left: var(--space-2); min-width: 0; }
  .account-card { padding: var(--space-4); }
  .account-table { font-size: var(--text-xs); }
  .table-scroll { width: 100%; max-width: 100%; }
}
/* The claimant's marker */
.marker { display: grid; gap: var(--space-3); }
.marker-title { margin: 0; color: hsl(var(--ink)); }
.marker-stage { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; background: hsl(var(--neutral-950)); cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: 2px; }
.marker-stage img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.marker-box { border-width: 3px; pointer-events: auto; cursor: move; }
.marker-handle { position: absolute; width: 18px; height: 18px; border: 2px solid hsl(var(--brand-orange)); border-radius: 50%; background: hsl(var(--neutral-0)); pointer-events: auto; }
.marker-handle.nw { left: -10px; top: -10px; cursor: nwse-resize; }
.marker-handle.ne { right: -10px; top: -10px; cursor: nesw-resize; }
.marker-handle.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
.marker-handle.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.marker-stage { margin-inline: auto; }

/* ==========================================================================
   Results: the reviewer's workflow. Left, the player with its strip and under it the clip of the selected moment;
   right, the tabs, the toolbar and the moment list. On a desktop both columns fit the window: the page does not
   scroll, only the moment list (or the activity log) scrolls, inside its own panel. On a phone: the video (pinned),
   the clip, then the list.
   ========================================================================== */
.results-head { flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-1); }
.results-title { display: flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 0 var(--space-4); }
.results-title h1 { margin: 0; font-size: 1.375rem; }
.results-title .claim { color: var(--text-2); }
.back-link { color: var(--text-2); text-decoration: none; }
.back-link:hover { color: hsl(var(--ink)); text-decoration: underline; }
.results-head .head-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.results-grid { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 10fr); align-items: start; gap: var(--space-4); }
.banners .notice { margin-bottom: var(--space-2); padding: var(--space-2) var(--space-3); }

/* the player's strip: what happens when (the native controls are the scrubber); a click still seeks, a hover names the time */
.strip-wrap { position: relative; margin: 0 var(--space-3); }
.strip-wrap.detail { margin-top: 12px; }
.strip { position: relative; height: 36px; margin: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; background: hsl(var(--neutral-50)); cursor: pointer; }
.lane { position: absolute; right: 0; left: 0; }
.lane.activity { top: 0; height: 22px; background: repeating-linear-gradient(135deg, hsl(var(--neutral-200)) 0 4px, hsl(var(--neutral-50)) 4px 8px); }   /* a stretch with no band: not in view */
.lane.marks { top: 22px; height: 14px; z-index: 2; }
.band { position: absolute; top: 0; min-width: 2px; height: 100%; background: hsl(var(--neutral-300)); }
.band.group-exertion, .legend-item.group-exertion::before { background-color: hsl(var(--status-red-fg)); }
.band.group-upright, .legend-item.group-upright::before { background-color: hsl(var(--status-teal-fg)); }
.band.group-standing, .legend-item.group-standing::before { background-color: hsl(var(--status-blue)); }
.band.group-seated, .legend-item.group-seated::before { background-color: hsl(var(--neutral-400)); }
.band.group-driving, .legend-item.group-driving::before { background-color: hsl(260 22% 50%); }
.band.group-device, .legend-item.group-device::before { background-color: hsl(var(--status-amber-fg)); }
.band.group-other, .legend-item.group-other::before { background-color: hsl(var(--neutral-300)); }
.clipband { position: absolute; top: 0; bottom: 0; z-index: 1; border-right: 2px solid hsl(var(--brand-orange)); border-left: 2px solid hsl(var(--brand-orange)); background: hsl(var(--brand-orange) / 0.2); pointer-events: none; }
/* a moment is a thin tick in its rating's colour; ticks that would touch join into one numbered mark; the selected moment is
   a small caret above the strip, never a bigger mark that could cover its neighbours. Marks take no pointer events: the
   strip finds the nearest one. */
.mark { position: absolute; top: 50%; width: 2px; height: 12px; margin: -6px 0 0 -1px; padding: 0; background: hsl(var(--neutral-500)); box-shadow: 0 0 0 1px hsl(var(--neutral-0)); pointer-events: none; }
.mark.sev-high { background: hsl(var(--status-red-fg)); }
.mark.sev-mid { background: hsl(var(--status-amber)); }
.mark.sev-low { background: hsl(var(--neutral-500)); }
.mark.sev-matched { background: hsl(var(--status-blue-fg)); }
.mark.cluster { display: grid; width: 20px; height: 14px; margin: -7px 0 0 -10px; place-items: center; border-radius: 7px; color: hsl(var(--neutral-0)); font-size: 0.6875rem; font-weight: var(--weight-bold); line-height: 1; font-variant-numeric: tabular-nums; }
.mark.cluster.sev-mid { color: hsl(var(--ink)); }
.mark.selected { height: 14px; margin-top: -7px; }
.mark.cluster.selected { box-shadow: 0 0 0 1px hsl(var(--neutral-0)), 0 0 0 3px hsl(var(--ink)); }
.sel-caret { position: absolute; z-index: 6; top: -9px; width: 0; height: 0; margin-left: -6px; border-top: 7px solid hsl(var(--ink)); border-right: 6px solid transparent; border-left: 6px solid transparent; pointer-events: none; }
.strip.on-mark { cursor: pointer; }
.strip { cursor: crosshair; }
/* a long video: the windows the strip can show, and moving along */
.zoom { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 4px; margin: -3px 0 -3px auto; padding-left: var(--space-3); }
.zoom-btn { min-width: 32px; height: 28px; padding: 0 var(--space-2); border: 1px solid var(--line-strong); border-radius: 6px; background: hsl(var(--neutral-0)); color: hsl(var(--ink)); cursor: pointer; font-size: 0.875rem; font-weight: var(--weight-medium); line-height: 1; white-space: nowrap; }
.zoom-btn.step { font-size: 1.25rem; }
.zoom-btn:hover:not(:disabled) { background: var(--hover); }
.zoom-btn[aria-pressed="true"] { border-color: hsl(var(--brand-orange-600)); background: hsl(var(--brand-orange-50)); color: hsl(var(--brand-orange-700)); font-weight: var(--weight-semibold); }
.zoom-btn:disabled { cursor: default; opacity: 0.4; }
.cursor { position: absolute; z-index: 4; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: hsl(var(--ink)); box-shadow: 0 0 0 1px hsl(var(--neutral-0)); pointer-events: none; }
.strip-tip { position: absolute; z-index: 7; bottom: calc(100% + 10px); text-align: left; max-width: 100%; padding: 2px var(--space-2); transform: translateX(-50%); border-radius: 4px; background: hsl(var(--ink)); color: hsl(var(--neutral-0)); font-size: 0.875rem; white-space: pre; pointer-events: none; }
.readout { display: flex; align-items: baseline; flex-wrap: nowrap; white-space: nowrap; gap: 0 var(--space-3); padding: var(--space-1) var(--space-3) 0; font-size: 0.9375rem; }
.readout .clock { color: hsl(var(--ink)); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.readout .offset { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.readout .clock { flex: 0 0 auto; }
.readout .band-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.readout .clock:not(:empty)::after, .readout .offset:has(+ .band-text:not(:empty))::after { margin-left: var(--space-3); color: var(--text-2); font-weight: var(--weight-normal); content: "\00b7"; }
.legend { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); padding: 2px var(--space-3) var(--space-1); color: var(--text-2); font-size: 0.75rem; line-height: 1.45; }
.legend-item::before { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; content: ""; vertical-align: -1px; }
.legend-rated::before { display: none; }
.legend-mark { margin-left: 8px; }
.legend-mark::before { display: inline-block; width: 3px; height: 11px; margin-right: 4px; background: hsl(var(--neutral-500)); content: ""; vertical-align: -1px; }
.legend-mark.sev-high::before { background: hsl(var(--status-red-fg)); }
.legend-mark.sev-mid::before { background: hsl(var(--status-amber)); }
.legend-mark.sev-low::before { background: hsl(var(--neutral-500)); }
.legend-mark.sev-matched::before { background: hsl(var(--status-blue-fg)); }
.legend-item.legend-clip::before { box-sizing: border-box; border-right: 2px solid hsl(var(--brand-orange)); border-left: 2px solid hsl(var(--brand-orange)); border-radius: 0; background: hsl(var(--brand-orange) / 0.2); }
.legend-item.legend-gap::before { border: 1px solid var(--line-strong); background: repeating-linear-gradient(135deg, hsl(var(--neutral-200)) 0 3px, hsl(var(--neutral-50)) 3px 6px); }
.strip:focus-visible { box-shadow: var(--shadow-focus) !important; }

/* the clip panel: the clip beside its trim bar and the three buttons, as small as it can be so the main video keeps the room */
.clip-panel { position: relative; padding: var(--space-2) 0; border: 1px solid hsl(var(--border)); border-radius: var(--radius-xl); background: hsl(var(--surface-card)); box-shadow: var(--shadow-sm); }
.clip-empty { margin: 0; padding: var(--space-2) var(--space-3); }
.clip-head, .trim, .clip-panel .actions, .clip-note { margin-right: var(--space-3); margin-left: var(--space-3); }
.clip-head { display: flex; min-width: 0; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.clip-when { flex: 0 0 auto; color: hsl(var(--text-heading)); font-variant-numeric: tabular-nums; }
.clip-rule { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the clip: a viewer as wide as the main player, then the trim bar the full width, then the buttons on one row */
.clip-media { position: relative; width: var(--stage-w, 100%); max-width: 100%; aspect-ratio: var(--stage-ar, 16 / 9); margin: 0 auto var(--space-2); overflow: hidden; border-radius: var(--radius); background: hsl(var(--neutral-950)); }
.clip-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.clip-status { position: absolute; inset: 0; display: grid; padding: var(--space-1); place-items: center; background: hsl(0 0% 0% / 0.55); color: hsl(var(--neutral-0)); font-size: 0.9375rem; font-weight: var(--weight-semibold); text-align: center; }
.clip-panel .actions { flex-wrap: wrap; margin-top: 0; gap: var(--space-2); }
.clip-panel .actions .button { min-width: 0; flex: 1 1 calc(33% - var(--space-2)); padding: 0 var(--space-2); font-size: 0.9375rem; white-space: nowrap; }
.clip-note { margin: 0 var(--space-3); color: var(--text-2); font-size: 0.9375rem; line-height: 1.35; }
.clip-note:empty { display: none; }
.clip-note.bad { color: hsl(var(--status-red-fg)); font-weight: var(--weight-semibold); }
.trim { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-1); }
.trim-time { color: hsl(var(--text-heading)); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.trim-length { position: absolute; top: -1px; left: 50%; transform: translateX(-50%); font-size: 0.8125rem; pointer-events: none; }
.trim-track { position: relative; height: 44px; margin: 0 14px; cursor: pointer; touch-action: none; }
.trim-rail, .trim-fill { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; }
.trim-rail { right: 0; left: 0; background: hsl(var(--neutral-200)); }
.trim-fill { background: var(--accent); }
.trim-moment { position: absolute; top: 8px; bottom: 8px; width: 2px; margin-left: -1px; background: hsl(var(--ink)); opacity: 0.55; pointer-events: none; }
.trim-handle { position: absolute; top: 50%; width: 28px; height: 44px; margin: -22px 0 0 -14px; padding: 0; border: 0; background: none; cursor: ew-resize; touch-action: none; }
.trim-handle::before { position: absolute; top: 6px; right: 8px; bottom: 6px; left: 8px; border: 2px solid var(--accent); border-radius: 6px; background: hsl(var(--surface-card)); box-shadow: var(--shadow-xs); content: ""; }
.trim.disabled { opacity: 0.45; }
.trim.disabled .trim-handle { cursor: not-allowed; }

/* the moments toolbar: search and three menus on one row; a menu shows what is chosen, with a one-click clear */
.toolbar { display: flex; align-items: center; flex-wrap: nowrap; gap: var(--space-2); }
.search-input { min-width: 0; flex: 1 1 110px; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--neutral-0)); font-size: 0.9375rem; }
.tb-filters { display: flex; min-width: 0; flex: 0 1 auto; align-items: center; gap: var(--space-2); }
.tb-drop { position: relative; min-width: 0; flex: 0 1 auto; }
.tb-split { display: flex; align-items: stretch; }
.tb-btn { display: inline-flex; min-height: 44px; min-width: 0; max-width: 190px; align-items: center; gap: 6px; padding: 0 var(--space-3); overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--neutral-0)); color: hsl(var(--ink)); cursor: pointer; font-size: 0.9375rem; font-weight: var(--weight-medium); text-overflow: ellipsis; white-space: nowrap; }
.tb-btn:hover { background: var(--hover); }
.tb-btn.tb-filters-toggle { display: none; }
.tb-btn .caret { width: 6px; height: 6px; margin: -2px 0 0 4px; border-width: 0 2px 2px 0; border-style: solid; border-color: currentColor; transform: rotate(45deg); flex: 0 0 auto; }
.tb-btn.on, .tb-btn[aria-expanded="true"] { border-color: hsl(var(--brand-orange-600)); background: hsl(var(--brand-orange-50)); color: hsl(var(--brand-orange-700)); }
.tb-split:has(.tb-clear:not([hidden])) .tb-btn { border-right: 0; border-radius: var(--r) 0 0 var(--r); }
.tb-clear { width: 40px; border: 1px solid hsl(var(--brand-orange-600)); border-radius: 0 var(--r) var(--r) 0; background: hsl(var(--brand-orange-50)); color: hsl(var(--brand-orange-700)); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.tb-clear:hover { background: hsl(var(--brand-orange-100)); }
.tb-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: max-content; min-width: 240px; max-width: min(340px, 90vw); max-height: min(60vh, 420px); padding: var(--space-1); overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--r); background: hsl(var(--surface-card)); box-shadow: var(--shadow-md); }
.tb-drop:not(:first-of-type) .tb-menu { right: 0; left: auto; }
.tb-item { display: flex; width: 100%; min-height: 44px; align-items: center; gap: var(--space-2); padding: 0 var(--space-3) 0 var(--space-2); border: 0; border-radius: 6px; background: none; color: hsl(var(--ink)); cursor: pointer; font-size: 0.9375rem; text-align: left; }
.tb-item:hover { background: var(--hover); }
.tb-item .tb-check { width: 16px; flex: 0 0 auto; color: var(--accent); font-weight: var(--weight-bold); }
.tb-item[aria-checked="true"] .tb-check::before { content: "\2713"; }
.tb-item[aria-checked="true"] { font-weight: var(--weight-semibold); }
.tb-item .tb-label { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-item .tb-count { flex: 0 0 auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-item.off { cursor: default; opacity: 0.45; }
.tb-item.off:hover { background: none; }
.tb-section { padding: var(--space-3) var(--space-3) var(--space-1); color: var(--text-2); font-size: 0.8125rem; font-weight: var(--weight-semibold); }
.tb-rule { height: 1px; margin: var(--space-1) 0; background: var(--line); }
.tb-menu-search { width: 100%; min-height: 40px; margin-bottom: var(--space-1); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: 6px; font-size: 0.9375rem; }
.tb-none { margin: var(--space-2) var(--space-3); }
.list-count { margin: var(--space-1) 0 0; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

/* the list: groups with a small sticky header; a card is the picture, the time, the rating, the restriction and one sentence */
.tab-panel.split { display: flex; flex-direction: column; padding: 0; }
.list-head { z-index: 5; padding: var(--space-2) var(--space-3) var(--space-1); border-bottom: 1px solid hsl(var(--border)); border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: hsl(var(--surface-card)); }
.moments-scroll { padding: 0 var(--space-3) var(--space-3); }
.findings { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.group-head { position: sticky; z-index: 2; top: 0; margin: 0 calc(-1 * var(--space-3)); padding: var(--space-2) var(--space-3) var(--space-1); background: hsl(var(--surface-card)); color: var(--text-2); font-size: 0.875rem; font-weight: var(--weight-semibold); }
.finding { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-3); padding: 6px var(--space-2); border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--surface-card)); cursor: pointer; }
.finding:hover { border-color: hsl(var(--brand-orange-ring)); }
.finding.active { border-color: hsl(var(--brand-orange-300)); background: hsl(var(--brand-orange-50)); box-shadow: 0 0 0 1px hsl(var(--brand-orange-300)); }
.finding .thumb { width: 96px; aspect-ratio: 16 / 9; align-self: start; border-radius: var(--radius-sm); background: hsl(var(--neutral-950)); object-fit: cover; }
.finding-body { display: grid; min-width: 0; gap: 2px; }
.finding-top { display: flex; min-width: 0; min-height: 24px; align-items: center; gap: var(--space-2); }
.finding-top .when { flex: 0 0 auto; color: hsl(var(--text-heading)); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.finding-text { display: -webkit-box; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 0.9rem; line-height: 1.25; }
.rule-tag { min-width: 0; flex: 0 1 auto; overflow: hidden; padding: 0 var(--space-2); border-radius: var(--radius-sm); background: hsl(var(--surface-sunk)); color: var(--text-2); font-size: 0.8125rem; text-overflow: ellipsis; white-space: nowrap; }
.rating { display: inline-flex; flex: 0 0 auto; padding: 0 9px; border: 1px solid hsl(var(--status-gray-border)); border-radius: var(--radius-pill); background: hsl(var(--status-gray-bg)); color: hsl(var(--status-gray-fg)); font-size: 0.875rem; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating.sev-high, .sev-badge.sev-high { border-color: hsl(var(--status-red-border)); background: hsl(var(--status-red-bg)); color: hsl(var(--status-red-fg)); }
.rating.sev-mid, .sev-badge.sev-mid { border-color: hsl(var(--status-amber-border)); background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.rating.sev-matched, .sev-badge.sev-matched { border-color: hsl(var(--status-blue-border)); background: hsl(var(--status-blue-bg)); color: hsl(var(--status-blue-fg)); }
.finding:focus-visible { box-shadow: inset 0 0 0 3px hsl(var(--brand-orange)) !important; }

/* the activity log: a list, the sentence on the full width, only what is known as muted tags */
.log-list { margin: 0; padding: 0; list-style: none; }
.log-item { padding: var(--space-3) 0; border-top: 1px solid hsl(var(--border)); }
.log-item:first-child { border-top: 0; padding-top: 0; }
.log-item.now { margin: 0 calc(-1 * var(--space-2)); padding-right: var(--space-2); padding-left: var(--space-2); border-radius: var(--radius); background: hsl(var(--brand-orange-50)); }
.log-top { display: flex; min-width: 0; align-items: center; gap: var(--space-3); }
.log-time { min-height: 36px; min-width: 56px; padding: 0 var(--space-2); border: 1px solid var(--line-strong); border-radius: 6px; background: hsl(var(--neutral-0)); color: hsl(var(--ink)); cursor: pointer; font-family: var(--font-mono); font-size: 0.9375rem; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.log-time:hover { background: var(--hover); }
.log-activity { min-width: 0; overflow-wrap: anywhere; }
.log-clock { margin-left: auto; flex: 0 0 auto; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.log-text { margin: var(--space-1) 0 0; font-size: 0.9375rem; line-height: 1.4; }
.log-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-2) 0 0; }
.log-tags:empty { display: none; }
.log-tag { padding: 0 var(--space-2); border-radius: var(--radius-sm); background: hsl(var(--surface-sunk)); color: var(--text-2); font-size: 0.8125rem; }
.log-tag.warn { background: hsl(var(--status-amber-bg)); color: hsl(var(--status-amber-fg)); }
.log-item.doubt .log-text { color: var(--text-2); }

/* Desktop: the page is the window; only the lists scroll, inside their panels. */
@media (min-width: 981px) {
  /* The body never scrolls: the header and two panels fill the window. Each column keeps its tabs fixed and scrolls what is below them. */
  .main.results-page { display: flex; height: calc(100vh - 57px); min-height: 560px; flex-direction: column; padding-top: var(--space-2); padding-bottom: var(--space-2); overflow: hidden; }
  .results-page > * { flex: 0 0 auto; }
  .results-page > .results-grid { min-height: 0; flex: 1 1 0; align-items: stretch; }
  .results-left, .results-right { display: flex; min-height: 0; flex-direction: column; }
  .results-left .video-tabs, .results-left .video-picker-row { flex: 0 0 auto; margin-bottom: var(--space-2); }
  .results-left .video-tabs .tab { padding-top: var(--space-1); padding-bottom: var(--space-1); }
  .left-scroll { min-height: 0; flex: 1 1 0; overflow-y: auto; overscroll-behavior: contain; }
  .results-left .player { margin-bottom: var(--space-2); }
  .results-right .tabs { flex: 0 0 auto; margin-bottom: var(--space-2); }
  .results-right .tabs .tab { padding: var(--space-1) var(--space-2); font-size: 0.9375rem; white-space: nowrap; }
  .results-right .tab-panel { min-height: 0; flex: 1 1 0; overflow-y: auto; overscroll-behavior: contain; }
  .results-right .tab-panel.split { overflow: visible; }
  .tab-panel.split .moments-scroll { min-height: 0; flex: 1 1 0; overflow-y: auto; overscroll-behavior: contain; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
}

/* Phone and narrow windows: video (pinned), clip, list. */
@media (max-width: 980px) {
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .results-left, .left-scroll { display: contents; }
  .results-left .player-host { position: sticky; top: var(--topbar-h); z-index: 5; background: hsl(var(--surface-page)); }
  .results-left .player { margin-bottom: var(--space-2); }
  .clip-panel { margin-bottom: var(--space-4); }
  .brand-product { display: none; }
  .sk-results { grid-template-columns: 1fr; }
  .group-head { position: static; }
}
@media (max-width: 700px) {
  .toolbar { flex-wrap: wrap; }
  .tb-btn.tb-filters-toggle { display: inline-flex; }
  .tb-filters { display: none; width: 100%; flex-wrap: wrap; }
  .list-head.filters-open .tb-filters { display: flex; }
  .list-head { position: relative; }
  .tb-drop { position: static; }
  .tb-menu, .tb-drop:not(:first-of-type) .tb-menu { top: 100%; right: var(--space-2); left: var(--space-2); width: auto; max-width: none; }
  .results-head .head-actions { width: 100%; flex-wrap: nowrap; }
  .results-head .head-actions .button { flex: 1 1 auto; padding: 0 var(--space-3); }
}

/* the window the strip shows, at its two ends, while it is zoomed */
.strip-range { display: flex; justify-content: space-between; gap: var(--space-3); margin: var(--space-1) var(--space-3) -6px; color: var(--text-2); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip-range[hidden] { display: none; }

.clip-head { margin-right: var(--space-3); margin-left: var(--space-3); }

/* a control that cannot work here: it stays focusable, looks off, and says why on hover and focus */
.button.is-off { position: relative; opacity: 0.5; cursor: not-allowed; }
.button.is-off::after, .trim[data-tip]::after { position: absolute; z-index: 20; bottom: calc(100% + 6px); left: 50%; width: max-content; max-width: min(300px, 80vw); padding: var(--space-2) var(--space-3); transform: translateX(-50%); border-radius: 6px; background: hsl(var(--ink)); color: hsl(var(--neutral-0)); content: attr(data-tip); font-size: 0.875rem; font-weight: var(--weight-normal); line-height: 1.3; text-align: left; white-space: normal; pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.button.is-off:hover::after, .button.is-off:focus::after, .trim[data-tip]:hover::after { opacity: 1; }
.trim[data-tip] { position: relative; }
.clip-panel .actions { position: relative; }

/* the details modal */
.details-dialog { display: flex; width: min(680px, 100%); max-height: min(86vh, 800px); flex-direction: column; padding: 0; overflow: hidden; }
.d-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); border-bottom: 1px solid hsl(var(--border)); }
.d-head h2 { margin: 0; font-size: 1.125rem; }
.d-when { font-weight: var(--weight-normal); }
.d-close { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer; font-size: 1.75rem; line-height: 1; }
.d-close:hover { background: var(--hover); color: hsl(var(--ink)); }
.d-body { overflow-y: auto; padding: var(--space-2) var(--space-5) var(--space-5); }
.d-section { padding: var(--space-3) 0; border-top: 1px solid hsl(var(--border)); }
.d-section:first-child { border-top: 0; }
.d-section h3 { margin: 0 0 var(--space-2); color: var(--text-2); font-size: 0.8125rem; font-weight: var(--weight-semibold); letter-spacing: 0.02em; text-transform: uppercase; }
.d-section p { margin: 0 0 var(--space-1); color: hsl(var(--ink)); }
.dialog .d-section p { color: hsl(var(--ink)); }
.dialog .d-sub, .dialog .d-caveat, .dialog p.muted { color: var(--text-2); }
.d-sub { font-size: 0.9375rem; }
.d-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.d-conf { margin-left: var(--space-2); font-size: 0.9375rem; }
.d-rules { margin: 0; padding: 0; list-style: none; }
.d-rules li { margin-bottom: var(--space-2); }
.d-rule { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); }
.d-context { width: 100%; border-collapse: collapse; }
.d-context td { padding: var(--space-2) var(--space-2) var(--space-2) 0; border-top: 1px solid hsl(var(--border)); vertical-align: top; font-size: 0.9375rem; }
.d-context td:first-child { width: 1%; white-space: nowrap; }
.d-context tr:first-child td { border-top: 0; }
.d-context tr.this td { background: hsl(var(--brand-orange-50)); }
.d-context tr.this td:first-child { padding-left: var(--space-2); }
.d-desc { display: block; color: var(--text-2); font-weight: var(--weight-normal); }
.d-caveat { margin: var(--space-3) 0 0; font-size: 0.875rem; }
@media (max-width: 700px) {
  .clip-panel .actions { flex-wrap: wrap; }
  .clip-panel .actions .button { flex: 1 1 45%; }
}

.unconfirmed { margin: var(--space-1) var(--space-1) var(--space-2); font-size: 0.875rem; }

/* ---- the restrictions card: two ways in, typing as a second option */
.ws-lead { margin: 0 0 var(--space-3); }
.ws-manual { margin-top: var(--space-3); }
.ws-manual > summary { cursor: pointer; color: hsl(var(--ink)); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.ws-manual > summary:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--r); }
.ws-manual[open] > summary { margin-bottom: var(--space-2); }
.saved-restrictions { margin: var(--space-3) 0 0; }

/* ---- the clip being cut: what is happening, for how long, and a way out */
.clip-status { grid-auto-flow: row; gap: var(--space-2); align-content: center; }
.clip-status .spinner { border-color: hsl(var(--neutral-0) / 0.4); border-top-color: hsl(var(--neutral-0)); }
.clip-status .clip-elapsed { color: hsl(var(--neutral-0) / 0.8); font-weight: var(--weight-regular); }
.clip-status .clip-cancel { color: hsl(var(--ink)); }
