/* ==========================================================================
   Assentra — midnight ink on warm paper, iris for actions and seal gold for
   the moments that matter in signing. Fraunces for headings, Inter for text.
   ========================================================================== */

:root {
  /* Assentra palette: midnight ink, iris for action, seal gold for signing moments */
  --ink: #1B1F3B;
  --ink-soft: #2A2F55;
  --paper: #F7F6F2;
  --paper-2: #EFEDE6;
  --tint: #E4E4FB;
  --gold: #C9A24A;
  --gold-soft: #F6EED9;

  /* Semantic tokens */
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #EFEDE6;
  --border: rgba(27, 31, 59, 0.12);
  --border-strong: rgba(27, 31, 59, 0.22);
  --text: #1B1F3B;
  --muted: rgba(27, 31, 59, 0.62);
  --primary: #1B1F3B;
  --primary-soft: #E4E4FB;
  --accent: #5B5BD6;
  --accent-soft: #ECECFD;
  --danger: #C8423F;
  --danger-soft: #FBE4E2;
  --success: #2F7D57;

  /* Tracked changes */
  --ins: #1D6E8C;
  --ins-soft: #E2F0F5;
  --del: #C0392B;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 31, 59, 0.04), 0 10px 30px rgba(27, 31, 59, 0.06);
  --font-display: "Fraunces", Georgia, serif;
  /* Contracts themselves: a text serif made for long reading on screen. */
  --font-doc: "Literata", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The nib's slit is cut in the background colour. */
  --mark-cut: #F7F6F2;
  --font-hand: "Caveat", "Segoe Script", "Brush Script MT", cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
  overflow-x: hidden;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
::selection { background: var(--tint); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- helpers ---------- */
/* One width everywhere, so the header never shifts between pages; the
   document view and editor (850px paper + sidebar) fit inside it. */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }
.container--wide { max-width: 1280px; }
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.top-gap { margin-top: 14px; }
.center { text-align: center; }
.section { margin-top: 32px; }

.eyebrow {
  display: inline-block;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow a { color: var(--muted); }
.eyebrow a:hover { color: var(--accent); }

/* Dashed rules */
.brand-rule {
  border: none; height: 1px; margin: 16px 0;
  color: var(--border-strong);
  background-image: linear-gradient(to right, currentColor 50%, transparent 50%);
  background-size: 12px 1px; background-repeat: repeat-x; background-position: left center;
}
.rule-accent {
  border: none; width: 40px; height: 2px; color: var(--gold); margin: 14px 0 0;
  background-image: linear-gradient(to right, currentColor 50%, transparent 50%);
  background-size: 10px 2px; background-repeat: repeat-x; background-position: left center;
}

/* ---------- topbar ---------- */
.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  height: 64px; display: flex; align-items: center;
  position: sticky; top: 0; z-index: 40;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brandmark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brandmark { color: var(--ink); gap: 10px; }
.brandmark:hover { color: var(--ink); }
.brandmark .mark { width: 30px; height: 30px; display: block; flex: none; }
.wordmark { font-family: var(--font-display); font-weight: 650; font-size: 22px; letter-spacing: -0.02em; line-height: 1; }
.org-chip {
  margin-right: auto; padding: 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.topbar-right { display: flex; align-items: center; gap: 22px; min-width: 0; }

.nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap;
  padding: 4px 0; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--accent); }

.account { position: relative; }
.account > summary { list-style: none; }
.account > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  display: grid; place-items: center; cursor: pointer; user-select: none;
}
.avatar:hover { background: var(--paper-2); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.menu {
  position: absolute; right: 0; top: 44px; min-width: 250px; padding: 14px;
  box-shadow: var(--shadow); z-index: 60;
}
.menu-head { margin-bottom: 4px; }
.menu .brand-rule { margin: 10px 0 8px; }
.menu-item {
  display: block; padding: 8px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; color: var(--ink);
}
.menu-item:hover { background: var(--paper-2); color: var(--ink); }

.main { padding: 40px 0 72px; }

/* ---------- page heading ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { min-width: 0; }
.page-title h1 { font-size: 1.8rem; margin-top: 6px; line-height: 1.2; overflow-wrap: anywhere; }
.page-sub { margin-top: 8px; font-size: 14.5px; max-width: 62ch; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.greeting { margin-bottom: 28px; }
.greeting h1 { font-size: 1.8rem; margin-top: 6px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; min-width: 0;
}
.card + .card, .disclosure + .card, .card + .disclosure { margin-top: 14px; }
.narrow-card { max-width: 760px; }
.narrow-card.center { max-width: 520px; margin: 24px auto; padding: 36px; }
.narrow-card.center h1 { font-size: 1.4rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
a.stat:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-2px); }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { margin-top: 6px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- buttons (pills) ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  padding: 9px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; font-family: inherit; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--paper-2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.sm { padding: 5px 13px; font-size: 13px; }
.btn.block { width: 100%; padding: 12px 18px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

/* ---------- forms ---------- */
label.field { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }
.field-group { margin-bottom: 16px; }
.field-group:last-child { margin-bottom: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=search], input[type=number], textarea, select {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
input[type=file] { font-family: inherit; font-size: 13.5px; }
input::placeholder, textarea::placeholder { color: rgba(27, 31, 59, .4); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 14px 16px; margin-bottom: 16px; }
.grid-form .field-group { margin: 0; }
@media (max-width: 720px) { .grid-form { grid-template-columns: 1fr; } }

/* ---------- badges, alerts, tabs ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px; background: var(--tint); color: var(--ink);
}
.badge.gray { background: var(--paper-2); color: var(--muted); }
.badge.green { background: var(--tint); color: var(--ink-soft); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(212, 72, 74, .35);
}
.alert.info { background: var(--primary-soft); color: var(--ink-soft); border-color: rgba(27, 31, 59, .18); }
.alert a { text-decoration: underline; text-underline-offset: 2px; }
.flash { margin-bottom: 22px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: 11px 14px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.empty {
  text-align: center; padding: 44px 24px; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty-action { margin-top: 14px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
a.list-item:hover { border-color: var(--accent); color: var(--ink); box-shadow: var(--shadow); }
.list-item.compact { padding: 10px 14px; }
.item-icon {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; background: var(--paper-2); color: var(--ink);
}
.item-icon.folder { background: var(--tint); }
.item-icon svg { width: 20px; height: 20px; }
.item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-title { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.progress { color: var(--muted); font-weight: 700; white-space: nowrap; }
.priority-item { position: relative; overflow: hidden; }
.priority-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }

/* ---------- disclosure ---------- */
.disclosure { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 14px; }
.disclosure > summary {
  cursor: pointer; list-style: none; padding: 14px 18px;
  font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 10px; border-radius: var(--radius);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--paper); }
.disclosure-mark { width: 18px; height: 18px; flex: none; border-radius: 6px; background: var(--tint); position: relative; }
.disclosure-mark::before, .disclosure-mark::after {
  content: ''; position: absolute; background: var(--ink); border-radius: 1px;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.disclosure-mark::before { width: 9px; height: 1.6px; }
.disclosure-mark::after { width: 1.6px; height: 9px; transition: opacity .15s; }
.disclosure[open] > summary { border-bottom: 1px dashed var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; }
.disclosure[open] .disclosure-mark::after { opacity: 0; }
.disclosure-body { padding: 18px; }
.action-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; align-items: start; }
.action-cards .disclosure { margin-top: 0; }
@media (max-width: 760px) { .action-cards { grid-template-columns: 1fr; } }

/* ---------- repository ---------- */
.repo { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .repo { grid-template-columns: minmax(0, 1fr); } }
.repo-side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 860px) { .repo-side { position: static; } }
.folder-tree { padding: 10px; }
.folder-tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.folder-tree > ul { padding-left: 0; }
.folder-tree a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.folder-tree a svg { width: 17px; height: 17px; flex: none; }
.folder-tree a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tree a:hover { background: var(--paper); color: var(--ink); }
.folder-tree a.active { background: var(--primary-soft); color: var(--ink); }
.new-folder { padding: 14px; }
.new-folder .row { gap: 8px; }
.search { display: flex; gap: 8px; margin-bottom: 8px; }

