/* VaultedInsight portal (business, referrer, admin, login, crew upload). Loads after site.css. */
body.app { background: var(--night); color: var(--night-ink); min-height: 100vh; display: flex; flex-direction: column; }
body.app a { color: var(--mint); }
body.app main { flex: 1; width: 100%; min-width: 0; }
.app-head { position: sticky; top: 0; z-index: 30; background: rgba(8, 13, 11, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--night-line); }
.app-head .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.app-head .brand { color: var(--night-ink); }
.app-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tabs a { padding: 8px 14px; border-radius: 999px; color: var(--night-muted) !important; text-decoration: none; font-size: .92rem; white-space: nowrap; }
.app-tabs a:hover { color: var(--night-ink) !important; background: rgba(255,255,255,.05); }
.app-tabs a[aria-current="page"] { color: var(--night) !important; background: var(--mint); font-weight: 550; }
.app-user { display: flex; align-items: center; gap: 12px; font-size: .86rem; color: var(--night-muted); white-space: nowrap; }
.app-user button { background: none; border: 1px solid var(--night-line-2); color: var(--night-ink); border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; }
.app-user button:hover { border-color: var(--mint); }
@media (max-width: 760px) {
  .app-head .wrap { height: auto; flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; padding-bottom: 10px; }
  .app-tabs { order: 3; flex-basis: 100%; }
  .app-user { margin-left: auto; }
  .app-user .who { display: none; }
}

.page { padding-top: 40px; padding-bottom: 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.05; }
.page-head p { color: var(--night-muted); margin-top: 8px; }
.eyebrow.m { color: var(--mint); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 20px 22px; border-radius: 18px; border: 1px solid var(--night-line); background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); }
.kpi span { display: block; font-size: .82rem; color: var(--night-muted); }
.kpi strong { display: block; margin-top: 10px; font: 500 1.75rem/1.05 var(--mono); letter-spacing: -.03em; color: var(--night-ink); }
.kpi small { display: block; margin-top: 8px; font-size: .8rem; color: var(--night-muted); }
.kpi.hi { border-color: rgba(111,227,176,.35); background: radial-gradient(120% 140% at 100% 0%, rgba(111,227,176,.14), transparent 60%), rgba(255,255,255,.02); }
.kpi.hi strong { color: var(--mint); }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .kpi strong { font-size: 1.4rem; } }

