/* Contract Management System — "Glass Desk" theme.
   Frosted glass surfaces on a soft mesh, a centred module tab bar with a sliding ink pill, a floating action dock and
   pill controls. Colour stays reserved for meaning: each workflow stage keeps one hue (path bar, board, funnel, badges,
   charts). Light and dark themes are token swaps on <html data-theme>; see docs/DESIGN.md. */

@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  /* Ground & glass */
  --bg: #eceef1;
  --mesh-a: #fbfcfd;
  --mesh-b: #d6dbe3;
  --mesh-c: #f4f6f9;
  --glass: rgba(255, 255, 255, .6);
  --glass-2: rgba(255, 255, 255, .74);
  --glass-3: rgba(255, 255, 255, .92);
  --rim: rgba(255, 255, 255, .85);
  --raised: #fbfbfc;
  --field: rgba(255, 255, 255, .85);
  --well: rgba(20, 24, 33, .05);
  --hover: rgba(20, 24, 33, .035);
  --line: rgba(20, 24, 33, .1);
  --line-2: rgba(20, 24, 33, .065);
  --surface: var(--glass);
  --canvas: var(--well);

  /* Ink */
  --ink: #141821;
  --ink-2: #3a4150;
  --muted: #5b6270;
  --muted-2: #848b98;
  --on-ink: #f6f7f9;
  --dock: #141821;
  --on-dock: #f6f7f9;
  --primary: #2b59e8;
  --primary-600: #1f47c9;
  --primary-50: rgba(43, 89, 232, .09);
  --accent: #cad8f6;
  --on-accent: #0f1f3d;
  --mix-bg: #fff;
  --mix-fg: #000;

  /* Stage hues — the identity of the app */
  --st-draft: #7a869a;
  --st-legal: #5b5bd6;
  --st-final: #2b7fe0;
  --st-sign: #8e4ec6;
  --st-client: #e08a1e;
  --st-done: #1f9d6b;
  --st-closed: #d9473f;
  --st-warn: #d9741f;

  /* Charts (read by window.cmsChartDefaults) */
  --chart-text: #4b5262;
  --chart-grid: rgba(20, 24, 33, .07);
  --chart-arc: #f3f4f7;
  --chart-tip: #141821;
  --chart-tip-text: #f6f7f9;

  /* Shape, depth, layout */
  --r-sm: 10px;
  --r-md: 20px;
  --r-card: 22px;
  --r-tile: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 22px 44px -30px rgba(16, 28, 52, .32);
  --shadow-float: 0 24px 60px -18px rgba(16, 28, 52, .3), 0 2px 6px rgba(16, 28, 52, .07);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gap: 16px;
  --gutter: clamp(16px, 1.6vw, 28px);
  --dock-x: 20px;
  --dock-w: 60px;
  --app-max: 1840px;
  --topbar-h: 64px;

  --bs-body-font-family: "Jakarta", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-body-font-size: 14px;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--well);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 43, 89, 232;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 43, 89, 232;
  --bs-link-hover-color: var(--primary-600);
  --bs-link-hover-color-rgb: 31, 71, 201;
  --bs-border-radius: var(--r-sm);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d0f14;
  --mesh-a: rgba(110, 140, 220, .12);
  --mesh-b: rgba(255, 255, 255, .035);
  --mesh-c: rgba(140, 110, 210, .07);
  --glass: rgba(255, 255, 255, .045);
  --glass-2: rgba(255, 255, 255, .08);
  --glass-3: #22252d;
  --rim: rgba(255, 255, 255, .075);
  --raised: #1b1e25;
  --field: rgba(255, 255, 255, .05);
  --well: rgba(255, 255, 255, .055);
  --hover: rgba(255, 255, 255, .04);
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .065);

  --ink: #eceef2;
  --ink-2: #c4c8d1;
  --muted: #9ba1ad;
  --muted-2: #767d8a;
  --on-ink: #12141a;
  --dock: rgba(255, 255, 255, .08);
  --on-dock: #eceef2;
  --primary: #7398ff;
  --primary-600: #98b3ff;
  --primary-50: rgba(115, 152, 255, .14);
  --accent: #22365e;
  --on-accent: #e8efff;
  --mix-bg: #17191f;
  --mix-fg: #fff;

  --st-draft: #8c96a8;
  --st-legal: #8080f0;
  --st-final: #4f98f0;
  --st-sign: #a978dc;
  --st-client: #eba143;
  --st-done: #35b583;
  --st-closed: #ec645c;
  --st-warn: #ea8d3d;

  --chart-text: #a3a9b5;
  --chart-grid: rgba(255, 255, 255, .07);
  --chart-arc: #17191f;
  --chart-tip: #eceef2;
  --chart-tip-text: #12141a;

  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 22px 44px -30px rgba(0, 0, 0, .7);
  --shadow-float: 0 24px 60px -18px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .08);

  --bs-primary-rgb: 115, 152, 255;
  --bs-link-color-rgb: 115, 152, 255;
  --bs-link-hover-color-rgb: 152, 179, 255;
  color-scheme: dark;
}

html { font-size: 14px; }
body { min-height: 100vh; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; letter-spacing: -.003em; overflow-x: hidden; }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; letter-spacing: -.015em; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.skip-link { position: absolute; left: 1rem; top: 1rem; z-index: 2000; background: var(--raised); color: var(--ink); padding: .5rem 1rem; border-radius: 999px; box-shadow: var(--shadow-float); }
.req { color: var(--st-closed); }
.text-secondary { color: var(--muted) !important; }
.text-body { color: var(--ink) !important; }

/* Bootstrap surfaces follow the theme */
.dropdown-menu { --bs-dropdown-bg: var(--raised); --bs-dropdown-color: var(--ink); --bs-dropdown-link-color: var(--ink); --bs-dropdown-link-hover-bg: var(--well); --bs-dropdown-link-hover-color: var(--ink); --bs-dropdown-link-active-bg: var(--ink); --bs-dropdown-link-active-color: var(--on-ink); --bs-dropdown-border-color: var(--line); --bs-dropdown-divider-bg: var(--line); --bs-dropdown-header-color: var(--muted);
  border: 1px solid var(--line); box-shadow: var(--shadow-float); border-radius: 16px; font-size: .9rem; padding: 6px; }
.dropdown-item { border-radius: 10px; padding: 7px 10px; }
.dropdown-item:hover { text-decoration: none; }
.modal { --bs-modal-bg: var(--raised); --bs-modal-color: var(--ink); --bs-modal-border-radius: var(--r-card); --bs-modal-header-border-color: var(--line-2); --bs-modal-footer-border-color: var(--line-2); }
.modal-backdrop { --bs-backdrop-bg: #0a0d14; --bs-backdrop-opacity: .38; }
.offcanvas { --bs-offcanvas-bg: var(--raised); --bs-offcanvas-color: var(--ink); --bs-offcanvas-border-color: var(--line); }
.popover { --bs-popover-bg: var(--raised); --bs-popover-border-color: var(--line); --bs-popover-body-color: var(--ink); --bs-popover-header-bg: var(--well); }
.table { --bs-table-bg: transparent; --bs-table-color: inherit; --bs-table-border-color: var(--line-2); --bs-table-striped-bg: var(--hover); --bs-table-hover-bg: var(--hover); }
.card { --bs-card-bg: var(--glass); --bs-card-border-color: var(--rim); --bs-card-border-radius: var(--r-card); --bs-card-cap-bg: transparent; box-shadow: var(--shadow); }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--line-2); --bs-list-group-color: var(--ink); --bs-list-group-action-hover-bg: var(--hover); }
.nav-tabs { --bs-nav-tabs-link-active-bg: var(--glass-3); --bs-nav-tabs-border-color: var(--line); --bs-nav-tabs-link-active-border-color: var(--line) var(--line) transparent; }
.accordion { --bs-accordion-bg: transparent; --bs-accordion-border-color: var(--line-2); }
.btn-close { filter: var(--btn-close-filter, none); }
[data-theme="dark"] .btn-close { --btn-close-filter: invert(1) grayscale(100%) brightness(200%); }

/* =========================================================================
   Shell: mesh ground, top bar with module tabs, floating dock, view sub-nav
   ========================================================================= */
.mesh { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.mesh i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .95; }
.mesh-a { width: 62vmax; height: 62vmax; top: -24vmax; left: -18vmax; background: radial-gradient(closest-side, var(--mesh-a), transparent); }
.mesh-b { width: 70vmax; height: 70vmax; bottom: -30vmax; right: -24vmax; background: radial-gradient(closest-side, var(--mesh-b), transparent); }
.mesh-c { width: 46vmax; height: 46vmax; top: -16vmax; right: 8vmax; background: radial-gradient(closest-side, var(--mesh-c), transparent); }

.app { max-width: var(--app-max); margin: 0 auto; padding: 18px var(--gutter) 28px calc(var(--dock-x) + var(--dock-w) + var(--gutter)); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: relative; z-index: 1030; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-height: 44px; min-width: 0; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-tile { display: grid; place-items: center; width: 42px; height: 42px; flex: none; }
.brand-tile img { width: 42px; height: 42px; }
.brand-text { display: grid; line-height: 1.1; min-width: 0; }
.brand-text b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-text small { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }

.ttabs { justify-self: center; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-radius: 999px; }
.ttabs::-webkit-scrollbar { display: none; }
.ttabs-track { position: relative; display: flex; gap: 2px; width: max-content; padding: 4px; background: var(--glass); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--rim); }
.ttab { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: color .3s var(--ease); }
.ttab i { font-size: 15px; opacity: .8; }
.ttab:hover { background: var(--well); text-decoration: none; color: var(--ink); }
.ttab[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.ttab[aria-current="page"] i { opacity: 1; }
.ttabs-track.is-sliding .ttab[aria-current="page"] { background: transparent; color: var(--ink); }
.ttab-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--ink); transition: transform .5s var(--ease), width .5s var(--ease); pointer-events: none; }

.top-tools { display: flex; align-items: center; gap: 10px; }
.ibtn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim); color: var(--ink); font-size: 1.1rem; }
.ibtn:hover { background: var(--glass-2); }
.bell-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--st-closed); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.user-chip { display: flex; align-items: center; gap: .55rem; border: 0; padding: 0; border-radius: 999px; color: var(--ink); background: transparent; }
.user-chip .av { width: 44px; height: 44px; font-size: .85rem; box-shadow: inset 0 0 0 1px var(--rim); }
.user-chip:hover .av { filter: brightness(.97); }
.user-name { font-size: .88rem; font-weight: 600; padding-right: 6px; }
/* Account menu: fixed width so long role lists wrap instead of stretching the menu */
.acct-menu { width: 300px; max-width: calc(100vw - 24px); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 6px; }
.acct-head .av { width: 38px; height: 38px; flex: none; }
.acct-id { display: grid; min-width: 0; line-height: 1.3; }
.acct-id strong { font-size: .92rem; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-id span { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-roles { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px 6px; }
.acct-role { max-width: 100%; padding: 2px 8px; border-radius: 999px; background: var(--well); color: var(--ink-2); font-size: .72rem; font-weight: 600; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.acct-role-more { color: var(--primary); }
a.acct-role-more:hover { text-decoration: none; background: var(--hover); }
.btn-icon { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--ink-2); padding: 0; font-size: 1.1rem; border: 0; background: transparent; }
.btn-icon:hover { background: var(--well); color: var(--ink); }

/* Floating dock: search, create, theme, notifications, administration */
.dock { position: fixed; z-index: 1035; top: 0; bottom: 0; left: max(var(--dock-x), calc((100vw - var(--app-max)) / 2 + var(--dock-x))); height: fit-content; margin: auto 0;
  display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 999px; background: var(--dock); color: var(--on-dock); box-shadow: 0 20px 40px -18px rgba(10, 20, 30, .45); }
[data-theme="dark"] .dock { backdrop-filter: blur(18px); border: 1px solid var(--line); }
.dock-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; padding: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .74; font-size: 1.1rem; }
.dock-btn:hover, .dock-btn:focus-visible, .dock-btn[aria-current="page"], .dock-btn[aria-expanded="true"] { opacity: 1; background: rgba(255, 255, 255, .13); color: inherit; text-decoration: none; }
.dock-btn:focus-visible { outline-color: var(--on-dock); }
.dock-btn[aria-current="page"]::after { content: ""; position: absolute; top: 50%; right: 3px; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--accent); }
[data-theme="dark"] .dock-btn[aria-current="page"]::after { background: var(--primary); }
.dock-sep { flex: none; height: 1px; margin: 4px 10px; background: rgba(255, 255, 255, .16); }
.dock-tip { position: absolute; top: 0; bottom: 0; left: calc(100% + 14px); height: fit-content; margin: auto 0; padding: 6px 10px; border-radius: 10px; background: var(--raised); color: var(--ink); box-shadow: var(--shadow-float);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .18s var(--ease); }
.dock-tip kbd { margin-left: 4px; padding: 1px 5px; font-size: 11px; font-family: inherit; background: var(--well); color: var(--muted); border-radius: 5px; box-shadow: none; }
.dock-btn:hover .dock-tip, .dock-btn:focus-visible .dock-tip { opacity: 1; }
.dock-btn[aria-expanded="true"] .dock-tip { opacity: 0; }

