/* Global palettes: Actual preserves the pre-theme CSS colors. */
:root,[data-theme="actual"]{
    --ink:#192d35;
    --muted:#697b83;
    --primary:#087f72;
    --nav:#122e34;
    --line:#e3e9e9;
    --page-bg:#f5f7f8;
    --brand-bg:#35c7a6;
    --brand-text:#103b37;
    --login-bg:#eef3f3;
    --surface:#fff;
    --shadow:#17383c12;
    --intro-start:#163c42;
    --intro-end:#0c252a;
    --intro-accent:#71d5be;
    --intro-text:#afc7c8;
    --input-border:#dce4e5;
    --input-bg:#fbfcfc;
    --form-ring:#087f721c;
    --primary-hover:#08665d;
    --nav-text:#e1efef;
    --nav-link:#d1dede;
    --nav-active-bg:#24494e;
    --nav-active-text:#8ae1c9;
    --nav-active-hover:#2c565b;
    --nav-muted:#89a5aa;
    --nav-future:#a3bdc0;
    --nav-line:#ffffff1c;
    --avatar-bg:#35575b;
    --nav-user:#a5bfc2;
    --nav-logout:#b8cbcd;
    --divider:#b4c2c7;
    --accent-border:#d7e3e2;
    --accent-text:#587976;
    --accent-soft:#e9f5f1;
    --caption:#64787f;
    --welcome-border:#dce8e4;
    --welcome-bg:#edf6f1;
    --welcome-text:#52736c;
    --highlight:#1ba67e;
    --focus-ring:#43bd9d;
    --meta-text:#64748b;
    --document-border:#e2e8f0;
    --total-border:#cbd5e1;
    --row-bg:#f8fafc;
    --editor-focus:#86b7fe;
    --panel-shadow:#192d351a;
    --primary-active:#06574f;
    --on-primary:#fff;
    --link:#0d6efd;
    --link-hover:#0a58ca;
    --selected-bg:#0d6efd;
    --selected-text:#fff;
}
[data-theme="qervox"]{
    --ink:#182c1b;
    --muted:#586b5c;
    --primary:#004f0d;
    --nav:#102817;
    --line:#dce7de;
    --page-bg:#f5f8f5;
    --brand-bg:#8fd4a0;
    --brand-text:#102817;
    --login-bg:#edf6ee;
    --surface:#fff;
    --shadow:#10281712;
    --intro-start:#245534;
    --intro-end:#102817;
    --intro-accent:#c0edc9;
    --intro-text:#a6c6af;
    --input-border:#b8d4be;
    --input-bg:#f5f8f5;
    --form-ring:#28793c30;
    --primary-hover:#003c0a;
    --nav-text:#e2eee5;
    --nav-link:#e2eee5;
    --nav-active-bg:#245534;
    --nav-active-text:#c0edc9;
    --nav-active-hover:#306944;
    --nav-muted:#a6c6af;
    --nav-future:#a6c6af;
    --nav-line:#ffffff1c;
    --avatar-bg:#306944;
    --nav-user:#a6c6af;
    --nav-logout:#a6c6af;
    --divider:#586b5c;
    --accent-border:#b8d4be;
    --accent-text:#285d33;
    --accent-soft:#edf6ee;
    --caption:#586b5c;
    --welcome-border:#b8d4be;
    --welcome-bg:#edf6ee;
    --welcome-text:#285d33;
    --highlight:#26783a;
    --focus-ring:#28793c;
    --meta-text:#586b5c;
    --document-border:#dce7de;
    --total-border:#b8d4be;
    --row-bg:#f5f8f5;
    --editor-focus:#28793c;
    --panel-shadow:#182c1b1a;
    --primary-active:#002d07;
    --on-primary:#fff;
    --link:#004f0d;
    --link-hover:#003c0a;
    --selected-bg:#004f0d;
    --selected-text:#fff;
}
[data-theme="blue"]{
    --ink:#1d2c44;
    --muted:#596a82;
    --primary:#174ea6;
    --nav:#14253f;
    --line:#dce4f0;
    --page-bg:#f5f7fb;
    --brand-bg:#9ec4fb;
    --brand-text:#14253f;
    --login-bg:#edf3fd;
    --surface:#fff;
    --shadow:#14253f12;
    --intro-start:#264a78;
    --intro-end:#14253f;
    --intro-accent:#c5ddff;
    --intro-text:#aac0df;
    --input-border:#bdcfea;
    --input-bg:#f5f7fb;
    --form-ring:#245fc130;
    --primary-hover:#123e85;
    --nav-text:#e1ebfa;
    --nav-link:#e1ebfa;
    --nav-active-bg:#264a78;
    --nav-active-text:#c5ddff;
    --nav-active-hover:#315b8f;
    --nav-muted:#aac0df;
    --nav-future:#aac0df;
    --nav-line:#ffffff1c;
    --avatar-bg:#315b8f;
    --nav-user:#aac0df;
    --nav-logout:#aac0df;
    --divider:#596a82;
    --accent-border:#bdcfea;
    --accent-text:#284d80;
    --accent-soft:#edf3fd;
    --caption:#596a82;
    --welcome-border:#bdcfea;
    --welcome-bg:#edf3fd;
    --welcome-text:#284d80;
    --highlight:#285eb0;
    --focus-ring:#245fc1;
    --meta-text:#596a82;
    --document-border:#dce4f0;
    --total-border:#bdcfea;
    --row-bg:#f5f7fb;
    --editor-focus:#245fc1;
    --panel-shadow:#1d2c441a;
    --primary-active:#0e3068;
    --on-primary:#fff;
    --link:#174ea6;
    --link-hover:#123e85;
    --selected-bg:#174ea6;
    --selected-text:#fff;
}
[data-theme="sky"]{
    --ink:#19313c;
    --muted:#546e7b;
    --primary:#00658a;
    --nav:#102f3e;
    --line:#d8e7ee;
    --page-bg:#f3f9fc;
    --brand-bg:#8ed7ef;
    --brand-text:#102f3e;
    --login-bg:#eaf6fb;
    --surface:#fff;
    --shadow:#102f3e12;
    --intro-start:#20566b;
    --intro-end:#102f3e;
    --intro-accent:#b9eaff;
    --intro-text:#9fc8da;
    --input-border:#afd3e2;
    --input-bg:#f3f9fc;
    --form-ring:#00749e30;
    --primary-hover:#00516f;
    --nav-text:#e0f0f7;
    --nav-link:#e0f0f7;
    --nav-active-bg:#20566b;
    --nav-active-text:#b9eaff;
    --nav-active-hover:#296a81;
    --nav-muted:#9fc8da;
    --nav-future:#9fc8da;
    --nav-line:#ffffff1c;
    --avatar-bg:#296a81;
    --nav-user:#9fc8da;
    --nav-logout:#9fc8da;
    --divider:#546e7b;
    --accent-border:#afd3e2;
    --accent-text:#235c73;
    --accent-soft:#eaf6fb;
    --caption:#546e7b;
    --welcome-border:#afd3e2;
    --welcome-bg:#eaf6fb;
    --welcome-text:#235c73;
    --highlight:#087797;
    --focus-ring:#00749e;
    --meta-text:#546e7b;
    --document-border:#d8e7ee;
    --total-border:#afd3e2;
    --row-bg:#f3f9fc;
    --editor-focus:#00749e;
    --panel-shadow:#19313c1a;
    --primary-active:#003e56;
    --on-primary:#fff;
    --link:#00658a;
    --link-hover:#00516f;
    --selected-bg:#00658a;
    --selected-text:#fff;
}
[data-theme="purple"]{
    --ink:#30243f;
    --muted:#6d5e7b;
    --primary:#673ab7;
    --nav:#281a3c;
    --line:#e6deee;
    --page-bg:#f9f6fc;
    --brand-bg:#cbb0f0;
    --brand-text:#281a3c;
    --login-bg:#f4eefb;
    --surface:#fff;
    --shadow:#281a3c12;
    --intro-start:#51366f;
    --intro-end:#281a3c;
    --intro-accent:#e4d0ff;
    --intro-text:#c6b1df;
    --input-border:#d4c2e9;
    --input-bg:#f9f6fc;
    --form-ring:#7645bd30;
    --primary-hover:#512e91;
    --nav-text:#eee5f8;
    --nav-link:#eee5f8;
    --nav-active-bg:#51366f;
    --nav-active-text:#e4d0ff;
    --nav-active-hover:#634486;
    --nav-muted:#c6b1df;
    --nav-future:#c6b1df;
    --nav-line:#ffffff1c;
    --avatar-bg:#634486;
    --nav-user:#c6b1df;
    --nav-logout:#c6b1df;
    --divider:#6d5e7b;
    --accent-border:#d4c2e9;
    --accent-text:#624080;
    --accent-soft:#f4eefb;
    --caption:#6d5e7b;
    --welcome-border:#d4c2e9;
    --welcome-bg:#f4eefb;
    --welcome-text:#624080;
    --highlight:#7645bd;
    --focus-ring:#7645bd;
    --meta-text:#6d5e7b;
    --document-border:#e6deee;
    --total-border:#d4c2e9;
    --row-bg:#f9f6fc;
    --editor-focus:#7645bd;
    --panel-shadow:#30243f1a;
    --primary-active:#402473;
    --on-primary:#fff;
    --link:#673ab7;
    --link-hover:#512e91;
    --selected-bg:#673ab7;
    --selected-text:#fff;
}
[data-theme="graphite"]{
    --ink:#242b35;
    --muted:#626c79;
    --primary:#3e4857;
    --nav:#202630;
    --line:#dfe4eb;
    --page-bg:#f6f7f9;
    --brand-bg:#b9c6d8;
    --brand-text:#202630;
    --login-bg:#eff2f6;
    --surface:#fff;
    --shadow:#20263012;
    --intro-start:#424f60;
    --intro-end:#202630;
    --intro-accent:#e0e7f1;
    --intro-text:#c0c9d6;
    --input-border:#c7d0dc;
    --input-bg:#f6f7f9;
    --form-ring:#536a8830;
    --primary-hover:#303946;
    --nav-text:#e7ebf0;
    --nav-link:#e7ebf0;
    --nav-active-bg:#424f60;
    --nav-active-text:#e0e7f1;
    --nav-active-hover:#526176;
    --nav-muted:#b6bfce;
    --nav-future:#b6bfce;
    --nav-line:#ffffff1c;
    --avatar-bg:#526176;
    --nav-user:#b6bfce;
    --nav-logout:#b6bfce;
    --divider:#626c79;
    --accent-border:#c7d0dc;
    --accent-text:#48596e;
    --accent-soft:#eff2f6;
    --caption:#626c79;
    --welcome-border:#c7d0dc;
    --welcome-bg:#eff2f6;
    --welcome-text:#48596e;
    --highlight:#536a88;
    --focus-ring:#536a88;
    --meta-text:#626c79;
    --document-border:#dfe4eb;
    --total-border:#c7d0dc;
    --row-bg:#f6f7f9;
    --editor-focus:#536a88;
    --panel-shadow:#242b351a;
    --primary-active:#242c37;
    --on-primary:#fff;
    --link:#3e4857;
    --link-hover:#303946;
    --selected-bg:#3e4857;
    --selected-text:#fff;
}
:root,[data-theme="actual"]{--theme-primary-rgb:8,127,114;--theme-hover-rgb:8,102,93;}
[data-theme="qervox"]{--theme-primary-rgb:0,79,13;--theme-hover-rgb:0,60,10;}
[data-theme="blue"]{--theme-primary-rgb:23,78,166;--theme-hover-rgb:18,62,133;}
[data-theme="sky"]{--theme-primary-rgb:0,101,138;--theme-hover-rgb:0,81,111;}
[data-theme="purple"]{--theme-primary-rgb:103,58,183;--theme-hover-rgb:81,46,145;}
[data-theme="graphite"]{--theme-primary-rgb:62,72,87;--theme-hover-rgb:48,57,70;}
*{box-sizing:border-box}body{font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:var(--page-bg)}a{text-decoration:none}.brand{display:flex;align-items:center;gap:10px;font-size:24px;font-weight:700;color:inherit;letter-spacing:-.8px}.brand-mark{display:inline-grid;place-items:center;background:var(--brand-bg);color:var(--brand-text);width:37px;height:37px;border-radius:11px;font-size:26px}.brand-tag{font-size:10px;letter-spacing:1.4px;font-weight:500;opacity:.65;margin-top:5px}.eyebrow{font-size:10px;letter-spacing:2px;font-weight:700;color:var(--primary)}.login-page{min-height:100vh;display:grid;place-items:center;padding:40px;background:var(--login-bg)}.login-shell{width:min(1020px,100%);min-height:590px;display:grid;grid-template-columns:1.05fr 1fr;background:var(--surface);border-radius:22px;overflow:hidden;box-shadow:0 25px 70px var(--shadow)}.login-intro{padding:45px;background:linear-gradient(145deg,var(--intro-start),var(--intro-end));color:var(--surface);display:flex;flex-direction:column;justify-content:space-between}.login-intro .eyebrow{color:var(--intro-accent)}.login-intro h1{font-size:36px;line-height:1.3;letter-spacing:-1.3px;margin:20px 0}.login-intro p,.login-intro small{color:var(--intro-text)}.login-intro small{font-size:11px}.login-form{padding:80px 55px;align-self:center}.login-form h2{font-size:27px;font-weight:700;margin:12px 0}.login-form p,.form-label{font-size:13px}.form-label{font-weight:600}.form-control{padding:12px;border-color:var(--input-border);background:var(--input-bg);border-radius:8px}.form-control:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--form-ring)}.btn-primary{background:var(--primary);border-color:var(--primary);padding:12px;font-size:13px;font-weight:600;border-radius:8px}.btn-primary:hover,.btn-primary:focus{background:var(--primary-hover);border-color:var(--primary-hover)}.btn-primary span{float:right}.login-help{text-align:center;color:var(--muted);margin:25px 0 0}.sidebar{position:fixed;inset:0 auto 0 0;width:264px;background:var(--nav);color:var(--nav-text);display:flex;flex-direction:column;padding:28px 18px 20px;z-index:10;overflow-y:auto}.sidebar .brand{padding:0 10px 30px}.sidebar nav{flex:1}.nav-item{display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:7px;color:var(--nav-link);font-size:12px;margin-bottom:3px}.nav-item.active{background:var(--nav-active-bg);color:var(--nav-active-text);font-weight:600}.nav-item.active:hover{background:var(--nav-active-hover)}.nav-heading{font-size:9px;letter-spacing:1.8px;text-transform:uppercase;color:var(--nav-muted);margin:24px 12px 10px;font-weight:600}.nav-item.future{justify-content:space-between;font-size:11px}.soon{font-size:8px;color:var(--nav-future)}.sidebar-user{margin-top:25px;padding:18px 10px 0;border-top:1px solid var(--nav-line);display:grid;grid-template-columns:34px 1fr;gap:10px}.avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:var(--avatar-bg);font-size:13px}.sidebar-user strong{display:block;font-size:12px}.sidebar-user small{display:block;font-size:10px;color:var(--nav-user)}.sidebar-user form{grid-column:1/-1}.logout-button{background:none;border:0;padding:8px 0;color:var(--nav-logout);font-size:11px;width:100%;text-align:left}.logout-button:hover{color:var(--surface)}.logout-button span{float:right}.workspace{margin-left:264px;min-height:100vh;display:flex;flex-direction:column}.topbar{height:76px;background:var(--surface);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 38px;font-size:11px;color:var(--muted);gap:15px}.topbar-divider{padding:0 15px;color:var(--divider)}.topbar-label{letter-spacing:1px;font-size:10px}.main-content{padding:42px 38px;flex:1}.page-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:32px}.page-heading h1{font-size:29px;letter-spacing:-1px;font-weight:700;margin:10px 0}.page-heading p{font-size:13px;color:var(--muted);margin:0}.phase-badge{border:1px solid var(--accent-border);background:var(--surface);color:var(--accent-text);border-radius:20px;font-size:10px;padding:7px 13px}.stat-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px}.stat-card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:22px 18px}.stat-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:var(--accent-soft);color:var(--primary);font-size:10px;font-weight:700;margin-bottom:22px}.stat-card h2{font-size:12px;font-weight:500;color:var(--muted)}.stat-number{font-size:32px;line-height:1.2;font-weight:650;margin:10px 0}.stat-caption{font-size:10px;color:var(--caption)}.welcome-panel{margin-top:28px;padding:32px;border:1px solid var(--welcome-border);border-radius:12px;background:linear-gradient(115deg,var(--welcome-bg),var(--surface))}.welcome-panel h2{font-size:20px;margin:14px 0}.welcome-panel p{font-size:12px;color:var(--muted)}.welcome-panel>span:last-child{font-size:10px;color:var(--welcome-text)}.status-dot{display:inline-block;width:6px;height:6px;background:#1ba67e;border-radius:50%;margin-right:6px}.page-footer{padding:20px 38px;display:flex;justify-content:space-between;font-size:10px;color:var(--muted);border-top:1px solid var(--line)}.menu-toggle{display:none}.skip-link{position:fixed;top:-100px;left:15px;z-index:30;background:var(--surface);padding:12px}.skip-link:focus{top:10px}.empty-state{padding:25px;background:var(--surface);border-radius:10px}button:focus-visible,a:focus-visible{outline:3px solid var(--focus-ring);outline-offset:3px}@media(min-width:1500px){.main-content{padding:50px 55px}.stat-card{padding:26px}.stat-number{font-size:38px}}@media(max-width:1200px){.stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.soon{display:none}}@media(max-width:850px){.sidebar{width:240px;transform:translateX(-100%);transition:transform .15s}.sidebar.is-open{transform:translateX(0)}.workspace{margin-left:0}.menu-toggle{display:block;font-size:12px}.topbar{padding:0 20px}.topbar-label{display:none}.main-content{padding:28px 20px}.login-shell{grid-template-columns:1fr}.login-intro{padding:28px}.login-intro>div,.login-intro>small{display:none}.login-form{padding:40px}.login-page{padding:20px}.page-footer{padding:20px}}@media(max-width:500px){.stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.page-heading{align-items:start;gap:10px}.page-heading p{line-height:1.6}.phase-badge{white-space:nowrap}.welcome-panel{padding:24px}.login-form{padding:30px 24px}.topbar{justify-content:flex-start;font-size:10px}}
.company-panel{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:24px}.company-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.company-table{font-size:12px}.company-table th{color:var(--muted);font-size:11px;white-space:nowrap}.company-table td{max-width:260px;overflow-wrap:anywhere}.company-table a{color:var(--primary)}.company-details dt{font-size:12px;color:var(--muted);font-weight:500}.company-details dd{font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere;margin-top:5px}.company-panel .form-select{padding:12px;border-color:var(--input-border);font-size:13px}.company-panel .btn-light,.page-heading .btn-light{font-size:13px}@media(max-width:600px){.company-panel{padding:16px}.page-heading{flex-wrap:wrap}}
.product-thumb,.product-preview{object-fit:contain;background:var(--page-bg);border:1px solid var(--line);border-radius:8px}.product-preview{max-width:100%}
/* Commercial quote detail: compact metadata and exact server-rendered totals. */
.quote-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.25rem 2rem;margin:1.25rem 0;padding-top:1rem;border-top:1px solid var(--line);}
.quote-document-header h2{display:flex;align-items:center;flex-wrap:wrap;gap:.6rem;margin-bottom:0;}
.quote-corporate-logo{display:block;max-width:min(240px,100%);max-height:100px;width:auto;height:auto;object-fit:contain;margin-bottom:1rem;}
.quote-header-fields{margin:0;display:grid;gap:.6rem;}
.quote-meta h3{color:var(--primary);margin-bottom:.85rem;}
.quote-meta dt{font-size:.75rem;color:var(--meta-text);font-weight:600;}
.quote-meta dd{margin:0;overflow-wrap:anywhere;white-space:normal;}
.quote-document .quote-notes,.quote-document .quote-terms{border-top:1px solid var(--document-border);padding-top:1rem;margin-top:1rem;}
.quote-notes p,.quote-terms p{overflow-wrap:anywhere;}
.quote-totals-wrap{display:flex;justify-content:flex-end;margin:1rem 0;}
.quote-totals{width:100%;max-width:28rem;margin:0;}
.quote-totals>div{display:flex;justify-content:space-between;gap:1rem;padding:.35rem 0;}
.quote-totals dt{font-weight:500;}.quote-totals dd{margin:0;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;}
.quote-totals .quote-grand-total{border-top:2px solid var(--total-border);margin-top:.35rem;padding-top:.7rem;font-size:1.1rem;font-weight:700;}
.quote-grand-total dt{font-weight:700;}
@media(max-width:900px){.quote-meta{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:575px){.quote-meta{grid-template-columns:1fr;}.quote-totals dd{white-space:normal;}.quote-totals>div{gap:.5rem;}}
.quote-products-section{border-top:1px solid var(--document-border);padding-top:1rem;margin-top:1rem;}
.quote-products-heading{display:flex;align-items:center;gap:.65rem;margin-bottom:1rem;}
.quote-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:34px;min-height:34px;}
.quote-line-actions{display:flex;gap:.35rem;align-items:center;}
.quote-product-image{object-fit:contain;}.quote-line-description{white-space:pre-wrap;overflow-wrap:anywhere;}
.quote-number{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;}
.quote-products-table th:nth-child(3),.quote-products-table th:nth-child(4),.quote-products-table th:nth-child(5){text-align:right;}
.quote-products-table .quote-line-input{min-width:7rem;max-width:10rem;text-align:right;}
.quote-products-table .quote-line-select{min-width:15rem;max-width:30rem;}
.quote-products-table textarea{min-width:15rem;resize:vertical;}
.quote-inline-row{background:var(--row-bg);}.quote-inline-row td{vertical-align:top;}
.quote-document .quote-totals-wrap{border-top:1px solid var(--document-border);padding-top:1rem;}
@media(max-width:575px){.quote-document .quote-totals{max-width:none;}}
#quote-add-product{color:#fff;background-color:#198754;border-color:#198754;}
#quote-add-product:hover{background-color:#157347;border-color:#146c43;}
#quote-add-product:focus-visible{outline:3px solid #86b7a1;outline-offset:2px;box-shadow:0 0 0 .2rem rgb(25 135 84 / 25%);}
.quote-inline-description-row>td{padding:.75rem 1rem 1rem;border-top:0;background:var(--row-bg);}
.quote-description-toolbar{display:flex;flex-wrap:wrap;gap:.35rem;margin-bottom:.5rem;}
.quote-description-editor{width:100%;min-height:8rem;max-height:24rem;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;}
.quote-description-editor:focus-visible{outline:2px solid var(--editor-focus);outline-offset:2px;}
.quote-line-description p,.quote-description-editor p{margin:0 0 .35rem;}
.quote-line-description ul,.quote-line-description ol,.quote-description-editor ul,.quote-description-editor ol{margin:.35rem 0;padding-left:1.4rem;}
.quote-line-description p:last-child{margin-bottom:0;}
@media(max-width:575px){.quote-inline-description-row>td{padding:.65rem;}.quote-description-editor{min-height:7rem;}}

