/* TwinNest VStudio — design tokens and components. Tailwind (vendored browser build) supplies layout
 * utilities; this file declares the same layer order so utilities still override components. */
@layer theme, base, components, utilities;

/* Cairo (variable, 200–1000) — vendored from @fontsource-variable/cairo, see vendor/VERSIONS.txt */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url(/static/vendor/cairo/cairo-arabic-wght-normal.woff2) format('woff2-variations'), url(/static/vendor/cairo/cairo-arabic-wght-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EEFF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url(/static/vendor/cairo/cairo-latin-ext-wght-normal.woff2) format('woff2-variations'), url(/static/vendor/cairo/cairo-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url(/static/vendor/cairo/cairo-latin-wght-normal.woff2) format('woff2-variations'), url(/static/vendor/cairo/cairo-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --ink-950: #0a0a0d;
  --ink-900: #101014;
  --ink-850: #15151b;
  --ink-800: #1b1b22;
  --ink-700: #25252e;
  --ink-600: #32323d;
  --gold-200: #f8e08e;
  --gold-400: #e3b341;
  --gold-600: #a9781e;
  --gold-grad: linear-gradient(135deg, #f8e08e 0%, #e3b341 50%, #a9781e 100%);
  --ivory: #fff8ec;
  --silver: #c9c5bd;
  --champagne: #d9c7a0;
  --mute: #9a958c;
  --faint: #6f6b64;
  --line: rgba(255, 248, 236, 0.08);
  --line-strong: rgba(255, 248, 236, 0.14);
  --glass: rgba(255, 248, 236, 0.035);
  --glass-strong: rgba(255, 248, 236, 0.06);
  --ok: #5fd39a;
  --warn: #f2b65a;
  --bad: #f07272;
  --live: #ff4646;
  --info: #8db8ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --focus: 0 0 0 2px var(--ink-900), 0 0 0 4px rgba(227, 179, 65, 0.85);
}

html { background: var(--ink-950); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Cairo', system-ui, 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ivory);
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(227, 179, 65, 0.10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(169, 120, 30, 0.08), transparent 60%),
    var(--ink-950);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[x-cloak] { display: none !important; }
::selection { background: rgba(227, 179, 65, 0.35); color: var(--ivory); }
* { scrollbar-width: thin; scrollbar-color: var(--ink-600) transparent; }

/* Boot splash: pure CSS, visible until Alpine renders the app. */
.boot-splash {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 5;
  background: var(--ink-950);
}
.boot-splash img { width: 88px; height: 88px; animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(0.97); } 50% { opacity: 1; transform: scale(1); } }

@layer components {
  /* Grid items may shrink below their content (long URLs, code lines) instead of widening the page. */
  .grid > * { min-width: 0; }

  /* ---------- typography helpers */
  .ltr { direction: ltr; unicode-bidi: isolate; }
  .bidi { unicode-bidi: isolate; }
  .num { font-variant-numeric: tabular-nums; }
  .gold-text {
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--champagne); }
  .muted { color: var(--mute); }
  .faint { color: var(--faint); }
  .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.9em; }
  .truncate-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  /* ---------- surfaces */
  .glass {
    background: linear-gradient(180deg, rgba(255, 248, 236, 0.045), rgba(255, 248, 236, 0.02));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 248, 236, 0.05), var(--shadow);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
  }
  .panel { padding: 20px; }
  @media (min-width: 768px) { .panel { padding: 24px; } }
  .panel-title { font-size: 17px; font-weight: 800; color: var(--ivory); line-height: 1.4; }
  .panel-sub { font-size: 13.5px; color: var(--mute); margin-top: 2px; }
  .divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
  .well {
    background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
  }

  /* ---------- buttons */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: 12px;
    font: inherit; font-size: 14px; font-weight: 700; line-height: 1; white-space: nowrap;
    border: 1px solid var(--line-strong); color: var(--ivory); background: var(--glass-strong);
    cursor: pointer; text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s, color 0.15s;
  }
  .btn:hover { background: rgba(255, 248, 236, 0.1); border-color: rgba(255, 248, 236, 0.22); }
  .btn:active { transform: translateY(1px); }
  .btn:focus-visible, .focus-ring:focus-visible { outline: none; box-shadow: var(--focus); }
  .btn[disabled], .btn[aria-disabled='true'] {
    opacity: 0.45; cursor: not-allowed; transform: none;
  }
  .btn-gold {
    background: var(--gold-grad); color: #1a1408; border-color: rgba(248, 224, 142, 0.6);
    box-shadow: 0 8px 24px -10px rgba(227, 179, 65, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  .btn-gold:hover { background: var(--gold-grad); filter: brightness(1.06); border-color: rgba(248, 224, 142, 0.9); }
  .btn-ghost { background: transparent; border-color: transparent; color: var(--silver); }
  .btn-ghost:hover { background: rgba(255, 248, 236, 0.06); color: var(--ivory); border-color: transparent; }
  .btn-danger { color: #ffc9c9; border-color: rgba(240, 114, 114, 0.35); background: rgba(240, 114, 114, 0.08); }
  .btn-danger:hover { background: rgba(240, 114, 114, 0.16); border-color: rgba(240, 114, 114, 0.6); }
  .btn-danger-solid { background: #c94444; border-color: #e06363; color: #fff; }
  .btn-danger-solid:hover { background: #d64f4f; border-color: #f07272; }
  .btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; gap: 6px; }
  .btn-lg { min-height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 14px; }
  .btn-icon { width: 36px; min-height: 36px; padding: 0; border-radius: 10px; }
  .btn-block { width: 100%; }
  .btn .icon { width: 18px; height: 18px; flex: none; }
  .btn-sm .icon { width: 16px; height: 16px; }
  .link { color: var(--gold-200); text-decoration: underline; text-decoration-color: rgba(248, 224, 142, 0.35); text-underline-offset: 3px; border-radius: 4px; }
  .link:hover { text-decoration-color: var(--gold-200); }
  .link:focus-visible { outline: none; box-shadow: var(--focus); }

  .icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .spinner {
    width: 16px; height: 16px; border-radius: 50%; flex: none;
    border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ---------- forms */
  .label { display: block; font-size: 13.5px; font-weight: 700; color: var(--champagne); margin-bottom: 6px; }
  .label .opt { font-weight: 500; color: var(--faint); }
  .input, .select, .textarea {
    width: 100%; min-height: 44px; padding: 9px 14px; border-radius: 12px;
    font: inherit; font-size: 14.5px; color: var(--ivory);
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line-strong);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  }
  .input::placeholder, .textarea::placeholder { color: var(--faint); }
  .input:hover, .select:hover, .textarea:hover { border-color: rgba(255, 248, 236, 0.22); }
  .input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: rgba(227, 179, 65, 0.75); box-shadow: 0 0 0 3px rgba(227, 179, 65, 0.18);
    background: rgba(0, 0, 0, 0.4);
  }
  .input[disabled], .select[disabled], .textarea[disabled] { opacity: 0.5; cursor: not-allowed; }
  .input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: rgba(240, 114, 114, 0.7); }
  .input-ltr { direction: ltr; text-align: left; }
  .input-ltr::placeholder { text-align: left; }
  .select {
    appearance: none; -webkit-appearance: none; padding-inline-start: 14px; padding-inline-end: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23d9c7a0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-size: 18px; background-position: left 12px center;
  }
  html[dir='ltr'] .select { background-position: right 12px center; }
  .select option { background: var(--ink-800); color: var(--ivory); }
  .select-sm { min-height: 36px; padding-block: 5px; font-size: 13px; border-radius: 10px; }
  .textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
  .help { font-size: 12.5px; color: var(--mute); margin-top: 6px; line-height: 1.6; }
  .field-error { font-size: 12.5px; color: #ff9d9d; margin-top: 6px; font-weight: 600; }
  /* Numbers and dates read left-to-right but sit on the start side of the field in both directions. */
  input[type='date'].input, input[type='number'].input { direction: ltr; text-align: right; }
  html[dir='ltr'] input[type='date'].input, html[dir='ltr'] input[type='number'].input { text-align: left; }
  input[type='date']::-webkit-calendar-picker-indicator { filter: invert(0.85) sepia(0.4); cursor: pointer; }
  input[type='file'].file { font: inherit; font-size: 13px; color: var(--mute); max-width: 100%; }
  input[type='file'].file::file-selector-button {
    font: inherit; font-weight: 700; font-size: 13px; color: var(--ivory); background: var(--glass-strong);
    border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 12px; margin-inline-end: 10px; cursor: pointer;
  }
  .pw-wrap { position: relative; }
  .pw-wrap .input { padding-inline-end: 46px; }
  .pw-toggle {
    position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--mute);
    background: transparent; border: 0; cursor: pointer;
  }
  .pw-toggle:hover { color: var(--ivory); }
  .pw-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

  /* option cards (radio as cards) */
  .opt-card {
    position: relative; display: block; padding: 12px 14px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.22);
    transition: border-color 0.15s, background-color 0.15s;
  }
  .opt-card:hover { border-color: rgba(255, 248, 236, 0.25); }
  .opt-card input { position: absolute; opacity: 0; pointer-events: none; }
  .opt-card.is-on { border-color: rgba(227, 179, 65, 0.8); background: rgba(227, 179, 65, 0.08); box-shadow: inset 0 0 0 1px rgba(227, 179, 65, 0.35); }
  .opt-card.is-off { opacity: 0.55; cursor: not-allowed; }
  .opt-card:has(input:focus-visible) { box-shadow: var(--focus); }
  .opt-card .opt-title { font-weight: 800; font-size: 14px; }
  .opt-card .opt-desc { font-size: 12.5px; color: var(--mute); line-height: 1.55; margin-top: 2px; }
  .opt-card .opt-why { font-size: 12px; color: var(--warn); margin-top: 4px; font-weight: 600; }

  /* segmented control */
  .seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); }
  .seg button {
    min-height: 28px; padding: 0 10px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--mute);
    background: transparent; border: 0; border-radius: 8px; cursor: pointer; white-space: nowrap;
  }
  .seg button:hover:not([disabled]) { color: var(--ivory); }
  .seg button[aria-pressed='true'] { background: var(--ink-600); color: var(--ivory); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
  .seg button[aria-pressed='true'].seg-on { background: rgba(95, 211, 154, 0.18); color: #a6f0c9; }
  .seg button[aria-pressed='true'].seg-off { background: rgba(240, 114, 114, 0.18); color: #ffb3b3; }
  .seg button[aria-pressed='true'].seg-gold { background: rgba(227, 179, 65, 0.2); color: var(--gold-200); }
  .seg button:focus-visible { outline: none; box-shadow: var(--focus); }
  .seg button[disabled] { opacity: 0.5; cursor: progress; }

  /* switch */
  .switch {
    position: relative; display: inline-flex; flex: none; width: 46px; height: 26px; border-radius: 99px; cursor: pointer;
    background: var(--ink-600); border: 1px solid var(--line-strong); transition: background-color 0.2s, border-color 0.2s; padding: 0;
  }
  .switch::after {
    content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--silver); transition: inset-inline-start 0.2s, background-color 0.2s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }
  .switch[aria-checked='true'] { background: rgba(227, 179, 65, 0.85); border-color: rgba(248, 224, 142, 0.8); }
  .switch[aria-checked='true']::after { inset-inline-start: 22px; background: #fffaf0; }
  .switch:focus-visible { outline: none; box-shadow: var(--focus); }
  .switch[disabled] { opacity: 0.45; cursor: not-allowed; }
  .switch.is-busy { cursor: progress; opacity: 0.7; }

  /* ---------- badges & status */
  .badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
    font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1;
    border: 1px solid var(--line-strong); background: rgba(255, 248, 236, 0.05); color: var(--silver);
  }
  .badge-sm { height: 20px; padding: 0 8px; font-size: 11px; }
  .badge.ok { color: #a6f0c9; border-color: rgba(95, 211, 154, 0.3); background: rgba(95, 211, 154, 0.08); }
  .badge.warn { color: #ffd59a; border-color: rgba(242, 182, 90, 0.35); background: rgba(242, 182, 90, 0.08); }
  .badge.bad { color: #ffb3b3; border-color: rgba(240, 114, 114, 0.35); background: rgba(240, 114, 114, 0.08); }
  .badge.info { color: #c4d9ff; border-color: rgba(141, 184, 255, 0.3); background: rgba(141, 184, 255, 0.08); }
  .badge.gold { color: var(--gold-200); border-color: rgba(227, 179, 65, 0.4); background: rgba(227, 179, 65, 0.1); }
  .badge.muted { color: var(--mute); }
  .badge.live { color: #fff; border-color: rgba(255, 70, 70, 0.6); background: rgba(255, 70, 70, 0.18); }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
  .dot-pulse { position: relative; }
  .dot-pulse::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; opacity: 0;
    animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  }
  @keyframes ping { 0% { transform: scale(0.6); opacity: 0.9; } 80%, 100% { transform: scale(1.7); opacity: 0; } }
  .live-pill { color: #fff; background: linear-gradient(135deg, #ff4b4b, #c71f1f); border-color: rgba(255, 120, 120, 0.7); box-shadow: 0 0 18px rgba(255, 70, 70, 0.35); }
  .live-pill .dot { background: #fff; }

  .tone-ok { color: var(--ok); }
  .tone-warn { color: var(--warn); }
  .tone-bad { color: var(--bad); }
  .tone-live { color: var(--live); }
  .tone-info { color: var(--info); }
  .tone-muted, .tone-off, .tone-idle { color: var(--mute); }

  /* ---------- notices */
  .notice {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--line-strong); background: rgba(255, 248, 236, 0.04); font-size: 14px; line-height: 1.6;
  }
  .notice .icon { margin-top: 2px; }
  .notice.info { border-color: rgba(141, 184, 255, 0.28); background: rgba(141, 184, 255, 0.06); }
  .notice.info .icon { color: var(--info); }
  .notice.warn { border-color: rgba(242, 182, 90, 0.3); background: rgba(242, 182, 90, 0.07); }
  .notice.warn .icon { color: var(--warn); }
  .notice.bad { border-color: rgba(240, 114, 114, 0.35); background: rgba(240, 114, 114, 0.08); }
  .notice.bad .icon { color: var(--bad); }
  .notice.ok { border-color: rgba(95, 211, 154, 0.3); background: rgba(95, 211, 154, 0.07); }
  .notice.ok .icon { color: var(--ok); }
  .notice.gold { border-color: rgba(227, 179, 65, 0.35); background: rgba(227, 179, 65, 0.07); }
  .notice.gold .icon { color: var(--gold-400); }
  .notice-title { font-weight: 800; }

  .locked {
    display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px;
    border: 1px dashed rgba(227, 179, 65, 0.4); background: rgba(227, 179, 65, 0.05);
  }
  .locked .icon { color: var(--gold-400); width: 22px; height: 22px; margin-top: 2px; }

  /* ---------- empty / loading */
  .empty { text-align: center; padding: 40px 20px; }
  .empty .empty-icon {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
    background: rgba(227, 179, 65, 0.08); border: 1px solid rgba(227, 179, 65, 0.25); color: var(--gold-200);
  }
  .empty .empty-icon .icon { width: 28px; height: 28px; }
  .empty h3 { font-size: 17px; font-weight: 800; }
  .empty p { color: var(--mute); font-size: 14px; max-width: 420px; margin: 6px auto 0; }
  .skeleton {
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(255, 248, 236, 0.04) 25%, rgba(255, 248, 236, 0.09) 50%, rgba(255, 248, 236, 0.04) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
  }
  @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

  /* ---------- progress */
  .bar { height: 8px; border-radius: 99px; background: rgba(255, 248, 236, 0.07); overflow: hidden; }
  .bar > span { display: block; height: 100%; border-radius: 99px; background: var(--gold-grad); transition: width 0.4s; }
  .bar.is-full > span { background: linear-gradient(90deg, #f07272, #c94444); }
  .bar.is-unlimited > span { background: linear-gradient(90deg, rgba(95, 211, 154, 0.5), rgba(95, 211, 154, 0.2)); }

  /* ---------- shell */
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 30;
    display: flex; flex-direction: column; gap: 18px; padding: 22px 18px 18px;
    background: linear-gradient(180deg, rgba(21, 21, 27, 0.92), rgba(12, 12, 15, 0.94));
    border-inline-end: 1px solid var(--line);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
  }
  .nav-item {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px;
    border-radius: 12px; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--silver);
    background: transparent; border: 1px solid transparent; cursor: pointer; text-align: start; text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  }
  .nav-item:hover { background: rgba(255, 248, 236, 0.05); color: var(--ivory); }
  .nav-item[aria-current='page'] {
    color: var(--ivory); background: linear-gradient(90deg, rgba(227, 179, 65, 0.04), rgba(227, 179, 65, 0.14));
    border-color: rgba(227, 179, 65, 0.25);
  }
  html[dir='ltr'] .nav-item[aria-current='page'] { background: linear-gradient(270deg, rgba(227, 179, 65, 0.04), rgba(227, 179, 65, 0.14)); }
  .nav-item[aria-current='page']::before {
    content: ''; position: absolute; inset-inline-start: -18px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--gold-grad);
  }
  .nav-item[aria-current='page'] .icon { color: var(--gold-200); }
  .nav-item:focus-visible { outline: none; box-shadow: var(--focus); }
  .nav-item .lock { margin-inline-start: auto; width: 15px; height: 15px; color: var(--gold-600); }
  .nav-sub { padding-inline-start: 18px; display: grid; gap: 2px; margin-top: 4px; }
  .nav-sub .nav-item { min-height: 36px; font-size: 13.5px; font-weight: 600; }
  .nav-sub .nav-item[aria-current='page']::before { display: none; }

  .engine {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px;
    background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
  }
  .engine .dot { margin-top: 7px; }
  /* The chip is a button that opens the "engine now" panel. */
  .engine-btn { width: 100%; font: inherit; color: inherit; text-align: start; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
  .engine-btn:hover { background: rgba(0, 0, 0, 0.4); border-color: var(--line-strong); }
  .engine-btn:focus-visible, .engine-badge:focus-visible { outline: none; box-shadow: var(--focus); }
  .engine-btn .eng-chev { width: 16px; height: 16px; margin-top: 3px; color: var(--faint); flex: none; transition: transform 0.2s; }
  .engine-btn[aria-expanded='true'] .eng-chev { transform: rotate(180deg); color: var(--gold-200); }
  .engine-badge { cursor: pointer; font-family: inherit; }
  .engine-badge .dot { margin-inline: 0; }

  .engine-backdrop { position: fixed; inset: 0; z-index: 51; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); }
  .engine-panel {
    position: fixed; z-index: 52; inset-inline: 0; bottom: 0; display: flex; flex-direction: column; max-height: 86dvh;
    background: var(--ink-900); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow); outline: none;
  }
  .engine-panel:focus-visible { box-shadow: var(--shadow); }
  @media (min-width: 1024px) {
    .engine-panel {
      inset-inline: auto; inset-inline-start: 292px; bottom: var(--eng-bottom, 16px); width: 410px;
      max-height: min(680px, calc(100dvh - var(--eng-bottom, 16px) - 16px)); border: 1px solid var(--line-strong); border-radius: 18px;
    }
  }
  .eng-grab { width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
  .eng-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px 14px; border-bottom: 1px solid var(--line); flex: none; }
  .eng-title { font-size: 15px; font-weight: 900; color: var(--gold-200); line-height: 1.4; }
  .eng-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 8px; }
  .eng-sec { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .eng-sec:last-child { border-bottom: 0; }
  .eng-sec .eyebrow { margin-bottom: 6px; }
  .eng-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
  .eng-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 248, 236, 0.05); flex: none; }
  .eng-ico .icon { width: 16px; height: 16px; }
  .eng-t { font-size: 13.5px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
  .eng-s { font-size: 12px; color: var(--mute); line-height: 1.5; overflow-wrap: anywhere; }
  .eng-time { font-size: 12.5px; font-weight: 700; color: var(--champagne); flex: none; }
  .eng-meta { display: grid; justify-items: end; gap: 2px; flex: none; text-align: end; }
  .eng-go-slot { width: 30px; flex: none; }
  .eng-go { width: 30px; min-height: 30px; color: var(--mute); }
  .eng-go .icon { width: 16px; height: 16px; }
  .eng-go:hover { color: var(--gold-200); }
  .eng-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .eng-kv { font-size: 13px; }
  .eng-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
  @media (min-width: 1024px) { .eng-foot { padding-bottom: 10px; } }
  .user-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); }
  .avatar {
    width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; overflow: hidden;
    font-weight: 900; font-size: 17px; color: #1a1408; background: var(--gold-grad);
  }
  .avatar img { width: 100%; height: 100%; object-fit: cover; }

  .topbar {
    position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 10px;
    height: 60px; padding: 0 12px 0 12px;
    background: rgba(12, 12, 15, 0.85); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 25; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 15, 0.92); border-top: 1px solid var(--line);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .bottom-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 52px; border-radius: 12px; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--mute);
    background: transparent; border: 0; cursor: pointer;
  }
  .bottom-nav button[aria-current='page'] { color: var(--gold-200); background: rgba(227, 179, 65, 0.08); }
  .bottom-nav button:focus-visible { outline: none; box-shadow: var(--focus); }
  .bottom-nav .lock-dot { position: absolute; top: 8px; inset-inline-end: calc(50% - 20px); width: 7px; height: 7px; border-radius: 50%; background: var(--gold-600); }

  .drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
  .drawer {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 41; width: min(320px, 88vw);
    display: flex; flex-direction: column; gap: 16px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    background: var(--ink-900); border-inline-end: 1px solid var(--line-strong); overflow-y: auto;
  }

  .page-head h1 { font-size: 24px; font-weight: 900; line-height: 1.35; letter-spacing: -0.01em; }
  @media (min-width: 768px) { .page-head h1 { font-size: 28px; } }
  .page-head p { color: var(--mute); font-size: 14.5px; margin-top: 4px; max-width: 720px; }
  .page-head h1:focus { outline: none; }

  .tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px; flex: none;
    font: inherit; font-size: 13.5px; font-weight: 700; color: var(--mute); background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  }
  .tab:hover { color: var(--ivory); }
  .tab[aria-selected='true'], .tab[aria-current='page'] { background: var(--ink-700); color: var(--ivory); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
  .tab[aria-selected='true'] .icon, .tab[aria-current='page'] .icon { color: var(--gold-200); }
  .tab:focus-visible { outline: none; box-shadow: var(--focus); }
  .tab .icon { width: 17px; height: 17px; }

  /* ---------- channel cards */
  .platform-chip {
    display: inline-flex; align-items: center; gap: 8px; height: 30px; padding-block: 0; padding-inline: 10px 12px; border-radius: 10px;
    font-size: 13px; font-weight: 800; background: rgba(255, 248, 236, 0.06); border: 1px solid var(--line-strong);
  }
  .platform-chip .pf { width: 10px; height: 10px; border-radius: 3px; }
  .pf-youtube { background: #ff3b3b; } .pf-twitch { background: #9b6bff; } .pf-kick { background: #53fc18; }
  .pf-tiktok { background: linear-gradient(135deg, #25f4ee, #fe2c55); } .pf-rumble { background: #85c742; }
  .pf-facebook { background: #1877f2; } .pf-x { background: #e7e7e7; }
  .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
  .kv dt { color: var(--mute); }
  .kv dd { margin: 0; color: var(--ivory); min-width: 0; }

  /* ---------- clip cards */
  .clip-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
  .clip-media {
    position: relative; aspect-ratio: 9 / 16; width: 100%; overflow: hidden; background: #050507;
    border-bottom: 1px solid var(--line);
  }
  .clip-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
  .clip-media .yt-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
  .clip-poster.no-play { cursor: default; }
  .clip-poster .yt-note { max-width: 100%; font-weight: 700; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
  .yt-saved { color: var(--gold-200); }
  .clip-poster {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 14px;
    width: 100%; border: 0; cursor: pointer; text-align: start; font: inherit; color: var(--ivory);
    background:
      radial-gradient(120% 70% at 80% 0%, rgba(227, 179, 65, 0.22), transparent 60%),
      radial-gradient(120% 80% at 0% 100%, rgba(169, 120, 30, 0.25), transparent 60%),
      linear-gradient(180deg, #17171e, #0b0b0f);
  }
  .clip-poster::before {
    content: ''; position: absolute; inset: 0; opacity: 0.35;
    background-image: repeating-linear-gradient(90deg, rgba(255, 248, 236, 0.03) 0 2px, transparent 2px 14px);
  }
  .clip-poster:focus-visible { outline: none; box-shadow: inset 0 0 0 3px rgba(227, 179, 65, 0.85); }
  .play-btn {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 248, 236, 0.12); border: 1px solid rgba(255, 248, 236, 0.3);
    backdrop-filter: blur(8px); transition: transform 0.15s, background-color 0.15s;
  }
  .clip-poster:hover .play-btn { transform: translate(-50%, -50%) scale(1.07); background: rgba(227, 179, 65, 0.3); }
  .play-btn svg { width: 26px; height: 26px; margin-left: 4px; fill: var(--ivory); stroke: none; }
  .score {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px;
    font-size: 13px; font-weight: 900; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line-strong); backdrop-filter: blur(6px);
  }
  .score.hot { color: #1a1408; background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.8); }
  .score.warm { color: var(--gold-200); border-color: rgba(227, 179, 65, 0.5); }
  .score.cool { color: var(--silver); }
  .tag {
    display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 700;
    color: var(--champagne); background: rgba(217, 199, 160, 0.08); border: 1px solid rgba(217, 199, 160, 0.16); unicode-bidi: isolate;
  }
  /* publishing safety (made for kids / private first) and the review line of a clip */
  .safe-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 248, 236, 0.08); }
  .safe-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; color: #ffd59a; background: rgba(242, 182, 90, 0.08); border: 1px solid rgba(242, 182, 90, 0.3); }
  .safe-honest { display: grid; gap: 6px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.55; color: #c4d9ff; background: rgba(141, 184, 255, 0.07); border: 1px solid rgba(141, 184, 255, 0.22); }
  .safe-fine { font-size: 12px; line-height: 1.55; color: var(--silver, #b9b3a6); }
  .clip-review { display: grid; gap: 6px; font-size: 12.5px; line-height: 1.55; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(141, 184, 255, 0.28); background: rgba(141, 184, 255, 0.07); color: #c4d9ff; }
  .clip-review .rv-head { display: flex; gap: 6px; align-items: flex-start; font-weight: 700; }
  .clip-review .rv-fine { font-size: 11.5px; opacity: 0.8; }
  .clip-review[data-review='passed'] { border-color: rgba(110, 200, 140, 0.35); background: rgba(110, 200, 140, 0.07); color: #bfe9cd; }
  .clip-review[data-review='held'] { border-color: rgba(242, 182, 90, 0.4); background: rgba(242, 182, 90, 0.09); color: #ffd59a; }
  .clip-note { font-size: 12.5px; line-height: 1.55; padding: 8px 10px; border-radius: 10px; }
  .clip-note.note { color: #c4d9ff; background: rgba(141, 184, 255, 0.07); border: 1px solid rgba(141, 184, 255, 0.22); }
  .clip-note.err { color: #ffc1c1; background: rgba(240, 114, 114, 0.08); border: 1px solid rgba(240, 114, 114, 0.28); }

  /* ---------- tables */
  .table-wrap { overflow-x: auto; border-radius: var(--radius); }
  .table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
  .table th {
    text-align: start; font-size: 12px; font-weight: 800; color: var(--champagne); padding: 12px 14px; white-space: nowrap;
    background: rgba(0, 0, 0, 0.25); border-bottom: 1px solid var(--line);
  }
  .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .table tr:last-child td { border-bottom: 0; }
  .table tbody tr.is-click { cursor: pointer; transition: background-color 0.12s; }
  .table tbody tr.is-click:hover { background: rgba(255, 248, 236, 0.035); }
  .table tbody tr.is-click:focus-visible { outline: none; background: rgba(227, 179, 65, 0.07); box-shadow: inset -3px 0 0 var(--gold-400); }
  html[dir='ltr'] .table tbody tr.is-click:focus-visible { box-shadow: inset 3px 0 0 var(--gold-400); }

  .list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .list-row:last-child { border-bottom: 0; }

  /* ---------- dialogs */
  .modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
  .modal-backdrop { position: fixed; inset: 0; background: rgba(4, 4, 6, 0.72); backdrop-filter: blur(6px); }
  .modal {
    position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto;
    padding: 22px; border-radius: 20px; background: linear-gradient(180deg, #1a1a21, #121217);
    border: 1px solid var(--line-strong); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  }
  .modal-lg { max-width: 720px; }
  .modal h2 { font-size: 19px; font-weight: 900; line-height: 1.4; }
  .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 20px; }
  .panel-drawer {
    position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 55; width: min(720px, 100vw);
    display: flex; flex-direction: column; background: linear-gradient(180deg, #17171d, #0f0f13);
    border-inline-start: 1px solid var(--line-strong); box-shadow: 30px 0 80px -20px rgba(0, 0, 0, 0.9);
  }
  html[dir='ltr'] .panel-drawer { box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.9); }
  .panel-drawer .drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
  .panel-drawer .drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
  .close-btn { margin-inline-start: auto; }

  /* ---------- toasts */
  .toasts {
    position: fixed; z-index: 80; inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  }
  @media (min-width: 1024px) { .toasts { bottom: 24px; } }
  .toast {
    pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; width: 100%; max-width: 420px; padding: 12px 14px;
    border-radius: 14px; font-size: 14px; line-height: 1.55; background: rgba(28, 28, 35, 0.96);
    border: 1px solid var(--line-strong); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px); animation: toast-in 0.2s ease-out;
  }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .toast.success { border-color: rgba(95, 211, 154, 0.4); } .toast.success .icon { color: var(--ok); }
  .toast.error { border-color: rgba(240, 114, 114, 0.45); } .toast.error .icon { color: var(--bad); }
  .toast.warn { border-color: rgba(242, 182, 90, 0.45); } .toast.warn .icon { color: var(--warn); }
  .toast.info .icon { color: var(--info); }
  .toast button { margin-inline-start: auto; color: var(--mute); background: transparent; border: 0; cursor: pointer; border-radius: 6px; padding: 2px; }
  .toast button:hover { color: var(--ivory); }
  .toast button:focus-visible { outline: none; box-shadow: var(--focus); }

  /* ---------- auth */
  .auth-hero { position: relative; overflow: hidden; }
  .auth-hero::before {
    content: ''; position: absolute; width: 560px; height: 560px; border-radius: 50%; top: -180px; inset-inline-end: -160px;
    background: radial-gradient(circle, rgba(227, 179, 65, 0.16), transparent 65%);
  }
  .auth-logo { width: 100%; max-width: 360px; height: auto; display: block; }
  .feature-li { display: flex; gap: 12px; align-items: flex-start; }
  .feature-li .ic {
    width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center;
    background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.25); color: var(--gold-200);
  }
  .feature-li .ic .icon { width: 18px; height: 18px; }
  .google-btn { background: #fff; color: #1f1f1f; border-color: #fff; }
  .google-btn:hover { background: #f1f1f1; border-color: #f1f1f1; }
  .google-g { width: 18px; height: 18px; }
  .or-line { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; }
  .or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }

  .stat { padding: 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
  .stat .v { font-size: 24px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .stat .k { font-size: 12.5px; color: var(--mute); font-weight: 600; }

  .chip-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; font: inherit;
    font-size: 12.5px; font-weight: 700; color: var(--mute); background: transparent; border: 1px solid var(--line-strong); cursor: pointer;
  }
  .chip-btn:hover { color: var(--ivory); border-color: rgba(255, 248, 236, 0.25); }
  .chip-btn[aria-pressed='true'] { color: #1a1408; background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.7); }
  .chip-btn:focus-visible { outline: none; box-shadow: var(--focus); }
  .chip-btn .count { font-size: 11px; opacity: 0.8; }

  .code-line {
    display: flex; align-items: center; gap: 8px; padding-block: 8px; padding-inline: 8px 12px; border-radius: 10px;
    background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line-strong);
  }
  .code-line code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13px; direction: ltr; text-align: left; color: var(--gold-200); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Untranslatable fragments of coded server messages (tool output, Google reasons): secondary LTR line. */
.msg-detail {
  direction: ltr; unicode-bidi: isolate; text-align: left; font-size: 12px; line-height: 1.55;
  color: var(--faint); overflow-wrap: anywhere; margin-top: 2px;
}

/* Clip thumbnails (newer servers): the image fills the 9:16 box behind the badges and play button. */
.clip-poster > * { z-index: 1; }
.clip-poster .clip-thumb { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; background: #0b0b0f; }
.clip-poster.has-thumb::before {
  z-index: 0; opacity: 1; background-image: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 22%, transparent 70%, rgba(0, 0, 0, 0.65) 100%);
}
.clip-poster.has-thumb::before { z-index: 1; }
.clip-poster.has-thumb .play-btn { z-index: 2; }
.clip-poster.has-thumb > div { z-index: 2; }

/* ---------------------------------------------------------------- direction (html[dir] is set by js/i18n.js) */
/* The page glow sits at the start corner in both directions. */
html[dir='ltr'] body {
  background:
    radial-gradient(900px 520px at 0% -10%, rgba(227, 179, 65, 0.10), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(169, 120, 30, 0.08), transparent 60%),
    var(--ink-950);
  background-attachment: fixed;
}
/* Icons whose meaning has a direction (back/forward chevrons, sign-out) are drawn for RTL; mirror them in LTR. */
html[dir='ltr'] .icon.mirror { transform: scaleX(-1); }
/* Left-to-right content (URLs, IDs, handles) aligned to the start side of the surrounding UI. */
.ui-start { text-align: right; }
html[dir='ltr'] .ui-start { text-align: left; }
/* The mobile drawer slides in from the start side. */
.drawer-off { transform: translateX(100%); }
html[dir='ltr'] .drawer-off { transform: translateX(-100%); }
/* Latin UI text in Cairo: a touch more tracking and a tighter line height read better at small sizes. */
html[lang='en'] body { line-height: 1.55; }
html[lang='en'] .eyebrow { letter-spacing: 0.04em; text-transform: uppercase; font-size: 11.5px; }

/* ---------------------------------------------------------------- language switch */
.lang-btn { gap: 6px; font-weight: 700; }
.lang-btn .icon { width: 17px; height: 17px; }
.lang-btn:lang(ar) span, .lang-btn [lang='ar'] { font-size: 1.05em; }

/* ---------------------------------------------------------------- bilingual fields (plan listing, landing page) */
.pub-box {
  padding: 16px; border-radius: 14px; border: 1px solid rgba(227, 179, 65, 0.22);
  background: linear-gradient(180deg, rgba(227, 179, 65, 0.05), rgba(227, 179, 65, 0.015));
}
.lang-tag {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; font-weight: 700; color: var(--champagne);
}
.lang-tag > span:first-child {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px;
  background: rgba(255, 248, 236, 0.06); border: 1px solid var(--line-strong);
}
.lang-tag .lang-missing { color: var(--warn); font-weight: 700; }
.lang-tag.is-missing > span:first-child { border-color: rgba(242, 182, 90, 0.55); background: rgba(242, 182, 90, 0.1); color: #ffd59a; }
.lang-tag.is-missing + .input, .lang-tag.is-missing + .textarea { border-style: dashed; border-color: rgba(242, 182, 90, 0.55); }

/* ---------------------------------------------------------------- landing page editor */
.contact-row.has-error { border-color: rgba(240, 114, 114, 0.45); }
.contact-num {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-size: 12.5px; font-weight: 900; color: #1a1408; background: var(--gold-grad);
}
.lp-preview { padding: 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.lp-preview .kv dd { text-align: start; }
.pv-plan { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(255, 248, 236, 0.03); }
.pv-plan.is-featured { border-color: rgba(227, 179, 65, 0.6); box-shadow: inset 0 0 0 1px rgba(227, 179, 65, 0.25); }
@media (min-width: 1536px) { .save-bar { position: sticky; bottom: 16px; z-index: 5; } }

/* ---------------------------------------------------------------- clip layouts (picker + facecam region) */
.lay-pick { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .lay-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.lay-card { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; }
.lay-card .lay-text { min-width: 0; flex: 1; }
.lay-diagram {
  flex: none; width: 34px; height: 60px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-strong);
  --lay-bg: #24242c; --lay-panel: #2e2a22; --lay-content: #1d2a33; --lay-content2: #2f4552; --lay-face: #d9c7a0;
  --lay-face2: #a9c4e6; --lay-accent: #e3b341; --lay-line: rgba(255, 248, 236, 0.35); --lay-sep: #e3b341;
  --lay-blur: #2c2f3a; --lay-blur2: #3a3f4f;
}
.lay-diagram svg { width: 100%; height: 100%; display: block; }
.lay-card.is-on .lay-diagram { box-shadow: 0 0 0 1.5px rgba(227, 179, 65, 0.85); }
.lay-card.is-off .lay-diagram { filter: grayscale(1); opacity: 0.6; }
/* Phones: compact cards (small diagram beside the name); only the chosen card shows its description. */
@media (max-width: 767px) {
  .lay-card { gap: 10px; padding: 8px 10px; align-items: center; }
  .lay-card .lay-diagram { width: 24px; height: 42px; border-radius: 5px; }
  .lay-card .opt-title { font-size: 13px; }
  .lay-card .opt-desc { font-size: 12px; }
  .lay-card:not(.is-on) .opt-desc { display: none; }
  .lay-card.is-on { grid-column: 1 / -1; }
}

.region-box { padding: 14px; border-radius: 14px; border: 1px solid rgba(227, 179, 65, 0.22); background: rgba(227, 179, 65, 0.04); }
.region-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .region-grid { grid-template-columns: minmax(0, 1fr) 132px; align-items: start; } }
.region-frame {
  position: relative; width: 100%; border-radius: 10px; overflow: hidden; background: #050507; cursor: crosshair;
  touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1px var(--line-strong);
}
.region-frame.is-dragging { cursor: grabbing; }
.region-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.region-schematic {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  background:
    linear-gradient(160deg, transparent 55%, rgba(47, 69, 82, 0.9) 55.5%, rgba(47, 69, 82, 0.9) 70%, transparent 70.5%),
    linear-gradient(200deg, transparent 60%, rgba(47, 69, 82, 0.7) 60.5%),
    repeating-linear-gradient(90deg, rgba(255, 248, 236, 0.04) 0 1px, transparent 1px 10%),
    repeating-linear-gradient(0deg, rgba(255, 248, 236, 0.04) 0 1px, transparent 1px 10%),
    linear-gradient(180deg, #1b2a35, #121a21);
}
.region-schematic span { font-size: 12px; font-weight: 800; color: rgba(255, 248, 236, 0.25); letter-spacing: 0.08em; }
.region-rect {
  position: absolute; border: 2px solid var(--gold-400); border-radius: 4px; cursor: move;
  background: rgba(227, 179, 65, 0.14); box-shadow: 0 0 0 1600px rgba(0, 0, 0, 0.5);
}
.region-rect:focus-visible { outline: 3px solid #fff8ec; outline-offset: 1px; }
.region-tag {
  position: absolute; top: 2px; left: 16px; font-size: 10.5px; font-weight: 800; line-height: 1; padding: 3px 5px;
  border-radius: 4px; color: #1a1408; background: var(--gold-400); pointer-events: none; white-space: nowrap;
}
.region-handle {
  position: absolute; width: 14px; height: 14px; border-radius: 4px; background: #fff8ec; border: 2px solid var(--gold-600);
  touch-action: none;
}
.region-handle::after { content: ''; position: absolute; inset: -10px; } /* larger touch target */
/* Handles sit inside the box's corners, so they stay reachable when the box touches the frame's edge. */
.region-handle.h-tl { left: -2px; top: -2px; cursor: nwse-resize; }
.region-handle.h-tr { right: -2px; top: -2px; cursor: nesw-resize; }
.region-handle.h-bl { left: -2px; bottom: -2px; cursor: nesw-resize; }
.region-handle.h-br { right: -2px; bottom: -2px; cursor: nwse-resize; }
.region-handle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold-400), 0 0 0 5px #0a0a0d; }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) {
  .preset-grid { grid-template-columns: minmax(0, 1fr); }
  .preset-corner { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
}
.preset-corner { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.preset-name { font-size: 12px; font-weight: 700; color: var(--champagne); }
.preset-corner .seg button { padding: 0 8px; font-size: 12px; }
.region-preview-col { display: flex; flex-direction: column; align-items: center; }
.stack-preview {
  width: 108px; height: 192px; border-radius: 10px; overflow: hidden; background: #050507;
  box-shadow: 0 0 0 1px var(--line-strong), 0 10px 30px -12px rgba(0, 0, 0, 0.8);
}
.stack-preview .sp-top, .stack-preview .sp-bottom { position: relative; overflow: hidden; width: 108px; }
.stack-preview .sp-top { height: 77px; border-bottom: 1.5px solid var(--gold-400); }
.stack-preview .sp-bottom { height: 115px; }
.stack-preview img, .stack-preview .sp-img { position: absolute; max-width: none; inset: auto; }

/* ---------- run now: progress and result on a channel card */
@layer components {
  .run-panel {
    --rt: var(--info);
    display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px;
    border: 1px solid color-mix(in srgb, var(--rt) 38%, transparent);
    background: color-mix(in srgb, var(--rt) 8%, transparent);
  }
  .run-panel[data-tone='ok'] { --rt: var(--ok); }
  .run-panel[data-tone='warn'] { --rt: var(--warn); }
  .run-panel[data-tone='bad'] { --rt: var(--bad); }
  .run-panel .run-head { display: flex; align-items: center; gap: 8px; min-height: 26px; color: var(--rt); }
  .run-panel .run-head strong { font-size: 13.5px; font-weight: 800; }
  .run-panel .run-subject { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ivory); font-weight: 700; }
  .run-panel .run-subject span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .run-steps { display: flex; gap: 4px; margin-top: 2px; }
  .run-steps > span { flex: 1; height: 5px; border-radius: 99px; background: rgba(255, 248, 236, 0.1); }
  .run-steps > span.is-on { background: var(--rt); }
  .run-steps > span.is-now { background: var(--rt); animation: run-pulse 1.4s ease-in-out infinite; }
  @keyframes run-pulse { 50% { opacity: 0.35; } }
  .run-chip {
    display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-radius: 10px;
    font-size: 13px; font-weight: 800; color: var(--info); border: 1px solid rgba(141, 184, 255, 0.35); background: rgba(141, 184, 255, 0.08);
  }
}

/* ---------- creator credit: the form group and the description preview */
@layer components {
  .credit-box { padding: 14px; border-radius: 14px; border: 1px solid rgba(255, 248, 236, 0.1); background: rgba(0, 0, 0, 0.2); }
  .credit-preview { margin: 0; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(217, 199, 160, 0.3); background: rgba(0, 0, 0, 0.3); min-width: 0; }
  .credit-preview figcaption { font-size: 11.5px; font-weight: 700; color: var(--faint); margin-bottom: 6px; }
  /* The description is Arabic whatever the interface language: its own right-to-left, isolated box. */
  .cp-text { direction: rtl; unicode-bidi: isolate; text-align: right; font-size: 13.5px; line-height: 1.75; color: var(--ivory); overflow-wrap: anywhere; }
  .cp-text p { margin: 0; unicode-bidi: plaintext; text-align: right; }
  .cp-url { direction: ltr; unicode-bidi: isolate; text-align: right; color: var(--champagne); font-size: 12.5px; }
  .cp-gap { color: var(--faint); }
  .cp-tags { color: var(--info); }
}

/* ---------- clips: source line and the clip a run just made */
@layer components {
  .clip-source { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; line-height: 1.5; color: var(--silver); min-width: 0; }
  .clip-source a { color: var(--gold-200); text-decoration: underline; text-decoration-color: rgba(248, 224, 142, 0.35); text-underline-offset: 3px; overflow-wrap: anywhere; }
  .clip-source a:hover { text-decoration-color: var(--gold-200); }
  .clip-card.is-focus { box-shadow: 0 0 0 2px var(--gold-400), 0 18px 40px -18px rgba(227, 179, 65, 0.5); }
}

/* ---------- connected YouTube channels */
@layer components {
  .yt-card { transition: border-color 0.2s; }
  .yt-card.is-default { border-color: rgba(227, 179, 65, 0.4); }
  .clip-dest { min-width: 0; }
  .clip-dest .select { width: 100%; }
}

/* ---------- clips: selection mode, selection bar, archive */
@layer components {
  .clip-card { position: relative; }
  .clip-card.is-selecting { cursor: pointer; }
  .clip-card.is-sel { border-color: rgba(227, 179, 65, 0.75); box-shadow: 0 0 0 2px rgba(227, 179, 65, 0.6), 0 18px 40px -20px rgba(227, 179, 65, 0.4); }
  .sel-hit { position: absolute; top: 0; inset-inline-start: 0; z-index: 6; width: 52px; height: 52px; }
  .sel-input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .sel-input:disabled { cursor: default; }
  .sel-box {
    position: absolute; top: 10px; inset-inline-start: 10px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
    color: #1a1408; background: rgba(10, 10, 13, 0.72); border: 2px solid rgba(255, 248, 236, 0.6);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background-color 0.12s, border-color 0.12s;
    pointer-events: none;
  }
  .sel-box .icon { width: 17px; height: 17px; opacity: 0; stroke-width: 3; }
  .sel-input:hover + .sel-box { border-color: var(--gold-200); }
  .sel-input:checked + .sel-box { background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.9); }
  .sel-input:checked + .sel-box .icon { opacity: 1; }
  .sel-input:focus-visible + .sel-box { box-shadow: var(--focus); }
  .sel-pad { padding-inline-start: 40px; }
  .sel-bar { position: sticky; z-index: 24; margin-top: 20px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  @media (min-width: 1024px) { .sel-bar { bottom: 16px; } }
  .sel-bar-in {
    display: grid; gap: 10px; padding: 12px 14px; border-radius: 16px;
    background: rgba(18, 18, 23, 0.95); border: 1px solid rgba(227, 179, 65, 0.4);
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  .sel-link {
    font: inherit; font-weight: 700; color: var(--gold-200); background: none; border: 0; padding: 8px 0; cursor: pointer; border-radius: 6px;
    text-decoration: underline; text-decoration-color: rgba(248, 224, 142, 0.35); text-underline-offset: 3px;
  }
  @media (max-width: 639px) { .sel-link { padding-block: 5px; font-size: 13px; } }
  body.is-selecting .toasts { bottom: auto; top: 72px; }
  @media (min-width: 1024px) { body.is-selecting .toasts { top: 20px; } }
  .sel-link:hover { text-decoration-color: var(--gold-200); }
  .sel-link:focus-visible { outline: none; box-shadow: var(--focus); }
  .sel-link:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
  .sel-act { flex: 1 1 auto; height: auto; min-height: 42px; padding-block: 8px; white-space: normal; line-height: 1.35; text-align: start; }
  @media (min-width: 640px) { .sel-act { flex: 0 1 auto; } }
}

/* ---- task queue ---- */
.q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.q-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; }
.q-row.is-blocked { opacity: 0.78; }
.q-row.is-cancelling { border-color: rgba(242, 182, 90, 0.4); }
.q-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.q-pos { flex: none; display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--gold-200); background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.25); }
.q-main { flex: 1; min-width: 0; }
.q-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-sub { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-stage { display: grid; gap: 4px; margin-top: 6px; max-width: 420px; }
.q-stage-t { font-size: 12.5px; }
.q-time { flex: none; font-size: 12.5px; color: var(--mute); }
.q-actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; }
.q-move { display: inline-flex; gap: 2px; }
.q-filter { width: auto; min-width: 150px; max-width: 240px; min-height: 36px; padding-block: 0; }
.q-chip { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; padding: 5px 10px; border-radius: 10px; border: 1px solid rgba(141, 184, 255, 0.3); background: rgba(141, 184, 255, 0.06); color: #c4d9ff; text-decoration: none; width: fit-content; }
.q-chip:hover { background: rgba(141, 184, 255, 0.12); }
@media (max-width: 760px) {
  .q-row { flex-wrap: wrap; padding: 10px 12px; }
  .q-main { flex: 1 1 calc(100% - 60px); }
  .q-time { margin-inline-start: auto; }
  .q-actions { width: 100%; justify-content: space-between; }
  .q-title, .q-sub { white-space: normal; }
}

/* ---------- clips and channels: the game, hashtag chips and the final hashtag line */
@layer components {
  .clip-meta { display: grid; gap: 8px; min-width: 0; }
  .game-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
  .game-line { font-size: 13.5px; line-height: 1.55; color: var(--silver); overflow-wrap: anywhere; }
  .game-name { font-weight: 800; color: var(--ivory); }
  .game-src { font-size: 12px; color: var(--mute); }
  .game-src:not(:empty)::before { content: '\00b7\00a0'; }
  .tag-src { color: var(--gold-200); background: rgba(227, 179, 65, 0.1); border-color: rgba(227, 179, 65, 0.4); }
  .tag-auto { color: var(--mute); background: transparent; border-style: dashed; }
  .tag-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--mute); }
  .tag-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
  .lg-dot { width: 9px; height: 9px; border-radius: 3px; background: rgba(217, 199, 160, 0.2); border: 1px solid rgba(217, 199, 160, 0.4); }
  .lg-dot.src { background: rgba(227, 179, 65, 0.3); border-color: rgba(227, 179, 65, 0.7); }
  .final-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 248, 236, 0.08); }
  .final-line .fl-label { font-size: 11.5px; font-weight: 700; color: var(--mute); }
  .final-line .fl-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; unicode-bidi: isolate; }
  .final-line .fl-tags .tag { height: 22px; font-size: 12px; }
  .fl-tag { color: var(--info); font-weight: 600; overflow-wrap: anywhere; }
  .clip-meta .help .ltr { white-space: nowrap; }
  .meta-edit { display: grid; gap: 12px; min-width: 0; }
  .chip-input {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 6px 8px; border-radius: 12px; cursor: text;
    background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 248, 236, 0.14);
  }
  .chip-input:hover { border-color: rgba(255, 248, 236, 0.22); }
  .chip-input:focus-within { border-color: var(--gold-400); box-shadow: var(--focus); }
  .chip-input.is-invalid { border-color: rgba(240, 114, 114, 0.7); }
  .chip-field { flex: 1 1 110px; min-width: 90px; height: 28px; background: transparent; border: 0; outline: 0; color: var(--ivory); font-size: 14px; }
  .chip-field::placeholder { color: var(--faint); }
  .tag-edit { gap: 4px; padding-inline-end: 3px; height: 28px; }
  .tag-x { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: inherit; opacity: 0.7; }
  .tag-x:hover { opacity: 1; background: rgba(255, 248, 236, 0.12); }
  .tag-x:focus-visible { outline: none; box-shadow: var(--focus); }
}

/* ---------- dashboard (لوحة الأداء): filters, KPI row, charts, channels, videos, compare, tasks, permissions */
@layer components {
  .dash-grid > *, .dash-main > * { min-width: 0; }
  .dash-queue { overflow: hidden; }
  .dash-job .q-main { min-width: 0; flex: 1; }
  .dash-job .q-title, .dash-job .q-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-spin { animation: spin 0.8s linear infinite; }
  .dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
  .dash-sel { display: inline-flex; align-items: center; gap: 6px; color: var(--mute); }
  .dash-sel .icon { width: 17px; height: 17px; }
  .dash-sel .select { width: auto; min-width: 170px; max-width: 260px; }
  .dash-custom {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin: -2px 0 14px; padding: 12px;
    border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line);
  }
  .dash-custom .input { min-width: 160px; min-height: 40px; }
  .dash-custom-err { flex-basis: 100%; margin: 0; }
  .dash-fresh { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; font-size: 12.5px; color: var(--mute); line-height: 1.7; }
  .dash-fresh .icon { width: 16px; height: 16px; margin-top: 4px; }
  .dash-empty { margin: 14px 0; text-align: center; color: var(--mute); font-size: 14px; }
  .dash-sub { margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--champagne); }
  .dash-panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }

  /* percent change: arrow + sign + colour, never colour alone */
  .delta {
    display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 6px; border-radius: 99px; border: 1px solid transparent;
    font-size: 12px; font-weight: 800; line-height: 1.55; direction: ltr; unicode-bidi: isolate; white-space: nowrap; vertical-align: middle;
  }
  .delta .icon { width: 13px; height: 13px; stroke-width: 2.5; }
  .delta-up { color: #a6f0c9; background: rgba(95, 211, 154, 0.1); border-color: rgba(95, 211, 154, 0.28); }
  .delta-down { color: #ffb3b3; background: rgba(240, 114, 114, 0.1); border-color: rgba(240, 114, 114, 0.3); }
  .delta-flat, .delta-na { color: var(--mute); background: rgba(255, 248, 236, 0.04); border-color: var(--line); }
  .delta-n { letter-spacing: 0.01em; }
  .kpi-vs { font-size: 12px; color: var(--mute); }

  /* KPI row */
  .dash-kpis { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
  .dash-kpi { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 14px 12px; overflow: hidden; }
  .dash-kpi.k-views::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 2px; background: var(--gold-grad); }
  .dash-kpi.is-note { background: transparent; border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
  .kpi-head { display: flex; align-items: center; gap: 8px; }
  .kpi-ico {
    display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 9px; color: var(--gold-200);
    background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.22);
  }
  .kpi-ico .icon { width: 16px; height: 16px; }
  .kpi-label { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--champagne); line-height: 1.35; }
  .kpi-value { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
  @media (min-width: 768px) { .kpi-value { font-size: 28px; } }
  .kpi-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .kpi-change { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
  .kpi-spark { display: block; height: 26px; color: var(--gold-400); line-height: 0; }
  .spark { display: block; }
  .spark-line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
  .spark-area { fill: currentColor; opacity: 0.12; }
  .spark-dot { fill: currentColor; }
  .kpi-day { margin: 0; padding-top: 8px; border-top: 1px dashed var(--line-strong); display: grid; gap: 3px; font-size: 12.5px; color: var(--silver); }
  .kpi-day-l b { color: var(--ivory); }
  .kpi-day-d { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
  .kpi-src { margin: 0; font-size: 11px; color: var(--faint); line-height: 1.4; }
  .kpi-note { margin: 0; font-size: 12.5px; color: var(--mute); line-height: 1.6; }
  .kpi-pub { margin: 2px 0 0; display: grid; gap: 8px; }
  .kpi-pub > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
  .kpi-pub dt { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--silver); font-weight: 700; }
  .kpi-pub dt .icon { width: 15px; height: 15px; color: var(--gold-200); }
  .kpi-pub dd { margin: 0; display: flex; align-items: center; gap: 6px; }
  .kpi-pub dd b { font-size: 18px; font-weight: 900; }

  /* the chart row */
  .dash-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 1280px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
  .dash-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; padding: 0; font-size: 12px; color: var(--mute); }
  .dash-legend li { display: inline-flex; align-items: center; }
  .lg-bar { display: inline-block; width: 10px; height: 10px; margin-inline-end: 6px; border-radius: 3px; background: var(--gold-grad); }
  .lg-bar.is-snap { opacity: 0.5; }
  .lg-line { display: inline-block; width: 16px; margin-inline-end: 6px; border-top: 2px solid var(--info); }
  .dash-chart-host { position: relative; width: 100%; direction: ltr; }
  .dsvg { display: block; width: 100%; height: auto; direction: ltr; overflow: visible; touch-action: pan-y; }
  .dg-grid { stroke: rgba(255, 248, 236, 0.07); stroke-width: 1; }
  .dg-base { stroke: rgba(255, 248, 236, 0.22); stroke-width: 1; }
  .dg-tick { fill: var(--mute); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
  .dg-tick-rev { fill: var(--info); }
  .dg-bar { fill: url(#dg-bar); transition: opacity 0.15s; }
  .dg-bar.is-snap { opacity: 0.5; }
  .dg-bar.is-partial { fill: rgba(227, 179, 65, 0.08); stroke: var(--gold-400); stroke-width: 1.5; stroke-dasharray: 3 3; }
  .dg-bar.is-active { opacity: 1; stroke: var(--gold-200); stroke-width: 1.5; stroke-dasharray: none; filter: brightness(1.18); }
  .dg-rev { fill: none; stroke: var(--info); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
  .dg-rev-dot { fill: var(--ink-900); stroke: var(--info); stroke-width: 1.6; }
  .dg-cross { stroke: rgba(255, 248, 236, 0.4); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
  .dg-hit { fill: transparent; cursor: crosshair; outline: none; }
  .dg-hit:focus-visible { fill: rgba(227, 179, 65, 0.1); stroke: var(--gold-200); stroke-width: 2; }
  .dg-line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
  .dg-end { stroke: var(--ink-900); stroke-width: 2; }
  .dash-readout { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); }
  .ro-grid { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .ro-grid > div { min-width: 0; }
  .ro-k { margin: 0; font-size: 11.5px; font-weight: 700; color: var(--faint); }
  .ro-v { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; }
  .ro-v b { font-size: 17px; font-weight: 900; }
  .ro-day .ro-v { font-weight: 800; color: var(--gold-200); }
  .dash-table-bar { margin-top: 12px; }
  .dash-twrap { contain: paint; max-height: 340px; margin-top: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
  .dash-twrap:focus-visible { outline: none; box-shadow: var(--focus); }
  .dash-table th, .dash-table td { white-space: nowrap; }
  .dash-table thead th { position: sticky; top: 0; z-index: 1; background: #15151b; }
  .dash-table th.n, .dash-table td.n { text-align: end; }
  .dash-table tbody th.day { font-weight: 700; color: var(--ivory); text-align: start; background: transparent; border-bottom: 1px solid var(--line); font-size: 13.5px; padding: 12px 14px; }
  .dash-table tbody tr:last-child th.day { border-bottom: 0; }
  .dash-table th.bidi { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

  /* running tasks */
  .dash-qcounts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 12px; }
  .dash-qcounts > div { padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
  .dash-qcounts dt { font-size: 12px; font-weight: 700; color: var(--mute); }
  .dash-qcounts dd { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.3; }
  .dash-qcounts .is-on { border-color: rgba(95, 211, 154, 0.35); }
  .dash-qcounts .is-on dd { color: var(--ok); }
  .dash-qcounts .is-wait dd { color: var(--gold-200); }
  .dash-jobs { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
  .dash-jobs > li { min-width: 0; }
  .dash-job { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
  .dash-job .q-pos { min-width: 30px; height: 30px; font-size: 13px; }
  .dash-job .q-ico { width: 30px; height: 30px; }

  /* per channel */
  .dash-chans { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
  .dash-chan { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
  .chan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
  .chan-head .platform-chip { max-width: 100%; }
  .chan-head .platform-chip .bidi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .chan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin: 0; }
  .chan-stats > div { min-width: 0; }
  .chan-stats dt { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--mute); }
  .chan-stats dt .icon { width: 14px; height: 14px; color: var(--champagne); }
  .chan-stats dd { margin: 2px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; }
  .chan-stats dd b { font-size: 20px; font-weight: 900; line-height: 1.3; }
  .chan-stats .sub { font-size: 11.5px; color: var(--faint); }
  .chan-share { height: 4px; border-radius: 99px; background: rgba(255, 248, 236, 0.07); overflow: hidden; }
  .chan-share > span { display: block; height: 100%; border-radius: 99px; background: var(--gold-grad); transition: width 0.4s; }
  .chan-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .chan-foot:empty { display: none; }
  .chan-rev { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--silver); }
  .chan-rev .icon { color: var(--gold-200); }

  /* per video */
  .dash-vtools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .dash-sort { width: auto; min-width: 190px; }
  .dash-cmpbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
  .dash-vwrap { border: 1px solid var(--line); border-radius: 12px; }
  .dash-vwrap:focus-visible { outline: none; box-shadow: var(--focus); }
  .dash-vtable th.n, .dash-vtable td.n { text-align: end; }
  .dash-vtable .c-sel { width: 52px; padding-inline-end: 4px; }
  .dash-vtable .c-video { min-width: 250px; max-width: 360px; }
  .dash-vtable tr.is-sel td { background: rgba(227, 179, 65, 0.07); }
  .v-title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; }
  .v-meta { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--mute); }
  .v-open { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--mute); }
  .v-open:hover { color: var(--gold-200); background: rgba(255, 248, 236, 0.06); }
  .v-open:focus-visible { outline: none; box-shadow: var(--focus); }
  .dash-cb { position: relative; display: inline-grid; width: 28px; height: 28px; vertical-align: middle; }
  .dash-cb-in { position: absolute; inset: -6px; z-index: 2; width: calc(100% + 12px); height: calc(100% + 12px); margin: 0; opacity: 0; cursor: pointer; }
  .dash-cb-box {
    display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #1a1408; pointer-events: none;
    background: rgba(0, 0, 0, 0.3); border: 2px solid rgba(255, 248, 236, 0.4); transition: background-color 0.12s, border-color 0.12s;
  }
  .dash-cb-box .icon { width: 16px; height: 16px; opacity: 0; stroke-width: 3; }
  .dash-cb-in:hover + .dash-cb-box { border-color: var(--gold-200); }
  .dash-cb-in:checked + .dash-cb-box { background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.9); }
  .dash-cb-in:checked + .dash-cb-box .icon { opacity: 1; }
  .dash-cb-in:focus-visible + .dash-cb-box { box-shadow: var(--focus); }
  .dash-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
  @media (max-width: 720px) {
    .dash-vwrap { border: 0; overflow: visible; border-radius: 0; }
    .dash-vtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .dash-vtable, .dash-vtable tbody { display: block; }
    .dash-vtable tr {
      position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-bottom: 10px; padding: 12px;
      border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, 0.22);
    }
    .dash-vtable td { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; border: 0; min-width: 0; }
    .dash-vtable td::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; color: var(--mute); }
    .dash-vtable td.c-sel { position: absolute; inset-block-start: 12px; inset-inline-start: 12px; width: auto; padding: 0; }
    .dash-vtable td.c-sel::before, .dash-vtable td.c-video::before { content: none; }
    .dash-vtable td.c-video { display: block; grid-column: 1 / -1; min-width: 0; max-width: none; padding-inline-start: 42px; min-height: 30px; }
    .dash-vtable tr.is-sel { border-color: rgba(227, 179, 65, 0.7); box-shadow: 0 0 0 1px rgba(227, 179, 65, 0.45); }
    .dash-vtable tr.is-sel td { background: transparent; }
  }

  /* side by side */
  .dash-cmp-cards { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .dash-cmp-card { min-width: 0; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-top: 3px solid var(--sc, var(--gold-400)); }
  .cmp-key { display: block; margin-bottom: 6px; }
  .cmp-total { margin: 6px 0 0; }
  .cmp-total b { font-size: 20px; font-weight: 900; }
  .cmp-vs { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }

  /* what is collected, permissions */
  .dash-layers { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .dash-layers li { display: flex; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); }
  .layer-ico { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 10px; color: var(--gold-200); background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.22); }
  .layer-ico .icon { width: 16px; height: 16px; }
  .layer-t { margin: 0; font-size: 13.5px; font-weight: 800; }
  .layer-d { margin: 2px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--mute); }
  .dash-conns { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .dash-conn { min-width: 0; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.22); }
  .conn-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
  .conn-name { margin: 0; min-width: 0; font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
  .conn-rows { list-style: none; margin: 0; padding: 0; }
  .conn-rows > li { padding: 10px 0; border-top: 1px solid var(--line); }
  .row-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 700; }
  .row-d { margin: 4px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--mute); }
  .row-act { margin-top: 8px; }
}

/* ---------------------------------------------------------------- production scheduling (dialog and calendar) */
@layer components {
  .modal-xl { max-width: 880px; }

  /* the production dialog */
  .sch-card { display: grid; gap: 14px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); }
  .sch-card > * { min-width: 0; }
  .sch-status { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 700; line-height: 1.5; }
  .sch-readout { margin: 0; font-size: 13px; font-weight: 700; color: var(--gold-200); }
  .sch-wd { min-width: 46px; justify-content: center; }
  .sch-mini { height: 26px; padding: 0 9px; font-size: 12px; }
  .sch-details summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--champagne); border-radius: 6px; width: fit-content; }
  .sch-details summary:focus-visible { outline: none; box-shadow: var(--focus); }
  .sch-key { display: inline-block; width: 18px; height: 12px; flex: none; border-radius: 4px; --sc: var(--gold-400); }
  .sch-key.is-short { background: color-mix(in srgb, var(--sc) 38%, #15151b); border-inline-start: 4px solid var(--sc); }
  .sch-key.is-full { border: 1.5px dashed var(--sc); background: color-mix(in srgb, var(--sc) 8%, transparent); }
  .sch-key.is-slot { border: 1px dotted var(--sc); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--sc) 60%, transparent) 0 3px, transparent 3px 6px); }
  .sch-key.is-open { background: color-mix(in srgb, var(--ok) 30%, transparent); box-shadow: 0 0 0 1px var(--ok), 0 0 8px rgba(95, 211, 154, 0.45); }
  .sch-key.is-now { height: 0; width: 18px; border-radius: 0; border-top: 2px solid var(--gold-400); }

  /* the 24-hour bar */
  .sch-bar24 { padding: 12px 14px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
  .sch-track { position: relative; margin-inline: 14px; }
  .sch-axis { position: relative; height: 16px; }
  .sch-axis span { position: absolute; top: 0; font-size: 11px; color: var(--faint); transform: translateX(-50%); }
  html[dir='rtl'] .sch-axis span { transform: translateX(50%); }
  .sch-rows {
    position: relative; display: grid; gap: 4px; padding-block: 3px; border-right: 1px solid rgba(255, 248, 236, 0.09);
    background-image: linear-gradient(to right, rgba(255, 248, 236, 0.09) 1px, transparent 1px); background-size: 12.5% 100%; background-repeat: repeat-x;
  }
  .sch-row { position: relative; height: 24px; border-radius: 6px; background: rgba(255, 248, 236, 0.03); }
  .sch-row.is-mine { height: 28px; background: rgba(227, 179, 65, 0.06); }
  .sch-seg {
    position: absolute; top: 2px; bottom: 2px; display: flex; align-items: center; min-width: 4px; padding-inline: 6px; overflow: hidden;
    border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; color: var(--silver);
    background: rgba(255, 248, 236, 0.14); border: 1px solid rgba(255, 248, 236, 0.24); cursor: default;
  }
  .sch-seg.is-full { background: transparent; border-style: dashed; }
  .sch-seg.is-mine { color: #1a1408; background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.85); }
  .sch-seg.is-mine.is-full { color: var(--gold-200); background: rgba(227, 179, 65, 0.1); border-color: var(--gold-400); }
  .sch-seg:focus-visible { outline: none; box-shadow: var(--focus); z-index: 2; }
  .sch-row-none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: var(--faint); }
  .sch-hover { min-height: 22px; margin: 8px 0 0; font-size: 12.5px; color: var(--silver); line-height: 1.6; }

  /* the calendar page */
  .sch-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; margin-bottom: 12px; }
  .sch-week-label { margin: 0; font-size: 16px; font-weight: 900; }
  .sch-tz { margin: 0; margin-inline-start: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--mute); }
  .sch-legend { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--mute); }
  .sch-legend li { display: inline-flex; align-items: center; gap: 6px; }
  .sch-week { overflow: hidden; }
  .sch-scroll { position: relative; max-height: min(72vh, 780px); overflow: auto; overscroll-behavior: contain; border-radius: var(--radius) var(--radius) 0 0; }
  .sch-scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(227, 179, 65, 0.7); }
  .sch-grid { --sch-hour: 30px; display: grid; grid-template-columns: 44px repeat(7, minmax(92px, 1fr)); }
  .sch-corner, .sch-dayhead { position: sticky; top: 0; z-index: 4; background: #15151b; border-bottom: 1px solid var(--line-strong); }
  .sch-dayhead { padding: 8px 8px 7px; border-inline-start: 1px solid var(--line); min-width: 0; }
  .sch-dayhead.is-today { box-shadow: inset 0 2px 0 var(--gold-400); background: #1a1914; }
  .sch-dn { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; line-height: 1.4; }
  .sch-dname { font-weight: 900; font-size: 14px; }
  .sch-dayhead.is-today .sch-dname { color: var(--gold-200); }
  .sch-ddate { font-size: 12px; color: var(--mute); }
  .sch-res { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 2px 9px; font-size: 11.5px; color: var(--silver); }
  .sch-res > span { display: inline-flex; align-items: center; gap: 3px; }
  .sch-res .icon { width: 12px; height: 12px; }
  .sch-res .r-short .icon, .sch-res .r-full .icon { color: var(--gold-200); }
  .sch-res .r-live .icon { color: var(--live); }
  .sch-res .r-fail { color: #ffb3b3; }
  .sch-res-none { margin: 3px 0 0; font-size: 11.5px; color: var(--faint); }
  .sch-hours { position: relative; height: calc(24 * var(--sch-hour)); }
  .sch-hours span { position: absolute; inset-inline-end: 6px; font-size: 11px; line-height: 1; color: var(--faint); margin-top: 3px; }
  .sch-col {
    position: relative; height: calc(24 * var(--sch-hour)); min-width: 0; border-inline-start: 1px solid var(--line);
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--sch-hour) - 1px), rgba(255, 248, 236, 0.06) calc(var(--sch-hour) - 1px), rgba(255, 248, 236, 0.06) var(--sch-hour));
  }
  .sch-col.is-today { background-color: rgba(227, 179, 65, 0.045); }
  .sch-blk {
    position: absolute; display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 3px 4px; overflow: hidden; cursor: pointer;
    text-align: start; font: inherit; font-size: 11.5px; line-height: 1.3; color: var(--ivory); background: transparent;
    border: 1px solid var(--sc); border-radius: 8px; --sc: var(--gold-400);
  }
  .sch-blk-h { display: flex; align-items: center; gap: 4px; min-width: 0; font-weight: 800; }
  .sch-blk-h .icon { width: 12px; height: 12px; color: var(--sc); }
  .sch-blk-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sch-blk-t { overflow: hidden; text-overflow: clip; white-space: nowrap; font-size: 10px; color: var(--silver); }
  .sch-blk-t.num { direction: ltr; unicode-bidi: isolate; text-align: left; }
  .sch-blk.is-short { background: color-mix(in srgb, var(--sc) 24%, #15151b); border-inline-start-width: 4px; }
  .sch-blk.is-full { background: color-mix(in srgb, var(--sc) 7%, transparent); border: 1.5px dashed var(--sc); }
  .sch-blk.is-slot { border: 1px dotted var(--sc); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--sc) 24%, transparent) 0 5px, transparent 5px 10px); }
  .sch-blk.is-open { box-shadow: 0 0 0 1px var(--ok), 0 0 14px rgba(95, 211, 154, 0.35); }
  .sch-blk.is-past { opacity: 0.55; }
  .sch-blk.is-more { border-end-start-radius: 0; border-end-end-radius: 0; }
  .sch-blk.is-cont { border-start-start-radius: 0; border-start-end-radius: 0; }
  .sch-blk:hover { filter: brightness(1.12); z-index: 2; }
  .sch-blk:focus-visible { outline: none; box-shadow: var(--focus); z-index: 3; }
  .sch-blk.is-sel { box-shadow: 0 0 0 2px var(--gold-200); z-index: 2; }
  .sch-now { position: absolute; inset-inline: 0; height: 0; z-index: 3; border-top: 2px solid var(--gold-400); pointer-events: none; }
  .sch-now::before { content: ''; position: absolute; inset-inline-start: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-400); }
  .sch-now span { position: absolute; inset-inline-end: 2px; top: -17px; padding: 0 4px; border-radius: 4px; font-size: 10.5px; font-weight: 800; color: #1a1408; background: var(--gold-400); }
  .sch-detail { padding: 10px 14px; border-top: 1px solid var(--line); min-height: 46px; }

  /* the agenda */
  .sch-list { display: grid; gap: 12px; }
  .sch-day { padding: 14px; }
  .sch-day.is-today { border-color: rgba(227, 179, 65, 0.4); }
  .sch-day-head { display: flex; align-items: center; gap: 10px; }
  .sch-day-title { margin: 0; font-size: 15.5px; font-weight: 900; }
  .sch-day-res { margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--silver); }
  .sch-agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  .sch-ag {
    display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border-radius: 10px; --sc: var(--gold-400);
    background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-inline-start: 4px solid var(--sc);
  }
  .sch-ag.is-full { border-style: dashed; border-color: var(--sc); background: color-mix(in srgb, var(--sc) 6%, transparent); }
  .sch-ag.is-slot { border-style: dotted; border-color: var(--sc); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--sc) 14%, transparent) 0 6px, transparent 6px 12px); }
  .sch-ag.is-open { box-shadow: 0 0 0 1px var(--ok); }
  .sch-ag.is-past { opacity: 0.6; }
  .sch-ag-time { flex: none; min-width: 104px; font-size: 13px; font-weight: 800; color: var(--ivory); direction: ltr; text-align: start; unicode-bidi: isolate; }
  .sch-ag-body { flex: 1; min-width: 0; display: grid; }
  .sch-ag-name { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sch-ag-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; color: var(--mute); }
  @media (max-width: 899px) {
    .sch-week { display: none !important; }
    .sch-list { display: grid !important; }
    .sch-viewseg { display: none; }
    .sch-tz { margin-inline-start: 0; width: 100%; }
  }
  @media (max-width: 480px) {
    .sch-ag-time { min-width: 0; }
    .sch-ag { flex-wrap: wrap; }
    .sch-ag-body { flex: 1 1 calc(100% - 60px); }
  }
}