/* Create popover (dock "+"): a compact menu beside the dock, one row per record type */
.pop-menu { min-width: 280px; max-width: min(340px, calc(100vw - 24px)); padding: 6px; border-radius: 18px; }
.pop-head { padding: 8px 10px 6px; font-size: 14px; font-weight: 700; color: var(--ink); }
.pop-item { --st: var(--primary); display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 7px 10px; border-radius: 12px; white-space: normal; }
.pop-item:hover, .pop-item:focus-visible { background: var(--well); outline: none; }
.pop-item:active { background: var(--well); color: var(--ink); }
.pop-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: .95rem;
  color: color-mix(in srgb, var(--st) 82%, var(--mix-fg)); background: color-mix(in srgb, var(--st) 14%, transparent); box-shadow: inset 0 0 0 1px var(--rim); }
.pop-txt { min-width: 0; line-height: 1.25; }
.pop-txt b { display: block; font-size: 13.5px; font-weight: 600; }
.pop-txt small { display: block; font-size: 12px; color: var(--muted); }
.pop-menu.show { animation: pop-in .18s var(--ease); }
@keyframes pop-in { from { opacity: 0; } to { opacity: 1; } }

/* Search dialog */
.search-modal .modal-content { background: var(--glass-3); backdrop-filter: blur(20px) saturate(1.3); border: 1px solid var(--rim); }
.finder { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.finder > i { color: var(--muted); font-size: 1.15rem; }
.finder input { flex: 1; min-width: 0; height: 36px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1.1rem; font-weight: 500; }
.finder input::placeholder { color: var(--muted-2); }
.finder input::-webkit-search-cancel-button { display: none; }
.finder kbd { padding: 2px 7px; font-size: 11px; font-family: inherit; background: var(--well); color: var(--muted); border-radius: 6px; box-shadow: none; }
.finder-hint { margin: 0; padding: 12px 20px 16px; font-size: .84rem; color: var(--muted); }

/* Notifications menu */
.notif-menu { width: 380px; padding: 0; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.notif-item { display: block; padding: 10px 16px; color: var(--ink); border-bottom: 1px solid var(--line-2); position: relative; }
.notif-item:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.notif-item.unread { padding-left: 28px; }
.notif-item.unread::before { content: ""; position: absolute; left: 13px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.notif-item.unread .notif-title { font-weight: 650; }
.notif-title { display: block; font-size: .87rem; line-height: 1.35; }
.notif-time { font-size: .75rem; color: var(--muted); }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: .9rem; }
.notif-all { display: block; text-align: center; padding: 11px; font-size: .85rem; font-weight: 600; }

/* Saved views: a glass pill track under the top bar */
.view-tabs { margin: 0 0 18px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-track { position: relative; isolation: isolate; display: flex; align-items: center; gap: 2px; width: max-content; padding: 4px; border-radius: 999px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim), 0 14px 30px -22px rgba(30, 50, 80, .4); }
/* The blur sits on a layer behind the track: backdrop-filter on the track itself would trap the section dropdowns
   (fixed-position menus) inside the scrolling sub-nav. */
.view-track::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; backdrop-filter: blur(14px) saturate(1.3); pointer-events: none; }
.view-tabs .dropdown { display: flex; }
.view-tab { display: inline-flex; align-items: center; gap: .5rem; min-height: 38px; padding: 0 15px 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.view-tab i { color: var(--muted-2); font-size: .95rem; }
.view-tab:hover { color: var(--ink); text-decoration: none; background: var(--hover); }
.view-tab.active { color: var(--ink); background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--rim), 0 2px 8px rgba(16, 32, 34, .08); }
.view-tab.active i { color: var(--ink); }
.view-tab-more i { font-size: .7rem; }
.view-menu-item { display: flex; align-items: center; gap: .55rem; }
.view-menu-item i { color: var(--muted-2); width: 1rem; text-align: center; }
.sv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sv, var(--muted-2)); margin: 0 .2rem; flex-shrink: 0; }

.content { flex: 1; min-width: 0; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: 28px 4px 0; font-size: .76rem; color: var(--muted-2); }
.breadcrumb { font-size: .8rem; margin-bottom: 8px; --bs-breadcrumb-divider-color: var(--muted-2); }
.breadcrumb a { color: var(--muted); }
.breadcrumb-item.active { color: var(--ink-2); }

@media (max-width: 1199.98px) {
  .ttab { padding-left: 12px; padding-right: 12px; }
  .ttab i { display: none; }
  .brand-text small { display: none; }
}
@media (max-width: 991.98px) {
  :root { --dock-w: 0px; --dock-x: 0px; }
  .app { padding: 14px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
  .top { grid-template-columns: minmax(0, 1fr) auto; row-gap: 12px; margin-bottom: 16px; }
  .ttabs { grid-area: 2 / 1 / auto / -1; justify-self: stretch; -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px calc(100% - 14px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px calc(100% - 14px), transparent); }
  .ttab i { display: inline; }
  .top-tools { grid-area: 1 / 2; }
  .dock { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 0; right: 0; flex-direction: row; width: fit-content; margin: 0 auto; padding: 6px; }
  .dock-sep { width: 1px; height: 24px; margin: auto 6px; }
  .dock-tip { display: none; }
  .dock-btn[aria-current="page"]::after { top: auto; right: auto; bottom: 3px; left: 50%; margin: 0 0 0 -2.5px; }
  .view-tabs { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: 0 calc(var(--gutter) - 4px); }
  .notif-menu { width: min(380px, calc(100vw - 32px)); }
}

/* =========================================================================
   Page structure
   ========================================================================= */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: clamp(26px, 2.4vw, 36px); font-weight: 600; margin: 0; letter-spacing: -.03em; line-height: 1.06; }