/* ---------- document page ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } }
.doc-side .card .eyebrow { margin-bottom: 4px; }
dl.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 9px 12px; margin: 12px 0 0; align-items: baseline; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.notes { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper); font-size: 13.5px; white-space: pre-wrap; }
.versions { list-style: none; margin: 12px 0 0; padding: 0; }
.version { padding: 11px 0; border-bottom: 1px dashed var(--border-strong); }
.version:last-child { border-bottom: 0; }
.version-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-weight: 700; }
.version-links a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.version-links .btn { padding: 2px 8px; font-size: 12.5px; }
.compare { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.compare .row { gap: 8px; }
.compare select { padding: 6px 30px 6px 10px; }
.file-card { display: flex; align-items: center; gap: 16px; }
.file-card > div { flex: 1; }
.pdf-frame { width: 100%; height: 78vh; min-height: 540px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

/* The paper: a contract reads as a page, not a web form. */
.paper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: var(--shadow);
  padding: 72px 80px; min-height: 900px;
  max-width: 850px; margin: 0 auto;
}
@media (max-width: 760px) { .paper { padding: 32px 22px; min-height: 0; } }
.doc-body { font-family: var(--font-doc); font-size: 16px; line-height: 1.7; color: #1d2030; font-optical-sizing: auto; overflow-wrap: anywhere; }
.doc-body h1, .doc-body h2, .doc-body h3 { font-family: var(--font-doc); font-weight: 700; letter-spacing: 0; }
.doc-body h1 { font-size: 1.6rem; text-align: center; margin: 0 0 24px; }
.doc-body h2 { font-size: 1.12rem; margin: 26px 0 8px; }
.doc-body h3 { font-size: 1rem; margin: 20px 0 6px; }
.doc-body p { margin: 0 0 12px; }
.doc-body ul, .doc-body ol { margin: 0 0 12px; padding-left: 28px; }
.doc-body li { margin-bottom: 4px; }
.doc-body blockquote { margin: 0 0 12px; padding-left: 16px; border-left: 3px solid var(--tint); font-style: italic; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 14.5px; }
.doc-body td, .doc-body th { border: 1px solid var(--border-strong); padding: 6px 9px; vertical-align: top; }
.doc-body hr { border: 0; border-top: 1px solid var(--border-strong); margin: 22px 0; }
.doc-body:focus { outline: none; }

/* Tracked changes and redlines */
.doc-body ins { color: var(--ins); background: var(--ins-soft); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.doc-body del { color: var(--del); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.doc-body ins[data-author], .doc-body del[data-author] { cursor: help; }
.doc-body ins.is-focus, .doc-body del.is-focus { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
.legend { display: flex; gap: 18px; margin-bottom: 14px; justify-content: center; }
.legend ins { color: var(--ins); background: var(--ins-soft); text-decoration: underline; padding: 1px 5px; }
.legend del { color: var(--del); text-decoration: line-through; padding: 1px 5px; }

/* ---------- editor ---------- */
.editor-shell { display: block; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 8px 12px; margin-bottom: 18px; position: sticky; top: 72px; z-index: 20;
  box-shadow: var(--shadow);
}
.tool-group { display: flex; gap: 2px; align-items: center; }
.tool-group + .tool-group { padding-left: 14px; border-left: 1px solid var(--border); }
.grow-right { margin-left: auto; border-left: 0 !important; }
.tool {
  appearance: none; border: 0; background: transparent; color: var(--ink);
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; min-width: 34px;
}
.tool:hover { background: var(--paper-2); }
.tool.is-on { background: var(--primary-soft); }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.tracking-on { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.tracking-on::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.redline-out { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 1080px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } }
.editor-side { position: sticky; top: 140px; }
@media (max-width: 1080px) { .editor-side { position: static; } }
.editor-shell.is-tracking .paper { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.changes { list-style: none; margin: 12px 0 0; padding: 0; max-height: 46vh; overflow: auto; }
.changes li { padding: 10px 0; border-bottom: 1px dashed var(--border-strong); }
.changes li:last-child { border-bottom: 0; }
.change-kind { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.change-kind.ins { color: var(--ins); }
.change-kind.del { color: var(--del); }
.change-text { font-family: var(--font-display); font-size: 14px; margin: 3px 0 6px; overflow-wrap: anywhere; cursor: pointer; }
.change-actions { display: flex; gap: 6px; }

/* ---------- envelopes ---------- */
.parties { display: flex; flex-direction: column; margin-top: 8px; }
.party { padding: 14px 0; border-bottom: 1px dashed var(--border-strong); }
.party:last-child { border-bottom: 0; padding-bottom: 0; }
.party-head { display: flex; align-items: center; gap: 12px; }
.order {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--accent); background: var(--accent-soft);
}
.party-meta { margin: 6px 0 0 40px; }
.sig-thumb { display: block; max-width: 220px; max-height: 70px; margin: 8px 0 0 40px; }
.link-row { display: flex; gap: 8px; margin-left: 40px; }
.link-row input { font-size: 12.5px; padding: 7px 10px; font-family: ui-monospace, Menlo, monospace; }
.link-row + .muted { margin: 6px 0 0 40px; }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; }
.timeline li { padding: 11px 0 11px 18px; border-left: 2px solid var(--tint); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.event-detail { margin-top: 4px; color: var(--ink-soft); overflow-wrap: anywhere; }

.party-rows { display: flex; flex-direction: column; gap: 8px; }
.party-row { display: grid; grid-template-columns: 70px 1fr 1.2fr 150px 36px; gap: 8px; align-items: center; }
.party-row--head { font-weight: 700; padding: 0 4px; }
.order-input input { text-align: center; padding: 10px 6px; }
@media (max-width: 720px) {
  .party-row { grid-template-columns: 60px 1fr 36px; }
  .party-row > :nth-child(3), .party-row > :nth-child(4) { grid-column: 2 / 3; }
  .party-row--head { display: none; }
}

/* ---------- signing ceremony ---------- */
.sign-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .sign-layout { grid-template-columns: minmax(0, 1fr); } }
.sign-layout > aside { position: sticky; top: 88px; }
@media (max-width: 980px) { .sign-layout > aside { position: static; } }
.sig-modes { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 12px; }
.sig-pad { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--paper); height: 130px; overflow: hidden; }
.sig-typed {
  position: absolute; inset: 0 14px 30px; display: flex; align-items: flex-end;
  font-family: var(--font-hand); font-size: 46px; line-height: 1; color: var(--ink);
  white-space: nowrap; overflow: hidden;
}
#sig-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; left: 14px; right: 14px; bottom: 26px; border-bottom: 1px solid var(--ink); pointer-events: none; opacity: .5; }
.sig-clear { position: absolute; right: 6px; top: 6px; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; margin: 16px 0; cursor: pointer; }
.consent input { accent-color: var(--ink); width: 16px; height: 16px; margin-top: 2px; flex: none; }

/* ---------- team (account admin look) ---------- */
.user-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.user-card + .user-card { margin-top: 10px; }
.user-head { display: flex; align-items: center; gap: 14px; padding: 15px 18px; flex-wrap: wrap; }
.u-id { min-width: 200px; }
.u-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; }
.u-badges { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.user-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px dashed var(--border-strong); padding: 12px 18px; }
.user-actions select { width: auto; padding: 5px 30px 5px 10px; font-size: 13px; }

/* ---------- message pages (sign-in states) ---------- */
.message-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 20px; }
.message-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 40px 36px; width: min(460px, 100%); text-align: center;
}
.message-logo { display: flex; justify-content: center; margin-bottom: 26px; }
.message-logo .wordmark { font-size: 24px; }
.message-logo .mark { width: 34px; height: 34px; }
/* On white cards the slit is cut in white. */
.message-card, .card { --mark-cut: #FFFFFF; }
.message-card h1 { font-size: 1.4rem; margin-bottom: 10px; }
.message-card p { font-size: 14.5px; line-height: 1.55; margin-bottom: 10px; }
.page-foot { font-size: 12px; color: var(--muted); text-align: center; }
.page-foot--light { padding: 0 0 32px; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .main { padding: 26px 0 56px; }
  .org-chip { max-width: 120px; }
  .topbar-right { gap: 14px; }
  .nav { gap: 14px; }
  .page-title h1, .greeting h1 { font-size: 1.45rem; }
  .card { padding: 18px; }
  .list-item { padding: 12px 14px; gap: 12px; }
  .list-item .badge { display: none; }
  .toolbar { top: 64px; }
  .tool-group + .tool-group { padding-left: 6px; }
}

@media print {
  .topbar, .page-actions, .legend, .flash { display: none; }
  body { background: #fff; }
  .main { padding: 0; }
  .paper { box-shadow: none; border: 0; padding: 0; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- drop-or-click upload zone ---------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; cursor: pointer;
  padding: 26px 20px; margin-bottom: 16px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--ink); background: var(--paper-2); }
.dropzone:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--primary-soft); }
.dropzone.is-over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--ink); background: var(--surface); }
/* Visually hidden but still focusable and clickable through the label. */
.dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--tint); }
.dropzone-icon svg { width: 22px; height: 22px; }
.dropzone.is-over .dropzone-icon { background: var(--surface); color: var(--accent); }
.dropzone-prompt { font-size: 14.5px; }
.dropzone-link { font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.dropzone-file { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.dropzone.has-file .dropzone-prompt { order: 2; font-size: 13px; }
.dropzone-hint { font-size: 12.5px; color: var(--muted); max-width: 46ch; line-height: 1.45; }
.dropzone--compact { padding: 16px; margin-bottom: 0; flex-direction: row; gap: 12px; text-align: left; justify-content: flex-start; }
.dropzone--compact .dropzone-icon { width: 36px; height: 36px; flex: none; }

/* ---------- stages and approval gates ---------- */
.badge.amber { background: #FBEBD3; color: #9A5B13; }
.badge.mint { background: var(--tint); color: var(--ink); }
.badge.ink { background: var(--ink); color: var(--paper); }

.stage-tracker {
  list-style: none; margin: -8px 0 22px; padding: 0;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0;
}
.stage-tracker li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; }
.stage-tracker li::before {
  content: ''; position: absolute; top: 7px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); z-index: 0;
}
.stage-tracker li:first-child::before { display: none; }
.stage-tracker li.is-done::before, .stage-tracker li.is-current::before { background: var(--ink); }
.stage-dot {
  position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-strong);
}
.stage-tracker li.is-done .stage-dot { background: var(--ink); border-color: var(--ink); }
.stage-tracker li.is-current .stage-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stage-name { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.stage-tracker li.is-done .stage-name { color: var(--ink-soft); }
.stage-tracker li.is-current .stage-name { color: var(--ink); }
@media (max-width: 640px) {
  .stage-name { display: none; }
  .stage-tracker li.is-current .stage-name { display: block; position: absolute; top: 22px; white-space: nowrap; }
  .stage-tracker { margin-bottom: 34px; }
}

.next-step { border-color: var(--ink); position: relative; overflow: hidden; }
.next-step::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.approvers { list-style: none; margin: 12px 0 0; padding: 0; }
.approvers li { padding: 9px 0; border-bottom: 1px dashed var(--border-strong); }
.approvers li:last-child { border-bottom: 0; }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.check-row:hover { border-color: var(--ink); }
.check-row input { accent-color: var(--ink); width: 16px; height: 16px; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-row .field-group { margin: 0; }
.lock-note { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper); font-size: 13.5px; }

/* ---------- send form: parties and signature blocks ---------- */
.send-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 24px; align-items: start; }
@media (max-width: 1080px) { .send-layout { grid-template-columns: minmax(0, 1fr); } }
.send-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.send-main .card + .card { margin-top: 0; }
.send-preview { position: sticky; top: 88px; min-width: 0; }
@media (max-width: 1080px) { .send-preview { position: static; } }
.paper--preview { min-height: 0; padding: 36px 32px; font-size: 12.5px; max-height: 78vh; overflow: auto; }
.party-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.party-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--paper); }
.party-card .party-row input, .party-card .party-row select { background: var(--surface); }
.party-block { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.party-card.is-cc .party-block { display: none; }
.block-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.block-grid .field-group { margin: 0; }
@media (max-width: 640px) { .block-grid { grid-template-columns: 1fr; } }
.notice-details { margin-top: 10px; }
.notice-details > summary { cursor: pointer; font-size: 13px; font-weight: 700; padding: 4px 0; color: var(--ink-soft); }
.notice-details[open] > summary { margin-bottom: 10px; }
.notice-details .field-group { margin-top: 10px; }
.notice-details textarea { min-height: 0; }

/* ---------- the signature page (paper view) ---------- */
.sig-page { font-family: var(--font-doc); color: #000; }
.paper > .sig-page, .sig-page-wrap .sig-page { margin-top: 48px; padding-top: 40px; border-top: 1px dashed var(--border-strong); }
.sig-page-wrap { max-width: 850px; margin: 24px auto 0; }
.sig-page-wrap .paper { min-height: 0; }
.sig-page-wrap .sig-page { margin: 0; padding: 0; border: 0; }
.sp-witness { text-indent: 2.4em; margin: 0 0 40px; }
.sp-blocks { margin-left: 50%; }
@media (max-width: 760px) { .sp-blocks { margin-left: 0; } }
.paper--preview .sp-blocks { margin-left: 34%; }
.sp-block { margin-bottom: 44px; }
.sp-block p { margin: 0; }
.sp-heading { font-weight: 700; margin-bottom: 26px !important; }
.sp-entity { border-bottom: 1px solid #000; padding-bottom: 1px; }
.sp-caption { font-style: italic; }
.sp-line { position: relative; height: 58px; border-bottom: 1px solid #000; margin-top: 22px; }
.sp-block.is-current .sp-line { background: linear-gradient(to top, var(--accent-soft), transparent 80%); }
.sig-here, .sig-awaiting {
  position: absolute; left: 8px; bottom: 6px; font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.sig-here { color: var(--accent); }
.sig-awaiting { color: var(--muted); }
.sig-stamp {
  position: absolute; left: 24%; bottom: -10px; display: flex; flex-direction: column;
  padding: 2px 0 1px 9px; border: 1.5px solid #22507a; border-right: 0; border-radius: 6px 0 0 6px;
  font-family: Helvetica, Arial, sans-serif;
}
.sig-stamp-label { font-size: 8px; font-weight: 700; color: #1a1a1a; }
.sig-stamp img { height: 30px; width: auto; max-width: 170px; object-fit: contain; object-position: left; }
.sig-stamp-typed { font-family: var(--font-hand); font-size: 26px; line-height: 30px; color: var(--ink); }
.sig-stamp-id { font-size: 7px; color: #444; letter-spacing: .02em; }
.sp-notice { margin-top: 34px; }
.sp-notice p + p { margin-top: 12px; }
.sp-notice-head { font-weight: 700; font-style: italic; }
.paper--preview > .sig-page { margin: 0; padding: 0; border: 0; }

/* ---------- entity chains (send form and signature page) ---------- */
.entity-layers { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.entity-layers .add-layer { align-self: flex-start; }
.entity-layer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--surface); }
.entity-layer--by { margin-left: 18px; border-left: 3px solid var(--tint); }
.entity-layer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; min-height: 24px; }
.entity-layer-head .btn { padding: 0 8px; }
.entity-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 8px; }
.entity-layer--by .entity-grid { grid-template-columns: 1.4fr 1fr 1.4fr 1fr; }
.entity-grid > span:empty { display: none; }
@media (max-width: 720px) { .entity-grid, .entity-layer--by .entity-grid { grid-template-columns: 1fr; } }

.sp-entity { margin: 0; }
.sp-by { padding-left: 2.1em; text-indent: -2.1em; margin-top: 8px !important; }
.sp-sign { display: flex; align-items: flex-end; gap: 6px; margin-top: 22px; }
.sp-sign .sp-line { flex: 1; margin-top: 0; }
.sp-by-label { padding-bottom: 2px; }
.sp-entity + .sp-sign, .sp-heading + .sp-sign { margin-top: 26px; }
/* Entity lines read as text in the new format — no underline, no caption. */
.sig-page .sp-entity { border-bottom: 0; padding-bottom: 0; }
.sp-follows { text-align: center; font-style: italic; font-family: var(--font-doc); margin: 28px 0 0 !important; }
.sp-follows--file { margin-top: 18px !important; font-style: normal; font-family: var(--font-sans); font-size: 13.5px; }
/* One page per signer: a page break between them on screen, a real one in print. */
.sp-page + .sp-page { margin-top: 40px; padding-top: 44px; border-top: 2px dashed var(--border-strong); position: relative; }
.sp-page + .sp-page::before {
  content: 'New page'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--surface); padding: 0 10px; font-family: var(--font-sans); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.sp-page .sp-block { margin-bottom: 0; }
@media print { .sp-page + .sp-page { break-before: page; border-top: 0; margin-top: 0; padding-top: 0; } .sp-page + .sp-page::before { display: none; } }
.sp-footer { text-align: center; margin: 48px 0 0 !important; }

/* Party and Counterparty side by side */
.side-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.side-row .field-group { margin: 0; }
@media (max-width: 640px) { .side-row { grid-template-columns: 1fr; } }
.search select { width: auto; flex: none; max-width: 220px; }

/* ---------- estimated page breaks (editor overlay) ---------- */
.paper-wrap { position: relative; }
.page-breaks { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.page-break { position: absolute; height: 0; border-top: 1.5px dashed var(--accent); opacity: .85; }
.page-break span {
  position: absolute; right: 10px; top: -10px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font: 700 10px/16px var(--font-sans); letter-spacing: .1em; text-transform: uppercase;
}
@media print { .page-breaks { display: none; } }

/* ---------- tables in the editor ---------- */
.doc-body table { table-layout: auto; }
.doc-body th { background: var(--paper); font-weight: 700; text-align: left; }
#editor td, #editor th { min-width: 64px; height: 30px; }
/* Table tools float just above the table being edited, not in the header. */
.table-tools {
  position: absolute; z-index: 5; display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  padding: 4px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: 0 6px 18px rgba(27, 31, 59, .14);
}
.table-tools[hidden] { display: none; }
.table-tools .tool { padding: 5px 9px; font-size: 12.5px; }
.tool--danger { color: var(--danger); }
.tool--danger:hover { background: var(--danger-soft); }

/* ---------- signer verification ---------- */
.verify-card {
  max-width: 440px; margin: 32px auto; padding: 36px 36px 28px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.verify-icon {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: var(--tint); color: var(--ink); margin-bottom: 18px;
}
.verify-icon svg { width: 28px; height: 28px; }
.verify-doc { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); margin: 4px 0 18px !important; }
.verify-card h1 { font-size: 1.55rem; }
.verify-lead { color: var(--muted); font-size: 15px; line-height: 1.55; margin: 10px 0 22px !important; max-width: 38ch; text-wrap: balance; }
.verify-lead strong { color: var(--ink); }
.verify-alert { width: 100%; margin: -6px 0 16px; text-align: left; }
.verify-card form { width: 100%; }
.verify-fine { font-size: 12px; color: var(--muted); margin-top: 10px !important; }
.verify-foot {
  width: 100%; margin-top: 26px !important; padding-top: 16px; border-top: 1px dashed var(--border-strong);
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
}

/* Six digit boxes over one real input: typing, paste and SMS autofill all just work. */
.otp { position: relative; margin-bottom: 18px; }
.otp-input {
  font-size: 26px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums;
}
.otp-cells { display: none; }
.otp.is-enhanced .otp-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; z-index: 2; cursor: text;
  border: 0; padding: 0; min-height: 0; caret-color: transparent;
}
.otp.is-enhanced .otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-cell {
  height: 58px; display: grid; place-items: center; border-radius: 12px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; transition: border-color .12s, box-shadow .12s, background .12s;
}
.otp-cell.is-filled { background: var(--paper); }
.otp.is-focused .otp-cell.is-active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--primary-soft); }
.otp.is-focused .otp-cell.is-active:empty::after {
  content: ''; width: 2px; height: 26px; background: var(--ink); animation: otp-caret 1s steps(1) infinite;
}
@keyframes otp-caret { 50% { opacity: 0; } }
.otp.is-error .otp-cell { border-color: var(--danger); }
@media (max-width: 400px) { .otp-cell { height: 50px; font-size: 22px; } .otp.is-enhanced .otp-cells { gap: 6px; } .verify-card { padding: 28px 20px 22px; } }

.verify-resend { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-top: 16px; font-size: 13.5px; }
.link-button {
  appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; cursor: pointer;
}
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.verify-row { margin-bottom: 12px; }
.verify-row .field-group { margin: 0; }
.verify-row input { max-width: 340px; }
.verified { color: var(--success); font-weight: 700; }
.nowrap { white-space: nowrap; }

/* ---------- company presets ---------- */
.company-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.company-form fieldset .card + .card { margin-top: 0; }
.company-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 12px 14px; }
.company-grid--2 { grid-template-columns: 1fr 1fr; }
.company-grid .field-group { margin: 0; }
@media (max-width: 760px) { .company-grid, .company-grid--2 { grid-template-columns: 1fr; } }
.signer-rows { display: flex; flex-direction: column; gap: 8px; }
.signer-row { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr 1fr 36px; gap: 8px; }
@media (max-width: 760px) { .signer-row { grid-template-columns: 1fr 36px; } .signer-row > :nth-child(n+2):not(:last-child) { grid-column: 1; } }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; padding: 10px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.preset-row .field-group { margin: 0; }
.preset-row label.field { font-size: 11px; }
.signer-row { grid-template-columns: 150px 1.2fr 1fr 1.2fr 1fr 36px; }
.package-preview { max-height: none; padding: 28px 24px; }
.package-preview .sp-blocks { margin-left: 30%; }
.package-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.package-bar label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.package-bar select { width: auto; max-width: 220px; padding: 6px 30px 6px 10px; }
.package-summary ul { list-style: none; margin: 8px 0 0; padding: 0; }
.package-summary li { padding: 8px 0; border-bottom: 1px dashed var(--border-strong); }
.package-summary li:last-child { border-bottom: 0; }

/* One row of form actions: primary on the left, destructive on the right. */
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; margin-top: 4px; border-top: 1px dashed var(--border-strong); }
.form-actions-main { display: flex; align-items: center; gap: 8px; }
.form-actions form { margin: 0; }
@media (max-width: 640px) {
  .form-actions { flex-wrap: nowrap; gap: 6px; }
  .form-actions-main { gap: 2px; }
  .form-actions .btn { padding: 9px 13px; }
}
@media (max-width: 380px) { .form-actions .btn { padding: 8px 10px; font-size: 13px; } }
@media (max-width: 345px) { .form-actions { flex-wrap: wrap; } .form-actions > form { margin-left: auto; } }
.approver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.approver-why { font-size: 12px; font-weight: 700; color: var(--ink-soft); background: var(--tint); padding: 1px 8px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.approver-why.is-required { background: var(--accent-soft); color: var(--accent); }
.check-row.is-locked { background: var(--paper); cursor: default; }
.locked-check {
  flex: none; width: 16px; height: 16px; border-radius: 4px; background: var(--ink); position: relative;
}
.locked-check::after {
  content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px;
  border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ---------- PDFs viewed in the page ---------- */
.pdf-viewer { display: flex; flex-direction: column; gap: 10px; }
.pdf-viewer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pdf-viewer-title { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { margin-bottom: 12px; }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.import-grid .field-group { margin: 0; }
.import-form { display: flex; flex-direction: column; gap: 14px; }
.import-form .card + .card { margin-top: 0; }
.table-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.import-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.import-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px 8px; }
.import-table td { padding: 6px; vertical-align: top; border-top: 1px dashed var(--border-strong); }
.import-table td:first-child { min-width: 240px; }
.import-table td:first-child a { display: inline-block; margin-top: 4px; }
.import-table input, .import-table select { padding: 7px 9px; font-size: 13.5px; }
.import-table select { padding-right: 28px; }

/* "← Back to …" above a page's heading. */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-soft);
}
.back-link span { transition: transform .15s; }
.back-link:hover { color: var(--ink); }
.back-link:hover span { transform: translateX(-3px); }

