/* PEPI Scraper — Partners Group visual system (2026-09 design pass)
   Palette: white, warm beige, near-black, Heritage Red. Light, quiet, precise. */
:root {
  --pg-red: #d92b2b;
  --pg-red-hover: #b81f1f;
  --pg-red-deep: #9e1a1a;
  --pg-red-050: #fbe3e2;
  --pg-red-100: #f3b9b8;
  --ink: #17171a;
  --black: #000000;
  --warm-700: #5c5b59;
  --warm-500: #7d7c7a;
  --warm-300: #a9a7a3;
  --bronze: #896c4c;
  --bronze-hover: #71583c;
  --sand: #d6d0c2;
  --sand-100: #e7e2db;
  --sand-050: #f2efe9;
  --sand-025: #f8f6f2;
  --line: #e4e0d8;
  --line-strong: #cfc9bd;
  --page: #f7f6f3;
  --card: #ffffff;
  --green: #2e7d53;
  --green-bg: #edf5ef;
  --green-line: #cfe6d8;
  --neg: #c0242c;
  --neg-bg: #fcece9;
  --neg-line: #f3cfcb;
  --amber: #9a6a12;
  --amber-bg: #fbf3e4;
  --amber-line: #eed9b0;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(23, 23, 26, 0.04);
  --shadow-md: 0 6px 20px rgba(23, 23, 26, 0.06);
  --shadow-lg: 0 14px 34px rgba(23, 23, 26, 0.10);
  --container: 1040px;
  --gutter: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --red-grad: linear-gradient(135deg, #e5403f 0%, #d92b2b 55%, #b81f1f 100%);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--page); color: var(--ink);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--pg-red-050); }
button { font: inherit; }
a { color: inherit; }

/* ---------- Header ---------- */
.topbar { background: var(--card); border-bottom: 3px solid var(--pg-red); box-shadow: var(--shadow-sm); }
.topbar-inner {
  max-width: var(--container); margin: 0 auto; padding: 18px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand-logo { height: 38px; width: auto; display: block; }
.app-title-wrap { text-align: right; }
.app-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--black); line-height: 1.1; }
.app-subtitle { font-size: 12px; color: var(--warm-700); letter-spacing: 0.02em; }

.mainnav { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.mainnav-inner { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 6px; }
.navlink {
  position: relative; padding: 15px 14px; font-size: 14px; font-weight: 700; color: var(--warm-700); text-decoration: none;
  transition: color .15s var(--ease);
}
.navlink::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; background: var(--pg-red); border-radius: 3px 3px 0 0; transform: scaleX(0); transform-origin: left; transition: transform .22s var(--ease); }
.navlink:hover { color: var(--ink); }
.navlink.active { color: var(--pg-red); }
.navlink.active::after { transform: scaleX(1); }
.nav-spacer { flex: 1; }
.nav-user { font-size: 13px; color: var(--warm-700); }
.nav-account { color: var(--warm-700); text-decoration: none; font-weight: 700; transition: color .15s; }
.nav-account:hover { color: var(--pg-red); }
.nav-signout {
  font-size: 12.5px; font-weight: 700; color: var(--warm-700); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; margin-left: 12px; transition: all .15s var(--ease);
}
.nav-signout:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--container); margin: 0 auto; padding: 28px var(--gutter) 48px; flex: 1 0 auto; }
#view > div { animation: fadeUp .28s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--warm-500); font-weight: 700; margin: 26px 0 12px; }
.section-label:first-child, .vhead + .section-label, .muted + .section-label { margin-top: 12px; }
.vhead { font-size: 22px; font-weight: 700; margin: 4px 0 16px; letter-spacing: -0.01em; }
.back { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--warm-700); text-decoration: none; margin-bottom: 8px; transition: color .15s; }
.back:hover { color: var(--pg-red); }
.muted { color: var(--warm-500); font-size: 13px; }
.tiny { font-size: 11.5px; }
.hint { font-size: 11.5px; color: var(--warm-500); font-weight: 400; text-transform: none; letter-spacing: 0; }
code { font-family: Consolas, Menlo, monospace; font-size: 12px; background: var(--sand-050); padding: 1px 5px; border-radius: 4px; }

