/* Justifacts team app. Same identity as Client Connect (Account Manager Emails, docs/BRAND_IDENTITY.md):
   royal blue #253887, deep navy #111D50, signal yellow #F3ED11, Exo 2 from justifacts.com. */
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 400; font-display: swap; src: url('https://storage.googleapis.com/justifacts-file-host-public/brand/exo2-regular.woff2') format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 500; font-display: swap; src: url('https://storage.googleapis.com/justifacts-file-host-public/brand/exo2-medium.woff2') format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 600; font-display: swap; src: url('https://storage.googleapis.com/justifacts-file-host-public/brand/exo2-semibold.woff2') format('woff2'); }
@font-face { font-family: 'Exo 2'; font-style: normal; font-weight: 700; font-display: swap; src: url('https://storage.googleapis.com/justifacts-file-host-public/brand/exo2-bold.woff2') format('woff2'); }

:root {
  --brand: #253887; --navy: #111d50; --yellow: #f3ed11; --ink: #1b1b1b; --muted: #606779;
  --line: #dfe2ec; --line-soft: #e9ebf2; --surface-muted: #f5f5f9; --surface-subtle: #fafafd; --brand-tint: #edf0fa;
  --yellow-tint: #faf8d2; --danger: #a32d30; --danger-tint: #fbeeee; --ok: #1d6b45; --ok-tint: #e7f4ec;
  color-scheme: light;
  font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; color: var(--ink); background: var(--surface-muted);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-muted); color: var(--ink); line-height: 1.55; }
a { color: var(--brand); }
h1, h2, h3 { color: var(--ink); font-weight: 700; margin: 0; }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.9px; }
h2 { font-size: 19px; line-height: 1.35; letter-spacing: -.35px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.eyebrow { display: block; color: var(--brand); font-size: 10px; font-weight: 600; letter-spacing: 1.25px; text-transform: uppercase; }

/* ---- Shell: white sidebar with the original wordmark, navy top bar with a yellow rule ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 234px; position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line); padding: 29px 20px 0; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 18px; margin: 0 9px 24px; text-decoration: none; }
.brand img { width: 180px; max-width: 100%; height: auto; display: block; }
.brand > span { display: block; color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: 2px; line-height: 1.4;
  padding-top: 15px; border-top: 1px solid var(--line); }
.brand small { display: block; font-size: 10px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-top: 6px; }
.nav-caption { color: var(--muted); font-size: 9px; letter-spacing: 1.3px; margin: 8px 13px 10px; }
.nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 6px;
  color: #535d78; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav-item:hover { background: var(--surface-muted); color: var(--brand); }
.nav-item.selected { background: var(--brand); color: #fff; }
.nav-item.selected::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; background: var(--yellow); border-radius: 0 2px 2px 0; }
.nav-item.selected .icon { color: var(--yellow); }
.sidebar-bottom { margin-top: auto; padding: 24px 0 18px; }
.sidebar-profile { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 18px 3px 10px; font-size: 12px; min-width: 0; }
.sidebar-profile > div { min-width: 0; }
.sidebar-profile strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.profile-avatar { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); font-weight: 600; font-size: 12px; }
.sidebar-bottom form { margin: 0; padding: 0 3px; }
.sidebar-bottom > a.text-button { padding: 4px 3px; margin-bottom: 4px; }

.main-shell { margin-left: 234px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 38px;
  background: var(--navy); border-bottom: 3px solid var(--yellow); }
.breadcrumb { display: flex; align-items: center; gap: 12px; color: #c7cce4; font-size: 12px; min-width: 0; }
.breadcrumb a, .breadcrumb > span { color: #c7cce4; text-decoration: none; white-space: nowrap; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb strong { color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-link { display: inline-flex; align-items: center; gap: 7px; color: #e1e5f6; font-size: 12px; text-decoration: none; white-space: nowrap; }
.top-link:hover { color: var(--yellow); }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 38px 38px 0; flex: 1; display: flex; flex-direction: column; }
.page-footer { margin-top: auto; padding: 20px 0 22px; display: flex; justify-content: space-between; gap: 12px;
  color: var(--muted); font-size: 10px; border-top: 1px solid var(--line); }
.page-footer-gap { height: 16px; }

/* ---- Page heading ---- */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; flex-wrap: wrap; }
.page-heading .eyebrow { margin-bottom: 12px; }
.page-heading p { font-size: 14px; line-height: 1.65; color: var(--muted); margin-top: 10px; max-width: 680px; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; text-decoration: none; margin-bottom: 18px; }
.back-link:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Buttons, fields, notices ---- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap;
  text-decoration: none; cursor: pointer; }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--navy); border-color: var(--navy); }
