/* ============================================================
   Mythri Movie Makers — Wave 1  ·  Design system
   Premium, cinematic executive-intelligence UI.
   Dark by default; light theme via [data-theme="light"].
   ============================================================ */

:root {
  /* Mythri Movie Makers — logo palette: red · orange · blue on white */
  --brand: #ED1C24;
  --brand-2: #F7941D;
  --brand-3: #27AAE1;
  --grad-brand: linear-gradient(120deg, #ED1C24 0%, #F7941D 100%);
  --grad-tri: linear-gradient(120deg, #ED1C24 0%, #F7941D 55%, #27AAE1 100%);
  --gold: #F7941D;
  --teal: #27AAE1;
  --cyan: #27AAE1;
  --green: #16a34a;
  --amber: #F7941D;
  --red: #E4322B;
  --pink: #F7941D;
  --orange: #F7941D;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 246px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 20px rgba(0,0,0,.28);
  --shadow-2: 0 12px 48px rgba(0,0,0,.5);
  --ease: cubic-bezier(.22,.61,.36,1);
  --mono: "SF Mono", ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #090b11;
  --bg-2: #0c0f16;
  --surface: #12161f;
  --surface-2: #171d28;
  --surface-3: #1e2634;
  --surface-hi: #232c3c;
  --border: #232c3a;
  --border-2: #2c3646;
  --text: #eef1f8;
  --text-2: #9aa6bd;
  --text-3: #667088;
  --glow: rgba(237,28,36,.18);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-2: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f7;
  --surface-hi: #e9edf5;
  --border: #e2e6ef;
  --border-2: #d3d9e6;
  --text: #131722;
  --text-2: #55607a;
  --text-3: #8a93a8;
  --glow: rgba(237,28,36,.12);
  --shadow-1: 0 1px 2px rgba(20,30,60,.06), 0 6px 24px rgba(20,30,60,.08);
  --shadow-2: 0 18px 50px rgba(20,30,60,.16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  overflow: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--glow), transparent 60%),
    var(--bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 20px 14px;
  gap: 8px;
  min-height: 0;
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 4px 6px 16px; cursor: pointer;
  user-select: none;
}
.brand-logo { width: 100%; max-width: 196px; height: auto; display: block; }
.brand-mark { filter: drop-shadow(0 4px 12px var(--glow)); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; font-size: 14.5px; letter-spacing: .08em; }
.brand-sub { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--text-2); font-size: 13.5px; font-weight: 550;
  border: 1px solid transparent; background: none; text-align: left; width: 100%;
  transition: all .16s var(--ease);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
  box-shadow: var(--shadow-1);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px; background: var(--grad-brand);
}
.nav-item.active svg { opacity: 1; color: var(--brand-2); }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 20px; background: var(--surface-3); color: var(--text-2);
}
.nav-badge.alert { background: rgba(248,113,113,.16); color: var(--red); }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.principle-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(124,92,255,.10), rgba(236,72,153,.06));
  border: 1px solid var(--border-2);
}
.principle-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 5px; box-shadow: 0 0 0 4px rgba(52,211,153,.14); flex-shrink: 0; }
.principle-title { font-size: 12px; font-weight: 700; }
.principle-sub { font-size: 10.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }

.role-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; position: relative;
  transition: border-color .16s;
}
.role-switch:hover { border-color: var(--border-2); }
.role-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: white;
  background: var(--grad-brand);
}
.role-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.role-name { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-title { font-size: 10.5px; color: var(--text-3); }
.role-switch .chev { margin-left: auto; color: var(--text-3); }
.role-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 6px; z-index: 40; display: none;
}
.role-menu.open { display: block; animation: pop .16s var(--ease); }
.role-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; }
.role-opt:hover { background: var(--surface-3); }
.role-opt .ra { width: 26px; height: 26px; font-size: 11px; border-radius: 8px; }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 30px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title h1 { font-size: 21px; }
.topbar-title p { font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.ask-launch {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px 8px 14px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  font-size: 13px; font-weight: 550; transition: all .16s var(--ease);
}
.ask-launch:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.ask-launch svg { color: var(--brand-2); }
.ask-launch kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text-2);
}
.freshness {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2);
  padding: 7px 12px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(52,211,153,.5); animation: pulse 2.4s infinite; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: all .16s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }

/* ---------- View ---------- */
.view { flex: 1; overflow-y: auto; padding: 26px 30px 60px; min-height: 0; }
.view-in { animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.5);} 70%{ box-shadow: 0 0 0 7px rgba(52,211,153,0);} 100%{box-shadow:0 0 0 0 rgba(52,211,153,0);} }