/* ---------- sign-in, two-step and account security ---------- */
.auth-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .eyebrow { margin-bottom: 4px; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }
.auth-card form { width: 100%; }
.auth-form { display: flex; flex-direction: column; text-align: left; width: 100%; }
.auth-form label.field { margin-top: 14px; }
.auth-form label.field:first-of-type, .auth-form input[type=hidden] + label.field { margin-top: 0; }
.auth-form .btn { margin-top: 20px; }
.auth-form .hint { margin-top: 8px; }
.auth-form.narrow { max-width: 380px; }
.auth-form.narrow .btn { align-self: flex-start; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.field-row label.field { margin: 0 0 6px; }
.field-row a { color: var(--accent); font-weight: 600; }
.auth-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin-top: 18px !important; font-size: 13.5px; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-switch span { color: var(--border-strong); }
.verify-foot a { color: var(--accent); font-weight: 600; }
.verify-foot .inline-form { display: inline-flex; width: auto; margin-left: 4px; vertical-align: baseline; }
.verify-form label.field { text-align: left; }

.qr { width: 184px; height: 184px; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 14px; margin: 4px auto 14px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-manual { width: 100%; margin-bottom: 18px; font-size: 13.5px; }
.qr-manual summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
.qr-manual summary::-webkit-details-marker { display: none; }
.qr-manual p { margin-top: 8px !important; }
.secret { font-size: 15px; letter-spacing: .08em; color: var(--ink); background: var(--paper); border-radius: 10px; padding: 10px; }

.method-list { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.method-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
a.method-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }
.method-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.method-card strong { display: flex; align-items: center; gap: 8px; }
.method-card.is-on { background: var(--paper); border-style: dashed; }
.method-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); flex: none; }
.method-icon svg { width: 22px; height: 22px; }
.method-go { color: var(--accent); font-weight: 700; }