.page-subtitle { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.panel { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; min-height: 48px; }
.panel-title { font-size: 1.05rem; margin: 0; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: .4rem; }
.panel-title small, .panel-title .count-pill { font-weight: 600; color: var(--muted); font-size: .76rem; background: var(--well); border-radius: 10px; padding: 1px 8px; margin-left: .15rem; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 11px 18px; border-top: 1px solid var(--line-2); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 18px; border-bottom: 1px solid var(--line-2); background: var(--hover); border-radius: var(--r-card) var(--r-card) 0 0; }
.filter-bar .form-label { font-size: .74rem; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .86rem; min-width: 150px; height: 34px; padding-top: 0; padding-bottom: 0; }
.filter-bar .grow { flex: 1 1 220px; }

/* Collapsible filter drawer used by CRM list views */
.filter-drawer > summary { list-style: none; cursor: pointer; }
.filter-drawer > summary::-webkit-details-marker { display: none; }
.filter-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.filter-toggle .n { background: var(--primary); color: #fff; border-radius: 9px; font-size: .7rem; font-weight: 800; padding: 0 6px; }

/* =========================================================================
   Tables
   ========================================================================= */
.table-cms { margin: 0; font-size: .875rem; --bs-table-bg: transparent; }
.table-cms thead th { background: transparent; color: var(--muted); font-weight: 600; font-size: .76rem; border-bottom: 1px solid var(--line); white-space: nowrap; padding: 9px 12px; }
.table-cms td { padding: 10px 12px; vertical-align: middle; border-color: var(--line-2); height: 44px; }
.table-cms tbody tr { transition: background .1s; }
.table-cms tbody tr:hover { background: var(--hover); }
.table-cms > :not(caption) > * > * { color: inherit; }
.table-cms th:first-child, .table-cms td:first-child { padding-left: 18px; }
.table-cms th:last-child, .table-cms td:last-child { padding-right: 18px; }
.table-cms .num { text-align: right; white-space: nowrap; }
.sort-link { color: inherit; }
.sort-link.active, .sort-link:hover { color: var(--ink); text-decoration: none; }
.ref { font-weight: 700; color: var(--primary); letter-spacing: .005em; white-space: nowrap; }
.cell-sub { display: block; font-size: .77rem; color: var(--muted); margin-top: 1px; }
.cell-entity { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.cell-entity .cell-text { min-width: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: .82rem; color: var(--muted); }
.pagination { --bs-pagination-bg: transparent; --bs-pagination-color: var(--ink-2); --bs-pagination-hover-bg: var(--well); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-color: var(--on-ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-border-color: var(--line); --bs-pagination-disabled-bg: transparent; --bs-pagination-border-radius: 999px; }

/* =========================================================================
   Avatars & brand monograms
   ========================================================================= */
.av { --h: 220; display: inline-grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; font-size: .7rem; font-weight: 700;
  background: hsl(var(--h) 70% 91%); color: hsl(var(--h) 45% 30%); letter-spacing: 0; }
[data-theme="dark"] .av { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 70% 84%); }
.av-xs { width: 22px; height: 22px; font-size: .6rem; }
.av-lg { width: 36px; height: 36px; font-size: .82rem; }
.bm { --h: 220; display: inline-grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; font-size: .72rem; font-weight: 800;
  background: hsl(var(--h) 55% 46%); color: #fff; letter-spacing: .01em; }
.bm-sm { width: 24px; height: 24px; border-radius: 6px; font-size: .62rem; }
.bm-xl { width: 52px; height: 52px; border-radius: 16px; font-size: 1.05rem; }
.person { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.av-stack { display: inline-flex; }
.av-stack .av { box-shadow: 0 0 0 2px var(--mix-bg); margin-left: -6px; }
.av-stack .av:first-child { margin-left: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; }

/* =========================================================================
   Status chips (tones) — stage hues first, generic tones mapped onto the palette
   ========================================================================= */
.badge-status { --tone: var(--muted-2); display: inline-flex; align-items: center; gap: .38rem; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 650; white-space: nowrap; line-height: 1.5;
  color: color-mix(in srgb, var(--tone) 78%, var(--mix-fg)); background: color-mix(in srgb, var(--tone) 12%, var(--mix-bg)); border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--mix-bg)); }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.tone-stage-draft { --tone: var(--st-draft); }
.tone-stage-legal { --tone: var(--st-legal); }
.tone-stage-final { --tone: var(--st-final); }
.tone-stage-sign { --tone: var(--st-sign); }
.tone-stage-client { --tone: var(--st-client); }
.tone-stage-done, .tone-success { --tone: var(--st-done); }
.tone-stage-closed, .tone-danger { --tone: var(--st-closed); }
.tone-info { --tone: var(--st-final); }
.tone-violet { --tone: var(--st-sign); }
.tone-amber { --tone: var(--st-client); }
.tone-warning { --tone: var(--st-warn); }
.tone-neutral { --tone: #6b7a92; }
.tone-muted { --tone: #a0abbd; }
.days-left { font-weight: 700; font-size: .8rem; padding: 1px 7px; border-radius: 5px; white-space: nowrap; color: color-mix(in srgb, var(--tone) 80%, var(--mix-fg)); background: color-mix(in srgb, var(--tone) 12%, var(--mix-bg)); }
.days-left.tone-neutral { background: transparent; color: var(--ink-2); }

/* =========================================================================
   Buttons & forms
   ========================================================================= */
.btn { --bs-btn-padding-x: 1rem; font-weight: 600; border-radius: 999px; font-size: .88rem; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-padding-x: 1.4rem; }
.btn-sm { --bs-btn-padding-x: .75rem; font-size: .8rem; }
.btn-primary { --bs-btn-color: var(--on-ink); --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-color: var(--on-ink); --bs-btn-hover-bg: color-mix(in srgb, var(--ink) 84%, var(--mix-bg)); --bs-btn-hover-border-color: transparent; --bs-btn-active-color: var(--on-ink); --bs-btn-active-bg: var(--ink); --bs-btn-active-border-color: var(--ink); --bs-btn-disabled-color: var(--on-ink); --bs-btn-disabled-bg: var(--muted-2); --bs-btn-disabled-border-color: var(--muted-2); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--st-done); --bs-btn-border-color: var(--st-done); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #178257; --bs-btn-hover-border-color: #178257; --bs-btn-active-bg: #136e49; --bs-btn-active-color: #fff; }
.btn-outline-primary { --bs-btn-bg: var(--glass); --bs-btn-color: var(--primary); --bs-btn-border-color: color-mix(in srgb, var(--primary) 30%, transparent); --bs-btn-hover-bg: var(--primary-50); --bs-btn-hover-color: var(--primary-600); --bs-btn-hover-border-color: color-mix(in srgb, var(--primary) 42%, transparent); --bs-btn-active-bg: color-mix(in srgb, var(--primary) 16%, transparent); --bs-btn-active-color: var(--primary); }
.btn-outline-secondary { --bs-btn-bg: var(--glass); --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--glass-3); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line); --bs-btn-active-bg: var(--glass-3); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--line); }
.btn-light { --bs-btn-color: var(--ink); --bs-btn-bg: var(--glass); --bs-btn-border-color: var(--rim); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--glass-3); --bs-btn-hover-border-color: var(--rim); --bs-btn-active-bg: var(--glass-3); --bs-btn-active-color: var(--ink); }
.btn-link { --bs-btn-color: var(--primary); --bs-btn-hover-color: var(--primary-600); }
.btn-group > .btn { border-radius: 999px; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
/* Radio/checkbox toggles (.btn-check + label): the hidden input comes first, so round the label that follows it */
.btn-group > .btn-check:first-child + .btn { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.view-toggle .btn.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.form-control, .form-select { background-color: var(--field); color: var(--ink); border-color: var(--line); border-radius: 12px; font-size: .9rem; }
.form-control::placeholder { color: var(--muted-2); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--well); }
.input-group-text { background: var(--well); border-color: var(--line); color: var(--muted); border-radius: 12px; }
.form-control-lg { border-radius: 14px; }
.form-control:focus, .form-select:focus { background-color: var(--field); color: var(--ink); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--ink-2); margin-bottom: 4px; }
.form-text { font-size: .76rem; }
.field-info { border: 0; background: none; padding: 0 0 0 4px; color: var(--muted); font-size: .82rem; line-height: 1; vertical-align: baseline; cursor: help; }
.field-info:hover, .field-info:focus-visible { color: var(--primary); }
.popover { max-width: 340px; font-size: .82rem; }
.form-check-input { background-color: var(--field); border-color: var(--line); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .form-check-input:checked { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2312141a' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
.form-section { font-size: .92rem; font-weight: 700; padding-bottom: 6px; margin: 22px 0 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; }
.form-section:first-child { margin-top: 0; }
form.panel > .panel-foot { position: sticky; bottom: 0; background: var(--raised); backdrop-filter: blur(6px); border-radius: 0 0 var(--r-card) var(--r-card); z-index: 5; }
.modal-content { border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow-float); }
.modal-header { border-bottom-color: var(--line-2); }
.modal-footer { border-top-color: var(--line-2); }
.alert { border-radius: 16px; font-size: .9rem; }

/* =========================================================================
   Metric strip (KPI) — joined tiles, not a card kit
   ========================================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi { --kpi-hue: var(--muted); display: block; background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 18px; color: var(--ink); position: relative; min-width: 0; }
a.kpi:hover { background: var(--glass-2); text-decoration: none; color: var(--ink); }
.kpi-label { font-size: .84rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label i { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: .95rem; color: color-mix(in srgb, var(--kpi-hue) 80%, var(--mix-fg)); background: color-mix(in srgb, var(--kpi-hue) 13%, transparent); box-shadow: inset 0 0 0 1px var(--rim); }
.kpi-value { font-size: 1.85rem; font-weight: 650; line-height: 1.15; margin-top: 10px; letter-spacing: -.03em; }
.kpi-note { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.kpi-alert .kpi-value { color: color-mix(in srgb, var(--st-client) 80%, var(--mix-fg)); }
.kpi.kpi-danger .kpi-value { color: var(--st-closed); }
.kpi.kpi-lead { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.kpi.kpi-lead .kpi-label, .kpi.kpi-lead .kpi-note { color: color-mix(in srgb, var(--on-accent) 72%, transparent); }
.kpi.kpi-lead .kpi-label i { background: rgba(255, 255, 255, .45); color: var(--on-accent); }
[data-theme="dark"] .kpi.kpi-lead .kpi-label i { background: rgba(255, 255, 255, .1); }
.kpi.kpi-lead .kpi-value { color: var(--on-accent); }


/* =========================================================================
   Record page (CRM): hero + highlights + path + 3 columns
   ========================================================================= */
.record-hero { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); margin-bottom: 14px; }
.record-hero-top { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px 16px; flex-wrap: wrap; }
.record-hero-main { flex: 1; min-width: 240px; }
.record-type { font-size: .76rem; font-weight: 700; color: var(--muted); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.record-type .ref-code { color: var(--primary); }
.record-hero h1 { font-size: 1.75rem; font-weight: 650; margin: 2px 0 6px; letter-spacing: -.025em; }
.record-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.record-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--line-2); }
.hl { padding: 12px 22px; border-right: 1px solid var(--line-2); min-width: 0; }
.hl:last-child { border-right: 0; }
.hl-label { font-size: .72rem; font-weight: 600; color: var(--muted); }
.hl-value { font-size: .95rem; font-weight: 700; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-value a { color: inherit; }

/* legacy header (pages not yet converted) */
.record-head { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.record-head .record-ref { font-size: .78rem; font-weight: 700; color: var(--primary-600); }
.record-head h1 { font-size: 1.4rem; font-weight: 800; margin: 2px 0 6px; }
.record-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; color: var(--ink-2); font-size: .86rem; align-items: center; }
.confidential-flag { color: var(--st-closed); font-weight: 700; font-size: .76rem; display: inline-flex; gap: .25rem; align-items: center; }

.record-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.record-grid > * { min-width: 0; }
@media (max-width: 1399.98px) { .record-grid { grid-template-columns: 280px minmax(0, 1fr); } .record-grid .col-related { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; } .record-grid .col-related > * { margin-bottom: 0; } }
@media (max-width: 991.98px) { .record-grid { grid-template-columns: minmax(0, 1fr); } }

/* collapsible detail sections */
.rsec { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); margin-bottom: 14px; }
.rsec > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: .5rem; }
.rsec > summary::-webkit-details-marker { display: none; }
.rsec > summary::before { content: "\F282"; font-family: "bootstrap-icons"; font-size: .75rem; color: var(--muted-2); transition: transform .15s; }
.rsec:not([open]) > summary::before { transform: rotate(-90deg); }
.rsec > summary .sum-aside { margin-left: auto; font-weight: 500; font-size: .78rem; color: var(--muted); }
.rsec-body { padding: 0 18px 16px; }
.field-list { margin: 0; }
.field-list > div { display: grid; grid-template-columns: 42% 58%; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: .86rem; }
.field-list > div:last-child { border-bottom: 0; }
.field-list dt { color: var(--muted); font-weight: 500; }
.field-list dd { margin: 0; font-weight: 600; word-break: break-word; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.dl-grid dt { font-size: .74rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.dl-grid dd { margin: 0; font-size: .9rem; word-break: break-word; }

/* =========================================================================
   Path bar — the signing pipeline (signature element)
   ========================================================================= */
.path-wrap { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 18px 12px; margin-bottom: 14px; }
.path-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.path-name { font-size: .8rem; font-weight: 700; color: var(--muted); }
.path { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); gap: 4px; margin: 0; padding: 0; overflow-x: auto; }
.path-step { --st: var(--st-draft); min-width: 0; }
.path-chev {
  height: 40px; display: flex; align-items: center; justify-content: center; gap: .35rem; padding: 0 18px; font-size: .82rem; font-weight: 700;
  background: var(--well); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
}
.path-step:first-child .path-chev { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 999px 0 0 999px; }
.path-step:last-child .path-chev { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 999px 999px 0; }
.path-step.is-done .path-chev, .path-step.is-skipped .path-chev { background: var(--st); color: #fff; }
.path-step.is-skipped .path-chev { background: repeating-linear-gradient(-45deg, var(--st), var(--st) 6px, color-mix(in srgb, var(--st) 80%, var(--mix-bg)) 6px, color-mix(in srgb, var(--st) 80%, var(--mix-bg)) 12px); }
.path-step.is-current .path-chev { background: color-mix(in srgb, var(--st) 16%, var(--mix-bg)); color: color-mix(in srgb, var(--st) 75%, var(--mix-fg)); box-shadow: inset 0 -3px 0 var(--st); }
.path-step.is-returned .path-chev { background: color-mix(in srgb, var(--st-warn) 16%, var(--mix-bg)); color: color-mix(in srgb, var(--st-warn) 66%, var(--mix-fg)); }
.path-step.is-rejected .path-chev, .path-step.is-cancelled .path-chev { background: color-mix(in srgb, var(--st-closed) 16%, var(--mix-bg)); color: color-mix(in srgb, var(--st-closed) 65%, var(--mix-fg)); }
.path-step.is-current .path-chev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex-shrink: 0; animation: path-ping 1.6s ease-out 2; }
@keyframes path-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st) 55%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.path-meta { font-size: .74rem; color: var(--muted); padding: 6px 4px 0 14px; line-height: 1.35; min-height: 2.6em; }
.path-meta strong { color: var(--ink-2); font-weight: 600; }
.path-meta .overdue { color: var(--st-closed); font-weight: 700; }
.st-draft { --st: var(--st-draft); } .st-legal { --st: var(--st-legal); } .st-final { --st: var(--st-final); }
.st-sign { --st: var(--st-sign); } .st-client { --st: var(--st-client); } .st-done { --st: var(--st-done); } .st-closed { --st: var(--st-closed); }

