/* ============================================================================
   Corvus Studio — premium dark UI.
   Theme: "raven iridescence" — obsidian surfaces + a violet→indigo→cyan sheen
   (the colours of light on a raven's wing). Server-rendered; no JS required.
   ========================================================================== */
:root {
  /* navy base — mirrors the Corvus Hub design system */
  --bg:        #08081a;
  --bg-1:      #0a0a1a;
  --bg-2:      #0c0c1d;
  --surface:   #141428;
  --surface-2: #1e1e3a;
  --surface-3: #1e1e3a;  /* legacy alias kept for older rules */
  --elevated:  #232347;
  --border:    rgba(139,92,246,.14);
  --border-2:  rgba(139,92,246,.26);
  --hairline:  rgba(255,255,255,.06);

  --text:    #f3f4f6;
  --text-2:  #d1d5db;
  --muted:   #9ca3af;
  --muted-2: #6b7280;

  /* purple accent ramp (Hub) */
  --iris-1: #a855f7;   /* purple-bright */
  --iris-2: #8b5cf6;   /* violet        */
  --iris-3: #a78bfa;   /* soft violet (links) */
  --iris-4: #c4b5fd;   /* light lilac   */
  --accent:   #7c3aed;
  --accent-2: #a855f7;
  --sheen:  linear-gradient(135deg, #a855f7 0%, #8b5cf6 52%, #7c3aed 100%);
  --sheen-soft: linear-gradient(135deg, rgba(168,85,247,.16), rgba(124,58,237,.10) 70%, rgba(139,92,246,.08));

  /* status */
  --green: #34d27b; --green-bg: rgba(52,210,123,.12); --green-bd: rgba(52,210,123,.32);
  --amber: #f0b13c; --amber-bg: rgba(240,177,60,.12); --amber-bd: rgba(240,177,60,.34);
  --red:   #f56a78; --red-bg:   rgba(245,106,120,.12); --red-bd:  rgba(245,106,120,.34);
  --blue:  #4aa3ff; --blue-bg:  rgba(74,163,255,.12); --blue-bd:  rgba(74,163,255,.34);
  --violet:#b08cff; --violet-bg:rgba(176,140,255,.14); --violet-bd:rgba(176,140,255,.36);

  --r:    14px;
  --r-sm: 9px;
  --r-lg: 22px;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.30);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 24px 60px rgba(0,0,0,.45);
  --glow: 0 0 0 1px rgba(124,58,237,.25), 0 8px 30px rgba(124,58,237,.35);
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", "Roboto Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* attribute must win over component display rules */
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(124,58,237,.16), transparent 60%),
    radial-gradient(760px 480px at 6% 4%, rgba(168,85,247,.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--iris-3); text-decoration: none; }
a:hover { color: var(--iris-1); }
h1, h2, h3 { margin: 0; font-weight: 680; letter-spacing: -.015em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.dot { color: var(--muted-2); margin: 0 2px; }
::selection { background: rgba(139,92,246,.32); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4456; background-clip: content-box; }

/* ---------- Raven brand mark ---------- */
.raven { display: block; }
.raven-svg { display: block; width: 100%; height: 100%; }
.brand-mark { /* rounded glass container that frames the Corvus Studio logo */
  width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden;
  border-radius: 10px; background: #0c0c1d;
  border: 1px solid rgba(139,92,246,.30);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px rgba(124,58,237,.30);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- App shell / layout ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0e0e24, var(--bg-1));
  border-right: 1px solid var(--border); padding: 20px 14px 16px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; align-items: center; padding: 4px 8px 20px; }