.recovery-codes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; width: 100%; margin: 0 0 20px; padding: 16px 20px 16px 38px;
  background: var(--paper); border: 1px dashed var(--border-strong); border-radius: 12px; font-size: 14.5px; text-align: left;
}
.recovery-codes li { padding-left: 2px; }
.form-actions--center { justify-content: center; width: 100%; }

.security-rows { display: flex; flex-direction: column; }
.security-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px dashed var(--border-strong); flex-wrap: wrap; }
.security-row:first-child { border-top: 0; padding-top: 4px; }
.security-row .inline-form input { width: 180px; padding: 6px 10px; font-size: 13px; }
.security-row .disclosure summary { font-size: 13px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 1.1rem; margin-bottom: 12px; }
.break { overflow-wrap: anywhere; }
.user-actions .inline-form input { width: auto; padding: 5px 10px; font-size: 13px; }

/* organization switcher in the account menu */
.menu form { margin: 0; }
button.menu-item { width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.menu-orgs { margin-top: 10px; }
.menu-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; }
.menu-item.is-current { display: flex; justify-content: space-between; background: var(--tint); }
@media (max-width: 480px) { .recovery-codes { grid-template-columns: 1fr; } }

/* ---------- action menus beside a page title ---------- */
.action-menu { position: relative; }
.action-menu > summary { list-style: none; cursor: pointer; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > summary { border-color: var(--ink); }
.action-menu .menu { min-width: 300px; display: flex; flex-direction: column; gap: 14px; }
.menu-form label.field { font-size: 11px; }
.menu-form .row { gap: 8px; }
.menu-form .row input, .menu-form .row select { flex: 1; min-width: 0; padding: 7px 10px; font-size: 14px; }
.menu-form .hint { margin: 2px 10px 0; }
.action-menu .brand-rule { margin: 0; }
.danger-item { color: var(--danger) !important; }
.danger-item:hover { background: var(--danger-soft) !important; }
@media (max-width: 640px) { .action-menu .menu { left: 0; right: auto; min-width: min(300px, calc(100vw - 32px)); } }

/* changing a party's email after sending */
.change-email { margin-top: 10px; }
.change-email .inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.change-email input[type=email], .change-email input[type=tel] { flex: 1; min-width: 200px; }
.change-email .inline-form.top-gap { margin-top: 12px; }

/* a signer correcting their own signature block */
.block-edit { margin-top: 14px; }
.block-edit .stack { gap: 10px; }
.block-edit label.field { margin: 6px 0 -4px; }
.block-layer { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.block-layer legend { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.block-pair { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.block-layer[data-optional] { border-style: dashed; }
.block-edit textarea { min-height: 64px; }
.block-layer .hint { margin: 0; }
.block-edit [aria-invalid=true] { border-color: var(--danger); }

/* ---------- confirmation dialog (public/confirm.js) ---------- */
.confirm-dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgba(27, 31, 59, .08), 0 24px 70px rgba(27, 31, 59, .28);
}
.confirm-dialog::backdrop { background: rgba(27, 31, 59, .42); backdrop-filter: blur(3px); }
.confirm-dialog[open] { animation: confirm-in .16s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.confirm-body { display: flex; flex-direction: column; align-items: flex-start; padding: 26px 26px 22px; margin: 0; }
.confirm-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--tint); color: var(--accent); margin-bottom: 16px; }
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-dialog.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-dialog h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 8px; }
.confirm-dialog p { color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 0; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; width: 100%; margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border-strong); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #A83532; border-color: #A83532; color: #fff; }
@media (max-width: 480px) { .confirm-actions { flex-direction: column-reverse; } .confirm-actions .btn { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }

/* ---------- time zone ---------- */
.tz-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 0; }
.tz-form select { width: auto; max-width: 100%; min-width: 260px; }
.tz-notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; font-size: 13.5px;
}
.tz-notice > span { flex: 1; min-width: 220px; }
.tz-notice form { margin: 0; }