/* "Your step" banner under the path */
.action-panel { --st: var(--primary); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border: 1px solid color-mix(in srgb, var(--st) 30%, transparent); background: color-mix(in srgb, var(--st) 9%, var(--glass)); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 14px; }
.action-panel h2 { font-size: .95rem; font-weight: 800; margin: 0 0 2px; }
.action-panel .instructions { color: var(--ink-2); font-size: .84rem; margin: 0; }
.action-panel .ap-main { flex: 1; min-width: 240px; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.waiting-panel { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; border: 1px dashed var(--line); border-radius: var(--r-card); padding: 10px 16px; color: var(--ink-2); font-size: .87rem; margin-bottom: 14px; background: var(--surface); }

/* legacy rail markup (render_stage_rail) */
.stage-rail { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(130px, 1fr); gap: 0; padding: 14px 16px 12px; margin: 0; overflow-x: auto; }
.stage { position: relative; padding-right: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage::after { content: ""; position: absolute; top: 14px; left: 32px; right: 4px; height: 2px; background: var(--line); }
.stage:last-child::after { display: none; }
.stage-done::after { background: var(--st-done); }
.stage-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--raised); color: var(--muted); font-size: .8rem; position: relative; z-index: 1; margin-bottom: 6px; }
.stage-num { font-size: .68rem; color: var(--muted-2); font-weight: 700; }
.stage-name { font-weight: 700; font-size: .84rem; line-height: 1.25; }
.stage-meta { font-size: .74rem; color: var(--muted); line-height: 1.35; }
.stage-done .stage-dot { background: var(--st-done); border-color: var(--st-done); color: #fff; }
.stage-current .stage-dot { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.stage-returned .stage-dot { border-color: var(--st-warn); color: var(--st-warn); }
.stage-rejected .stage-dot, .stage-cancelled .stage-dot { border-color: var(--st-closed); color: var(--st-closed); }

/* =========================================================================
   Activity feed / timeline
   ========================================================================= */
/* Activity: composer — one rounded field that grows, Post sits inside it */
.composer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 14px 18px 8px; border-bottom: 1px solid var(--line-2); }
.composer > .av { margin-top: 7px; }
.composer-field { position: relative; }
.composer-field textarea { display: block; min-height: 46px; padding: 12px 84px 12px 16px; border-radius: 23px; resize: none; line-height: 1.45; overflow-y: auto; }
.composer-field .btn { position: absolute; right: 7px; bottom: 7px; height: 32px; padding-top: 0; padding-bottom: 0; }
.composer-field .btn:disabled { opacity: .3; }
.composer-hint { grid-column: 2; margin: 0 0 0 16px; min-height: 1.2em; font-size: .74rem; color: var(--muted-2); opacity: 0; transition: opacity .15s; }
.composer:focus-within .composer-hint { opacity: 1; }

/* Activity tabs: a segmented pill, like the view sub-nav */
.activity-panel .activity-tabs { width: fit-content; max-width: calc(100% - 36px); margin: 14px 18px 2px; padding: 3px; gap: 2px; border: 0; border-radius: 999px; background: var(--well); }
.activity-panel .activity-tabs .nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border: 0; border-radius: 999px; color: var(--muted); font-size: .82rem; font-weight: 600; }
.activity-panel .activity-tabs .nav-link:hover { color: var(--ink); }
.activity-panel .activity-tabs .nav-link.active { background: var(--raised); color: var(--ink); box-shadow: 0 2px 8px rgba(16, 32, 52, .1); }
.activity-panel .activity-tabs .nav-link .count { margin: 0; background: transparent; padding: 0; font-weight: 600; color: var(--muted-2); }

/* Timeline: day markers on a continuous rail; notes hang off the rail as cards, workflow events are single lines */
.timeline { --rail-x: 33px; list-style: none; margin: 0; padding: 8px 18px 16px; position: relative; }
.timeline::before { content: ""; position: absolute; left: var(--rail-x); top: 22px; bottom: 26px; width: 2px; margin-left: -1px; background: var(--line); }
.tl-day { position: relative; padding: 12px 0 4px 44px; font-size: .76rem; font-weight: 650; color: var(--muted); }
.tl-day::before { content: ""; position: absolute; left: calc(var(--rail-x) - 18px - 5px); top: 50%; width: 10px; height: 10px; margin-top: -3px; border-radius: 50%; background: var(--raised); box-shadow: inset 0 0 0 2px var(--muted-2); }
.tl-item { position: relative; display: flex; gap: 12px; padding: 7px 0; }
.tl-icon, .tl-node { position: relative; z-index: 1; flex-shrink: 0; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; }
.tl-node .av { width: 32px; height: 32px; box-shadow: 0 0 0 3px var(--raised); }
.tl-icon { --tl: var(--muted-2); font-size: .88rem; color: color-mix(in srgb, var(--tl) 85%, var(--mix-fg)); background: color-mix(in srgb, var(--tl) 14%, var(--raised)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tl) 28%, transparent), 0 0 0 3px var(--raised); }
.tl-act-submit, .tl-act-resubmit { --tl: var(--st-legal); }
.tl-act-approve, .tl-act-client_sign, .tl-act-client_ack, .tl-act-client_esign, .tl-act-finalize { --tl: var(--st-done); }
.tl-act-sign, .tl-act-esign { --tl: var(--st-sign); }
.tl-act-send, .tl-act-followup { --tl: var(--st-client); }
.tl-act-return, .tl-act-document_changed { --tl: var(--st-warn); }
.tl-act-reject, .tl-act-cancel, .tl-act-override { --tl: var(--st-closed); }
.tl-item.tl-act-finalize .tl-icon { background: var(--st-done); color: #fff; }
.tl-body { min-width: 0; flex: 1; padding-top: 6px; }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: .86rem; line-height: 1.45; }
.tl-line { flex: 1 1 auto; min-width: 0; color: var(--ink-2); }
.tl-line strong { color: var(--ink); font-weight: 650; }
.tl-line .version-chip { vertical-align: 1px; }
.tl-time { flex: none; margin-left: auto; font-size: .74rem; color: var(--muted-2); white-space: nowrap; }
.tl-stage { --st: var(--st-draft); display: inline-flex; align-items: center; gap: 5px; margin-left: 2px; padding: 0 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1.6; vertical-align: 1px; white-space: nowrap;
  color: color-mix(in srgb, var(--st) 78%, var(--mix-fg)); background: color-mix(in srgb, var(--st) 12%, transparent); }
.tl-stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); }
.tl-stage.st-legal { --st: var(--st-legal); } .tl-stage.st-final { --st: var(--st-final); } .tl-stage.st-sign { --st: var(--st-sign); }
.tl-stage.st-client { --st: var(--st-client); } .tl-stage.st-done { --st: var(--st-done); } .tl-stage.st-closed { --st: var(--st-closed); }

/* Comment bubble (shared with the review / signature feeds) */
.tl-comment { margin-top: 6px; background: var(--well); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px 11px; font-size: .86rem; overflow-wrap: anywhere; }
/* A note: the card is the content, its squared corner points back to the author on the rail */
.tl-note .tl-comment { max-width: 68ch; margin-top: 7px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; background: var(--raised); color: var(--ink); font-size: .9rem; line-height: 1.55; box-shadow: 0 8px 18px -14px rgba(16, 28, 52, .35); }
/* A reason attached to a decision (returned, rejected…): quoted in the event's hue */
.tl-event .tl-comment { margin-top: 6px; padding: 7px 12px; border: 0; border-left: 3px solid var(--tl, var(--line)); border-radius: 0 12px 12px 0; background: color-mix(in srgb, var(--tl, var(--muted-2)) 7%, transparent); }
@media (max-width: 575.98px) {
  .composer { padding: 12px 14px 6px; }
  .composer > .av { display: none; }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer-hint { grid-column: 1; }
  .timeline { padding: 6px 14px 14px; --rail-x: 29px; }
  .tl-time { margin-left: 0; width: 100%; }
}

/* =========================================================================
   Lists, queues, related cards
   ========================================================================= */
.empty-state { text-align: center; padding: 38px 18px; color: var(--muted); }
.empty-state > i { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; font-size: 1.35rem; color: var(--muted); background: var(--well); box-shadow: inset 0 0 0 1px var(--rim); }
.empty-state p { margin-bottom: 10px; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line-2); font-size: .86rem; }
.queue-list li:last-child { border-bottom: 0; }
.queue-list li:hover { background: var(--hover); }
.queue-list .q-main { flex: 1; min-width: 0; }
.queue-list .q-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.queue-list .q-meta { font-size: .76rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-box { position: relative; height: 250px; }
.chart-box.tall { height: 310px; }

.nav-tabs-cms { border-bottom: 1px solid var(--line-2); gap: 2px; padding: 0 14px; flex-wrap: nowrap; overflow-x: auto; }
.nav-tabs-cms .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: .86rem; padding: 11px 10px; border-radius: 0; white-space: nowrap; }
.nav-tabs-cms .nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-tabs-cms .nav-link.active { color: var(--ink); border-bottom-color: var(--ink); background: transparent; }
.nav-tabs-cms .nav-link .count { font-size: .7rem; background: var(--well); border-radius: 8px; padding: 0 6px; margin-left: 4px; color: var(--muted); }

.service-tile { border: 1px solid var(--line); border-radius: var(--r-tile); padding: 12px; height: 100%; }
.service-tile.availed { border-color: color-mix(in srgb, var(--st-done) 30%, var(--mix-bg)); background: color-mix(in srgb, var(--st-done) 4%, var(--mix-bg)); }
.service-tile h3 { font-size: .9rem; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.version-chip { display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }
.final-chip, .primary-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
.final-chip { background: color-mix(in srgb, var(--st-done) 13%, var(--mix-bg)); color: color-mix(in srgb, var(--st-done) 72%, var(--mix-fg)); }
.primary-chip { background: color-mix(in srgb, var(--st-client) 15%, var(--mix-bg)); color: color-mix(in srgb, var(--st-client) 66%, var(--mix-fg)); }

.related-card { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); margin-bottom: 14px; }
.related-card .panel-head { padding: 10px 14px; min-height: 0; }
.related-list { list-style: none; margin: 0; padding: 4px 0; }
.related-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 14px; font-size: .85rem; }
.related-list li + li { border-top: 1px solid var(--line-2); }
.related-list .rl-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--line-2); display: grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.related-list .rl-icon.is-final { background: color-mix(in srgb, var(--st-done) 14%, var(--mix-bg)); color: var(--st-done); }
.related-list .rl-icon.is-primary { background: color-mix(in srgb, var(--st-client) 16%, var(--mix-bg)); color: color-mix(in srgb, var(--st-client) 70%, var(--mix-fg)); }
.related-list .rl-main { flex: 1; min-width: 0; }
.related-list .rl-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.related-list .rl-meta { font-size: .75rem; color: var(--muted); }

/* =========================================================================
   Board (kanban pipeline)
   ========================================================================= */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { --st: var(--st-draft); background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); padding: 0 8px 8px; min-height: 140px; }