/* Panels and tables */
.panel-d { margin-top: 22px; padding: 24px; border-radius: 20px; border: 1px solid var(--night-line); background: rgba(255,255,255,.02); }
.panel-d h2, .panel-d .ph h2 { font-size: 1.1rem; letter-spacing: -.015em; font-weight: 600; }
.panel-d .ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-d .sub { color: var(--night-muted); font-size: .9rem; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr .7fr; gap: 22px; align-items: start; }
.grid-2 > * { min-width: 0; }
.grid-2 .panel-d { margin-top: 22px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

.tbl-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font: 500 .72rem/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--night-muted); padding: 10px 12px 10px 0; border-bottom: 1px solid var(--night-line); white-space: nowrap; }
.tbl td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--night-line); vertical-align: top; }
.tbl td.n, .tbl th.n { text-align: right; font-family: var(--mono); font-size: .85rem; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .fn { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .meta { display: block; color: var(--night-muted); font-size: .8rem; margin-top: 2px; }
.empty { padding: 28px 0 12px; color: var(--night-muted); text-align: center; font-size: .94rem; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: 500 .74rem/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pending { color: #f4c76b; background: rgba(244,199,107,.1); }
.badge.approved, .badge.paid, .badge.active, .badge.earned { color: var(--mint); background: rgba(111,227,176,.1); }
.badge.rejected { color: #ff8a80; background: rgba(255,138,128,.1); }
.badge.open, .badge.uploading, .badge.processing { color: #9cc3ff; background: rgba(156,195,255,.1); }
.badge.paused { color: var(--night-muted); background: rgba(255,255,255,.06); }

/* Bars (by task) */
.bars { display: grid; gap: 12px; }
.bars .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; }
.bars .row b { font-weight: 500; }
.bars .row span { font-family: var(--mono); font-size: .82rem; color: var(--night-muted); }
.bars .track { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--night-3); overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--mint); border-radius: 6px; }

/* Forms on dark */
.f { margin-top: 16px; }
.f label, .f .label { display: block; font-weight: 550; font-size: .9rem; margin-bottom: 7px; }
.f .opt { font-weight: 400; color: var(--night-muted); }
.f input[type=text], .f input[type=email], .f input[type=password], .f input[type=tel], .f input[type=number], .f input[type=date], .f input[type=month], .f select, .f textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--night-line-2); border-radius: 12px;
  background: var(--night-2); color: var(--night-ink); font: inherit; color-scheme: dark; }
.f textarea { min-height: 84px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 4px rgba(111,227,176,.14); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .f-row { grid-template-columns: 1fr; } }
.form-err { color: #ff8a80; font-size: .9rem; margin-top: 12px; min-height: 1.2em; }
.form-ok { color: var(--mint); font-size: .9rem; margin-top: 12px; }
.btn.danger { background: transparent; color: #ff8a80; border-color: rgba(255,138,128,.4); }
.btn.danger:hover { background: rgba(255,138,128,.1); border-color: #ff8a80; }
body.app .btn.ghost { color: var(--night-ink); border-color: var(--night-line-2); }
body.app .btn.ghost:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.35); }

/* Copy field */
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy input { flex: 1; min-width: 0; min-height: 46px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--night-line-2); background: var(--night-2); color: var(--night-ink); font: 500 .9rem/1 var(--mono); }

/* Centered card (login, crew upload) */
.center { max-width: 480px; margin: 0 auto; padding: 72px 20px 96px; }
.center .card-d { padding: 32px; border-radius: 22px; border: 1px solid var(--night-line); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015)); }
.center h1 { font-size: clamp(1.8rem, 6vw, 2.3rem); line-height: 1.05; }
.center .lead { color: var(--night-muted); margin-top: 10px; }

