:root {
  color-scheme: light;
  --brand: #0a5c46;
  --brand-dark: #063b2e;
  --brand-soft: #e8f4ef;
  --gold: #e5b93f;
  --ink: #17211e;
  --muted: #6d7b76;
  --line: #dce6e1;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 20px 55px rgba(10, 58, 45, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(229, 185, 63, .45); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 6px; color: #809089; font-size: .66rem; font-weight: 900; letter-spacing: .14em; }
.button { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 11px; font-size: .76rem; font-weight: 850; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 9px 22px rgba(10, 92, 70, .18); }
.button-primary:hover { background: #084d3b; }
.button-outline { color: var(--brand); border-color: #c8d9d2; background: #fff; }
.button-light { color: var(--brand-dark); background: #fff; box-shadow: 0 10px 24px rgba(4, 48, 36, .13); }
.button-block { width: 100%; }
.text-button, .back-button, .language-button, .dialog-close, .mobile-menu { border: 0; color: var(--brand); background: transparent; font-weight: 850; }
.language-button { min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .7rem; }

.brand-lockup { display: inline-flex; align-items: center; gap: 11px; color: var(--brand-dark); }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #0b7759, #073f31); box-shadow: 0 9px 22px rgba(7, 63, 49, .22); font-weight: 950; letter-spacing: -.04em; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: .86rem; letter-spacing: .12em; }
.brand-lockup small { margin-top: 2px; color: #a77e0a; font-size: .53rem; font-weight: 900; letter-spacing: .2em; }

.login-page { min-height: 100vh; padding: 32px 18px; display: grid; place-items: center; background:
  radial-gradient(circle at 15% 20%, rgba(229,185,63,.15), transparent 27%),
  radial-gradient(circle at 88% 78%, rgba(28,133,98,.13), transparent 31%),
  linear-gradient(145deg, #eef6f2, #f9fbfa); }
.login-card { width: min(100%, 430px); padding: 34px; border: 1px solid rgba(202,220,212,.9); border-radius: 25px; background: rgba(255,255,255,.94); box-shadow: 0 32px 90px rgba(5,54,40,.13); backdrop-filter: blur(14px); }
.login-copy { margin: 34px 0 24px; }
.login-copy h1 { margin: 0; color: var(--brand-dark); font-size: clamp(1.7rem, 5vw, 2.4rem); }
.login-copy > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.login-form { display: grid; gap: 14px; }
.login-form label, .contract-form label { display: grid; gap: 7px; color: #41514b; font-size: .7rem; font-weight: 800; }
.login-form input, .contract-form input, .contract-form select, .contract-form textarea, .editor-actions select, .filter-group select {
  width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #cedbd5; border-radius: 10px; color: var(--ink); background: #fff; font-size: .77rem; font-weight: 600; transition: border-color .15s ease, box-shadow .15s ease;
}
.contract-form textarea { resize: vertical; line-height: 1.55; }
.login-form input:focus, .contract-form input:focus, .contract-form select:focus, .contract-form textarea:focus { border-color: #73a995; box-shadow: 0 0 0 4px rgba(10,92,70,.07); outline: 0; }
.form-error { min-height: 18px; margin: -2px 0 0; color: var(--danger); font-size: .7rem; font-weight: 750; }
.login-card > .language-button { margin-top: 19px; }
.brand-wordmark { min-width: 0; display: grid; justify-items: start; gap: 5px; }
.brand-wordmark span { max-width: 100%; display: flex; align-items: baseline; gap: clamp(4px,1.5vw,8px); line-height: 1; letter-spacing: .055em; white-space: nowrap; }
.brand-wordmark strong { color: var(--brand); font-weight: 950; }
.brand-wordmark b { color: var(--gold); font-weight: 900; }
.brand-wordmark a { color: #62736c; font-size: .62rem; font-weight: 750; text-decoration: none; letter-spacing: .04em; }
.brand-wordmark a:hover { color: var(--brand); text-decoration: underline; }
.brand-wordmark-login { max-width: 100%; padding: 21px 22px; overflow: hidden; border: 1px solid #d8e8e1; border-radius: 18px; background: linear-gradient(135deg,#f4faf7,#fff9e7); }
.brand-wordmark-login span { font-size: clamp(1rem,5vw,1.55rem); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 23px 16px 17px; display: flex; flex-direction: column; border-right: 1px solid #d9e5df; background: #fff; z-index: 20; }
.sidebar-brand { padding: 0 8px; }
.brand-wordmark-sidebar { padding: 13px 9px; border-bottom: 1px solid #e5eee9; }
.brand-wordmark-sidebar span { gap: 5px; font-size: .88rem; }
.brand-wordmark-sidebar a { font-size: .52rem; }
.sidebar nav { margin-top: 38px; display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 46px; padding: 0 13px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 11px; color: #53615c; background: transparent; text-align: left; font-size: .75rem; font-weight: 800; }
.nav-item:hover { color: var(--brand); background: #f2f8f5; }
.nav-item.is-active { color: var(--brand-dark); background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: rgba(10,92,70,.07); font-size: 1rem; }
.sidebar-foot { margin-top: auto; display: grid; gap: 13px; }
.privacy-note { padding: 12px; display: flex; align-items: center; gap: 9px; border: 1px solid #dbe8e2; border-radius: 12px; background: #f6faf8; }
.privacy-note > span { color: #39a674; font-size: .68rem; }
.privacy-note p { margin: 0; min-width: 0; }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: .65rem; }
.privacy-note small { margin-top: 2px; color: #83908b; font-size: .57rem; }
.nav-item-muted { border-top: 1px solid #edf1ef; border-radius: 0; }

.app-main { min-width: 0; }
.topbar { min-height: 82px; padding: 15px clamp(18px,3vw,38px); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid #dce6e1; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; color: var(--brand-dark); font-size: 1.28rem; }
.topbar-actions, .editor-actions, .editor-bottom-actions > div, .preview-toolbar > div:last-child { display: flex; align-items: center; gap: 9px; }
.mobile-menu { display: none; font-size: 1.25rem; }
.view { padding: clamp(20px,3vw,38px); }
.view > * + * { margin-top: 22px; }

.welcome-panel { min-height: 172px; padding: clamp(24px,4vw,42px); display: flex; align-items: center; justify-content: space-between; gap: 24px; overflow: hidden; border-radius: 24px; color: #fff; background:
  radial-gradient(circle at 80% 15%, rgba(229,185,63,.33), transparent 28%),
  linear-gradient(130deg, #063c2f, #0b7255); box-shadow: 0 24px 60px rgba(6,60,47,.16); }
.welcome-panel h2 { margin: 0; font-size: clamp(1.45rem,3.3vw,2.45rem); }
.welcome-panel p:last-child { max-width: 670px; margin: 10px 0 0; color: rgba(255,255,255,.75); font-size: .8rem; line-height: 1.65; }
.welcome-panel .eyebrow { color: #f1cf69; }
.stat-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 13px; }
.stat-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 11px 32px rgba(7,63,49,.045); }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span { color: #6a7973; font-size: .65rem; font-weight: 850; }
.stat-card strong { margin: 8px 0 5px; color: var(--brand-dark); font-size: 1.7rem; }
.stat-card small { overflow: hidden; color: #9aa49f; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.stat-total { color: #fff; border-color: transparent; background: linear-gradient(145deg,#0c674f,#084735); }
.stat-total span, .stat-total small { color: rgba(255,255,255,.67); }
.stat-total strong { color: #fff; }

.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 15px 42px rgba(7,63,49,.05); }
.panel-head { min-height: 78px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 17px; border-bottom: 1px solid #e5ece8; }
.panel-head h2 { margin: 0; color: var(--brand-dark); font-size: 1.05rem; }
.contract-table-wrap { overflow-x: auto; }
.contract-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.contract-table th { padding: 12px 17px; color: #83908a; background: #f8faf9; font-size: .59rem; font-weight: 900; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.contract-table td { padding: 14px 17px; border-top: 1px solid #edf2ef; color: #4d5b56; font-size: .7rem; vertical-align: middle; }
.contract-table tbody tr { transition: background .15s ease; }
.contract-table tbody tr:hover { background: #f7fbf9; }
.contract-link { border: 0; color: var(--brand); background: transparent; font-weight: 900; text-align: left; }
.cell-stack strong, .cell-stack span { display: block; }
.cell-stack strong { color: #31453e; }
.cell-stack span { margin-top: 3px; color: #8a9691; font-size: .61rem; }
.status-pill { display: inline-flex; min-height: 26px; padding: 0 9px; align-items: center; border-radius: 999px; color: #795d08; background: #fff4bd; font-size: .59rem; font-weight: 900; }
.status-pill.signed { color: #0c684e; background: #e3f5ed; }
.status-pill.in_transit { color: #175a8f; background: #e6f2fb; }
.status-pill.completed { color: #fff; background: #1f8d63; }
.status-pill.cancelled { color: #8f3c33; background: #fbe9e7; }
.row-menu { min-width: 32px; min-height: 32px; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: #fff; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.empty-state { min-height: 270px; padding: 35px; display: grid; place-items: center; align-content: center; color: #87938e; text-align: center; }
.empty-state > span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; color: var(--brand); background: var(--brand-soft); font-size: 1.25rem; }
.empty-state h3 { margin: 13px 0 5px; color: #42524c; font-size: .92rem; }
.empty-state p { margin: 0; font-size: .68rem; }
.contracts-toolbar { align-items: flex-end; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.search-field { min-width: min(35vw,330px); min-height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 7px; border: 1px solid #cedbd5; border-radius: 10px; background: #fff; }
.search-field input { width: 100%; border: 0; outline: 0; font-size: .71rem; }
.filter-group select { min-width: 130px; }

.editor-view { max-width: 1480px; margin: 0 auto; }
.editor-top { margin: 0 0 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.editor-top h2 { margin: 0; color: var(--brand-dark); font-size: clamp(1.3rem,3vw,2rem); }
.editor-top .back-button { margin: 0 0 18px; padding: 0; font-size: .69rem; }
.contract-number { margin: 6px 0 0; color: #81908a; font-size: .67rem; }
.editor-actions select { width: auto; min-width: 125px; }
.contract-form { display: grid; gap: 15px; }
.form-section { display: grid; grid-template-columns: 64px minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 12px 38px rgba(7,63,49,.045); }
.section-number { padding-top: 24px; color: rgba(10,92,70,.32); background: linear-gradient(180deg,#f2f8f5,#fff); font-size: 1rem; font-weight: 950; text-align: center; }
.section-body { min-width: 0; padding: 23px; border-left: 1px solid #e7eeea; }
.section-title { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-title h3 { margin: 0; color: var(--brand-dark); font-size: 1rem; }
.section-title p { margin: 5px 0 0; color: #82908a; font-size: .65rem; }
.party-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.contract-form fieldset { min-width: 0; margin: 0; padding: 17px; border: 1px solid #dde8e3; border-radius: 15px; background: #fafcfb; }
.contract-form legend { padding: 0 8px; color: var(--brand-dark); font-size: .75rem; font-weight: 900; }
.contract-form legend small { margin-left: 7px; color: #9aa49f; font-size: .52rem; letter-spacing: .1em; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.grid-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.calculated-output { min-height: 43px; padding: 10px 12px; display: flex; align-items: center; border: 1px solid #d8e5df; border-radius: 10px; color: var(--brand); background: #f4faf7; font-size: .82rem; font-weight: 900; }
.pricing-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 18px; align-items: stretch; }
.payment-badge { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: #705507; background: #fff1a8; font-size: .61rem; font-weight: 900; }
.total-card { padding: 22px; display: flex; flex-direction: column; border-radius: 16px; color: #fff; background: linear-gradient(145deg,#063d2f,#0c7054); box-shadow: 0 16px 36px rgba(7,63,49,.14); }
.total-card > span { color: rgba(255,255,255,.68); font-size: .65rem; font-weight: 850; }
.total-card > strong { margin: 12px 0 6px; display: flex; align-items: baseline; gap: 7px; font-size: 2rem; }
.total-card > strong small { color: #f1cf69; font-size: .68rem; }
.total-card > p { margin: 0; color: rgba(255,255,255,.62); font-size: .58rem; }
.payment-rule { margin-top: auto; padding-top: 22px; display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 8px; }
.payment-rule > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--brand-dark); background: #f2cf67; font-size: .7rem; font-weight: 950; }
.payment-rule p { margin: 0; color: rgba(255,255,255,.82); font-size: .62rem; line-height: 1.55; }
.cargo-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 18px; align-items: stretch; }
.simple-total-card { min-height: 155px; padding: 22px; display: flex; flex-direction: column; border-radius: 16px; color: #fff; background: linear-gradient(145deg,#063d2f,#0c7054); box-shadow: 0 16px 36px rgba(7,63,49,.14); }
.simple-total-card > span { color: rgba(255,255,255,.72); font-size: .68rem; font-weight: 850; }
.simple-total-card > strong { margin: 12px 0 4px; font-size: 1.8rem; }
.simple-total-card > strong small { color: #f1cf69; font-size: .7rem; }
.simple-total-card > p { margin: 0; color: rgba(255,255,255,.68); font-size: .65rem; }
.image-upload { margin-top: 18px; padding: 15px; display: grid; grid-template-columns: 122px minmax(0,1fr); gap: 16px; align-items: center; border: 1px solid #dbe7e1; border-radius: 15px; background: #f8fbfa; }
.image-preview { width: 122px; height: 100px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #aac8bc; border-radius: 12px; color: var(--brand); background: #fff; font-size: 1.35rem; }
.image-preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
.image-upload strong { color: var(--brand-dark); font-size: .75rem; }
.image-upload p { margin: 5px 0 10px; color: var(--muted); font-size: .63rem; line-height: 1.5; }
.file-button { width: max-content; }
.file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.remove-image { margin-left: 8px; font-size: .65rem; }
.fairness-note { margin-top: 18px; padding: 15px; border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; background: #fffbec; }
.fairness-note strong { color: #705507; font-size: .72rem; }
.fairness-note p { margin: 5px 0 0; color: #73683e; font-size: .64rem; line-height: 1.6; }
.checkbox-card { min-height: 76px; padding: 13px; grid-template-columns: auto minmax(0,1fr); align-items: flex-start; border: 1px solid #d9e6e0; border-radius: 12px; background: #f7fbf9; }
.checkbox-card input { width: 17px; min-height: 17px; margin: 3px 0 0; accent-color: var(--brand); }
.checkbox-card strong, .checkbox-card small { display: block; }
.checkbox-card small { margin-top: 5px; color: #82908a; font-size: .59rem; line-height: 1.35; }
.single-shipment-notice { margin-top: 18px; padding: 15px; border-left: 4px solid var(--gold); border-radius: 0 12px 12px 0; background: #fffbec; }
.single-shipment-notice strong { color: #6c5105; font-size: .72rem; }
.single-shipment-notice p { margin: 5px 0 0; color: #817143; font-size: .64rem; line-height: 1.55; }
.editor-bottom-actions { margin-top: 20px; padding: 17px 0 4px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.preview-dialog { width: min(96vw,1100px); max-height: 94vh; padding: 0; overflow: hidden; border: 0; border-radius: 18px; background: #eef2ef; box-shadow: 0 35px 120px rgba(0,0,0,.3); }
.preview-dialog::backdrop { background: rgba(4,24,18,.72); backdrop-filter: blur(8px); }
.preview-toolbar { min-height: 68px; padding: 12px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #d8e3de; background: #fff; }
.preview-toolbar > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
.preview-toolbar strong { color: var(--brand-dark); font-size: .86rem; }
.dialog-close { width: 40px; height: 40px; border-radius: 10px; background: #f1f5f3; font-size: 1.25rem; }
.contract-document { max-height: calc(94vh - 68px); padding: 28px; overflow: auto; }
.document-page { width: 210mm; min-height: 297mm; margin: 0 auto 24px; padding: 16mm 17mm; color: #111; background: #fff; box-shadow: 0 10px 35px rgba(0,0,0,.09); font-family: "Times New Roman", "Noto Serif SC", serif; font-size: 10.5pt; line-height: 1.55; }
.document-page h1 { margin: 0; font-size: 18pt; text-align: center; letter-spacing: .05em; }
.document-brand { margin-bottom: 5mm; text-align: left; }
.document-wordmark { display: flex; justify-content: flex-start; align-items: baseline; gap: 1.5mm; font-family: Arial, sans-serif; font-size: 10.5pt; font-weight: 900; letter-spacing: .07em; line-height: 1; }
.document-wordmark strong { color: #0a5c46; }
.document-wordmark b { color: #d7a91d; }
.document-website { margin-top: 1.2mm; color: #4d625a; font-family: Arial, sans-serif; font-size: 7pt; font-weight: 400; letter-spacing: .04em; }
.document-meta { margin: 8px 0 13px; display: flex; justify-content: space-between; border-bottom: 1px solid #222; font-size: 9pt; }
.document-parties { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12mm; }
.document-party { padding: 0; }
.document-party h2 { margin: 0 0 5px; padding-bottom: 3px; border-bottom: 1px solid #bbb; font-size: 11pt; }
.document-party p, .document-clause p { margin: 3px 0; }
.document-manual-blank { min-width: 34mm; display: inline-block; border-bottom: 1px solid #555; }
.document-cargo { margin-top: 7mm; break-inside: avoid; }
.document-cargo h2 { margin: 0 0 4mm; padding-bottom: 2mm; border-bottom: 1px solid #bbb; font-size: 11pt; }
.document-cargo-content { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 6mm; align-items: start; }
.document-cargo-image { width: 35mm; height: 35mm; display: block; object-fit: contain; }
.document-cargo-facts { margin: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2.5mm 7mm; }
.document-cargo-facts div { min-width: 0; }
.document-cargo-facts dt { color: #555; font-size: 8pt; }
.document-cargo-facts dd { margin: 1px 0 0; overflow-wrap: anywhere; font-size: 9.5pt; }
.document-cargo-facts .cargo-wide { grid-column: 1 / -1; }
.document-preamble { margin: 13px 0; text-indent: 2em; }
.document-clause { margin-top: 10px; }
.document-clause h2 { margin: 0 0 4px; font-size: 11.5pt; }
.document-clause ol { margin: 3px 0; padding-left: 1.5em; }
.signature-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; break-inside: avoid; }
.signature-box { min-height: 100px; padding-top: 8px; border-top: 1px solid #222; }
.signature-box p { margin: 8px 0; }
.document-page[lang="en"] { break-before: page; page-break-before: always; }

.toast-region { position: fixed; top: 18px; right: 18px; z-index: 2000; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 240px; padding: 12px 14px; border-radius: 11px; color: #fff; background: #0b5e47; box-shadow: 0 12px 35px rgba(0,0,0,.18); font-size: .72rem; font-weight: 800; animation: toast-in .2s ease both; }
.toast.error { background: #9b3027; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-4 .span-4 { grid-column: span 2; }
  .pricing-layout { grid-template-columns: 1fr; }
  .cargo-layout { grid-template-columns: 1fr; }
  .total-card { min-height: 220px; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 228px; transition: transform .2s ease; box-shadow: 20px 0 60px rgba(5,40,31,.18); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: block; }
  .topbar { justify-content: flex-start; }
  .topbar-actions { margin-left: auto; }
  .topbar-actions .language-button { display: none; }
  .party-columns { grid-template-columns: 1fr; }
  .editor-top { align-items: stretch; flex-direction: column; }
  .editor-actions { justify-content: flex-end; }
  .document-page { width: 100%; min-height: auto; padding: 22px; }
}

@media (max-width: 620px) {
  .login-page { padding: 14px; }
  .login-card { padding: 22px; border-radius: 20px; }
  .brand-wordmark-login { padding: 17px 16px; }
  .brand-wordmark-login span { font-size: clamp(.92rem,4.75vw,1.25rem); }
  .login-copy { margin: 26px 0 20px; }
  .topbar { min-height: 72px; }
  .topbar .button span:last-child { display: none; }
  .view { padding: 16px; }
  .welcome-panel { min-height: 230px; align-items: flex-start; flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .contracts-toolbar { align-items: stretch; flex-direction: column; }
  .filter-group { align-items: stretch; flex-direction: column; }
  .search-field { min-width: 0; }
  .form-section { grid-template-columns: 42px minmax(0,1fr); }
  .section-body { padding: 17px 14px; }
  .field-grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .grid-4 .span-4 { grid-column: span 1; }
  .section-title { flex-direction: column; }
  .editor-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .editor-actions select { grid-column: 1 / -1; width: 100%; }
  .editor-bottom-actions { align-items: stretch; flex-direction: column; }
  .editor-bottom-actions > div, .editor-bottom-actions .button { width: 100%; }
  .document-parties, .signature-grid { grid-template-columns: 1fr; }
  .document-cargo-content { grid-template-columns: 1fr; }
  .image-upload { grid-template-columns: 1fr; }
  .contract-document { padding: 10px; }
  .preview-toolbar .eyebrow { display: none; }
  .preview-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preview-toolbar > div:last-child { width: 100%; justify-content: flex-start; }
  .preview-toolbar .button { flex: 1 1 140px; }
  .dialog-close { flex: 0 0 40px !important; margin-left: auto; }
  .contract-document { max-height: calc(100vh - 210px); }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body > *:not(.preview-dialog) { display: none !important; }
  .preview-dialog[open] { position: static; width: auto; max-height: none; margin: 0; display: block; overflow: visible; border-radius: 0; box-shadow: none; }
  .preview-toolbar { display: none; }
  .contract-document { max-height: none; padding: 0; overflow: visible; }
  .document-page { width: auto; min-height: auto; margin: 0; padding: 0; box-shadow: none; page-break-after: always; }
  .document-parties, .signature-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .document-cargo-content { grid-template-columns: auto minmax(0,1fr); }
  .document-page:last-child { page-break-after: auto; }
  body.print-zh .document-page[lang="en"] { display: none !important; }
  body.print-en .document-page[lang="zh-CN"] { display: none !important; }
  body.print-en .document-page[lang="en"] { break-before: auto; page-break-before: auto; }
}

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