/* ---------- Buttons ---------- */
.btn-primary, .generate-btn {
  display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 700; color: #fff;
  background: var(--red-grad); border: none; border-radius: var(--radius); padding: 12px 24px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(23,23,26,.08), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s;
}
.btn-primary:hover:not(:disabled), .generate-btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(217,43,43,.28), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 2px rgba(23,23,26,.08); }
.btn-primary:disabled, .generate-btn:disabled { background: var(--sand); color: #fff; cursor: not-allowed; box-shadow: none; }
.mini, .file-btn, .history-redl {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink);
  background: linear-gradient(180deg, #fff 0%, var(--sand-025) 100%); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: border-color .15s, color .15s, transform .15s var(--ease), box-shadow .15s var(--ease);
}
.mini:hover, .file-btn:hover, .history-redl:hover { border-color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.mini:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.mini.danger { color: var(--neg); border-color: var(--neg-line); }
.mini.danger:hover { border-color: var(--neg); background: var(--neg-bg); }
.download-btn {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #9a7a56, var(--bronze) 60%, var(--bronze-hover)); border: none; border-radius: var(--radius);
  padding: 11px 18px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease), box-shadow .15s;
}
.download-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(137,108,76,.28); }
.btn-open {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12.5px; font-weight: 700; color: #fff; text-decoration: none;
  background: var(--red-grad); border-radius: 8px; padding: 7px 14px;
  box-shadow: 0 1px 2px rgba(23,23,26,0.08), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s;
}
.btn-open::after { content: "\203A"; font-size: 15px; line-height: 1; opacity: .85; transition: transform .15s var(--ease); }
a.card:hover .btn-open, a.history-row:hover .btn-open, .btn-open:hover { filter: brightness(1.06); box-shadow: 0 6px 14px rgba(217,43,43,0.28), inset 0 1px 0 rgba(255,255,255,0.2); transform: translateY(-1px); }
a.card:hover .btn-open::after { transform: translateX(2px); }

/* ---------- Tags & pills ---------- */
.tag, .pill, .status-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.2;
  background: var(--sand-050); color: var(--warm-700); border: 1px solid var(--line);
}
.tag.red, .pill.red { background: var(--neg-bg); color: var(--neg); border-color: var(--neg-line); }
.tag.green, .pill.green { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.tag.amber, .pill.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.tag.bronze, .pill.bronze { background: var(--sand-025); color: var(--bronze); border-color: var(--line); }
.tag.ink { background: var(--ink); color: #fff; border-color: var(--ink); }
a.pill { text-decoration: none; transition: border-color .15s, transform .15s var(--ease); }
a.pill:hover { border-color: var(--bronze); transform: translateY(-1px); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.status-pill.active { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.status-pill.invited { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.status-pill.disabled { background: var(--sand-050); color: var(--warm-500); }

/* ---------- Cards & lists ---------- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-row, .card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; box-shadow: var(--shadow-sm); transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
a.history-row, a.card { text-decoration: none; color: inherit; }
a.history-row:hover, a.card:hover { border-color: var(--pg-red-100); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.history-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.history-title { font-weight: 700; color: var(--ink); }
.history-sub { font-size: 11.5px; color: var(--warm-500); }
.history-row .tag { flex: none; }

/* card grid with hover details (Companies / Funds) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { position: relative; flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
a.card:hover, a.card:focus-within { z-index: 6; border-radius: var(--radius) var(--radius) 0 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.card-sub { font-size: 11.5px; color: var(--warm-500); margin-top: 3px; }
/* details float over the cards below on hover, so the grid never shifts */
.card-more {
  position: absolute; left: -1px; right: -1px; top: 100%; z-index: 7;
  background: var(--card); border: 1px solid var(--pg-red-100); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s var(--ease), transform .22s var(--ease), visibility 0s linear .2s;
}
a.card:hover .card-more, a.card:focus-within .card-more { opacity: 1; visibility: visible; transform: translateY(0); transition-delay: 0s; }
.card-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; padding: 12px 16px 14px; background: var(--sand-025); border-radius: 0 0 var(--radius) var(--radius); }
.fact { min-width: 0; }
.fact-k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--warm-500); font-weight: 700; }
.fact-v { font-size: 13px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-v.neg { color: var(--neg); }
.fact.wide { grid-column: 1 / -1; }
.fact.wide .fact-v { white-space: normal; font-weight: 400; font-size: 12px; color: var(--warm-700); }
.list-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.list-tools .search { margin: 0; flex: 1; }
.list-count { font-size: 12px; color: var(--warm-500); white-space: nowrap; }

/* counters */
.count {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
  min-width: 66px; padding: 6px 12px; border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, var(--sand-050) 100%); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff;
}
.count b { font-size: 18px; line-height: 1.1; color: var(--pg-red); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.count small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--warm-500); font-weight: 700; margin-top: 2px; }

/* audit trail */
.audit { display: flex; flex-direction: column; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.audit-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--sand-050); transition: background .15s; }
.audit-row:last-child { border-bottom: none; }
.audit-row:hover { background: var(--sand-025); }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warm-300); justify-self: center; }
.audit-row.edit .audit-dot { background: var(--amber); }
.audit-row.void .audit-dot, .audit-row.delete .audit-dot { background: var(--neg); }
.audit-row.submit .audit-dot, .audit-row.link .audit-dot { background: var(--green); }
.audit-row.extract .audit-dot { background: var(--bronze); }
.audit-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.audit-title .arrow { color: var(--warm-300); margin: 0 6px; }
.audit-title .metric { color: var(--warm-700); font-weight: 700; }
.audit-sub { font-size: 11.5px; color: var(--warm-500); margin-top: 2px; }
.audit-sub .reason { color: var(--warm-700); font-style: italic; }

