:root {
    --ink: #122019;
    --muted: #65746d;
    --line: #dbe5df;
    --soft: #f4f7f5;
    --surface: #ffffff;
    --nav: #10271e;
    --nav-2: #19372b;
    --green: #087a4f;
    --green-dark: #05603d;
    --green-soft: #e5f5ed;
    --coral: #d85e48;
    --coral-soft: #fcede9;
    --amber: #b77a14;
    --amber-soft: #fff4dc;
    --blue: #33748f;
    --blue-soft: #e9f4f8;
    --danger: #b93b42;
    --danger-soft: #fbedee;
    --shadow: 0 12px 30px rgba(12, 43, 31, .09);
    --sidebar: 260px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--soft); }
body { margin: 0; min-height: 100%; color: var(--ink); background: var(--soft); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; letter-spacing: 0; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 50; display: flex; flex-direction: column; color: #e9f1ed; background: var(--nav); border-right: 1px solid #244436; box-shadow: 8px 0 30px rgba(8, 35, 25, .08); }
.brand { min-height: 82px; display: flex; gap: 13px; align-items: center; padding: 17px 20px; border-bottom: 1px solid #29483b; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: inline-grid; place-items: center; border: 1px solid #68cba3; color: #fff; background: #0b8f5d; font-weight: 850; font-size: 20px; border-radius: 8px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.08), 0 6px 16px rgba(0,0,0,.18); }
.brand-mark.large { width: 56px; height: 56px; font-size: 28px; }
.brand-logo { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: 0 0 auto; overflow: hidden; padding: 4px; background: #fff; border: 1px solid #5eb991; border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.18); }.brand-logo.large { width: 64px; height: 64px; padding: 6px; }.brand-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand strong { display: block; color: #fff; font-size: 17px; font-weight: 780; }
.brand small { display: block; color: #91afa3; font-size: 10px; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 20px 13px; }
.nav-label { display: block; margin: 20px 11px 8px; color: #6f9183; font-size: 9px; font-weight: 850; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.nav-link { position: relative; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: #abc1b8; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 650; transition: color .16s, background .16s, border-color .16s; }
.nav-link:hover { color: #fff; background: #1b3a2e; border-color: #2b5142; }
.nav-link.active { color: #fff; background: #20503d; border-color: #32634f; box-shadow: inset 3px 0 #62d0a3; }
.nav-link.active::before { display: none; }
.nav-group { display: grid; gap: 3px; }
.nav-sublink { min-height: 34px; position: relative; display: flex; align-items: center; gap: 10px; margin-left: 23px; padding: 7px 10px; color: #8fa99e; border-radius: 5px; font-size: 11px; font-weight: 650; }
.nav-sublink:hover, .nav-sublink.active { color: #fff; background: #193b2e; }
.nav-submark { width: 6px; height: 6px; flex: 0 0 auto; background: #608678; border-radius: 50%; }
.nav-sublink.active .nav-submark { background: #62d0a3; box-shadow: 0 0 0 3px rgba(98,208,163,.13); }
.icon { width: 17px; height: 17px; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; }
.icon svg { width: 100%; height: 100%; display: block; }
.sidebar-user { min-height: 76px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 32px; gap: 11px; align-items: center; padding: 13px 15px; background: #0b1d16; border-top: 1px solid #29483b; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: #18382c; background: #bfe8d8; border-radius: 50%; font-weight: 800; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; color: #fff; }
.user-copy small { color: #82968e; font-size: 10px; }
.sidebar-user form { margin: 0; }
.main-shell { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 74px; display: grid; grid-template-columns: 40px minmax(0,1fr) 40px; gap: 16px; align-items: center; padding: 12px clamp(20px, 3vw, 40px); background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px rgba(18,45,34,.035); backdrop-filter: blur(10px); }
.topbar-title { grid-column: 2; justify-self: center; text-align: center; }
.topbar-title span, .topbar-title small { display: block; }
.topbar-title span { color: var(--ink); font-size: 17px; font-weight: 780; }
.topbar-title small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.system-dot { width: 6px; height: 6px; display: inline-block; background: #1bae72; border: 2px solid #d5f2e5; border-radius: 50%; box-sizing: content-box; }
.topbar-spacer { grid-column: 3; width: 40px; height: 1px; }
.mobile-menu { display: none; }
.page-content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 30px clamp(20px, 3vw, 40px) 60px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading h1 { margin-bottom: 5px; font-size: 25px; line-height: 1.25; font-weight: 790; }
.page-heading p { margin: 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--green); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.workspace-chip { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: #176246; background: var(--green-soft); border: 1px solid #c9e8da; border-radius: 17px; font-size: 10px; font-weight: 750; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.btn { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 720; font-size: 12px; white-space: nowrap; transition: background .15s, border .15s, transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 5px 12px rgba(8,122,79,.18); }
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 7px 16px rgba(8,122,79,.24); }
.btn-secondary { color: var(--ink); background: #fff; border-color: #cfd7d3; }
.btn-secondary:hover { border-color: #9badA5; background: #f9fbfa; }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: #efcdd0; }
.btn-ghost { color: var(--muted); background: transparent; border-color: transparent; }
.btn-sm { min-height: 32px; padding: 5px 9px; }
.btn-block { width: 100%; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--soft); border-color: var(--line); }
.icon-btn-danger { color: var(--danger); }
.icon-btn-danger:hover { color: #b93828; background: #fff1ee; border-color: #f0b8ae; }
.icon-btn.inverse { color: #abc0b7; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 3px 14px rgba(18,45,34,.045); }
.panel-body { padding: 20px; }
.panel-header { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 14px; }
.panel-header small { color: var(--muted); }
.panel-footer { padding: 14px 18px; border-top: 1px solid var(--line); background: #fafcfb; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: grid; gap: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat { min-height: 130px; position: relative; padding: 19px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 8px; box-shadow: 0 5px 18px rgba(18,45,34,.05); transition: transform .18s, box-shadow .18s, border-color .18s; }
.stat:hover { transform: translateY(-2px); border-color: #b8d9ca; box-shadow: 0 10px 25px rgba(18,45,34,.09); }
.stat:nth-child(2) { border-top-color: var(--amber); }.stat:nth-child(3) { border-top-color: var(--blue); }.stat:nth-child(4) { border-top-color: var(--coral); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border: 1px solid #d3ecdf; border-radius: 7px; }
.stat-icon.coral { color: var(--coral); background: var(--coral-soft); }
.stat-icon.amber { color: var(--amber); background: var(--amber-soft); }
.stat-icon.blue { color: var(--blue); background: var(--blue-soft); }
.stat-label { color: var(--muted); font-size: 10px; font-weight: 790; text-transform: uppercase; }
.stat-value { display: block; margin-top: 16px; font-size: 27px; line-height: 1; font-weight: 820; }
.stat-note { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .75fr); gap: 18px; align-items: start; }
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quick-action { min-height: 76px; display: flex; gap: 11px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; transition: transform .16s, border-color .16s, background .16s; }
.quick-action:hover { transform: translateY(-1px); }
.quick-action:hover { border-color: #9fc9b9; background: var(--green-soft); }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { font-size: 12px; }
.quick-action small { color: var(--muted); font-size: 10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 14px; }
.search-field { min-width: 230px; flex: 1; position: relative; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #8b9692; }
.search-field input { width: 100%; padding-left: 36px; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #cfd7d3; border-radius: 5px; outline: none; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,124,90,.11); }
input[readonly] { color: #53605b; background: #f1f4f2; }
input[type="checkbox"] { width: 16px; min-height: 16px; accent-color: var(--green); }
.field { display: grid; gap: 6px; align-content: start; }
.field > span:first-child, .field-label { color: #3c4844; font-size: 11px; font-weight: 750; }
.field small { color: var(--muted); font-size: 10px; }
.field-error { color: var(--danger) !important; font-size: 10px; }
.required::after { content: " *"; color: var(--danger); }
.field-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-3 { grid-column: span 3; }.span-4 { grid-column: span 4; }.span-5 { grid-column: span 5; }.span-6 { grid-column: span 6; }.span-7 { grid-column: span 7; }.span-8 { grid-column: span 8; }.span-12 { grid-column: span 12; }
.checkbox-field { min-height: 38px; display: flex; align-items: center; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 38px; height: 22px; position: relative; background: #c5cfcb; border-radius: 12px; transition: .2s; }
.switch-track::after { content: ""; width: 16px; height: 16px; position: absolute; top: 3px; left: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th { padding: 12px 14px; color: #57675f; background: #f3f7f5; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; font-weight: 850; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid #e7ede9; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafcfb; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-title { display: block; font-weight: 750; }
.cell-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.actions-cell { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.badge { min-height: 24px; display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid transparent; border-radius: 12px; font-size: 10px; font-weight: 800; text-transform: capitalize; }
.badge-active, .badge-approved, .badge-converted { color: #116145; background: var(--green-soft); border-color: #cde9dd; }
.badge-draft { color: #56635f; background: #edf1ef; border-color: #dfe5e2; }
.badge-submitted { color: #24657f; background: var(--blue-soft); border-color: #cae3ed; }
.badge-revised { color: #8b5e0d; background: var(--amber-soft); border-color: #f2dda8; }
.badge-cancelled, .badge-rejected, .badge-inactive, .badge-expired { color: #a1373d; background: var(--danger-soft); border-color: #efcdd0; }
.empty-table { padding: 48px 20px !important; text-align: center; color: var(--muted); }

.toast { max-width: 640px; min-height: 44px; display: flex; align-items: center; gap: 10px; margin: 0 0 16px auto; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; box-shadow: var(--shadow); }
.toast-success { border-left-color: var(--green); }.toast-error { border-left-color: var(--danger); }
.toast .icon-btn { margin-left: auto; }.alert { padding: 10px 12px; border-radius: 5px; }.alert-error { color: var(--danger); background: var(--danger-soft); }.alert-warning { color: #7a4b06; background: #fff6dd; border: 1px solid #f0d695; }

.drawer { width: min(600px, 94vw); position: fixed; z-index: 100; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; background: #fff; box-shadow: -18px 0 50px rgba(18,33,27,.18); transform: translateX(105%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; font-size: 17px; }.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }.drawer-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafcfb; }
.modal-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(13,25,21,.52); }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }.form-section:last-child { border-bottom: 0; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 18px; background: #e9eeeb; border-radius: 6px; }
.tab { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; color: var(--muted); border-radius: 4px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.tab.active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.settings-section { scroll-margin-top: 100px; margin-bottom: 18px; }
.image-upload { min-height: 118px; display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px dashed #bac6c1; border-radius: 6px; background: #fafcfb; }
.image-preview { width: 96px; height: 78px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px; transition: border-color .16s, box-shadow .16s; }
.image-preview.has-image { border-color: #7dc7a7; box-shadow: 0 0 0 3px rgba(8,122,79,.08); }.image-preview img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }.image-preview .icon { width: 24px; height: 24px; color: #8e9b96; }.image-empty-mark { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }.upload-file-name { max-width: 220px; display: block; margin-top: 7px; overflow: hidden; color: var(--green-dark); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.term-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 32px; gap: 8px; align-items: start; margin-bottom: 8px; }.drag-handle { color: #8d9994; cursor: grab; padding-top: 10px; text-align: center; }.term-row textarea { min-height: 52px; }

.quote-header-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(150px, .5fr)); gap: 14px; }
.customer-summary { min-height: 112px; margin-top: 10px; padding: 12px; color: #41504a; background: #f6f9f7; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; }
.select-with-action { display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 6px; }
.select-with-action .quick-add-btn { width: 38px; height: 38px; color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 4px 10px rgba(8,122,79,.18); }
.select-with-action .quick-add-btn .icon { width: 18px; height: 18px; font-size: 20px; font-weight: 700; line-height: 1; }
.select-with-action .quick-add-btn:hover { color: #fff; background: var(--green-dark); border-color: var(--green-dark); }
.quote-items-panel { margin-top: 18px; }
.quote-table { min-width: 1220px; }
.quote-table th, .quote-table td { padding: 7px; }
.quote-table th { font-size: 9px; }
.quote-table input, .quote-table select { min-height: 34px; padding: 6px 7px; font-size: 11px; }
.quote-table .select-with-action .quick-add-btn { width: 34px; height: 34px; }
.quote-table .sl-cell { width: 34px; text-align: center; color: var(--muted); }.quote-table .drag-cell { width: 28px; }.quote-table .product-cell { min-width: 220px; }.quote-table .pack-cell { min-width: 115px; }.quote-table .money-cell { width: 105px; }.quote-table .percent-cell { width: 84px; }.quote-table .company-cell { min-width: 160px; }.quote-table .qty-cell { width: 75px; }.quote-table .actions-cell { width: 72px; }
.calculated-rate { padding: 8px; background: #f0f5f2; border: 1px solid #d7dfdb; border-radius: 5px; font-weight: 800; white-space: nowrap; }
.quote-bottom { display: grid; grid-template-columns: minmax(0, 1.5fr) 360px; gap: 18px; align-items: start; margin-top: 18px; }
.quote-bottom.unit-rate-mode { grid-template-columns: minmax(0, 1fr); }
.unit-rate-detail > aside.stack > section:first-child { display: none; }
.unit-rate-detail > .stack > section:nth-child(2) .data-table th:nth-last-child(-n+2), .unit-rate-detail > .stack > section:nth-child(2) .data-table td:nth-last-child(-n+2) { display: none; }
.totals-box { position: sticky; top: 94px; }
.total-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid #e8ecea; font-size: 12px; }.total-row:last-child { border: 0; }.total-row strong { font-variant-numeric: tabular-nums; }.total-row.grand { margin-top: 5px; padding: 13px 0; color: var(--green-dark); font-size: 15px; border-top: 2px solid var(--green); }.amount-words { padding: 11px; color: #52615b; background: var(--green-soft); border-radius: 5px; font-size: 10px; }
.sticky-actions { position: sticky; z-index: 20; bottom: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 22px -12px -12px; padding: 12px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 -8px 24px rgba(20,35,29,.08); backdrop-filter: blur(8px); }.sticky-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }
.autosave-state { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }

.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 7px; margin-bottom: 18px; }
.detail-hero h1 { margin-bottom: 5px; font-size: 23px; }.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 11px; }
.activity-list { list-style: none; margin: 0; padding: 0; }.activity-item { position: relative; display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 10px; padding: 0 0 17px; }.activity-item:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 27px; bottom: 0; width: 1px; background: var(--line); }.activity-dot { width: 28px; height: 28px; z-index: 1; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; }.activity-copy strong, .activity-copy small { display: block; }.activity-copy strong { font-size: 11px; }.activity-copy small { color: var(--muted); font-size: 10px; }
.audit-change { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; }
.role-list { display: grid; gap: 9px; }.role-permissions { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }.role-permissions summary { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 15px; cursor: pointer; background: #fafcfb; }.role-permissions summary strong,.role-permissions summary small { display: block; }.role-permissions summary small { color: var(--muted); font-size: 10px; }.role-body { padding: 15px; border-top: 1px solid var(--line); }.role-body .panel-footer { margin: 15px -15px -15px; }.permission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 16px; }.permission-grid h3 { grid-column: 1/-1; margin: 10px 0 0; padding-bottom: 5px; border-bottom: 1px solid var(--line); font-size: 11px; }.permission-grid label { font-size: 11px; }

.preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.paper-frame { width: min(210mm, 100%); min-height: 297mm; margin: 0 auto; padding: 14mm 13mm; background: #fff; box-shadow: 0 8px 35px rgba(17,31,26,.14); }
.document-header { display: grid; grid-template-columns: 90px minmax(0,1fr) 170px; gap: 14px; align-items: center; padding-bottom: 12px; border-bottom: 2px solid #1f684f; }.document-logo { max-width: 82px; max-height: 64px; object-fit: contain; }.document-org h1 { margin: 0 0 4px; color: #155f46; font-size: 22px; }.document-org p, .document-meta p { margin: 1px 0; font-size: 9px; }.document-meta { text-align: right; }.document-title { margin: 14px 0 9px; text-align: center; font-size: 16px; text-transform: uppercase; }.document-info { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 14px 0; margin: 0 -14px; }.document-info td { width: 50%; padding: 12px 14px; background: #f5f8f6; border: 1px solid #d9e1dd; vertical-align: top; }.document-info h3 { margin: 0 0 8px; font-size: 10px; text-transform: uppercase; }.document-info p { margin: 0 0 5px; font-size: 9px; line-height: 1.5; }.document-info p:last-child { margin-bottom: 0; }.document-info-name { margin-bottom: 7px !important; }.document-subject { margin: 13px 0; white-space: pre-line; font-size: 10px; }.document-table { width: 100%; border-collapse: collapse; font-size: 8px; }.document-table th { padding: 6px 4px; color: #fff; background: #205f4a; border: 1px solid #205f4a; text-align: left; }.document-table td { padding: 6px 4px; border: 1px solid #ced8d3; vertical-align: top; }.document-table .num { text-align: right; white-space: nowrap; }.document-totals { width: 48%; margin: 10px 0 12px auto; }.document-totals div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid #e1e6e3; font-size: 9px; }.document-totals .final { padding: 6px 0; font-size: 11px; font-weight: 800; border-top: 2px solid #205f4a; }.document-words { padding: 6px; background: #f1f6f3; font-size: 8px; }.document-footer { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 22px; margin-top: 14px; }.document-footer h3 { margin: 0 0 7px; color: #205f4a; font-size: 9px; text-transform: uppercase; }.document-footer p, .document-footer li { margin: 0 0 4px; font-size: 8px; line-height: 1.45; }.document-footer ol { margin: 0; padding-left: 15px; }.bank-details { padding: 10px 12px; background: #f8faf9; border-left: 3px solid #2d7a5d; }.bank-address { white-space: normal; }.signatory { margin-top: 16px; text-align: right; }.sign-images { min-height: 216px; display: flex; justify-content: flex-end; align-items: flex-end; gap: 4px; }.sign-images img { object-fit: contain; }.sign-images .seal-image { max-width: 312px; max-height: 216px; }.sign-images .signature-image { max-width: 78px; max-height: 54px; }.document-note { margin-top: 15px; padding-top: 6px; color: #7a8580; border-top: 1px solid #dfe5e2; text-align: center; font-size: 7px; }

.drawer-wide { width: min(760px, 96vw); }
.additional-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.company-identity-cell { min-width: 260px; display: flex; align-items: center; gap: 10px; }
.company-table-logo { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; color: #fff; background: var(--green); border: 1px solid var(--line); border-radius: 6px; font-weight: 800; }
.company-table-logo img { width: 100%; height: 100%; padding: 3px; object-fit: contain; background: #fff; }
.company-table-logo-empty { box-shadow: inset 0 0 0 2px rgba(255,255,255,.13); }
.template-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; }
.template-chip i { width: 15px; height: 15px; display: inline-block; border: 1px solid rgba(0,0,0,.12); border-radius: 3px; }
.color-control { min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 1px solid #cfd7d3; border-radius: 5px; }
.color-control input[type="color"] { width: 42px; height: 27px; min-height: 27px; padding: 0; border: 0; cursor: pointer; }
.color-control span { color: var(--muted); font-size: 11px; }
.compact-upload { min-height: 104px; gap: 10px; padding: 10px; }
.compact-upload .image-preview { width: 66px; height: 64px; }
.remove-asset { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.remove-asset input { vertical-align: middle; }
.additional-generator-grid { margin-bottom: 18px; }
.generator-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.snapshot-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.summary-metric { padding: 2px 0 15px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.summary-metric strong,.summary-metric span { display: block; }
.summary-metric strong { font-size: 26px; }
.summary-metric span { color: var(--muted); font-size: 11px; }
.percentage-input { position: relative; }
.percentage-input input { padding-right: 34px; }
.percentage-input span { position: absolute; right: 11px; top: 9px; color: var(--muted); font-weight: 750; }
.adjustment-range { display: grid; grid-template-columns: 32px minmax(0,1fr) 32px; gap: 8px; align-items: center; color: var(--muted); font-size: 9px; }
.adjustment-range div { height: 4px; overflow: hidden; background: #dbe5df; border-radius: 2px; }
.adjustment-range i { width: 33%; height: 100%; display: block; margin-left: 33%; background: var(--green); }
.additional-history { margin-top: 18px; }
.additional-paper-frame { width: min(210mm, 100%); min-height: 297mm; margin: 0 auto; padding: 12mm; background: #fff; box-shadow: 0 8px 35px rgba(17,31,26,.14); }
.additional-document { --document-accent: #17624a; color: #18211d; font-size: 9px; }
.additional-document.template-executive { font-family: Georgia, "Times New Roman", serif; }
.additional-document-header { display: grid; grid-template-columns: 92px minmax(0,1fr) 165px; gap: 15px; align-items: center; padding: 0 0 14px; border-bottom: 3px solid var(--document-accent); }
.additional-logo-wrap { width: 82px; height: 68px; display: grid; place-items: center; overflow: hidden; }
.additional-logo-wrap img { max-width: 80px; max-height: 66px; object-fit: contain; }
.additional-logo-wrap span { width: 58px; height: 58px; display: grid; place-items: center; color: #fff; background: var(--document-accent); font-size: 26px; font-weight: 800; }
.additional-company-heading h1 { margin: 0 0 3px; color: var(--document-accent); font-size: 24px; line-height: 1.1; }
.additional-company-heading p { margin: 1px 0; font-size: 8px; }
.additional-tagline { font-style: italic; }
.additional-legal { text-align: right; }
.additional-legal p { margin: 0 0 5px; }
.additional-legal strong,.additional-legal span { display: block; }
.additional-legal strong { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.additional-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0; }
.additional-title-row span { color: var(--document-accent); font-size: 17px; font-weight: 800; text-transform: uppercase; }
.additional-title-row strong { font-size: 12px; }
.additional-parties { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(250px,.85fr); }
.additional-parties > div { padding: 12px 14px; background: #f5f7f6; }
.additional-parties > .additional-document-meta { background: #edf3f0; }
.additional-kicker { display: block; margin-bottom: 5px; color: var(--document-accent); font-size: 7px; font-weight: 850; text-transform: uppercase; }
.additional-parties h2 { margin: 0 0 5px; font-size: 13px; }
.additional-parties p { margin: 0 0 4px; line-height: 1.45; }
.additional-document-meta p { display: flex; justify-content: space-between; gap: 12px; }
.additional-document-meta span { color: var(--muted); }
.additional-subject { margin: 13px 0; white-space: pre-line; line-height: 1.55; }
.additional-items { width: 100%; border-collapse: collapse; font-size: 8px; }
.additional-items th { padding: 7px 5px; color: #fff; background: var(--document-accent); text-align: left; }
.additional-items td { padding: 7px 5px; border-bottom: 1px solid #d4dcd8; vertical-align: top; }
.additional-items tbody tr:nth-child(even) { background: #f8faf9; }
.additional-items .num { text-align: right; white-space: nowrap; }
.strong-rate { font-weight: 850; }
.additional-total-section { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 28px; align-items: end; margin-top: 12px; }
.additional-amount-words span,.additional-amount-words strong { display: block; }
.additional-amount-words span { color: var(--document-accent); font-size: 7px; text-transform: uppercase; }
.additional-totals p { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 4px 0; border-bottom: 1px solid #d8dfdc; }
.additional-grand { color: var(--document-accent); font-size: 11px; border-top: 2px solid var(--document-accent) !important; }
.additional-document-footer { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 24px; margin-top: 16px; }
.additional-terms ol { margin: 0; padding-left: 15px; }
.additional-terms li,.additional-bank p { margin: 0 0 4px; line-height: 1.45; }
.additional-bank { padding: 9px 11px; background: #f5f7f6; border-left: 3px solid var(--document-accent); }
.additional-signature { margin-top: 10px; text-align: right; }
.additional-sign-images { min-height: 120px; display: flex; justify-content: flex-end; align-items: flex-end; gap: 5px; }
.additional-sign-images img { object-fit: contain; }
.additional-seal { max-width: 165px; max-height: 115px; }
.additional-signature-image { max-width: 82px; max-height: 52px; }
.additional-signature p { margin: 2px 0; }
.template-modern .additional-document-header { padding: 10px; background: #f4f7f6; }
.template-modern .additional-company-heading h1 { font-family: Inter, ui-sans-serif, sans-serif; }
.template-modern .additional-items th { font-size: 7px; text-transform: uppercase; }

.auth-page { background: #fff; }.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .95fr) minmax(440px, 1.05fr); }.auth-brand-panel { position: relative; display: flex; align-items: flex-end; padding: clamp(38px, 7vw, 90px); color: #fff; background: #152a23; overflow: hidden; }.auth-brand-panel::before { content: ""; position: absolute; width: 280px; height: 280px; right: -85px; top: -85px; border: 42px solid #234d3e; transform: rotate(18deg); }.auth-brand-copy { position: relative; width: 100%; max-width: 540px; }.auth-brand-identity { width: max-content; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 0 auto 26px; text-align: center; }.auth-brand-identity h1 { min-width: 0; margin: 0; font-size: 42px; line-height: 1.1; }.auth-primary-logo { width: 128px; height: 128px; padding: 8px; border-radius: 8px; }.auth-brand-copy > p { max-width: 490px; color: #b9cbc4; font-size: 17px; }.auth-proof { display: flex; gap: 12px; align-items: center; margin-top: 42px; padding-top: 20px; border-top: 1px solid #3b5048; }.auth-proof .icon { width: 24px; height: 24px; color: #6fd1ad; }.auth-proof small { color: #91aaa0; }.auth-form-panel { display: grid; place-items: center; padding: 40px; }.auth-form { width: min(420px, 100%); display: grid; gap: 18px; }.auth-login-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }.auth-form-logo { width: 76px; height: 76px; padding: 6px; border-color: #a8d9c4; box-shadow: 0 8px 22px rgba(8,122,79,.12); }.auth-heading { margin-bottom: 10px; text-align: center; }.auth-heading h2 { margin-bottom: 6px; font-size: 27px; }.auth-heading p { color: var(--muted); }.password-field { position: relative; display: block; }.password-field input { padding-right: 42px; }.password-field .icon-btn { position: absolute; right: 3px; top: 3px; }.demo-credentials { padding: 9px; color: var(--muted); background: var(--soft); border-radius: 5px; text-align: center; font-size: 10px; }
.login-options { display: flex; align-items: center; margin-top: -5px; }.remember-option { display: inline-flex; align-items: center; gap: 9px; color: #46564f; cursor: pointer; font-size: 11px; font-weight: 650; }.remember-option > input { position: absolute; opacity: 0; pointer-events: none; }.remember-check { width: 18px; height: 18px; display: inline-grid; place-items: center; color: transparent; background: #fff; border: 1px solid #b9c8c1; border-radius: 4px; transition: background .15s, border-color .15s, color .15s; }.remember-check .icon { width: 12px; height: 12px; }.remember-option > input:checked + .remember-check { color: #fff; background: var(--green); border-color: var(--green); }.remember-option > input:focus-visible + .remember-check { box-shadow: 0 0 0 3px rgba(8,122,79,.14); }
.empty-state { min-height: 65vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }.empty-state h1 { margin: 12px 0 5px; }.empty-state p { color: var(--muted); }.empty-icon { width: 42px; height: 42px; color: var(--coral); }.empty-code { color: var(--green); font-size: 54px; font-weight: 900; }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dashboard-grid, .grid-sidebar, .quote-bottom { grid-template-columns: 1fr; }
    .additional-document-footer, .additional-total-section { grid-template-columns: 1fr; }
    .totals-box { position: static; }
    .quote-header-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .auth-primary-logo { width: 108px; height: 108px; }.auth-brand-identity { gap: 16px; }.auth-brand-identity h1 { font-size: 36px; }
}
@media (max-width: 820px) {
    .app-shell { display: block; }.main-shell { margin-left: 0; }.sidebar { transform: translateX(-105%); transition: transform .22s; box-shadow: 16px 0 45px rgba(0,0,0,.2); }.sidebar.open { transform: translateX(0); }.mobile-menu { display: inline-grid; }.topbar { min-height: 64px; }.topbar-title small { display: none; }.page-content { padding-top: 18px; }.grid-2, .grid-3 { grid-template-columns: 1fr; }.field-row { grid-template-columns: repeat(2, minmax(0,1fr)); }.field-row > * { grid-column: span 1 !important; }.quote-header-grid { grid-template-columns: 1fr 1fr; }.quote-header-grid .customer-field, .quote-header-grid .subject-field { grid-column: 1 / -1; }.additional-parties { grid-template-columns: 1fr; }.additional-document-header { grid-template-columns: 72px minmax(0,1fr); }.additional-legal { grid-column: 1 / -1; text-align: left; }.auth-layout { grid-template-columns: 1fr; }.auth-brand-panel { display: none; }.auth-form-panel { min-height: 100vh; padding: 28px; }.permission-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
    .page-heading, .detail-hero, .preview-toolbar { align-items: stretch; flex-direction: column; }.page-actions { width: 100%; }.page-actions .btn { flex: 1; }.stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.stat { min-height: 104px; padding: 13px; }.stat-value { font-size: 21px; }.dashboard-grid { gap: 12px; }.quick-actions { grid-template-columns: 1fr; }.field-row, .quote-header-grid { grid-template-columns: 1fr; }.field-row > *, .quote-header-grid > * { grid-column: 1 !important; }.toolbar > select, .toolbar > input, .toolbar > .btn { width: 100%; }.search-field { min-width: 100%; }.panel-body, .form-section { padding: 14px; }.sticky-actions { align-items: stretch; flex-direction: column; }.sticky-actions > div { display: grid; grid-template-columns: 1fr 1fr; }.paper-frame, .additional-paper-frame { min-height: auto; padding: 8mm 5mm; }.document-header { grid-template-columns: 54px 1fr; }.document-meta { grid-column: 1 / -1; text-align: left; }.document-footer { grid-template-columns: 1fr; }.document-table, .additional-items { font-size: 6px; }.document-table th, .document-table td, .additional-items th, .additional-items td { padding: 3px 2px; }.additional-title-row { align-items: flex-start; flex-direction: column; gap: 4px; }.additional-company-heading h1 { font-size: 19px; }.generator-actions { align-items: stretch; flex-direction: column; }.auth-form-logo { width: 66px; height: 66px; }
}
@media print {
    body { background: #fff; }.sidebar, .topbar, .preview-toolbar, .toast { display: none !important; }.main-shell { margin: 0; }.page-content { max-width: none; padding: 0; }.paper-frame, .additional-paper-frame { width: 100%; min-height: 0; padding: 0; box-shadow: none; }
}