.brand-mark { grid-row: span 2; align-self: center; }
.brand-name { font-weight: 760; font-size: 17px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name b { background: var(--sheen); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { grid-column: 2; font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .16em; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: 10px; color: var(--muted); font-weight: 560; font-size: 13.5px;
  transition: background .14s, color .14s; isolation: isolate;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(139,92,246,.20), rgba(139,92,246,.02)); }
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--sheen); box-shadow: 0 0 12px rgba(139,92,246,.7);
}
.nav-link .ic { width: 18px; text-align: center; opacity: .85; font-size: 15px; }
.nav-sep { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); padding: 16px 12px 5px; }
.soon { margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: var(--iris-1);
  background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.3); border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.lang-switch { display: inline-flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.lang-switch a { color: var(--muted-2); font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 6px; letter-spacing: .03em; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a.on { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-2); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 30px; background: rgba(8,8,26,.72); backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 19px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: inline-flex; align-items: center; gap: 9px; color: var(--text-2); font-weight: 560; font-size: 13px; }
.role-badge { font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; }
.role-admin  { background: var(--violet-bg); color: var(--violet); border: 1px solid var(--violet-bd); }
.role-editor { background: var(--blue-bg);  color: var(--blue);  border: 1px solid var(--blue-bd); }
.content { padding: 28px 34px 80px; width: 100%; max-width: none; }
.content > * { animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 650; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); transition: .14s; white-space: nowrap; }
.btn:hover { border-color: #3a4658; background: var(--elevated); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--sheen); border: none; color: #fff; box-shadow: 0 6px 20px rgba(124,58,237,.4); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 8px 26px rgba(124,58,237,.55); }
.btn.primary:disabled { background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--border); cursor: not-allowed; box-shadow: none; transform: none; filter: none; }
.btn.warn { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.btn.warn:hover { background: rgba(240,177,60,.2); }
.btn.ghost { background: transparent; }
.btn.ghost.on { background: rgba(139,92,246,.14); border-color: rgba(139,92,246,.45); color: #fff; }
.btn.block { width: 100%; }
.btn.xs { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 8px; }

input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; outline: none; transition: .14s; }
input:hover, select:hover, textarea:hover { border-color: var(--accent-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,92,246,.2); background: var(--surface); }
input[type="time"] { font-variant-numeric: tabular-nums; }

/* ---------- Auth (login / change password) ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(700px 480px at 50% -10%, rgba(124,58,237,.20), transparent 60%); }
.auth-card { width: 384px; max-width: 100%; background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 34px 32px; box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,.6), transparent); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 23px; font-weight: 780; letter-spacing: -.02em; }
.auth-brand .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
.auth-brand .brand-mark .raven-svg { width: 27px; height: 27px; }
.auth-brand b { background: var(--sheen); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .18em; margin: 14px 0 24px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form label, .settings-fields label { display: flex; flex-direction: column; gap: 7px; font-size: 12px;
  color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.auth-form .btn { margin-top: 6px; padding: 11px; font-size: 14px; }
.auth-lang { margin-top: 22px; color: var(--muted-2); font-size: 12px; text-align: center; }
.auth-lang a { color: var(--muted); font-weight: 600; } .auth-lang a.on { color: var(--text); }
.alert { padding: 10px 13px; border-radius: 10px; font-size: 13px; }
.alert.err  { background: var(--red-bg);  border: 1px solid var(--red-bd);  color: #ffb0b7; }
.alert.info { background: var(--blue-bg); border: 1px solid var(--blue-bd); color: #bcd9ff; }

/* ---------- Panels ---------- */
.panel { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel h2 { font-size: 14.5px; }
.subhead { margin: -6px 0 20px; color: var(--muted); }
.subhead-row { display: flex; align-items: center; gap: 12px; margin: -6px 0 20px; }
.subhead-row .subhead { margin: 0; }
.scoped-note { display: flex; align-items: center; gap: 9px; background: var(--sheen-soft); border: 1px solid rgba(139,92,246,.28);
  color: var(--text-2); border-radius: 11px; padding: 11px 15px; font-size: 13px; margin-bottom: 20px; }
.scoped-note::before { content: "◆"; color: var(--iris-1); font-size: 11px; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--muted); letter-spacing: .01em; }
.badge.green  { background: var(--green-bg);  color: var(--green);  border-color: var(--green-bd); }
.badge.amber  { background: var(--amber-bg);  color: var(--amber);  border-color: var(--amber-bd); }
.badge.red    { background: var(--red-bg);    color: #ffb0b7;       border-color: var(--red-bd); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue);   border-color: var(--blue-bd); }
.badge.violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-bd); }
.badge.muted  { color: var(--muted-2); }
.badge.status { text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }
.status-live { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
.status-staged { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-bd); }
.status-instructed, .status-sent_to_creator { background: var(--surface-2); color: var(--muted); }
.status-editing { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bd); }
.status-archived { background: var(--surface-2); color: var(--muted-2); }

/* ---------- Kanban board ---------- */
.board { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.column { flex: 1 1 340px; min-width: 300px; background: linear-gradient(180deg, rgba(255,255,255,.02), transparent), var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.col-head { display: flex; align-items: center; gap: 9px; padding: 4px 6px 14px; }
.col-title { font-weight: 680; font-size: 12.5px; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); }
.col-count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 7px; }
.col-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.col-to_cut  .col-dot { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.col-editing .col-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.col-staged  .col-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.col-body { display: flex; flex-direction: column; gap: 11px; min-height: 72px; }
.col-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted-2); font-size: 12px;
  text-align: center; padding: 26px 12px; border: 1px dashed var(--border-2); border-radius: 11px; }
