/* LEGALITY CLI Nexus Edition: futuristic layer over Interface Vault.
   Keeps Times New Roman, 12-16 pt reading preferences, reduced motion and light mode. */
:root,:root[data-theme=dark]{color-scheme:dark;--bg:#06111c;--surface:#0b1d2b;--surface2:#0f2636;--surface3:#163548;--text:#e4f1f4;--muted:#b6ccd5;--muted2:#a8c1cc;--blue:#6fdde6;--violet:#b5b0f3;--mint:#7fe6c9;--amber:#f0cf98;--danger:#f3b6bc;--line:#2c5b6b;--line2:#183848;--shadow:0 20px 60px #0007;
 --nx-teal:#2fd3b5;--nx-cyan:#5fd6e8;--nx-violet:#7d78e0;--nx-glass:#0a1c2ad9;--nx-glass2:#0d2433cc;--nx-edge:#4fd8e04d;--nx-glow:0 0 0 1px #5fd6e833,0 0 38px #2fd3b522,0 24px 60px #0008;--nx-btn:#11707c;--nx-btn-hi:#178a96;--nx-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
:root[data-theme=light]{--nx-teal:#1f7f8f;--nx-cyan:#2b7a99;--nx-violet:#5b4fa0;--nx-glass:#f7fbfdeb;--nx-glass2:#eef5f9e6;--nx-edge:#2b7a9940;--nx-glow:0 0 0 1px #2b7a9926,0 18px 44px #1c355218;--nx-btn:#1d6f7d;--nx-btn-hi:#175c68;--nx-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}

/* Shared backdrop */
:root[data-theme=dark] body{background:radial-gradient(1200px 700px at 8% 6%,#0f4a4a 0%,transparent 60%),radial-gradient(900px 700px at 100% 100%,#2a2f5c 0%,transparent 62%),linear-gradient(160deg,#071a26 0%,#0a1726 45%,#141a35 100%) fixed;background-color:#06111c}
:root[data-theme=light] body{background:radial-gradient(1000px 600px at 5% 0%,#d6f0ef 0%,transparent 60%),radial-gradient(900px 700px at 100% 100%,#e2def5 0%,transparent 60%),#eef3f7 fixed}
.nexus-rain{position:fixed;inset:0;width:100%;height:100%;display:block;pointer-events:none;z-index:0}
.nexus-rain-workspace{opacity:.28}
:root[data-theme=light] .nexus-rain{opacity:.22}
#root{position:relative;z-index:1;isolation:isolate}

/* Sign-in */
.nexus-login{position:relative;min-height:100vh;min-height:100dvh;display:grid;grid-template-rows:auto 1fr auto;padding:22px clamp(16px,4vw,44px);overflow:hidden;background:transparent!important;max-width:none!important}
.nexus-aurora{position:fixed;inset:0;pointer-events:none;z-index:0;background:radial-gradient(520px 340px at 50% 48%,#2fd3b51f,transparent 70%)}
:root[data-theme=light] .nexus-aurora{background:radial-gradient(520px 340px at 50% 48%,#2b7a9914,transparent 70%)}
.nexus-login-top,.nexus-card,.nexus-login-foot{position:relative;z-index:1}
.nexus-login-top{display:flex;justify-content:space-between;align-items:center;gap:16px}
.nexus-card{align-self:center;justify-self:center;width:min(500px,100%);margin:28px 0;padding:36px 36px 30px;border-radius:22px;background:linear-gradient(180deg,var(--nx-glass),var(--nx-glass2));border:1px solid var(--nx-edge);box-shadow:var(--nx-glow);backdrop-filter:blur(14px) saturate(130%);-webkit-backdrop-filter:blur(14px) saturate(130%)}
.nexus-kicker{display:block;font-size:12pt;letter-spacing:.06em;color:var(--text);opacity:.92}
.nexus-card h1.nexus-title{margin:14px 0 12px;font-family:'Times New Roman',Times,serif;font-size:clamp(26px,4.6vw,34px)!important;font-weight:700!important;font-variant-caps:all-small-caps;letter-spacing:.07em!important;line-height:1.1!important;color:var(--text);text-shadow:0 0 22px #5fd6e840}
:root[data-theme=light] .nexus-title{text-shadow:none}
.nexus-lede{margin:0 0 20px;color:var(--muted);line-height:1.55;max-width:44ch}
.nexus-card .login-tabs{display:flex;gap:4px;padding:4px;border-radius:12px;background:#0003;border:1px solid var(--line2);margin-bottom:18px}
:root[data-theme=light] .nexus-card .login-tabs{background:var(--surface2)}
.nexus-card .login-tabs button{flex:1;min-height:42px;border:0;border-radius:9px;background:transparent;color:var(--muted);font:inherit;cursor:pointer}
.nexus-card .login-tabs button[aria-selected=true]{background:var(--surface3);color:var(--text);box-shadow:inset 0 0 0 1px var(--nx-edge)}
.nexus-form h2{font-size:15pt;margin:0 0 6px}
.nexus-form input{background:#020a12cc!important;border:1px solid var(--line)!important;border-radius:10px!important;color:var(--text)!important;min-height:46px}
:root[data-theme=light] .nexus-form input{background:#fff!important}
.nexus-form input:focus-visible{outline:2px solid var(--nx-cyan)!important;outline-offset:2px;box-shadow:0 0 0 4px #5fd6e822}
.nexus-card .btn.primary,.nexus-alert-go,.sign-go{background:linear-gradient(180deg,var(--nx-btn-hi),var(--nx-btn))!important;color:#f2fbfc!important;border:1px solid #6fdde655!important;box-shadow:0 0 22px #2fd3b52b}
.nexus-card .btn.primary{width:100%;justify-content:center;border-radius:12px}
.nexus-quick{list-style:none;display:flex;flex-wrap:wrap;gap:8px;margin:20px 0 0;padding:0}
.nexus-quick li{display:inline-flex;align-items:center;gap:7px;padding:7px 11px;border-radius:999px;border:1px solid var(--line2);color:var(--muted);background:#ffffff08}
.nexus-quick .icon{width:16px;height:16px;color:var(--nx-cyan)}
.nexus-card .login-security{display:flex;gap:10px;margin-top:18px;padding-top:16px;border-top:1px solid var(--line2);color:var(--muted);line-height:1.55}
.nexus-card .login-security .icon{flex:0 0 18px;color:var(--nx-teal)}
.nexus-login-foot{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;color:var(--muted)}
.nexus-badge{font-family:var(--nx-mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;padding:7px 13px;border-radius:999px;color:#bff5ee;background:#061620d9;border:1px solid #5fd6e855;box-shadow:0 0 18px #2fd3b526}
:root[data-theme=light] .nexus-badge{color:var(--nx-btn);background:#ffffffd9}

/* Fallbacks so the card holds its layout on every base stylesheet */
.nexus-login-top .brand{display:flex;align-items:center;gap:12px;flex:0 1 auto}
.nexus-login-top .brand>span{display:grid}
.nexus-login-top .brand-logo{width:48px;height:48px;object-fit:contain}
.nexus-form form{display:grid;gap:4px}
.nexus-form .field{display:grid;gap:6px;margin:0 0 12px}
.nexus-form .field input{width:100%;box-sizing:border-box;padding:10px 12px;font:inherit}
.nexus-form .form-note{color:var(--muted);line-height:1.55;margin:0 0 12px}
.nexus-card .btn.primary{display:inline-flex;align-items:center;gap:8px;min-height:48px;font:inherit;cursor:pointer}
.nexus-card .btn.primary .icon{width:18px;height:18px}
.nexus-card .icon-btn,.nexus-login-top .icon-btn{display:grid;place-items:center}

/* Workspace glass */
:root[data-theme=dark] .workspace{background:transparent!important;background-image:none!important}
:root[data-theme=dark] .topbar{background:#06121dcc!important;border-bottom:1px solid var(--line2)!important;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
:root[data-theme=dark] .sidebar{background:#06121d99!important}
:root[data-theme=dark] .panel,:root[data-theme=dark] .command-surface,:root[data-theme=dark] .next-step-panel{background:linear-gradient(180deg,#0b1f2ee6,#0a1a28e0)!important;border:1px solid var(--line2)!important}
:root[data-theme=dark] .nav-button[aria-current=page]{background:linear-gradient(90deg,#13404acc,#0f2636cc)!important;box-shadow:inset 3px 0 0 var(--nx-teal);color:var(--text)}
.nav-button .count{font-family:var(--nx-mono)}
.brand-name{letter-spacing:.04em}

/* Action rail on overview */
.nexus-rail{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px;margin:18px 0}
.nexus-alert{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:14px;width:100%;text-align:left;padding:16px 18px;border-radius:16px;font:inherit;color:var(--text);cursor:pointer;background:linear-gradient(120deg,var(--nx-glass),var(--nx-glass2));border:1px solid var(--nx-edge);box-shadow:var(--nx-glow)}
.nexus-alert.is-sign{border-color:#f0cf9866}
.nexus-alert-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;background:#2fd3b51f;color:var(--nx-teal)}
.nexus-alert.is-sign .nexus-alert-icon{background:#f0cf981f;color:var(--amber)}
.nexus-alert-icon .icon{width:24px;height:24px}
.nexus-alert-text{display:grid;gap:3px;min-width:0}
.nexus-alert-text small{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nexus-alert-go{display:inline-flex;align-items:center;gap:6px;padding:9px 14px;border-radius:11px;white-space:nowrap}
.nexus-alert-go .icon,.sign-go .icon{width:16px;height:16px}
.nexus-alert:focus-visible,.letter-tile:focus-visible{outline:2px solid var(--nx-cyan);outline-offset:3px}

/* Signature desk */
.nexus-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin:0 0 18px}
.nexus-stats>div{padding:16px 18px;border-radius:14px;background:var(--surface);border:1px solid var(--line2);display:grid;gap:4px}
.nexus-stats strong{font-size:16pt;line-height:1;color:var(--text)}
.nexus-stats span{color:var(--muted)}
.nexus-stats .is-live{border-color:#f0cf9870;box-shadow:0 0 26px #f0cf981a}
.nexus-stats .is-live strong{color:var(--amber)}
.nexus-section{margin-bottom:18px}
.sign-list{display:grid;gap:12px;padding:4px}
.sign-card{display:grid;grid-template-columns:auto 1fr auto;gap:16px;align-items:start;padding:18px;border-radius:16px;border:1px solid var(--line2);background:var(--surface2)}
.sign-card.is-pending{border-left:3px solid var(--amber)}
.sign-card.is-done{opacity:.92}
.sign-glyph{display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:var(--surface3);color:var(--nx-cyan)}
.sign-card.is-pending .sign-glyph{color:var(--amber)}
.sign-body h3{margin:8px 0 6px}
.sign-body p{margin:0 0 8px;color:var(--muted);line-height:1.55;white-space:pre-line;max-width:72ch}
.sign-due{display:inline-flex;align-items:center;gap:5px;color:var(--amber)}
.sign-due .icon,.sign-host .icon{width:16px;height:16px}
.sign-host{display:flex!important;gap:8px;align-items:center;font-size:12pt;color:var(--muted)!important}
.sign-host strong{color:var(--text);word-break:break-all}
.sign-actions{display:flex;flex-direction:column;align-items:flex-end;gap:8px}
.sign-go{display:inline-flex;align-items:center;gap:8px;text-decoration:none;padding:0 18px;min-height:46px;border-radius:12px;white-space:nowrap}
.nexus-trust{display:flex;gap:10px;align-items:flex-start;color:var(--muted);line-height:1.6;max-width:80ch}
.nexus-trust .icon{flex:0 0 20px;color:var(--nx-teal)}

/* Letter box */
.letter-filters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.letter-stack{display:grid;gap:10px;padding:4px}
.letter-tile{display:grid;grid-template-columns:auto 1fr auto auto;gap:14px;align-items:center;width:100%;padding:16px;border-radius:14px;text-align:left;font:inherit;color:var(--text);cursor:pointer;background:var(--surface2);border:1px solid var(--line2)}
.letter-tile:hover{border-color:var(--nx-edge)}
.letter-tile.is-new{border-color:var(--nx-edge);box-shadow:inset 3px 0 0 var(--nx-teal)}
.letter-seal{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--surface3);color:var(--nx-cyan)}
.letter-meta{display:grid;gap:3px;min-width:0}
.letter-meta small{color:var(--muted)}
.letter-preview{color:var(--muted);overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.letter-new{font-family:var(--nx-mono);font-size:11px;letter-spacing:.12em;text-transform:uppercase;padding:4px 9px;border-radius:999px;color:#06221d;background:var(--nx-teal)}
.letter-tile>.icon{color:var(--muted)}
.letter-sheet{background:#fdfdfb;color:#1d2830;border-radius:10px;padding:clamp(20px,4vw,44px);line-height:1.6;max-width:72ch;font-family:'Times New Roman',Times,serif}
.letter-sheet a{color:#1d5f7a}
.letter-head{display:flex;gap:14px;align-items:center;padding-bottom:14px;margin-bottom:18px;border-bottom:2px solid #1d6f7d}
.letter-head div{display:grid}
.letter-head small{color:#4b5b66}
.letter-logo{width:54px;height:54px;object-fit:contain}
.letter-re{margin-top:18px}
.letter-actions{margin-top:16px;display:flex;gap:10px;flex-wrap:wrap}

/* Motion: one entrance, only for the sign-in card */
@media (prefers-reduced-motion:no-preference){:root:not([data-motion=reduced]) .nexus-card{animation:nexusIn .7s cubic-bezier(.2,.7,.2,1) both}}
@keyframes nexusIn{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:none}}

@media (max-width:720px){.nexus-card{padding:26px 20px}.sign-card{grid-template-columns:auto 1fr}.sign-actions{grid-column:1/-1;align-items:stretch}.sign-go{justify-content:center}.letter-tile{grid-template-columns:auto 1fr auto}.letter-tile>.icon{display:none}.nexus-login-foot{justify-content:center;text-align:center}}

@media print{.nexus-rain,.nexus-aurora{display:none!important}body:has(dialog[open]) #root{display:none!important}body:has(dialog[open]){background:#fff!important}dialog[open]{position:static;border:0;box-shadow:none;max-width:none;width:auto}dialog[open] .dialog-head,dialog[open] .letter-actions{display:none!important}}
.sign-actions .btn .icon,.letter-actions .btn .icon,.nexus-section .btn .icon,.letter-tile>.icon,.letter-seal .icon,.sign-glyph .icon,.nexus-trust .icon,.letter-enclosure .icon{width:20px;height:20px}
.sign-actions .btn,.letter-actions .btn{display:inline-flex;align-items:center;gap:8px}
