/* Katara Studios screening room.
   Brand: KS Black dominant (70-95%), Graphite for secondary text, the KS gradient only on
   dividers and separators (never as an accent, a fill or an indicator), secondary colours
   for status only. KSZok Condensed for
   headlines (tight leading), Lama Sans for everything else. Dark only, like the studio's site. */

@font-face { font-family: "KSZok Condensed"; src: url("/static/fonts/KSZok-headings.woff2") format("woff2");
             font-weight: 400; font-display: swap; }
@font-face { font-family: "Lama Sans"; src: url("/static/fonts/LamaSans-light.woff2") format("woff2");
             font-weight: 300; font-display: swap; }
@font-face { font-family: "Lama Sans"; src: url("/static/fonts/LamaSans-regular.woff2") format("woff2");
             font-weight: 400; font-display: swap; }
@font-face { font-family: "Lama Sans"; src: url("/static/fonts/LamaSans-extrabold.woff2") format("woff2");
             font-weight: 800; font-display: swap; }

:root {
  color-scheme: dark;
  --black: #000; --white: #fff;
  --graphite: #898c8a; --graphite-80: #b4b6b7; --graphite-40: #cbcccc;
  --purple: #a05eb5; --pink: #d961a0; --salmon: #f2928b; --yellow: #fdd26e;
  --aqua: #8dcdc4; --blue: #64ceea; --violet: #685bc7;
  --ks-gradient: linear-gradient(90deg, #a05eb5 0%, #d961a0 15%, #f2928b 30%, #fdd26e 50%, #8dcdc4 70%, #64ceea 85%, #685bc7 100%);

  /* Panels a step above the black page, edges a step above the panels, and fields an
     inset a step below them, so every box reads where it starts and ends. */
  --surface: #151515; --surface-2: #1b1b1b; --surface-3: #252525;
  --line: #2b2b2b; --line-2: #3b3b3b;
  --field: #0c0c0c;
  --text: #f4f4f3; --text-2: var(--graphite-80); --text-3: var(--graphite);
  --ok: var(--aqua); --warn: var(--yellow); --bad: var(--salmon); --info: var(--blue);

  --font-display: "KSZok Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "Lama Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--black); color: var(--text);
       font: 300 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: rgba(160, 94, 181, .45); color: var(--white); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a { color: var(--white); text-decoration-color: rgba(255, 255, 255, .35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--white); }
strong, b { font-weight: 800; }
em { font-style: normal; font-weight: 800; }
img { display: block; max-width: 100%; }

h1, .display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
               line-height: .86; letter-spacing: -.01em; margin: 0 0 18px; font-size: clamp(2.4rem, 5vw, 3.6rem); }