/* Canonical note sizes: closed semantic elements, no user CSS. */
.qervox-rich-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.qervox-rich-text small { font-size: .85rem; }
.qervox-rich-text big { font-size: 1.15rem; }

.qervox-rich-text span { font-size: 1rem; }

/* Default-note editors only: use Proforma's .35rem paragraph/list spacing.
   Formatting whitespace between HTML blocks must not add another visual line.
   Plain-text notes retain pre-wrap; explicit br and empty blocks remain visible. */
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor){line-height:1.5;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor):has(p,div,ul,ol){white-space:normal;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor) :is(p,div,li){white-space:pre-wrap;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor) :is(p,div){margin:0 0 .35rem;min-height:1.5em;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor) :is(ul,ol){margin:.35rem 0;padding-left:1.4rem;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor)>:first-child{margin-top:0;}
:is(#quote_notes-editor,#invoice_notes-editor,#purchase_order_notes-editor)>:last-child{margin-bottom:0;}

/* Read-only document notes/T&C share compact block spacing; editors keep their styles.
   Preserve pre-wrap and explicit br/empty paragraphs for intentional line breaks. */
:is(.quote-notes,.quote-terms) .qervox-rich-text:not(.quote-description-editor){line-height:1.5;}
:is(.quote-notes,.quote-terms) .qervox-rich-text:not(.quote-description-editor) :is(p,div,ul,ol){margin-top:0;margin-bottom:0;}
:is(.quote-notes,.quote-terms) .qervox-rich-text:not(.quote-description-editor) p{min-height:1.5em;}

@media(max-width:767.98px){.quote-meta{grid-template-columns:1fr;gap:1.25rem;}}

.quote-header-top{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:1rem;}
.quote-header-top .quote-corporate-logo{margin-bottom:0;}
.quote-header-actions{margin-left:auto;justify-content:flex-end;}
.quote-header-identity{min-width:0;}
.quote-header-identity h2{margin:.75rem 0 0;}
.quote-header-controls{margin-left:auto;display:flex;flex-direction:column;align-items:flex-end;gap:.75rem;max-width:100%;}
.quote-header-state{display:flex;flex-direction:column;align-items:flex-end;gap:.65rem;}
.quote-state-actions{justify-content:flex-end;flex-wrap:nowrap;max-width:100%;}
.quote-state-actions > button{flex-shrink:0;}
#quote-state-action{width:225px!important;min-width:0;flex:0 1 225px;padding-right:2.25rem;}
@media(max-width:767.98px){.quote-header-controls{margin-left:0;align-items:flex-start;width:100%;}.quote-header-state{align-items:flex-end;width:100%;max-width:100%;}.quote-state-actions{justify-content:flex-end;}.quote-state-actions .form-select{max-width:100%;}}

@media(max-width:767.98px){.quote-header-top{flex-direction:column;align-items:flex-start;}.quote-header-actions{margin-left:0;justify-content:flex-start;}}
.quote-delete-confirm{position:relative;}
.quote-delete-panel{position:absolute;right:0;top:calc(100% + .5rem);z-index:2;width:20rem;max-width:calc(100vw - 3rem);padding:1rem;background:var(--surface);border:1px solid #efcaca;border-radius:8px;box-shadow:0 8px 24px var(--panel-shadow);}
@media(max-width:767.98px){.quote-delete-panel{position:static;margin-top:.5rem;}}
.terms-document-editor{min-height:28rem;max-height:70vh;line-height:1.6;overflow-wrap:anywhere}
:is(.terms-document-editor,.quote-terms-content) img{display:block;max-width:100%;height:auto;margin:.75rem 0}
:is(.terms-document-editor,.quote-terms-content) img[data-align="left"]{margin-left:0;margin-right:auto}
:is(.terms-document-editor,.quote-terms-content) img[data-align="center"]{margin-left:auto;margin-right:auto}
:is(.terms-document-editor,.quote-terms-content) img[data-align="right"]{margin-left:auto;margin-right:0}
/* Closed horizontal positions: percent of free space, not percent of image width. */
:is(.terms-document-editor,.quote-terms-content) img[data-x]{position:relative;left:var(--terms-image-x,0%);transform:translateX(calc(-1 * var(--terms-image-x,0%)));margin-left:0;margin-right:0}
:is(.terms-document-editor,.quote-terms-content) img[data-x="0"]{--terms-image-x:0%}:is(.terms-document-editor,.quote-terms-content) img[data-x="1"]{--terms-image-x:1%}:is(.terms-document-editor,.quote-terms-content) img[data-x="2"]{--terms-image-x:2%}:is(.terms-document-editor,.quote-terms-content) img[data-x="3"]{--terms-image-x:3%}:is(.terms-document-editor,.quote-terms-content) img[data-x="4"]{--terms-image-x:4%}:is(.terms-document-editor,.quote-terms-content) img[data-x="5"]{--terms-image-x:5%}:is(.terms-document-editor,.quote-terms-content) img[data-x="6"]{--terms-image-x:6%}:is(.terms-document-editor,.quote-terms-content) img[data-x="7"]{--terms-image-x:7%}:is(.terms-document-editor,.quote-terms-content) img[data-x="8"]{--terms-image-x:8%}:is(.terms-document-editor,.quote-terms-content) img[data-x="9"]{--terms-image-x:9%}:is(.terms-document-editor,.quote-terms-content) img[data-x="10"]{--terms-image-x:10%}:is(.terms-document-editor,.quote-terms-content) img[data-x="11"]{--terms-image-x:11%}:is(.terms-document-editor,.quote-terms-content) img[data-x="12"]{--terms-image-x:12%}:is(.terms-document-editor,.quote-terms-content) img[data-x="13"]{--terms-image-x:13%}:is(.terms-document-editor,.quote-terms-content) img[data-x="14"]{--terms-image-x:14%}:is(.terms-document-editor,.quote-terms-content) img[data-x="15"]{--terms-image-x:15%}:is(.terms-document-editor,.quote-terms-content) img[data-x="16"]{--terms-image-x:16%}:is(.terms-document-editor,.quote-terms-content) img[data-x="17"]{--terms-image-x:17%}:is(.terms-document-editor,.quote-terms-content) img[data-x="18"]{--terms-image-x:18%}:is(.terms-document-editor,.quote-terms-content) img[data-x="19"]{--terms-image-x:19%}:is(.terms-document-editor,.quote-terms-content) img[data-x="20"]{--terms-image-x:20%}:is(.terms-document-editor,.quote-terms-content) img[data-x="21"]{--terms-image-x:21%}:is(.terms-document-editor,.quote-terms-content) img[data-x="22"]{--terms-image-x:22%}:is(.terms-document-editor,.quote-terms-content) img[data-x="23"]{--terms-image-x:23%}:is(.terms-document-editor,.quote-terms-content) img[data-x="24"]{--terms-image-x:24%}:is(.terms-document-editor,.quote-terms-content) img[data-x="25"]{--terms-image-x:25%}:is(.terms-document-editor,.quote-terms-content) img[data-x="26"]{--terms-image-x:26%}:is(.terms-document-editor,.quote-terms-content) img[data-x="27"]{--terms-image-x:27%}:is(.terms-document-editor,.quote-terms-content) img[data-x="28"]{--terms-image-x:28%}:is(.terms-document-editor,.quote-terms-content) img[data-x="29"]{--terms-image-x:29%}:is(.terms-document-editor,.quote-terms-content) img[data-x="30"]{--terms-image-x:30%}:is(.terms-document-editor,.quote-terms-content) img[data-x="31"]{--terms-image-x:31%}:is(.terms-document-editor,.quote-terms-content) img[data-x="32"]{--terms-image-x:32%}:is(.terms-document-editor,.quote-terms-content) img[data-x="33"]{--terms-image-x:33%}:is(.terms-document-editor,.quote-terms-content) img[data-x="34"]{--terms-image-x:34%}:is(.terms-document-editor,.quote-terms-content) img[data-x="35"]{--terms-image-x:35%}:is(.terms-document-editor,.quote-terms-content) img[data-x="36"]{--terms-image-x:36%}:is(.terms-document-editor,.quote-terms-content) img[data-x="37"]{--terms-image-x:37%}:is(.terms-document-editor,.quote-terms-content) img[data-x="38"]{--terms-image-x:38%}:is(.terms-document-editor,.quote-terms-content) img[data-x="39"]{--terms-image-x:39%}:is(.terms-document-editor,.quote-terms-content) img[data-x="40"]{--terms-image-x:40%}:is(.terms-document-editor,.quote-terms-content) img[data-x="41"]{--terms-image-x:41%}:is(.terms-document-editor,.quote-terms-content) img[data-x="42"]{--terms-image-x:42%}:is(.terms-document-editor,.quote-terms-content) img[data-x="43"]{--terms-image-x:43%}:is(.terms-document-editor,.quote-terms-content) img[data-x="44"]{--terms-image-x:44%}:is(.terms-document-editor,.quote-terms-content) img[data-x="45"]{--terms-image-x:45%}:is(.terms-document-editor,.quote-terms-content) img[data-x="46"]{--terms-image-x:46%}:is(.terms-document-editor,.quote-terms-content) img[data-x="47"]{--terms-image-x:47%}:is(.terms-document-editor,.quote-terms-content) img[data-x="48"]{--terms-image-x:48%}:is(.terms-document-editor,.quote-terms-content) img[data-x="49"]{--terms-image-x:49%}:is(.terms-document-editor,.quote-terms-content) img[data-x="50"]{--terms-image-x:50%}:is(.terms-document-editor,.quote-terms-content) img[data-x="51"]{--terms-image-x:51%}:is(.terms-document-editor,.quote-terms-content) img[data-x="52"]{--terms-image-x:52%}:is(.terms-document-editor,.quote-terms-content) img[data-x="53"]{--terms-image-x:53%}:is(.terms-document-editor,.quote-terms-content) img[data-x="54"]{--terms-image-x:54%}:is(.terms-document-editor,.quote-terms-content) img[data-x="55"]{--terms-image-x:55%}:is(.terms-document-editor,.quote-terms-content) img[data-x="56"]{--terms-image-x:56%}:is(.terms-document-editor,.quote-terms-content) img[data-x="57"]{--terms-image-x:57%}:is(.terms-document-editor,.quote-terms-content) img[data-x="58"]{--terms-image-x:58%}:is(.terms-document-editor,.quote-terms-content) img[data-x="59"]{--terms-image-x:59%}:is(.terms-document-editor,.quote-terms-content) img[data-x="60"]{--terms-image-x:60%}:is(.terms-document-editor,.quote-terms-content) img[data-x="61"]{--terms-image-x:61%}:is(.terms-document-editor,.quote-terms-content) img[data-x="62"]{--terms-image-x:62%}:is(.terms-document-editor,.quote-terms-content) img[data-x="63"]{--terms-image-x:63%}:is(.terms-document-editor,.quote-terms-content) img[data-x="64"]{--terms-image-x:64%}:is(.terms-document-editor,.quote-terms-content) img[data-x="65"]{--terms-image-x:65%}:is(.terms-document-editor,.quote-terms-content) img[data-x="66"]{--terms-image-x:66%}:is(.terms-document-editor,.quote-terms-content) img[data-x="67"]{--terms-image-x:67%}:is(.terms-document-editor,.quote-terms-content) img[data-x="68"]{--terms-image-x:68%}:is(.terms-document-editor,.quote-terms-content) img[data-x="69"]{--terms-image-x:69%}:is(.terms-document-editor,.quote-terms-content) img[data-x="70"]{--terms-image-x:70%}:is(.terms-document-editor,.quote-terms-content) img[data-x="71"]{--terms-image-x:71%}:is(.terms-document-editor,.quote-terms-content) img[data-x="72"]{--terms-image-x:72%}:is(.terms-document-editor,.quote-terms-content) img[data-x="73"]{--terms-image-x:73%}:is(.terms-document-editor,.quote-terms-content) img[data-x="74"]{--terms-image-x:74%}:is(.terms-document-editor,.quote-terms-content) img[data-x="75"]{--terms-image-x:75%}:is(.terms-document-editor,.quote-terms-content) img[data-x="76"]{--terms-image-x:76%}:is(.terms-document-editor,.quote-terms-content) img[data-x="77"]{--terms-image-x:77%}:is(.terms-document-editor,.quote-terms-content) img[data-x="78"]{--terms-image-x:78%}:is(.terms-document-editor,.quote-terms-content) img[data-x="79"]{--terms-image-x:79%}:is(.terms-document-editor,.quote-terms-content) img[data-x="80"]{--terms-image-x:80%}:is(.terms-document-editor,.quote-terms-content) img[data-x="81"]{--terms-image-x:81%}:is(.terms-document-editor,.quote-terms-content) img[data-x="82"]{--terms-image-x:82%}:is(.terms-document-editor,.quote-terms-content) img[data-x="83"]{--terms-image-x:83%}:is(.terms-document-editor,.quote-terms-content) img[data-x="84"]{--terms-image-x:84%}:is(.terms-document-editor,.quote-terms-content) img[data-x="85"]{--terms-image-x:85%}:is(.terms-document-editor,.quote-terms-content) img[data-x="86"]{--terms-image-x:86%}:is(.terms-document-editor,.quote-terms-content) img[data-x="87"]{--terms-image-x:87%}:is(.terms-document-editor,.quote-terms-content) img[data-x="88"]{--terms-image-x:88%}:is(.terms-document-editor,.quote-terms-content) img[data-x="89"]{--terms-image-x:89%}:is(.terms-document-editor,.quote-terms-content) img[data-x="90"]{--terms-image-x:90%}:is(.terms-document-editor,.quote-terms-content) img[data-x="91"]{--terms-image-x:91%}:is(.terms-document-editor,.quote-terms-content) img[data-x="92"]{--terms-image-x:92%}:is(.terms-document-editor,.quote-terms-content) img[data-x="93"]{--terms-image-x:93%}:is(.terms-document-editor,.quote-terms-content) img[data-x="94"]{--terms-image-x:94%}:is(.terms-document-editor,.quote-terms-content) img[data-x="95"]{--terms-image-x:95%}:is(.terms-document-editor,.quote-terms-content) img[data-x="96"]{--terms-image-x:96%}:is(.terms-document-editor,.quote-terms-content) img[data-x="97"]{--terms-image-x:97%}:is(.terms-document-editor,.quote-terms-content) img[data-x="98"]{--terms-image-x:98%}:is(.terms-document-editor,.quote-terms-content) img[data-x="99"]{--terms-image-x:99%}:is(.terms-document-editor,.quote-terms-content) img[data-x="100"]{--terms-image-x:100%}
.terms-image-host{position:relative}
.terms-document-editor img{cursor:grab}
.terms-document-editor img.terms-image-selected{outline:2px solid var(--primary);outline-offset:2px}
.terms-image-selection{position:absolute;z-index:3;pointer-events:none;border:2px solid var(--primary)}
.terms-image-handle{position:absolute;width:12px;height:12px;padding:0;border:2px solid var(--primary);border-radius:50%;background:var(--surface);pointer-events:auto;touch-action:none;transform:translate(-50%,-50%)}
.terms-image-handle-nw{left:0;top:0;cursor:nwse-resize}.terms-image-handle-ne{left:100%;top:0;cursor:nesw-resize}
.terms-image-handle-sw{left:0;top:100%;cursor:nesw-resize}.terms-image-handle-se{left:100%;top:100%;cursor:nwse-resize}
.terms-image-drop-marker{position:absolute;height:3px;background:var(--primary);z-index:4;pointer-events:none}
:is(.terms-document-editor,.quote-terms-content) [data-align="left"]{text-align:left}
:is(.terms-document-editor,.quote-terms-content) [data-align="center"]{text-align:center}
:is(.terms-document-editor,.quote-terms-content) [data-align="right"]{text-align:right}
@media(max-width:575px){.terms-document-editor{min-height:20rem}}

/* Commercial document PDF exports. Bootstrap orange with dark text. */
.btn-pdf{
    --bs-btn-color:#212529;
    --bs-btn-bg:#fd7e14;
    --bs-btn-border-color:#fd7e14;
    --bs-btn-hover-color:#212529;
    --bs-btn-hover-bg:#e96b02;
    --bs-btn-hover-border-color:#e96b02;
    --bs-btn-focus-shadow-rgb:33,37,41;
    --bs-btn-active-color:#212529;
    --bs-btn-active-bg:#e96b02;
    --bs-btn-active-border-color:#e96b02;
    --bs-btn-disabled-color:#212529;
    --bs-btn-disabled-bg:#fd7e14;
    --bs-btn-disabled-border-color:#fd7e14;
}
.btn-pdf:focus-visible{outline:2px solid #212529;outline-offset:2px;}

/* Bootstrap integration is scoped to opted-in themes: Actual keeps its original defaults. */
:root:not([data-theme="actual"])[data-theme]{
    --bs-link-color:var(--link);
    --bs-link-color-rgb:var(--theme-primary-rgb);
    --bs-link-hover-color:var(--link-hover);
    --bs-link-hover-color-rgb:var(--theme-hover-rgb);
    --bs-primary:var(--primary);
    --bs-primary-rgb:var(--theme-primary-rgb);
    --bs-primary-text-emphasis:var(--primary-active);
    --bs-primary-bg-subtle:var(--accent-soft);
    --bs-primary-border-subtle:var(--accent-border);
    --bs-border-color:var(--line);
    --bs-focus-ring-color:var(--form-ring);
}
:root:not([data-theme="actual"])[data-theme] .btn-primary{
    --bs-btn-color:var(--on-primary);
    --bs-btn-bg:var(--primary);
    --bs-btn-border-color:var(--primary);
    --bs-btn-hover-color:var(--on-primary);
    --bs-btn-hover-bg:var(--primary-hover);
    --bs-btn-hover-border-color:var(--primary-hover);
    --bs-btn-active-color:var(--on-primary);
    --bs-btn-active-bg:var(--primary-active);
    --bs-btn-active-border-color:var(--primary-active);
    --bs-btn-focus-shadow-rgb:var(--theme-primary-rgb);
    --bs-btn-disabled-color:var(--on-primary);
    --bs-btn-disabled-bg:var(--primary);
    --bs-btn-disabled-border-color:var(--primary);
    color:var(--on-primary);
}
:root:not([data-theme="actual"])[data-theme] .btn-primary:active,
:root:not([data-theme="actual"])[data-theme] .btn-primary.active{background:var(--primary-active);border-color:var(--primary-active);}
:root:not([data-theme="actual"])[data-theme] :is(.form-control,.form-select):focus{border-color:var(--focus-ring);box-shadow:0 0 0 .25rem var(--form-ring);}
:root:not([data-theme="actual"])[data-theme] .form-check-input:checked{background-color:var(--primary);border-color:var(--primary);}
:root:not([data-theme="actual"])[data-theme] .form-check-input:focus{border-color:var(--focus-ring);box-shadow:0 0 0 .25rem var(--form-ring);}
:root:not([data-theme="actual"])[data-theme] .page-link{color:var(--link);}
:root:not([data-theme="actual"])[data-theme] :is(.active>.page-link,.page-link.active){color:var(--on-primary);background:var(--primary);border-color:var(--primary);}
:root:not([data-theme="actual"])[data-theme] .nav-item:hover{background:var(--nav-active-hover);color:var(--nav-active-text);}
:root:not([data-theme="actual"])[data-theme] ::selection{background:var(--selected-bg);color:var(--selected-text);}
/* Previews use the same palette variables as the actual page, with no inline colors. */
.appearance-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:1rem;}
.appearance-option{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:.75rem;padding:1rem;border:1px solid var(--line);border-radius:8px;cursor:pointer;}
.appearance-option:has(input:checked){border-color:var(--primary);box-shadow:0 0 0 2px var(--primary);background:var(--accent-soft);}
.appearance-option:has(input:focus-visible){outline:3px solid var(--focus-ring);outline-offset:3px;}
.appearance-name{font-weight:600;}.appearance-current{display:block;color:var(--primary);font-weight:600;}
.appearance-preview{grid-column:1/-1;display:flex;height:100px;overflow:hidden;border:1px solid var(--line);border-radius:6px;background:var(--page-bg);}
.appearance-preview-nav{width:25%;padding:12px 6px;background:var(--nav);}
.appearance-preview-nav>span{display:block;height:20px;border-radius:3px;background:var(--nav-active-bg);border-left:3px solid var(--nav-active-text);}
.appearance-preview-content{flex:1;padding:12px;display:grid;gap:8px;}
.appearance-preview-heading{height:6px;width:70%;background:var(--ink);border-radius:3px;}
.appearance-preview-accent{height:14px;background:var(--accent-soft);border:1px solid var(--accent-border);border-radius:3px;}
.appearance-preview-button{justify-self:start;padding:2px 12px;background:var(--primary);color:var(--on-primary);border-radius:4px;font-size:12px;}

/* Product lookup inherits the global palette; results stay inside responsive tables. */
.quote-product-search{min-width:15rem;max-width:30rem;}
.quote-product-search-input{width:100%;}
.quote-product-search-results{max-height:18rem;overflow:auto;margin-top:.35rem;border:1px solid var(--line);border-radius:6px;background:var(--surface);}
.quote-product-search-option{padding:.55rem .75rem;cursor:pointer;color:var(--ink);border-bottom:1px solid var(--line);}
.quote-product-search-option:last-child{border-bottom:0;}
.quote-product-search-option:hover,.quote-product-search-option.is-active{background:var(--accent-soft);color:var(--accent-text);box-shadow:inset 3px 0 var(--primary);}
.quote-product-search-input:focus{border-color:var(--focus-ring);box-shadow:0 0 0 .2rem var(--form-ring);}

.quote-header-actions{align-items:center;}
.quote-header-actions > .btn,.quote-header-actions > form > .btn,.quote-header-actions > .quote-delete-confirm > summary.btn{display:inline-flex;align-items:center;justify-content:center;height:2.5rem;padding:.5rem .75rem;border-radius:8px;font-size:.875rem;line-height:1.25rem;}
.quote-header-actions .btn-light{
    --bs-btn-color:var(--primary);
    --bs-btn-bg:var(--surface);
    --bs-btn-border-color:var(--primary);
    --bs-btn-hover-color:var(--primary-hover);
    --bs-btn-hover-bg:var(--accent-soft);
    --bs-btn-hover-border-color:var(--primary-hover);
    --bs-btn-active-color:var(--primary-active);
    --bs-btn-active-bg:var(--accent-soft);
    --bs-btn-active-border-color:var(--primary-active);
    --bs-btn-focus-shadow-rgb:var(--theme-primary-rgb);
}

.quote-state-actions[hidden]{display:none;}

/* Corporate branding and the locally remembered sidebar layout. */
.corporate-brand-logo{display:block;object-fit:contain;background:transparent;}
.corporate-brand-logo[hidden]{display:none;}
.sidebar .sidebar-brand{padding:0 1.75rem 1.5rem 0;min-height:5rem;}
.sidebar-logo{width:190px;max-width:100%;height:auto;max-height:90px;}
.login-logo{width:260px;max-width:100%;height:auto;max-height:140px;margin:0 auto 1.75rem;}
.login-logo-fallback{text-align:center;font-size:1.5rem;font-weight:600;margin-bottom:1.75rem;}
.sidebar-close{position:absolute;top:1rem;right:.65rem;padding:.15rem .5rem;font-size:1.25rem;line-height:1.25;}
.crm-page .menu-toggle{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:.35rem .65rem;}
.sidebar{transition:transform .18s ease,visibility .18s;}
.workspace{transition:margin-left .18s ease;}
.crm-page.sidebar-collapsed .sidebar{transform:translateX(-100%);visibility:hidden;}
.crm-page.sidebar-collapsed .workspace{margin-left:0;}
@media(max-width:850px){.crm-page .sidebar{visibility:hidden;}.crm-page .sidebar.is-open{transform:translateX(0);visibility:visible;}.crm-page .workspace{margin-left:0;}.login-logo{width:240px;}}
@media(prefers-reduced-motion:reduce){.sidebar,.workspace{transition:none;}}

.sidebar-logo-fallback{color:var(--nav-text);font-size:2rem;line-height:1;}

.document-configuration-block{margin-top:2rem;padding-top:1.5rem;border-top:2px solid var(--line);}
.document-configuration-save{display:flex;justify-content:flex-end;margin:1.5rem 0;padding-top:1.25rem;border-top:1px solid var(--line);}

/* Compact +Info layout: presentation only, scoped to followup panels. */
.company-panel.followup-compact{padding:14px 16px;font-size:13px;min-width:0;}
.followup-compact p{margin-bottom:.4rem;}
.followup-compact p:last-child{margin-bottom:0;}
.followup-section-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem;margin-bottom:.65rem;}
.followup-section-heading>h2,.followup-section-heading>h3{min-width:0;overflow-wrap:anywhere;}
.followup-status{color:var(--primary);background:var(--accent-soft);border:1px solid var(--line);border-radius:6px;padding:.15rem .45rem;font-size:12px;overflow-wrap:anywhere;}
.followup-fields{display:grid;gap:.5rem 1rem;margin:0 0 .65rem;}
.followup-shipping-fields{grid-template-columns:repeat(6,minmax(0,1fr));}
.followup-payment-summary{grid-template-columns:repeat(5,minmax(0,1fr));}
.followup-fields>div{min-width:0;}
.followup-fields dt{font-size:11px;font-weight:500;color:var(--muted);margin-bottom:.15rem;}
.followup-fields dd{margin:0;font-size:13px;overflow-wrap:anywhere;}
.followup-payment-summary dd{font-weight:600;}
.followup-documents-heading{font-size:12px;margin:.55rem 0 .25rem;}
.followup-document-row{display:flex;align-items:center;flex-wrap:wrap;gap:.25rem .6rem;padding:.2rem 0;min-width:0;}
.followup-document-row>*{min-width:0;max-width:100%;overflow-wrap:anywhere;}
.followup-document-row+.followup-document-row{border-top:1px solid var(--line);}
.followup-actions{gap:.3rem .45rem;min-width:0;}
.followup-compact .followup-actions form,.followup-document-row form{display:flex;align-items:center;flex-wrap:wrap;gap:.25rem .4rem;min-width:0;max-width:100%;margin:0;}
.followup-compact .btn{font-size:12px;line-height:1.25;padding:.25rem .5rem;white-space:normal;overflow-wrap:anywhere;max-width:100%;}
.followup-compact .followup-actions label{font-size:11px;line-height:1.35;overflow-wrap:anywhere;}
.followup-component-heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .8rem;margin-bottom:.6rem;}
.followup-component-heading>h3{flex:1 1 150px;min-width:0;overflow-wrap:anywhere;}
.followup-component-heading>span{overflow-wrap:anywhere;}
.followup-component-heading>.followup-actions{margin-left:auto;flex:0 1 auto;max-width:42%;}
.followup-table-wrap{width:100%;min-width:0;}
.followup-table{width:100%;table-layout:fixed;font-size:12px;margin-bottom:0;}
.followup-table th,.followup-table td{padding:.4rem .45rem;white-space:normal;overflow-wrap:anywhere;}
.followup-table th{font-size:11px;color:var(--muted);font-weight:600;}
.followup-quota-table th:nth-child(1){width:5%;}
.followup-quota-table th:nth-child(2){width:13%;}
.followup-quota-table th:nth-child(3){width:17%;}
.followup-quota-table th:nth-child(4){width:11%;}
.followup-quota-table th:nth-child(5){width:25%;}
.followup-quota-table th:nth-child(6){width:29%;}
.followup-payments-table th:nth-child(1){width:13%;}
.followup-payments-table th:nth-child(2){width:12%;}
.followup-payments-table th:nth-child(3){width:11%;}
.followup-payments-table th:nth-child(4){width:11%;}
.followup-payments-table th:nth-child(5){width:10%;}
.followup-payments-table th:nth-child(6){width:25%;}
.followup-payments-table th:nth-child(7){width:18%;}
.followup-payment-detail td{padding-top:.15rem;padding-bottom:.5rem;background:var(--surface);}
.followup-payments-table tbody>tr,.followup-payments-table tbody>tr>td{border:0;}
.followup-payments-table tbody>.followup-payment-main~.followup-payment-main>td{border-top:2px solid var(--line);padding-top:.6rem;}
@media(max-width:1199px){
    .followup-shipping-fields,.followup-payment-summary{grid-template-columns:repeat(3,minmax(0,1fr));}
    .followup-component-heading>.followup-actions{max-width:100%;margin-left:0;flex-basis:100%;}
    .followup-table,.followup-table tbody{display:block;width:100%;}
    .followup-table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
    .followup-table tbody>tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.35rem .65rem;padding:.5rem 0;border-top:1px solid var(--line);}
    .followup-table tbody>tr>td{display:block;min-width:0;border:0;padding:0;}
    .followup-table td[data-label]::before{content:attr(data-label);display:block;font-size:11px;font-weight:500;color:var(--muted);margin-bottom:.15rem;}
    .followup-table td[data-label="Documentos"],.followup-table td[data-label="Acciones"]{grid-column:1/-1;}
    .followup-table tbody>tr.followup-payment-detail{display:block;border-top:0;padding-top:0;}
    .followup-payments-table tbody>.followup-payment-main~.followup-payment-main{border-top:2px solid var(--line);padding-top:.6rem;}
    .followup-payments-table tbody>.followup-payment-main~.followup-payment-main>td{border:0;padding-top:0;}
}
@media(max-width:639px){
    .company-panel.followup-compact{padding:12px;}
    .followup-shipping-fields,.followup-payment-summary,.followup-table tbody>tr{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:419px){
    .followup-shipping-fields,.followup-payment-summary,.followup-table tbody>tr{grid-template-columns:minmax(0,1fr);}
    .followup-component-heading{align-items:flex-start;flex-direction:column;}
    .followup-component-heading>h3,.followup-component-heading>.followup-actions{flex-basis:auto;}
}
.followup-confirm{min-width:0;max-width:100%;}
.followup-confirm>summary{list-style:none;cursor:pointer;}
.followup-confirm>summary::-webkit-details-marker{display:none;}
.followup-confirm:not([open])>form{display:none;}
.followup-confirm[open]>form{margin-top:.3rem;padding:.4rem;border:1px solid var(--line);border-radius:6px;background:var(--surface);}
.payment-sequence-dialog{width:min(34rem,calc(100% - 2rem));max-height:calc(100vh - 2rem);overflow:auto;padding:1.25rem;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink);box-shadow:0 12px 40px #0003;}
.payment-sequence-dialog::backdrop{background:#0006;}
.payment-sequence-dialog p{overflow-wrap:anywhere;}

/* Keep installment actions compact, with cancellation last. */
.followup-quota-actions{flex-wrap:nowrap;gap:.25rem;}
.followup-compact .followup-quota-actions .btn{padding:.25rem .3rem;white-space:nowrap;overflow-wrap:normal;flex-shrink:0;}
.followup-quota-actions>.followup-confirm{order:1;flex-shrink:0;position:relative;}
@media(min-width:640px){
    .followup-quota-actions>.followup-confirm[open]>form{position:absolute;top:100%;right:0;width:15rem;max-width:none;z-index:5;box-shadow:0 4px 12px #0002;}
}
@media(min-width:1200px){
    .followup-quota-table th:nth-child(5){width:20%;}
    .followup-quota-table th:nth-child(6){width:34%;}
}
@media(max-width:639px){
    .followup-quota-actions{flex-wrap:wrap;}
}

/* Consistent single-line actions for real payments. */
.followup-real-payment-actions{flex-wrap:nowrap;gap:.25rem;}
.followup-compact .followup-real-payment-actions .btn{display:inline-flex;align-items:center;justify-content:center;font-size:12px;line-height:1.25;padding:.25rem .3rem;min-height:25px;white-space:nowrap;overflow-wrap:normal;flex-shrink:0;}
.followup-real-payment-actions>.followup-confirm{flex-shrink:0;position:relative;}
@media(min-width:640px){
    .followup-real-payment-actions>.followup-confirm[open]>form{position:absolute;top:100%;right:0;width:15rem;max-width:none;z-index:5;box-shadow:0 4px 12px #0002;}
}
@media(min-width:1200px){
    .followup-payments-table th:nth-child(6){width:15%;}
    .followup-payments-table th:nth-child(7){width:28%;}
}
@media(max-width:639px){
    .followup-real-payment-actions{flex-wrap:wrap;}
}

.po-pdf-language{position:relative;}
.quote-header-actions .po-pdf-language>summary.btn{display:inline-flex;align-items:center;justify-content:center;height:2.5rem;padding:.5rem .75rem;border-radius:8px;font-size:.875rem;line-height:1.25rem;list-style:none;cursor:pointer;}
.po-pdf-language>summary::-webkit-details-marker{display:none;}
.po-pdf-language-panel{position:absolute;right:0;top:calc(100% + .5rem);z-index:10;width:max-content;max-width:calc(100vw - 3rem);padding:1rem;border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:0 8px 24px var(--shadow);}
.po-pdf-language-panel p{margin:0 0 .75rem;}
@media(max-width:767.98px){.po-pdf-language-panel{right:auto;left:0;}}

/* Trace dashboard: colors identify entity types; connectors follow the rendered relationships. */
.trace-tone-quote {--trace-color:#7954c9;--trace-tint:#f3eefb;}
.trace-tone-invoice {--trace-color:#326bc8;--trace-tint:#edf3fd;}
.trace-tone-followup,.trace-tone-payments {--trace-color:#218264;--trace-tint:#eaf6f0;}
.trace-tone-order {--trace-color:#b56a1b;--trace-tint:#fff4e7;}
.trace-tone-shipping {--trace-color:#5968ba;--trace-tint:#eff0fb;}
.trace-tone-note {--trace-color:#b84c68;--trace-tint:#fceff3;}
.trace-invoice-summary {display:flex;flex-wrap:wrap;gap:16px 28px;align-items:center;padding:18px 24px;}
.trace-invoice-summary>div {min-width:0;display:grid;gap:5px;overflow-wrap:anywhere;}
.trace-invoice-summary>div:nth-child(2) {flex:1;}
.trace-invoice-summary strong {font-size:13px;font-weight:600;}
.trace-invoice-summary .trace-balance-paid{color:var(--primary);}
.trace-invoice-summary .trace-balance-paid small{font-size:10px;font-weight:600;}
.trace-caption {display:block;color:var(--muted);font-size:10px;letter-spacing:.7px;}
.trace-panel-heading {display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:24px;}
.trace-panel-heading h2 {font-size:15px;font-weight:600;margin:5px 0 0;}
.trace-map-label {font-size:10px;color:var(--muted);white-space:nowrap;}
.trace-dashboard-diagram {padding:24px;margin-bottom:24px;}
/* Main documents share a row; actual operations share a separate branching row. */
.followup-trace {--trace-source:calc(83.333333% + 12px);position:relative;display:grid;gap:64px;min-width:0;padding-right:22px;}
.followup-trace-no-quote {--trace-source:calc(75% + 9px);}
.trace-primary-flow {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:36px;align-items:stretch;position:relative;}
.followup-trace-no-quote .trace-primary-flow {grid-template-columns:repeat(2,minmax(0,1fr));}
.followup-trace-main {display:flex;}
.followup-trace-main>.followup-trace-node {width:100%;display:flex;flex-direction:column;}
.followup-trace-main .trace-detail-link {margin-top:auto;padding-top:12px;}
.followup-trace:not(.followup-trace-no-branches) .trace-primary-flow::after {content:"";position:absolute;left:var(--trace-source);top:100%;height:32px;border-left:2px solid var(--primary);}
.followup-trace-node.company-panel {position:relative;min-width:0;overflow-wrap:anywhere;padding:14px;border-radius:10px;border-top:3px solid var(--trace-color);background:var(--surface);box-shadow:0 3px 12px var(--shadow);}
.trace-node-heading {display:flex;align-items:center;gap:8px;margin-bottom:12px;}
.trace-node-heading h3,.trace-branch-heading h3 {font-size:11px;font-weight:600;margin:0;color:var(--trace-color);}
.trace-icon {display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;border-radius:8px;color:var(--trace-color);background:var(--trace-tint);font-size:17px;font-weight:600;}
.trace-node-reference {font-size:13px;font-weight:700;line-height:1.5;margin:0 0 8px;}
.trace-node-reference a {color:var(--ink);}
.trace-node-reference a:hover {color:var(--trace-color);text-decoration:underline;}
.trace-state {display:inline-block;width:fit-content;border-radius:6px;padding:3px 7px;font-size:10px;font-weight:600;background:var(--trace-tint);color:var(--trace-color);}
.trace-node-amount {font-size:12px;font-weight:600;margin:12px 0 6px;}
.trace-node-detail,.trace-payment-count {font-size:11px;line-height:1.7;color:var(--muted);margin:8px 0;}
.trace-detail-link {display:inline-flex;align-items:center;gap:7px;font-size:11px;font-weight:600;margin-top:12px;color:var(--trace-color,var(--primary));}
.followup-trace-main,.followup-trace-branch {position:relative;min-width:0;}
.followup-trace-main + .followup-trace-main::before {content:"";position:absolute;left:-36px;top:44px;width:36px;border-top:2px solid var(--primary);}
.followup-trace-main + .followup-trace-main::after {content:"";position:absolute;left:-8px;top:40px;width:8px;height:8px;border-top:2px solid var(--primary);border-right:2px solid var(--primary);transform:rotate(45deg);}
.followup-trace-branches {--trace-bus-start:calc((100% - 48px) / 6);position:relative;min-width:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;align-items:start;}
.trace-branch-count-2 {--trace-bus-start:calc((100% - 24px) / 4);grid-template-columns:repeat(2,minmax(0,1fr));}
.trace-branch-count-1 {--trace-bus-start:50%;grid-template-columns:minmax(0,1fr);}
.followup-trace-branches::before {content:"";position:absolute;top:-32px;left:var(--trace-bus-start);right:calc(100% - var(--trace-source));border-top:2px solid var(--primary);}
.followup-trace-branch {padding:12px;background:var(--trace-tint);border:1px solid var(--line);border-radius:12px;}
.followup-trace-branch::before {content:"";position:absolute;top:-32px;left:50%;height:32px;border-left:2px solid var(--trace-color);}
.followup-trace-branch::after {content:"";position:absolute;top:-9px;left:calc(50% - 3px);width:8px;height:8px;border-top:2px solid var(--trace-color);border-right:2px solid var(--trace-color);transform:rotate(135deg);}
/* NC has its own route from Seguimiento, never from an OC or Shipping. */
.followup-trace-has-notes::after {content:"";position:absolute;top:44px;bottom:0;right:0;width:22px;border-top:2px solid #b84c68;border-right:2px solid #b84c68;border-bottom:2px solid #b84c68;border-radius:0 12px 12px 0;pointer-events:none;}
.followup-trace-has-notes .trace-primary-flow::before {content:"";position:absolute;left:100%;top:44px;width:22px;border-top:2px solid #b84c68;}
.trace-notes-route {position:relative;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;padding-bottom:0;}
.trace-notes-group {grid-column:3;}
.followup-trace-no-quote .trace-notes-route {grid-template-columns:repeat(2,minmax(0,1fr));}
.followup-trace-no-quote .trace-notes-group {grid-column:2;}
.trace-notes-group::before {top:auto;bottom:0;left:100%;width:22px;height:0;border-left:0;border-top:2px solid #b84c68;}
.trace-notes-group::after {top:auto;bottom:-3px;left:auto;right:-9px;transform:rotate(-135deg);}
.followup-trace-has-notes .trace-primary-flow::after {display:none;}
.followup-trace-has-notes:has(.followup-trace-branches) .trace-primary-flow::after {display:block;}
.trace-branch-heading {display:flex;align-items:center;gap:8px;margin-bottom:10px;}
.trace-count {margin-left:auto;border-radius:6px;background:var(--surface);padding:2px 6px;font-size:10px;color:var(--trace-color);}
.trace-branch-entities {display:grid;gap:10px;}
.trace-branch-entities .trace-node-heading {display:none;}
.trace-bottom-panels {display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:start;}
.trace-bottom-panels>section {min-width:0;}
.trace-highlights {list-style:none;padding:0 0 0 16px;margin:0;border-left:1px solid var(--line);}
.trace-highlights li {position:relative;margin:0 0 18px;display:grid;gap:4px;overflow-wrap:anywhere;}
.trace-highlights li::before {content:"";position:absolute;left:-21px;top:4px;width:9px;height:9px;border-radius:50%;background:var(--primary);border:2px solid var(--surface);}
.trace-highlights time,.trace-highlights li>span {color:var(--muted);font-size:10px;}
.trace-highlights strong {font-size:12px;font-weight:600;}
.trace-summary-row {display:flex;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid var(--line);min-width:0;overflow-wrap:anywhere;}
.trace-summary-row:last-child {border-bottom:0;}
.trace-summary-row>div {min-width:0;}
.trace-summary-row strong {display:block;font-size:12px;font-weight:600;}
.trace-summary-row strong a {color:var(--ink);}
.trace-summary-state {display:block;color:var(--trace-color);font-size:10px;margin-top:3px;}
.trace-summary-value {margin-left:auto;text-align:right;font-size:11px;font-weight:600;max-width:48%;}
.trace-summary-value small {display:block;font-size:10px;font-weight:400;color:var(--muted);margin-top:4px;}
.followup-trace-progress {display:block;width:100%;height:7px;margin-top:12px;appearance:none;border:0;border-radius:8px;overflow:hidden;background:var(--line);color:var(--trace-color);}
.followup-trace-progress::-webkit-progress-bar {background:var(--line);}
.followup-trace-progress::-webkit-progress-value {background:var(--trace-color);}
.followup-trace-progress::-moz-progress-bar {background:var(--trace-color);}
.trace-progress-label {font-size:10px;color:var(--trace-color);margin:5px 0 0;text-align:right;}
#followup-payments,[id^="shipping-"] {scroll-margin-top:24px;}
@media (min-width:992px) {
 .trace-bottom-panels {grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);}
 .trace-dashboard-diagram {padding:22px 18px;}
 .trace-primary-flow .trace-node-heading h3 {font-size:12px;}
 .trace-branch-entities {max-height:440px;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;}
 .trace-highlights li {grid-template-columns:132px minmax(0,1fr);gap:4px 12px;margin-bottom:14px;}
 .trace-highlights time {grid-row:span 2;line-height:1.7;}
}
@media (max-width:991.98px) {
 .followup-trace {display:grid;gap:32px;padding-right:0;}
 .trace-primary-flow,.followup-trace-no-quote .trace-primary-flow {grid-template-columns:minmax(0,1fr);gap:32px;}
 .followup-trace-main + .followup-trace-main::before {left:24px;top:-32px;width:0;height:32px;border-top:0;border-left:2px solid var(--primary);display:block;}
 .followup-trace-main + .followup-trace-main::after {left:21px;top:-9px;width:8px;height:8px;transform:rotate(135deg);border-top:2px solid var(--primary);border-right:2px solid var(--primary);}
 .followup-trace .trace-primary-flow::after,.followup-trace-has-notes::after,.followup-trace-has-notes .trace-primary-flow::before {display:none!important;}
 .followup-trace-branches {grid-template-columns:minmax(0,1fr);gap:24px;margin-left:24px;border-left:2px solid var(--primary);padding-left:18px;}
 .followup-trace-branches::before {left:-2px;top:-32px;right:auto;width:0;height:32px;border-top:0;border-left:2px solid var(--primary);}
 .followup-trace-branch::before {top:24px;left:-20px;width:20px;height:0;border-left:0;border-top:2px solid var(--trace-color);}
 .followup-trace-branch::after {top:20px;left:-8px;transform:rotate(45deg);}
 .trace-notes-route,.followup-trace-no-quote .trace-notes-route {grid-template-columns:minmax(0,1fr);margin-left:24px;padding-left:18px;border-left:2px solid #b84c68;}
 .trace-notes-group,.followup-trace-no-quote .trace-notes-group {grid-column:1;}
 .trace-notes-route::before {content:"";position:absolute;left:-2px;top:-32px;height:32px;border-left:2px solid #b84c68;}
 .trace-notes-group::before {top:24px;bottom:auto;left:-20px;width:20px;height:0;}
 .trace-notes-group::after {top:20px;bottom:auto;left:-8px;right:auto;transform:rotate(45deg);}
 .trace-bottom-panels {grid-template-columns:minmax(0,1fr);gap:16px;}
}
@media (max-width:767px) {
 .trace-bottom-panels {grid-template-columns:minmax(0,1fr);gap:16px;}
 .trace-dashboard-diagram {padding:16px;}
 .trace-invoice-summary {padding:16px;gap:14px 20px;}
 .trace-invoice-summary>div:nth-child(2) {flex:1 1 60%;}
 .trace-panel-heading {flex-wrap:wrap;margin-bottom:20px;}
 .trace-summary-value {max-width:45%;}
}

.invoice-detail-heading{gap:16px;}
.invoice-detail-heading .company-actions{margin-left:auto;justify-content:flex-end;flex-wrap:nowrap;}
.invoice-detail-heading .company-actions .btn{white-space:nowrap;}
@media(max-width:1200px){
    .invoice-detail-heading{flex-wrap:wrap;}
    .invoice-detail-heading .company-actions{flex-wrap:wrap;}
}

/* Category editing keeps the Bootstrap btn-sm metrics used by its status action. */
.category-edit-button.btn-sm,.btn-compact.btn-sm{
    padding:var(--bs-btn-padding-y) var(--bs-btn-padding-x);
    font-size:var(--bs-btn-font-size);
    font-weight:var(--bs-btn-font-weight);
    line-height:var(--bs-btn-line-height);
    border-radius:var(--bs-btn-border-radius);
}

/* Secondary actions share the active palette's neutral colors. */
.followup-list-actions .btn-secondary,.btn-theme-secondary{
    --bs-btn-color:var(--surface);
    --bs-btn-bg:var(--muted);
    --bs-btn-border-color:var(--muted);
    --bs-btn-hover-color:var(--surface);
    --bs-btn-hover-bg:var(--ink);
    --bs-btn-hover-border-color:var(--ink);
    --bs-btn-active-color:var(--surface);
    --bs-btn-active-bg:var(--ink);
    --bs-btn-active-border-color:var(--ink);
    --bs-btn-disabled-color:var(--surface);
    --bs-btn-disabled-bg:var(--muted);
    --bs-btn-disabled-border-color:var(--muted);
}

/* Preserve the existing font size of actions previously styled as btn-light. */
.company-panel .secondary-light-size{font-size:13px;}

/* Search and reset actions share dimensions while retaining their button colors. */
.company-panel .btn.filter-action{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:12px;
    font-size:13px;
    line-height:1.5;
    border-width:1px;
    border-radius:8px;
    vertical-align:middle;
}

/* Subtle Dashboard outline without changing menu spacing. */
.nav-item.nav-dashboard.active{box-shadow:inset 0 0 0 1px var(--nav-line);}

/* Compact trace map: all related operations branch from Seguimiento on the right. */
.trace-right-map.followup-trace{
    display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);
    align-items:center;gap:64px;padding-right:0;
}
.trace-right-map.followup-trace-no-branches{grid-template-columns:minmax(0,1fr);}
.trace-right-map .trace-primary-flow{gap:20px;align-items:stretch;grid-auto-rows:1fr;}
.trace-right-map .followup-trace-main + .followup-trace-main::before{
    left:-20px;top:50%;width:20px;border-top:1px solid var(--primary);
}
.trace-right-map .followup-trace-main + .followup-trace-main::after{
    left:-6px;top:calc(50% - 3px);width:6px;height:6px;
    border-width:1px;transform:rotate(45deg);
}
.trace-right-map .trace-primary-flow::before,
.trace-right-map.followup-trace-has-notes::after{display:none;}
.trace-right-map .trace-primary-flow::after{content:none;display:none!important;}
.trace-right-map .followup-trace-main:last-child>.followup-trace-node::after{
    content:"";position:absolute;left:100%;top:50%;width:32px;
    border-top:1px solid var(--primary);pointer-events:none;
}
.trace-right-map.followup-trace-no-branches .followup-trace-main:last-child>.followup-trace-node::after{display:none;}
.trace-right-map .followup-trace-branches{
    display:grid;grid-template-columns:minmax(0,1fr);gap:14px;
    margin:0;padding:0;border:0;
    width:max(65%,min(220px,100%));justify-self:start;
}
.trace-right-map .followup-trace-branches::before{
    content:"";position:absolute;left:-32px;right:auto;top:24px;bottom:24px;
    width:0;height:auto;border:0;border-left:1px solid var(--primary);
}
.trace-right-map .followup-trace-branch{
    padding:8px;border-radius:8px;background:var(--surface);
}
.trace-right-map .followup-trace-branch::before{
    left:-33px;top:24px;width:32px;height:0;
    border:0;border-top:1px solid var(--trace-color);
}
.trace-right-map .followup-trace-branch::after{
    left:-6px;right:auto;top:21px;bottom:auto;width:6px;height:6px;
    border-width:1px;transform:rotate(45deg);
}
.trace-right-map .trace-branch-heading{gap:6px;margin-bottom:6px;}
.trace-right-map .trace-branch-heading h3{min-width:0;overflow-wrap:anywhere;}
.trace-right-map .trace-branch-entities{
    grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr));
    gap:8px;max-height:none;overflow:visible;
}
.trace-right-map .followup-trace-node.company-panel{
    padding:8px;border-radius:7px;border-top-width:2px;box-shadow:none;
}
.trace-right-map .trace-node-heading{gap:5px;margin-bottom:6px;}
.trace-right-map .trace-node-heading h3{font-size:10px;}
.trace-right-map .trace-icon{width:22px;height:22px;border-radius:6px;font-size:13px;}
.trace-right-map .trace-node-reference{font-size:11px;line-height:1.35;margin-bottom:5px;}
.trace-right-map .trace-state{font-size:9px;padding:2px 5px;}
.trace-right-map .trace-node-amount{font-size:11px;margin:6px 0 3px;}
.trace-right-map .trace-node-detail,
.trace-right-map .trace-payment-count{font-size:10px;line-height:1.4;margin:4px 0;}
.trace-right-map .trace-detail-link{font-size:10px;margin-top:6px;padding-top:0;gap:4px;}
.trace-right-map .followup-trace-main .trace-detail-link{padding-top:6px;}
.trace-right-map .followup-trace-progress{height:4px;margin-top:6px;}
.trace-right-map .trace-progress-label{font-size:9px;margin-top:3px;}
.trace-right-map .trace-node-dates{font-size:10px;line-height:1.4;color:var(--muted);margin-top:4px;overflow-wrap:anywhere;}
@media(max-width:991.98px){
    .trace-right-map.followup-trace{grid-template-columns:minmax(0,1fr);gap:28px;}
    .trace-right-map .trace-primary-flow{grid-template-columns:minmax(0,1fr);}
    .trace-right-map.followup-trace-no-quote .trace-primary-flow{grid-template-columns:minmax(0,1fr);}
    .trace-right-map .followup-trace-main + .followup-trace-main::before{
        left:24px;top:-20px;width:0;height:20px;border:0;border-left:1px solid var(--primary);
    }
    .trace-right-map .followup-trace-main + .followup-trace-main::after{
        left:21px;top:-6px;transform:rotate(135deg);
    }
    .trace-right-map .followup-trace-main:last-child>.followup-trace-node::after{display:none;}
    .trace-right-map .followup-trace-branches{margin-left:24px;width:max(65%,min(244px,calc(100% - 24px)));max-width:calc(100% - 24px);}
    .trace-right-map .followup-trace-branches::before{
        left:0;top:-28px;bottom:24px;border-left:1px solid var(--primary);
    }
    .trace-right-map .followup-trace-branch{margin-left:24px;}
    .trace-right-map .followup-trace-branch::before{left:-25px;width:24px;}
    .trace-right-map .trace-primary-flow::after{
        display:none!important;left:24px;top:100%;height:28px;width:0;
        border:0;border-left:1px solid var(--primary);
    }
    .trace-right-map.followup-trace-no-branches .trace-primary-flow::after{display:none!important;}
}

/* Independent sidebar groups; only the upper navigation scrolls. */
.sidebar{overflow:hidden;}
.sidebar .sidebar-brand,.sidebar .sidebar-user{flex-shrink:0;}
.sidebar .sidebar-main-nav{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--nav-line) transparent;padding:3px 0;}
.sidebar-group{margin-top:4px;}
.sidebar-group-toggle.nav-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;margin:0;padding:11px 12px;border:0;border-radius:7px;background:transparent;text-align:left;line-height:1.4;cursor:pointer;transition:background .16s ease,color .16s ease;}
.sidebar-group-toggle:hover{background:var(--nav-active-hover);color:var(--nav-link);}
.sidebar-group-toggle:focus-visible{outline-offset:-3px;}
.sidebar-group-chevron{flex-shrink:0;transition:transform .18s ease;}
.sidebar-group.is-expanded .sidebar-group-chevron{transform:rotate(90deg);}
.sidebar-group-panel{display:grid;grid-template-rows:0fr;opacity:0;transition:grid-template-rows .18s ease,opacity .18s ease;}
.sidebar-group.is-expanded .sidebar-group-panel{grid-template-rows:1fr;opacity:1;}
.sidebar-group-items{min-height:0;overflow:hidden;}
.sidebar-group-items .nav-item{padding-left:22px;}
.sidebar .sidebar-user{display:flex;flex-direction:column;gap:8px;margin-top:8px;padding:12px 0 0;}
.sidebar-user-row{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,3fr);gap:6px;align-items:stretch;}
.sidebar-user-identity{display:flex;align-items:center;gap:8px;min-width:0;padding-left:4px;}
.sidebar-user-identity .avatar{flex:0 0 34px;}
.sidebar-user-details{min-width:0;}
.sidebar-user-details strong{line-height:1.4;overflow-wrap:anywhere;}
.sidebar-user-details small{overflow-wrap:anywhere;}
.sidebar-user .sidebar-help-link{justify-content:center;gap:5px;align-self:stretch;padding:8px 4px;margin:0;font-size:11px;}
.sidebar-help-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 15px;width:15px;height:15px;border:1px solid currentColor;border-radius:50%;font-size:10px;line-height:1;opacity:.8;}
.sidebar-user .logout-button{padding:8px 4px;}
@media(prefers-reduced-motion:reduce){.sidebar-group-toggle,.sidebar-group-chevron,.sidebar-group-panel{transition:none;}}

/* Followup detail: compact, consistent information type controls. */
.followup-compact .btn.followup-detail-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:30px;
    padding:.25rem .5rem;
    font-size:12px;
    font-weight:600;
    line-height:1.5;
    border-radius:var(--bs-border-radius-sm);
    vertical-align:middle;
}
/* Invoice numbers remain recognizable links regardless of the button theme. */
.followup-header .followup-invoice-link{
    color:#0d6efd;
    text-decoration:underline;
}
.followup-header .followup-invoice-link:hover,
.followup-header .followup-invoice-link:focus{
    color:#0a58ca;
    text-decoration:underline;
}
.followup-header .followup-invoice-link:focus-visible{
    outline-color:#0a58ca;
}

/* Keep term edit actions and purchase order filters visually consistent. */
.company-panel .payment-term-edit-actions .btn,
.company-panel .terms-edit-actions .btn,
.company-panel .purchase-order-filters :is(.form-control,.form-select,.btn){
    height:46px;
    padding-top:12px;
    padding-bottom:12px;
    font-family:inherit;
    font-size:13px;
    line-height:1.5;
    border-radius:8px;
}
.company-panel .payment-term-edit-actions .btn,
.company-panel .terms-edit-actions .btn,
.company-panel .purchase-order-filters .btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding-left:12px;
    padding-right:12px;
    font-weight:600;
    text-align:center;
    vertical-align:middle;
}
.company-panel .purchase-order-filters :is(.form-control,.form-select){
    font-weight:400;
}
