/* Optical correction: Thai glyphs run larger than Barlow Condensed at the same CSS size. */
@font-face { font-family: "Google Sans Thai Balanced"; font-style: normal; font-weight: 400; font-display: swap; size-adjust: 90%; unicode-range: U+0E00-0E7F; src: url("https://fonts.gstatic.com/s/googlesans/v70/4Ua_rENHsxJlGDuGo1OIlJfC6l_24rlCK1Yo_Iqcsih3SAyH6cAwhX9RFD48TE63OOYKtrwEIKli.ttf") format("truetype"); }
@font-face { font-family: "Google Sans Thai Balanced"; font-style: normal; font-weight: 500; font-display: swap; size-adjust: 90%; unicode-range: U+0E00-0E7F; src: url("https://fonts.gstatic.com/s/googlesans/v70/4Ua_rENHsxJlGDuGo1OIlJfC6l_24rlCK1Yo_Iqcsih3SAyH6cAwhX9RFD48TE63OOYKtrw2IKli.ttf") format("truetype"); }
@font-face { font-family: "Google Sans Thai Balanced"; font-style: normal; font-weight: 600; font-display: swap; size-adjust: 90%; unicode-range: U+0E00-0E7F; src: url("https://fonts.gstatic.com/s/googlesans/v70/4Ua_rENHsxJlGDuGo1OIlJfC6l_24rlCK1Yo_Iqcsih3SAyH6cAwhX9RFD48TE63OOYKtrzaJ6li.ttf") format("truetype"); }
@font-face { font-family: "Google Sans Thai Balanced"; font-style: normal; font-weight: 700 900; font-display: swap; size-adjust: 90%; unicode-range: U+0E00-0E7F; src: url("https://fonts.gstatic.com/s/googlesans/v70/4Ua_rENHsxJlGDuGo1OIlJfC6l_24rlCK1Yo_Iqcsih3SAyH6cAwhX9RFD48TE63OOYKtrzjJ6li.ttf") format("truetype"); }

:root {
  --color-navy: #06243d;
  --color-blue: #08aeef;
  --color-blue-ink: #0077a8;
  --color-blue-hover: #079bd5;
  --color-blue-soft: #e5f7fe;
  --color-white: #ffffff;
  --color-background: #f5f7fa;
  --color-text: #152536;
  --color-muted: #5f7081;
  --color-border: #dce4ec;
  --color-control-border: #cfd9e3;
  --color-surface-subtle: #fbfcfd;
  --color-success: #16845b;
  --color-warning: #b76e00;
  --color-danger: #c33d4a;
  --color-focus: #08aeef;
  /* Barlow Condensed leads Latin/English; Google Sans leads Thai with a local fallback for missing glyphs. */
  --font-english: "Barlow Condensed", Arial, sans-serif;
  --font-thai: "Google Sans Thai Balanced", "Google Sans", "Noto Sans Thai", Arial, sans-serif;
  --font-ui: "Barlow Condensed", "Google Sans Thai Balanced", "Google Sans", "Noto Sans Thai", Arial, sans-serif;
  --font-document: "Barlow Condensed", "Google Sans Thai Balanced", "Google Sans", "Noto Sans Thai", Arial, sans-serif;
  --font-size-body: 1.2rem;
  --font-size-small: 1.0625rem;
  --font-size-label: 1.125rem;
  --font-size-meta: 1rem;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius-sm: .625rem;
  --radius-md: 1rem;
  --shadow-card: 0 12px 32px rgba(6, 36, 61, .08);
  --motion-fast: 150ms;
  --motion-normal: 220ms;
}