.board-col-head { display: flex; align-items: center; gap: .5rem; padding: 14px 14px 10px; margin: 0 -8px 4px; border-radius: var(--r-card) var(--r-card) 0 0; }
.board-col-head::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--st); flex: none; align-self: flex-start; margin-top: 5px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 18%, transparent); }
.board-col-head h2 { font-size: .86rem; font-weight: 800; margin: 0; }
.board-col-head .n { margin-left: auto; font-size: .74rem; font-weight: 800; color: color-mix(in srgb, var(--st) 75%, var(--mix-fg)); background: color-mix(in srgb, var(--st) 15%, var(--mix-bg)); border-radius: 9px; padding: 0 8px; }
.board-col-head .who { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; }
.deal-card { display: block; background: var(--glass-3); border: 1px solid var(--rim); border-radius: var(--r-tile); padding: 11px 12px; margin-bottom: 8px; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.deal-card:hover { border-color: color-mix(in srgb, var(--st) 55%, var(--mix-bg)); box-shadow: 0 4px 14px rgba(16, 28, 52, .1); text-decoration: none; }
.deal-card .dc-ref { font-size: .72rem; font-weight: 700; color: var(--primary); }
.deal-card .dc-title { font-weight: 700; font-size: .88rem; line-height: 1.3; margin: 2px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deal-card .dc-brand { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--ink-2); margin-bottom: 8px; }
.deal-card .dc-foot { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: var(--muted); }
.deal-card .dc-foot .ms-auto { margin-left: auto; }
.deal-card .dc-money { font-weight: 700; color: var(--ink-2); }
.age-chip { font-weight: 700; font-size: .72rem; border-radius: 5px; padding: 1px 6px; background: var(--line-2); color: var(--ink-2); }
.age-chip.late { background: color-mix(in srgb, var(--st-closed) 13%, var(--mix-bg)); color: color-mix(in srgb, var(--st-closed) 72%, var(--mix-fg)); }
.board-empty { font-size: .8rem; color: var(--muted); text-align: center; padding: 18px 6px; border: 1.5px dashed var(--line); border-radius: var(--r-tile); }

/* =========================================================================
   Dashboard funnel (pipeline strip)
   ========================================================================= */
.funnel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.funnel li { --st: var(--st-draft); min-width: 0; }
.funnel a { display: block; color: #fff; padding: 16px 22px 15px 28px; background: var(--st); clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%); min-width: 0; }
.funnel li:first-child a { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); border-radius: 18px 0 0 18px; padding-left: 20px; }
.funnel li:last-child a { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%); border-radius: 0 18px 18px 0; }
.funnel a:hover { text-decoration: none; filter: brightness(1.06); }
.funnel .f-n { font-size: 1.9rem; font-weight: 650; line-height: 1.1; letter-spacing: -.03em; display: block; }
.funnel .f-l { font-size: .76rem; font-weight: 600; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.funnel .is-zero a { background: color-mix(in srgb, var(--st) 16%, var(--glass-2)); color: color-mix(in srgb, var(--st) 70%, var(--mix-fg)); }

.section-title { font-size: 1.2rem; font-weight: 650; margin: 28px 0 12px; letter-spacing: -.02em; }

/* =========================================================================
   Quick create drawer
   ========================================================================= */
.qc-grid { display: grid; gap: 10px; }
.qc-tile { --st: var(--primary); display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-tile); color: var(--ink); }
.qc-tile:hover { border-color: color-mix(in srgb, var(--st) 40%, transparent); background: color-mix(in srgb, var(--st) 7%, transparent); text-decoration: none; color: var(--ink); }
.qc-tile .qc-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: var(--st); flex-shrink: 0; }
.qc-tile strong { display: block; font-size: .95rem; }
.qc-tile span { font-size: .8rem; color: var(--muted); }

/* =========================================================================
   Auth & installer
   ========================================================================= */
@media (max-width: 767.98px) { .auth-page { grid-template-columns: 1fr; } .auth-aside { display: none; } }
.install-wrap { max-width: 780px; margin: 32px auto; padding: 0 16px; }
.check-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.test-email-box { border: 1px dashed var(--line); background: var(--hover); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 4px; }

/* =========================================================================
   Print
   ========================================================================= */