h2 { font: 800 1.02rem/1.3 var(--font-body); letter-spacing: .01em; margin: 0 0 14px; }
h3 { font: 800 .95rem/1.3 var(--font-body); margin: 0 0 10px; }
p { margin: 0 0 12px; }
small, .small { font-size: .84rem; font-weight: 400; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.error { color: var(--bad); font-weight: 400; }
code { font-family: var(--mono); font-size: .9em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[dir="auto"] { unicode-bidi: plaintext; }
/* An Arabic title still lines up with the page on an English layout. */
h1[dir="auto"], a[dir="auto"] { text-align: left; }

/* The KS gradient as a divider: the "colour bar". Dividers and separators only. */
.keyline { height: 2px; background: var(--ks-gradient); border: 0; margin: 0; }

/* --- forms ---------------------------------------------------------------- */

label { display: block; margin: 18px 0 7px; color: var(--text-2); font: 800 .72rem/1.2 var(--font-body);
        letter-spacing: .14em; text-transform: uppercase; }
input, textarea, select { width: 100%; min-height: 48px; padding: 12px 14px; font: 400 1rem/1.4 var(--font-body);
        color: var(--text); background: var(--field); border: 1px solid var(--line-2); border-radius: var(--radius);
        transition: border-color 150ms ease, background-color 150ms ease; }
input::placeholder, textarea::placeholder { color: #5c5e5d; }
input:hover, textarea:hover { border-color: #4a4a4a; }
input:focus, textarea:focus { outline: none; border-color: var(--white); background: #080808; }
input:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(100, 206, 234, .25); }
textarea { min-height: 200px; resize: vertical; line-height: 1.55; }
input[type="file"] { padding: 9px; color: var(--text-2); cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: 14px; padding: 8px 14px; border: 1px solid var(--line-2);
        border-radius: var(--radius); background: var(--surface-3); color: var(--text);
        font: 800 .78rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
input[type="checkbox"] { width: 18px; min-height: 0; height: 18px; accent-color: var(--white); }
/* iOS Safari sizes date fields to their text, past the card's edge, and centres it. */
input[type="datetime-local"], input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none;
        display: block; min-width: 0; max-width: 100%; text-align: left; }
input::-webkit-date-and-time-value { margin: 0; text-align: left; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 18px; }
.row > * { min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; color: var(--text);
         font: 300 .95rem/1.5 var(--font-body); letter-spacing: 0; text-transform: none; cursor: pointer; }
.check input { flex: none; margin-top: 3px; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
        margin-top: 22px; padding: 0 24px; border: 1px solid var(--white); border-radius: var(--radius);
        background: var(--white); color: var(--black); cursor: pointer; text-decoration: none;
        font: 800 .8rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase;
        transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease; }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
@media (hover: hover) and (pointer: fine) {
  button:hover, .button:hover { background: #e7e7e5; border-color: #e7e7e5; }
  button.secondary-btn:hover, .button.ghost:hover { background: rgba(255, 255, 255, .06); border-color: var(--white); }
  button.danger:hover { background: rgba(242, 146, 139, .1); border-color: var(--bad); }
}
button.secondary-btn, .button.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
button.danger { background: transparent; color: var(--bad); border-color: rgba(242, 146, 139, .55); }
button.link { min-height: 0; margin: 0; padding: 0; border: 0; background: none; color: var(--text-2);
              font: 400 .9rem/1.4 var(--font-body); letter-spacing: 0; text-transform: none; text-decoration: underline;
              text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { button.link:hover { background: none; color: var(--white); } }
.block { width: 100%; }

.notice { margin: 16px 0; padding: 14px 16px; border-left: 2px solid var(--warn); background: rgba(253, 210, 110, .06);
          color: var(--text); font-size: .95rem; border-radius: 0 var(--radius) var(--radius) 0; }
.notice strong { font-weight: 800; }

/* --- status pills ----------------------------------------------------------- */

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 9px; border-radius: 999px;
        border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; vertical-align: middle;
        font: 800 .66rem/1.2 var(--font-body); letter-spacing: .12em; text-transform: uppercase; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--graphite); flex: none; }
.pill.ready, .pill.live, .pill.active { color: var(--ok); border-color: rgba(141, 205, 196, .35); }
.pill.ready::before, .pill.live::before, .pill.active::before { background: var(--ok); }
.pill.live::before { box-shadow: 0 0 0 3px rgba(141, 205, 196, .18); }
.pill.waiting, .pill.preparing, .pill.draft, .pill.pending { color: var(--warn); border-color: rgba(253, 210, 110, .3); }
.pill.waiting::before, .pill.preparing::before, .pill.draft::before, .pill.pending::before { background: var(--warn); }
.pill.errored, .pill.revoked { color: var(--bad); border-color: rgba(242, 146, 139, .35); }
.pill.errored::before, .pill.revoked::before { background: var(--bad); }

/* --- tables ------------------------------------------------------------------- */

.table-wrap { position: relative; overflow-x: auto; margin: 0 -4px; padding: 0 4px; } /* relative: keeps the hidden "Actions" label inside the scroller */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { padding: 0 12px 12px; text-align: left; vertical-align: bottom; white-space: nowrap; color: var(--text-3);
     font: 800 .66rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; border-bottom: 1px solid var(--line-2); }
td { padding: 14px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr { transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { tbody tr:hover { background: rgba(255, 255, 255, .025); } }
td .muted { font-size: .84rem; }
td a { font-weight: 800; text-decoration: none; }
td a:hover { text-decoration: underline; }
td button { min-height: 32px; margin-top: 0; padding: 0 12px; font-size: .66rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
td.nowrap { white-space: nowrap; }

/* --- the admin console --------------------------------------------------------- */

.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 14px 28px;
       background: rgba(0, 0, 0, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ks-gradient); opacity: .7; }
.bar form { margin: 0 0 0 auto; }
.who { display: flex; align-items: center; gap: 16px; }
.who-name { display: flex; flex-direction: column; align-items: flex-end; color: var(--text); font: 400 .84rem/1.25 var(--font-body); }
.who-role { color: var(--text-3); font: 800 .6rem/1.4 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.brand { display: flex; align-items: center; gap: 16px; color: var(--white); text-decoration: none; }
.brand img { width: 64px; height: auto; }
.brand-name { padding-left: 16px; border-left: 1px solid var(--line-2); font: 800 .72rem/1.2 var(--font-body);
              letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--text-2); text-decoration: none;
         font: 800 .72rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; transition: color 150ms ease, background-color 150ms ease; }
.nav a:hover { color: var(--white); background: rgba(255, 255, 255, .05); }
.nav a[aria-current="page"] { color: var(--white); }
main { max-width: 1180px; margin: 0 auto; padding: 44px 28px 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 24px; margin-bottom: 30px; }
.page-head h1 { margin: 0; }
.page-head .button { margin-top: 0; }
.back { display: inline-flex; gap: 8px; margin-bottom: 18px; color: var(--text-2); text-decoration: none;
        font: 800 .7rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.back:hover { color: var(--white); }
section { margin: 0 0 40px; }
.card { position: relative; margin: 0 0 28px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-title { margin: 0 0 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 28px; align-items: start; }
.danger-zone { border-color: rgba(242, 146, 139, .28); }
.danger-zone button { margin-top: 8px; }
.empty { padding: 44px 24px; text-align: center; color: var(--text-2); border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* Facts about a screening, as tiles. */
/* Flex, not grid: the tiles in each row grow to fill it, so no empty cell ever shows. */
.facts { display: flex; flex-wrap: wrap; gap: 1px; margin: 0 0 28px;
         background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fact { flex: 1 1 190px; margin: 0; padding: 18px 20px; background: var(--surface); }
.fact dt { margin-bottom: 10px; color: var(--text-3); font: 800 .66rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.fact dd { margin: 0; font-weight: 400; }
.fact dd .muted { display: block; margin-top: 8px; font-size: .84rem; line-height: 1.45; }
.fact.wide { flex-basis: 380px; flex-grow: 2; }
.meter { display: block; height: 4px; margin-top: 12px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--text); }

.upload { margin-top: 20px; }
progress { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border: 0; border-radius: 2px;
           background: var(--surface-3); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-3); }
progress::-webkit-progress-value { background: var(--text); }
progress::-moz-progress-bar { background: var(--text); }
.upload p { margin-top: 10px; color: var(--text-2); font-size: .9rem; }
.linkbox { display: flex; gap: 8px; align-items: stretch; margin-top: 14px; }
.linkbox input { font-family: var(--mono); font-size: .86rem; }
.linkbox button { margin-top: 0; white-space: nowrap; }
.link-result { border-color: rgba(100, 206, 234, .35); }
.lookup-form { max-width: 520px; }

/* Sign-in, matching Deckorator's: the showreel behind, the lockup, the keyline, one button. */
body.signin { background: #0a0a0a; color: #f5f5f5; }
/* Full width: not the admin pages' 1180px column, or the film is cut off at its sides. */
.signin-page { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh;
               max-width: none; margin: 0; padding: 32px; overflow: hidden; }
.backdrop { position: absolute; inset: 0; pointer-events: none; }
/* Cover-fit at the film's own ratio, so the player never letterboxes; 1.02 hides edge slivers. */
/* Black until the film is playing (showreel.js), then a slow fade in: never the player's grey. */
.backdrop iframe { position: absolute; left: 50%; top: 50%; border: 0; opacity: 0; transition: opacity 1.8s cubic-bezier(.4, 0, .2, 1);
                   width: max(100vw, calc(100vh * 16 / 9)); height: max(100vh, calc(100vw * 9 / 16));
                   transform: translate(-50%, -50%) scale(1.02); }
.backdrop.playing iframe { opacity: .5; }
.backdrop.scope iframe { width: max(100vw, calc(100vh * 426 / 178)); height: max(100vh, calc(100vw * 178 / 426)); }
.backdrop .scrim { position: absolute; inset: 0; background: rgba(10, 10, 10, .45); }
@media (prefers-reduced-motion: reduce) { .backdrop { display: none; } }
.signin-column { position: relative; width: 100%; max-width: 320px; text-align: center; }
.signin-logo { width: 139px; height: auto; margin: 0 auto; }
.wordmark { margin: 24px 0 0; font: 400 3rem/1 var(--font-display); letter-spacing: .025em; text-transform: uppercase; white-space: nowrap; }
.signin-keyline { width: 240px; height: 2px; margin: 24px auto 0; border-radius: 999px; background: var(--ks-gradient); }
.signin-note { margin: 24px 0 0; color: #a3a3a3; font: 400 .875rem/1.25rem var(--font-body); }
.signin-error { margin: 16px 0 0; padding: 8px 12px; border-radius: 6px; background: rgba(239, 68, 68, .1); color: #f87171;
                font: 400 .875rem/1.25rem var(--font-body); }
.google-button, button.google-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 0; margin: 24px 0 0; padding: 10px 16px; border: 0; border-radius: 6px; background: #fff; color: #171717;
  font: 400 1rem/1.5rem var(--font-body); letter-spacing: 0; text-transform: none; text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out); }
.google-button:hover, button.google-button:hover { background: #e5e5e5; border-color: transparent; }
.google-button:active { transform: scale(.97); }
.key-login { margin-top: 20px; }
.key-login summary { display: inline-block; list-style: none; color: #737373; cursor: pointer; font: 400 .8125rem/1.25rem var(--font-body);
                     transition: color 150ms ease; }
.key-login summary::-webkit-details-marker { display: none; }
.key-login summary:hover { color: #f5f5f5; }
.key-login form { margin-top: 12px; }
.key-login input { min-height: 44px; border-radius: 6px; background: rgba(10, 10, 10, .6); text-align: center; }
.key-login .key-button { width: 100%; min-height: 40px; margin-top: 8px; border-radius: 6px; background: transparent; color: #f5f5f5;
                         border-color: #404040; font: 400 .875rem/1.25rem var(--font-body); letter-spacing: 0; text-transform: none; }
.key-login .google-button { margin-top: 12px; }

/* --- audience, viewers, the log, traces ------------------------------------------ */

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 18px; }
.section-head .section-title { margin: 0; }
.head-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.quiet-link { color: var(--text-2); text-decoration: none; font: 800 .68rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase;
              transition: color 150ms ease; }
.quiet-link:hover { color: var(--white); }
.head-sub { margin: 14px 0 0; }
.head-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 28px; }
.head-actions button { margin-top: 0; min-height: 40px; padding: 0 18px; }
.line { display: block; }
.nowrap { white-space: nowrap; }
.spaced { margin-top: 24px; }
.hint { margin: 8px 0 0; }
.figure { font-weight: 400; font-variant-numeric: tabular-nums; }
.notice.bad { border-left-color: var(--bad); background: rgba(242, 146, 139, .07); }
.inline-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -10px 0 26px; }
.inline-setting label { margin: 0; }
.inline-setting select { width: auto; min-width: 200px; min-height: 40px; padding: 8px 12px; }
.pill.match { color: var(--bad); border-color: rgba(242, 146, 139, .35); }
.pill.match::before { background: var(--bad); }
select { cursor: pointer; }

/* The audience in numbers. */
.stats { display: flex; flex-wrap: wrap; gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line);
         border-radius: var(--radius); overflow: hidden; }
.stat { display: flex; flex-direction: column; flex: 1 1 140px; margin: 0; padding: 18px 20px 16px; background: var(--surface); }
.stat dt { margin-bottom: 12px; color: var(--text-3); font: 800 .66rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.stat dd { margin: auto 0 0; font: 400 2.3rem/.9 var(--font-display); font-variant-numeric: tabular-nums; }
.stat.now dd { color: var(--ok); }

/* Flags under a viewer's status. */
.tag { display: block; margin-top: 6px; color: var(--warn); font: 400 .8rem/1.35 var(--font-body); }
.tag.bad { color: var(--bad); }
.meter.inline { display: inline-block; width: 56px; height: 3px; margin: 0 0 0 10px; vertical-align: middle; }

/* Tables that never scroll sideways: columns drop, then rows become cards. */
.table-wrap.fit { overflow: visible; margin: 0; padding: 0; }
table.stack td.primary { overflow-wrap: anywhere; }
table.viewers td.primary { max-width: 280px; }
table.viewers td.actions { width: 1%; text-align: right; }
table.log td.when { width: 1%; color: var(--text-2); font-variant-numeric: tabular-nums; }
table.log td.what { min-width: 220px; }
table.log tr.alert td:first-child, table.stack tr.alert td:first-child { box-shadow: inset 2px 0 0 var(--bad); }
td.strip-cell { width: 180px; min-width: 120px; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; vertical-align: 1px; background: var(--graphite); }
.dot.access { background: var(--blue); }
.dot.playback { background: var(--aqua); }
.dot.alerts { background: var(--bad); }
.dot.admin { background: var(--graphite-80); }

/* A row's menu: a details element, so it works without script. */
details.menu { position: relative; display: inline-block; text-align: left; }
details.menu > summary { display: inline-flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 12px; list-style: none;
  border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--text); cursor: pointer; user-select: none; white-space: nowrap;
  font: 800 .66rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase;
  transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform 160ms var(--ease-out); }
details.menu[open] > summary { border-color: var(--white); }
details.menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
details.menu > summary:active { transform: scale(.97); }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .9);
  transform-origin: top right; animation: ks-pop 150ms var(--ease-out); }
@keyframes ks-pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-list a, .menu-list button, td .menu-list button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 38px;
  margin: 0; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: left; text-decoration: none;
  font: 400 .9rem/1.2 var(--font-body); letter-spacing: 0; text-transform: none; }
.menu-list .bad, td .menu-list button.bad { color: var(--bad); }
@media (hover: hover) and (pointer: fine) {
  details.menu > summary:hover { border-color: var(--white); background: rgba(255, 255, 255, .06); }
  .menu-list a:hover, .menu-list button:hover { background: rgba(255, 255, 255, .07); border-color: transparent; text-decoration: none; }
}

/* Charts: SVG drawn on a 0-1000 axis, stretched to the width. */
figure.card { margin: 0 0 28px; }
.chart figcaption { margin-bottom: 18px; }
.chart h3 { margin-bottom: 4px; }
.chart figcaption p { margin: 0; }
.plot { position: relative; }
svg.retention { display: block; width: 100%; height: 160px; overflow: visible; }
.y-label { position: absolute; right: 0; padding-left: 6px; background: var(--surface); color: var(--text-3); font: 400 .72rem/1 var(--font-body); }
.y-label.top { top: -6px; }
.y-label.mid { top: calc(50% - 6px); }
svg.retention .area { fill: rgba(255, 255, 255, .12); stroke: var(--white); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
svg.retention .grid { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; margin-top: 10px; color: var(--text-3); font: 400 .78rem/1 var(--font-body);
        font-variant-numeric: tabular-nums; }
svg.coverage { display: block; width: 100%; height: 28px; }
svg.coverage.mini { height: 8px; border-radius: 2px; }
svg.coverage .track { fill: var(--surface-3); }
svg.coverage .seen { fill: var(--text); }
svg.coverage .mark { fill: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 0; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--text); }
.key.mark { background: var(--bad); }
.insights .card h3 { margin-bottom: 4px; }
ul.bars, ul.plain { list-style: none; margin: 0; padding: 0; }
ul.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
ul.bars li .meter { grid-column: 1 / -1; height: 3px; margin: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; overflow-wrap: anywhere; }

/* The log's filters. */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 16px; margin: -6px 0 26px; }
.filters > div { flex: 0 1 260px; min-width: 200px; }
.filters label { margin-top: 0; }
.chip-cell { display: flex; align-items: flex-end; min-height: 48px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 5px 0 14px; border: 1px solid var(--line-2);
        border-radius: 999px; font-size: .92rem; font-weight: 400; }
.chip a { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--text-2); text-decoration: none; font-size: 1.1rem; }
.chip a:hover { background: rgba(255, 255, 255, .08); color: var(--white); }
.more { margin: 22px 0 0; text-align: center; }
.more .button { margin-top: 0; }

/* A trace's verdict. */
.verdict.match, .verdict.several { border-color: rgba(242, 146, 139, .45); }
.verdict-label { margin: 0 0 12px; color: var(--text-3); font: 800 .7rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.verdict-name { margin: 0 0 14px; font: 400 clamp(2.6rem, 7vw, 4.2rem)/.88 var(--font-display); text-transform: uppercase; overflow-wrap: anywhere; }
.verdict-name a { text-decoration: none; }
.verdict p:last-child { margin-bottom: 0; }

/* The page's own dialogs (admin.js ask): confirmations, a reason, an error. */
dialog.modal { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 64px); margin: auto; padding: 0; overflow: auto;
               border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--text);
               box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .95); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: ks-modal 200ms var(--ease-out); }
dialog.modal[open]::backdrop { animation: ks-fade 200ms ease; }
@keyframes ks-modal { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ks-fade { from { opacity: 0; } to { opacity: 1; } }
dialog.modal form { padding: 28px 28px 24px; }
dialog.modal h2 { margin: 0 0 10px; font-size: 1.12rem; overflow-wrap: anywhere; }
dialog.modal p { margin: 0; color: var(--text-2); }
dialog.modal label:not(.check) { margin-top: 22px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.modal-actions button { margin-top: 0; min-height: 44px; padding: 0 20px; }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--black); }
@media (hover: hover) and (pointer: fine) {
  button.danger.solid:hover { background: #f5a69f; border-color: #f5a69f; }
}
@media (max-width: 480px) {
  .modal-actions button { flex: 1 1 auto; }
}

@media (max-width: 1000px) {
  table.viewers .col-optional { display: none; }
}
@media (max-width: 860px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-bottom: 10px; padding: 16px 18px;
                   background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  table.stack tr.alert { border-color: rgba(242, 146, 139, .45); }
  table.stack tr.alert td:first-child { box-shadow: none; }
  table.stack td, table.stack td.col-optional { display: block; min-width: 0; padding: 0; border: 0; }
  table.stack td.nowrap { white-space: normal; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 6px; color: var(--text-3);
                                       font: 800 .62rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
  table.stack td.primary, table.stack td.what, table.stack td.strip-cell { grid-column: 1 / -1; }
  table.stack td.actions { grid-column: 1 / -1; width: auto; text-align: left; }
  table.stack td.actions .menu-list { left: 0; right: auto; transform-origin: top left; }
  /* The log stays compact: the time, the event, then who and where on one line. */
  table.log tr { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 12px 16px; margin-bottom: 8px; }
  table.log td { color: var(--text-2); font-size: .84rem; }
  table.log td[data-label]::before { content: none; }
  table.log td.when, table.log td.what { flex-basis: 100%; width: auto; min-width: 0; }
  table.log td.when { color: var(--text-3); font-size: .8rem; }
  table.log td.what { margin-bottom: 2px; color: var(--text); font-size: .95rem; }
  table.log td.blank { display: none; }
  table.log td .line { display: inline; margin-left: 8px; }
  table.viewers td.primary { max-width: none; }
}

/* --- staff and watermarks --------------------------------------------------------- */

dl.roles { margin: 0; }
dl.roles div { padding: 10px 0; border-bottom: 1px solid var(--line); }
dl.roles dt { font-weight: 800; }
dl.roles dd { margin: 4px 0 0; color: var(--text-2); font-size: .92rem; }
table.staff select { width: auto; min-width: 140px; min-height: 36px; padding: 6px 10px; }
tr.inactive td { color: var(--text-3); }
td .small-btn { min-height: 34px; padding: 0 12px; white-space: nowrap; }
.label-like { margin: 18px 0 7px; color: var(--text-2); font: 800 .72rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
.grid-2.tight { gap: 0 28px; }
fieldset.checks { margin: 18px 0 0; padding: 0; border: 0; }
fieldset.checks legend { margin-bottom: 4px; padding: 0; color: var(--text-2); font: 800 .72rem/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; }
fieldset.checks .check { margin-top: 10px; }
input[type="range"] { min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--white); }
label output { margin-left: 8px; color: var(--text); letter-spacing: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* The watermark at the chosen strength over the showreel at full strength, as a viewer
   sees it; a dark, busy stand-in until the film plays, or if Vimeo won't play it here. */
.wm-preview { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; container-type: inline-size; background:
  radial-gradient(60% 80% at 30% 40%, #3a3f46, transparent 70%), radial-gradient(50% 60% at 75% 65%, #6b5a47, transparent 70%), #15171a; }
/* Cover-fit to the 16:9 box rather than the window. */
.wm-preview .backdrop iframe { width: 100cqw; height: calc(100cqw * 9 / 16); }
.wm-preview .backdrop.scope iframe { width: calc(100cqw * 9 / 16 * 426 / 178); }
.wm-preview .backdrop.playing iframe { opacity: 1; }
.wm-preview .backdrop .scrim { display: none; }
.wm-preview-mark { position: absolute; left: 8%; top: 18%; max-width: 84%; color: #fff; font: 800 .82rem/1.3 var(--font-body);
                   -webkit-text-stroke: 3px rgba(0, 0, 0, .9); paint-order: stroke fill; }
.wm-preview-pattern { position: absolute; inset: -40%; display: block; color: #808080; font: 400 .66rem/2.6 var(--font-body);
                      transform: rotate(-24deg); word-spacing: 4em; overflow: hidden; }

/* --- the viewer's side ------------------------------------------------------------ */

body.viewer { background: var(--black); overflow-x: hidden; }
/* Light as the narrative device: a soft projector glow from above. */
body.viewer::before { content: ""; position: fixed; inset: -20vh -10vw auto; height: 80vh; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 55% at 50% 0%, rgba(255, 255, 255, .075), transparent 70%),
              radial-gradient(40% 35% at 30% 0%, rgba(160, 94, 181, .07), transparent 70%),
              radial-gradient(40% 35% at 72% 0%, rgba(100, 206, 234, .06), transparent 70%); }
.v-shell { display: flex; flex-direction: column; min-height: 100vh; }
.v-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 26px 32px 0; }
.v-top img { width: 96px; height: auto; }
.v-who { color: var(--text-2); font-size: .84rem; font-weight: 400; text-align: right; }
.v-who strong { color: var(--white); }
.viewer-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 48px 32px 64px; }

.v-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center;
          min-height: calc(100vh - 290px); }
@media (max-width: 860px) { .v-hero { grid-template-columns: 1fr; gap: 36px; min-height: 0; } }
.v-title { font-size: clamp(3.6rem, 9vw, 7.4rem); line-height: .84; margin: 0 0 22px; overflow-wrap: anywhere; }
.v-window { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; color: var(--text-2); font-size: .95rem; }
.v-window strong { color: var(--text); font-weight: 400; }
.v-card { position: relative; padding: 32px; background: rgba(23, 23, 23, .94); border: 1px solid var(--line-2);
          border-radius: var(--radius); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9); }
.v-card h2 { font-size: 1.1rem; }
.v-card .muted { font-size: .95rem; }
.v-card > form:first-child > label:first-child { margin-top: 0; }
.v-single { max-width: 560px; margin: 0 auto; }
.v-message { max-width: 620px; margin: 6vh auto 0; }
.v-message h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
.v-message p { color: var(--text-2); font-size: 1.05rem; max-width: 46ch; }

.code-input { min-height: 64px; text-align: center; font: 400 2rem/1 var(--mono); letter-spacing: .5em; padding-left: calc(14px + .5em); }
.nda-heading { margin-top: 26px; }
.nda { position: relative; max-height: 280px; overflow-y: auto; padding: 16px 18px 28px;
       font-size: .9rem; font-weight: 400; line-height: 1.6; color: var(--text-2); background: var(--field);
       border: 1px solid var(--line-2); border-radius: 0 0 var(--radius) var(--radius);
       -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.nda h3, .nda h4, .nda h5 { margin: 18px 0 8px; color: var(--text); font: 800 .9rem/1.35 var(--font-body); }
.nda h3:first-child { margin-top: 0; font-size: 1rem; }
.nda p { margin: 0 0 10px; }
.nda ul { margin: 0 0 10px; padding-inline-start: 20px; }
.nda li { margin-bottom: 6px; }
.nda strong { color: var(--text); }
.nda[dir="rtl"] { text-align: right; line-height: 1.8; }
/* The NDA's language tabs: radios, so they work without script. */
.nda-tabs { position: relative; }
.tab-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tab-list { display: flex; gap: 2px; }
.tab-list label { margin: 0; padding: 10px 16px; border: 1px solid var(--line-2); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
                  background: transparent; color: var(--text-3); cursor: pointer; font: 800 .74rem/1 var(--font-body);
                  letter-spacing: .1em; text-transform: uppercase; transition: color 150ms ease, background-color 150ms ease; }
.tab-list label[lang="ar"] { font-size: .86rem; letter-spacing: 0; }
.nda-panel { display: none; }
.id-ar { margin-left: 8px; letter-spacing: 0; text-transform: none; font-size: .82rem; font-weight: 400; }
.tab-radio[value="en"]:checked ~ .nda-panel[data-lang="en"], .tab-radio[value="ar"]:checked ~ .nda-panel[data-lang="ar"] { display: block; }
.tab-radio[value="en"]:checked ~ .tab-list label[lang="en"], .tab-radio[value="ar"]:checked ~ .tab-list label[lang="ar"] { background: var(--field); color: var(--text); }
.tab-radio[value="en"]:focus-visible ~ .tab-list label[lang="en"], .tab-radio[value="ar"]:focus-visible ~ .tab-list label[lang="ar"] { outline: 2px solid var(--blue); outline-offset: 2px; }
.nda-editor textarea { min-height: 460px; border-radius: 0 var(--radius) var(--radius) var(--radius); font: 400 .92rem/1.6 var(--font-body); }
.nda-editor textarea[dir="rtl"] { line-height: 1.85; }
.nda.preview { max-height: 520px; }
.nda:focus-visible { -webkit-mask-image: none; mask-image: none; }
.secondary { margin-top: 18px; }

/* Entrances, for pages seen once or twice: never for anything repeated. */
@keyframes ks-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise { animation: ks-rise .7s var(--ease-out) both; }
.rise-2 { animation: ks-rise .7s var(--ease-out) .08s both; }
@media (prefers-reduced-motion: reduce) {
  .rise, .rise-2, .menu-list, dialog.modal[open], dialog.modal[open]::backdrop { animation: none; }
  *, *::before, *::after { transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* --- the watch page --------------------------------------------------------------- */

body.viewer .viewer-main:has(.watch) { max-width: 1320px; padding-top: 32px; }
.watch-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 32px; margin-bottom: 26px; }
.watch-head h1 { font-size: clamp(3rem, 6vw, 4.8rem); margin: 0; }
.watch-head .v-window { justify-content: flex-end; text-align: right; }
@media (max-width: 700px) { .watch-head .v-window { justify-content: flex-start; text-align: left; } }
/* The screen: the Brand Window, lit from behind. The glow lives on this wrapper, never on
   the stage, whose children the watermark checks. */
.screen { position: relative; }
.screen::before { content: ""; position: absolute; inset: 8% 4% -6%; z-index: -1; pointer-events: none; filter: blur(60px);
                  background: radial-gradient(closest-side, rgba(100, 206, 234, .10), rgba(160, 94, 181, .07) 55%, transparent); }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden;
         box-shadow: 0 0 0 1px #1c1c1c, 0 50px 120px -50px rgba(0, 0, 0, .95); -webkit-user-select: none; user-select: none; }
.stage mux-player { position: absolute; inset: 0; width: 100%; height: 100%;
                    --pip-button: none; --bottom-pip-button: none; --center-pip-button: none;
                    --cast-button: none; --bottom-cast-button: none; --center-cast-button: none;
                    --airplay-button: none; --bottom-airplay-button: none; --center-airplay-button: none; }
/* Above the watermark; clicks pass through to the player underneath. */
.stage-message { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-content: center; gap: 16px;
                 padding: 32px; text-align: center; color: var(--graphite-40); font-size: 1rem; font-weight: 400; pointer-events: none; }
.stage-message[hidden] { display: none; }
.stage-message::after { content: ""; width: 120px; height: 2px; background: var(--line-2)
                          linear-gradient(90deg, transparent, var(--graphite-40), transparent) 0 0 / 50% 100% no-repeat;
                        animation: ks-scan 1.6s linear infinite; }
@keyframes ks-scan { from { background-position: -100% 0; } to { background-position: 200% 0; } }
.stage-message.final::after { display: none; }

/* The watermark is drawn on a canvas inside this host (watermark.js); it checks these values. */
.wm { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; opacity: 1; }
.stage:fullscreen, .stage:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; aspect-ratio: auto; box-shadow: none; }
.stage.no-fullscreen mux-player { --fullscreen-button: none; --bottom-fullscreen-button: none; --center-fullscreen-button: none; }

/* Before the window opens: a countdown. */
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 26px 0 8px; max-width: 560px;
             background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.countdown div { padding: 18px 10px 14px; background: var(--surface); text-align: center; }
.countdown b { display: block; font: 400 clamp(2.4rem, 7vw, 3.6rem)/.9 var(--font-display); font-variant-numeric: tabular-nums; }
.countdown span { display: block; margin-top: 8px; color: var(--text-3); font: 800 .62rem/1 var(--font-body); letter-spacing: .16em; text-transform: uppercase; }

/* Our own control bar (local films). */
.stage .local-video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }
.pc { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; align-items: center; gap: 6px;
      padding: 36px 16px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .82)); color: #fff;
      font: 400 .8rem/1 var(--font-body); transition: opacity 300ms ease; }