.col-empty .ce-icon { font-size: 18px; opacity: .6; }

.reel-card { position: relative; display: block; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 15px 16px 15px 19px; transition: transform .14s, border-color .14s, box-shadow .14s; overflow: hidden; }
.reel-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--muted-2); }
.reel-card:hover { transform: translateY(-2px); border-color: var(--accent-2); box-shadow: var(--shadow); }
.reel-card.ok::before   { background: linear-gradient(180deg, var(--green), #1fae63); box-shadow: 0 0 14px rgba(52,210,123,.5); }
.reel-card.warn::before { background: linear-gradient(180deg, var(--amber), #c98a2a); box-shadow: 0 0 14px rgba(240,177,60,.5); }
.rc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rc-creator { font-weight: 760; color: var(--text); font-size: 15.5px; letter-spacing: -.01em; }
.rc-num { font-size: 13px; color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.rc-checks { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 7px; border: 1px solid var(--border-2); color: var(--muted-2); background: var(--bg-2); }
.pill.yes { color: var(--green); border-color: var(--green-bd); background: var(--green-bg); }
.pill.no  { color: var(--muted-2); opacity: .8; }
.rc-missing { margin: 10px 0 0; padding: 8px 10px 8px 26px; color: var(--amber); font-size: 11.5px;
  background: var(--amber-bg); border: 1px solid var(--amber-bd); border-radius: 9px; list-style-position: inside; }

/* full-width "intentional" empty pipeline */
.empty-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 30px 20px; margin-bottom: 24px; border: 1px dashed var(--border-2); border-radius: var(--r);
  background: radial-gradient(420px 200px at 50% 0, rgba(124,58,237,.08), transparent 70%); }
.empty-hero .eh-mark { width: 52px; height: 52px; opacity: .8; }
.empty-hero h3 { font-size: 15px; }
.empty-hero p { margin: 0; color: var(--muted); font-size: 13px; max-width: 440px; }

/* ---------- Availability (coverage bars) ---------- */
.avail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.avail-card { display: flex; flex-direction: column; gap: 11px; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 13px; padding: 16px 18px; }
.avail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.avail-name { font-weight: 760; font-size: 15px; color: var(--text); letter-spacing: -.01em; }
.avail-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.avail-sub b { color: var(--text); font-weight: 700; }
.coverage-bar { height: 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.coverage-bar > span { display: block; height: 100%; border-radius: 999px; min-width: 3px;
  background: linear-gradient(90deg, #1fae63, var(--green)); transition: width .35s ease; }
.coverage-bar.low > span { background: linear-gradient(90deg, #c98a2a, var(--amber)); }

/* ---------- Reel detail ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 16px; font-weight: 650; font-size: 13px; }
.back-link:hover { color: var(--text); }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 18px; }
.preview-box { display: flex; gap: 15px; align-items: center; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.preview-play { width: 58px; height: 58px; flex: none; display: grid; place-items: center; font-size: 21px; color: #fff;
  background: var(--sheen); border-radius: 14px; box-shadow: 0 8px 22px rgba(124,58,237,.45); }
.preview-title { font-weight: 650; }
.kv { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 11px 2px; border-top: 1px solid var(--border); }
.kv-k { color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.kv-v { word-break: break-word; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.check-ic { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 7px; font-size: 12px; font-weight: 800; }
.check.ok .check-ic  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.check.bad .check-ic { background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--border-2); }
.validation-summary { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); font-weight: 650; font-size: 13px; }
.validation-summary.ok { color: var(--green); }
.validation-summary.warn { color: var(--amber); }
.chip { display: inline-block; font-size: 11px; background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bd);
  border-radius: 7px; padding: 2px 9px; margin: 4px 4px 0 0; }
.status-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.live-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Content inbox ---------- */
.inbox-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.inbox-stub { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 12px; gap: 8px; }
.stub-icon { width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px; color: var(--iris-1);
  background: var(--sheen-soft); border: 1px solid rgba(139,92,246,.25); border-radius: 50%; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 6px; border-top: 1px solid var(--border); }
.file-list li:first-child { border-top: none; }
.file-name { flex: 1 1 260px; min-width: 160px; display: flex; align-items: center; gap: 8px;
  white-space: normal; overflow-wrap: anywhere; word-break: normal; font-size: 14px; font-weight: 650; color: var(--text); line-height: 1.4; }
.file-meta { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.file-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Instructions ---------- */
.instr-list { display: flex; flex-direction: column; gap: 14px; }
.instr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.instr-id { display: flex; align-items: baseline; gap: 10px; }
.instr-toggles { display: flex; gap: 16px; }
.switch-form { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; background: none; border: none;
  color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 650; padding: 0; }
.switch-track { width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-2);
  position: relative; transition: .18s; flex: none; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--muted);
  transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch:hover .switch-track { border-color: #3a4658; }
.switch.on .switch-track { background: linear-gradient(90deg, var(--green-bg), rgba(52,210,123,.28)); border-color: var(--green-bd); }
.switch.on .switch-knob { left: 19px; background: var(--green); box-shadow: 0 0 10px rgba(52,210,123,.7); }
.switch.on .switch-label { color: var(--green); }
.brief { border-top: 1px solid var(--border); padding-top: 12px; }
.brief summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; }
.brief summary::-webkit-details-marker { display: none; }
.brief summary::before { content: "▸"; color: var(--iris-1); margin-right: 8px; display: inline-block; transition: .15s; }
.brief[open] summary::before { transform: rotate(90deg); }
.brief-body { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 12px 0 0; max-height: 360px; overflow: auto; }

/* ---------- Settings ---------- */
.settings-list { display: flex; flex-direction: column; gap: 14px; }
.settings-form { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: center; }
.settings-name { font-weight: 700; font-size: 14px; }
.settings-name .muted.small { display: block; font-weight: 500; margin-top: 3px; }
.settings-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
.settings-fields input[type=number] { width: 92px; }
.time-pair { display: flex; gap: 6px; align-items: center; }
.tz-foot { margin-top: 16px; display: inline-flex; align-items: center; gap: 7px; }
.tz-foot::before { content: "🌐"; filter: grayscale(.3); }

/* ---------- Premium "coming soon" placeholder ---------- */
.placeholder { position: relative; overflow: hidden; text-align: center; padding: 58px 24px 64px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--border-2); border-radius: var(--r-lg); }
.placeholder::before { content: ""; position: absolute; inset: -40% 0 auto 0; height: 70%;
  background: radial-gradient(520px 240px at 50% 0, rgba(124,58,237,.18), transparent 70%); pointer-events: none; }
.ph-badge { position: relative; display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em; color: #fff; background: var(--sheen); border-radius: 999px;
  padding: 5px 14px; box-shadow: 0 6px 18px rgba(124,58,237,.4); }
.ph-icon { position: relative; font-size: 46px; margin: 22px 0 10px; background: var(--sheen);
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 14px rgba(124,58,237,.5)); }
.placeholder h2 { position: relative; font-size: 20px; }
.placeholder p { position: relative; color: var(--muted); max-width: 460px; margin: 8px auto 0; }
.ph-preview { position: relative; display: flex; justify-content: center; gap: 8px; margin-top: 26px; opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent); }
.ph-preview span { width: 54px; height: 34px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border-2); }

/* ---------- Distribution matrix (Phase 4) ---------- */
.dist-banner { display: flex; align-items: center; gap: 9px; background: var(--amber-bg); border: 1px solid var(--amber-bd);
  color: var(--amber); border-radius: 11px; padding: 11px 15px; font-size: 13px; font-weight: 700; margin-bottom: 16px; letter-spacing: .01em; }
.dist-overview { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin-bottom: 18px; padding: 15px 20px; }
.dist-ov { display: flex; align-items: baseline; gap: 8px; }
.dist-ov b { font-size: 15px; font-variant-numeric: tabular-nums; }
.dist-teams { display: flex; flex-direction: column; gap: 16px; }
.dist-team-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.dist-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dist-table-wrap { overflow-x: auto; }
.dist-matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dist-matrix th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2);
  font-weight: 700; padding: 6px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dist-matrix td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.dist-matrix tbody tr:last-child td { border-bottom: none; }
.dist-matrix tbody tr:hover td { background: rgba(255,255,255,.018); }
.dist-wcol { width: 170px; }
.dist-wname { font-weight: 680; color: var(--text); white-space: nowrap; }
.dist-cell { font-variant-numeric: tabular-nums; }
.dist-cell.filled { color: var(--text-2); }
.dist-cell.empty { color: var(--muted-2); }
.dist-cell.recycled { color: var(--blue); }
.dist-rec { color: var(--blue); font-weight: 800; }
.dist-short { text-align: right; white-space: nowrap; }
.dist-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dist-note { color: var(--amber); }
.viral-note { display: block; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- History (received) matrix (Task 3) ---------- */
.hist-creatorbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hist-creator { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--muted); font-weight: 650; font-size: 13px; }
.hist-creator:hover { color: var(--text); border-color: #3a4658; }
.hist-creator.on { color: #fff; background: var(--sheen); border-color: transparent; }
.hist-panel { padding: 16px; }
.hist-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.hist-tools { display: inline-flex; gap: 8px; }
.hist-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: 10px; }
.hist-matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.hist-matrix th, .hist-matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; }
.hist-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-weight: 700;
  padding: 7px 6px; white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums; }
.hist-matrix thead th:hover { color: #fff; background: var(--surface-3); }
.hist-corner { position: sticky; left: 0; z-index: 3 !important; text-align: left !important; min-width: 150px; padding-left: 12px !important; }
.hist-rowhead { position: sticky; left: 0; z-index: 1; background: var(--bg-2); text-align: left; white-space: nowrap;
  padding: 6px 12px; font-weight: 650; color: var(--text); cursor: pointer; }
.hist-rowhead:hover { color: var(--iris-1); }
.hist-cell { width: 34px; }
.hist-cell input { margin: 6px; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.hist-cell.real { background: rgba(74,163,255,.08); }
.hist-cell.real input { accent-color: var(--blue); cursor: not-allowed; }
.hist-matrix tbody tr:hover td { background: rgba(255,255,255,.02); }
.hist-matrix tbody tr:hover .hist-rowhead { background: var(--surface-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .brand { padding: 4px 8px; } .brand-tag { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; margin: 0; gap: 4px; } .nav-sep { display: none; }
  .nav-link.active::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .board { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 560px) {
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 13px 16px; }
  .user-chip { display: none; }
}

/* ============================================================================
   Stage B — Hub-matched pipeline filter + collapsible board + instruction tracker
   ========================================================================== */
.avail-panel { margin-bottom: 22px; }

/* creator filter bar (reuses the history creator-pill styling) */
.filterbar { display: flex; align-items: center; gap: 14px; margin: 2px 0 20px; flex-wrap: wrap; }
.filterbar-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.filterbar .hist-creatorbar { margin-bottom: 0; }

/* board columns are collapsible <details> + independently scrollable */
.board > .column.is-empty { flex: 0 1 248px; min-width: 216px; }
details.column { align-self: start; }
.column > summary.col-head { list-style: none; cursor: pointer; user-select: none; }
.column > summary.col-head::-webkit-details-marker { display: none; }
.col-caret { margin-left: 4px; color: var(--muted-2); font-size: 11px; transition: transform .16s; }
details.column:not([open]) .col-caret { transform: rotate(-90deg); }
.col-requested .col-dot { background: var(--iris-1); box-shadow: 0 0 8px var(--iris-1); }
.col-ready .col-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.col-body { max-height: 72vh; overflow-y: auto; padding-right: 5px; }

.empty-hero img.eh-mark { width: 56px; height: 56px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 8px 24px rgba(124,58,237,.35); }

/* instruction tracker — grouped by creator, then ISO week */
.instr-creator-group { margin-bottom: 26px; }
.instr-creator-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 12px;
  border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.instr-creator-name { font-size: 16px; font-weight: 760; letter-spacing: -.01em; }
.instr-creator-count { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 8px; }
.week-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-1); overflow: hidden; }
.week-summary { display: flex; align-items: center; gap: 11px; padding: 13px 16px; cursor: pointer; user-select: none; list-style: none; }
.week-summary::-webkit-details-marker { display: none; }
.week-summary:hover { background: rgba(139,92,246,.05); }
.week-caret { color: var(--muted-2); font-size: 11px; transition: transform .16s; }
.week-group:not([open]) .week-caret { transform: rotate(-90deg); }
.week-label { font-weight: 700; font-size: 13.5px; letter-spacing: .01em; }
.week-recent { margin-left: 2px; }
.week-count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 8px; }
.week-group .instr-list { padding: 4px 14px 16px; }
.instr-date { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; margin-left: 2px; }

@media (max-width: 1000px) {
  .board { flex-direction: column; }
  .board > .column, .board > .column.is-empty { flex: 1 1 auto; min-width: 0; width: 100%; }
  .col-body { max-height: none; }
}

/* Content Inbox — read-only Drive files */
.inbox-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-head-actions { display: flex; align-items: center; gap: 8px; }
.inline-form { margin: 0; display: inline; }
.file-list li.is-new { background: linear-gradient(90deg, rgba(74,163,255,.10), transparent 70%); border-radius: 8px; }
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 8px var(--blue); flex: none; }
.file-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Pipeline reel chips (compact, scannable) ---------- */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.reel-chip { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 54px;
  padding: 9px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: .01em;
  transition: transform .12s, border-color .12s, background .12s; }
.reel-chip:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.reel-chip.ok { color: var(--green); border-color: var(--green-bd); background: var(--green-bg); }
.reel-chip.ok:hover { border-color: var(--green); }
.reel-chip.warn { color: var(--amber); border-color: var(--amber-bd); background: var(--amber-bg); }
.reel-chip.warn:hover { border-color: var(--amber); }
.chip-flag { font-size: 10px; opacity: .8; }
.chip-group { margin-bottom: 16px; }
.chip-group:last-child { margin-bottom: 0; }
.chip-group-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--text-2); margin: 0 2px 9px; }
.chip-group-count { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }

