/* AO Signet – classic British wax seal and signet ring. Deep navy, burnished gold, parchment.
   Created by ALPHA OMEGA CORE Labs 2018. */
@font-face { font-family: 'Cormorant Garamond'; src: url('../fonts/CormorantGaramond-VariableFont_wght.ttf') format('truetype'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('../fonts/CormorantGaramond-Italic-VariableFont_wght.ttf') format('truetype'); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Cormorant SC'; src: url('../fonts/CormorantSC-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('../fonts/SourceSans3-VariableFont_wght.ttf') format('truetype'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Great Vibes'; src: url('../fonts/GreatVibes-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Allura'; src: url('../fonts/Allura-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Pinyon Script'; src: url('../fonts/PinyonScript-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Herr Von Muellerhoff'; src: url('../fonts/HerrVonMuellerhoff-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Homemade Apple'; src: url('../fonts/HomemadeApple-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Dancing Script'; src: url('../fonts/DancingScript-VariableFont_wght.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }

:root {
  --navy: #0f1f3d; --navy-2: #172c55; --navy-3: #22396a;
  --gold: #b8893a; --gold-hi: #e6c47a; --gold-lo: #7a5419; --gold-text: #82591a;
  --wax: radial-gradient(circle at 36% 30%, #fbe7a6 0, #dcae55 32%, #a9782c 72%, #6e4a17 100%);
  --bg: #f3ecdc; --bg-2: #ebe2cd; --paper: #fbf7ee; --card: #fffdf7;
  --ink: #15213b; --ink-2: #4b5468; --ink-3: #6b7284;
  --line: rgba(21, 33, 59, .14); --line-2: rgba(21, 33, 59, .24);
  --focus: #1f4fb5;
  --ok: #2f6b3a; --warn: #9a3a1c; --info: #24406f;
  --shadow: 0 1px 2px rgba(15, 31, 61, .06), 0 8px 28px -12px rgba(15, 31, 61, .28);
  --shadow-lg: 0 30px 80px -30px rgba(15, 31, 61, .5);
  --r: 14px; --r-sm: 9px;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tabbar: 0px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #08111f; --bg-2: #0c182c; --paper: #0f1d36; --card: #12223f;
  --ink: #f2ead8; --ink-2: #c1b9a6; --ink-3: #958f82;
  --gold-text: #e1bd6e;
  --line: rgba(230, 196, 122, .16); --line-2: rgba(230, 196, 122, .3);
  --focus: #8fb4ff;
  --ok: #8fd19a; --warn: #f1a483; --info: #a9c3f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .9);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
button, a, label, summary, .btn, .tool, .fld { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
html.theme-anim *, html.theme-anim *::before { transition: background-color .4s ease, color .4s ease, border-color .4s ease !important; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 18px/1.55 var(--sans); color: var(--ink); background: var(--bg);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(184, 137, 58, .12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(15, 31, 61, .08), transparent 60%);
  
}
[data-theme="dark"] body { background-image: radial-gradient(1200px 600px at 85% -10%, rgba(184, 137, 58, .14), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(34, 57, 106, .5), transparent 60%); }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 22px 56px; outline: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0 0 .4em; letter-spacing: .005em; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3.1rem); text-wrap: balance; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 .9em; }
a { color: var(--gold-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold); color: #111; padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-2); }
.small, small { font-size: .86rem; }
.fineprint { font-size: .9rem; color: var(--ink-3); margin: .5em 0 1em; }
.eyebrow { font-family: 'Cormorant SC', var(--serif); letter-spacing: .14em; color: var(--gold-text); font-size: 1rem; margin: 0 0 .35em; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 60ch; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- letterhead ---------- */
.lh-inner { max-width: 1180px; margin: 0 auto; padding: 10px 22px; display: flex; align-items: center; gap: 18px; min-height: 68px; }
.letterhead { background: linear-gradient(180deg, var(--navy) 0, #0b1831 100%); color: #f4ecd9; position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 var(--gold), 0 3px 0 rgba(184, 137, 58, .35), 0 10px 30px -14px rgba(0, 0, 0, .6); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-seal { width: 46px; height: 46px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .brand-seal { transform: rotate(-14deg) scale(1.06); }
.brand-word { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; letter-spacing: .02em; }
.brand-word em { color: var(--gold-hi); font-style: italic; font-weight: 500; }
.lh-spacer { flex: 1; }
.topnav { flex: 1; display: flex; gap: 4px; justify-content: center; }
.topnav-link { display: inline-flex; align-items: center; gap: 8px; color: #d9d0bb; text-decoration: none; padding: 10px 14px; border-radius: 999px; font-weight: 500; font-size: 1rem; position: relative; }
.topnav-link .ic { width: 20px; height: 20px; }
.topnav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.topnav-link.is-active { color: var(--navy); background: linear-gradient(180deg, #f1d48d, #c99a3f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 8px -2px rgba(0, 0, 0, .5); }
.lh-tools { display: flex; align-items: center; gap: 10px; }

/* sun/moon toggle */
.theme-toggle { border: 0; background: none; padding: 4px; cursor: pointer; border-radius: 999px; color: inherit; }
.tt-track { display: block; width: 64px; height: 34px; border-radius: 999px; background: linear-gradient(180deg, #8fb4e8, #cfe2f7); position: relative; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35), 0 0 0 1px rgba(230, 196, 122, .6); transition: background .4s; }
.tt-knob { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: var(--wax); box-shadow: 0 2px 5px rgba(0, 0, 0, .4); display: grid; place-items: center; transition: transform .45s cubic-bezier(.4, 1.5, .5, 1); color: #5b3c0e; }
.tt-knob .ic { position: absolute; width: 18px; height: 18px; transition: opacity .3s, transform .45s; }
.tt-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] .tt-track { background: linear-gradient(180deg, #0a1428, #1e3260); }
[data-theme="dark"] .tt-knob { transform: translateX(30px); background: radial-gradient(circle at 35% 30%, #fffbea, #e8dcb8 60%, #b9a77d); color: #30406a; }
[data-theme="dark"] .tt-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"] .tt-moon { opacity: 1; transform: none; }

/* account menu */
.account { position: relative; }
.account summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; cursor: pointer; color: #efe6d2; border: 1px solid rgba(230, 196, 122, .35); min-height: 44px; }
.account summary::-webkit-details-marker { display: none; }
.acc-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.account-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 290px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 8px; z-index: 60; }
.account-menu a, .account-menu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover { background: var(--bg-2); }
.acc-who { padding: 10px 12px; margin: 0 0 6px; border-bottom: 1px solid var(--line); line-height: 1.35; }
.acc-who span { color: var(--ink-2); font-size: .92rem; } .acc-who small { color: var(--gold-text); }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 0 22px; border-radius: 999px; font: 600 1.02rem/1 var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: transform .15s, box-shadow .2s, background .2s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-gold { color: #2a1b04; background: linear-gradient(180deg, #f3d892 0, #d7a94f 45%, #b7862f 100%); border-color: #8f6420; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 6px 16px -8px rgba(122, 84, 25, .9); }
.btn-gold:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 10px 22px -8px rgba(122, 84, 25, .9); }
.btn-ghost { color: var(--ink); background: var(--card); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { color: #fff !important; background: #9a2f1c !important; border-color: #7a2414 !important; box-shadow: none !important; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .95rem; }
.icon-btn { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { border-color: var(--gold); }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .98rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], input:not([type]) {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-sm); min-height: 52px; padding: 10px 14px; width: 100%;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(184, 137, 58, .25); }
input::placeholder { color: var(--ink-3); }
input[readonly] { opacity: .75; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.grow { flex: 1; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.pill-muted { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill-demo, .badge-demo { background: #f6e2b0; color: #5c3d0b; border: 1px solid #d7b064; }
.notice { padding: 13px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); font-size: .98rem; }
.notice-info { border-left: 4px solid var(--gold); }
.notice-warn { border-left: 4px solid var(--warn); color: var(--ink); }
.ao-reveal-btn:hover { background: rgba(184, 137, 58, .15) !important; }

/* ---------- panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 1.45rem; }
.link-more { font-weight: 600; font-size: .98rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 32px; box-shadow: var(--shadow); }
.narrow { max-width: 520px; margin: 30px auto; }
.narrow-wide { max-width: 860px; margin: 0 auto; }
.center { text-align: center; }
.big-seal { width: 120px; height: 120px; margin: 0 auto 12px; display: block; }
.page-head { margin: 6px 0 22px; }

/* shared paper lines (used by the seal moment inside the app) */
.lp-line { display: block; height: 9px; border-radius: 5px; background: rgba(29, 42, 69, .13); margin: 12px 0; width: 100%; }
.lp-line.short { width: 72%; } .lp-line.short2 { width: 48%; }
.lp-sigline { position: absolute; left: 36px; right: 40%; bottom: 66px; height: 1.5px; background: rgba(29, 42, 69, .5); }
/* ---------- sign in (landing v2 lives in landing.css) ---------- */
.page-signin main { max-width: 1240px; }
.signin { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: start; }
@keyframes glint { from { transform: translateX(0) rotate(18deg); } to { transform: translateX(200px) rotate(18deg); } }

.signin-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 32px; box-shadow: var(--shadow-lg); position: relative; }
.signin-card::before { content: ''; position: absolute; inset: 8px; border: 1px solid var(--line); border-radius: 16px; pointer-events: none; }
.signin-card h2 { font-size: 2.1rem; }
.providers { display: grid; gap: 10px; margin: 18px 0 8px; }
.btn-provider { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); text-decoration: none; font: 600 1.05rem/1.2 var(--sans); cursor: pointer; position: relative; transition: border-color .2s, transform .15s; }
.btn-provider:hover { border-color: var(--gold); }
.btn-provider .pv { width: 24px; height: 24px; flex: none; }
.btn-provider .ic.pv { stroke: var(--gold-text); }
.btn-provider small.pill { margin-left: auto; }
.btn-provider.is-off { opacity: .72; cursor: not-allowed; background: transparent; border-style: dashed; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); margin: 18px 0; font-size: .95rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.magic { margin: 16px 0 6px; border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; background: var(--paper); }
.magic summary { cursor: pointer; padding: 15px 0; font-weight: 600; display: flex; gap: 10px; align-items: center; list-style: none; color: var(--gold-text); }
.magic summary::-webkit-details-marker { display: none; }
.magic form { padding-bottom: 16px; }
.switch { text-align: center; margin: 14px 0 0; }
.switch a { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.switch .ic { width: 18px; height: 18px; }

/* ---------- home desk ---------- */
.desk { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 26px; }
.desk-head h1 { margin-bottom: .2em; }
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ledger-card { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 14px; padding: 22px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .25s cubic-bezier(.3,1.4,.5,1), box-shadow .25s; }
a.ledger-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lc-ic { grid-row: 1 / 4; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--gold-hi); box-shadow: inset 0 0 0 2px rgba(230,196,122,.5); }
.lc-need .lc-ic { background: var(--wax); color: #4d330b; box-shadow: inset 0 -3px 6px rgba(80,50,10,.3); }
.lc-num { font-family: var(--serif); font-size: 2.6rem; font-weight: 600; line-height: 1; }
.lc-label { font-weight: 700; font-size: 1.06rem; }
.lc-sub { color: var(--ink-2); font-size: .92rem; }
.lc-wait { opacity: .9; }

.envelope { position: relative; margin: 8px 0 30px; border-radius: 20px; background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: #f3ead6; padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid rgba(230,196,122,.35); }
.env-flap { position: absolute; inset: 0 0 auto 0; height: 120px; background: linear-gradient(180deg, rgba(255,255,255,.06), transparent); clip-path: polygon(0 0, 100% 0, 50% 100%); border-bottom: 1px solid rgba(230,196,122,.2); }
.env-body { position: relative; padding: 70px 28px 26px; text-align: center; }
.env-seal { position: absolute; left: 50%; top: 52px; transform: translate(-50%, -50%); width: 92px; height: 92px; transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.env-seal .wax-seal { width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.envelope:hover .env-seal, .envelope.is-over .env-seal { transform: translate(-50%, -50%) rotate(-10deg) scale(1.08); }
.envelope.is-over { outline: 3px dashed var(--gold-hi); outline-offset: -10px; }
.env-body h2 { margin-top: 26px; font-size: 2rem; color: #fff8e6; }
.env-body p { color: #d7cdb6; max-width: 56ch; margin-left: auto; margin-right: auto; }
.env-body .fineprint { color: #a9a08b; }
.env-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0 10px; }
.envelope .btn-ghost { background: rgba(255,255,255,.06); color: #f6eedb; border-color: rgba(230,196,122,.5); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.only-touch { display: none; }
.touch .only-touch { display: inline-flex; }
.upload-progress { max-width: 460px; margin: 10px auto; display: grid; gap: 8px; }
.upload-progress .bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.upload-progress .bar span { display: block; height: 100%; width: 4%; background: var(--wax); transition: width .3s; }
.upload-progress.err .txt { color: #ffc2a6; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.sig-preview { min-height: 110px; display: grid; place-items: center; background: repeating-linear-gradient(0deg, transparent 0 31px, var(--line) 31px 32px), var(--paper); border-radius: var(--r-sm); border: 1px solid var(--line); margin-bottom: 12px; padding: 10px; text-align: center; }
.sig-preview img { max-width: 100%; max-height: 110px; }
[data-theme="dark"] .sig-preview, [data-theme="dark"] .f-img, [data-theme="dark"] .sp-upload-preview { background-color: #f6efdc; }
[data-theme="dark"] .sig-preview .muted, [data-theme="dark"] .sig-preview small { color: #4b5468; }
.sig-preview.small { min-height: 60px; } .sig-preview.small img { max-height: 54px; } .sig-preview.small:empty { display: none; }
.sig-preview.big { min-height: 160px; } .sig-preview.big img { max-height: 140px; }
.sig-preview small { display: block; margin-top: 6px; }

/* ---------- lists ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-list li { display: flex; gap: 8px; align-items: stretch; animation: rowIn .45s calc(var(--i, 0) * 45ms) both cubic-bezier(.2,.8,.2,1); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.doc-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .2s, transform .2s; }
.two-col .doc-row { background: var(--paper); }
.doc-row:hover { border-color: var(--gold); transform: translateX(2px); }
.dr-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--bg-2); color: var(--ink-2); }
.dr-ic.st-signed { background: var(--wax); color: #4d330b; }
.dr-ic.st-pending { background: var(--navy); color: var(--gold-hi); }
.dr-ic.st-lapsed { color: var(--warn); }
.dr-ic.st-template { background: var(--navy-3); color: #fff; }
.dr-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.dr-title { font-weight: 700; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-meta { color: var(--ink-2); font-size: .94rem; }
.dr-status { font-weight: 700; }
.dr-status.st-pending { color: var(--gold-text); } .dr-status.st-signed { color: var(--ok); } .dr-status.st-lapsed { color: var(--warn); }
.dr-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--ink-3); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line-2); font-weight: 600; font-size: .78rem; }
.dr-go { color: var(--ink-3); }
.dr-action { display: grid; place-items: center; gap: 2px; align-content: center; min-width: 86px; padding: 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--gold-text); text-decoration: none; font: 600 .85rem var(--sans); cursor: pointer; }
.dr-action:hover { border-color: var(--gold); }
.empty { display: grid !important; justify-items: center; text-align: center; gap: 6px; padding: 34px 18px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-2); }
.empty strong { color: var(--ink); font-family: var(--serif); font-size: 1.4rem; }
.empty-seal { width: 64px; height: 64px; fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: .8; }
.skeleton { height: 76px; border-radius: var(--r); background: linear-gradient(90deg, var(--bg-2), var(--card), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; min-height: 50px; border: 0; background: none; color: var(--ink-2); font: 600 1.02rem var(--sans); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--gold); }
.tab-count { min-width: 26px; padding: 0 7px; border-radius: 99px; background: var(--bg-2); font-size: .82rem; line-height: 22px; text-align: center; }
.tab-count:empty { display: none; }
.tab.is-active .tab-count { background: var(--gold); color: #2a1b04; }
.tabs.small .tab { min-height: 44px; padding: 8px 14px; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search { flex: 1; min-width: 220px; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 46px; border-radius: 999px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 200px; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 50; }
.menu-right { left: auto; right: 0; min-width: 250px; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; min-height: 46px; padding: 8px 14px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; border-radius: 9px; cursor: pointer; }
.menu button:hover, .menu button:focus { background: var(--bg-2); outline: none; }
.menu button:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu [aria-checked="true"] { font-weight: 700; color: var(--gold-text); }
.menu [aria-checked="true"]::after { content: '✓'; margin-left: auto; }
.menu .danger { color: var(--warn); }
.sort-btn strong { color: var(--gold-text); }

/* ---------- document page ---------- */
.page-doc main { max-width: none; padding: 0; display: flex; }
.page-doc .colophon { display: none; }
.doc-page { flex: 1; display: grid; grid-template-rows: auto 1fr auto; height: calc(100vh - 71px); height: calc(100dvh - 71px); }
.doc-bar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.doc-title-wrap { flex: 1; min-width: 0; }
.doc-title { font-size: 1.6rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { margin: 0; font-size: .92rem; color: var(--ink-2); }
.doc-bar-actions { display: flex; gap: 10px; align-items: center; }
.ai-btn .ic { color: var(--gold-text); }
.doc-work { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
.toolbox { border-right: 1px solid var(--line); padding: 16px; background: var(--paper); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.tb-hint { font-size: .92rem; color: var(--ink-2); margin: 0; min-height: 3em; }
.tools { display: grid; gap: 8px; }
.tool { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); color: var(--ink); font: 600 1rem var(--sans); cursor: pointer; text-align: left; transition: transform .15s, border-color .2s, background .2s; }
.tool:hover { border-color: var(--gold); transform: translateX(2px); }
.tool .ic { color: var(--gold-text); }
.tool[aria-pressed="true"] { background: var(--navy); color: #fff6df; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,58,.3); }
.tool[aria-pressed="true"] .ic { color: var(--gold-hi); }
.tb-zoom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; font-weight: 600; color: var(--ink-2); }
.is-readonly .toolbox .tools, .is-readonly .tb-hint { display: none; }
.pages-scroll { overflow: auto; background: var(--bg-2); padding: 26px 0 40px; -webkit-overflow-scrolling: touch; }
[data-theme="dark"] .pages-scroll { background: #050c18; }
.pages { display: grid; justify-items: center; gap: 26px; padding: 0 10px; }
.page { position: relative; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 18px 40px -20px rgba(15,31,61,.45); border-radius: 2px; }
.page-canvas { width: 100%; height: 100%; display: block; border-radius: 2px; }
.page:not(.is-rendered) { background: linear-gradient(90deg, #fff, #f3f0e8, #fff); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.page-no { position: absolute; right: 8px; bottom: -22px; font-size: .8rem; color: var(--ink-3); }
.fields-layer { position: absolute; inset: 0; }
.is-placing .fields-layer { cursor: crosshair; outline: 2px dashed rgba(184,137,58,.7); outline-offset: -2px; }
.loading-doc { display: grid; justify-items: center; gap: 10px; padding: 60px; color: var(--ink-2); }
.spin-seal { width: 80px; height: 80px; animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fld { position: absolute; border: 1.5px dashed rgba(31, 79, 181, .55); background: rgba(232, 240, 255, .45); border-radius: 4px; touch-action: none !important; user-select: none; -webkit-user-select: none; cursor: grab; display: flex; align-items: center; justify-content: center; color: #13254a; }
.fld:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.fld.is-selected { border: 2px solid #b8893a; background: rgba(255, 246, 220, .55); box-shadow: 0 0 0 4px rgba(184,137,58,.22); z-index: 3; }
.fld.is-dragging { cursor: grabbing; opacity: .9; box-shadow: 0 12px 24px -10px rgba(0,0,0,.4); }
.fld.is-missing { border-color: #c0392b; background: rgba(255, 220, 214, .5); }
.fld.is-new { animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.f-tag { position: absolute; left: -1px; top: -21px; z-index: 2; font: 700 11px/1 var(--sans); letter-spacing: .03em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px 4px 0 0; background: #1f4fb5; color: #fff; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; }
.fld.is-selected .f-tag, .fld:hover .f-tag, .fld:focus-visible .f-tag { opacity: 1; }
.fld.is-selected .f-tag { background: #8f6420; pointer-events: auto; cursor: move; }
.fld.is-selected .f-tag::before { content: '⠿ '; }
.f-img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.f-ph { font: 600 12px/1.15 var(--sans); text-align: center; color: #1f4fb5; padding: 2px 4px; pointer-events: none; }
.f-input { width: 100%; height: 100%; min-height: 0 !important; padding: 0 3px !important; border: 0 !important; background: transparent !important; color: #13254a !important; font-family: var(--sans); box-shadow: none !important; pointer-events: none; border-radius: 0 !important; }
.fld.is-selected .f-input { pointer-events: auto; cursor: text; }
.f-box { width: 100%; height: 100%; display: grid; place-items: center; border: 1.5px solid #13254a; border-radius: 3px; background: #fff; }
.f-box svg { width: 92%; height: 92%; fill: none; stroke: #13254a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.f-checkbox { border-style: solid; background: transparent; }
.f-del { position: absolute; right: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: #9a2f1c; color: #fff; display: none; place-items: center; padding: 0; cursor: pointer; z-index: 4; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.f-del .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.f-handle { position: absolute; right: -9px; bottom: -9px; width: 20px; height: 20px; border-radius: 50%; background: var(--wax); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: nwse-resize; display: none; touch-action: none; }
.fld.is-selected .f-del { display: grid; } .fld.is-selected .f-handle { display: block; }
.touch .f-handle { width: 28px; height: 28px; right: -14px; bottom: -14px; }
.is-readonly .fld { display: none; }

.action-bar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); }
.ab-status { margin: 0; flex: 1; color: var(--ink-2); font-size: .95rem; }
.ab-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn-seal { padding-left: 14px; }
.mini-wax { width: 30px; height: 30px; border-radius: 50%; background: var(--wax); box-shadow: inset 0 -2px 4px rgba(80,50,10,.45), 0 0 0 2px rgba(255,255,255,.35); position: relative; }
.mini-wax::after { content: 'AO'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px var(--serif); color: #5b3c0e; }

/* dialogs */
dialog.sheet { border: 1px solid var(--line-2); border-radius: 20px; background: var(--card); color: var(--ink); padding: 22px; width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(5, 12, 26, .62); backdrop-filter: blur(3px); }
dialog[open] { animation: sheetIn .3s cubic-bezier(.2,.9,.3,1); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; display: flex; gap: 10px; align-items: center; font-size: 1.6rem; }
.sheet-head h2 .ic { color: var(--gold-text); }
.ai-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.ai-tabs button { flex: 1; min-height: 46px; border-radius: 999px; border: 1px dashed var(--line-2); background: var(--bg-2); color: var(--ink-3); font: 600 1rem var(--sans); cursor: not-allowed; }
.ai-off { padding: 18px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); }
.timeline { list-style: none; margin: 0 0 16px; padding: 0 0 0 22px; border-left: 2px solid var(--gold); }
.timeline li { position: relative; display: grid; gap: 2px; padding: 0 0 14px 10px; }
.tl-dot { position: absolute; left: -31px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); border: 3px solid var(--gold); }
.ev-signed .tl-dot { background: var(--wax); border-color: #8f6420; }
.hashes { display: grid; gap: 4px; margin: 0 0 10px; }
.hashes dt { font-weight: 700; font-size: .9rem; color: var(--ink-2); margin-top: 6px; }
.hashes dd { margin: 0; }
code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; background: var(--bg-2); padding: 2px 6px; border-radius: 5px; }

/* signature pad */
.sigpad { width: min(760px, calc(100vw - 16px)); }
.sp-canvas-wrap { position: relative; height: 230px; border-radius: 14px; background: #fffdf6; border: 1px solid var(--line-2); overflow: hidden; touch-action: none; }
.sigpad.is-initials .sp-canvas-wrap { height: 190px; max-width: 420px; margin: 0 auto; }
#sp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; z-index: 2; }
.sp-baseline { position: absolute; left: 7%; right: 7%; bottom: 28%; height: 1.5px; background: rgba(19, 37, 74, .35); }
.sp-x { position: absolute; left: 7%; bottom: calc(28% + 6px); color: rgba(19, 37, 74, .45); font-size: 20px; }
.sp-placeholder { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: rgba(19, 37, 74, .45); font: italic 1.25rem var(--serif); pointer-events: none; padding-bottom: 30px; }
.sp-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.inks { display: flex; gap: 8px; }
.ink { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; padding: 0; }
.ink span { width: 24px; height: 24px; border-radius: 50%; display: block; }
.ink[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,58,.3); }
.font-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.font-opt { display: grid; gap: 2px; justify-items: center; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line-2); background: #fffdf6; cursor: pointer; color: #13254a; min-height: 86px; }
.fo-sample { font-size: 1.9rem; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-opt small { color: #6b7284; font-family: var(--sans); }
.font-opt[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,58,.35); }
.dropzone { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 16px; border: 2px dashed var(--line-2); border-radius: 14px; cursor: pointer; background: var(--paper); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone span { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.dropzone:focus-within { outline: 3px solid var(--focus); }
.sp-upload-preview { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; background: #fffdf6; }
.sp-upload-preview img { max-width: 100%; max-height: 140px; }
.sp-panel .check { margin-top: 12px; }
.sp-error { margin: 12px 0 0; }

/* ---------- the seal moment ---------- */
.seal-moment { position: fixed; inset: 0; z-index: 200; transition: opacity .6s ease; display: grid; place-items: center; align-content: center; gap: 18px; background: radial-gradient(circle at 50% 45%, rgba(23, 44, 85, .92), rgba(5, 10, 22, .97)); }
.sm-stage { position: relative; width: min(540px, 90vw, 62vh); aspect-ratio: 1.05; }
.sm-paper { position: absolute; inset: 6% 8% 8%; background: linear-gradient(180deg, #fffdf6, #efe4ca); border-radius: 6px; padding: 9% 10%; box-shadow: 0 40px 80px -30px rgba(0,0,0,.8); transform: rotate(-1.5deg); }
.sm-paper .lp-line { background: rgba(29, 42, 69, .14); }
.sm-sig { position: absolute; left: 10%; bottom: 26%; max-width: 54%; max-height: 22%; object-fit: contain; }
.sm-paper .lp-sigline { left: 10%; right: 40%; bottom: 24%; }
.sm-drop { position: absolute; right: 21%; bottom: 17%; width: 26px; height: 26px; margin: -13px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: var(--wax); opacity: 0; }
.sm-seal { position: absolute; right: 8%; bottom: 4%; width: 40%; aspect-ratio: 1; opacity: 0; transform: scale(.3); }
.sm-seal .wax-seal { width: 100%; height: 100%; filter: drop-shadow(0 10px 12px rgba(60, 36, 6, .55)); }
.sm-ring { position: absolute; right: 9%; bottom: 14%; width: 38%; opacity: 0; transform: translateY(-140%); z-index: 3; }
.sm-ring .signet-ring { width: 100%; height: auto; filter: drop-shadow(0 18px 18px rgba(0,0,0,.5)); }
.sm-caption { text-align: center; color: #f6ecd4; min-height: 90px; }
.sm-word { font-family: var(--serif); font-style: italic; font-size: clamp(2.6rem, 8vw, 4rem); margin: 0; color: var(--gold-hi); opacity: 0; letter-spacing: .02em; }
.sm-when { margin: 0; opacity: 0; color: #d6ccb4; }
.seal-moment.play .sm-paper { animation: smPaper .5s both; }
.seal-moment.play .sm-drop { animation: smDrop .5s .25s cubic-bezier(.5,0,1,.6) both; }
.seal-moment.play .sm-ring { animation: smRing 1.5s .55s cubic-bezier(.45,0,.3,1) both; }
.seal-moment.play .sm-seal { animation: smSeal .45s 1.1s cubic-bezier(.2,1.6,.4,1) both; }
.seal-moment.play .sm-stage { animation: smShake .25s 1.12s; }
.seal-moment.play .moment-seal .seal-glint { animation: glint 1s 1.9s ease-in-out both; }
.seal-moment.play .sm-word { animation: fadeUp .6s 1.8s both; }
.seal-moment.done .sm-when { animation: fadeUp .5s both; }
.seal-moment.leaving { opacity: 0; }
.seal-moment.still .sm-seal { opacity: 1; transform: none; }
.seal-moment.still .sm-word { opacity: 1; }
.seal-moment.still.done .sm-when { opacity: 1; }
@keyframes smPaper { from { opacity: 0; transform: translateY(30px) rotate(-4deg); } }
@keyframes smDrop { 0% { opacity: 0; transform: translateY(-260px); } 20% { opacity: 1; } 85% { transform: translateY(0) scale(1, 1.15); } 100% { opacity: 1; transform: translateY(0) scale(1.9, .7); } }
@keyframes smRing { 0% { opacity: 0; transform: translateY(-160%) rotate(-14deg); } 25% { opacity: 1; } 38% { transform: translateY(-4%) rotate(0); } 42% { transform: translateY(3%) scaleY(.96); } 62% { transform: translateY(0); opacity: 1; } 100% { opacity: 0; transform: translateY(-190%) rotate(10deg); } }
@keyframes smSeal { from { opacity: 0; transform: scale(.25); } to { opacity: 1; transform: none; } }
@keyframes smShake { 0%, 100% { transform: none; } 30% { transform: translateY(3px); } 60% { transform: translateY(-1px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sealed-sheet { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(5, 12, 26, .6); padding: 16px; animation: fadeUp .3s; }
.ss-card { position: relative; width: min(520px, 100%); background: var(--card); border-radius: 22px; padding: 70px 28px 26px; text-align: center; border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.ss-seal { position: absolute; left: 50%; top: 0; width: 120px; height: 120px; transform: translate(-50%, -45%); filter: drop-shadow(0 10px 14px rgba(60,36,6,.45)); }
.ss-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ---------- verify & guide ---------- */
.verify { max-width: 820px; margin: 0 auto; }
.verify-drop { position: relative; display: flex; align-items: center; gap: 22px; padding: 26px; border-radius: 20px; border: 2px dashed var(--gold); background: var(--card); cursor: pointer; transition: transform .2s, box-shadow .2s; margin: 18px 0; }
.verify-drop:hover, .verify-drop.is-over { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.verify-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.verify-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.vd-seal { width: 96px; height: 96px; flex: none; }
.vd-seal .wax-seal { width: 100%; height: 100%; }
.verify-drop:hover .verify-seal .seal-glint { animation: glint 1s ease-in-out; }
.vd-text { display: grid; gap: 4px; font-size: 1.2rem; }
.vd-text small { color: var(--ink-2); }
.verify-result { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.verify-result.ok { border-left: 6px solid var(--ok); } .verify-result.no { border-left: 6px solid var(--warn); } .verify-result.info { border-left: 6px solid var(--gold); }
.fp span { font-weight: 700; color: var(--ink-2); font-size: .9rem; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 26px; }
.steps li { display: grid; gap: 4px; padding: 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.step-n { width: 44px; height: 44px; border-radius: 50%; background: var(--wax); display: grid; place-items: center; font: 700 1.3rem var(--serif); color: #4d330b; margin-bottom: 6px; }
.steps span:last-child { color: var(--ink-2); }
.faq details { border-bottom: 1px solid var(--line-2); padding: 4px 0; }
.faq summary { cursor: pointer; padding: 14px 0; font: 600 1.3rem var(--serif); list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: '+'; color: var(--gold-text); font-size: 1.5rem; line-height: 1; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary::-webkit-details-marker { display: none; }
.faq p { color: var(--ink-2); max-width: 70ch; }
.sig-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.saved-note { color: var(--ok); font-size: .95rem; }
.mail pre { white-space: pre-wrap; font-size: .9rem; background: var(--bg-2); padding: 12px; border-radius: 8px; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: calc(24px + var(--tabbar) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--navy); color: #f6eedb; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid rgba(230,196,122,.4); animation: fadeUp .3s; font-size: 1rem; }
.toast-warn { background: #5c1f12; border-color: #f1a483; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }

/* footer */
.colophon { border-top: 1px solid var(--line); padding: 26px 22px calc(26px + var(--tabbar)); color: var(--ink-2); font-size: .95rem; }
.colophon-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.colophon p { margin: 0; }
.colo-seal { width: 36px; height: 36px; display: block; }
.mini-seal { width: 36px; height: 36px; }
.made { font-family: 'Cormorant SC', var(--serif); letter-spacing: .08em; color: var(--gold-text); font-size: 1.02rem; }
.tabbar { display: none; }
.page-doc .toasts { bottom: 96px; }

/* ---------- tablet & phone ---------- */
@media (max-width: 1020px) {
  .topnav-link span { display: none; }
  .topnav-link { padding: 10px; }
}
@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; gap: 10px; }
  .two-col { grid-template-columns: 1fr; }
  .doc-work { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .toolbox { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; gap: 8px; }
  .tb-hint { display: none; }
  .tools { display: flex; gap: 8px; }
  .tool { flex-direction: column; gap: 2px; min-height: 58px; min-width: 70px; padding: 6px 8px; font-size: .8rem; justify-content: center; text-align: center; }
  .tb-zoom { margin: 0 0 0 auto; }
  .is-readonly .toolbox { justify-content: flex-end; }
}
@media (max-width: 700px) {
  body { font-size: 17px; --tabbar: 68px; }
  main { padding: 18px 14px 40px; }
  .topnav, .acc-name { display: none; }
  .lh-inner { padding: 8px 14px; min-height: 60px; gap: 10px; }
  .brand-word { font-size: 1.45rem; }
  .brand-seal { width: 40px; height: 40px; }
  .lh-spacer { flex: 1; }
  .lh-tools { margin-left: auto; }
  .account summary { padding: 8px; border: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--navy); border-top: 1px solid var(--gold); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -15px rgba(0,0,0,.6); }
  .tab { font-size: .96rem; }
  .tabbar .tb-link { display: grid; justify-items: center; gap: 2px; color: #cfc5ad; text-decoration: none; font-size: .72rem; font-weight: 600; padding: 4px 2px; border: 0; margin: 0; min-height: 54px; border-radius: 12px; }
  .tabbar .tb-link.is-active { color: var(--navy); background: linear-gradient(180deg, #f1d48d, #c99a3f); }
  .ledger { grid-template-columns: 1fr; gap: 10px; }
  .ledger-card { padding: 16px; }
  .lc-num { font-size: 2.1rem; }
  .env-body { padding: 64px 16px 20px; }
  .env-body h2 { font-size: 1.6rem; }
  .env-actions .btn { width: 100%; }
  .signin-card { padding: 22px 18px; border-radius: 18px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs .tab { padding: 10px 12px; flex: none; }
  .doc-row { padding: 12px; gap: 10px; }
  .dr-ic { width: 40px; height: 40px; }
  .dr-go { display: none; }
  .dr-action { min-width: 64px; font-size: .75rem; }
  .page-doc .tabbar { display: none; }
.page-doc .toasts { bottom: 96px; }
  .page-doc { --tabbar: 0px; }
  .page-doc .toasts { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .doc-page { height: calc(100dvh - 61px); }
  .doc-bar { padding: 8px 10px; gap: 8px; }
  .doc-title { font-size: 1.25rem; }
  .doc-meta { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ai-btn { padding: 0 12px; min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .pages-scroll { padding: 26px 0; }
  .action-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .ab-status { font-size: .85rem; text-align: center; }
  .ab-buttons { display: grid; grid-template-columns: 1fr 1.4fr; }
  .ab-buttons > :only-child { grid-column: 1 / -1; }
  .font-grid { grid-template-columns: 1fr 1fr; }
  .sp-canvas-wrap { height: 200px; }
  dialog.sheet { padding: 16px; border-radius: 18px; }
  .steps { grid-template-columns: 1fr; }
  .sig-cards { grid-template-columns: 1fr; }
  .colophon-inner { grid-template-columns: auto 1fr; }
  .made { grid-column: 1 / -1; }
  .verify-drop { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .spin-seal { animation: none !important; }
}
@media print { .letterhead, .tabbar, .colophon, .toolbox, .action-bar { display: none !important; } }
/* Continue with SSO: "private" page (portal says no) */
.sso-private h1 { margin: .1em 0 .4em; }
.sso-private p { max-width: 40ch; margin-left: auto; margin-right: auto; }
.sso-private .btn { margin-top: 10px; }

/* ======================================================================
   Saved signatures (20 Nov 2026): the writing case, the picker, the save tick
   ====================================================================== */
.sig-library { max-width: 1040px; margin: 0 auto; }
.lib-head { position: relative; padding-right: 170px; }
.lib-head .lede { max-width: 62ch; }
.lib-emblem { position: absolute; right: 14px; top: -6px; width: 132px; height: 132px; transform: rotate(-14deg); filter: drop-shadow(0 14px 18px rgba(80,50,10,.35)); animation: emblemIn .9s cubic-bezier(.2,1.4,.4,1) both .15s; }
.lib-emblem svg { width: 100%; height: 100%; }
@keyframes emblemIn { from { opacity: 0; transform: translateY(-30px) rotate(-40deg) scale(1.25); } }
.sig-shelf { position: relative; margin: 0 0 22px; padding: 24px 24px 26px; border-radius: 20px; background:
  linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 60%), var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.sig-shelf::before { content: ''; position: absolute; inset: 7px; border: 1.5px dashed rgba(184, 137, 58, .38); border-radius: 15px; pointer-events: none; }
[data-theme="dark"] .sig-shelf { background: linear-gradient(180deg, rgba(230,196,122,.05), transparent 60%), var(--card); }
.shelf-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.shelf-head h2 { margin: 0; font-size: 1.9rem; }
.shelf-count { font: 700 .8rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); }
.shelf-count.is-full { background: #f6e2b0; color: #5c3d0b; border-color: #d7b064; }
.shelf-lede { margin: 4px 0 16px; font-size: .98rem; }
.sig-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; position: relative; }
[data-shelf="initials"] .sig-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

.sig-tile { position: relative; display: flex; flex-direction: column; border-radius: 16px; background: var(--paper); border: 1px solid var(--line-2); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 24px -18px rgba(15,31,61,.6);
  animation: tileIn .55s cubic-bezier(.2,.9,.3,1.15) both; animation-delay: calc(var(--i, 0) * 70ms); transition: transform .25s cubic-bezier(.3,1.4,.5,1), box-shadow .25s, border-color .25s, opacity .25s; }
@keyframes tileIn { from { opacity: 0; transform: translateY(14px) rotate(-.6deg); } }
.sig-tile:not(.add-tile):hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.sig-tile.is-loading { min-height: 230px; background: linear-gradient(100deg, var(--paper) 30%, var(--bg-2) 50%, var(--paper) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }
.sig-tile.is-default { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,137,58,.22), 0 14px 30px -18px rgba(122,84,25,.9); }
.sig-tile.is-leaving { opacity: 0; transform: scale(.94) rotate(1deg); }
.sig-tile.is-fresh { animation: tileFresh 1.3s ease; }
@keyframes tileFresh { 0% { box-shadow: 0 0 0 0 rgba(230,196,122,.9); } 60% { box-shadow: 0 0 0 14px rgba(230,196,122,0); } }
.tile-paper { position: relative; height: 140px; margin: 10px 10px 0; border-radius: 11px; display: grid; place-items: center; overflow: hidden;
  background: repeating-linear-gradient(0deg, transparent 0 27px, rgba(21,33,59,.07) 27px 28px), #fffcf3; border: 1px solid rgba(21,33,59,.1); }
[data-shelf="initials"] .tile-paper { height: 112px; }
.tile-paper img { position: relative; z-index: 1; max-width: 86%; max-height: 104px; object-fit: contain; filter: drop-shadow(0 .5px 0 rgba(19,37,74,.25)); }
[data-shelf="initials"] .tile-paper img { max-height: 78px; }
.tile-line { position: absolute; left: 9%; right: 9%; bottom: 24%; height: 1.2px; background: rgba(19,37,74,.28); }
.tile-x { position: absolute; left: 7%; bottom: calc(24% + 3px); color: rgba(19,37,74,.35); font-size: 14px; }
.tile-ribbon { position: absolute; top: -9px; left: 16px; z-index: 2; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px 5px 8px; border-radius: 999px; background: var(--wax); color: #4d330b; font: 700 .76rem var(--sans); letter-spacing: .06em; text-transform: uppercase; box-shadow: inset 0 -2px 4px rgba(80,50,10,.35), 0 4px 10px -4px rgba(80,50,10,.7); }
.tile-ribbon .star { width: 15px; height: 15px; fill: #fff3c8; stroke: #6e4a17; stroke-width: 1; }
.tile-meta { padding: 12px 16px 4px; }
.tile-name { margin: 0; font-size: 1.32rem; overflow-wrap: anywhere; }
.tile-meta p { margin: 2px 0 0; color: var(--ink-2); font-size: .9rem; }
.tile-actions { margin-top: auto; display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 6px; padding: 10px; }
.tile-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 4px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font: 600 .84rem/1.1 var(--sans); cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.tile-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-btn:hover { border-color: var(--gold); }
.tile-btn:active { transform: scale(.97); }
.tile-btn:focus-visible, .add-btn:focus-visible, .pick-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile-star .star { stroke: var(--gold-text); }
.tile-star[aria-pressed="true"] { background: linear-gradient(180deg, #fbefcc, #f1d896); color: #5c3d0b; border-color: #d7b064; cursor: default; opacity: 1; }
[data-theme="dark"] .tile-star[aria-pressed="true"] { background: linear-gradient(180deg, #4a3714, #33260d); color: #f3d892; border-color: #8f6420; }
.tile-star[aria-pressed="true"] .star { fill: #d7a94f; stroke: #8f6420; }
.tile-del { color: var(--warn); }
.add-tile { background: transparent; border: 2px dashed rgba(184,137,58,.55); box-shadow: none; min-height: 250px; }
[data-shelf="initials"] .add-tile { min-height: 215px; }
.add-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 20px; border: 0; border-radius: 14px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; transition: background .2s; }
.add-btn:hover { background: rgba(184,137,58,.08); }
.add-plus { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: var(--wax); box-shadow: inset 0 -3px 6px rgba(80,50,10,.35), 0 10px 20px -10px rgba(80,50,10,.8); transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.add-plus svg { width: 30px; height: 30px; stroke: #4d330b; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.add-btn:hover .add-plus { transform: rotate(90deg) scale(1.06); }
.add-label { font: 600 1.3rem var(--serif); }
.add-btn small { color: var(--ink-2); }
.lib-note { display: flex; gap: 8px; align-items: center; margin: 0 4px 22px; }
.lib-note .ic { width: 18px; height: 18px; color: var(--gold-text); flex: none; }
.details-panel { max-width: 720px; }

/* the save tick on the signature pad */
.sp-keep { margin-top: 14px; }
.keep-tick { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; transition: border-color .2s, background .2s; }
.keep-tick:hover { border-color: var(--gold); }
.keep-tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kt-box { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--gold); display: grid; place-items: center; background: var(--card); transition: background .2s, transform .2s; }
.kt-box .ic { width: 20px; height: 20px; stroke: #4d330b; stroke-width: 2.6; opacity: 0; transform: scale(.4) rotate(-12deg); transition: opacity .2s, transform .3s cubic-bezier(.3,1.6,.5,1); }
.keep-tick input:checked + .kt-box { background: var(--wax); border-color: #8f6420; box-shadow: inset 0 -2px 4px rgba(80,50,10,.35); }
.keep-tick input:checked + .kt-box .ic { opacity: 1; transform: none; }
.keep-tick input:focus-visible + .kt-box { outline: 3px solid var(--focus); outline-offset: 2px; }
.keep-tick input:disabled + .kt-box { opacity: .5; }
.kt-text { display: grid; gap: 2px; }
.kt-text strong { font-size: 1.04rem; }
.kt-text small { color: var(--ink-2); font-size: .9rem; }
.sp-keep-note { margin: 8px 2px 0; }
.sp-name-field { margin-top: 12px; }
.sigpad.is-once .keep-tick { border-style: dashed; }

/* the picker in the editor */
dialog.picker { width: min(860px, calc(100vw - 16px)); }
.picker-lede { margin: -4px 0 14px; }
.picker-grid { list-style: none; margin: 0; padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; max-height: min(56vh, 560px); overflow: auto; }
.picker.is-initials .picker-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.pick-card { position: relative; display: flex; flex-direction: column; width: 100%; padding: 10px; gap: 8px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font: inherit; text-align: center; cursor: pointer; transition: transform .2s cubic-bezier(.3,1.4,.5,1), box-shadow .2s, border-color .2s; }
.pick-card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.pick-card.is-default { border-color: var(--gold); }
.pick-card.is-current { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.pc-paper { display: grid; place-items: center; height: 118px; border-radius: 10px; background: repeating-linear-gradient(0deg, transparent 0 25px, rgba(21,33,59,.07) 25px 26px), #fffcf3; border: 1px solid rgba(21,33,59,.1); }
.picker.is-initials .pc-paper { height: 92px; }
.pc-paper img { max-width: 88%; max-height: 96px; object-fit: contain; }
.pc-name { font: 600 1.15rem var(--serif); overflow-wrap: anywhere; }
.pc-use { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 999px; font: 700 1.05rem var(--sans); color: #2a1b04; background: linear-gradient(180deg, #f3d892 0, #d7a94f 45%, #b7862f 100%); border: 1px solid #8f6420; box-shadow: inset 0 1px 0 rgba(255,255,255,.65); }
.pick-card.is-current .pc-use { background: var(--navy); color: var(--gold-hi); border-color: var(--navy-3); box-shadow: none; }
.pc-star { position: absolute; top: -8px; left: 14px; display: inline-flex; gap: 4px; align-items: center; padding: 4px 10px 4px 7px; border-radius: 999px; background: var(--wax); color: #4d330b; font: 700 .72rem var(--sans); letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 4px 10px -4px rgba(80,50,10,.7); z-index: 1; }
.pc-star .star { width: 14px; height: 14px; fill: #fff3c8; stroke: #6e4a17; stroke-width: 1; }
.picker-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.picker-foot .btn { flex: 1 1 240px; min-height: 54px; }
.picker-manage { margin: 12px 0 0; text-align: center; }
.tb-defaults { width: 100%; margin-top: 10px; }

@media (max-width: 700px) {
  .lib-head { padding-right: 0; }
  .lib-emblem { width: 76px; height: 76px; right: 0; top: -10px; }
  .sig-shelf { padding: 18px 14px 18px; border-radius: 16px; }
  .shelf-head h2 { font-size: 1.6rem; }
  .sig-grid, [data-shelf="initials"] .sig-grid { grid-template-columns: 1fr; gap: 16px; }
  .add-tile, [data-shelf="initials"] .add-tile { min-height: 170px; }
  .picker-grid, .picker.is-initials .picker-grid { grid-template-columns: 1fr 1fr; gap: 10px; max-height: 52vh; }
  .pc-paper { height: 88px; } .pc-name { font-size: 1rem; } .pc-use { min-height: 46px; font-size: .95rem; }
  .tb-defaults { width: auto; margin: 0; }
}