:root {
    --bs-primary: var(--color-blue);
    --bs-primary-rgb: 8, 174, 239;
    --bs-body-color: var(--color-text);
    --bs-body-bg: var(--color-background);
    --app-sidebar-width: 256px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body, button, input, select, textarea, table, .tooltip, .popover, .modal, .dropdown-menu, .swal2-popup {
    font-family: var(--font-ui);
    font-optical-sizing: auto;
}

.font-english { font-family: var(--font-english); }
.font-thai { font-family: var(--font-thai); }

html { font-size: 17px; scrollbar-color: var(--color-muted) var(--color-background); }
body { color: var(--color-text); background: var(--color-background); min-height: 100dvh; caret-color: var(--color-blue-ink); font-size: var(--font-size-body); line-height: 1.45; }
a { color: var(--color-blue-ink); text-underline-offset: .18em; }
a:hover { color: var(--color-navy); }
::selection { color: var(--color-white); background: var(--color-navy); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--color-background); }
::-webkit-scrollbar-thumb { background: var(--color-muted); border: 3px solid var(--color-background); border-radius: 999px; }
::placeholder { color: var(--color-muted) !important; opacity: 1; }
.skip-link { position: fixed; z-index: 2000; top: 8px; left: 8px; background: white; padding: 8px 12px; border-radius: 8px; }

