:root {
  --paper: #f3f0e8;
  --card: #fffef9;
  --ink: #11110f;
  --muted: #77756b;
  --line: #d7d4c9;
  --acid: #d9ff52;
  --red: #b63c35;
  --shadow: 0 18px 55px rgba(17,17,15,.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.app-nojs { padding: 18px; text-align: center; background: var(--ink); color: #fff; }
.js-ready .app-nojs { display: none; }
.app-root { min-height: 100vh; }
.visually-hidden { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }

.app-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 70px; padding: 12px clamp(16px, 3vw, 36px); border-bottom: 1px solid rgba(17,17,15,.12); background: rgba(243,240,232,.94); backdrop-filter: blur(16px); }
.app-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 950; letter-spacing: -.04em; font-size: 20px; white-space: nowrap; }
.app-mark { display: grid; grid-template-columns: repeat(2, 9px); grid-template-rows: repeat(2, 9px); gap: 2px; transform: rotate(-12deg); }
.app-mark i { display: block; background: var(--ink); border-radius: 2px; }
.app-mark i:nth-child(2), .app-mark i:nth-child(3) { background: var(--acid); }
.app-top-actions { display: flex; align-items: center; gap: 8px; }
.app-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.app-status:before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #37a05c; }
.app-status.offline:before { background: #e0a43e; }
.icon-btn, .circle-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; font-size: 18px; }
.icon-btn:hover, .circle-btn:hover { background: var(--card); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); text-decoration: none; font-weight: 850; font-size: 14px; transition: transform .18s, background .18s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-acid { background: var(--acid); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 12px; }
.btn-plain { border-color: transparent; }
.btn-danger { color: var(--red); border-color: rgba(182,60,53,.45); }
.link-btn { border: 0; padding: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 44px 18px 80px; }
.auth-grid { width: min(1060px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; }
.auth-intro { min-height: 590px; padding: clamp(28px, 5vw, 68px); border-radius: 30px; background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.auth-intro:after { content: ""; position: absolute; width: 280px; height: 280px; right: -70px; bottom: -80px; border-radius: 50%; border: 44px solid var(--acid); opacity: .92; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; font-weight: 900; }
.auth-intro .eyebrow { color: #a9a79d; }
.auth-intro h1 { max-width: 560px; margin: 24px 0 14px; font-size: clamp(48px, 7vw, 90px); line-height: .9; letter-spacing: -.075em; }
.auth-intro p { max-width: 450px; margin: 0; color: #c3c1b8; font-size: 17px; line-height: 1.45; }
.auth-steps { display: grid; gap: 12px; margin-top: 36px; position: relative; z-index: 1; }
.auth-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; font-size: 13px; }
.auth-step b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--acid); color: var(--ink); font-size: 11px; }
.auth-card { align-self: center; padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line); border-radius: 30px; background: var(--card); box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 8px; font-size: 36px; letter-spacing: -.06em; line-height: .98; }
.auth-card > p { margin: 0 0 26px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.auth-form { display: grid; gap: 12px; }
.form-field { display: grid; gap: 6px; }
.form-field label { color: #4d4b44; font-size: 12px; font-weight: 850; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fff; outline: 0; font-size: 16px; }
.form-field textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(217,255,82,.45); }
.form-hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 4px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.auth-divider:before, .auth-divider:after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-legal { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.auth-legal a { text-decoration: underline; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-message { padding: 12px; border-radius: 12px; background: rgba(217,255,82,.32); color: #414037; font-size: 13px; line-height: 1.4; }
.consent-check { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 9px; align-items: start; color: #4d4b44; font-size: 12px; line-height: 1.4; }
.consent-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); }
.consent-check a { font-weight: 800; text-underline-offset: 2px; }

.workspace { display: grid; grid-template-columns: 238px minmax(0,1fr); min-height: calc(100vh - 70px); }
.app-sidebar { position: sticky; top: 70px; align-self: start; height: calc(100vh - 70px); display: flex; flex-direction: column; gap: 22px; padding: 24px 14px; border-right: 1px solid var(--line); }
.profile-mini { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--acid); font-weight: 950; }
.profile-mini b { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile-mini span { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 11px; border: 0; border-radius: 12px; background: transparent; text-align: left; color: #4d4b44; font-size: 13px; font-weight: 800; }
.side-nav button:hover, .side-nav button.active { background: var(--ink); color: #fff; }
.side-nav button.active:before { content: ""; width: 6px; height: 6px; margin-left: -5px; border-radius: 50%; background: var(--acid); }
.side-nav .nav-icon { width: 19px; text-align: center; font-size: 15px; }
.side-bottom { margin-top: auto; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.45; }
.main-content { min-width: 0; padding: clamp(22px, 4vw, 52px); }
.main-inner { max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 30px; }
.page-head h1 { margin: 5px 0 0; font-size: clamp(34px, 5vw, 64px); line-height: .95; letter-spacing: -.07em; }
.page-head p { max-width: 560px; margin: 10px 0 0; color: var(--muted); line-height: 1.45; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.stat-card { min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.stat-card.acid { background: var(--acid); }
.stat-card strong { display: block; margin: 15px 0 5px; font-size: 36px; letter-spacing: -.07em; line-height: .9; }
.stat-card span { color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); gap: 14px; align-items: start; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 21px; line-height: 1; letter-spacing: -.045em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.empty { padding: 34px 14px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; }
.empty b { display: block; margin-bottom: 7px; font-size: 18px; }
.empty p { max-width: 340px; margin: 0 auto 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.doc-list { display: grid; gap: 8px; }
.doc-card { display: grid; grid-template-columns: minmax(0,1fr) minmax(138px,auto); gap: 22px; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.doc-card:hover { border-color: var(--ink); }
.doc-main { min-width: 0; }
.doc-topline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.doc-title { display: block; width: 100%; max-width: 100%; margin: 9px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-align: left; font-size: 18px; font-weight: 900; letter-spacing: -.03em; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.status-pill, .type-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: #efede5; color: #55534b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.status-pill.ready { background: rgba(55,160,92,.14); color: #2d7a46; }
.status-pill.archived { background: rgba(17,17,15,.1); }
.type-pill { background: var(--acid); color: var(--ink); }
.doc-amount { min-width: 138px; padding-left: 18px; border-left: 1px solid var(--line); text-align: right; white-space: nowrap; font-size: 18px; font-weight: 900; letter-spacing: -.04em; }
.doc-amount .status-pill { margin-bottom: 10px; }
.doc-amount small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.doc-menu { display: flex; gap: 5px; margin-top: 10px; }
.doc-menu button { border: 0; padding: 0; background: none; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; margin-bottom: 14px; }
.search-row input, .search-row select { min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-size: 15px; }
.quick-grid { display: grid; gap: 8px; }
.quick-card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; text-decoration: none; }
.quick-card:hover { border-color: var(--ink); }
.quick-card b { display: block; margin-bottom: 6px; font-size: 15px; }
.quick-card span { color: var(--muted); font-size: 12px; line-height: 1.35; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.choice-card { min-height: 150px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); text-align: left; }
.choice-card:hover, .choice-card:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(217,255,82,.48); outline: 0; }
.choice-card .choice-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--acid); font-weight: 900; }
.choice-card h3 { margin: 22px 0 7px; font-size: 20px; letter-spacing: -.045em; }
.choice-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.editor-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.55fr); gap: 14px; align-items: start; }
.editor-panel { display: grid; gap: 14px; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.back-btn { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 800; }
.save-state { color: var(--muted); font-size: 11px; }
.document-title-input { display: block; width: 100%; min-height: 2.15em; padding: 0; border: 0; outline: 0; overflow: hidden; resize: vertical; background: transparent; color: var(--ink); font-size: clamp(28px, 3vw, 42px); font-weight: 950; letter-spacing: -.055em; line-height: 1.03; }
.editor-head-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.section-block { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; }
.section-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: #f0eee7; }
.section-bar input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-weight: 900; font-size: 14px; }
.section-actions { display: flex; gap: 5px; }
.tiny-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.tiny-btn.danger { color: var(--red); }
.item-list { display: grid; gap: 0; }
.item-row { display: grid; grid-template-columns: minmax(150px,1.5fr) 118px 82px 92px 96px 94px 34px; gap: 7px; align-items: center; padding: 9px 10px; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; }
.item-row input, .item-row select { width: 100%; min-width: 0; min-height: 38px; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; background: #faf9f4; color: var(--ink); font-size: 14px; }
.item-row input:focus, .item-row select:focus { border-color: var(--ink); outline: 0; background: #fff; }
.item-row .item-name { font-weight: 750; }
.item-row .item-total { text-align: right; white-space: nowrap; font-size: 13px; font-weight: 850; }
.item-row .remove-item { width: 30px; height: 30px; }
.item-add { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.item-add button { width: 100%; min-height: 38px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.item-add button:hover { border-color: var(--ink); color: var(--ink); }
.item-add { flex-wrap: wrap; }
.item-add button { flex: 1 1 160px; }
.creation-mode-note { margin-bottom: 16px; }
.pricebook-results { margin-top: 14px; }
.pricebook-results .data-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.editor-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.total-card { padding: 20px; border-radius: 18px; background: var(--ink); color: #fff; }
.total-card .eyebrow { color: #aaa89f; }
.total-amount { margin: 11px 0 18px; font-size: 38px; font-weight: 950; letter-spacing: -.075em; }
.total-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.16); color: #c5c3ba; font-size: 12px; }
.total-line strong { color: #fff; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9c6bb; transition: .2s; }
.switch span:after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span:after { transform: translateX(18px); background: var(--acid); }
.warning { padding: 12px 14px; border-radius: 13px; background: rgba(217,255,82,.28); color: #4b493f; font-size: 12px; line-height: 1.45; }
.warning.danger { background: rgba(182,60,53,.10); color: var(--red); }
.template-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.generation-panel { border-left: 4px solid var(--acid); }
.generation-panel h2 { font-size: 20px; line-height: 1.3; }
.generation-panel p { line-height: 1.5; }
.generation-panel details { margin: 12px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.generation-panel summary { cursor: pointer; color: var(--ink); }
.generation-panel ul { padding-left: 20px; }
.generation-panel li + li { margin-top: 6px; }
.item-row .item-note { grid-column: 1 / -1; color: var(--muted); font-size: 11px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.incomplete-row { background: rgba(217,255,82,.12); }
.account-panel { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: start; margin-bottom: 14px; }
.account-panel h2 { margin: 7px 0 4px; font-size: 24px; letter-spacing: -.045em; }
.account-panel p { margin: 0; color: var(--muted); font-size: 12px; }
.account-panel .form-hint { grid-column: 1 / -1; }

.data-table { display: grid; gap: 7px; }
.data-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.data-row h3 { margin: 0 0 5px; font-size: 15px; }
.data-row p { margin: 0; color: var(--muted); font-size: 12px; }
.trash-row h3 { margin-top: 9px; }
.trash-row .type-pill { background: #efede5; color: #55534b; }
.data-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: end; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(17,17,15,.55); }
.cloud-notice { margin-bottom: 20px; border-color: #bccd6a; }
.cloud-notice p { margin: 10px 0 16px; line-height: 1.5; }
.cloud-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 13px; color: var(--muted, #74746a); }
.cloud-tools > span { flex: 1 1 280px; }
.cloud-tools [hidden] { display: none; }
.conflict-modal { width: min(760px, 100%); }
.conflict-entry { padding: 20px 0; border-top: 1px solid #deddd3; }
.conflict-entry h3 { overflow-wrap: anywhere; }
.conflict-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 14px 0; }
.conflict-versions p { font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 520px) { .conflict-versions { grid-template-columns: 1fr; } .cloud-notice .form-actions .btn { width: 100%; } }
.modal { width: min(640px,100%); max-height: min(760px, calc(100vh - 36px)); overflow: auto; padding: 24px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal h2 { margin: 0; font-size: 28px; letter-spacing: -.06em; }
.modal-form { display: grid; gap: 12px; }
.modal-actions { display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.modal-grid .full { grid-column: 1 / -1; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; max-width: 360px; padding: 13px 15px; border: 1px solid var(--ink); border-radius: 13px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 13px; line-height: 1.35; }
.toast.success { background: #286d42; border-color: #286d42; }
.toast.error { background: var(--red); border-color: var(--red); }

.install-card { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 16px; align-items: center; padding: 18px; border-radius: 18px; background: var(--acid); }
.install-card .install-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 17px; background: var(--ink); color: var(--acid); font-size: 26px; font-weight: 950; }
.install-card h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.04em; }
.install-card p { margin: 0; color: #555447; font-size: 12px; line-height: 1.4; }
.install-card .btn { grid-column: 1 / -1; width: 100%; }
.install-steps { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.install-steps li { counter-increment: steps; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; color: #4c4a42; font-size: 13px; line-height: 1.4; }
.install-steps li:before { content: counter(steps); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--acid); font-weight: 900; font-size: 11px; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 196px minmax(0,1fr); }
  .main-content { padding: 28px 22px; }
  .content-grid, .editor-layout { grid-template-columns: 1fr; }
  .editor-layout .editor-side { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; }
  .editor-layout .editor-side .panel { margin-top: 0; }
}
@media (max-width: 760px) {
  .app-topbar { min-height: 62px; padding: 8px 12px; }
  .app-status { display: none; }
  .workspace { display: block; min-height: calc(100vh - 62px); padding-bottom: 74px; }
  .app-sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 35; height: auto; display: block; padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); background: rgba(243,240,232,.97); backdrop-filter: blur(16px); }
  .profile-mini, .side-bottom { display: none; }
  .side-nav { grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .side-nav button { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; padding: 5px 2px; border-radius: 11px; text-align: center; font-size: 10px; }
  .side-nav button.active:before { display: none; }
  .side-nav .nav-icon { font-size: 17px; }
  .main-content { padding: 22px 12px; }
  .page-head { align-items: start; flex-direction: column; margin-bottom: 22px; }
  .page-head h1 { font-size: 44px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 106px; padding: 14px; }
  .stat-card:first-child { grid-column: 1 / -1; }
  .stat-card strong { font-size: 30px; }
  .panel { padding: 16px; border-radius: 18px; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .search-row input { grid-column: 1 / -1; }
  .doc-card { grid-template-columns: minmax(0,1fr); }
  .doc-amount { min-width: 0; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .doc-menu { flex-wrap: wrap; }
  .editor-layout .editor-side { grid-template-columns: 1fr; }
  .editor-head-grid, .modal-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: minmax(110px,1fr) 74px 74px 82px 86px 30px; gap: 5px; overflow-x: auto; }
  .item-row > * { min-width: 0; }
  .item-row .item-name { grid-column: 1 / -1; }
  .item-row .item-note { max-width: calc(100vw - 80px); }
  .item-row .item-total { grid-column: 5; grid-row: 2; }
  .item-row .remove-item { grid-column: 6; grid-row: 2; }
  .item-row select { font-size: 12px; }
  .install-card { grid-template-columns: 52px minmax(0,1fr); }
  .install-card .install-icon { width: 52px; height: 52px; font-size: 20px; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-card { order: -1; }
  .auth-intro { min-height: 330px; padding: 28px; }
  .auth-intro h1 { font-size: 54px; }
  .auth-steps { grid-template-columns: repeat(3,1fr); gap: 8px; }
  .auth-step { display: block; font-size: 11px; }
  .auth-step b { margin-bottom: 7px; }
  .auth-intro:after { width: 160px; height: 160px; border-width: 25px; right: -55px; bottom: -55px; }
  .account-panel { grid-template-columns: 1fr; }
  .account-panel .form-actions { width: 100%; }
}
@media (max-width: 420px) {
  .auth-card { padding: 22px 16px; }
  .auth-card h2 { font-size: 31px; }
  .form-actions .btn { width: 100%; }
  .total-amount { font-size: 33px; }
}