/* ---------- Generic cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-1);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-head h3 { font-size: 14.5px; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.section-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 650; margin: 4px 0 14px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-1); transition: transform .18s var(--ease), border-color .18s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-2); }
.kpi::after {
  content:""; position:absolute; inset:0 0 auto auto; width:120px; height:120px;
  background: radial-gradient(circle at 100% 0, var(--kpi-glow, var(--glow)), transparent 70%);
  pointer-events:none;
}
.kpi-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; font-weight: 550; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; display:grid; place-items:center; color: white; flex-shrink:0; }
.kpi-top { display:flex; align-items:center; justify-content: space-between; }
.kpi-value { font-size: 27px; font-weight: 720; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--text-2); }
.kpi-foot { font-size: 11.5px; color: var(--text-3); margin-top: 8px; display:flex; align-items:center; gap:6px; }
.kpi.clickable { cursor: pointer; }

/* progress bars */
.bar { height: 7px; border-radius: 20px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > span { position:absolute; left:0; top:0; bottom:0; border-radius: 20px; background: var(--grad-brand); }
.bar.thin { height: 5px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 20px; white-space: nowrap; letter-spacing:.01em; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: rgba(52,211,153,.13); }
.badge.amber { color: var(--amber); background: rgba(251,191,36,.14); }
.badge.red   { color: var(--red);   background: rgba(248,113,113,.14); }
.badge.violet{ color: var(--brand-2); background: rgba(124,92,255,.15); }
.badge.cyan  { color: var(--cyan);  background: rgba(56,189,248,.14); }
.badge.gray  { color: var(--text-2); background: var(--surface-3); }
.badge.gold  { color: var(--gold);  background: rgba(245,182,74,.14); }
.badge.pink  { color: var(--pink);  background: rgba(251,113,133,.14); }

.stage-badge { font-size:11px; font-weight:600; padding:3px 8px; border-radius:7px; background: var(--surface-3); color: var(--text-2); }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tr:last-child td { border-bottom: none; }
td.right, th.right { text-align: right; font-variant-numeric: tabular-nums; }
.src-ref { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

/* drill affordance */
.drillable { cursor: pointer; border-bottom: 1px dashed transparent; transition: color .12s, border-color .12s; }
.drillable:hover { color: var(--brand-2); border-bottom-color: var(--brand); }
.drill-ico { opacity: .5; margin-left: 5px; }

/* pills / chips */
.chip { display:inline-flex; align-items:center; gap:7px; padding: 7px 13px; border-radius: 20px; font-size:12.5px; font-weight:550;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2); transition: all .15s; }
.chip:hover { border-color: var(--brand); color: var(--text); box-shadow: 0 0 0 3px var(--glow); }
.seg { display:inline-flex; background: var(--surface-2); border:1px solid var(--border); border-radius: 12px; padding: 3px; gap:2px; }
.seg button { padding: 6px 14px; border-radius: 9px; border: none; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.seg button.active { background: var(--surface-hi); color: var(--text); box-shadow: var(--shadow-1); }

/* ---------- Leadership hero ---------- */
.hero {
  display:flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding: 22px 24px; border-radius: var(--radius-lg); margin-bottom: 20px;
  background:
    radial-gradient(600px 200px at 90% 0%, rgba(124,92,255,.14), transparent 70%),
    linear-gradient(120deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2); box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.hero h2 { font-size: 23px; }
.hero .greet-sub { font-size: 13.5px; color: var(--text-2); margin-top: 6px; max-width: 620px; line-height: 1.55; }
.hero-overnight { display:flex; gap: 14px; flex-shrink:0; }
.overnight-stat { text-align:right; }
.overnight-stat .v { font-size: 19px; font-weight: 720; font-variant-numeric: tabular-nums; }
.overnight-stat .l { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing:.05em; }

/* attention list */
.att-item { display:flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.att-item:last-child { border-bottom: none; }
.att-ico { width: 32px; height: 32px; border-radius: 9px; display:grid; place-items:center; flex-shrink:0; }
.att-body { flex:1; min-width: 0; }
.att-title { font-size: 13px; font-weight: 600; }
.att-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.att-amt { font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Posters ---------- */
.poster {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background: var(--pc-accent, var(--surface-3));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.poster-gen { position: absolute; inset: 0; display: grid; place-items: center; }
.poster-gen::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(255,255,255,.20), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, transparent 45%, rgba(0,0,0,.55));
}
.poster-mono {
  position: relative; font-weight: 800; letter-spacing: -.03em;
  font-size: clamp(34px, 6.5vw, 58px); color: rgba(255,255,255,.94);
  text-shadow: 0 6px 30px rgba(0,0,0,.4);
}
.poster-gen-genre {
  position: absolute; bottom: 12px; left: 10px; right: 10px; text-align: center;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 650;
  color: rgba(255,255,255,.82);
}
.poster-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--pc-solid, var(--surface-3)); }
.poster.has-img .poster-gen { display: none; }
.poster.has-img::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, transparent 30%, transparent 60%, rgba(0,0,0,.5)); }
.poster-code {
  position: absolute; left: 10px; top: 10px; z-index: 2; font-family: var(--mono);
  font-size: 10px; letter-spacing: .08em; color: rgba(255,255,255,.92);
  background: rgba(0,0,0,.34); padding: 3px 8px; border-radius: 7px; backdrop-filter: blur(4px);
}
.poster-health { position: absolute; top: 10px; right: 10px; z-index: 2; }