/* ---------- Inputs ---------- */
.search, .auth-form input[type=email], .auth-form input[type=password], .auth-form input[type=text], .auth-form textarea, .auth-form select, .modal input, .add-user input, .add-user select {
  width: 100%; font: inherit; font-size: 14px; padding: 11px 13px; color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s;
}
.search { margin-bottom: 14px; padding-left: 38px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d7c7a' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>"); background-repeat: no-repeat; background-position: 13px center; }
.search:focus, .auth-form input:focus, .auth-form textarea:focus, .auth-form select:focus, .modal input:focus, .add-user input:focus, .add-user select:focus, select:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,23,26,.07);
}
.auth-form textarea { min-height: 84px; resize: vertical; }
.add-user input, .add-user select { font-size: 13px; padding: 9px 10px; border-radius: 8px; }
select {
  width: 100%; font: inherit; font-size: 14.5px; padding: 11px 38px 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background-color: #fff; color: var(--ink); cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%235c5b59' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; transition: border-color .15s, box-shadow .15s;
}
select:disabled { background-color: var(--sand-050); color: var(--warm-500); cursor: not-allowed; }
.inline-error { color: var(--neg); font-size: 13px; margin-top: 10px; }

/* ---------- Stepper ---------- */
.stepper { margin: 0 0 20px; padding: 0 0 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--warm-500); transition: color .2s; }
.step .num { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--warm-500); background: var(--card); transition: all .2s var(--ease); }
.step.active { color: var(--ink); font-weight: 700; }
.step.active .num { background: var(--red-grad); border-color: var(--pg-red); color: #fff; box-shadow: 0 0 0 4px var(--pg-red-050); }
.step.done .num { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-sep { flex: 0 0 26px; height: 1px; background: var(--line-strong); }

/* ---------- Scrape ---------- */
.selectors { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.select-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.select-card label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.docs-panel { margin-top: 22px; border-radius: var(--radius-lg); padding: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.docs-panel.empty { background: var(--sand-025); border: 1.5px dashed var(--line-strong); box-shadow: none; }
.docs-placeholder { margin: 0; color: var(--warm-500); text-align: center; font-size: 13.5px; padding: 8px 0; }
.docs-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: border-color .15s, background .15s; }
.doc-row.filled { border-color: var(--green-line); background: var(--green-bg); }
.doc-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.doc-sub { font-size: 11.5px; color: var(--warm-500); letter-spacing: 0.02em; }
.doc-action { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.doc-filename { font-size: 12px; color: var(--warm-700); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generate-row { display: flex; align-items: center; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.generate-status { font-size: 13px; color: var(--warm-700); display: inline-flex; align-items: center; gap: 8px; }
.refresh-toggle { font-size: 12.5px; color: var(--warm-700); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.refresh-toggle input { accent-color: var(--pg-red); }
.history-panel { margin-top: 22px; }
.cached-note { display: flex; align-items: center; gap: 9px; background: var(--sand-025); border: 1px solid var(--line); border-left: 3px solid var(--bronze); color: var(--warm-700); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 12.5px; margin-bottom: 16px; }
.cached-note strong { color: var(--bronze); }
.spinner { width: 15px; height: 15px; border: 2px solid var(--sand); border-top-color: var(--pg-red); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.lp-checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.check { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.check .check-text { color: var(--ink); }
.check.green { background: var(--green-bg); border-color: var(--green-line); }
.check.green .pill { background: var(--green); color: #fff; border-color: var(--green); }
.check.red { background: var(--neg-bg); border-color: var(--neg-line); }
.check.red .pill { background: var(--neg); color: #fff; border-color: var(--neg); }
.check.amber { background: var(--amber-bg); border-color: var(--amber-line); }
.check.amber .pill { background: var(--amber); color: #fff; border-color: var(--amber); }
.download-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 22px; padding: 16px; background: var(--sand-025); border: 1px solid var(--line); border-radius: var(--radius); }
.download-name { font-size: 13px; color: var(--warm-700); }
.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 6px 20px 12px; box-shadow: var(--shadow-sm); }
.summary table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.summary td { padding: 9px 4px; border-bottom: 1px solid var(--sand-050); }
.summary tr:last-child td { border-bottom: none; }
.summary td.k { color: var(--warm-700); }
.summary td.v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.summary.edit td { padding: 6px 6px; }
.summary.edit td.k { width: 40%; }
.summary.edit input { width: 100%; font: inherit; font-size: 13.5px; padding: 7px 9px; border: 1px solid transparent; border-radius: 6px; background: var(--sand-050); text-align: right; transition: all .15s; }
.summary.edit input:focus { outline: none; border-color: var(--ink); background: #fff; box-shadow: 0 0 0 2px rgba(23,23,26,.07); }
.summary.edit input[data-seller="investorName"] { text-align: left; }
.flags { margin-top: 16px; background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: var(--radius); padding: 13px 16px; font-size: 13px; color: #7a5410; }
.flags strong { color: var(--amber); }
.flags ul { margin: 6px 0 0; padding-left: 18px; }
.error-box { margin-top: 22px; background: var(--neg-bg); border: 1px solid var(--neg-line); border-radius: var(--radius); padding: 13px 16px; color: var(--neg); font-size: 14px; }
.mock-banner { background: var(--amber-bg); border: 1px solid var(--amber-line); border-left: 3px solid var(--amber); color: #7a5410; padding: 11px 15px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; margin-bottom: 22px; }
.valid-lps { border: 1px solid var(--line); background: var(--sand-025); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.valid-lps .lp-list { margin: 6px 0 8px; padding-left: 18px; }
.valid-lps .lp-list li { margin: 2px 0; font-weight: 700; color: var(--ink); }
.xlink { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.xbtns { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------- Data grids ---------- */
.gridwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); }
table.grid { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.grid th { position: sticky; top: 0; background: var(--sand-025); color: var(--warm-700); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.grid th.sticky, table.grid td.sticky { position: sticky; left: 0; text-align: left; background: #fff; z-index: 1; }
table.grid th.sticky { background: var(--sand-025); z-index: 2; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--sand-050); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: var(--sand-025); }
table.grid tbody tr:hover td.sticky { background: var(--sand-025); }
table.grid td.sticky .unit { display: block; font-size: 10.5px; color: var(--warm-500); font-weight: 400; }
table.grid td.sticky { font-weight: 700; }
table.grid input { font: inherit; font-size: 13px; width: 96px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: var(--sand-050); text-align: right; }
table.grid input.nameinp { width: 160px; text-align: left; }
table.grid input.ccy { width: 56px; text-align: center; }
table.grid input:focus { outline: none; border-color: var(--ink); background: #fff; box-shadow: 0 0 0 2px rgba(23,23,26,.07); }
table.grid input:disabled { background: repeating-linear-gradient(45deg, #f6f5f2, #f6f5f2 6px, #efeee9 6px, #efeee9 12px); color: var(--warm-500); }
td.num.neg, .neg-val { color: var(--neg); }
.xdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bronze); margin-left: 6px; vertical-align: middle; }
.ccytag { font-size: 10px; color: var(--warm-500); }
.mtag { color: var(--pg-red); font-size: 11px; }
td.editable { position: relative; cursor: pointer; transition: background .12s; }
td.editable:hover { background: var(--pg-red-050) !important; }
.editpen { opacity: 0; margin-left: 6px; color: var(--pg-red); font-size: 11px; transition: opacity .12s; }
td.editable:hover .editpen { opacity: 1; }
.chartcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow-sm); }
svg.chart { width: 100%; height: auto; }
svg.chart .ct { font-size: 10px; fill: var(--warm-500); font-family: Arial, sans-serif; }
svg.spark { vertical-align: middle; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.tile { background: linear-gradient(180deg, #fff 0%, var(--sand-025) 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.tile-label { font-size: 11.5px; color: var(--warm-700); }
.tile-val { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 11px; color: var(--warm-500); margin-top: 2px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(23,23,26,0.42); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; animation: fadeIn .18s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border-radius: var(--radius-lg); padding: 22px; width: 400px; max-width: 92vw; box-shadow: var(--shadow-lg); animation: fadeUp .22s var(--ease); }
.modal h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.mlbl { display: block; font-size: 12px; color: var(--warm-700); margin: 10px 0 5px; font-weight: 700; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; align-items: center; }

/* ---------- Login / auth ---------- */
.login-card { max-width: 460px; margin: 30px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-md); animation: fadeUp .3s var(--ease); }
.login-h { margin: 0 0 6px; font-size: 20px; }
.login-sub { color: var(--warm-700); font-size: 13.5px; margin: 0 0 16px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: 12.5px; color: var(--warm-700); font-weight: 700; display: block; margin-bottom: 4px; }
.auth-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 12.5px; }
.auth-links a, .auth-link { color: var(--bronze); text-decoration: none; font-weight: 700; cursor: pointer; background: none; border: none; font: inherit; font-size: 12.5px; padding: 0; transition: color .15s; }
.auth-links a:hover, .auth-link:hover { color: var(--pg-red); }
.auth-ok { background: var(--green-bg); border: 1px solid var(--green-line); color: var(--green); border-radius: var(--radius); padding: 12px 14px; font-size: 13.5px; }
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--warm-700); white-space: nowrap; }
.auth-check input { width: 16px; height: 16px; accent-color: var(--pg-red); }
.code-input { letter-spacing: 0.35em; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }
.qr-wrap { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: linear-gradient(180deg, #fff, var(--sand-025)); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin: 4px 0 14px; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-box img { width: 168px; height: 168px; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: 6px; box-shadow: var(--shadow-sm); }
.qr-cap { font-size: 11px; color: var(--warm-500); text-align: center; }
.qr-steps { font-size: 13.5px; color: var(--ink); margin: 0; padding-left: 20px; line-height: 1.45; }
.qr-steps li { margin-bottom: 8px; }
.qr-steps li::marker { color: var(--pg-red); font-weight: 700; }
.qr-manual { grid-column: 1 / -1; font-size: 12px; color: var(--warm-700); }
.qr-manual summary { cursor: pointer; color: var(--bronze); font-weight: 700; }
.secret { font-family: Consolas, Menlo, monospace; font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; display: inline-block; margin-top: 6px; user-select: all; }
.pw-hint { font-size: 12px; color: var(--warm-500); margin: -4px 0 0; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-tabs button { font-size: 13px; font-weight: 700; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--warm-700); cursor: pointer; transition: all .15s var(--ease); }
.admin-tabs button:hover { border-color: var(--ink); color: var(--ink); }
.admin-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: var(--shadow-sm); }
.users-table, .cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th, .cost-table th { text-align: left; font-size: 10.5px; color: var(--warm-700); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--line); padding: 9px 10px; }
.users-table td, .cost-table td { padding: 10px; border-bottom: 1px solid var(--sand-050); vertical-align: middle; }
.users-table tr:last-child td, .cost-table tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover td, .cost-table tbody tr:hover td { background: var(--sand-025); }
.users-table .actions { white-space: nowrap; }
.users-table .actions .mini { margin-right: 4px; }
.users-table select { width: auto; font-size: 12.5px; padding: 6px 30px 6px 10px; border-radius: 8px; }
.cost-table th.num, .cost-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-table tr.total td { font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--sand-025); }
.cost-table input.amt { width: 96px; text-align: right; font: inherit; font-size: 13px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 6px; }
.add-user { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr 0.8fr auto; gap: 8px; align-items: end; background: var(--sand-025); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); }
.add-user label { font-size: 11px; color: var(--warm-700); font-weight: 700; display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.cost-add { grid-template-columns: 0.9fr 0.9fr 2fr 0.9fr 1.2fr auto; }
.cost-actions { margin: 6px 0 14px; }
.req-card { border: 1px solid var(--amber-line); background: var(--amber-bg); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 13px; }
.note { font-size: 12px; color: var(--warm-500); margin: 6px 0 0; }

/* ---------- Footer ---------- */
.footer { margin-top: auto; background: var(--black); border-top: 3px solid var(--pg-red); }
.footer-inner { max-width: var(--container); margin: 0 auto; padding: 20px 8px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-logo { height: 26px; width: auto; opacity: 0.95; }
.footer-note { font-size: 11.5px; color: #b8b6b2; text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .selectors { grid-template-columns: 1fr; }
  .topbar-inner { flex-direction: column; align-items: flex-start; padding: 16px var(--gutter); }
  .app-title-wrap { text-align: left; }
  .doc-filename { max-width: 120px; }
  .add-user, .cost-add { grid-template-columns: 1fr 1fr; }
  .qr-wrap { grid-template-columns: 1fr; }
  .auth-check { white-space: normal; }
  .card-grid { grid-template-columns: 1fr; }
  .footer-inner { padding: 20px var(--gutter); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