@media print {
  .mesh, .top, .dock, .view-tabs, .app-footer, .page-actions, .record-actions, .filter-bar, .filter-drawer, .pager, .no-print, .breadcrumb, .btn, .action-panel, .composer { display: none !important; }
  .app { display: block; padding: 0; max-width: none; }
  .panel, .rsec, .record-hero, .kpi, .board-col { box-shadow: none !important; background: #fff !important; }
  body { background: #fff; font-size: 11px; }
  .panel, .rsec, .record-hero, .path-wrap, .related-card { border: 0; }
  .record-grid { display: block; }
  .table-cms thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .path-chev, .badge-status, .funnel a { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
  a { color: inherit; }
}
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* lists & boards */
.list-form { position: relative; }
.list-toolbar { display: flex; align-items: center; gap: .6rem; min-height: 54px; padding: 10px 128px 10px 16px; border-bottom: 1px solid var(--line-2); }
.list-search { position: relative; flex: 1 1 auto; max-width: 440px; min-width: 0; }
.list-search > .bi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; font-size: .85rem; }
.list-search .form-control { height: 36px; padding-left: 34px; font-size: .86rem; background: var(--field); border-radius: 999px; }
.list-search .form-control:focus { background: var(--field); }
.list-toolbar .list-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.list-toolbar .list-reset { font-size: .8rem; white-space: nowrap; }
.list-form > .filter-drawer > summary { position: absolute; top: 10px; right: 16px; padding: 0 !important; border: 0 !important; }
.list-form > .filter-drawer > summary .filter-toggle { height: 34px; }
.list-form > .filter-drawer[open] > summary .filter-toggle { background: var(--primary-50); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--primary-600); }
.list-form .filter-bar { border-radius: 0; }
.list-form .filter-bar .form-control, .list-form .filter-bar .form-select { min-width: 140px; }
.list-tabs { border-bottom: 0; }
.list-tabs + .list-form .list-toolbar, .list-tabs + .list-toolbar { border-top: 1px solid var(--line); }
.th-sep { color: var(--muted-2); margin: 0 .2rem; }
.table-cms .cell-entity .ref { display: inline-block; }
.cell-title { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .77rem; color: var(--muted); margin-top: 1px; }
.cell-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.link-ink { color: var(--ink); font-weight: 600; }
.link-ink:hover { color: var(--primary-600); }
.term { white-space: nowrap; font-size: .8rem; color: var(--ink-2); }
.sig-stack { display: grid; grid-template-columns: auto auto; gap: 3px 6px; align-items: center; justify-content: start; }
.sig-stack .sig-l { font-size: .72rem; color: var(--muted); }
.badge-status.badge-sm { font-size: .7rem; padding: 0 7px 0 6px; gap: .3rem; }
.lock-flag { color: var(--st-closed); font-size: .72rem; margin-left: .25rem; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; }
.table-cms .col-act { width: 1%; white-space: nowrap; text-align: right; }
.person-role { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; color: var(--ink-2); }
.av-role { --h: 220; background: var(--line-2); color: var(--muted); }
.kpi-grid.kpi-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.kpi .kpi-label, .kpi .kpi-value, .kpi .kpi-note { display: block; }
.kpi .kpi-label { display: flex; }

/* boards */
.board { grid-auto-columns: minmax(244px, 1fr); }
.board-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 12px; }
.board-toolbar .form-select { width: auto; min-width: 180px; max-width: 100%; height: 32px; padding-top: 0; padding-bottom: 0; font-size: .82rem; }
.board-toolbar .board-meta { margin-left: auto; font-size: .8rem; color: var(--muted); }
.board-col-head .bch-text { min-width: 0; }
.board-col-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-col-head .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-col-head .n { align-self: flex-start; margin-top: 1px; }
.deal-card .dc-brand span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-card .lock-flag { float: right; }
@media (max-width: 767.98px) {
  .board { grid-auto-columns: 84%; scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  .board-toolbar .board-meta { margin-left: 0; width: 100%; }
  .list-toolbar .list-meta { display: none; }
}

/* record pages */
.record-hero-top > .bm-xl { margin-top: 2px; }
.record-type .dot-sep { color: var(--muted-2); font-weight: 500; }
.record-type .badge-status { font-size: .7rem; }
.record-actions .btn-icon { width: 36px; padding-left: 0; padding-right: 0; }
.record-actions .dropdown-item.text-danger:active { color: #fff !important; }
.record-actions form { margin: 0; }
.hl-value .person { font-weight: 700; }
.hl-value .person > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.hl-value .days-left { font-size: .82rem; }

/* "your step" + waiting panels */
.action-panel .ap-icon, .waiting-panel .wp-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--st); color: #fff; font-size: 1rem; }
.action-panel .ap-doc { font-size: .78rem; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.action-panel .action-buttons { align-items: center; }
.waiting-panel { --st: var(--st-draft); }
.waiting-panel .wp-icon { width: 28px; height: 28px; border-radius: 8px; font-size: .85rem; background: color-mix(in srgb, var(--st) 14%, var(--mix-bg)); color: color-mix(in srgb, var(--st) 80%, var(--mix-fg)); }
.waiting-panel .wp-sep { color: var(--muted-2); }
.waiting-panel .wp-meta { color: var(--muted); }
.waiting-panel .person { font-weight: 600; color: var(--ink); }

/* details column */
.field-list > div.fl-block { grid-template-columns: 1fr; gap: 2px; }
.field-list dd .person { white-space: normal; }
.rsec-note { font-size: .84rem; color: var(--muted); margin: 0; }
.rsec-sub { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin: 12px 0 6px; }
.svc-block { border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 10px 2px; margin-bottom: 8px; }
.svc-block.is-availed { border-color: color-mix(in srgb, var(--st-done) 28%, var(--mix-bg)); background: color-mix(in srgb, var(--st-done) 3%, var(--mix-bg)); }
.svc-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 700; font-size: .86rem; padding: 6px 0 4px; border-bottom: 1px solid var(--line-2); }
.svc-block .field-list > div { font-size: .82rem; padding: 5px 0; }

/* activity column */
.feed-list { list-style: none; margin: 0; padding: 4px 0; }
.feed-list > li { display: flex; gap: 12px; padding: 11px 16px; align-items: flex-start; }
.feed-list > li + li { border-top: 1px solid var(--line-2); }
.feed-list > li.is-muted { opacity: .65; }
.feed-list .fl-main { flex: 1; min-width: 0; }
.feed-list .fl-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .86rem; }
.feed-list .fl-time { margin-left: auto; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.feed-list .fl-meta { font-size: .78rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }

/* related column */
.related-card .panel-head .btn-sm { padding-top: 2px; padding-bottom: 2px; }
.related-list li > .badge-status { flex-shrink: 0; margin-top: 2px; }
.related-list .rl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.related-list .rl-who { display: flex; align-items: center; gap: .35rem; margin-top: 3px; min-width: 0; }
.related-list .rl-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-list .rl-actions { display: flex; gap: 2px; flex-shrink: 0; }
.related-list .rl-act { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.related-list .rl-act:hover { background: var(--line-2); color: var(--primary-600); text-decoration: none; }
.related-sub { font-size: .76rem; font-weight: 700; color: var(--muted); padding: 10px 14px 0; }
.related-empty { font-size: .84rem; color: var(--muted); margin: 0; padding: 12px 14px; }
.related-foot { border-top: 1px solid var(--line-2); padding: 8px 14px; font-size: .82rem; font-weight: 600; }
.related-card .stat-list { margin: 0; padding: 6px 14px 10px; }
.related-card .stat-list > div { display: flex; justify-content: space-between; gap: .5rem; padding: 6px 0; font-size: .85rem; border-bottom: 1px dashed var(--line-2); }
.related-card .stat-list > div:last-child { border-bottom: 0; }
.related-card .stat-list dt { color: var(--muted); font-weight: 500; }
.related-card .stat-list dd { margin: 0; font-weight: 700; }

/* compact tables in the centre column (brand page) */
.table-compact td, .table-compact th { padding-top: 8px; padding-bottom: 8px; }
.table-compact .cell-sub { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 575.98px) {
  .record-hero-top { padding: 14px; gap: 12px; }
  .record-hero-top > .bm-xl { width: 40px; height: 40px; font-size: .85rem; }
  .record-hero-main { min-width: 0; flex-basis: calc(100% - 56px); }
  .record-hero h1 { font-size: 1.2rem; }
  .record-actions { width: 100%; }
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hl { padding: 8px 14px; border-bottom: 1px solid var(--line-2); }
  .hl:nth-child(2n) { border-right: 0; }
  .action-panel { padding: 12px; }
  .action-panel .ap-main { min-width: 0; flex-basis: calc(100% - 50px); }
  .action-panel .action-buttons { width: 100%; }
  .feed-list .fl-time { margin-left: 0; width: 100%; }
}
.table-responsive { position: relative; }
/* record pages (2) */
.hl-value.wrap { white-space: normal; line-height: 1.3; }
@media (min-width: 1400px) { .record-grid { grid-template-columns: 290px minmax(0, 1fr) 310px; } }
.chip-labelled { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; color: var(--muted); font-weight: 600; }

/* =========================================================================
   dashboard & misc
   ========================================================================= */
.dash-hello { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 6px; }
.dash-hello-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-hello-main .av-lg { width: 44px; height: 44px; font-size: .95rem; }
.dash-hello .page-subtitle { margin-top: 1px; }
.dash-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-quick .btn i { color: var(--muted); }
.dash-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.dash-head .section-title { margin-bottom: 10px; }
.funnel { margin-bottom: 16px; }
.funnel a { height: 100%; }
.funnel .f-l { white-space: normal; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.funnel .f-n { font-variant-numeric: tabular-nums; }
.kpi-value { font-variant-numeric: tabular-nums; }


/* queue rows: brand mark · ref + title · stage chip + due chip */
.dash-q li { padding: 0; }
.dash-q .q-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; width: 100%; color: var(--ink); min-width: 0; }
.dash-q .q-row:hover { text-decoration: none; }
.dash-q .q-row:hover .q-title { color: var(--primary-600); }
.q-ref { font-weight: 700; color: var(--primary-600); margin-right: 2px; }
.dash-q .q-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; max-width: 46%; }
.dash-q .q-side .badge-status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dash-q .q-side-row { display: inline-flex; align-items: center; gap: 6px; }
.q-time { font-size: .74rem; color: var(--muted); white-space: nowrap; align-self: flex-start; padding-top: 2px; }
.act-list li { align-items: flex-start; }
.act-list .q-meta strong { color: var(--ink-2); font-weight: 650; }
.act-list .q-title { font-weight: 500; font-size: .84rem; }

/* expirations timeline */
.exp-list { list-style: none; margin: 0; padding: 6px 0; position: relative; }
.exp-list li { position: relative; }
.exp-list li + li::before { content: ""; position: absolute; left: 37px; top: -8px; height: 16px; border-left: 2px dotted var(--line); }
.exp-list a { display: flex; align-items: center; gap: 12px; padding: 8px 16px; color: var(--ink); min-width: 0; }
.exp-list a:hover { background: var(--hover); text-decoration: none; }
.exp-list a:hover .q-title { color: var(--primary-600); }
.exp-date { width: 46px; flex-shrink: 0; text-align: center; border: 1px solid var(--rim); border-top: 3px solid var(--st-done); border-radius: 12px; padding: 3px 0 4px; background: var(--glass-3); line-height: 1.1; }
.exp-list li.is-soon .exp-date { border-top-color: var(--st-client); }
.exp-date .m { display: block; font-size: .64rem; font-weight: 700; color: var(--muted); }
.exp-date .d { display: block; font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.exp-main { flex: 1; min-width: 0; }
.exp-main .q-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.exp-main .q-meta { font-size: .76rem; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }

/* queue tabs */
.dash-tabs .nav-tabs-cms { padding-top: 2px; }
.nav-tabs-cms .nav-link .count.is-late { background: color-mix(in srgb, var(--st-closed) 14%, var(--mix-bg)); color: color-mix(in srgb, var(--st-closed) 72%, var(--mix-fg)); }
.nav-tabs-cms button.nav-link { background: none; }

/* charts */
.chart-panel .panel-head { align-items: flex-start; }
.chart-sub { margin: 2px 0 0; font-size: .76rem; color: var(--muted); }
.chart-hint { margin-top: 8px; font-size: .74rem; color: var(--muted-2); }
.dash-howto { margin-top: 16px; }
.dash-howto > summary { list-style: none; cursor: pointer; border-bottom: 0; }
.dash-howto > summary::-webkit-details-marker { display: none; }
.dash-howto[open] > summary { border-bottom: 1px solid var(--line-2); }
.dash-howto-caret { color: var(--muted); transition: transform .15s; }
.dash-howto[open] .dash-howto-caret { transform: rotate(180deg); }
.dash-howto dt { font-weight: 650; }
.dash-two { margin-bottom: 4px; }

@media (max-width: 575.98px) {
  .dash-quick { width: 100%; }
  .funnel { grid-auto-columns: minmax(104px, 1fr); }
  .dash-q .q-row { flex-wrap: wrap; }
  .dash-q .q-side { flex-direction: row; max-width: 100%; margin-left: 34px; align-items: center; }
}
/* stage classes must beat the `.funnel li` / `.auth-path li` defaults */
.funnel li.st-draft, .auth-path li.st-draft { --st: var(--st-draft); }
.funnel li.st-legal, .auth-path li.st-legal { --st: var(--st-legal); }
.funnel li.st-final, .auth-path li.st-final { --st: var(--st-final); }
.funnel li.st-sign, .auth-path li.st-sign { --st: var(--st-sign); }
.funnel li.st-client, .auth-path li.st-client { --st: var(--st-client); }
/* client stage, still on our side (not yet sent): between internal signing and client */
.funnel li.st-ready { --st: color-mix(in srgb, var(--st-client) 55%, var(--st-sign)); }
.funnel li.st-done, .auth-path li.st-done { --st: var(--st-done); }
.funnel li.st-closed, .auth-path li.st-closed { --st: var(--st-closed); }
.hl-sub { font-size: .76rem; font-weight: 500; color: var(--muted); }
@media (max-width: 575.98px) {
  .dash-q .q-main { flex: 1 1 calc(100% - 40px); }
  .dash-q .q-side { margin-left: 34px; }
  .dash-hello-main .av-lg { display: none; }
}
.board-col.st-draft { --st: var(--st-draft); } .board-col.st-legal { --st: var(--st-legal); } .board-col.st-final { --st: var(--st-final); }
.board-col.st-sign { --st: var(--st-sign); } .board-col.st-client { --st: var(--st-client); } .board-col.st-done { --st: var(--st-done); }
.board-col-head { background: transparent; }
/* login */
/* record pages (3): stage hue on panels (must beat the base --st defaults) */
.action-panel.st-draft, .waiting-panel.st-draft { --st: var(--st-draft); }
.action-panel.st-legal, .waiting-panel.st-legal { --st: var(--st-legal); }
.action-panel.st-final, .waiting-panel.st-final { --st: var(--st-final); }
.action-panel.st-sign, .waiting-panel.st-sign { --st: var(--st-sign); }
.action-panel.st-client, .waiting-panel.st-client { --st: var(--st-client); }
.action-panel.st-done, .waiting-panel.st-done { --st: var(--st-done); }
.action-panel.st-closed, .waiting-panel.st-closed { --st: var(--st-closed); }
.field-list dd .badge-status { white-space: normal; max-width: 100%; }
.col-details .rsec-body .fw-semibold .person { font-weight: 600; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 6px; vertical-align: middle; }
/* reports index */
.section-title .count-pill { font-weight: 600; color: var(--muted); font-size: .74rem; background: var(--line-2); border-radius: 10px; padding: 1px 8px; }
.section-title > i { color: var(--muted-2); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-bottom: 8px; }
.report-tile { --rt: var(--primary); display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); color: var(--ink); position: relative; overflow: hidden; }

.report-tile:hover { border-color: color-mix(in srgb, var(--rt) 40%, transparent); text-decoration: none; background: var(--glass-2); color: var(--ink); }
.report-tile .rt-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--rt) 12%, var(--mix-bg)); color: color-mix(in srgb, var(--rt) 85%, var(--mix-fg)); }
.report-tile .rt-main { flex: 1; min-width: 0; }
.report-tile strong { display: block; font-size: .9rem; }
.report-tile .rt-main span { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.report-tile .rt-go { color: var(--muted-2); align-self: center; }
.related-card .empty-state { padding: 18px 14px; font-size: .84rem; } .related-card .empty-state > i { font-size: 1.4rem; }
.routing-who { display: flex; gap: .5rem; align-items: flex-start; font-weight: 700; font-size: .88rem; margin-top: 4px; overflow-wrap: anywhere; } .routing-who .av { margin-top: -2px; }
.rpt-table td a { white-space: nowrap; }
@media (max-width: 767.98px) { .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-strip > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
/* installer */
.install-wrap .panel-title .step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-50); color: var(--primary-600); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 800; margin-right: 4px; }
.install-wrap .h4 { font-weight: 800; letter-spacing: -.02em; }
.dash-hello + .row, .dash-hello + .panel { margin-top: 14px; }
.role-ic { width: 26px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--st-legal) 12%, var(--mix-bg)); color: var(--st-legal); font-size: .8rem; }
.table-cms code { color: var(--ink-2); font-size: .8rem; }
.doc-ic { display: inline-grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px; background: var(--primary-50); color: var(--primary-600); font-size: .95rem; }

/* Searchable select (select[data-searchable] in app.js) */
.ss { position: relative; }
.ss-toggle { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-panel { position: absolute; z-index: 1060; top: calc(100% + 4px); left: 0; right: 0; min-width: 240px; padding: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-float); box-shadow: var(--shadow-float); }
.ss-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ss-list li { padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink); }
.ss-list li.active { background: var(--primary-50); color: var(--primary-600); }
.ss-list li[aria-selected="true"] { font-weight: 600; }
.ss-list .ss-empty { color: var(--muted); cursor: default; }

/* Global: every modal is vertically centered (same as Bootstrap's .modal-dialog-centered) */
.modal-dialog { display: flex; align-items: center; min-height: calc(100% - var(--bs-modal-margin) * 2); }

/* =========================================================================
   Contract editor (modules/contracts/draft.php): editor left, A4 preview right
   ========================================================================= */
.draft-head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.draft-title h1 { font-size: 1.3rem; margin: 2px 0 0; }
.draft-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.save-status { font-size: .82rem; color: var(--muted); margin-right: 4px; }
.save-status[data-tone="ok"] { color: var(--st-done); }
.save-status[data-tone="danger"] { color: var(--st-closed); font-weight: 600; }
.draft-split { display: grid; grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 220px); min-height: 520px;
  background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.draft-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.draft-edit .tox-tinymce { border: 0 !important; border-radius: 0 !important; flex: 1; }