/* ============================================================================
   Mobile — native iOS app feel (≤768px). Media queries only; desktop untouched.
   ========================================================================== */
@media (max-width: 768px) {
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  a, button, .switch, .nav-link, .reel-chip { -webkit-tap-highlight-color: rgba(124,58,237,.18); }

  .layout { display: block; }

  /* sidebar -> fixed bottom tab bar, above the home indicator */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto;
    flex-direction: row; align-items: center; gap: 0; z-index: 60;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12,12,29,.93); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
    border-top: 1px solid var(--border); border-right: none; box-shadow: 0 -6px 24px rgba(0,0,0,.45);
  }
  .brand, .sidebar-foot, .nav-sep { display: none; }
  .nav { flex-direction: row; flex-wrap: nowrap; width: 100%; gap: 2px; margin: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; flex-direction: column; gap: 3px; min-width: 64px; min-height: 50px;
    padding: 6px 10px; border-radius: 12px; font-size: 10px; font-weight: 650; text-align: center; justify-content: center; }
  .nav-link .ic { font-size: 19px; opacity: .92; }
  .nav-txt { font-size: 10px; line-height: 1.05; white-space: nowrap; }
  .nav-link.active { background: rgba(124,58,237,.20); color: #fff; }
  .nav-link.active::before { display: none; }
  .soon { display: none; }

  /* sticky header; content fills width and clears the bottom bar */
  .topbar { position: sticky; top: 0; padding: 12px 14px; }
  .page-title { font-size: 17px; }
  .content { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); max-width: none; }

  /* single-column stacks */
  .board { flex-direction: column; gap: 14px; }
  .board > .column, .board > .column.is-empty { flex: 1 1 auto; min-width: 0; width: 100%; }
  .col-body { max-height: none; }
  .avail-grid, .inbox-grid, .detail-grid, .settings-form { grid-template-columns: 1fr; }

  /* comfortable tap targets; 16px inputs so iOS doesn't auto-zoom on focus */
  .btn { min-height: 44px; }
  .btn.xs { min-height: 44px; padding: 10px 14px; }
  .switch { min-height: 44px; }
  .reel-chip { min-height: 44px; padding: 11px 16px; }
  .hist-creator { padding: 10px 15px; }
  input, select, textarea { font-size: 16px; }
}

