:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --navy: #07101f;
  --navy-2: #0d1a2f;
  --text: #172033;
  --muted: #69758a;
  --line: #e5eaf1;
  --blue: #286df2;
  --blue-dark: #1857ce;
  --blue-soft: #eaf1ff;
  --cyan: #0ea5c6;
  --violet: #8158e8;
  --orange: #ea8b26;
  --green: #18a773;
  --danger: #d84747;
  --radius: 16px;
  --shadow: 0 9px 34px rgba(20, 39, 74, .07);
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(40, 109, 242, .28); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 1000; background: white; color: var(--navy); padding: 12px 18px; border-radius: 8px; text-decoration: none; box-shadow: var(--shadow); }
.skip-link:focus { top: 16px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: var(--sidebar); background: linear-gradient(175deg, #081221 0%, #060c16 100%); color: #b8c2d3; padding: 26px 18px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 36px; color: white; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(140deg, #3488ff, #1859db); box-shadow: 0 9px 24px rgba(30, 102, 240, .3); transform: rotate(-5deg); }
.brand-mark span { font-weight: 900; font-size: 20px; transform: rotate(5deg); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; letter-spacing: .12em; }
.brand-copy strong { font-size: 17px; }
.brand-copy small { color: #718097; font-size: 9px; letter-spacing: .26em; margin-top: 5px; }
.main-nav { display: flex; flex-direction: column; gap: 7px; }
.main-nav a { min-height: 48px; display: flex; align-items: center; gap: 13px; color: #94a2b7; text-decoration: none; padding: 0 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; transition: .2s ease; }
.main-nav a:hover { color: white; background: rgba(255,255,255,.045); }
.main-nav a.active { color: white; background: linear-gradient(90deg, rgba(42, 111, 246, .25), rgba(42, 111, 246, .1)); box-shadow: inset 3px 0 var(--blue); }
.main-nav svg { width: 19px; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; display: grid; place-items: center; background: rgba(255,255,255,.08); border-radius: 11px; font-size: 11px; }
.main-nav a.active .nav-count { background: var(--blue); }
.sidebar-footer { margin-top: auto; }
.storage-note { display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.025); padding: 12px; margin-bottom: 16px; border-radius: 11px; }
.storage-note div, .user-card div { display: flex; flex-direction: column; }
.storage-note strong, .user-card strong { color: #d6deeb; font-size: 11px; }
.storage-note small, .user-card small { font-size: 9.5px; color: #748198; margin-top: 3px; }
.status-dot { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: #23cf8d; box-shadow: 0 0 0 4px rgba(35, 207, 141, .12); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 11px 7px 0; border-top: 1px solid rgba(255,255,255,.07); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; background: #14223a; color: #6da0ff; font-size: 10px; font-weight: 800; border-radius: 50%; }

.content-shell { padding-left: var(--sidebar); min-height: 100vh; }
.topbar { height: 72px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 3.2%; position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); }
.topbar-date { display: flex; flex-direction: column; }
.topbar-date > span { font-size: 13px; font-weight: 700; }
.topbar-date small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.local-pill { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.local-pill span { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.menu-button { display: none; }
.icon-button { width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); background: white; border-radius: 9px; }

main { padding: 34px 3.2% 60px; max-width: 1600px; margin: 0 auto; }
.view { display: none; animation: fade-in .3s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin: 3px 0 6px; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.035em; color: #101a2c; }
.page-heading h1 span { font-size: .75em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { color: var(--blue) !important; font-size: 9px !important; font-weight: 800; letter-spacing: .2em; }
.primary-button, .secondary-button { min-height: 43px; padding: 0 18px; border-radius: 9px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-size: 12px; font-weight: 750; transition: .2s ease; white-space: nowrap; }
.primary-button { background: var(--blue); color: white; box-shadow: 0 8px 20px rgba(40, 109, 242, .2); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button.compact { min-height: 38px; padding-inline: 15px; }
.primary-button svg { width: 17px; }
.secondary-button { border: 1px solid #dce3ec; background: white; color: var(--text); }
.secondary-button:hover { background: #f8fafc; border-color: #c9d3e1; }
.heading-actions { display: flex; gap: 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 14px; min-height: 132px; display: flex; align-items: center; gap: 15px; padding: 20px; box-shadow: 0 5px 18px rgba(20, 39, 74, .035); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -16px; top: -20px; width: 80px; height: 80px; border-radius: 50%; opacity: .055; background: currentColor; }
.stat-icon { flex: 0 0 43px; height: 43px; display: grid; place-items: center; border-radius: 11px; }
.stat-card.blue { color: var(--blue); } .stat-card.blue .stat-icon { background: var(--blue-soft); }
.stat-card.cyan { color: var(--cyan); } .stat-card.cyan .stat-icon { background: #e4f8fb; }
.stat-card.violet { color: var(--violet); } .stat-card.violet .stat-icon { background: #f1ecff; }
.stat-card.orange { color: var(--orange); } .stat-card.orange .stat-icon { background: #fff3e6; }
.stat-card div:last-child { min-width: 0; display: flex; flex-direction: column; }
.stat-card p { color: var(--muted); font-size: 11px; margin: 0 0 6px; }
.stat-card strong { color: var(--text); font-size: 23px; letter-spacing: -.03em; }
.stat-card small { color: #8b96a7; font-size: 9.5px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 20px; }
.recent-panel, .quick-panel { min-height: 320px; padding: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 15px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.text-button { border: 0; background: none; color: var(--blue); font-size: 10px; font-weight: 700; padding: 6px; }
.text-button span { margin-left: 5px; }
.quote-list { display: flex; flex-direction: column; }
.quote-row { display: grid; grid-template-columns: minmax(130px, 1.4fr) minmax(130px, 1.2fr) .8fr .7fr auto; align-items: center; gap: 15px; border-top: 1px solid #edf0f5; min-height: 65px; font-size: 11px; }
.quote-row .quote-primary { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doc-icon { flex: 0 0 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-soft); color: var(--blue); }
.doc-icon svg { width: 15px; }
.quote-primary div { display: flex; min-width: 0; flex-direction: column; }
.quote-primary strong, .client-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-primary small, .quote-date { color: var(--muted); font-size: 9.5px; margin-top: 2px; }
.quote-amount { font-weight: 800; text-align: right; }
.status { justify-self: start; display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 0; border-radius: 20px; font-size: 8.5px; font-weight: 750; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.draft { background: #eff2f6; color: #718096; }
.status.sent { background: #e8f2ff; color: #2872df; }
.status.accepted { background: #e6f8f0; color: #159466; }
.row-actions { display: flex; gap: 3px; justify-content: flex-end; }
.row-actions button { border: 0; background: transparent; color: #8a96a8; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
.row-actions button:hover { background: #f2f5f9; color: var(--blue); }
.row-actions .delete:hover { color: var(--danger); background: #fff0f0; }
.row-actions svg { width: 14px; }
.empty-state { min-height: 210px; display: grid; place-items: center; text-align: center; padding: 25px; }
.empty-state div { max-width: 300px; }
.empty-icon { margin: auto auto 12px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.empty-state h3 { margin: 0 0 6px; font-size: 14px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.quick-action { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; text-align: left; border: 1px solid transparent; background: transparent; padding: 10px 8px; border-radius: 10px; }
.quick-action:hover { border-color: var(--line); background: #fafcff; }
.quick-action + .quick-action { margin-top: 4px; }
.quick-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.quick-icon.blue { color: var(--blue); background: var(--blue-soft); } .quick-icon.violet { color: var(--violet); background: #f2edff; } .quick-icon.cyan { color: var(--cyan); background: #e8f9fb; }
.quick-icon svg { width: 17px; }
.quick-action > span:nth-child(2) { display: flex; flex-direction: column; }
.quick-action strong { font-size: 11.5px; color: var(--text); }
.quick-action small { font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.quick-action b { color: #9aa5b5; font-weight: 500; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 16px; }
.form-panel { padding: 24px; }
.section-title { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.section-title > span { display: grid; place-items: center; width: 31px; height: 31px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-weight: 800; border-radius: 8px; }
.section-title h2 { margin: 0; font-size: 14px; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 9.5px; }
.field-grid { display: grid; gap: 16px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.two { grid-template-columns: repeat(2, 1fr); }
label { display: flex; flex-direction: column; gap: 7px; color: #394459; font-size: 10.5px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #dfe5ed; border-radius: 8px; background: white; color: var(--text); padding: 10px 12px; font-size: 12px; transition: .2s ease; }
input { height: 41px; }
input:hover, textarea:hover, select:hover { border-color: #cbd4e1; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: 3px solid rgba(40, 109, 242, .11); }
input::placeholder, textarea::placeholder { color: #a4adba; }
textarea { resize: vertical; line-height: 1.55; }
.full-field { margin-top: 16px; }
.items-head, .line-item { display: grid; grid-template-columns: minmax(180px, 1fr) 58px 90px 76px 92px 31px; gap: 9px; align-items: center; }
.items-head { color: #8a95a7; font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; padding: 0 4px 7px; }
.line-item { padding: 10px 0; border-top: 1px solid #edf0f5; }
.line-item input, .line-item select { height: 38px; padding: 8px 9px; }
.line-total { text-align: right; font-size: 11px; font-weight: 750; }
.remove-line { width: 29px; height: 29px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #a0a9b7; font-size: 18px; }
.remove-line:hover { color: var(--danger); background: #fff0f0; }
.add-line-button { margin-top: 10px; min-height: 39px; border: 1px dashed #bfcbe0; width: 100%; border-radius: 8px; background: #fbfcff; color: var(--blue); font-size: 10.5px; font-weight: 750; }
.add-line-button:hover { background: var(--blue-soft); border-color: var(--blue); }
.add-line-button span { font-size: 16px; vertical-align: -1px; margin-right: 5px; }
.form-sidebar { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 14px; }
.total-card { padding: 22px; background: linear-gradient(155deg, #0c182b, #07101e); color: white; border: 0; }
.total-card h2 { margin: 0 0 22px; font-size: 14px; }
.total-card > div { display: flex; justify-content: space-between; font-size: 10.5px; color: #aab5c7; margin: 12px 0; }
.total-card > div strong { color: white; font-size: 11px; }
.total-card hr { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 19px 0; }
.total-card .grand-total { align-items: flex-end; margin-bottom: 16px; }
.total-card .grand-total span { font-weight: 700; color: white; }
.total-card .grand-total strong { font-size: 23px; color: #65a0ff; letter-spacing: -.03em; }
.total-card p { color: #76859c; line-height: 1.45; font-size: 8.5px; margin: 0; }
.tip-card { display: flex; gap: 11px; border: 1px solid #dce7fb; background: #f2f7ff; padding: 15px; border-radius: 12px; color: #526683; }
.tip-card > span { flex: 0 0 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: white; font-size: 10px; font-weight: 800; }
.tip-card p { font-size: 9px; margin: 0; line-height: 1.55; }
.tip-card strong { display: block; color: #2c405f; margin-bottom: 2px; }

.library-panel { overflow: hidden; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; max-width: 390px; width: 100%; }
.search-box svg { position: absolute; left: 12px; top: 10px; width: 17px; color: #8994a5; }
.search-box input { padding-left: 39px; }
.toolbar select { width: 155px; }
.quote-table-wrap { min-height: 260px; padding: 0 20px; }
.quote-table-head, .quote-table-row { display: grid; grid-template-columns: 1fr 1fr .7fr .6fr .6fr 100px; gap: 14px; align-items: center; }
.quote-table-head { min-height: 42px; color: #8a95a7; text-transform: uppercase; font-size: 8px; letter-spacing: .08em; font-weight: 800; border-bottom: 1px solid var(--line); }
.quote-table-row { min-height: 70px; border-bottom: 1px solid #edf0f5; font-size: 11px; }
.quote-table-row:last-child { border: 0; }
.quote-table-row .quote-amount { text-align: left; }
.quote-number { color: var(--blue); font-weight: 750; }
.client-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.client-card { padding: 20px; min-height: 172px; }
.client-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.client-card .client-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
.client-card h3 { margin: 0 0 10px; font-size: 14px; }
.client-card p { margin: 6px 0; color: var(--muted); font-size: 10.5px; display: flex; align-items: center; gap: 7px; }
.client-card p svg { width: 13px; color: #8b97a8; }
.client-card .row-actions { margin-left: auto; }
.client-empty { grid-column: 1 / -1; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(2, 8, 18, .62); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(520px, 100%); background: white; border-radius: 18px; padding: 30px; box-shadow: 0 24px 80px rgba(0,0,0,.25); animation: modal-in .25s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal h2 { margin: 6px 0; font-size: 22px; }
.modal-intro { color: var(--muted); margin: 0 0 22px; font-size: 11px; }
.modal-close { position: absolute; right: 16px; top: 14px; border: 0; background: transparent; color: #8792a3; font-size: 24px; }
.modal form { display: flex; flex-direction: column; gap: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.preview-backdrop { overflow: auto; display: block; padding: 22px; }
.preview-modal { width: min(940px, 100%); margin: 0 auto; }
.preview-toolbar { position: sticky; top: 0; z-index: 2; background: white; min-height: 65px; padding: 10px 14px 10px 20px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; box-shadow: var(--shadow); margin-bottom: 18px; }
.preview-toolbar > div { display: flex; flex-direction: column; }
.preview-toolbar > div:last-child { flex-direction: row; gap: 8px; }
.preview-toolbar strong { font-size: 13px; }
.preview-toolbar small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.paper { width: min(794px, 100%); min-height: 1123px; margin: 0 auto 30px; background: white; padding: 64px; box-shadow: 0 10px 40px rgba(0,0,0,.22); color: #172033; }
.document-header { display: flex; justify-content: space-between; border-bottom: 2px solid #172033; padding-bottom: 28px; margin-bottom: 34px; }
.document-brand { display: flex; align-items: center; gap: 12px; }
.document-brand .brand-mark { color: white; }
.document-brand div { display: flex; flex-direction: column; }
.document-brand strong { letter-spacing: .13em; }
.document-brand small { font-size: 8px; color: #788398; letter-spacing: .18em; margin-top: 3px; }
.document-type { text-align: right; }
.document-type h2 { font-size: 30px; margin: 0; letter-spacing: .08em; }
.document-type p { margin: 4px 0 0; color: var(--blue); font-size: 12px; font-weight: 750; }
.document-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-bottom: 38px; }
.document-meta h3 { color: #8a95a6; font-size: 8px; text-transform: uppercase; letter-spacing: .15em; margin: 0 0 12px; }
.document-meta strong { font-size: 13px; display: block; margin-bottom: 5px; }
.document-meta p { font-size: 10px; color: #5f6c80; margin: 3px 0; line-height: 1.5; }
.document-meta .dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.document-meta .dates strong { font-size: 10px; }
.document-subject { background: #f3f6fa; border-left: 3px solid var(--blue); padding: 13px 15px; font-size: 10px; margin-bottom: 25px; }
.document-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.document-table th { background: #0c182b; color: white; text-align: left; padding: 11px 9px; font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.document-table td { border-bottom: 1px solid #e7ebf1; padding: 13px 9px; }
.document-table th:not(:first-child), .document-table td:not(:first-child) { text-align: right; }
.document-bottom { display: grid; grid-template-columns: 1fr 230px; gap: 35px; margin-top: 28px; }
.document-notes h3 { font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.document-notes p { white-space: pre-wrap; color: #667287; font-size: 9px; line-height: 1.6; }
.document-totals > div { display: flex; justify-content: space-between; padding: 7px 0; font-size: 10px; }
.document-totals .document-grand { border-top: 2px solid #172033; margin-top: 6px; padding-top: 12px; font-size: 14px; font-weight: 800; color: var(--blue); }
.document-footer { margin-top: 70px; padding-top: 15px; border-top: 1px solid #e7ebf1; text-align: center; color: #8a95a6; font-size: 8px; line-height: 1.6; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; background: #0c182b; color: white; padding: 13px 18px; border-radius: 10px; font-size: 11px; box-shadow: 0 12px 32px rgba(7,16,31,.24); transform: translateY(80px); opacity: 0; transition: .25s ease; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .client-grid { grid-template-columns: repeat(2, 1fr); }
  .quote-table-head, .quote-table-row { grid-template-columns: 1fr 1fr .7fr .6fr 95px; }
  .quote-table-head > :nth-child(4), .quote-table-row > :nth-child(4) { display: none; }
}

@media (max-width: 850px) {
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-100%); width: 244px; transition: transform .25s ease; box-shadow: 10px 0 40px rgba(0,0,0,.25); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(3,8,16,.52); }
  .menu-button { display: grid; }
  .topbar-date { display: none; }
  .content-shell { padding-left: 0; }
  .dashboard-grid, .form-layout { grid-template-columns: 1fr; }
  .form-sidebar { position: static; }
  .total-card { max-width: none; }
}

@media (max-width: 650px) {
  .topbar { height: 64px; padding: 0 16px; }
  .local-pill { display: none; }
  .primary-button.compact { font-size: 0; width: 40px; padding: 0; }
  .primary-button.compact svg { margin: 0; }
  main { padding: 25px 16px 45px; }
  .page-heading, .form-heading { align-items: flex-start; flex-direction: column; }
  .page-heading > .primary-button { width: 100%; }
  .heading-actions { width: 100%; }
  .heading-actions button { flex: 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 118px; padding: 15px; align-items: flex-start; flex-direction: column; gap: 10px; }
  .stat-icon { width: 34px; flex-basis: 34px; }
  .stat-card strong { font-size: 19px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .recent-panel, .quick-panel, .form-panel { padding: 18px; }
  .quote-row { grid-template-columns: 1fr auto auto; min-height: 70px; }
  .quote-row .client-name, .quote-row .quote-date { display: none; }
  .field-grid.three, .field-grid.two { grid-template-columns: 1fr; }
  .items-head { display: none; }
  .line-item { position: relative; grid-template-columns: 1fr 70px; gap: 8px; padding: 14px 38px 14px 0; }
  .line-item .item-description { grid-column: 1 / -1; }
  .line-item .line-total { text-align: left; }
  .line-item .remove-line { position: absolute; top: 17px; right: 0; }
  .toolbar { flex-direction: column; }
  .toolbar select { width: 100%; }
  .quote-table-head { display: none; }
  .quote-table-row { position: relative; grid-template-columns: 1fr auto; gap: 6px; padding: 14px 0; }
  .quote-table-row > * { display: block !important; }
  .quote-table-row .quote-date { grid-column: 1; }
  .quote-table-row .status { justify-self: start; width: fit-content; }
  .quote-table-row .quote-amount { position: absolute; right: 4px; top: 16px; }
  .quote-table-row .row-actions { position: absolute; right: 0; bottom: 12px; }
  .client-grid { grid-template-columns: 1fr; }
  .modal { padding: 24px 20px; }
  .preview-backdrop { padding: 0; }
  .preview-toolbar { border-radius: 0; margin: 0; flex-direction: column; align-items: stretch; padding: 12px; }
  .preview-toolbar > div:first-child { display: none; }
  .preview-toolbar > div:last-child button { flex: 1; }
  .paper { min-height: auto; padding: 30px 22px; box-shadow: none; }
  .document-header { align-items: flex-start; }
  .document-type h2 { font-size: 22px; }
  .document-meta { gap: 20px; }
  .document-bottom { grid-template-columns: 1fr; }
}

@media print {
  body { background: white; }
  body > *:not(.preview-backdrop), .preview-toolbar { display: none !important; }
  .preview-backdrop { display: block !important; position: static; padding: 0; background: white; }
  .preview-modal, .paper { width: 100%; margin: 0; box-shadow: none; }
  .paper { padding: 12mm 15mm; min-height: 0; }
  @page { size: A4; margin: 0; }
}

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