/* HaloScape design system, Daylight (light) surface. 4 px grid; cards radius 24; Inter Tight; Lucide icons. */
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-tight-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/inter-tight-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --canvas: #fafafa;
  --card: #ffffff;
  --ink: #0b0b0c;
  --ink-2: #4a4a52;
  --ink-3: #8a8a93;
  --line: #ececef;
  --line-2: #dcdce1;
  --plum: #2a1a2e;
  --plum-2: #3d2842;
  --plum-soft: #f3eff4;
  --lime: #d8ff3c;
  --lime-deep: #b9e000;
  --teal: #00ced1;
  --danger: #c4122f;
  --danger-soft: #fdecef;
  --ok: #0f7b4f;
  --ok-soft: #e6f6ee;
  --warn-soft: #fff6db;
  --r-card: 24px;
  --r-ctl: 12px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(11, 11, 12, 0.04), 0 8px 24px rgba(11, 11, 12, 0.04);
  font-family: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 36px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 28px; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
a { color: inherit; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; line-height: 20px; }
.xs { font-size: 12px; line-height: 16px; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke-width: 1.75; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- controls ---------- */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button, .btn {
  font: inherit; font-size: 15px; font-weight: 600; line-height: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 12px 20px; border-radius: var(--r-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--lime); color: var(--ink);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover, .btn:hover { background: var(--lime-deep); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-dark { background: var(--plum); color: #fff; }
.btn-dark:hover { background: var(--plum-2); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: #f2f2f4; }
.btn-danger { background: transparent; border-color: #f3c3cc; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 14px; }
.icon-btn { min-height: 40px; width: 40px; padding: 0; background: transparent; border-color: var(--line-2); color: var(--ink); }
.icon-btn:hover { background: #f2f2f4; }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.link:hover { background: none; color: var(--plum); }
label.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 550; color: var(--ink-2); }
input[type='email'], input[type='text'], input:not([type]), textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  min-height: 48px; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
textarea { line-height: 24px; resize: vertical; }
label.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 550; cursor: pointer; }
label.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--plum); flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; background: #f0f0f2; color: var(--ink-2);
}
.chip svg.i { width: 14px; height: 14px; }
.stack > .chip { align-self: flex-start; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.off { background: var(--danger-soft); color: var(--danger); }
.chip.wait { background: var(--warn-soft); color: #7a5b00; }
.chip.new { background: var(--lime); color: var(--ink); }
.chip.plum { background: var(--plum-soft); color: var(--plum); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 24px; color: var(--ink-2); }
.empty .badge { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--plum-soft); color: var(--plum); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 16px; background: var(--plum-soft); color: var(--plum); font-size: 14px; line-height: 20px; }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.notice.good { background: var(--ok-soft); color: var(--ok); }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--plum); border-radius: 4px; }

/* ---------- auth layout (sign in) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.auth-side { background: var(--plum); color: #fff; padding: 48px; display: flex; flex-direction: column; gap: 32px; }
.auth-side .lead { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; max-width: 420px; }
.auth-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-side li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, 0.86); }
.auth-side li svg { color: var(--lime); }
.auth-main { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-main .card { width: 100%; max-width: 440px; margin: auto; padding: 32px; }
.mail-badge { width: 56px; height: 56px; border-radius: 20px; background: var(--lime); display: grid; place-items: center; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; font-weight: 650; letter-spacing: -0.01em; }
.brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--lime); color: var(--plum); display: grid; place-items: center; }
.brand .sub { font-weight: 450; opacity: 0.7; }
.top-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- investor layout ---------- */
.inv-bar { position: sticky; top: 0; z-index: 5; background: rgba(250, 250, 250, 0.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.inv-bar .in { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; }
.inv-main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.room-hero { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.doc-card { display: flex; flex-direction: column; gap: 16px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.15s; }
.doc-card:hover { border-color: var(--plum); transform: translateY(-2px); }
.doc-card .top { display: flex; align-items: flex-start; gap: 12px; }
.doc-card h3 { overflow-wrap: anywhere; }
.type-tile { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--plum-soft); color: var(--plum); }
.type-tile.xlsx { background: #e8f7ef; color: #0f7b4f; }
.type-tile.pptx { background: #fff0e6; color: #b34a00; }
.type-tile.docx { background: #e8f1ff; color: #1f55c4; }
.type-tile.img { background: #e6fafa; color: #007c7e; }
.nda-card { max-width: 760px; margin: 0 auto; width: 100%; }
.nda-text { white-space: pre-wrap; font-size: 16px; line-height: 28px; color: var(--ink); max-width: 640px; padding: 8px 0 24px; }
.accept-bar { position: sticky; bottom: 0; margin: 0 -24px -24px; padding: 16px 24px; background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-card) var(--r-card); box-shadow: 0 -8px 16px rgba(255, 255, 255, 0.9); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* viewer (focus mode) */
body.focus { background: #efeff1; }
.viewer-bar { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); }
.viewer-bar .in { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 16px; }
.viewer-bar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: #f0f0f2; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage { display: flex; justify-content: center; padding: 24px 16px 120px; }
canvas.page { display: block; max-width: min(100%, 1000px); max-height: calc(100vh - 180px); width: auto; height: auto; background: #fff; border-radius: 8px; box-shadow: 0 12px 32px rgba(11, 11, 12, 0.12); pointer-events: none; }
body.obscured canvas.page { filter: blur(18px); }
.pager { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--r-pill); background: var(--plum); color: #fff; box-shadow: 0 12px 32px rgba(42, 26, 46, 0.3); }
.pager button { min-height: 44px; width: 44px; padding: 0; background: transparent; color: #fff; }
.pager button:hover { background: var(--plum-2); }
.pager .pill { background: transparent; color: #fff; }
.viewer-note { position: fixed; left: 0; right: 0; bottom: 84px; text-align: center; color: var(--ink-2); font-size: 12px; padding: 0 16px; pointer-events: none; }

/* ---------- admin layout ---------- */
.adm { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); background: linear-gradient(to right, var(--plum) 272px, var(--canvas) 272px); }
.side { background: var(--plum); color: #fff; padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); padding: 0 12px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side a.item, .side button.item { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 12px; color: rgba(255, 255, 255, 0.82); text-decoration: none; font-weight: 500; font-size: 15px; background: transparent; border: 0; justify-content: flex-start; width: 100%; }
.side a.item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side a.item:hover, .side button.item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.side a.item.on { background: rgba(216, 255, 60, 0.14); color: var(--lime); }
.side form { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.side input { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); color: #fff; min-height: 40px; padding: 8px 12px; font-size: 14px; }
.side input::placeholder { color: rgba(255, 255, 255, 0.45); }
.side .btn-side { background: transparent; border-color: rgba(216, 255, 60, 0.5); color: var(--lime); }
.side .btn-side:hover { background: rgba(216, 255, 60, 0.12); }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 12px; }
.adm-top { display: none; }
.adm-main { padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.room-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-top: -8px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; text-decoration: none; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--plum); }
.tabs .count { font-size: 12px; background: #f0f0f2; border-radius: var(--r-pill); padding: 0 8px; line-height: 20px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.kpi .v { font-size: 28px; line-height: 36px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .k { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.kpi.accent { background: var(--plum); color: #fff; border-color: var(--plum); }
.kpi.accent .k { color: rgba(255, 255, 255, 0.7); }
.rows { display: flex; flex-direction: column; }
.r { display: grid; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); min-height: 64px; }
.r:last-child { border-bottom: 0; }
.r-over.head > :first-child, .r-inv.head > :first-child { padding-left: 48px; }
.r.head { min-height: 0; padding-top: 10px; padding-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); background: #fcfcfd; }
.r .cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.r .cell-main > div { min-width: 0; }
.r .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.r.dim { opacity: 0.55; }
.r.clickable { cursor: pointer; }
.r.clickable:hover { background: #fcfcfd; }
.r-over { grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr 1fr 24px; }
.r-docs { grid-template-columns: minmax(0, 3fr) 1fr 1fr auto; }
.r-inv { grid-template-columns: minmax(0, 2.5fr) 1fr 1.2fr auto; }
.r-ev { grid-template-columns: 40px minmax(0, 1fr) auto; }
.r-pages { grid-template-columns: minmax(0, 2fr) 80px 1fr 1fr; padding-left: 64px; background: #fcfcfd; min-height: 44px; font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--plum-soft); color: var(--plum); display: grid; place-items: center; font-weight: 650; font-size: 14px; flex: none; text-transform: uppercase; }
.ev-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #f0f0f2; color: var(--ink-2); }
.ev-ico.inv { background: var(--plum-soft); color: var(--plum); }
.drop { border: 1.5px dashed var(--line-2); border-radius: 20px; padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; background: #fcfcfd; transition: border-color 0.15s, background 0.15s; }
.drop.over { border-color: var(--plum); background: var(--plum-soft); }
.drop .badge { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--lime); color: var(--ink); }
.upload-job { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.link-box { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 16px; background: #f5f5f7; border: 1px solid var(--line); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; color: var(--ink-2); -webkit-user-select: all; user-select: all; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 240px; width: auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { min-height: 32px; padding: 4px 14px; font-size: 14px; background: transparent; border-color: var(--line-2); font-weight: 550; }
.filters button.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.nda-edit textarea { min-height: 280px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side .icon-btn { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
@media (min-width: 861px) { .hide-lg { display: none !important; } }

/* dialog + toast */
dialog { border: 0; padding: 0; border-radius: var(--r-card); max-width: 440px; width: calc(100% - 32px); box-shadow: 0 24px 64px rgba(11, 11, 12, 0.24); color: var(--ink); }
dialog::backdrop { background: rgba(42, 26, 46, 0.5); backdrop-filter: blur(2px); }
dialog .body { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; gap: 8px; align-items: center; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--r-pill); background: var(--ink); color: #fff; font-size: 14px; font-weight: 550; box-shadow: 0 12px 32px rgba(11, 11, 12, 0.25); }
.toast svg { color: var(--lime); }
.center-card { max-width: 480px; margin: 64px auto; }

/* ---------- mobile ---------- */
@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-main { padding: 24px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 20px 24px; gap: 16px; }
  .auth-side .lead { font-size: 20px; line-height: 28px; }
  .auth-side ul { display: none; }
  .auth-main { padding: 16px; }
  .auth-main .card { margin: 16px auto; padding: 24px; }
  .adm { grid-template-columns: 1fr; background: var(--canvas); }
  .kpi .v { font-size: 22px; line-height: 28px; }
  .adm-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--plum); color: #fff; position: sticky; top: 0; z-index: 10; }
  .adm-top .icon-btn { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 20; transform: translateX(-100%); transition: transform 0.2s; }
  .adm.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(11, 11, 12, 0.4); }
  .adm-main { padding: 20px 16px 48px; gap: 20px; }
  h1 { font-size: 24px; line-height: 32px; }
  .r { padding: 12px 16px; gap: 8px 12px; }
  .r.head { display: none; }
  .r-over { grid-template-columns: minmax(0, 1fr) auto; }
  .r-over > :nth-child(3), .r-over > :nth-child(4), .r-over > :nth-child(6) { display: none; }
  .r-docs, .r-inv { grid-template-columns: minmax(0, 1fr); }
  .r-docs > :nth-child(2), .r-docs > :nth-child(3) { display: none; }
  .r .acts { justify-content: flex-start; }
  .r-pages { padding-left: 16px; grid-template-columns: minmax(0, 1fr) auto auto; }
  .r-pages > :nth-child(4) { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .inv-bar .in { padding: 8px 16px; }
  .inv-main { padding: 20px 16px 48px; }
  .card { padding: 20px; }
  .accept-bar { margin: 0 -20px -20px; padding: 16px 20px; }
  .accept-bar button { width: 100%; }
  .viewer-bar .in { padding: 8px 12px; gap: 8px; }
  .stage { padding: 0 0 128px; }
  canvas.page { max-height: none; max-width: 100%; border-radius: 0; box-shadow: none; }
  .pager { bottom: 16px; }
  .viewer-note { bottom: 76px; }
}
@media print { body { display: none !important; } }