.button.outline { background: #fff; border-color: #cbd2e7; color: var(--brand); }
.button.outline:hover:not(:disabled) { background: var(--brand-tint); border-color: var(--brand); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.full { width: 100%; height: 44px; }
.button:disabled { opacity: .55; cursor: progress; }
.text-button, button.link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none;
  color: var(--brand); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.text-button:hover, button.link:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
button.link.danger { color: var(--danger); }
.sidebar-bottom .text-button { color: var(--muted); font-weight: 500; }
.sidebar-bottom .text-button:hover { color: var(--brand); }
input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  font: inherit; font-size: 13px; color: var(--ink); background: #fff; border: 1px solid #cfd4e2; border-radius: 7px; min-width: 0; outline: none; }
input[type=text], input[type=email], input[type=password], input[type=search] { height: 42px; padding: 0 12px; }
textarea { padding: 11px 12px; line-height: 1.6; resize: vertical; width: 100%; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #2538871f; }
input[aria-invalid=true] { border-color: var(--danger); }
button:focus-visible, a:focus-visible, input[type=checkbox]:focus-visible { outline: 3px solid #3d73d7; outline-offset: 3px; }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
.field { display: grid; gap: 7px; font-size: 12px; font-weight: 600; color: #39425c; }
.field small, .hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.field .optional { font-weight: 400; color: var(--muted); }
.flash, .notice { padding: 12px 16px; border-radius: 8px; background: var(--brand-tint); border: 1px solid #dce2f5;
  border-left: 3px solid var(--brand); color: #2c3654; font-size: 13px; margin-bottom: 22px; }
.flash.error, .notice.error { background: var(--danger-tint); border-color: #f0d3d4; border-left-color: var(--danger); color: #7d2225; }
.notice form { margin: 10px 0 0; }
.notice p { margin: 0; }
.panel > .notice { margin: 0 25px 18px; }
.form-error { margin: 0; padding: 9px 12px; border-radius: 7px; background: var(--danger-tint); color: var(--danger); font-size: 12px; }

/* ---- Panels, stats, tables ---- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 7px #111d5005; margin-bottom: 24px; overflow: hidden; }
.panel-body { padding: 0 25px 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 24px 25px 18px; flex-wrap: wrap; }
.section-head .eyebrow { font-size: 9px; margin-bottom: 7px; }
.section-head h2 { font-size: 18px; }
.section-head p { font-size: 12px; color: var(--muted); margin-top: 5px; }
.panel-foot { background: var(--surface-subtle); border-top: 1px solid var(--line); padding: 13px 25px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.panel.danger-zone { border-color: #ecc9ca; }
.panel.danger-zone .eyebrow { color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 17px; margin-bottom: 26px; }
.stat { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 12px; padding: 20px 22px;
  box-shadow: 0 2px 7px #111d5005; display: flex; flex-direction: column; }
.stat:nth-child(3) { border-top-color: var(--yellow); }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.stats.compact .stat { padding: 18px; }
.stats.compact .stat-value { font-size: 26px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.icon-box { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--brand-tint); color: var(--brand); flex-shrink: 0; }
.stat:nth-child(3) .icon-box { background: var(--yellow-tint); color: var(--navy); }
.stat-value { font-size: 32px; font-weight: 600; color: var(--brand); letter-spacing: -.7px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-label { font-size: 13px; font-weight: 600; }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 4px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 17px; }
.card { display: flex; gap: 14px; align-items: flex-start; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.card h2 { font-size: 15px; margin-bottom: 4px; }
.card p { font-size: 12px; color: var(--muted); }
.card .go { margin-left: auto; color: var(--muted); align-self: center; }
a.card:hover { border-color: #b9c4e8; }
a.card:hover h2, a.card:hover .go { color: var(--brand); }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { background: var(--surface-muted); color: #545e78; font-size: 9px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  text-align: left; padding: 11px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-subtle); }
.table th:first-child, .table td:first-child { padding-left: 25px; }
.table th:last-child, .table td:last-child { padding-right: 25px; }
.table td.name { overflow-wrap: anywhere; }
.table td.name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table td.name a:hover { color: var(--brand); }
.table td.name .muted { font-weight: 400; }
.table .empty td { color: var(--muted); padding: 28px 25px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * { display: inline-flex; vertical-align: middle; margin: 0 0 0 16px; }
td.actions > :first-child { margin-left: 0; }
.num { font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; line-height: 1.4; padding: 4px 9px; border-radius: 5px;
  background: var(--surface-muted); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.busy { background: var(--yellow-tint); color: #645f14; }
.pill.bad { background: var(--danger-tint); color: var(--danger); }
.pill.info { background: var(--brand-tint); color: var(--brand); }

/* ---- Forms inside panels: upload, invite ---- */
.form-grid { display: grid; gap: 16px; padding: 0 25px 24px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 260px; }
.dropzone { position: relative; display: grid; place-items: center; gap: 6px; padding: 28px 20px; border: 1.5px dashed #c3cae0; border-radius: 10px;
  background: var(--surface-subtle); cursor: pointer; text-align: center; color: var(--muted); font-size: 12px; }
.dropzone .icon { color: var(--brand); }
.dropzone strong { color: var(--brand); }
.dropzone.dragging, .dropzone:hover { border-color: var(--brand); background: var(--brand-tint); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 3px solid #3d73d7; outline-offset: 3px; }
.checkbox { display: flex; gap: 9px; align-items: center; font-size: 12px; color: #4d5771; }
.results { list-style: none; padding: 0 25px; margin: 0 0 20px; display: grid; gap: 8px; }
.results:empty { display: none; }
.results li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-subtle); font-size: 12px; overflow-wrap: anywhere; }
.results li.ok { border-left: 3px solid var(--ok); }
.results li.error { background: var(--danger-tint); border-color: #f0d3d4; color: var(--danger); }
.results li > .muted { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.results progress { flex: 1 1 120px; accent-color: var(--brand); }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.toolbar input { flex: 1 1 240px; max-width: 360px; }
#library .toolbar { flex-wrap: nowrap; }

/* ---- Upload flow: folded away until "Add files"; numbered steps that appear as they apply ---- */
.panel:has(> .wizard[hidden]) > .section-head { padding-bottom: 24px; }
#upload-toggle[aria-expanded=true] .icon { display: none; }
.wizard { counter-reset: step; padding: 0 25px 24px; display: grid; gap: 0; }
.step { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 16px; padding: 18px 0;
  border: 0; border-top: 1px solid var(--line-soft); margin: 0; min-width: 0; }
.step:first-child { border-top: 0; padding-top: 0; }
.step[hidden] { display: none; counter-increment: none; }
.step-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; position: relative; }
.step-num::before { content: counter(step); }
.step-body { display: grid; gap: 12px; min-width: 0; }
.step-body h3, .step legend h3 { font-size: 14px; font-weight: 600; margin: 4px 0 0; }
.step legend { padding: 0; float: left; width: 100%; }
.step legend + * { clear: both; }
.step-body > input[type=text] { width: 100%; max-width: 480px; }
.step-lead { margin-top: -4px; }
.chosen { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chosen li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-subtle); font-size: 12px; overflow-wrap: anywhere; }
.chosen li .muted { white-space: nowrap; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.choice { position: relative; display: flex; gap: 13px; align-items: flex-start; padding: 15px 16px; border: 1px solid #cfd4e2; border-radius: 10px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--brand); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.choice:has(input:checked)::after { content: ''; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--yellow); box-shadow: 0 0 0 3px var(--brand); }
.choice:has(input:focus-visible) { outline: 3px solid #3d73d7; outline-offset: 3px; }
.choice-icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--brand-tint); color: var(--brand); }
.choice:has(input:checked) .choice-icon { background: var(--brand); color: var(--yellow); }
.choice strong { display: block; font-size: 13px; }
.choice small { display: block; margin-top: 3px; padding-right: 14px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.form-stack { display: grid; gap: 14px; max-width: 640px; }
.wizard-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.wizard-foot .form-error { margin-right: auto; }
select { font: inherit; font-size: 13px; height: 42px; padding: 0 10px; border: 1px solid #cfd4e2; border-radius: 7px; background: #fff; color: var(--ink); }
textarea[aria-invalid=true] { border-color: var(--danger); }

/* ---- Gate form builder ---- */
.fb { display: grid; gap: 12px; max-width: 720px; }
.fb-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-palette-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.fb-add { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px dashed #b8c1dd; border-radius: 7px;
  background: #fff; color: var(--brand); font: inherit; font-size: 12px; font-weight: 600; cursor: grab; }
.fb-add:hover:not(:disabled) { border-style: solid; border-color: var(--brand); background: var(--brand-tint); }
.fb-add:disabled { opacity: .5; cursor: not-allowed; }
.fb-list { list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; }
.fb-block { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 8px; background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--brand); border-radius: 8px; }
.fb-block.fixed { border-left-color: var(--yellow); background: var(--surface-subtle); align-items: center; }
.fb-block.dragging { opacity: .4; }
.fb-grip { flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); }
button.fb-grip { cursor: grab; }
button.fb-grip:hover { background: var(--surface-muted); color: var(--brand); }
.fb-block.fixed .fb-grip { color: var(--brand); }
.fb-main { flex: 1; min-width: 0; display: grid; gap: 9px; }
.fb-fixed-text strong { display: block; font-size: 13px; }
.fb-fixed-text span { font-size: 11px; color: var(--muted); }
.fb-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fb-type { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--brand); }
.fb-required { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #4d5771; margin-left: auto; cursor: pointer; }
.fb-tools { display: inline-flex; gap: 2px; }
.fb-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.fb-icon:hover:not(:disabled) { background: var(--surface-muted); color: var(--brand); }
.fb-icon.danger:hover { background: var(--danger-tint); color: var(--danger); }
.fb-icon:disabled { opacity: .3; cursor: default; }
.fb-label { width: 100%; }
.fb-options { font-size: 12.5px; }
.fb-drop { height: 4px; border-radius: 2px; background: var(--brand); box-shadow: 0 0 0 3px #2538871f; }
.fb-empty { font-size: 11.5px; color: var(--muted); margin: -4px 0 0; }

/* ---- Page builder: content blocks above and below the file (or the gate) ---- */
.pb { display: grid; gap: 10px; max-width: 720px; }
.pb-zone { display: grid; gap: 10px; padding: 12px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 10px; }
.pb-zone-title { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: #545e78; }
.pb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pb-block { padding-left: 14px; }
.pb-block .fb-tools { margin-left: auto; }
.pb-fields { display: grid; gap: 9px; }
.pb-fields input, .pb-fields select { width: 100%; }
.pb-pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 9px; }
.pb-empty { font-size: 11.5px; color: var(--muted); }
.pb-fixed { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--navy); color: #fff; }
.pb-fixed-icon { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: #ffffff1f; color: var(--yellow); }
.pb-fixed strong { display: block; font-size: 13px; }
.pb-fixed div > span { font-size: 11px; color: #c7cce4; }
select[aria-invalid=true] { border-color: var(--danger); }
.form-grid.after-tabs { padding-top: 20px; }

/* ---- Files list: tabs, chips, rows that open the file ---- */
.tabs { display: flex; gap: 4px; padding: 0 25px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 11px 12px 13px; border: 0; background: none; font: inherit;
  font-size: 12.5px; font-weight: 600; color: #59627b; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--brand); }
.tab[aria-pressed=true] { color: var(--brand); }
.tab[aria-pressed=true]::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.tab-count { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 600; text-align: center; }
.tab[aria-pressed=true] .tab-count { background: var(--yellow); color: var(--navy); }
.tabs + .notice, .tabs + .table-scroll { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.page-heading .chips { margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  border: 1px solid transparent; }
.chip.public { background: var(--ok-tint); color: var(--ok); }
.chip.gated { background: var(--navy); color: #fff; }
.chip.gated::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.chip.page { background: var(--brand-tint); color: var(--brand); }
.chip.type { background: #fff; border-color: var(--line); color: #4d5771; }
.table tr.linked { cursor: pointer; }
.table td.name a.title { display: block; }
.table td.name .path { display: block; margin-top: 2px; font-size: 11.5px; color: #4d5771; }
.table td.actions a.go { width: 28px; height: 28px; justify-content: center; align-items: center; border-radius: 6px; color: var(--muted);
  font-size: 18px; text-decoration: none; }
.table tr.linked:hover a.go { background: var(--brand-tint); color: var(--brand); }
.table.compact td, .table.compact th { padding-top: 8px; padding-bottom: 8px; }
.table td.answer { max-width: 260px; white-space: normal; overflow-wrap: anywhere; }

/* ---- Folders: path, folder bar, inline forms, selection, folder rows, drag to move ---- */
.folder-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 7px; font-size: 11.5px; font-weight: 600; }
.folder-crumbs[hidden] { display: none; }
.folder-crumbs a { color: var(--brand); text-decoration: none; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; }
.folder-crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.folder-crumbs span[aria-current] { color: #4d5771; }
.folder-crumbs .sep { color: #a3a9bb; }
.folder-picker { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 480px; }
.folder-picker select { flex: 1 1 200px; min-width: 0; }
.folder-picker input { flex: 1 1 200px; }
.step-body .folder-picker { margin-bottom: 2px; }
.folder-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin: 0 25px 14px;
  padding: 10px 14px; border-radius: 8px; background: var(--surface-subtle); border: 1px solid var(--line-soft); }
.folder-bar[hidden] { display: none; }
.folder-summary { font-size: 12px; color: #4d5771; }
.folder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.folder-actions form { margin: 0; }
.text-button.danger-text { color: var(--danger); }
.text-button:disabled { color: #a3a9bb; cursor: not-allowed; text-decoration: none; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 0 25px 16px; padding: 14px; border: 1px solid #dce2f5;
  border-radius: 8px; background: var(--brand-tint); }
.inline-form[hidden] { display: none; }
.inline-form .field { flex: 1 1 260px; max-width: 480px; }
.inline-form .text-button { height: 42px; }
.selection-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 25px;
  background: var(--navy); color: #fff; font-size: 12.5px; }
.selection-bar[hidden] { display: none; }
.selection-bar .selection-move { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; font-weight: 600; }
.selection-bar .folder-picker select, .selection-bar .folder-picker input { height: 36px; }
.selection-bar .button.primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.selection-bar .text-button { color: #fff; }
.table th.select, .table td.select { width: 1%; padding-right: 0; }
.table td.select input { display: block; }
.table tr.selected td { background: #f3f5fc; }
.folder-name { display: flex; align-items: center; gap: 12px; }
.folder-icon { flex-shrink: 0; color: var(--brand); }
.folder-row td.name a.title { font-weight: 700; }
.table td.actions span.go { display: inline-flex; width: 28px; height: 28px; justify-content: center; align-items: center; border-radius: 6px; color: var(--muted); font-size: 18px; }
.table tr.folder-row:hover span.go { background: var(--brand-tint); color: var(--brand); }
.table tr.dragging { opacity: .45; }
.drag-active .folder-row td { background: var(--surface-subtle); }
.drag-active .folder-row td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.folder-row.drop-over td { background: var(--yellow-tint) !important; }
.folder-crumbs a.drop-over, .folder-crumbs span.drop-over { background: var(--yellow-tint); outline: 2px dashed var(--navy); }
.folder-move .folder-picker { max-width: 480px; }

/* ---- Team: temporary passwords ---- */
#invite-form { max-width: 760px; }
.invite-email input { max-width: 420px; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 7px; }
.temp-password { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.temp-password[hidden] { display: none; }
.temp-password .field { flex: 1 1 260px; max-width: 420px; }
.temp-password .hint { flex-basis: 100%; margin: 0; }
.temp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; letter-spacing: .5px; }
.table tr.row-form td { background: var(--surface-subtle); padding-top: 12px; padding-bottom: 16px; white-space: normal; }
.temp-row { margin: 0; }
.auth-card .hint { margin-top: -6px; }
#choose-form { margin-top: 16px; }
#choose-form .flash { margin-bottom: 2px; }

/* ---- Detail pages ---- */
.link-list { display: grid; gap: 16px; }
.link-item { display: grid; gap: 7px; }
.field-label { font-size: 12px; font-weight: 600; color: #39425c; }

/* ---- 30-day activity: small multiples, one metric each ---- */
.activity { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 26px 32px; padding: 0 25px 22px; }
.spark { margin: 0; min-width: 0; }
.spark figcaption { display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; margin-bottom: 12px; }
.spark-label { font-size: 12.5px; font-weight: 600; }
.spark-total { font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1; grid-row: span 2; align-self: center; }
.spark-note { font-size: 11px; color: var(--muted); }
.spark-plot { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 110px; }
.spark-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums; margin: -6px 0 -6px; }
.spark-bars { position: relative; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid #c9cfdf;
  background: linear-gradient(var(--line-soft), var(--line-soft)) top / 100% 1px no-repeat; }
.spark-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 3px 3px 0 0; }
.spark-col.active { background: var(--brand-tint); }
.spark-bar { width: 100%; max-width: 24px; height: 0; background: var(--brand); border-radius: 4px 4px 0 0; }
.spark-col.active .spark-bar { background: var(--navy); }
.spark-none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--muted); pointer-events: none; }
.spark-x { display: flex; justify-content: space-between; margin: 6px 0 0 calc(1ch + 14px); font-size: 10px; color: var(--muted); }
.chart-tip { position: absolute; z-index: 50; pointer-events: none; padding: 7px 10px; border-radius: 7px; background: var(--navy); color: #fff;
  font-size: 11.5px; line-height: 1.35; box-shadow: 0 8px 20px #111d5033; white-space: nowrap; }
.chart-tip strong { font-size: 13px; }
.chart-tip span { display: block; color: #c7cce4; font-size: 10.5px; }
.table-view { border-top: 1px solid var(--line); }
.table-view summary { padding: 12px 25px; font-size: 12px; font-weight: 600; color: var(--brand); cursor: pointer; }
.table-view .table-scroll { max-height: 320px; overflow-y: auto; }

/* ---- Gated item detail ---- */
.link-row { display: flex; gap: 10px 18px; align-items: center; flex-wrap: wrap; }
.link-row code { flex: 1 1 320px; padding: 10px 12px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 7px;
  font-size: 12px; overflow-wrap: anywhere; color: var(--navy); }
.chart-wrap { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 170px auto; gap: 6px 10px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--muted); text-align: right; }
.chart { width: 100%; height: 170px; display: block; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chart-x { grid-column: 2; display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.chart-area { fill: var(--brand); opacity: .12; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-grid { stroke: var(--line); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.leads td { white-space: nowrap; }
.leads td.name { white-space: nowrap; overflow-wrap: normal; }
.empty-state { padding: 6px 25px 26px; color: var(--muted); font-size: 13px; }

/* ---- Sign-in pages ---- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 14px;
  padding: 34px 34px 28px; box-shadow: 0 20px 60px #111d5014; }
.auth-brand { display: flex; flex-direction: column; gap: 14px; padding-bottom: 18px; margin-bottom: 26px; border-bottom: 3px solid var(--yellow); }
.auth-brand img { width: 170px; height: auto; }
.auth-brand span { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: 2px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.6px; }
.auth-card .lead { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.auth-card .flash { margin-bottom: 18px; }
.auth-form { display: grid; gap: 16px; }
.auth-form .button { margin-top: 4px; }
.auth-links { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }
.auth-links form { margin: 0; }
.auth-foot { margin-top: 18px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---- Smaller screens: the sidebar becomes a header ---- */
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 16px;
    padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { margin: 0; flex-direction: row; align-items: center; gap: 12px; }
  .brand img { width: 128px; }
  .brand > span { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 12px; font-size: 10px; }
  .brand small, .nav-caption, .sidebar-profile { display: none; }
  .sidebar-bottom { margin: 0 0 0 auto; padding: 0; display: flex; align-items: center; gap: 14px; }
  .sidebar-bottom > a.text-button { margin: 0; }
  .nav { order: 3; width: 100%; display: flex; gap: 4px; overflow-x: auto; margin: 0 -4px; padding: 2px 4px; }
  .nav-item { padding: 9px 12px; font-size: 12px; }
  .nav-item.selected::before { display: none; }
  .main-shell { margin-left: 0; }
  .topbar { height: 52px; padding: 0 16px; }
  .top-link { display: none; }
  .breadcrumb { gap: 8px; }
  .breadcrumb > span, .breadcrumb > span + .icon { display: none; }
  .content { padding: 26px 16px 0; }
  h1 { font-size: 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 26px; }
}
@media (max-width: 640px) {
  .section-head, .form-grid, .panel-body { padding-left: 16px; padding-right: 16px; }
  .results { padding: 0 16px; }
  .panel-foot { padding: 12px 16px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .table td, .table th { padding-left: 10px; padding-right: 10px; }
  td.actions > * { display: flex; justify-content: flex-end; margin: 6px 0 0; }
  td.actions > :first-child { margin-top: 0; }
  .library th:nth-child(4), .library td:nth-child(4), .library th:nth-child(5), .library td:nth-child(5),
  .library th:nth-child(6), .library td:nth-child(6) { display: none; }
  #library .toolbar { flex-wrap: wrap; }
  .library th.select, .library td.select { padding-left: 16px; padding-right: 0; }
  .folder-bar, .inline-form { margin-left: 16px; margin-right: 16px; }
  .selection-bar { padding: 10px 16px; }
  .library td.actions button.link { display: none; }
  .wizard { padding: 0 16px 20px; }
  .step { grid-template-columns: 24px minmax(0, 1fr); gap: 12px; }
  .step-num { width: 24px; height: 24px; font-size: 11px; }
  .tabs { padding: 0 10px; }
  .activity { padding: 0 16px 18px; }
  .table-view summary { padding: 12px 16px; }
  .fb-block { padding: 10px 10px 10px 6px; gap: 6px; }
  .fb-required { margin-left: 0; }
  .fb-tools { margin-left: auto; }
  .pb-pair { grid-template-columns: minmax(0, 1fr); }
  .team th:nth-child(3), .team td:nth-child(3) { display: none; }
  .auth-card { padding: 26px 20px 22px; }
}
@media (max-width: 480px) {
  .nav { margin: 0; padding: 2px 0; justify-content: space-between; }
  .nav-item { padding: 8px 9px; gap: 0; }
  .nav-item .icon { display: none; }
  .account-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .stat-top { margin-bottom: 12px; }
}