/* Hidden page-layout frame (draft-editor.js): laid out offscreen, never seen. */
.draft-paginator { position: absolute; left: -10000px; top: 0; width: 1000px; height: 600px; border: 0; visibility: hidden; pointer-events: none; }
@media (max-width: 991.98px) {
  .draft-split { height: calc(100vh - var(--topbar-h) - 170px); }
}
.pdf-frame { width: 100%; height: 78vh; border: 0; display: block; background: #525659; }
.field-list-sig { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.field-list-sig li { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.field-list-sig .fs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: .85rem; }
.field-list-sig .fs-main span { color: var(--muted); overflow-wrap: anywhere; }
.field-list-sig .fs-party { font-size: .72rem; font-weight: 700; color: var(--st-sign) !important; }
.field-list-sig .fs-party.fs-client { color: var(--st-client) !important; }
.field-list-sig .fs-act { display: flex; gap: 4px; }

/* Signature pad (internal e-sign modal and public sign.php) */
.esign-pad .sig-surface { position: relative; border: 1px dashed var(--muted-2); border-radius: var(--r-sm); background: #fff; aspect-ratio: 3 / 1; width: 100%; touch-action: none; }
.esign-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--r-sm); }
.esign-pad .sig-baseline { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px solid var(--line); pointer-events: none; }
.esign-pad .sig-x { position: absolute; left: 3%; bottom: 22%; color: var(--muted-2); font-weight: 700; pointer-events: none; }
.esign-pad .sig-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.esign-consent { background: var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: .85rem; }
.esign-fields { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.esign-fields li { display: flex; gap: 8px; align-items: center; font-size: .88rem; }
.esign-fields li i { color: var(--st-sign); }
.method-chip { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.method-chip.is-electronic { background: color-mix(in srgb, var(--st-sign) 14%, var(--mix-bg)); color: color-mix(in srgb, var(--st-sign) 72%, var(--mix-fg)); }

/* Public client signing page (sign.php) */
.esign-page { min-height: 100vh; background: radial-gradient(60vmax 60vmax at 0% 0%, var(--mesh-a), transparent 70%), radial-gradient(70vmax 70vmax at 100% 100%, var(--mesh-b), transparent 70%), var(--bg); background-attachment: fixed; }
.esign-main { max-width: 1320px; margin: 0 auto; padding: 24px 20px; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.esign-doc { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.esign-doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); background: var(--glass-2); }
.esign-doc-bar .edb-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esign-doc-bar .edb-title i { color: var(--primary); font-size: 1.1rem; }
.esign-doc-bar .btn { flex-shrink: 0; }
.esign-doc iframe { width: 100%; height: calc(100vh - 110px); min-height: 520px; border: 0; display: block; background: #525659; }
.pdfv-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pdfv-group { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--well); }
.pdfv-btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: .85rem; font-weight: 600; text-decoration: none; transition: background-color .15s; }
.pdfv-btn:hover:not(:disabled) { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 28, 52, .1); }
.pdfv-btn:disabled { opacity: .35; }
.pdfv-zoom-label { min-width: 52px; font-variant-numeric: tabular-nums; }
.pdfv-count { display: flex; align-items: center; gap: 6px; margin: 0 4px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.pdfv-count input { width: 44px; height: 26px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); text-align: center; font-weight: 600; -moz-appearance: textfield; appearance: textfield; }
.pdfv-count input::-webkit-inner-spin-button, .pdfv-count input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pdfv-single .pdfv-pager { display: none; }
.pdfv-stage { position: relative; height: calc(100vh - 110px); min-height: 520px; overflow: hidden; display: grid; place-items: center; background: #e4e8ee; }
/* Zoomed in: a block so the page can be scrolled to every edge (a centred grid item would clip its left side). */
.pdfv-stage.is-zoomed { overflow: auto; display: block; }
.pdfv-stage.is-zoomed .pdfv-sheet, .pdfv-stage.is-zoomed .rv-scaler { margin: 16px auto; width: max-content; }
.pdfv-sheet { line-height: 0; }
.pdfv-sheet canvas { display: block; background: #fff; border-radius: 2px; box-shadow: 0 1px 3px rgba(17, 26, 46, .16), 0 12px 32px -12px rgba(17, 26, 46, .3); }
.pdfv-turn-next { animation: pdfv-in-next .25s var(--ease); }
.pdfv-turn-prev { animation: pdfv-in-prev .25s var(--ease); }
@keyframes pdfv-in-next { from { opacity: 0; transform: translateX(24px); } }
@keyframes pdfv-in-prev { from { opacity: 0; transform: translateX(-24px); } }
.pdfv-status { color: var(--muted); font-size: .9rem; display: flex; align-items: center; }
.pdfv-stage iframe { position: absolute; inset: 0; height: 100%; min-height: 0; }
[data-theme="dark"] .pdfv-stage { background: #23262d; }
@media (prefers-reduced-motion: reduce) { .pdfv-turn-next, .pdfv-turn-prev { animation: none; } }
@media (max-width: 575.98px) { .esign-doc-bar .edb-title { display: none; } .esign-doc-bar { justify-content: center; padding-inline: 8px; } .pdfv-tools { gap: 4px; } }
.esign-side { background: var(--glass-3); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 22px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; }
.esign-side h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.015em; margin: 10px 0 14px; }
.esign-head { margin-bottom: 18px; }
.esign-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; background: var(--primary-50); color: var(--primary); }
.esign-docref { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-tile); background: var(--well); margin-bottom: 10px; }
.esign-docref > i { font-size: 1.25rem; color: var(--primary); line-height: 1.2; }
.esign-docref strong, .esign-docref span { display: block; overflow-wrap: anywhere; }
.esign-docref span { color: var(--muted); font-size: .86rem; }
.esign-who { display: flex; gap: 10px; align-items: center; padding: 0 2px; }
.esign-who > div { min-width: 0; }
.esign-who strong, .esign-who > div span { display: block; overflow-wrap: anywhere; line-height: 1.3; }
.esign-who > div span { color: var(--muted); font-size: .84rem; }
.esign-who .esign-who-role { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); }
.esign-steps { list-style: none; padding: 0; margin: 0 0 16px; counter-reset: es; border-top: 1px solid var(--line-2); }
.esign-steps > li { position: relative; padding: 16px 0 4px 38px; counter-increment: es; }
.esign-steps > li::before { content: counter(es); position: absolute; left: 0; top: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--primary); color: #fff; }
.esign-steps > li + li { border-top: 1px dashed var(--line); }
.esign-step-t { font-weight: 700; margin-bottom: 6px; }
.esign-step-d { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.esign-steps .esign-fields { margin-bottom: 8px; }
.esign-steps .esign-fields li { padding: 7px 10px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--st-sign) 8%, transparent); }
.esign-cta { font-weight: 700; border-radius: 14px; padding-block: 12px; box-shadow: 0 10px 22px -12px var(--primary); }
.esign-more { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-tile); overflow: hidden; }
.esign-more details + details { border-top: 1px solid var(--line); }
.esign-more summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; }
.esign-more summary::-webkit-details-marker { display: none; }
.esign-more summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; font-size: .75rem; color: var(--muted); transition: transform .2s var(--ease); }
.esign-more details[open] summary::after { transform: rotate(180deg); }
.esign-more summary:hover { background: var(--hover); }
.esign-more summary i { color: var(--muted); }
.esign-more form { padding: 2px 14px 14px; font-size: .86rem; }
.esign-foot { display: flex; gap: 8px; margin: 16px 0 0; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.esign-foot i { color: var(--st-done); margin-top: 1px; }
.esign-msg { max-width: 460px; margin: 10vh auto; background: var(--glass-3); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 36px 32px 28px; text-align: center; }
.esign-msg h1 { font-weight: 700; letter-spacing: -.01em; margin-bottom: 8px; }
.esign-msg p.text-secondary { line-height: 1.55; margin-bottom: 22px; }
.esign-icon { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.esign-icon i { font-size: 1.7rem; }
.esign-note { font-size: .82rem; color: var(--muted); text-align: center; margin: 20px -32px 0; padding: 16px 32px 0; border-top: 1px solid var(--line-2); }
.esign-centered { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.esign-centered .esign-msg { width: 100%; margin: 0; }
.esign-centered .otp-input { height: 60px; border-radius: 14px; }
.esign-centered .otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.esign-centered .otp-input::placeholder { color: var(--muted-2); opacity: .5; }
@media (max-width: 575.98px) { .esign-msg { padding: 28px 20px 22px; } .esign-note { margin-inline: -20px; padding-inline: 20px; } }
@media (max-width: 991.98px) { .esign-main { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 32px; } .esign-side { position: static; max-height: none; } .esign-doc iframe, .pdfv-stage { height: 70vh; min-height: 420px; } }
.otp-input { letter-spacing: .4em; font-weight: 700; font-size: 1.4rem; }

/* Client review of a proposal (sign.php review links, assets/js/client-review.js) */
/* Pages laid out like the PDF by CmsDocPreview (doc-preview.js), one shown at a time (assets/js/review-pages.js) */
.rv-scaler { position: relative; flex-shrink: 0; }
.rv-pages { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.rv-pages .page { position: relative; overflow: hidden; box-sizing: border-box; padding: 0 20mm 22mm; background: #fff; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(17, 26, 46, .16), 0 12px 32px -12px rgba(17, 26, 46, .3); }
.rv-pages .page .doc-letterhead { position: absolute; left: 20mm; right: 20mm; }
.rv-pages .page .doc-letterhead.lh-banner { left: 0; right: 0; }
.rv-pages .page .doc-body { overflow: hidden; }
.rv-pages .page .pg-foot { position: absolute; left: 0; right: 0; bottom: 8mm; text-align: center; font: 7.5pt "DejaVu Serif", Georgia, serif; color: #595959; }
.rv-pages.paginating .sig-float { display: none; }
.review-doc.is-loading .rv-scaler { visibility: hidden; position: absolute; }
.review-doc.rv-flat .esign-doc-bar .pdfv-tools > .pdfv-group { display: none; }
.review-doc.rv-flat .pdfv-stage { display: block; overflow: auto; padding: 16px; }
.review-doc.rv-flat .rv-scaler, .review-doc.rv-flat .rv-pages { position: static; width: auto !important; height: auto !important; transform: none !important; }
.review-doc.rv-flat .rv-pages { background: #fff; padding: 12mm 20mm; }
.review-body [data-rb] { cursor: text; border-radius: 2px; transition: background-color .15s; }
.review-body [data-rb]:hover { background: color-mix(in srgb, var(--st-client) 8%, transparent); }
.review-side { max-height: calc(100vh - 48px); overflow: auto; }
.review-list-title { font-size: .9rem; font-weight: 700; margin: 4px 0 6px; }
@media (max-width: 991.98px) { .review-side { max-height: none; } }
/* Word-style comments beside a document (doc-comments.js): review link, Review & comment page, editor. */
.review-main { max-width: 1640px; grid-template-columns: minmax(0, 1fr) 340px; }
.cm-split { display: flex; min-height: 0; }
.cm-split > .pdfv-stage, .cm-split > .cm-pdf { flex: 1; min-width: 0; }
.cm-pdf { height: calc(100vh - 110px); min-height: 520px; border: 0; display: block; background: #525659; }
.cm-pane { width: 310px; flex-shrink: 0; position: relative; height: calc(100vh - 110px); min-height: 520px; overflow: hidden auto; background: var(--glass-2); border-left: 1px solid var(--line); }
.cm-review .pdfv-stage, .cm-review .cm-pane, .cm-review .cm-pdf { height: calc(100vh - var(--topbar-h) - 230px); }
.cm-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; font-size: .82rem; background: var(--glass-2); border-bottom: 1px solid var(--line); }
.cm-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cm-count { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--well); color: var(--muted); }
.cm-toggle { display: flex; align-items: center; gap: 5px; color: var(--muted); margin: 0; cursor: pointer; }
.cm-track { position: relative; margin: 8px 0; }
.cm-card, .cm-offer, .cm-empty, .cm-more, .cm-new { position: absolute; left: 10px; right: 10px; }
.cm-offer, .cm-new { right: auto; }
.cm-card { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .84rem; box-shadow: 0 1px 2px rgba(16, 28, 52, .06); transition: top .15s ease, box-shadow .15s ease; }
.cm-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent), 0 4px 14px rgba(16, 28, 52, .12); z-index: 2; }
.cm-card.is-resolved { opacity: .72; }
.cm-card.is-pending { border-style: dashed; }
.cm-card.is-compose { border-color: var(--primary); z-index: 2; }
.cm-who { display: flex; align-items: center; gap: 8px; }
.cm-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .7rem; font-weight: 700; color: #fff; background: var(--primary); }
.cm-avatar.is-client { background: var(--st-client); }
.cm-name { flex: 1; min-width: 0; line-height: 1.25; }
.cm-name strong { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-name span { font-size: .7rem; color: var(--muted); }
.cm-act { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.cm-act:hover { background: var(--line-2); color: var(--primary); }
.cm-text { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-where { margin-top: 6px; font-size: .75rem; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.cm-gone { font-style: normal; font-weight: 600; color: var(--st-warn); }
.cm-state { margin-top: 6px; font-size: .74rem; color: var(--st-done); display: flex; gap: 4px; align-items: center; }
.cm-state.is-pending { color: var(--muted); }
.cm-reply { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.cm-reply .cm-avatar { width: 22px; height: 22px; font-size: .6rem; }
.cm-reply-box { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cm-reply-box textarea, .cm-card.is-compose textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: .82rem; resize: vertical; background: var(--raised); color: inherit; }
.cm-card.is-compose textarea { margin-top: 8px; }
.cm-compose-act { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.cm-offer { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--primary); background: var(--raised); color: var(--primary); font-size: .8rem; font-weight: 600; box-shadow: 0 2px 8px rgba(16, 28, 52, .12); }
.cm-empty, .cm-more { font-size: .8rem; color: var(--muted); text-align: center; padding: 6px 0; }
mark.cm-hl { background: rgba(255, 196, 0, .3); color: inherit; padding: 0; border-bottom: 2px solid rgba(225, 155, 0, .85); cursor: pointer; }
mark.cm-hl.is-client { background: rgba(80, 160, 255, .2); border-bottom-color: rgba(40, 120, 230, .75); }
mark.cm-hl.is-resolved { background: rgba(140, 140, 140, .14); border-bottom-color: rgba(140, 140, 140, .5); }
mark.cm-hl.is-active { background: rgba(255, 196, 0, .58); }
mark.cm-hl.is-client.is-active { background: rgba(80, 160, 255, .42); }
/* Uploaded PDF on a review link: the comments sit in the side panel. */
.esign-side .cm-pane { width: auto; height: auto; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 12px; overflow: visible; }
.esign-side .cm-track { height: auto !important; }
.esign-side .cm-card, .esign-side .cm-offer, .esign-side .cm-empty, .esign-side .cm-more, .esign-side .cm-new { position: static; margin: 8px 10px; }
/* Editor: the column floats over the right of the editor area, beside the pages (draft-editor.js). */
.draft-edit { position: relative; }
.cm-editor-pane { position: absolute; right: 17px; bottom: 0; height: auto; min-height: 0; overflow: hidden; z-index: 5; background: color-mix(in srgb, var(--glass-2) 92%, transparent); }
@media (max-width: 991.98px) {
  .review-main { grid-template-columns: minmax(0, 1fr); }
  .cm-split { flex-direction: column; }
  .cm-split > .cm-pane { width: auto; height: auto; min-height: 0; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .cm-split .cm-track { height: auto !important; }
  .cm-split .cm-card, .cm-split .cm-offer, .cm-split .cm-empty, .cm-split .cm-more, .cm-split .cm-new { position: static; margin: 8px 10px; }
}

/* Client comments on a proposal, shown on the proposal, its contract and the contract editor */
.client-comments .cc-item { padding: 10px 0; border-top: 1px solid var(--line); }
.client-comments .cc-item:first-child { border-top: 0; }
.client-comments .cc-where { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--st-warn); padding-left: 8px; margin-bottom: 4px; font-style: italic; }
.client-comments .cc-text { white-space: pre-wrap; }
.client-comments .cc-round { font-size: .8rem; color: var(--muted); margin: 8px 0 2px; font-weight: 600; }
.lh-pick { display: flex; align-items: center; gap: 4px; color: var(--muted); } .lh-pick select { width: auto; max-width: 200px; }

/* Letterhead templates (modules/contracts/letterheads.php) */
.lh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.lh-card { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.lh-card.is-muted { opacity: .6; }
.lh-card .lh-meta { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lh-stage { position: relative; overflow: hidden; background: var(--well); }
.lh-page { position: absolute; top: 0; left: 0; width: 210mm; min-height: 62mm; padding: 34mm 20mm 6mm; box-sizing: border-box; background: #fff; transform-origin: top left; }
.lh-head { position: absolute; left: 20mm; right: 20mm; top: 10mm; }
.lh-head:has(.lh-banner) { left: 0; right: 0; }
.lh-dummy { display: grid; gap: 3mm; padding-top: 2mm; }
.lh-dummy span { display: block; height: 2.2mm; background: #e6e9ef; border-radius: 1mm; }
.lh-dummy span:nth-child(2) { width: 88%; } .lh-dummy span:nth-child(3) { width: 94%; } .lh-dummy span:nth-child(4) { width: 60%; }
.lh-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
.lh-preview-panel { position: sticky; top: 14px; }
@media (max-width: 991.98px) { .lh-editor { grid-template-columns: minmax(0, 1fr); } .lh-preview-panel { position: static; } }
.lh-layouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.lh-layout { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; font-size: .85rem; }
.lh-layout:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.lh-layout input { margin: 0; }
.lh-ico { width: 46px; height: 24px; border: 1px solid var(--muted-2); border-radius: 3px; position: relative; flex-shrink: 0; background: #fff; }
.lh-ico i { position: absolute; width: 9px; height: 9px; background: var(--primary); border-radius: 2px; top: 4px; }
.lh-ico b { position: absolute; height: 3px; background: var(--muted-2); top: 8px; }
.lh-ico-logo_left i { left: 4px; } .lh-ico-logo_left b { left: 16px; right: 6px; }
.lh-ico-logo_right i { right: 4px; } .lh-ico-logo_right b { left: 6px; right: 16px; }
.lh-ico-logo_center i { left: 18px; top: 2px; } .lh-ico-logo_center b { left: 10px; right: 10px; top: 15px; }
.lh-ico-banner i { left: 3px; right: 3px; width: auto; top: 3px; height: 14px; } .lh-ico-banner b { display: none; }

/* =========================================================================
   Auth (sign-in, first-login password): ink panel with the stage path + glass form card on the mesh
   ========================================================================= */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 16px; }
.auth-aside { --a-text: #c9cfdb; --a-muted: #8d95a5; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 44px;
  border-radius: 28px; background: #141821; color: var(--a-text); box-shadow: 0 30px 60px -30px rgba(10, 20, 40, .5); }
[data-theme="dark"] .auth-aside { background: rgba(255, 255, 255, .045); border: 1px solid var(--rim); }
.auth-aside::after { content: ""; position: absolute; right: -160px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(closest-side, rgba(115, 152, 255, .2), transparent); pointer-events: none; }
.auth-brand, .auth-pitch, .auth-foot { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand .brand-name { color: #fff; font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; }
.auth-brand .brand-sub { color: var(--a-muted); font-size: .78rem; font-weight: 600; }
.auth-kicker { color: #9db5ff !important; font-weight: 600; font-size: .9rem !important; margin-bottom: 10px; }
.auth-aside h1 { color: #fff; font-size: clamp(2rem, 3.2vw, 2.9rem); font-weight: 600; line-height: 1.06; max-width: 15ch; margin: 0 0 16px; letter-spacing: -.035em; }
.auth-aside p { max-width: 44ch; color: var(--a-muted); font-size: 1rem; line-height: 1.55; }
.auth-path { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 6px; max-width: 420px; }
.auth-path li { --st: var(--st-draft); display: flex; padding-left: calc(var(--i, 0) * 14px); }
.auth-path .ap-bar { width: 236px; height: 36px; display: flex; align-items: center; gap: 10px; padding: 1px 22px 0; background: var(--st); color: #fff; font-size: .86rem; font-weight: 600; line-height: 1;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.auth-path li:first-child .ap-bar { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 999px 0 0 999px; padding-left: 12px; }
.auth-path .ap-n { width: 21px; height: 21px; border-radius: 50%; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; }
.auth-foot { color: var(--a-muted); font-size: .8rem; }
.auth-main { display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 34px 32px; background: var(--glass); border: 1px solid var(--rim); border-radius: 28px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; }
.auth-card .form-control-lg { font-size: .98rem; }
.auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-mobile-brand strong { display: block; font-weight: 700; line-height: 1.1; }
.auth-mobile-brand small { display: block; color: var(--muted); font-size: .76rem; }
@media (max-width: 767.98px) {
  .auth-page { grid-template-columns: 1fr; padding: 12px; }
  .auth-aside { display: none; }
  .auth-card { padding: 26px 22px; border-radius: 22px; }
}
.install-wrap .panel { backdrop-filter: none; }

/* =========================================================================
   Dashboard (Glass Desk pass)
   ========================================================================= */
.dash-hello { margin-bottom: 10px; }
.dash-hello .page-title { font-size: clamp(28px, 2.8vw, 40px); }
.dash-hello-main .av-lg { width: 52px; height: 52px; font-size: 1rem; box-shadow: inset 0 0 0 1px var(--rim); }
.dash-quick .btn { height: 40px; display: inline-flex; align-items: center; }
.dash-head { align-items: center; }
.dash-head a { font-weight: 600; }
.chart-box { height: 260px; }
.chart-hint { color: var(--muted); }
.dash-howto > summary { padding: 14px 18px; }
.dash-q .q-row { padding: 11px 18px; }
.q-ref { color: var(--primary); }
.dash-q .q-row:hover .q-title, .exp-list a:hover .q-title { color: var(--primary); }
.exp-list a { padding: 9px 18px; }
.exp-list li + li::before { left: 40px; }

@media (prefers-reduced-motion: reduce) { .ttab-pill { display: none; } }

/* Contract page: "Due for notarization" steps */
.notary-due { border-left: 3px solid var(--st-done); }
.notary-steps { padding-left: 1.2rem; }
.notary-steps li { margin-bottom: .75rem; }
.notary-steps li:last-child { margin-bottom: 0; }

/* Administration › Notification email: editor on the left, live preview on the right */
.notify-setup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1200px) { .notify-setup { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.notify-editor { margin-bottom: 0; }
.notify-editor > .panel-foot { position: sticky; bottom: 0; background: var(--raised); border-radius: 0 0 var(--r-card) var(--r-card); z-index: 5; }
.notify-editor [data-part] { border-radius: var(--r-sm); }
.token-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.token-row .btn { padding: 1px 10px; font-size: .78rem; }

.notify-preview { background: var(--glass); border: 1px solid var(--rim); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@media (min-width: 1200px) { .notify-preview { position: sticky; top: 14px; height: calc(100vh - 28px); } }
.np-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.np-sample { width: auto; max-width: 100%; margin-right: auto; }
.np-envelope { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 14px; margin: 0; padding: 10px 14px; background: var(--glass-3); border: 1px solid var(--line-2); border-radius: var(--r-tile); font-size: .84rem; }
.np-envelope dt { color: var(--muted); font-weight: 500; }
.np-envelope dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.np-envelope #npSubject { font-weight: 650; border-radius: 6px; transition: box-shadow .15s; }
.np-envelope #npSubject.is-marked { box-shadow: 0 0 0 2px var(--primary); background: var(--primary-50); }
.np-stage { flex: 1 1 auto; min-height: 520px; display: flex; justify-content: center; background: #eceef1; border-radius: var(--r-tile); overflow: hidden; border: 1px solid var(--line-2); }
.np-stage iframe { display: block; width: 100%; max-width: 100%; height: auto; min-height: 520px; flex: 1 1 auto; border: 0; background: #eceef1; transition: max-width .25s ease; }
.np-stage.is-phone iframe { max-width: 390px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.np-stage[aria-busy="true"] iframe { opacity: .85; }
.np-text { flex: 1 1 auto; margin: 0; padding: 18px 22px; overflow: auto; background: #fff; color: #141821; font: .84rem/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; text-align: left; width: 100%; }
.np-stage.is-phone .np-text { max-width: 390px; }
.np-note { margin: 0; font-size: .78rem; color: var(--muted); }
.np-note.is-error { color: var(--st-closed); }