/* ---------- document page ---------- */
.page-sub .dot { color: var(--border-strong); margin: 0 2px; }
.page-sub .badge { vertical-align: 1px; }
.page-actions { align-items: center; }
.action-menu .menu-item { display: block; width: 100%; text-align: left; }
.action-menu .menu form { margin: 0; }
.action-menu .menu { right: 0; left: auto; min-width: 220px; gap: 2px; padding: 8px; }
.action-menu .menu .brand-rule { margin: 6px 4px; }
.doc-tabs { padding: 0; overflow: hidden; }
.doc-tabs .tab-bar { display: none; }
.doc-tabs.is-tabbed .tab-bar { display: flex; border-bottom: 1px solid var(--border); padding: 0 8px; }
.tab-bar [role=tab] {
  appearance: none; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 14px 12px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab-bar [role=tab]:hover { color: var(--ink); }
.tab-bar [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-bar .count { font-size: 11.5px; color: var(--muted); background: var(--paper-2); border-radius: 999px; padding: 1px 7px; margin-left: 2px; }
.tab-panel { padding: 18px 20px 20px; }
.doc-tabs:not(.is-tabbed) .tab-panel + .tab-panel { border-top: 1px solid var(--border); }
.panel-title { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.doc-tabs.is-tabbed .panel-title { display: none; }
.doc-tabs .edit-details { margin-top: 16px; }
.doc-tabs .versions { margin-top: 0; }
.top-gap-lg { display: block; margin-top: 22px; }

.next-step .next-title { font-family: var(--font-sans); font-size: 16px; font-weight: 700; letter-spacing: 0; margin: 8px 0 4px; }
.next-step .ghost { padding-left: 0; }
.doc-tabs .edit-details { margin-top: 14px; border: 0; background: none; box-shadow: none; }
.doc-tabs .edit-details > summary { padding: 0; font-size: 14px; font-weight: 600; color: var(--accent); }
.doc-tabs .edit-details > summary .disclosure-mark { display: none; }
.doc-tabs .edit-details[open] > summary { margin-bottom: 12px; }
.doc-tabs .edit-details .disclosure-body { padding: 0; border: 0; }
.panel-sub { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.doc-tabs .list-item { flex-wrap: wrap; row-gap: 6px; }
.doc-tabs .list-item .grow { flex-basis: 100%; }
.doc-tabs .list-item .item-title { display: block; }

/* ---------- documents list ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.doc-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.doc-filters input[type=search] { flex: 1 1 280px; min-width: 0; }
.doc-filters select { width: auto; flex: 0 0 auto; max-width: 220px; }
.clear-filters { font-size: 13.5px; font-weight: 600; color: var(--accent); padding: 0 4px; }
.list-head { margin: 4px 2px 8px; }
.doc-row { display: flex; align-items: center; gap: 14px; }
.doc-row-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-row-meta { width: 96px; text-align: right; flex: none; }
@media (max-width: 640px) { .doc-row-meta { display: none; } .doc-filters select { flex: 1 1 140px; max-width: none; } }
.new-menu .menu { min-width: 280px; }
.menu-hint { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.new-folder-toggle { margin-top: 10px; padding: 0 6px; }
.new-folder-toggle > summary { list-style: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); padding: 6px 4px; }
.new-folder-toggle > summary::-webkit-details-marker { display: none; }
.new-folder-toggle form { gap: 6px; margin-top: 6px; }
.new-folder-toggle input[type=text] { flex: 1; min-width: 0; padding: 7px 10px; font-size: 14px; }
.narrow-form { max-width: 720px; }
/* Phones: the folder tree becomes a dropdown in the filter row. */
.doc-filters .folder-select { display: none; }
@media (max-width: 860px) {
  .doc-filters .folder-select { display: block; flex: 1 1 100%; max-width: none; }
  .repo-side { order: 2; }
  .repo-side .folder-tree { display: none; }
}
/* The new-folder box only appears when chosen from the New menu. */
.new-folder-toggle:not([open]) { display: none; }
.new-folder-toggle { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.new-folder-toggle form { margin-top: 0; flex-wrap: wrap; }
.new-folder-toggle input[type=text] { flex: 1 1 100%; }
/* the folder a document is filed in, on its row */
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 2px; }
.doc-meta .dot { color: var(--border-strong); }
.doc-folder { display: inline-flex; align-items: center; gap: 4px; }
.doc-folder svg { width: 13px; height: 13px; flex: none; }
.folder-tree .tree-extra { margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border-strong); border-radius: 0; }

/* ==========================================================================
   App shell: a sidebar for navigation; a slim bar with a drawer on phones.
   ========================================================================== */
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px 14px; background: var(--paper); border-right: 1px solid var(--border); overflow-y: auto; z-index: 45;
}
.sidebar-top { padding: 2px 8px 6px; }
.sidebar .brandmark .wordmark { font-size: 21px; }
.mobile-bar { display: none; }

.org-switch { position: relative; }
.org-switch > summary, .org-switch.is-single {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--ink);
}
.org-switch > summary { cursor: pointer; }
.org-switch > summary:hover { border-color: var(--border-strong); }
.org-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--ink); color: var(--paper); font-size: 12.5px; font-weight: 700; }
.org-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 11px; }
.org-switch .menu { left: 0; right: 0; top: calc(100% + 6px); min-width: 0; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; color: var(--muted);
}
.nav-item:hover { background: var(--paper-2); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27, 31, 59, .06); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 19px; height: 19px; flex: none; }
.nav-item > span:first-of-type { flex: 1; }
.nav-count { font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--tint); color: var(--accent); }

