/* SecureView styles — modern, formal design system */
:root {
  --ink: #0d1a2b;
  --navy: #12263f;
  --navy-2: #274a72;
  --accent: #3860e0;
  --accent-d: #2b4bc4;
  --accent-soft: #eef2fe;
  --bg: #f5f7fa;
  --bg-grad: radial-gradient(1100px 520px at 50% -8%, #e7edf9, #f5f7fa 60%);
  --card: #ffffff;
  --line: #e7eaf1;
  --line-2: #dbe1ec;
  --text: #16223a;
  --muted: #616d84;
  --good: #12855a; --good-soft: #e6f6ee;
  --warn: #9a5b00; --warn-soft: #fbeeda;
  --danger: #c23b32; --danger-soft: #fceceb;
  --gold: #c19a3d; --gold-d: #a67f27; --gold-ink: #7a5c14; --gold-soft: #f7f0dc;
  --paper: #fdfcf8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16,36,62,.06);
  --shadow: 0 6px 20px -8px rgba(16,36,62,.16), 0 2px 6px -2px rgba(16,36,62,.08);
  --shadow-lg: 0 24px 56px -16px rgba(13,26,43,.34);
  --ring: 0 0 0 3px rgba(56,96,224,.18);
  --tr: .18s cubic-bezier(.4, 0, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Inter", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em; line-height: 1.5;
}
#app { min-height: 100%; }
.sv-boot { padding: 4rem; text-align: center; color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.55rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.sv-muted { color: var(--muted); font-size: .9rem; }
.tiny { font-size: .72rem; }

/* buttons */
.sv-btn, .sv-btn-ghost {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  font: inherit; font-weight: 600; border-radius: 9px; padding: .6rem 1rem; border: 1px solid transparent;
}
.sv-btn { background: var(--accent); color: #fff; }
.sv-btn:hover { background: var(--accent-d); }
.sv-btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.sv-btn-ghost:hover { background: #f1f5fc; }
.sv-btn-ghost.danger, .danger { color: var(--danger); border-color: #f0c6c0; }
.sv-link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.sv-err { color: var(--danger); font-size: .85rem; min-height: 1em; }

/* auth / cards */
.sv-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, #dbe6fb, var(--bg)); }
.sv-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 420px; }
.sv-card.wide { max-width: 720px; }
.sv-brand { font-weight: 800; font-size: 1.2rem; color: var(--navy); letter-spacing: -.01em; }
.sv-brand.big { font-size: 1.7rem; margin-bottom: .25rem; }
form label { display: block; font-size: .85rem; font-weight: 600; color: var(--navy); margin: .9rem 0 0; }
form input, form textarea, form select {
  width: 100%; margin-top: .35rem; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
form textarea { resize: vertical; }
.sv-btn[type="submit"], form .sv-btn { margin-top: 1.1rem; width: 100%; justify-content: center; }
.sv-backend { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sv-backend summary { cursor: pointer; margin: .4rem 0; }
.sv-backend input { width: 100%; margin-top: .4rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.sv-backend-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.sv-backend-actions .sv-btn-ghost { width: auto; margin: 0; padding: .45rem .8rem; }

/* shell / nav */
.sv-shell { min-height: 100vh; }
.sv-top { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 1.5rem;
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.sv-top .sv-brand { color: #fff; }
.sv-nav { display: flex; gap: 1rem; margin-left: 1rem; }
.sv-nav a { color: #cdd9ee; font-weight: 600; padding: .35rem .2rem; border-bottom: 2px solid transparent; }
.sv-nav a.active, .sv-nav a:hover { color: #fff; border-color: var(--accent); }
.sv-who { margin-left: auto; display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.sv-who .sv-link { color: #cdd9ee; }
.sv-main { max-width: 1040px; margin: 0 auto; padding: 1.5rem; }

.sv-pagehead { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1.5rem; }
.sv-pagehead .sv-btn, .sv-pagehead .sv-headbtns { margin-left: auto; }
.sv-headbtns { display: flex; gap: .5rem; }
.sv-crumb { margin-bottom: .5rem; font-size: .85rem; }

/* doc grid */
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.sv-doccard { display: flex; gap: .9rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); color: var(--text); }
.sv-doccard:hover { border-color: #c5d4ee; transform: translateY(-1px); transition: .15s; }
.sv-doc-ico { font-size: 1.8rem; }
.sv-doc-title { font-weight: 700; margin-bottom: .15rem; }
.sv-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.sv-tag { font-size: .72rem; background: #eef2f9; color: var(--navy-2); padding: .15rem .5rem; border-radius: 99px; }
.sv-tag.good { background: #e3f5ea; color: var(--good); }
.sv-tag.warn { background: #fdeede; color: #9a5b00; }
.sv-recips { margin-top: .4rem; word-break: break-word; }

.sv-empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 2.5rem; text-align: center; color: var(--muted); }
.sv-empty.small { padding: 1.2rem; }

/* stats */
.sv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.sv-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.sv-dash { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.sv-storagebar { background: #eef2f9; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin-bottom: 1rem; font-size: .85rem; color: var(--navy-2); }
.sv-alert a { color: #8a1f1f; text-decoration: underline; font-weight: 700; }
.sv-stat .n { font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.sv-stat .l { font-size: .8rem; color: var(--muted); }

.sv-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }

/* shares */
.sv-sharerow { display: flex; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.sv-sharerow:last-child { border-bottom: none; }
.sv-share-main { flex: 1; min-width: 0; }
.sv-share-title { font-weight: 700; }
.sv-share-url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-share-actions { display: flex; gap: .4rem; align-items: flex-start; flex-wrap: wrap; }

/* bars */
.sv-bar-row { display: grid; grid-template-columns: 70px 1fr 150px; align-items: center; gap: .75rem; margin: .35rem 0; }
.sv-bar-label { font-size: .82rem; color: var(--muted); }
.sv-bar { background: #eef2f9; border-radius: 99px; height: 14px; overflow: hidden; }
.sv-bar-fill { background: linear-gradient(90deg, var(--accent), #5f93f7); height: 100%; }
.sv-bar-val { font-size: .78rem; color: var(--muted); text-align: right; }

/* tables */
.sv-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.sv-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.sv-table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.sv-vname { font-weight: 600; }
.sv-ref { font-family: ui-monospace, Consolas, monospace; background: #eef2f9; color: var(--navy-2);
  padding: .12rem .45rem; border-radius: 5px; font-size: .82rem; letter-spacing: .06em; font-weight: 700; }

/* nda */
.sv-ndarow { display: flex; gap: 1rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.sv-ndarow:last-child { border-bottom: none; }
.sv-ndarow-actions { display: flex; gap: .4rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.sv-sigimg { width: 120px; height: 60px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.sv-nda-meta { flex: 1; min-width: 0; }

/* tabs (My NDAs, etc.) */
.sv-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .5rem 0 .75rem; }
.sv-tab { appearance: none; border: none; background: none; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--muted); padding: .5rem .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.sv-tab:hover { color: var(--ink); background: var(--paper-2, rgba(0,0,0,.03)); }
.sv-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* Sign in with Google */
.sv-btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; padding: .7rem 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #3c4043; font: inherit; font-weight: 600; cursor: pointer; }
.sv-btn-google:hover { background: #f7f8fa; box-shadow: var(--shadow); }
.sv-or { display: flex; align-items: center; text-align: center; color: var(--muted); margin: .9rem 0; font-size: .85rem; }
.sv-or::before, .sv-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.sv-or span { padding: 0 .7rem; }

/* security activity */
.sv-secrow { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.sv-secrow:last-child { border-bottom: none; }
.sv-secicon { font-size: 1.1rem; width: 1.6rem; text-align: center; }
.sv-sec-main { flex: 1; min-width: 0; }

/* two-party NDA workflow */
.sv-card.xwide { max-width: 940px; }
.sv-modal.wide2 { max-width: 860px; }
.sv-nda2 h2 { margin-top: 0; }
.sv-nda-scroll { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin: 1rem 0; }
.sv-nda-scroll.small { max-height: 36vh; }
.sv-nda-form h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.sv-nda-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.sv-nda-row3 label { margin: 0; }
.sv-navbadge { display: inline-block; background: #e8512f; color: #fff; border-radius: 99px; font-size: .68rem; font-weight: 700; padding: 0 .42rem; margin-left: .35rem; line-height: 1.5; }
@media (max-width: 720px) { .sv-nda-row3 { grid-template-columns: 1fr; } }

/* prose (security model page) */
.sv-prose { line-height: 1.65; }
.sv-prose h2 { margin: 1.4rem 0 .5rem; font-size: 1.05rem; }
.sv-prose ul { margin: .4rem 0; padding-left: 1.2rem; }
.sv-prose li { margin: .35rem 0; }
.sv-prose p { margin: .6rem 0; }

/* suspicious-activity alert */
.sv-alert { background: #fdecec; border: 1px solid #f3c2c2; color: #8a1f1f; border-radius: 8px;
  padding: .6rem .8rem; margin-bottom: .6rem; font-size: .9rem; }

/* version history */
.sv-verrow { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.sv-verrow:last-child { border-bottom: none; }
.sv-verrow > div:first-child { min-width: 110px; }
.sv-verrow .sv-muted { flex: 1; }
.sv-verrow .sv-btn-ghost { width: auto; margin: 0; padding: .4rem .7rem; }
.sv-verrow.current { background: #f6faf7; border-radius: 8px; padding: .6rem; }

/* recipient links result */
.sv-reciprow { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.sv-reciprow:last-child { border-bottom: none; }
.sv-reciprow .sv-btn-ghost { width: auto; margin: 0; padding: .4rem .7rem; }

/* modal */
.sv-modal-backdrop { position: fixed; inset: 0; background: rgba(16,36,62,.45); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.sv-modal { background: #fff; border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sv-modal .sv-row { display: flex; align-items: center; justify-content: space-between; }
.sv-modal .sv-row input { width: auto; margin: 0; }
.sv-modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }
.sv-modal-actions .sv-btn, .sv-modal-actions .sv-btn-ghost { width: auto; margin: 0; }

/* viewer flow */
.sv-viewstage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, #dbe6fb, var(--bg)); }
.sv-viewstage .sv-viewinner { width: 100%; max-width: 720px; display: flex; flex-direction: column; align-items: center; }
.sv-readshell { min-height: 100vh; display: flex; flex-direction: column; background: #5a6b80; }
.sv-readbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.2rem; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.sv-readtitle { font-weight: 700; }
.sv-readwho { font-size: .82rem; color: #cdd9ee; }
.sv-readnav { display: flex; align-items: center; gap: .4rem; color: #fff; }
.sv-pagebtn { background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: .8rem; line-height: 1; }
.sv-pagebtn:hover { background: rgba(255,255,255,.25); }
.sv-pageind { font-size: .82rem; color: #cdd9ee; }
.sv-pageind input { width: 42px; text-align: center; padding: .15rem .25rem; border-radius: 5px;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; font: inherit; }
@media (max-width: 720px) { .sv-readwho { display: none; } }
.sv-readbody { flex: 1; overflow: auto; padding: 1.5rem; }
.sv-viewer { display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.sv-page { box-shadow: 0 4px 18px rgba(0,0,0,.25); background: #fff; user-select: none; max-width: 100%; }
.sv-page canvas { display: block; }
.sv-page img.sv-pageimg { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }

/* screenshot-deterrent shield */
.sv-shield { position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(16,36,62,.97); backdrop-filter: blur(14px);
  align-items: center; justify-content: center; text-align: center; }
.sv-shield.on { display: flex; }
.sv-shield-msg { color: #fff; font-size: 1.2rem; font-weight: 600; line-height: 1.6; }
.sv-shield-msg span { font-size: .9rem; font-weight: 400; color: #cdd9ee; }

/* nda gate */
.sv-nda h2 { margin-top: 0; }
.sv-nda-text { max-height: 220px; overflow: auto; background: #f7f9fc; border: 1px solid var(--line);
  border-radius: 8px; padding: 1rem; font-size: .85rem; line-height: 1.5; white-space: pre-wrap; }
.sv-nda-check { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; font-weight: 600; }
.sv-nda-check input { width: auto; margin: 0; }
.sv-sigwrap { position: relative; }
.sv-sig-label { font-size: .8rem; color: var(--muted); }
.sv-sig { width: 100%; height: 140px; border: 1px dashed #aab6c8; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.sv-nda-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.sv-nda-actions .sv-btn, .sv-nda-actions .sv-btn-ghost { width: auto; margin: 0; }
.sv-nda-err { color: var(--danger); font-size: .85rem; }

/* toast */
.sv-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: .7rem 1.2rem; border-radius: 99px; font-size: .9rem;
  opacity: 0; transition: .3s; z-index: 100; box-shadow: var(--shadow); }
.sv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .sv-stats { grid-template-columns: repeat(2, 1fr); }
  .sv-bar-row { grid-template-columns: 56px 1fr; }
  .sv-bar-val { grid-column: 2; text-align: left; }
  .sv-main { padding: 1rem; }
}

/* ---------- mobile / native (Capacitor) — safe areas + small screens ---------- */
.sv-top { padding-top: calc(.8rem + env(safe-area-inset-top)); }
.sv-readbar { padding-top: calc(.7rem + env(safe-area-inset-top)); }
.sv-readbody { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
.sv-headbtns { flex-wrap: wrap; }

/* Hamburger toggle — hidden on desktop, shown on phones. */
.sv-navtoggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: .2rem .4rem; }

@media (max-width: 720px) {
  /* Collapse the top nav + account into a hamburger menu. */
  .sv-top { gap: .5rem; flex-wrap: wrap; }
  .sv-navtoggle { display: block; margin-left: auto; }
  .sv-nav, .sv-who { display: none; width: 100%; margin-left: 0; }
  .sv-top.nav-open .sv-nav { display: flex; flex-direction: column; gap: 0; margin-top: .4rem; }
  .sv-top.nav-open .sv-nav a { padding: .7rem .2rem; border-bottom: 1px solid rgba(255,255,255,.12); border-left: 0; }
  .sv-top.nav-open .sv-who { display: flex; justify-content: space-between; align-items: center; padding-top: .6rem; margin-top: .3rem; border-top: 1px solid rgba(255,255,255,.14); }
  .sv-pagehead { flex-direction: column; align-items: stretch; }
  .sv-pagehead .sv-btn, .sv-pagehead .sv-headbtns { margin-left: 0; }
  .sv-headbtns .sv-btn, .sv-headbtns .sv-btn-ghost, .sv-headbtns label { flex: 1 1 auto; justify-content: center; }
  .sv-sharerow { flex-direction: column; }
  .sv-share-actions { width: 100%; }
  .sv-modal { padding: 1.2rem 1rem; }
  .sv-nda-scroll { max-height: 42vh; }
  /* Wide content (analytics tables) scrolls inside its section instead of blowing out. */
  .sv-section { overflow-x: auto; }
  .sv-table { font-size: .82rem; }
  .sv-table th, .sv-table td { padding: .4rem; }
  /* Prevent iOS auto-zoom on focus by keeping inputs at 16px. */
  form input, form textarea, form select { font-size: 16px; }
}

@media (max-width: 460px) {
  /* Never let the centered auth / viewer cards exceed the screen. */
  .sv-auth, .sv-viewstage { padding: 1rem; }
  .sv-card { max-width: calc(100vw - 2rem); }
  .sv-card.wide, .sv-card.xwide { max-width: calc(100vw - 2rem); }
  .sv-readnav .sv-pageind { font-size: .76rem; }
}

/* ---- receiver portal / people / auth (added for the accounts model) ---- */
.sv-auth-links { display: flex; justify-content: flex-end; margin: .4rem 0; }
.sv-ok { color: #1a7f37; font-size: .9rem; }
.sv-statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.sv-statcard { display: block; padding: 1rem 1.2rem; border-radius: 12px; background: linear-gradient(135deg, #14202e, #223142); color: #fff; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.sv-statcard:hover { transform: translateY(-1px); }
.sv-statlabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.sv-stattitle { font-size: 1.1rem; font-weight: 600; margin: .2rem 0; }
.sv-personrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--sv-border, #e6e8ec); }
.sv-copyable { display: inline-block; margin-top: .3rem; padding: .3rem .5rem; background: #f2f4f7; border-radius: 6px; font-size: .78rem; word-break: break-all; user-select: all; }
@media (max-width: 460px) {
  .sv-statrow { grid-template-columns: 1fr; }
  .sv-personrow { flex-direction: column; align-items: stretch; }
  .sv-personrow .sv-btn-ghost { width: 100%; }
}

/* ---- NDA template editor ---- */
.sv-ndaedit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.sv-ndaedit-form textarea { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.sv-ndaedit-preview { position: sticky; top: 5rem; }
.sv-ndaprev { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 860px) { .sv-ndaedit { grid-template-columns: 1fr; } .sv-ndaedit-preview { position: static; } }

/* ---- owner signature pad ---- */
.sv-sigpadwrap { margin-top: .5rem; }
.sv-sigpad { width: 100%; height: 120px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }

/* ---- draft lifecycle: protection panel ---- */
.sv-protect-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.sv-protect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem 1.4rem; margin: .8rem 0; }
@media (max-width: 640px) { .sv-protect-grid { grid-template-columns: 1fr; } }

/* NDA required-fields toggles */
.sv-reqfields { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .8rem .8rem; margin: .9rem 0; }
.sv-reqfields legend { font-size: .82rem; font-weight: 600; color: var(--navy); padding: 0 .4rem; }
.sv-reqfields .sv-row { margin: .3rem 0; }

/* ============================================================================
   MODERN POLISH LAYER — refined typography, depth, motion (formal & sleek)
   ============================================================================ */
h1 { font-weight: 680; letter-spacing: -0.02em; color: var(--ink); }
h2 { font-weight: 640; letter-spacing: -0.01em; color: var(--navy); }
h3 { font-weight: 620; letter-spacing: -0.01em; }
a { transition: color var(--tr); }
a:hover { color: var(--accent-d); }

/* Buttons — crisp, tactile, accessible focus */
.sv-btn, .sv-btn-ghost {
  border-radius: var(--radius-sm); padding: .62rem 1.05rem; font-weight: 600;
  letter-spacing: -0.01em; transition: background var(--tr), border-color var(--tr), box-shadow var(--tr), transform var(--tr);
}
.sv-btn { background: linear-gradient(180deg, #4269e6, var(--accent)); box-shadow: 0 2px 6px -1px rgba(56,96,224,.4); }
.sv-btn:hover { background: linear-gradient(180deg, #3860e0, var(--accent-d)); transform: translateY(-1px); box-shadow: 0 6px 16px -4px rgba(56,96,224,.5); }
.sv-btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(56,96,224,.4); }
.sv-btn-ghost { background: #fff; border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.sv-btn-ghost:hover { background: #f7f9fc; border-color: #c7d0e0; transform: translateY(-1px); }
.sv-btn:focus-visible, .sv-btn-ghost:focus-visible, .sv-link:focus-visible { outline: none; box-shadow: var(--ring); }
.sv-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Inputs — soft, with a clear focus ring */
form input, form textarea, form select {
  border-color: var(--line-2); border-radius: var(--radius-sm); padding: .62rem .75rem;
  transition: border-color var(--tr), box-shadow var(--tr); background: #fdfefe;
}
form input:focus, form textarea:focus, form select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: #fff; }
form input::placeholder, form textarea::placeholder { color: #9aa4b6; }

/* Cards & sections — layered depth, gentle hover */
.sv-card, .sv-section, .sv-stat, .sv-doccard, .sv-empty { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); }
.sv-card { padding: 2.1rem; }
.sv-section { transition: box-shadow var(--tr); }
.sv-doccard { transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr); }
.sv-doccard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #cdd8ec; }

/* Top bar — deep ink with a hairline and soft elevation */
.sv-top {
  background: linear-gradient(180deg, #16294214, transparent), var(--ink);
  border-bottom: 1px solid #ffffff14; box-shadow: 0 1px 0 #00000022, 0 8px 24px -18px #000;
  padding: .85rem 1.6rem;
}
.sv-brand { letter-spacing: -0.02em; }
.sv-nav a { border-radius: 7px; padding: .4rem .7rem; transition: background var(--tr), color var(--tr); border-bottom: none; }
.sv-nav a:hover { background: #ffffff14; color: #fff; border-bottom: none; }
.sv-nav a.active { background: #ffffff1f; color: #fff; border-bottom: none; }
.sv-navtoggle { border-radius: 8px; transition: background var(--tr); }
.sv-navtoggle:hover { background: #ffffff1a; }

/* Auth — premium, centered, formal */
.sv-auth { background: var(--bg-grad); }
.sv-card { animation: sv-rise .3s cubic-bezier(.2,.7,.3,1); }
@keyframes sv-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sv-brand.big { letter-spacing: -0.03em; }

/* Tags / badges — quieter, formal */
.sv-tag { font-weight: 600; padding: .2rem .6rem; letter-spacing: -0.01em; background: #eef1f7; color: var(--navy-2); }
.sv-tag.good { background: var(--good-soft); color: var(--good); }
.sv-tag.warn { background: var(--warn-soft); color: var(--warn); }

/* Stat cards (portal) — refined gradient + motion */
.sv-statcard { border-radius: var(--radius); background: linear-gradient(135deg, var(--navy), #1f3a5c); box-shadow: var(--shadow); transition: transform var(--tr), box-shadow var(--tr); }
.sv-statcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.sv-stat .n { color: var(--accent-d); letter-spacing: -0.02em; }

/* Reader chrome — cleaner document stage */
.sv-readbar { background: var(--ink); border-bottom: 1px solid #ffffff14; }
.sv-page { border-radius: 6px; box-shadow: 0 6px 24px -8px rgba(13,26,43,.3); }

/* Modal — deeper focus */
.sv-modal { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.sv-modal-backdrop { backdrop-filter: blur(3px); background: rgba(13,26,43,.5); }

/* Alerts */
.sv-alert { border-radius: var(--radius-sm); }

/* Toast — floating pill */
.sv-toast { border-radius: 999px; box-shadow: var(--shadow-lg); letter-spacing: -0.01em; }

/* Subtle custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c6cede transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd3e0; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b3bdcf; background-clip: content-box; }

/* ============================================================================
   READER + NDA SIGNING POLISH  ·  formal navy-and-gold accents
   ============================================================================ */

/* Brand mark — subtle gold crest */
.sv-top .sv-brand { display: inline-flex; align-items: center; gap: .1rem; }
.sv-brand.big { color: var(--ink); }

/* Gold accent utilities for formal/legal touches */
.sv-tag.seal, .sv-tag.gold { background: var(--gold-soft); color: var(--gold-ink); box-shadow: inset 0 0 0 1px #e5d3a3; }

/* ---- Document reader ---- */
.sv-readshell { background: radial-gradient(1200px 640px at 50% -12%, #34414f, #202b39 62%); }
.sv-readbar {
  background: linear-gradient(180deg, #16273b, var(--ink)); border-bottom: 1px solid #ffffff12;
  box-shadow: 0 6px 20px -14px #000; padding: .75rem 1.4rem;
}
.sv-readtitle { letter-spacing: -0.01em; }
.sv-readtitle::before { content: ""; display: inline-block; width: 3px; height: 1em; margin-right: .55rem;
  background: linear-gradient(180deg, var(--gold), var(--gold-d)); border-radius: 2px; vertical-align: -0.12em; }
.sv-pagebtn { background: #ffffff16; border-radius: 8px; transition: background var(--tr), transform var(--tr); }
.sv-pagebtn:hover { background: #ffffff2b; transform: translateY(-1px); }
.sv-pageind input { background: #ffffff14; color: #fff; border: 1px solid #ffffff26; border-radius: 6px; }
.sv-pageind input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px #c19a3d33; }
.sv-readref, .sv-ref { background: #ffffff1a; color: #f2e6c4; }
.sv-page { border-radius: 5px; box-shadow: 0 10px 34px -12px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.2); }
.sv-page img.sv-pageimg { border-radius: 5px; }

/* Privacy shield — refined, blurred, gold lock */
.sv-shield { background: rgba(18,28,44,.86); backdrop-filter: blur(10px); text-align: center; }
.sv-shield-msg { max-width: 26rem; padding: 0 2rem; }
.sv-shield-msg::before { content: "🔒"; display: block; font-size: 2rem; margin-bottom: .5rem; }

/* ---- NDA signing gate ---- */
.sv-nda2 h2 {
  font-size: 1.15rem; padding-bottom: .6rem; margin-bottom: .2rem;
  border-bottom: 2px solid transparent; border-image: linear-gradient(90deg, var(--gold), transparent) 1;
  display: flex; align-items: center; gap: .5rem;
}
.sv-nda2 h2::before { content: "✒️"; }
.sv-nda-sub { color: var(--muted); }
/* The agreement viewport reads like formal paper */
.sv-nda-scroll {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper);
  box-shadow: inset 0 2px 10px -6px rgba(16,36,62,.18); padding: .4rem; margin: 1.1rem 0;
}
.sv-nda-scroll .sv-nda-doc { box-shadow: none; }
.sv-nda-form { background: linear-gradient(180deg, #fbfcfe, #f6f8fc); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.sv-nda-form h3 { color: var(--navy); font-weight: 640; }
.sv-nda-check { background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .7rem .9rem; }
.sv-nda-check input { accent-color: var(--gold-d); width: 1.1rem; height: 1.1rem; }
/* Signature: a formal ruled area */
.sv-sigwrap { margin-top: .9rem; }
.sv-sig-label, .sv-sig-label::before { color: var(--muted); }
.sv-sig, .sv-sigpad { border: 1.5px dashed #c8b98a; border-radius: var(--radius-sm); background:
  linear-gradient(#fff, #fff) padding-box, repeating-linear-gradient(45deg, #f6efdc, #f6efdc 6px, #fff 6px, #fff 12px) border-box;
  transition: border-color var(--tr), box-shadow var(--tr); }
.sv-sig:hover, .sv-sigpad:hover { border-color: var(--gold); }
.sv-nda-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.1rem; }
.sv-nda-actions .sv-btn { background: linear-gradient(180deg, #cfa542, var(--gold-d)); box-shadow: 0 2px 8px -2px rgba(166,127,39,.5); }
.sv-nda-actions .sv-btn:hover { background: linear-gradient(180deg, #c19a3d, #8f6c1f); }

/* Executed / verified seal accents in signed NDAs + Signatures inbox */
.sv-nda-doc .verify { border-color: #d9c790; background: var(--gold-soft); color: var(--gold-ink); }

/* ============================================================================
   WIDER LAYOUT + single-column NDA template editor
   ============================================================================ */
.sv-main { max-width: 1320px; padding: 1.75rem 2rem; }
/* NDA template editor: one column (form, then full-width live preview below) */
.sv-ndaedit { grid-template-columns: 1fr; gap: 1.4rem; }
.sv-ndaedit-preview { position: static; }
.sv-ndaprev { max-height: 78vh; }
.sv-ndaedit-form textarea#nt-clauses { min-height: 340px; }
/* Give the owner signature + editor cards room to breathe */
@media (min-width: 900px) { .sv-ndaedit-form { max-width: 920px; } }

/* ---- folders (owner Documents) ---- */
.sv-folder { margin: 0 0 1.5rem; }
.sv-folder-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .1rem 0 .5rem; border-bottom: 1px solid var(--line); margin-bottom: .85rem; }
.sv-folder-name { font-weight: 650; color: var(--navy); font-size: 1.04rem; }
.sv-folder-actions { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.sv-btn-ghost.tiny { padding: .28rem .62rem; font-size: .78rem; width: auto; margin: 0; }
.sv-link.danger { color: var(--danger); }
.sv-foldersel { display: inline-flex; align-items: center; gap: .4rem; margin-top: .45rem; font-size: .8rem; color: var(--muted); }
.sv-foldersel select { padding: .26rem .5rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--text); }
.sv-covered { margin: .2rem 0 .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fafbfe; padding: .5rem .75rem; }
.sv-covered summary { cursor: pointer; font-size: .82rem; color: var(--navy-2); font-weight: 600; }
.sv-filelist { margin: .5rem 0 0; padding-left: 1.25rem; font-size: .85rem; color: var(--text); }
.sv-filelist li { margin: .18rem 0; }

/* ---- recipient portal folder groups ---- */
.sv-pfolder { margin: 0 0 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); overflow: hidden; }
.sv-pfolder-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .7rem .9rem; background: linear-gradient(180deg,#f7f9fd,#f2f5fb); border-bottom: 1px solid var(--line); }
.sv-pfolder-name { font-weight: 650; color: var(--navy); }
.sv-pfolder .sv-doclist { padding: .7rem .9rem; }