/* ---------- Portfolio cards ---------- */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px,1fr)); gap: 18px; }
.pcard .poster { border-radius: 0; aspect-ratio: 3 / 4; }
.pcard-body { padding-top: 13px; }
.bva { margin: 13px 0 4px; }
.bva-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 650; color: var(--text-3); }
.bva-track { height: 8px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.bva-fill { height: 100%; border-radius: 20px; transition: width .4s var(--ease); }
.detail-poster-wrap { width: 156px; flex-shrink: 0; }
.detail-poster-wrap .poster { border-radius: 14px; }
.pcard {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.pcard:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow-2); }
.pcard-poster { height: 92px; position: relative; display:flex; align-items:flex-end; padding: 14px; }
.pcard-poster::before { content:""; position:absolute; inset:0; opacity:.9; background: var(--pc-accent); }
.pcard-poster::after { content:""; position:absolute; inset:0; background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.42)); }
.pcard-code { position: relative; font-family: var(--mono); font-size: 11px; letter-spacing:.1em; color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.28); padding: 3px 9px; border-radius: 7px; backdrop-filter: blur(4px); }
.pcard-health { position:absolute; top: 12px; right: 12px; }
.pcard-body { padding: 15px 16px 17px; }
.pcard-title { font-size: 16px; font-weight: 680; letter-spacing: -.01em; }
.pcard-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; display:flex; gap:8px; align-items:center; flex-wrap: wrap; }
.pcard-fin { margin-top: 15px; }
.pcard-fin-row { display:flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.pcard-fin-row .v { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Project detail ---------- */
.detail-hero {
  display:flex; gap: 22px; align-items: stretch; padding: 22px; border-radius: var(--radius-lg);
  border: 1px solid var(--border-2); box-shadow: var(--shadow-1); margin-bottom: 20px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
}
.detail-poster { width: 120px; border-radius: 14px; position: relative; overflow: hidden; flex-shrink:0; display:flex; align-items:flex-end; padding: 12px; min-height: 150px; }
.detail-poster::before { content:""; position:absolute; inset:0; background: var(--pc-accent); }
.detail-poster::after { content:""; position:absolute; inset:0; background: linear-gradient(180deg, transparent, rgba(0,0,0,.4)); }
.detail-poster .dp-code { position:relative; font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.9); letter-spacing:.08em; }
.detail-info { flex:1; min-width: 0; }
.detail-info h2 { font-size: 27px; letter-spacing: -.02em; }
.detail-tags { display:flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.detail-facts { display:flex; gap: 26px; flex-wrap: wrap; margin-top: 14px; }
.fact .l { font-size: 11px; text-transform: uppercase; letter-spacing:.05em; color: var(--text-3); }
.fact .v { font-size: 13.5px; font-weight: 600; margin-top: 3px; }
.back-link { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; color: var(--text-2); margin-bottom: 14px; background:none; border:none; }
.back-link:hover { color: var(--text); }

/* department bars */
.deptbar { display:grid; grid-template-columns: 160px 1fr 130px; gap: 14px; align-items:center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.deptbar:last-child { border-bottom: none; }
.deptbar .dl { font-size: 12.5px; font-weight: 550; }
.deptbar .track { height: 20px; background: var(--surface-3); border-radius: 7px; position: relative; overflow: hidden; }
.deptbar .fill { position:absolute; left:0; top:0; bottom:0; border-radius: 7px; }
.deptbar .budget-tick { position:absolute; top:-2px; bottom:-2px; width:2px; background: var(--text); opacity:.5; }
.deptbar .dv { font-size: 12px; text-align:right; font-variant-numeric: tabular-nums; }
.deptbar .dv .pct { color: var(--text-3); font-size: 11px; }

/* obligations timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:""; position:absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border-2); }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot { position:absolute; left: -26px; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--bg); }
.tl-when { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.tl-title { font-size: 13px; font-weight: 600; margin: 3px 0; }
.tl-meta { font-size: 11.5px; color: var(--text-3); display:flex; gap: 10px; flex-wrap: wrap; align-items:center; }

/* ---------- Ask Mythri ---------- */
.ask-modal {
  position: fixed; left: 50%; top: 76px; transform: translateX(-50%) translateY(-12px);
  width: min(760px, 92vw); max-height: 80vh; z-index: 80; opacity: 0; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); overflow: hidden; display:flex; flex-direction: column;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.ask-modal.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.modal-scrim, .drawer-scrim {
  position: fixed; inset: 0; background: rgba(4,6,12,.55); backdrop-filter: blur(3px);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-scrim.open, .drawer-scrim.open { opacity: 1; pointer-events: auto; }
.ask-input-wrap { display:flex; align-items:center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.ask-input-wrap svg { color: var(--brand-2); flex-shrink:0; }
.ask-input { flex:1; background: none; border: none; outline: none; color: var(--text); font-size: 16px; font-family: inherit; }
.ask-input::placeholder { color: var(--text-3); }
.ask-scroll { overflow-y: auto; padding: 16px 20px 20px; }
.ask-suggests { display:flex; flex-wrap: wrap; gap: 8px; }
.ask-hint { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing:.08em; font-weight:650; margin-bottom: 10px; }
.answer { animation: fade .25s var(--ease); }
.answer-head { display:flex; gap: 12px; align-items:flex-start; margin-bottom: 6px; }
.answer-badge { width: 34px; height: 34px; border-radius: 10px; background: var(--grad-brand); display:grid; place-items:center; flex-shrink:0; color:white; }
.answer h3 { font-size: 17px; }
.answer .narrative { font-size: 13.5px; color: var(--text-2); line-height: 1.6; margin: 8px 0 16px; }
.answer-foot { font-size: 11px; color: var(--text-3); margin-top: 14px; display:flex; gap: 7px; align-items:center; border-top: 1px dashed var(--border); padding-top: 12px; }
.kv { display:grid; grid-template-columns: 1fr auto; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.kv > div { background: var(--surface-2); padding: 11px 14px; font-size: 13px; }
.kv .k { color: var(--text-2); }
.kv .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Drawer (drill to source) ---------- */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(560px, 94vw); z-index: 70;
  background: var(--surface); border-left: 1px solid var(--border-2); box-shadow: var(--shadow-2);
  transform: translateX(100%); transition: transform .28s var(--ease); display:flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display:flex; align-items:flex-start; justify-content: space-between; gap: 14px; }
.drawer-head h3 { font-size: 16px; }
.drawer-head .sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.drawer-body { overflow-y: auto; padding: 6px 22px 30px; flex:1; }
.drawer-tag { display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:600; color: var(--green); background: rgba(52,211,153,.12); padding: 4px 10px; border-radius: 20px; margin-top: 10px; }
.txn-row { display:flex; align-items:center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.txn-ico { width: 34px; height: 34px; border-radius: 9px; display:grid; place-items:center; flex-shrink:0; font-size: 11px; font-weight: 700; }
.txn-main { flex:1; min-width: 0; }
.txn-desc { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; display:flex; gap:8px; align-items:center; }
.txn-amt { font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.txn-amt.in { color: var(--green); }

/* connectors */
.conn-card { display:flex; align-items:center; gap: 14px; padding: 16px; border:1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.conn-ico { width: 42px; height: 42px; border-radius: 11px; display:grid; place-items:center; color:white; flex-shrink:0; }
.conn-main { flex:1; min-width:0; }
.conn-name { font-size: 14px; font-weight: 620; }
.conn-note { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.conn-meta { text-align:right; font-size: 11.5px; color: var(--text-2); }

/* empty / loader */
.loader { display:grid; place-items:center; padding: 80px; color: var(--text-3); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align:center; padding: 50px 20px; color: var(--text-3); font-size: 13px; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-hi); border: 1px solid var(--border-2); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 13px;
  z-index: 100; opacity: 0; pointer-events: none; transition: all .25s var(--ease); display:flex; align-items:center; gap:10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* misc layout helpers */
.row { display:flex; gap: 18px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { align-items:center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.mt8{margin-top:8px}.mt16{margin-top:16px}.mt24{margin-top:24px}
.flex1 { flex: 1; min-width: 0; }
.two-col { display:grid; grid-template-columns: 1.5fr 1fr; gap: 18px; }
.text-r { text-align: right; }

/* date filter */
.datefilter { position: relative; }
#dateBtn { gap: 7px; }
#dateBtn.active-range { border-color: var(--brand); color: var(--text); box-shadow: 0 0 0 3px var(--glow); }
.date-menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 250px; z-index: 45;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 14px;
  box-shadow: var(--shadow-2); padding: 10px; display: none;
}
.date-menu.open { display: block; animation: pop .16s var(--ease); }
.date-opt { display: block; width: 100%; text-align: left; padding: 8px 11px; border-radius: 9px; border: none; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.date-opt:hover { background: var(--surface-3); color: var(--text); }
.date-custom { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; display: grid; gap: 8px; }
.date-custom label { font-size: 11px; color: var(--text-3); display: flex; flex-direction: column; gap: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* form controls */
.ek-select, .ek-in {
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 9px;
  color: var(--text); font-family: inherit; font-size: 13px; padding: 8px 11px; outline: none;
}
.ek-select { min-width: 200px; font-weight: 600; cursor: pointer; }
.ek-in:focus, .ek-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.date-custom input[type=date] { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); padding: 7px 9px; font-family: inherit; font-size: 12.5px; }
.num-in { width: 100px; text-align: right; }
input.cat { width: 100%; min-width: 130px; }
tfoot td { padding: 12px 14px; border-top: 2px solid var(--border-2); }

/* audit form */
.audit-form { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; }
.audit-form label { font-size: 11px; color: var(--text-3); display: flex; flex-direction: column; gap: 5px; text-transform: uppercase; letter-spacing: .04em; }
.audit-form label.wide { grid-column: span 3; }
.audit-form button { height: 38px; }
.audit-day { margin-bottom: 18px; }
.audit-day:last-child { margin-bottom: 0; }
.audit-day-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; margin-bottom: 4px; }
.audit-date { font-size: 12.5px; font-weight: 700; }
@media (max-width: 900px) { .audit-form { grid-template-columns: repeat(2, 1fr); } .audit-form label.wide { grid-column: span 2; } }

/* budget original tick (faint) vs revised/effective (bold) */
.deptbar .budget-tick.orig { background: var(--text-3); opacity: .6; width: 2px; }

/* Chart of Accounts editor */
.coa-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.coa-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.coa-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.coa-gname { font-weight: 650; font-size: 14px; flex: 1; }
.coa-gname-ro { font-weight: 650; font-size: 14px; flex: 1; }
.coa-heads { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.coa-head { display: grid; grid-template-columns: 1.1fr 1.4fr auto; gap: 8px; align-items: center; }
.coa-head .coa-map { font-size: 11.5px; color: var(--text-2); }
.coa-head-ro { font-size: 13px; }
.bud-total td, .grp-row td { font-weight: 700; }
.grp-row { background: var(--surface-2); }
.grp-row td { border-top: 1px solid var(--border-2); }

/* craft-wise field audit */
.craft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.craft-tile {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-1); cursor: pointer; transition: transform .16s var(--ease), border-color .16s;
}
.craft-tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.craft-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--grad-brand); }
.craft-ico svg { width: 20px; height: 20px; }
.craft-name { font-weight: 640; font-size: 14px; line-height: 1.2; }
.craft-meta { font-size: 11.5px; color: var(--text-3); }
.craft-status { margin-top: 4px; }

.fa-summary { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 22px; align-content: center; flex-shrink: 0; }
.fa-summary > div { display: flex; flex-direction: column; text-align: right; }
.fa-summary .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.fa-summary .v { font-size: 17px; font-weight: 720; font-variant-numeric: tabular-nums; }

.fa-head-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fa-head-grid label, .fa-obs label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.fa-obs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fa-obs label.wide { grid-column: span 2; }
.fa-obs textarea { resize: vertical; font-family: inherit; }

table.fa-tbl th { font-size: 10px; }
table.fa-tbl td { padding: 5px 6px; }
.fa-in {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; color: var(--text);
  font-family: inherit; font-size: 12.5px; padding: 6px 8px; outline: none; width: 100%; min-width: 70px;
}
.fa-in:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--glow); background: var(--surface); }
.fa-in.tr { text-align: right; }
.fa-in.w60 { width: 62px; min-width: 62px; } .fa-in.w70 { width: 72px; min-width: 72px; }
.fa-in.w80 { width: 84px; min-width: 84px; } .fa-in.w90 { width: 92px; min-width: 90px; }
.fa-in.w110 { width: 110px; min-width: 108px; } .fa-in.w140 { width: 150px; min-width: 120px; }
.fa-yn { width: 56px; min-width: 52px; padding: 6px 4px; }
.fa-tbl .var { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); }
.fa-tbl .var.neg { color: var(--red); }
.fa-tbl .amt { font-weight: 600; }
.icon-btn.del { background: none; border: none; color: var(--text-3); }
.icon-btn.del:hover { color: var(--red); }

.checkpoints { display: flex; flex-direction: column; gap: 4px; }
.cp { display: flex; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--border); border-radius: 8px; transition: background .15s; }
.cp:last-child { border-bottom: none; }
.cp.cp-no { background: rgba(248, 113, 113, .06); }
.cp-no-badge { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.cp-main { flex: 1; min-width: 0; }
.cp-text { font-size: 13px; line-height: 1.45; margin-bottom: 9px; }
.cp-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cp-seg button { padding: 5px 13px; }
.cp-seg button.active[data-val="Yes"] { background: rgba(52, 211, 153, .18); color: var(--green); }
.cp-seg button.active[data-val="No"] { background: rgba(248, 113, 113, .2); color: var(--red); }
.cp-seg button.active[data-val="NA"] { background: var(--surface-hi); color: var(--text-2); }
.cp-doc { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.cp-impact { border-color: var(--red) !important; }

/* RBAC toggles + financial mask */
.tog { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.tog input { opacity: 0; width: 0; height: 0; position: absolute; }
.tog span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 20px; transition: all .16s var(--ease); }
.tog span::before { content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-3); transition: all .16s var(--ease); }
.tog input:checked + span { background: linear-gradient(135deg, var(--brand), var(--brand-3)); border-color: transparent; }
.tog input:checked + span::before { transform: translateX(16px); background: #fff; }
.rbac-tbl td, .rbac-tbl th { padding: 10px 10px; }
.rbac-tbl tbody tr:hover { background: var(--surface-2); }

/* When the active role can't see financials, blur monetary figures. */
body.mask-fin .kpi-value,
body.mask-fin .overnight-stat .v,
body.mask-fin td.right,
body.mask-fin .att-amt,
body.mask-fin .pcard-fin-row .v,
body.mask-fin .txn-amt,
body.mask-fin .kv .v {
  filter: blur(7px); user-select: none; pointer-events: none;
}
body.mask-fin .kpi::after { opacity: .4; }

/* ============================================================
   Premium login screen (cinematic)
   ============================================================ */
.login-screen, .owner-screen {
  position: fixed; inset: 0; z-index: 200; overflow: auto;
  background: radial-gradient(1200px 800px at 20% -10%, #201a44 0%, transparent 55%),
              radial-gradient(1000px 700px at 90% 110%, #3a1236 0%, transparent 50%),
              linear-gradient(160deg, #07080e 0%, #0b0a18 55%, #0a0710 100%);
  color: #eef1f8;
}
.login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.login-bg .orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: orbFloat 18s ease-in-out infinite; }
.orb.o1 { width: 440px; height: 440px; left: -80px; top: 8%; background: radial-gradient(circle, #ED1C24, transparent 70%); }
.orb.o2 { width: 520px; height: 520px; right: -120px; top: 30%; background: radial-gradient(circle, #27AAE1, transparent 70%); animation-delay: -6s; }
.orb.o3 { width: 380px; height: 380px; left: 40%; bottom: -140px; background: radial-gradient(circle, #F7941D, transparent 70%); opacity: .35; animation-delay: -11s; }
@keyframes orbFloat { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,-30px) scale(1.08); } 66% { transform: translate(-30px,25px) scale(.95); } }

.filmstrip { position: absolute; left: 0; right: 0; top: 0; height: 30px; display: flex; gap: 10px; padding: 6px 0; opacity: .10;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.04), transparent); animation: stripMove 40s linear infinite; }
.filmstrip.bottom { top: auto; bottom: 0; animation-direction: reverse; }
.filmstrip i { width: 42px; height: 18px; border-radius: 3px; background: rgba(255,255,255,.14); flex-shrink: 0; }
@keyframes stripMove { from { transform: translateX(0); } to { transform: translateX(-104px); } }

.particles span { position: absolute; bottom: -10px; left: calc(var(--i) * 4.7%); width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,.5); box-shadow: 0 0 6px rgba(255,255,255,.5); opacity: 0;
  animation: rise 14s linear infinite; animation-delay: calc(var(--i) * -0.7s); }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: .7; } 90% { opacity: .6; } 100% { transform: translateY(-100vh); opacity: 0; } }

.login-wrap { position: relative; z-index: 2; min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 40px; padding: 40px min(8vw, 96px); animation: fadeUp .7s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.login-brand { max-width: 480px; }
.login-logo { display: inline-block; background: #fff; border-radius: 18px; padding: 20px 26px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45); animation: logoGlow 4s ease-in-out infinite; }
.login-logo img { display: block; width: 320px; max-width: 62vw; height: auto; }
@keyframes logoGlow { 0%,100% { filter: drop-shadow(0 8px 26px rgba(124,92,255,.45)); } 50% { filter: drop-shadow(0 10px 40px rgba(236,72,153,.55)); } }
.login-word { font-size: clamp(38px, 6vw, 62px); font-weight: 800; letter-spacing: .1em; margin: 18px 0 6px;
  background: linear-gradient(100deg, #fff 10%, #c9b8ff 45%, #F7941D 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-tag { font-size: 13px; letter-spacing: .28em; text-transform: uppercase; color: #b7a9e0; font-weight: 600; }
.login-blurb { font-size: 15px; line-height: 1.6; color: #aeb6cc; margin: 22px 0 24px; max-width: 400px; }
.login-crafts { display: flex; flex-wrap: wrap; gap: 8px; }
.login-crafts span { font-size: 12px; padding: 6px 13px; border-radius: 20px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04); color: #cdd4e6; backdrop-filter: blur(6px); }

.login-card { position: relative; max-width: 400px; width: 100%; justify-self: end; padding: 38px 34px 26px;
  border-radius: 22px; border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(160deg, rgba(28,26,48,.72), rgba(16,14,28,.82)); backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08); animation: fadeUp .8s var(--ease) .1s both; }
.login-card-glow { position: absolute; inset: -1px; border-radius: 22px; padding: 1px; pointer-events: none;
  background: linear-gradient(130deg, rgba(124,92,255,.6), transparent 40%, transparent 60%, rgba(245,182,74,.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .8; }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 30%,70% { transform: translateX(5px); } 50% { transform: translateX(-6px); } }
.login-card h2 { font-size: 24px; }
.login-sub { font-size: 13px; color: #98a1ba; margin: 6px 0 22px; }
.login-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.login-field span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8b93ac; font-weight: 600; }
.login-field input, .login-field select { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); border-radius: 11px;
  color: #fff; font-family: inherit; font-size: 14.5px; padding: 12px 14px; outline: none; transition: all .16s; }
.login-field input:focus { border-color: #ED1C24; box-shadow: 0 0 0 3px rgba(124,92,255,.22); background: rgba(255,255,255,.08); }
.login-err { min-height: 18px; color: #fb7185; font-size: 12.5px; margin: -4px 0 12px; }
.login-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px; border: none; border-radius: 12px;
  font-size: 14.5px; font-weight: 650; color: #fff; cursor: pointer; background: linear-gradient(120deg, #ED1C24, #F7941D 55%, #27AAE1);
  box-shadow: 0 10px 30px rgba(124,92,255,.45); transition: transform .15s, box-shadow .2s; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(236,72,153,.5); }
.login-btn:disabled { opacity: .7; cursor: default; }
.login-btn.loading span::after { content: "…"; }
.login-foot { text-align: center; font-size: 11px; color: #6b7288; margin-top: 20px; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; text-align: center; } .login-card { justify-self: center; } .login-brand { margin: 0 auto; } .login-crafts { justify-content: center; } }

/* Owner console */
.owner-top { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 30px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(10,8,18,.7); backdrop-filter: blur(12px); }
.owner-body { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 30px; }
.owner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.tenant-card { border: 1px solid var(--border-2); border-radius: 18px; padding: 18px;
  background: linear-gradient(160deg, rgba(28,26,48,.55), rgba(16,14,28,.7)); backdrop-filter: blur(10px); box-shadow: var(--shadow-1); }
.tenant-head { display: flex; align-items: center; gap: 12px; }
.tenant-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.tenant-name { font-weight: 650; font-size: 15px; }
.tenant-meta { font-size: 11.5px; color: var(--text-3); }
.tenant-head .badge { margin-left: auto; }
.tenant-users { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.tenant-user { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tenant-user .mono { font-family: var(--mono); color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.mini { padding: 3px 9px; font-size: 10.5px; }

.owner-modal-scrim { position: fixed; inset: 0; z-index: 210; background: rgba(4,6,12,.6); backdrop-filter: blur(4px); display: grid; place-items: center; animation: fade .2s; }
.owner-modal { width: min(440px, 92vw); padding: 28px; border-radius: 20px; border: 1px solid var(--border-2);
  background: linear-gradient(160deg, #1a1830, #12101f); box-shadow: var(--shadow-2); animation: pop .2s var(--ease); }
.owner-modal h3 { font-size: 18px; }
.cred-box { border: 1px dashed var(--border-2); border-radius: 12px; padding: 14px; background: rgba(124,92,255,.06); margin-top: 8px; }
.cred-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cred-row:last-child { border-bottom: none; }
.cred-row .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.cred-row .v { font-weight: 650; }
.cred-row .mono { font-family: var(--mono); font-size: 14px; color: var(--gold); }

@media (max-width: 1080px) { .two-col { grid-template-columns: 1fr; } }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.nav-toggle:hover { background: var(--surface-2); }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(8,10,18,.5); z-index: 45; opacity: 0;
  pointer-events: none; transition: opacity .2s; }
.sidebar-scrim.open { opacity: 1; pointer-events: auto; }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w); height: 100vh; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .nav-toggle { display: inline-flex; }
  .topbar { position: sticky; top: 0; z-index: 30; gap: 10px; }
  .topbar-title h1 { font-size: 18px; }
  .ask-launch kbd, .freshness #freshnessText { display: none; }
  .view { padding-left: 14px; padding-right: 14px; }
  .lead-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .lead-head-stats { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .topbar-actions .ask-launch span { display: none; }
  .alert-grid { grid-template-columns: 1fr; }
}

/* ---------- Leadership · Cash & Bank (treasury) ---------- */
.treasury .ts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
@media (max-width: 820px) { .treasury .ts-grid { grid-template-columns: 1fr; } }
.ts-stat { position: relative; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.ts-stat:hover { border-color: var(--border-2); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }
.ts-stat.cash { border-top: 3px solid #27AAE1; }
.ts-stat.pos  { border-top: 3px solid var(--green); }
.ts-stat.neg  { border-top: 3px solid var(--amber); }
.ts-top { display: flex; align-items: center; justify-content: space-between; }
.ts-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.ts-info { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--text-3);
  font-size: 10px; font-style: italic; display: grid; place-items: center; }
.ts-value { font-size: 23px; font-weight: 720; margin-top: 8px; font-variant-numeric: tabular-nums; }
.ts-stat.neg .ts-value { color: var(--red); }
.ts-foot { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.ts-pop { position: absolute; top: 100%; left: 0; min-width: 100%; width: max-content; max-width: 440px;
  padding-top: 8px; z-index: 40; opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s, transform .14s; }
.ts-stat.neg .ts-pop { left: auto; right: 0; }
.ts-stat:hover .ts-pop { opacity: 1; visibility: visible; transform: translateY(0); }
.ts-pop-inner { background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 16px 46px rgba(0, 0, 0, .45); max-height: 300px; overflow: auto; }
.ts-poptbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.ts-poptbl td { padding: 7px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ts-poptbl td:first-child { white-space: normal; max-width: 300px; }
.ts-poptbl td.r { text-align: right; font-variant-numeric: tabular-nums; padding-left: 20px; }
.ts-poptbl td.neg { color: var(--red); }
.ts-poptbl tr:last-child td { border-bottom: none; }

/* ---------- Leadership · header + slate health ---------- */
.lead-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.lead-eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.lead-title { font-size: 26px; font-weight: 720; margin: 6px 0 6px; letter-spacing: -.01em; }
.lead-sub { font-size: 12.5px; color: var(--text-2); }
.lead-head-stats { display: flex; gap: 26px; }
.lead-head-stats .lh-v { font-size: 19px; font-weight: 720; font-variant-numeric: tabular-nums; text-align: right; }
.lead-head-stats .lh-l { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 2px; }
@media (max-width: 700px) { .lead-head-stats { gap: 18px; } .lead-head-stats .lh-v { font-size: 16px; } }

.tbl.slate tbody tr.slate-row { cursor: pointer; transition: background .12s; }
.tbl.slate tbody tr.slate-row:hover { background: var(--surface-2); }
.tbl.slate .sdot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 9px; vertical-align: middle; }
.slate-bar { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.slate-bar .sb-cost { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #ED1C24, #F7941D); position: relative; min-width: 4px; }
.slate-bar .sb-rev { position: absolute; left: 0; top: 0; height: 100%; border-radius: 5px; background: var(--green); opacity: .85; }

/* "This week" alert strip on Leadership */
.week-strip { display: flex; align-items: center; gap: 14px; margin: 18px 0 4px; }
.week-lead { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); flex: none; }
.week-lead svg { width: 15px; height: 15px; }
.week-items { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; flex: 1; }
.week-chip { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 15px;
  font-size: 12.5px; color: var(--text); transition: border-color .12s, transform .12s, box-shadow .12s; }
.week-chip:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 0 0 3px var(--glow); }
.wc-title { font-weight: 640; }
.wc-detail { color: var(--text-2); font-size: 11.5px; }
.wc-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wc-dot.red { background: var(--red); } .wc-dot.amber { background: var(--amber); }
.wc-dot.cyan { background: var(--cyan); } .wc-dot.gray { background: var(--text-3); }
.week-clear { font-size: 12.5px; color: var(--text-2); padding: 8px 4px; }
@media (max-width: 640px) { .week-strip { flex-direction: column; align-items: flex-start; gap: 8px; } .wc-detail { display: none; } }

/* Phone-friendly slate-health cards (<=640px): stack each row as a labelled card */
@media (max-width: 640px) {
  .tbl.slate.health thead { display: none; }
  .tbl.slate.health, .tbl.slate.health tbody, .tbl.slate.health tr, .tbl.slate.health td { display: block; width: 100%; }
  .tbl.slate.health tbody tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px;
    padding: 4px 2px; background: var(--surface); }
  .tbl.slate.health td { display: flex; justify-content: space-between; align-items: center; gap: 14px;
    border: none; padding: 8px 14px; text-align: right; }
  .tbl.slate.health td::before { content: attr(data-label); color: var(--text-2); font-size: 10.5px;
    text-transform: uppercase; letter-spacing: .4px; font-weight: 600; text-align: left; }
  .tbl.slate.health td[data-label="Production"] { font-size: 15px; font-weight: 700; padding-top: 12px; }
  .tbl.slate.health td[data-label="Recovery"] .slate-bar { flex: 1; max-width: 55%; }
}

/* Slate Budget-vs-Actual cockpit (Budgets view) */
.tbl.slate tbody tr.slate-vrow { cursor: pointer; transition: background .12s; }
.tbl.slate tbody tr.slate-vrow:hover { background: var(--surface-2); }
.vrow-sub { font-size: 11.5px; color: var(--red); margin-top: 3px; opacity: .9; }
.vbar { position: relative; height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.vbar-fill { height: 100%; border-radius: 5px; min-width: 3px; transition: width .3s; }
.vbar-fill.green { background: linear-gradient(90deg, #34d399, #2dd4bf); }
.vbar-fill.amber { background: linear-gradient(90deg, #F7941D, #fb923c); }
.vbar-fill.red   { background: linear-gradient(90deg, #fb7185, #f87171); }
.vbar-fill.gray  { background: var(--surface-3); }
.vbar-fill.profit { background: linear-gradient(90deg, #34d399, #d4af37); }

/* Recoupment waterfall (viewWaterfall) */
.wf-bar { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.wf-seg { height: 100%; min-width: 1px; transition: width .3s; }
.wf-seg + .wf-seg { box-shadow: inset 1px 0 0 rgba(0,0,0,.18); }
.wf-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; }
.wf-key { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.wf-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.modal-back { position: fixed; inset: 0; background: rgba(8,10,18,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.cf-chart { width: 100%; }

/* Alerts feed */
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.alert-item { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: background .12s, transform .12s; }
.alert-item[data-goto]:hover { background: var(--surface-2); transform: translateY(-1px); }
.al-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.al-kind { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.al-go { margin-left: auto; font-size: 11.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 2px; }
.al-title { font-weight: 640; font-size: 13.5px; }
.al-detail { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* Program Sheets editor */
.pg-head { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.pg-head label { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-2); font-weight: 600; }
.pg-head label input, .pg-head label select { font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 820px) { .cards-2 { grid-template-columns: 1fr; } }
.vbar-tick { position: absolute; right: 0; top: -2px; width: 2px; height: 12px; background: var(--text-2); opacity: .55; border-radius: 2px; }
.vbar-lbl { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* Collections — licence deals (viewCollections) */
.deal-card .card-head h3 { display: flex; align-items: center; }
.deal-stat { min-width: 110px; }
.deal-stat .ds-v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.deal-stat .ds-l { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.ms-note { font-size: 11px; color: var(--text-3); margin-top: 3px; max-width: 480px; }
button.ms-status { cursor: pointer; border: none; }
button.ms-status:hover { filter: brightness(1.08); box-shadow: 0 0 0 3px var(--glow); }
.deal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin-bottom: 8px; }
.deal-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-2); font-weight: 600; }
.deal-grid label input, .deal-grid label select { font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; color: var(--text); }
.deal-grid input:focus, .deal-grid select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.ms-editor { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; }
.ms-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.ms-editor-head span:first-child { text-transform: uppercase; letter-spacing: .4px; }
.ms-editor-head button { margin-left: auto; }
.ms-input-row { display: grid; grid-template-columns: 1fr 80px 150px 34px; gap: 8px; margin-bottom: 7px; align-items: center; }
.ms-input-row input, .ms-input-row select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 9px; font-size: 12.5px; color: var(--text); }
.ms-input-row input:focus, .ms-input-row select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.dfms-del { padding: 6px 8px; }
@media (max-width: 720px) { .deal-grid { grid-template-columns: 1fr; } .ms-input-row { grid-template-columns: 1fr 60px; } .ms-input-row .dfms-status, .ms-input-row .dfms-del { grid-column: span 1; } }

/* Accounts payable (viewPayables) */
.tbl.slate tbody tr.ap-sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand); }
.ap-bucket { background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 9px; cursor: pointer;
  color: var(--text-2); font-size: 11.5px; display: inline-flex; align-items: center; gap: 6px; }
.ap-bucket:hover { border-color: var(--border); color: var(--text); }
.ap-bucket.active { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }
.ap-bucket b { color: var(--text); font-variant-numeric: tabular-nums; }
.ap-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ap-search { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px;
  font-size: 12.5px; color: var(--text); min-width: 210px; }
.ap-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow); }
.ap-note { font-size: 11.5px; color: var(--text-3); margin-top: 10px; }
@media (max-width: 640px) {
  .tbl.slate.health td[data-label="Vendor"] { font-size: 14.5px; font-weight: 700; padding-top: 12px; }
  .ap-tools { justify-content: flex-start; }
  .ap-search { min-width: 0; flex: 1; }
}