.user-menu { margin-top: auto; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer;
  border-top: 1px dashed var(--border-strong); border-radius: 0 0 12px 12px; padding-top: 14px;
}
.user-chip:hover .avatar { background: var(--paper-2); }
.user-chip .avatar { width: 34px; height: 34px; font-size: 12.5px; flex: none; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.user-chip-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.user-chip-text .small { font-size: 12px; text-transform: capitalize; }
.user-menu .menu { left: 0; right: 0; bottom: calc(100% + 6px); top: auto; min-width: 0; }

.has-sidebar .main { padding-top: 32px; }
.has-sidebar .container { padding: 0 32px; }
/* Sticky things sit at the top of the window now there's no top bar. */
.has-sidebar .toolbar { top: 12px; }
.has-sidebar .repo-side, .has-sidebar .send-preview, .has-sidebar .editor-side { top: 24px; }
/* Two-column pages fold sooner: the sidebar takes 248px of the width. */
@media (max-width: 1240px) { .has-sidebar .doc-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1320px) { .has-sidebar .editor-layout, .has-sidebar .send-layout { grid-template-columns: minmax(0, 1fr); } .has-sidebar .editor-side, .has-sidebar .send-preview { position: static; } }
@media (max-width: 1100px) { .has-sidebar .repo { grid-template-columns: minmax(0, 1fr); } .has-sidebar .repo-side { position: static; } .has-sidebar .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) and (min-width: 901px) { .has-sidebar .doc-filters .folder-select { display: block; flex: 1 1 100%; max-width: none; } .has-sidebar .repo-side { order: 2; } .has-sidebar .repo-side .folder-tree { display: none; } }

/* Phones and small tablets: slim bar, sidebar slides in. */
@media (max-width: 900px) {
  .app { display: block; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 12px; position: sticky; top: 0; z-index: 40;
    background: var(--paper); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brandmark .mark { width: 26px; height: 26px; }
  .mobile-bar .wordmark { font-size: 19px; }
  .mobile-org { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-toggle { appearance: none; border: 0; background: none; width: 40px; height: 40px; display: grid; place-content: center; gap: 4px; cursor: pointer; border-radius: 10px; }
  .nav-toggle:hover { background: var(--paper-2); }
  .nav-toggle span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: none;
  }
  .nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(27, 31, 59, .25); }
  .nav-scrim { position: fixed; inset: 0; background: rgba(27, 31, 59, .35); z-index: 44; }
  .nav-scrim[hidden] { display: none; }
  .nav-open { overflow: hidden; }
  .has-sidebar .main { padding-top: 22px; }
  .has-sidebar .container { padding: 0 16px; }
  .has-sidebar .toolbar { top: 64px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media print { .sidebar, .mobile-bar { display: none; } .app { display: block; } }

/* ---------- template variables ---------- */
.editor-shell .tpl-var, .doc-main .tpl-var[data-empty] {
  border-radius: 6px; padding: 0 4px; margin: 0 1px; white-space: nowrap;
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(91, 91, 214, .35); color: var(--ink);
}
.editor-shell .tpl-var[data-empty], .doc-main .tpl-var[data-empty] { color: var(--accent); font-weight: 600; background: var(--tint); }
.editor-shell .tpl-var:not([data-empty]) { background: transparent; box-shadow: inset 0 -2px 0 rgba(91, 91, 214, .45); border-radius: 0; padding: 0; }
.editor-shell .tpl-var.is-focus { box-shadow: 0 0 0 2px var(--accent); }
.vars-list { display: flex; flex-direction: column; gap: 10px; }
.var-field label.field { margin-bottom: 4px; }
.var-row { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.var-row:last-child { border-bottom: 0; }
.var-name { flex: 1; font-weight: 600; font-size: 14px; }
.var-add { display: flex; gap: 6px; }
.var-add input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 14px; }
.vars-card .link-button { font-size: 13.5px; text-align: left; }
.tpl-upload[hidden] { display: none; }

/* ---------- OAuth consent ---------- */
.consent-org { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 600; margin: 4px 0 6px !important; }
.consent-list { text-align: left; margin: 14px 0 18px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.consent select { margin-bottom: 4px; }
.move-form { padding: 6px 4px 8px; }
.move-form .row { gap: 6px; }
.move-form select { flex: 1; min-width: 0; padding: 6px 28px 6px 10px; font-size: 13.5px; }
.page-actions .action-menu .menu:has(.move-form) { min-width: 280px; }
.prepared-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prepared-note > span { flex: 1; min-width: 240px; }
.prepared-line { font-size: 13.5px; background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; }