/* ---------------------------------------------------------------- full videos: recipes, moments, editor */
@layer components {
  .clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .btn-wrap { height: auto; min-height: 32px; padding-block: 7px; white-space: normal; text-align: start; line-height: 1.35; }
  .link-btn {
    display: inline; padding: 0; margin-inline-start: 8px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--gold-200);
    background: transparent; border: 0; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(248, 224, 142, 0.35); text-underline-offset: 3px; border-radius: 4px;
  }
  .link-btn:hover { text-decoration-color: var(--gold-200); }
  .link-btn:focus-visible { outline: none; box-shadow: var(--focus); }
  .bar.is-ok > span { background: linear-gradient(90deg, rgba(95, 211, 154, 0.9), rgba(95, 211, 154, 0.55)); }

  /* a landscape frame (16:9) for full videos and moments */
  .clip-media.is-wide { aspect-ratio: 16 / 9; }
  .clip-media.is-wide .play-btn { width: 56px; height: 56px; }
  .clip-media.is-wide .clip-poster { padding: 12px; }
  .clip-poster[disabled] { cursor: default; }

  /* recipe cards */
  .fv-grid { display: grid; align-items: start; gap: 20px; grid-template-columns: minmax(0, 1fr); list-style: none; margin: 0; padding: 0; }
  @media (min-width: 1280px) { .fv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .fv-grid > li { display: flex; min-width: 0; }
  .fv-card { display: flex; flex-direction: column; gap: 16px; width: 100%; padding: 20px; transition: opacity 0.2s, border-color 0.2s; }
  .fv-card.is-paused { opacity: 0.72; }
  .fv-card.is-paused .fv-name { color: var(--silver); }
  .fv-head { display: flex; align-items: flex-start; gap: 12px; }
  .fv-name { font-size: 18px; font-weight: 900; line-height: 1.4; overflow-wrap: anywhere; }
  .fv-theme { font-size: 13.5px; color: var(--silver); margin-top: 2px; overflow-wrap: anywhere; }
  .fv-chans { display: flex; flex-wrap: wrap; gap: 8px; }
  .fv-chan {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 30px; padding-inline: 10px; border-radius: 10px;
    font-size: 13px; font-weight: 700; background: rgba(255, 248, 236, 0.06); border: 1px solid var(--line-strong);
  }
  .fv-chan .pf { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  .fv-chan .icon { width: 15px; height: 15px; color: var(--warn); }
  .fv-chan.is-off { border-color: rgba(242, 182, 90, 0.5); background: rgba(242, 182, 90, 0.08); color: #ffd59a; }
  .fv-warn {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55;
    border: 1px solid rgba(242, 182, 90, 0.4); background: rgba(242, 182, 90, 0.08); color: #ffe2b3;
  }
  .fv-warn > .icon { margin-top: 2px; color: var(--warn); }
  .fv-prog { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); }
  .fv-next { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.55; color: var(--silver); }
  .fv-next .dot { margin-top: 7px; }
  .fv-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
  .fv-stats > div { min-width: 0; }
  .fv-stats dt { font-size: 12px; color: var(--mute); font-weight: 600; line-height: 1.4; }
  .fv-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 900; line-height: 1.2; }
  .fv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .fv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
  .fv-how { display: grid; gap: 10px; max-width: 460px; margin: 20px auto 0; padding: 0; list-style: none; text-align: start; }
  .fv-how li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--silver); }
  .fv-how .num {
    flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 12.5px; font-weight: 900;
    color: var(--gold-200); background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.3);
  }

  /* moments */
  .fv-mgrid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 720px) { .fv-mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (min-width: 1200px) { .fv-mgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  .fv-moment { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
  .fv-moment.is-excluded .clip-media { filter: grayscale(0.85) brightness(0.8); }
  .fv-moment.is-excluded h3 { color: var(--mute); }

  /* editor */
  .fv-pick { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 640px) { .fv-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .fv-pickrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-inline-end: 40px; min-height: 48px; }
  .fv-pickname { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
  .fv-pickname .pf { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  .fv-pickoff { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--warn); }
  .fv-tick {
    position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; padding: 3px; border-radius: 50%;
    border: 1px solid var(--line-strong); color: transparent;
  }
  .fv-pickrow.is-on .fv-tick { color: #1a1408; background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.7); }
  .fv-switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
  .opt-why { color: var(--warn); font-weight: 600; }
  /* a full video's card in the studio */
  .clip-card.is-full .clip-media { aspect-ratio: 16 / 9; }
  .clip-card.is-full .play-btn { width: 56px; height: 56px; }
  .chapters { max-height: 150px; overflow-y: auto; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: grid; gap: 3px; list-style: none; }
  .chapters li { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.5; }
  .chapters .at { flex: none; font-weight: 800; color: var(--gold-200); direction: ltr; unicode-bidi: isolate; min-width: 38px; }
  .full-badge { color: #1a1408; background: var(--gold-grad); border-color: rgba(248, 224, 142, 0.7); }
}

@layer components {
  .fv-clipgrid { grid-template-columns: minmax(0, 1fr) !important; }
  @media (min-width: 900px) { .fv-clipgrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
  @media (min-width: 1536px) { .fv-clipgrid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
}
