:root {
  --ink: #22231f;
  --muted: #77776f;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --soft: #f3f0e9;
  --line: #e5e1d8;
  --amber: #f4a11a;
  --amber-dark: #c77800;
  --amber-pale: #fff3d7;
  --brick: #b64b37;
  --shadow: 0 14px 34px rgba(34, 35, 31, 0.07);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  font-family: "Manrope", "Avenir Next", Avenir, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 100% 0%, #fff7e8 0, var(--paper) 36rem); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 760px); margin: 0 auto; padding: 18px 16px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 2px 24px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.owner-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px 4px 4px; border: 1px solid #ead8b8; border-radius: 999px; background: #fffaf0; color: var(--amber-dark); font-size: 9px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.owner-avatar { display: block; width: 28px; height: 28px; flex: 0 0 28px; border: 2px solid var(--amber); border-radius: 50%; object-fit: cover; object-position: 50% 37%; background: var(--soft); }
.owner-hero { position: relative; width: 100%; height: clamp(120px, 33vw, 250px); margin: 4px 0 0; overflow: hidden; border: 1px solid #ead8b8; border-radius: 18px; background: var(--ink); box-shadow: var(--shadow); }
.owner-hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 58% center; }
.brand-lockup, .print-brand { display: flex; gap: 11px; align-items: center; }
.brand-mark { width: 38px; height: 38px; position: relative; flex: 0 0 auto; background: var(--ink); border-radius: 12px; overflow: hidden; }
.brand-mark::before { content: ""; position: absolute; inset: 7px 7px 7px 18px; background: var(--amber); border-radius: 3px 8px 8px 3px; transform: skewY(-16deg); }
.brand-mark span { position: absolute; width: 9px; height: 9px; left: 7px; top: 9px; border: 2px solid var(--amber); border-radius: 50%; }
.brand-mark i { position: absolute; width: 13px; height: 3px; background: var(--amber); left: 7px; bottom: 9px; transform: rotate(-16deg); border-radius: 4px; }
.byline { margin: 3px 0 0; color: var(--muted); font-size: 9px; font-style: italic; }
.eyebrow { margin: 0 0 4px; color: var(--amber-dark); font-size: 10px; font-weight: 800; line-height: 1.2; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font-size: 18px; line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: 7px; font-size: clamp(26px, 6.8vw, 42px); line-height: 1.04; letter-spacing: -.055em; max-width: 520px; }
h3 { margin: 0; font-size: 19px; line-height: 1.1; letter-spacing: -.04em; }
.muted { margin-bottom: 0; max-width: 520px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status-pill { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid #e9e0cf; border-radius: 999px; background: rgba(255, 255, 255, .72); color: #777066; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4a9b62; box-shadow: 0 0 0 3px #e3f3e7; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 22px 2px 28px; }
.date-chip { flex: 0 0 auto; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 23px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.tab { flex: 1; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; transition: 160ms ease; }
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 4px 13px rgba(34, 35, 31, .08); }
.tab-count { display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; margin-left: 4px; padding: 0 4px; border-radius: 999px; background: var(--amber-pale); color: var(--amber-dark); font-size: 10px; }
.tab-panel[hidden] { display: none; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 15px; }
.dashboard-section-heading { margin-bottom: 12px; }
.calculator-grid { display: grid; gap: 14px; }
.calculator-card { min-width: 0; padding: 14px; border: 1px solid #eadfcd; border-radius: var(--radius-lg); background: rgba(255, 255, 255, .72); box-shadow: var(--shadow); }
.calculator-card .section-heading { margin-bottom: 12px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 1px solid transparent; border-radius: 12px; font-size: 12px; font-weight: 800; transition: transform 160ms ease, background 160ms ease, border-color 160ms ease; }
.button:active { transform: translateY(1px); }
.button:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, .add-row:focus-visible, .remove-row:focus-visible { outline: 3px solid rgba(244, 161, 26, .35); outline-offset: 2px; }
.button-primary { background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(34, 35, 31, .14); }
.button-primary:hover { background: #35362f; }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover, .button-ghost:hover { border-color: #d9c9ae; background: var(--amber-pale); }
.button-ghost { min-height: 34px; padding: 0 11px; border-color: var(--line); background: transparent; color: var(--muted); }
.button-icon { font-size: 16px; line-height: 1; }
.transaction-head { display: grid; grid-template-columns: 1fr 74px 95px; gap: 10px; padding: 0 16px 7px 46px; color: #a09b90; font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.transaction-head span:nth-child(2), .transaction-head span:nth-child(3) { text-align: right; }
.transaction-rows { display: grid; gap: 10px; }
.transaction-card { position: relative; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 4px 13px rgba(34, 35, 31, .03); }
.transaction-card.has-value { border-color: #ebd5a6; }
.row-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.row-number { display: inline-flex; width: 25px; height: 25px; align-items: center; justify-content: center; border-radius: 8px; background: var(--amber-pale); color: var(--amber-dark); font-size: 11px; font-weight: 900; }
.remove-row { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #afa99e; font-size: 22px; line-height: 1; }
.remove-row:hover { background: #fff0ed; color: var(--brick); }
.field-label { display: block; margin-bottom: 5px; color: #858177; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.search-field { position: relative; display: flex; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; transition: border-color 160ms ease, box-shadow 160ms ease; }
.search-field:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(244, 161, 26, .12); }
.search-icon { width: 35px; flex: 0 0 35px; color: #aaa399; font-size: 20px; line-height: 1; text-align: center; transform: translateY(-1px); }
.search-field input { width: 100%; min-width: 0; height: 42px; padding: 0 10px 0 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-field input::placeholder { color: #aba79e; }
.product-picker { position: relative; }
.suggestions { position: absolute; z-index: 5; top: calc(100% + 5px); left: 0; right: 0; display: none; overflow: hidden; border: 1px solid #e6d7bb; border-radius: 12px; background: #fff; box-shadow: 0 14px 35px rgba(34, 35, 31, .16); }
.suggestions.is-open { display: block; }
.suggestion { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid #f1ede5; background: #fff; color: var(--ink); text-align: left; }
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover, .suggestion:focus { background: var(--amber-pale); outline: 0; }
.suggestion-name { display: block; overflow: hidden; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-category { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.suggestion-price { flex: 0 0 auto; color: var(--amber-dark); font-size: 11px; font-weight: 800; }
.selected-meta { display: flex; justify-content: space-between; gap: 12px; min-height: 21px; padding: 6px 2px 0; color: var(--muted); font-size: 10px; }
.category-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-price-label { color: var(--amber-dark); font-weight: 800; white-space: nowrap; }
.row-bottomline { display: grid; grid-template-columns: 90px 1fr; gap: 13px; align-items: end; margin-top: 8px; }
.quantity-input { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 800; outline: 0; }
.quantity-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(244, 161, 26, .12); }
.line-total { min-width: 0; text-align: right; }
.line-total-value { display: block; overflow: hidden; color: var(--ink); font-size: 19px; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.add-row { display: flex; align-items: center; gap: 11px; width: 100%; margin-top: 12px; padding: 12px 14px; border: 1px dashed #d6c6a8; border-radius: var(--radius-md); background: transparent; color: var(--ink); text-align: left; transition: background 160ms ease, border-color 160ms ease; }
.add-row:hover { border-color: var(--amber); background: var(--amber-pale); }
.add-icon { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--amber); color: var(--ink); font-size: 20px; font-weight: 500; }
.add-row strong, .add-row small { display: block; }
.add-row strong { font-size: 12px; }
.add-row small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.transaction-actions { display: flex; justify-content: flex-end; padding: 16px 0 0; }
.print-summary { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-top: 18px; padding: 20px 18px; border-radius: var(--radius-lg); background: var(--amber); box-shadow: var(--shadow); }
.print-summary .eyebrow { color: rgba(34, 35, 31, .64); }
.print-summary strong { display: block; font-size: clamp(26px, 8vw, 40px); letter-spacing: -.07em; line-height: 1; }
.summary-meta { display: grid; gap: 4px; color: rgba(34, 35, 31, .65); font-size: 10px; font-weight: 800; text-align: right; }
.catalog-badge { padding: 7px 9px; border-radius: 999px; background: var(--amber-pale); color: var(--amber-dark); font-size: 10px; font-weight: 800; white-space: nowrap; }
.catalog-tools { display: grid; gap: 9px; margin-bottom: 7px; }
.wide-search input { height: 46px; }
.tool-row { display: flex; gap: 7px; }
.tool-row select { min-width: 0; flex: 1; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 800; outline: 0; }
.tool-row .button { padding: 0 10px; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.helper-text { margin: 0 0 15px; color: var(--muted); font-size: 11px; line-height: 1.5; }
code { padding: 2px 4px; border-radius: 4px; background: var(--soft); color: var(--ink); }
.catalog-form-card { margin-bottom: 16px; padding: 15px; border: 1px solid #ead8b8; border-radius: var(--radius-md); background: linear-gradient(135deg, #fffaf0, #fff); }
.form-card-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.form-card-heading h4 { margin: 0; font-size: 15px; letter-spacing: -.03em; }
.product-form-grid { display: grid; gap: 9px; }
.product-form-grid label { display: block; }
.product-form-grid input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12px; outline: 0; }
.product-form-grid input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(244, 161, 26, .12); }
.form-submit { width: 100%; margin-top: 12px; }
.catalog-list { display: grid; gap: 7px; }
.catalog-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.catalog-item-name { min-width: 0; }
.catalog-item-name strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-item-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.catalog-item-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.catalog-item-price { flex: 0 0 auto; color: var(--amber-dark); font-size: 12px; font-weight: 900; }
.catalog-edit { padding: 5px 7px; border: 1px solid #ead8b8; border-radius: 7px; background: var(--amber-pale); color: var(--amber-dark); font-size: 10px; font-weight: 800; }
.catalog-edit:hover { border-color: var(--amber); }
.empty-state { padding: 26px 14px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.toast { position: fixed; z-index: 20; right: 16px; bottom: 18px; left: 16px; display: none; max-width: 500px; margin: auto; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; text-align: center; box-shadow: 0 12px 28px rgba(0,0,0,.18); }
.toast.is-visible { display: block; animation: toast-in 160ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.print-only { display: none; }

@media (min-width: 620px) {
  .app-shell { padding: 26px 28px 54px; }
  .transaction-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) 220px; gap: 14px; align-items: center; padding: 13px 15px; }
  .row-topline { display: contents; }
  .row-number { grid-column: 1; grid-row: 1; }
  .remove-row { position: absolute; top: 8px; right: 8px; }
  .product-picker { grid-column: 2; grid-row: 1; }
  .row-bottomline { grid-column: 3; grid-row: 1; grid-template-columns: 72px 1fr; margin: 16px 0 0; }
  .transaction-head { grid-template-columns: 34px 1fr 220px; padding-left: 15px; }
  .transaction-head span:first-child { grid-column: 2; }
  .calculator-card { padding: 16px; }
  .product-form-grid { grid-template-columns: minmax(0, 1.5fr) minmax(120px, .7fr) minmax(0, 1fr); align-items: end; }
  .form-submit { width: auto; }
}

@media (min-width: 760px) {
  .calculator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media print {
  @page { margin: 10mm; size: A4 portrait; }
  body { background: #fff; color: #111; }
  .app-shell, .toast { display: none !important; }
  .print-only { display: block !important; }
  .print-section:not(.print-target) { display: none; }
  .print-sheet { padding: 0; }
  .print-brand { margin-bottom: 8px; }
  .print-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .print-brand h1 { font-size: 16px; }
  .print-byline { margin: 2px 0 0; color: #666; font-size: 9px; font-style: italic; }
  .print-date { margin: 12px 0 24px; color: #666; font-size: 10px; }
  .print-sheet h2 { margin: 0 0 12px; font-size: 20px; }
  .print-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 9px; }
  .print-table thead { display: table-header-group; }
  .print-table tfoot { display: table-footer-group; }
  .print-table tr { break-inside: avoid; page-break-inside: avoid; }
  .print-table th, .print-table td { padding: 6px 5px; border: 1px solid #d9d9d9; text-align: left; overflow-wrap: anywhere; }
  .print-table th:nth-child(1), .print-table td:nth-child(1) { width: 7%; }
  .print-table th:nth-child(2), .print-table td:nth-child(2) { width: 43%; }
  .print-table th:nth-child(3), .print-table td:nth-child(3) { width: 18%; }
  .print-table th:nth-child(4), .print-table td:nth-child(4) { width: 10%; }
  .print-table th:nth-child(5), .print-table td:nth-child(5) { width: 22%; }
  .print-table th:nth-child(1), .print-table td:nth-child(1), .print-table th:nth-child(4), .print-table td:nth-child(4) { text-align: center; }
  .print-table th:nth-child(3), .print-table td:nth-child(3), .print-table th:nth-child(5), .print-table td:nth-child(5) { text-align: right; }
  .print-table thead th { background: #f4a11a; color: #111; font-size: 9px; text-transform: uppercase; }
  .print-table tfoot th { background: #fff3d7; font-size: 11px; }
  .print-footnote { margin-top: 28px; color: #888; font-size: 9px; }
}