.app-sidebar { width: var(--app-sidebar-width) !important; background-color: var(--color-navy) !important; color: white; border: 0; }
.app-sidebar .offcanvas-body { display: flex; flex-direction: column; height: 100%; padding: 26px 16px 22px; background-color: var(--color-navy) !important; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-size: 27px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
.sidebar-brand .brand-name { transition: color var(--motion-fast); }
.sidebar-brand:hover .brand-name, .sidebar-brand:focus-visible .brand-name { color: var(--color-blue); }
.sidebar-brand small { display: block; margin-top: 3px; color: #b8ccdc; font-size: 14px; line-height: 1.3; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border: 2px solid var(--color-blue); color: var(--color-blue); border-radius: 11px; }
.sidebar-nav { display: grid; gap: 6px; margin-top: 40px; }
.sidebar-link { min-height: 56px; display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: #e4edf5; border-radius: 10px; text-decoration: none; font-size: 21px; line-height: 1.35; font-weight: 600; letter-spacing: .005em; transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast); }
.sidebar-link i { flex: 0 0 26px; width: 26px; font-size: 24px; line-height: 1; text-align: center; }
.sidebar-link-label { min-width: 0; }
.sidebar-link:hover, .sidebar-link:focus-visible { color: white; background: rgba(255,255,255,.08); }
.sidebar-link.active { color: var(--color-navy); background: var(--color-blue); font-weight: 700; box-shadow: 0 8px 18px rgba(8,174,239,.18); }
.sidebar-footer { margin-top: auto; padding-top: 24px; }

.app-shell { min-height: 100dvh; margin-left: var(--app-sidebar-width); }
.topbar { min-height: 76px; display: flex; align-items: center; gap: 16px; padding: 14px 32px; background: var(--color-white); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 1010; }
.page-title { font-size: 37px; font-weight: 700; letter-spacing: -.03em; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user strong { display: block; font-size: 18px; }
.topbar-user span { display: block; font-size: 17px; }
.topbar-user span { color: var(--color-muted); }
.avatar { display: grid !important; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--color-blue-soft); color: var(--color-blue-ink) !important; font-weight: 700; }
.main-content { padding: 28px 32px 48px; }

.card-surface { background: white; border: 0; border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.section-card { padding: 24px; }
.section-heading { font-size: 24px; font-weight: 700; margin: 0; }
.section-kicker { color: var(--color-muted); font-size: 18px; margin: 3px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.btn { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; text-align: center; vertical-align: middle; border-radius: var(--radius-sm); font-size: 21px; line-height: 1.2; font-weight: 600; padding-inline: 22px; }
.btn-primary { --bs-btn-color: var(--color-navy); --bs-btn-bg: var(--color-blue); --bs-btn-border-color: var(--color-blue); --bs-btn-hover-color: var(--color-navy); --bs-btn-hover-bg: var(--color-blue-hover); --bs-btn-hover-border-color: var(--color-blue-hover); --bs-btn-active-color: var(--color-navy); --bs-btn-active-bg: var(--color-blue-hover); --bs-btn-active-border-color: var(--color-blue-hover); }
.btn-outline-primary { --bs-btn-color: var(--color-blue-ink); --bs-btn-border-color: var(--color-blue); --bs-btn-hover-color: var(--color-navy); --bs-btn-hover-bg: var(--color-blue); --bs-btn-hover-border-color: var(--color-blue); }
.btn-navy { background: var(--color-navy); border-color: var(--color-navy); color: white; }
.btn-navy:hover { background: #0a3455; border-color: #0a3455; color: white; }
.icon-button { width: 52px; height: 52px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon-button-sm { width: 52px; height: 52px; min-height: 52px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.form-control, .form-select { min-height: 52px; border-color: var(--color-control-border); border-radius: var(--radius-sm); font-size: 21px; line-height: 1.35; }
.form-control:valid:not(.date-picker-input), .form-control.is-valid:not(.date-picker-input), .form-select:valid, .form-select.is-valid,
.was-validated .form-control:valid:not(.date-picker-input), .was-validated .form-control.is-valid:not(.date-picker-input),
.was-validated .form-select:valid, .was-validated .form-select.is-valid { background-image: none !important; }
.form-control:focus, .form-select:focus, .btn:focus-visible, .sidebar-link:focus-visible, a:focus-visible, [contenteditable="true"]:focus-visible { border-color: var(--color-focus); box-shadow: 0 0 0 .22rem rgba(8,174,239,.24); outline: 0; }
.btn:disabled, .form-control:disabled, .form-select:disabled { cursor: not-allowed; opacity: .62; }
.modal .btn-close { min-width: 52px; min-height: 52px; }
.dropdown-item { min-height: 52px; display: flex; align-items: center; font-size: 21px; }
.date-picker-input { cursor: pointer; padding-right: 42px !important; background-color: var(--color-white) !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16' fill='none' stroke='%230077a8' stroke-width='1.5'%3E%3Crect x='2' y='3.5' width='12' height='10' rx='2'/%3E%3Cpath d='M5 2v3M11 2v3M2 7h12'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 18px 18px !important; }
.flatpickr-calendar { z-index: 1200 !important; width: 320px; max-width: calc(100vw - 28px); padding: 8px; border: 1px solid var(--color-border); border-radius: 14px; box-shadow: 0 18px 42px rgba(6,36,61,.18); font-family: var(--font-ui); }
.flatpickr-months { align-items: center; padding: 2px 4px 8px; }
.flatpickr-current-month { color: var(--color-navy); font-size: 20px; font-weight: 700; }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { color: var(--color-navy); font-weight: 700; }
.flatpickr-weekdays { height: 28px; }
span.flatpickr-weekday { color: var(--color-muted); font-size: 16px; font-weight: 700; }
.flatpickr-day { max-width: 44px; height: 44px; line-height: 44px; border-radius: 10px; color: var(--color-text); font-size: 20px; }
.flatpickr-day:hover, .flatpickr-day:focus { color: var(--color-navy); background: var(--color-blue-soft); border-color: var(--color-blue-soft); }
.flatpickr-day.today { border-color: var(--color-blue-ink); }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { color: var(--color-navy); background: var(--color-blue); border-color: var(--color-blue); font-weight: 700; }
.flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover { color: var(--color-navy); background: var(--color-blue-hover); border-color: var(--color-blue-hover); }
.flatpickr-prev-month, .flatpickr-next-month { border-radius: 8px; }
.flatpickr-prev-month:hover svg, .flatpickr-next-month:hover svg { fill: var(--color-navy); }
.form-label { font-size: 19px; font-weight: 600; margin-bottom: 8px; }
.form-text { color: var(--color-muted); }
.invalid-feedback { font-size: 18px; }
textarea.form-control { min-height: 96px; }
.remark-display-control { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.remark-display-control .form-check { display: inline-flex; align-items: center; gap: 9px; }
.remark-display-control .form-check-input { width: 2.55em; height: 1.4em; margin: 0; cursor: pointer; }
.remark-display-control .form-check-label { color: var(--color-navy); font-size: 18px; font-weight: 600; cursor: pointer; }
.remark-display-control .form-text { margin: 0; font-size: 17px; }
.document-visibility-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.document-visibility-option .form-check { display: flex; align-items: center; gap: 10px; min-height: 44px; height: 100%; margin: 0; padding-left: 0; }
.document-visibility-option .form-check-input { flex-shrink: 0; width: 2.55em; height: 1.4em; margin: 0; cursor: pointer; }
.document-visibility-option .form-check-label { color: var(--color-navy); font-size: 18px; font-weight: 600; cursor: pointer; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table th { color: var(--color-muted); font-size: 18px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-bottom-color: var(--color-border); white-space: nowrap; }
.table td { color: var(--color-text); vertical-align: middle; border-bottom-color: #edf1f5; font-size: 20px; line-height: 1.4; }
.table tbody tr { transition: background-color var(--motion-fast); }
.table tbody tr:hover { background: #f7fbfd; }
.table > :not(caption) > * > * { padding: 17px 14px; }
.numeric { text-align: right; font-family: var(--font-document); font-variant-numeric: tabular-nums; }
.empty-state { padding: 54px 20px; text-align: center; color: var(--color-muted); }
.empty-state i { display: block; color: #b7c6d3; font-size: 44px; margin-bottom: 10px; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi-card { position: relative; overflow: hidden; padding: 20px; min-height: 136px; isolation: isolate; }
.kpi-card::after { content: ""; position: absolute; z-index: -1; width: 82px; height: 58px; right: 0; top: 0; background: var(--color-blue-soft); clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%, 0 38%); }
.kpi-label { color: var(--color-muted); font-size: 19px; line-height: 1.25; font-weight: 600; }
.kpi-value { margin-top: 18px; font-family: var(--font-document); font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.kpi-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--color-blue-ink); background: transparent; border-radius: 8px; }

.auth-body { background: var(--color-navy); }
.auth-main { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth-main::before, .auth-main::after { content: ""; position: fixed; background: var(--color-blue); transform: skewX(-38deg); opacity: .85; }
.auth-main::before { width: 360px; height: 120px; top: -50px; right: -80px; }
.auth-main::after { width: 420px; height: 90px; bottom: -45px; left: -100px; }
.login-card { width: min(100%, 440px); padding: 36px; position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.login-brand h1 { font-size: 35px; font-weight: 800; margin: 0; }
.login-card .helper-account { background: #edf8fd; border: 1px solid #c9eefd; border-radius: 10px; padding: 12px; font-size: 18px; }

.filter-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(130px, .7fr)) auto; gap: 10px; align-items: end; }
.pagination { --bs-pagination-active-bg: var(--color-blue); --bs-pagination-active-border-color: var(--color-blue); }
.action-group { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; }
.customer-search-control { max-width: 460px; }
.customer-address-cell { max-width: 320px; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.user-search-control { max-width: 460px; }
.user-role { font-weight: 600; color: var(--color-blue-ink); }
.user-state { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 8px 12px; font-size: 17px; font-weight: 700; white-space: nowrap; }
.user-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.user-state.active { color: #116b49; background: #e5f6ee; }
.user-state.inactive { color: #6b7785; background: #edf1f4; }
.user-actions { flex-wrap: wrap; }
.signature-preview { max-width: 220px; max-height: 90px; object-fit: contain; }
.signature-upload-actions { display: flex; align-items: stretch; gap: 8px; width: 100%; }
.signature-upload-actions .form-control { flex: 1 1 0; width: 100%; min-width: 0; max-width: 100%; }
.signature-upload-actions .form-control[type="file"] { padding-block: .625rem; }
.logo-upload-actions { justify-content: flex-start; }
.signature-crop-reopen { flex: 0 0 auto; white-space: nowrap; }
.signature-crop-status { min-height: 1.45em; margin-top: 6px; color: var(--color-success); font-size: 17px; }
.signature-crop-status.is-error { color: var(--color-danger); }
.signature-crop-result { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; background: var(--color-blue-soft); border: 1px solid #b9e8f8; border-radius: var(--radius-sm); }
.signature-crop-result .signature-preview { flex: 0 0 auto; max-width: 150px; max-height: 56px; }
.signature-crop-result-label { color: var(--color-blue-ink); font-size: 17px; font-weight: 700; }
.signature-current-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 4px; }
.signature-current-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.signature-current-actions label { display: inline-flex; align-items: center; gap: 8px; color: var(--color-muted); font-size: 18px; }
.signature-current-actions input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--color-blue-ink); }
.signature-watermark-settings { padding-top: 20px; border-top: 1px solid var(--color-border); }
.signature-watermark-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.signature-watermark-toggle { flex: 0 0 auto; margin: 3px 0 0; white-space: nowrap; }
.signature-watermark-preview { flex: 0 0 auto; width: 92px; height: 92px; padding: 6px; object-fit: contain; opacity: .34; background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.signature-watermark-current-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 29px; }
.signature-watermark-current-wrap .signature-current-actions { align-items: flex-start; flex-direction: column; }
.signature-watermark-settings .signature-crop-result .signature-watermark-preview { width: 76px; height: 76px; }
.signature-crop-modal .modal-dialog { max-width: 820px; }
.signature-crop-modal .modal-content { border: 0; border-radius: var(--radius-md); box-shadow: 0 24px 60px rgba(6,36,61,.28); }
.signature-crop-modal .modal-header { align-items: flex-start; gap: 16px; padding: 24px 28px 16px; border-bottom-color: var(--color-border); }
.signature-crop-modal .modal-title { color: var(--color-navy); font-size: 27px; font-weight: 700; }
.signature-crop-modal .modal-kicker { margin: 4px 0 0; color: var(--color-muted); font-size: 18px; }
.signature-crop-modal .modal-body { padding: 22px 28px 18px; }
.signature-crop-stage { position: relative; min-height: 320px; overflow: hidden; border-radius: var(--radius-sm); background: #0b2d48; touch-action: none; outline: 0; }
.signature-crop-stage:focus-visible { box-shadow: 0 0 0 .25rem rgba(8,174,239,.3); }
.signature-crop-stage.is-dragging .crop-image { cursor: grabbing; }
.signature-crop-stage .crop-image { position: absolute; z-index: 1; max-width: none; user-select: none; cursor: grab; }
.signature-crop-frame { position: absolute; z-index: 2; border: 2px solid var(--color-blue); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(6,36,61,.68); pointer-events: none; }
.signature-crop-corner { position: absolute; width: 18px; height: 18px; border-color: var(--color-white); border-style: solid; }
.signature-crop-corner-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.signature-crop-corner-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.signature-crop-corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.signature-crop-corner-br { right: -2px; bottom: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }
.signature-crop-controls { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; gap: 16px; margin-top: 20px; }
.signature-crop-zoom-label { display: inline-flex; align-items: baseline; gap: 8px; color: var(--color-navy); font-size: 18px; font-weight: 700; white-space: nowrap; }
.signature-crop-zoom-label output { color: var(--color-blue-ink); font-variant-numeric: tabular-nums; }
.signature-crop-controls .form-range { margin: 0; accent-color: var(--color-blue-ink); }
.signature-crop-dimensions { min-height: 1.45em; margin: 12px 0 0; color: var(--color-muted); font-size: 17px; text-align: center; font-variant-numeric: tabular-nums; }
.signature-crop-modal .modal-footer { gap: 8px; padding: 16px 28px 24px; border-top-color: var(--color-border); }
.company-logo-preview { display: block; width: auto; max-width: 260px; max-height: 88px; object-fit: contain; object-position: left center; }
.logo-crop-result { align-items: center; }
.logo-crop-result .company-logo-preview { flex: 0 1 auto; max-width: 240px; max-height: 80px; }
.logo-current-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 4px; }

.editor-layout { display: grid; grid-template-columns: minmax(560px, 1.05fr) minmax(440px, .95fr); gap: 24px; align-items: start; }
.document-editor { min-width: 0; }
.form-section { display: flex; gap: 18px; margin-bottom: 18px; }
.section-marker { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; color: var(--color-blue-ink); background: var(--color-blue-soft); border-radius: 10px; font-size: 22px; }
.section-content { min-width: 0; flex: 1; }
.preview-panel { position: sticky; top: 108px; min-width: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 14px 16px; background: white; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.document-preview-shell { border-radius: 8px; background: #e1e7ed; min-height: 400px; }
.customer-search-wrap { position: relative; }
.customer-results { position: absolute; z-index: 1040; top: 100%; left: 0; right: 0; max-height: 280px; overflow-y: auto; border-radius: 0 0 10px 10px; box-shadow: 0 14px 30px rgba(6,36,61,.16); }
.customer-result { text-align: left; }
.customer-result strong, .customer-result small { display: block; }
.customer-result small { color: var(--color-muted); }
.items-container { display: grid; gap: 14px; }
.item-editor { padding: 16px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface-subtle); }
.item-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.item-editor-title { font-size: 20px; font-weight: 700; margin: 0; }
.item-actions { display: inline-flex; align-items: center; gap: 4px; }
.rich-editor-wrap { border: 1px solid var(--color-control-border); border-radius: var(--radius-sm); overflow: hidden; background: white; }
.rich-editor-toolbar { display: flex; gap: 4px; padding: 5px; border-bottom: 1px solid #e3e9ee; background: #f8fafb; }
.rich-editor-toolbar .btn { width: 52px; height: 52px; min-height: 52px; padding: 0; }
.description-editor { min-height: 130px; max-height: 360px; overflow-y: auto; padding: 11px 12px; outline: 0; white-space: pre-wrap; }
.description-editor:empty::before { content: attr(data-placeholder); color: var(--color-muted); pointer-events: none; }
.description-editor:focus { box-shadow: inset 0 0 0 2px rgba(8,174,239,.2); }
.description-editor.is-invalid { box-shadow: inset 0 0 0 1px var(--color-danger); }
.calculation-readout { border-top: 1px solid var(--color-border); font-family: var(--font-document); font-variant-numeric: tabular-nums; }
.calculation-readout > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 0; font-variant-numeric: tabular-nums; }
.calculation-readout .total { margin-top: 4px; padding: 15px 17px; color: var(--color-navy); background: var(--color-blue); border-radius: 9px; font-size: 22px; }
.calculation-readout .total strong { font-size: 26px; }
.item-line-total { font-family: var(--font-document); font-variant-numeric: tabular-nums; }
.preview-expanded { overflow: hidden; }
.preview-expanded .preview-panel { position: fixed; z-index: 1100; inset: 0; padding: 16px; background: rgba(6,36,61,.94); overflow: auto; }
.preview-expanded .preview-toolbar { position: sticky; top: 0; z-index: 3; max-width: 210mm; margin-inline: auto; }
.preview-expanded .document-preview-shell { max-width: 210mm; margin-inline: auto; }
.preview-expanded #expandPreview i::before { content: "\f3de"; }
.document-view-stage { max-width: 210mm; margin: 0 auto; }

.swal2-popup, .swal2-title, .swal2-html-container, .swal2-confirm, .swal2-cancel { font-family: var(--font-ui) !important; }

.pagination { --bs-pagination-color: var(--color-blue-ink); --bs-pagination-hover-color: var(--color-navy); }
.pagination .page-link { min-width: 44px; min-height: 44px; display: grid; place-items: center; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    .sidebar-link, .btn, .form-control, .form-select, .table tbody tr, .fade, .offcanvas, .modal { transition: none !important; }
    .spinner-border { animation: none !important; }
}

@media (min-width: 992px) {
    .app-sidebar { position: fixed !important; inset: 0 auto 0 0; height: 100dvh; visibility: visible !important; transform: none !important; }
}