.stage.pc-idle .pc { opacity: 0; }
.stage.pc-idle { cursor: none; }
.pc button { display: inline-grid; place-items: center; width: 38px; min-height: 38px; height: 38px; margin: 0; padding: 0;
             border: 0; border-radius: 50%; background: transparent; color: #fff; letter-spacing: 0; }
.pc button svg { width: 20px; height: 20px; fill: currentColor; }
@media (hover: hover) and (pointer: fine) { .pc button:hover { background: rgba(255, 255, 255, .12); border: 0; } }
.pc button[hidden] { display: none; }
.pc input[type=range] { -webkit-appearance: none; appearance: none; min-height: 0; height: 20px; padding: 0; border: 0;
                        background: transparent; cursor: pointer; }
.pc input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #fff var(--p, 0%), rgba(255, 255, 255, .25) var(--p, 0%)); }
.pc input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.pc input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: #fff; }
.pc input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%;
                                               background: #fff; transition: transform 150ms var(--ease-out); }
.pc input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.pc input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
.pc .pc-seek { flex: 1; min-width: 60px; margin: 0 8px; }
.pc .pc-vol { width: 84px; }
.pc .pc-time, .pc .pc-dur { font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: center; color: rgba(255, 255, 255, .85); }
@media (max-width: 560px) { .pc .pc-vol { display: none; } .pc { padding-left: 8px; padding-right: 8px; } }

/* Screenshot shield: above the video, below the watermark, so a capture shows black + name. */
.shield { position: absolute; inset: 0; z-index: 4; background: #000; display: grid; place-items: center; }
.shield[hidden] { display: none; }
.stage.shielded mux-player, .stage.shielded .local-video { visibility: hidden; }
/* The bar sits above the shield; its play button would bring back sound under a black picture. */
.stage.shielded .pc { display: none; }
.shield-box { max-width: 440px; padding: 24px; text-align: center; color: var(--graphite-40); font-weight: 400; }
.shield-box p { margin: 0 0 6px; }
.shield-resume { margin-top: 18px; }

/* --- small screens ------------------------------------------------------------------ */

@media (max-width: 720px) {
  .bar { gap: 14px; padding: 12px 18px; flex-wrap: wrap; }
  .brand-name { display: none; }
  .nav { order: 3; flex-wrap: wrap; width: 100%; margin: 0 -12px; }
  .who-name { display: none; }
  main { padding: 30px 18px 72px; }
  .card { padding: 22px 18px; }
  .v-top { padding: 20px 18px 0; }
  .v-top img { width: 76px; }
  .viewer-main { padding: 32px 18px 48px; }
  .v-card { padding: 24px 20px; }
  .grid-2 { grid-template-columns: 1fr; }
}