/* ============================================================================
   Example video + admin edit/override/delete + mark-handled undo
   ========================================================================== */
.example-video { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.example-player { width: 100%; max-width: 440px; border-radius: 14px; background: #000; border: 1px solid var(--border-2); }
.example-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.preview-box .btn { margin-left: auto; }
.instr-full-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.instr-link a { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }

/* admin edit/override controls (items 1 & 2) */
.instr-edit-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.instr-edit-text { width: 100%; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
.instr-edit-actions { display: flex; gap: 8px; }
.admin-reel-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.bundle-edit summary { cursor: pointer; display: inline-flex; color: var(--text-2); font-weight: 650; font-size: 12.5px; }
.bundle-edit[open] summary { margin-bottom: 10px; }
.bundle-edit-form { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.bundle-edit-form label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bundle-edit-form textarea, .bundle-edit-form input { font-family: inherit; font-size: 13px; resize: vertical; }
.btn.danger { background: var(--red-bg); border-color: var(--red-bd); color: #ffb0b7; }
.btn.danger:hover { background: rgba(245,106,120,.2); }

/* mark-handled undo (item 4) — dimmed in place, not removed */
.file-list li.handled-dim { opacity: .5; }
.handled-tag { color: var(--green); font-weight: 700; font-size: 12.5px; margin-right: 4px; }

/* ============================================================================
   Distribution matrix (redesigned, aligned) + on/off toggles
   ========================================================================== */
.dist-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; padding: 14px 18px; }
.dist-status-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dist-status-spacer { flex: 1; }
.dist-off-note { color: var(--amber); }
.dist-teams { display: flex; flex-direction: column; gap: 16px; }
.dist-team-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.dist-team-title { display: flex; align-items: center; gap: 10px; }
.dist-team-title h2 { font-size: 16px; }
.dist-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dist-table-wrap { overflow-x: auto; }
.dist-matrix { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dist-col-worker { width: 22%; min-width: 150px; }
.dist-col-slot { width: 30%; }
.dist-col-short { width: 90px; }
.dist-matrix th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2);
  font-weight: 700; padding: 7px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dist-matrix td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dist-matrix tbody tr:last-child td { border-bottom: none; }
.dist-matrix tbody tr:hover td { background: rgba(139,92,246,.05); }
.dist-wname { font-weight: 680; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-cell { font-variant-numeric: tabular-nums; }
.dist-cell.filled { color: var(--text-2); }
.dist-cell.empty { color: var(--muted-2); }
.dist-cell.recycled { color: var(--blue); }
.dist-rec { color: var(--blue); font-weight: 800; }
.dist-short { text-align: right; white-space: nowrap; }
.dist-empty-cell { color: var(--muted-2); text-align: center; padding: 18px; }
.dist-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dist-note { color: var(--amber); }

.dist-toggles-panel { margin-bottom: 20px; }
.dist-toggles { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.dist-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 4px; border-top: 1px solid var(--border); }
.dist-toggle-row:first-child { border-top: none; }
.dist-toggle-row.is-master { border-bottom: 1px solid var(--border-2); margin-bottom: 6px; padding-bottom: 14px; }
.dist-toggle-row.is-master .dist-toggle-name { font-weight: 760; font-size: 15px; }
.dist-toggle-name { font-weight: 650; color: var(--text); }

/* topic attachment (admin) */
.topic-group { margin-bottom: 16px; }
.topic-workers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.topic-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.topic-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); font-weight: 700; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.topic-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.topic-table tbody tr:last-child td { border-bottom: none; }
.topic-attach-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================================
   Corvus Command — owner hub additions (tiles, stats, dual-2FA gates).
   Built on the shared raven-iridescence tokens above.
   ========================================================================== */
.role-owner { background: var(--violet-bg); color: var(--violet); border: 1px solid var(--violet-bd); }

/* dashboard tile grid */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.tile { display: flex; flex-direction: column; gap: 16px; }
.tile .panel-head { margin-bottom: 0; }
.badge.live { letter-spacing: .02em; }
.tile-error { display: flex; flex-direction: column; gap: 4px; color: var(--amber); font-size: 13px;
  background: var(--amber-bg); border: 1px solid var(--amber-bd); border-radius: 11px; padding: 12px 14px; }
.tile-error .muted { color: var(--muted-2); font-family: var(--mono); word-break: break-word; }

/* stat blocks */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; }
.stat-num { font-size: 26px; font-weight: 760; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat-num.warn-num { color: var(--amber); }
.stat-label { margin-top: 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-sub { margin-top: 5px; font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* mini lists (top creators/workers, pool per creator) */
.tile-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mini { display: flex; flex-direction: column; }
.mini-head { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 2px; border-top: 1px solid var(--border); }
.mini-row:first-of-type { border-top: none; }
.mini-name { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-val { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.mini-empty { color: var(--muted-2); font-size: 12px; padding: 8px 2px; }

/* studio master switch readout */
.dist-master { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--border); }
.dist-master .dm-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); flex: none; }
.dist-master.on  .dm-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dist-master.off .dm-dot { background: var(--red);   box-shadow: 0 0 10px var(--red); }
.dm-label { font-weight: 650; color: var(--text-2); }
.dm-state { font-weight: 800; letter-spacing: .06em; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.dist-master.on  .dm-state { color: var(--green); background: var(--green-bg); border: 1px solid var(--green-bd); }
.dist-master.off .dm-state { color: #ffb0b7; background: var(--red-bg); border: 1px solid var(--red-bd); }
.dm-window { margin-left: auto; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-top: 4px; }

/* TOTP enrollment / gate */
.totp-intro { display: flex; flex-direction: column; gap: 4px; }
.totp-intro strong { font-size: 15px; }
.totp-intro .hint { margin-top: 0; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; margin: 4px auto;
  width: fit-content; box-shadow: var(--shadow); }
.qr-box img { display: block; border-radius: 4px; }
.totp-secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 2px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.totp-secret code { font-family: var(--mono); font-size: 12.5px; color: var(--iris-3); letter-spacing: .04em; word-break: break-all; }

/* finance gate centering */
.gate-wrap { display: grid; place-items: start center; padding-top: 6px; }
.gate-card { width: 420px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.gate-card .auth-form { gap: 13px; }

/* mobile: ≥44px taps, ≥16px inputs (inherits the shared @768 block; reinforce tile bits) */
@media (max-width: 768px) {
  .tiles { grid-template-columns: 1fr; }
  .tile-cols { grid-template-columns: 1fr; }
  .gate-card { width: 100%; }
  .dm-window { margin-left: 0; width: 100%; }
}

/* ============================================================================
   Corvus Command — Finance sector (Phase 2).
   ========================================================================== */
.fin-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.fin-tabs a { padding: 8px 14px; border-radius: 10px; font-weight: 650; font-size: 13.5px; color: var(--muted);
  border: 1px solid transparent; }
.fin-tabs a:hover { color: var(--text); background: var(--surface); }
.fin-tabs a.on { color: #fff; background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(139,92,246,.04));
  border-color: var(--border-2); }
.fin-tabs-spacer { flex: 1; }
.fin-tabs .fin-lock { color: var(--iris-3); }

.fin-link { text-decoration: none; transition: border-color .14s, transform .14s; }
.fin-link:hover { border-color: var(--accent-2); transform: translateY(-2px); }

.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* forms */
.stacked-form { display: flex; flex-direction: column; gap: 13px; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid > label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form-grid .span2 { grid-column: span 2; }
.form-grid .form-actions { grid-column: span 2; }
.field-hint { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted-2); }
.checks { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.chk, .inline-check { flex-direction: row !important; align-items: center; gap: 8px; text-transform: none;
  letter-spacing: 0; font-weight: 600; color: var(--text-2); font-size: 13px; }
.chk input, .inline-check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* tables */
.fin-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.fin-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.fin-table tbody tr:last-child td { border-bottom: none; }
.fin-table tbody tr:hover td { background: rgba(139,92,246,.05); }
.fin-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table .wallet { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* team list edit rows */
.fin-list { display: flex; flex-direction: column; }
.fin-row { border-top: 1px solid var(--border); padding: 4px 0; }
.fin-row:first-child { border-top: none; }
.fin-row > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 2px; }
.fin-row > summary::-webkit-details-marker { display: none; }
.fin-row-name { font-weight: 700; color: var(--text); }
.fin-edit-hint { margin-left: auto; color: var(--muted-2); font-size: 12px; }
.fin-row[open] .fin-edit-hint { color: var(--iris-1); }
.edit-form { padding: 6px 2px 14px; }

/* payout breakdown */
.payout-breakdown { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.pb-title { font-weight: 700; margin-bottom: 10px; color: var(--text); }
.pb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pb-table td { padding: 9px 4px; border-bottom: 1px solid var(--border); }
.pb-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.pb-table td.neg { color: var(--muted); }
.pb-table tr.sub td { color: var(--muted); }
.pb-table tr.total td { border-top: 1px solid var(--border-2); font-weight: 800; color: var(--text); }
.pb-table tr.total td.num { font-size: 16px; }
.pb-table tr.agency td { color: var(--iris-1); font-weight: 800; }
.pb-table tr.agency td.num { color: var(--iris-1); }

.tappable { cursor: pointer; font: inherit; }
button.tappable.badge { line-height: 1.2; }

@media (max-width: 768px) {
  .fin-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-grid .form-actions { grid-column: span 1; }
  .fin-tabs a { min-height: 40px; display: inline-flex; align-items: center; }
}

/* ---------- Finance Step 2: ledger / invoices / payroll / P&L ---------- */
.mode-toggle { display: inline-flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 4px; margin-bottom: 18px; }
.mode-toggle a { padding: 8px 18px; border-radius: 8px; font-weight: 650; font-size: 13.5px; color: var(--muted); }
.mode-toggle a:hover { color: var(--text); }
.mode-toggle a.on { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-2); }

.cat-add { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.cat-add > summary { cursor: pointer; color: var(--iris-3); font-weight: 650; font-size: 13px; list-style: none; }
.cat-add > summary::-webkit-details-marker { display: none; }

.period-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.period-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.pnl-profit { background: linear-gradient(135deg, rgba(52,210,123,.12), var(--bg-2)); border-color: var(--green-bd); }
.pnl-profit.is-loss { background: linear-gradient(135deg, rgba(245,106,120,.12), var(--bg-2)); border-color: var(--red-bd); }
.pnl-profit-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.pnl-profit-label { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.pnl-profit-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--green); }
.pnl-profit.is-loss .pnl-profit-val { color: #ffb0b7; }