/* Uploader */
.drop { margin-top: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 34px 18px; border: 1.5px dashed var(--night-line-2); border-radius: 18px; background: rgba(111,227,176,.03); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--mint); background: rgba(111,227,176,.07); }
.drop svg { width: 34px; height: 34px; color: var(--mint); }
.drop b { font-size: 1rem; }
.drop span { font-size: .86rem; color: var(--night-muted); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.queue { display: grid; gap: 10px; margin-top: 16px; }
.qi { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--night-line); background: var(--night-2); }
.qi .top { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.qi .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qi .st { font: 500 .78rem/1.4 var(--mono); color: var(--night-muted); white-space: nowrap; }
.qi .st.ok { color: var(--mint); }
.qi .st.err { color: #ff8a80; }
.qi .pbar { height: 6px; border-radius: 6px; background: var(--night-3); margin-top: 10px; overflow: hidden; }
.qi .pbar i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .3s; }
.qi .acts { display: flex; gap: 12px; margin-top: 8px; font-size: .82rem; }
.qi .acts button { background: none; border: 0; padding: 0; color: var(--night-muted); text-decoration: underline; cursor: pointer; font: inherit; }
.tips { margin: 14px 0 0; padding-left: 1.1em; color: var(--night-muted); font-size: .88rem; display: grid; gap: 6px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 99; padding: 12px 18px; border-radius: 12px; background: var(--night-ink); color: var(--night); font-size: .92rem; font-weight: 550; box-shadow: 0 12px 40px rgba(0,0,0,.4); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.loading { padding: 80px 0; text-align: center; color: var(--night-muted); }
.todo-d { background: rgba(255,243,196,.12); outline: 1px dashed #c9a200; color: #f4d77a; border-radius: 4px; padding: 0 5px; }

/* Paper theme for the portal: same look as the public site.
   The rules above are written against the dark "night" colors, so the portal flips by redefining them here. */
body.app {
  --night: #f2efe8; --night-2: #fbfaf7; --night-3: #f6f3ed;
  --night-ink: #141414; --night-muted: #77736b;
  --night-line: #d8d3c8; --night-line-2: #c6c0b3;
  --mint: #0a7a52; --mint-2: #086343;
}
body.app .app-head { background: rgba(242, 239, 232, .88); border-bottom-color: var(--line); }
body.app .app-tabs a:hover { background: #e9e5dc; }
body.app .app-tabs a[aria-current="page"] { color: #fff !important; background: var(--ink); }
body.app .kpi, body.app .panel-d, body.app .center .card-d { background: var(--surface); box-shadow: var(--shadow); border-radius: 12px; }
body.app .kpi.hi { background: radial-gradient(120% 140% at 100% 0%, rgba(10,122,82,.08), transparent 60%), var(--surface); border-color: rgba(10,122,82,.35); }
body.app .badge.paused { background: #e9e5dc; }
body.app .btn.mint { background: var(--ink); border-color: var(--ink); color: #fff; }
body.app .btn.mint:hover { background: #000; border-color: #000; }
body.app .btn.ghost:hover { background: var(--surface); border-color: var(--ink-2); }
body.app .btn.danger { color: #b3261e; border-color: rgba(179,38,30,.35); }
body.app .btn.danger:hover { background: rgba(179,38,30,.06); border-color: #b3261e; }
body.app input, body.app select, body.app textarea { color-scheme: light; }
body.app .badge.rejected, body.app .form-err, body.app .qi .st.err { color: #b3261e; }
body.app .badge.rejected { background: rgba(179,38,30,.08); }
body.app .todo-d { background: var(--warn-bg); color: #6b5400; }
body.app .f input:focus, body.app .f select:focus, body.app .f textarea:focus { box-shadow: 0 0 0 3px rgba(10,122,82,.14); }

/* Sign-in pages use the public site's pill header */
body.app .site-header { margin-bottom: 12px; }
body.app .site-header .brand { color: var(--ink); text-decoration: none; }
body.app .site-header .site-nav a:not(.btn) { color: var(--ink-2); text-decoration: none; }
body.app .site-header .btn { color: #fff; background: var(--ink); text-decoration: none; }

body.app .topnav { margin-bottom: 16px; }

/* Onboarding home (/portal/ until setup is done) */
.ob { max-width: 860px; margin: 0 auto; }
.ob-head { margin-bottom: 30px; }
.ob-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 400; letter-spacing: -.045em; line-height: 1.02; margin-top: 12px; }
.ob-head p { color: var(--night-muted); font-size: 1.05rem; margin-top: 12px; max-width: 560px; }
.ob-prog { display: flex; align-items: center; gap: 14px; margin-top: 22px; font: 500 .78rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--night-muted); }
.ob-prog .track { flex: 1; max-width: 260px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ob-prog .track i { display: block; height: 100%; background: var(--mint); border-radius: 4px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.ob-step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 0 20px; padding: 26px 28px; margin-top: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transition: border-color .2s, opacity .2s; }
.ob-step.cur { border-color: var(--ink); box-shadow: 0 1px 2px rgba(20,20,20,.04), 0 18px 40px -20px rgba(20,20,20,.22); }
.ob-n { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font: 500 .95rem/1 var(--mono); color: var(--ink-2); background: var(--bg); }
.ob-step.cur .ob-n { background: var(--ink); border-color: var(--ink); color: #fff; }
.ob-step.done .ob-n { background: var(--mint); border-color: var(--mint); color: #fff; }
.ob-n svg { width: 18px; height: 18px; }
.ob-step h2 { font-size: 1.22rem; font-weight: 550; letter-spacing: -.02em; line-height: 1.25; padding-top: 9px; }
.ob-step .d { color: var(--night-muted); margin-top: 6px; font-size: .96rem; }
.ob-body { grid-column: 2; }
.ob-acts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.ob-meta { font-size: .9rem; color: var(--mint); font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.ob-meta svg { width: 16px; height: 16px; }
.ob-sub { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--night-muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ob-sub:hover { color: var(--ink); }
.ob-cals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.ob-cal { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ob-cal:hover { border-color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.ob-cal b { font-weight: 550; font-size: 1rem; }
.ob-cal span { font-size: .88rem; color: var(--night-muted); line-height: 1.45; }
.ob-cal em { margin-top: 8px; font-style: normal; font-size: .88rem; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.ob-cal.booked { border-color: rgba(10,122,82,.45); background: rgba(10,122,82,.05); }
.ob-cal.booked em { color: var(--mint); }
.ob-lockh { display: flex; align-items: center; gap: 10px; margin: 38px 0 0; font: 500 .74rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--night-muted); }
.ob-lockh::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ob-lockh svg { width: 14px; height: 14px; }
.ob-step.locked { background: transparent; box-shadow: none; border-style: dashed; }
.ob-step.locked h2, .ob-step.locked .d { opacity: .55; }
.ob-step.locked .ob-n { opacity: .55; }
.ob-help { margin-top: 34px; text-align: center; color: var(--night-muted); font-size: .9rem; }
@media (max-width: 640px) {
  .ob-step { grid-template-columns: 1fr; padding: 22px 20px; }
  .ob-n { width: 36px; height: 36px; margin-bottom: 12px; }
  .ob-step h2 { padding-top: 0; }
  .ob-body { grid-column: 1; }
  .ob-cals { grid-template-columns: 1fr; }
  .ob-acts .btn { width: 100%; }
}
.f .help, .panel-d > .help { display: block; margin-top: 6px; font-size: .82rem; color: var(--night-muted); }
.ob .panel-d { padding: 28px; }
body.app .ob a.btn { color: #fff; }
body.app .ob a.btn.ghost { color: var(--ink); }
body.app .ob a.btn svg { flex: 0 0 auto; }
.ob-cal em svg, .ob-meta svg { width: 16px; height: 16px; flex: 0 0 16px; }
.lang-pick { background: transparent; color: var(--night-ink); border: 1px solid var(--night-line-2); border-radius: 999px; padding: 6px 10px; font: inherit; cursor: pointer; color-scheme: dark; max-width: 110px; }
.lang-pick:hover { border-color: var(--mint); }
.lang-pick option { color: #111; }

/* Numbered how-to steps (head mounts, recording app, crew page) */
.steps-l { counter-reset: n; list-style: none; padding: 0; margin: 4px 0 0; }
.steps-l li { counter-increment: n; position: relative; padding: 11px 0 11px 38px; border-top: 1px solid var(--line); }
.steps-l li:first-child { border-top: 0; }
.steps-l li::before { content: counter(n); position: absolute; left: 0; top: 11px; width: 24px; height: 24px; border-radius: 50%; background: var(--night-ink); color: #fff; font: 600 .78rem/24px var(--mono); text-align: center; }
.steps-l b { display: block; font-weight: 550; }
.steps-l span { color: var(--night-muted); font-size: .92rem; }
.steps-l a { color: var(--mint); }
.org-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.org-code code { font: 600 1.15rem/1 var(--mono); letter-spacing: .12em; color: var(--night-ink); background: var(--night-2); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.ob-wait { margin: 14px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--night-muted); font-size: .95rem; }

/* Emailed-code dialog for sensitive changes */
.code-dlg { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.code-dlg::backdrop { background: rgba(20,20,20,.45); }
.code-dlg h2 { font-size: 1.22rem; font-weight: 550; letter-spacing: -.02em; }
.code-dlg p { margin-top: 8px; line-height: 1.5; }
.code-dlg input { font: 500 1.4rem/1 var(--mono) !important; letter-spacing: .3em; text-align: center; }
/* Buttons set display, which would otherwise override the hidden attribute. */
body.app [hidden] { display: none !important; }
