:root {
  --paper: #f4f0e8;
  --paper-deep: #ebe4d8;
  --ink: #1d2924;
  --muted: #72776f;
  --pine: #2d5446;
  --sage: #b9c9b6;
  --peach: #e88463;
  --butter: #e5c95c;
  --white: #fffdf8;
  --line: rgba(29, 41, 36, .16);
  --danger: #a94338;
  --shadow: 0 24px 60px rgba(45, 55, 48, .1);
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--paper); color: var(--ink); }

.skip-link { position: fixed; left: 12px; top: 8px; z-index: 200; padding: 10px 14px; background: var(--ink); color: var(--white); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  background:
    radial-gradient(circle at 90% 4%, rgba(232, 132, 99, .11), transparent 27rem),
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(29, 41, 36, .035) calc(100% - 1px));
  background-size: auto, 28px 28px;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(232, 132, 99, .34); outline-offset: 2px; }

.topbar {
  height: 78px;
  padding: 13px clamp(18px, 4vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, .91);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.wordmark { display: flex; align-items: center; gap: 11px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.wordmark-mark { width: 42px; height: 42px; display: grid; place-items: center; color: var(--white); background: var(--pine); border-radius: 50% 48% 52% 44%; font: 700 21px var(--serif); }
.wordmark b { display: block; font: 700 18px/1.1 var(--serif); letter-spacing: .12em; }
.wordmark small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.readable-toggle { min-height: 38px; padding: 7px 12px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; }
.readable-toggle[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.sync-now-button { min-height: 38px; padding: 7px 12px; border: 1px solid var(--peach); border-radius: 999px; background: var(--peach); color: var(--white); cursor: pointer; font-size: 13px; font-weight: 800; }

.save-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.save-state i { width: 8px; height: 8px; background: var(--sage); border-radius: 50%; box-shadow: 0 0 0 4px rgba(185, 201, 182, .25); }
.save-state.is-saving i { background: var(--butter); }
.save-state.is-pending { color: #8a6418; }
.save-state.is-pending i { background: var(--butter); }
.save-state.is-error { color: var(--danger); }
.save-state.is-error i { background: var(--danger); }

main { max-width: 1320px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 60px) 112px; }
.view { display: none; animation: reveal .35s ease both; }
.view.is-active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }

.editorial-head, .page-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  padding: clamp(46px, 8vw, 92px) 0 clamp(38px, 5vw, 62px);
}

.eyebrow { margin: 0 0 14px; color: var(--peach); font-size: 10px; font-weight: 800; letter-spacing: .28em; }
h1 { margin: 0; font: 700 clamp(38px, 6vw, 76px)/1.08 var(--serif); letter-spacing: -.055em; }
.page-title h1 { font-size: clamp(36px, 5vw, 62px); }
.page-title > p { max-width: 370px; color: var(--muted); line-height: 1.9; font-size: 14px; }

.day-note { min-width: 170px; padding: 22px 0 8px 24px; border-left: 1px solid var(--ink); }
.day-note span, .day-note small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.day-note strong { display: block; margin: 10px 0 5px; font: 700 30px var(--serif); }

.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: clamp(28px, 5vw, 72px); align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.section-heading.ruled { padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.section-heading > div { display: flex; align-items: baseline; gap: 12px; }
.section-heading span { color: var(--peach); font: 700 11px var(--sans); letter-spacing: .1em; }
.section-heading h2 { margin: 0; font: 700 24px var(--serif); }
.section-heading p { max-width: 390px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: right; }
.quick-add-button { min-height: 40px; margin-left: auto; padding: 8px 13px; border: 1px solid var(--pine); border-radius: 999px; background: transparent; color: var(--pine); cursor: pointer; font-size: 13px; font-weight: 700; white-space: nowrap; }
.quick-add-button:hover { background: var(--pine); color: var(--white); }
.top-gap { margin-top: 64px; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card {
  min-height: 172px;
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.product-card::after { content: ""; width: 74px; height: 74px; position: absolute; right: -24px; top: -24px; border-radius: 50%; background: var(--card-color, var(--sage)); opacity: .55; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(44, 55, 48, .08); border-color: rgba(29, 41, 36, .35); }
.product-card:active { transform: scale(.985); }
.product-card:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.product-card .stock { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.product-card .stock.low { color: var(--danger); font-weight: 700; }
.product-card h3 { margin: 20px 0 8px; font: 700 21px var(--serif); }
.product-card .price { display: flex; justify-content: space-between; align-items: end; }
.product-card .price b { font-size: 20px; }
.product-card .price small { color: var(--muted); font-size: 10px; }

.ticket { position: sticky; top: 102px; padding: 27px; background: var(--ink); color: var(--white); box-shadow: var(--shadow); }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 0; right: 0; height: 7px; background: radial-gradient(circle at 7px -1px, transparent 7px, var(--ink) 7.5px) 0 0/14px 7px repeat-x; }
.ticket::before { top: -7px; transform: rotate(180deg); }
.ticket::after { bottom: -7px; }
.ticket-head { display: flex; justify-content: space-between; align-items: start; padding-bottom: 18px; border-bottom: 1px dashed rgba(255,255,255,.3); }
.ticket-head span { color: var(--sage); font-size: 9px; letter-spacing: .2em; }
.ticket-head h2 { margin: 4px 0 0; font: 700 23px var(--serif); }
.ticket .text-button { color: var(--sage); }
.ticket-empty { min-height: 250px; display: grid; place-content: center; text-align: center; color: rgba(255,255,255,.4); }
.ticket-empty span { font: 300 42px var(--serif); }
.ticket-empty p { font: 400 14px/1.8 var(--serif); }
.ticket-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px dashed rgba(255,255,255,.2); }
.ticket-line h3 { margin: 0 0 3px; font: 600 15px var(--serif); }
.ticket-line small { color: rgba(255,255,255,.5); font-size: 10px; }
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button { width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; background: transparent; color: white; cursor: pointer; }
.ticket-line > b { min-width: 58px; text-align: right; font-size: 13px; }
.ticket-checkout { padding-top: 19px; }
.bill-row { display: flex; justify-content: space-between; align-items: baseline; margin: 7px 0; }
.bill-row.muted { color: rgba(255,255,255,.55); font-size: 11px; }
.bill-row.total { margin: 12px 0 18px; font: 700 18px var(--serif); }
.bill-row.total b { font-size: 32px; }
.payment-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 12px; border: 1px solid rgba(255,255,255,.25); }
.payment-tabs button { padding: 10px; border: 0; background: transparent; color: rgba(255,255,255,.55); cursor: pointer; font-size: 12px; }
.payment-tabs button.is-active { background: var(--white); color: var(--ink); }
.ticket .field span { color: rgba(255,255,255,.55); }
.ticket .field input { border-color: rgba(255,255,255,.25); background: transparent; color: white; }
.ticket .field input::placeholder { color: rgba(255,255,255,.35); }
.change-line { min-height: 21px; margin: 8px 0 15px; color: var(--sage); text-align: right; font-size: 12px; }
.field-error { margin: -5px 0 10px; color: #ffd4ca; font-size: 13px; font-weight: 700; }

.primary-button, .outline-button, .danger-button {
  width: 100%; min-height: 48px; padding: 12px 18px; border-radius: 2px; cursor: pointer; font-weight: 700; letter-spacing: .04em; transition: transform .15s, opacity .15s;
}
.primary-button { border: 1px solid var(--peach); background: var(--peach); color: var(--white); }
.outline-button { border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.danger-button { border: 1px solid var(--danger); background: var(--danger); color: white; }
.primary-button:hover, .outline-button:hover, .danger-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .outline-button:disabled { opacity: .45; cursor: wait; transform: none; }
.fit { width: auto; min-width: 150px; }
.text-button { min-height: 36px; border: 0; padding: 7px; background: none; cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.report-export-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.stock-actions, .cost-toolbar { display: flex; gap: 10px; margin: -20px 0 35px; }
.stock-list { border-top: 1px solid var(--ink); }
.stock-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(80px, .7fr)); gap: 18px; align-items: center; padding: 24px 8px; border-bottom: 1px solid var(--line); }
.stock-row .product-name { display: flex; align-items: center; gap: 14px; }
.stock-row .swatch { width: 38px; height: 38px; border-radius: 50%; background: var(--card-color); }
.stock-row h3 { margin: 0; font: 700 20px var(--serif); }
.stock-row label { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.stock-row strong { display: block; margin-top: 5px; font-size: 17px; }
.stock-row strong.low { color: var(--danger); }
.paper-note { max-width: 630px; margin: 48px 0 0 auto; padding: 24px 28px; border: 1px solid var(--line); background: rgba(255,253,248,.58); transform: rotate(-.4deg); }
.paper-note span { color: var(--peach); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.paper-note p { margin: 9px 0 0; color: var(--muted); font: 500 15px/1.8 var(--serif); }

.material-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.material-card { min-height: 170px; padding: 20px; position: relative; border: 1px solid var(--line); background: var(--white); }
.material-card .material-index { position: absolute; right: 14px; top: 10px; color: rgba(29,41,36,.12); font: italic 700 40px var(--serif); }
.material-card h3 { margin: 18px 0 30px; font: 700 20px var(--serif); }
.material-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.material-card dt { color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.material-card dd { margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.material-card.is-negative { border-color: rgba(169,67,56,.55); }
.material-card.is-negative dd:first-of-type { color: var(--danger); }

.recipe-list { display: grid; gap: 10px; }
.recipe-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) 130px; gap: 24px; align-items: center; padding: 19px 4px; border-bottom: 1px solid var(--line); }
.recipe-row h3 { margin: 0; font: 700 18px var(--serif); }
.recipe-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.recipe-row strong { text-align: right; font-size: 18px; }
.recipe-row strong small { display: block; color: var(--muted); font-size: 9px; font-weight: 400; }

.report-title { align-items: center; }
.date-picker { min-width: 210px; padding: 12px 0; border-bottom: 1px solid var(--ink); }
.date-picker span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.date-picker input { width: 100%; margin-top: 4px; border: 0; background: none; color: var(--ink); font-weight: 700; }
.report-cards { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); background: var(--white); }
.report-cards article { min-height: 210px; padding: 26px; border-right: 1px solid var(--ink); display: flex; flex-direction: column; }
.report-cards article:last-child { border: 0; }
.report-cards article.accent { background: var(--pine); color: var(--white); }
.report-cards span { color: var(--peach); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.report-cards small { margin-top: 8px; color: var(--muted); }
.report-cards .accent small { color: var(--sage); }
.report-cards strong { margin-top: auto; font: 700 clamp(32px, 4vw, 52px) var(--serif); }
.report-cards em { margin-top: 5px; color: var(--sage); font-style: normal; font-size: 11px; }
.report-sheet { margin-top: 32px; padding: 28px; background: var(--white); box-shadow: 0 15px 45px rgba(44,55,48,.06); }
.report-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.report-sheet-head h2 { margin: 0; font: 700 22px var(--serif); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 10px 12px; border-bottom: 1px solid var(--ink); color: var(--muted); text-align: right; font-size: 9px; letter-spacing: .08em; }
th:first-child, td:first-child { text-align: left; }
td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: right; font-size: 13px; }
.empty-row td { padding: 40px; color: var(--muted); text-align: center; }
.sales-log { display: grid; gap: 8px; }
.sale-log-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 90px 90px; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); background: rgba(255,253,248,.6); }
.sale-log-row.is-voided { opacity: .56; text-decoration: line-through; }
.sale-log-row time { color: var(--muted); font-size: 11px; }
.sale-log-row p { margin: 0; font-size: 12px; }
.sale-log-row strong { text-align: right; }
.sale-log-row button { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 11px; text-decoration: underline; }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.settings-card { min-height: 280px; padding: 30px; border: 1px solid var(--line); background: var(--white); }
.settings-card .card-no { color: var(--peach); font-size: 10px; font-weight: 800; }
.settings-card h2 { margin: 22px 0; font: 700 28px var(--serif); }
.settings-card > p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.cloud-card { background: var(--pine); color: var(--white); }
.cloud-card > p { color: var(--sage); }
.cloud-card .cloud-link { margin-top: 12px; border-color: var(--sage); color: var(--white); }
.cloud-status { display: flex; gap: 13px; align-items: center; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.2); border-bottom: 1px solid rgba(255,255,255,.2); }
.cloud-status i { width: 12px; height: 12px; background: var(--butter); border-radius: 50%; }
.cloud-status b, .cloud-status small { display: block; }
.cloud-status small { margin-top: 4px; color: var(--sage); font-size: 10px; }
.button-stack { display: grid; gap: 9px; margin-top: 24px; }
.file-button { display: grid; place-items: center; }
.file-button input { display: none; }
.danger-card { background: rgba(232,132,99,.07); }
.settings-product-list { display: grid; gap: 7px; margin-bottom: 20px; }
.settings-product-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.settings-product-row b { font: 600 14px var(--serif); }
.settings-product-row span { color: var(--muted); font-size: 11px; }
.settings-product-row button { border: 0; background: none; color: var(--pine); cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.settings-product-row.is-inactive { opacity: .48; }

.field { display: block; margin: 16px 0; }
.field > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.field input, .field select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--white); color: var(--ink); }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.field.compact { margin: 10px 0; }
.check-field { display: flex; align-items: center; gap: 9px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.check-field input { width: 17px; height: 17px; accent-color: var(--pine); }

.bottom-nav { height: 70px; position: fixed; left: 50%; bottom: 14px; z-index: 40; transform: translateX(-50%); display: flex; padding: 5px; border: 1px solid rgba(29,41,36,.14); border-radius: 4px; background: rgba(255,253,248,.94); box-shadow: 0 16px 40px rgba(29,41,36,.18); backdrop-filter: blur(15px); }
.bottom-nav button { width: 74px; border: 0; border-radius: 2px; background: none; color: var(--muted); cursor: pointer; }
.bottom-nav span { display: none; }
.bottom-nav b { font-size: 11px; }
.bottom-nav button.is-active { background: var(--ink); color: var(--white); }

.modal { width: min(92vw, 520px); max-height: 88vh; padding: 0; border: 0; border-radius: 3px; background: var(--paper); color: var(--ink); box-shadow: 0 40px 100px rgba(17,28,23,.35); }
.wide-modal { width: min(92vw, 680px); }
.mini-modal { width: min(92vw, 430px); }
.modal::backdrop { background: rgba(18,29,24,.62); backdrop-filter: blur(4px); }
.modal form { padding: 29px; }
.modal-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.modal-head h2 { margin: 0; font: 700 28px var(--serif); }
.close-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; font-size: 23px; line-height: 1; }
.recipe-editor { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; max-height: 330px; overflow-y: auto; }
.recipe-input { display: grid; grid-template-columns: 1fr 90px; gap: 7px; align-items: center; padding: 10px; border: 1px solid var(--line); background: var(--white); }
.recipe-input span { font-size: 12px; }
.recipe-input label { display: flex; align-items: center; gap: 4px; }
.recipe-input input { width: 62px; padding: 7px; border: 1px solid var(--line); background: transparent; text-align: right; }
.recipe-input small { color: var(--muted); font-size: 9px; }
.recipe-preview { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0; padding: 15px 0; border-top: 1px solid var(--ink); }
.recipe-preview span { color: var(--muted); font-size: 11px; }
.recipe-preview strong { font: 700 25px var(--serif); }
.production-preview { margin: 18px 0; padding: 16px; background: var(--white); border: 1px solid var(--line); }
.production-preview h3 { margin: 0 0 11px; font: 700 16px var(--serif); }
.production-preview p { display: flex; justify-content: space-between; margin: 7px 0; color: var(--muted); font-size: 11px; }
.production-preview p.is-short { color: var(--danger); font-weight: 700; }
.production-preview .preview-total { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); }

.toast { min-width: 220px; max-width: calc(100vw - 36px); position: fixed; left: 50%; bottom: 96px; z-index: 100; transform: translate(-50%, 20px); padding: 13px 18px; border-radius: 2px; background: var(--ink); color: var(--white); opacity: 0; pointer-events: none; text-align: center; font-size: 12px; transition: .25s ease; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }
.empty-panel { grid-column: 1/-1; padding: 45px 20px; border: 1px dashed var(--line); color: var(--muted); text-align: center; font: 500 15px var(--serif); }

/* 預設字級也不低於一般手機容易辨識的尺寸。 */
:is(.wordmark small, .eyebrow, .product-card .price small, .ticket-head span, .ticket-line small,
  .material-card dt, .recipe-row strong small, .date-picker span, th, .settings-card .card-no,
  .cloud-status small, .field small, .recipe-input small) { font-size: 12px; }
:is(.save-state, .day-note span, .day-note small, .product-card .stock, .bill-row.muted,
  .change-line, .stock-row label, .recipe-row p, .sale-log-row time, .sale-log-row p,
  .sale-log-row button, .settings-product-row span, .settings-product-row button,
  .field > span, .check-field, .production-preview p, .toast) { font-size: 13px; }

/* 易讀模式會放大整個操作介面，同時保留原本的響應式排列。 */
html.readable-mode { font-size: 18px; }
html.readable-mode body { line-height: 1.65; }
html.readable-mode :is(.wordmark small, .save-state, .eyebrow, .day-note span, .day-note small, .section-heading p,
  .product-card .stock, .product-card .price small, .ticket-head span, .ticket-line small, .bill-row.muted,
  .payment-tabs button, .change-line, .text-button, .stock-row label, .paper-note span, .material-card dt,
  .recipe-row p, .recipe-row strong small, .date-picker span, th, .sale-log-row time, .sale-log-row p,
  .sale-log-row button, .settings-card .card-no, .cloud-status small, .settings-product-row span,
  .settings-product-row button, .field > span, .field small, .check-field, .bottom-nav b, .recipe-input small,
  .recipe-preview span, .production-preview p, .toast) { font-size: 15px; }
html.readable-mode :is(.page-title > p, .ticket-empty p, .paper-note p, .settings-card > p, .cloud-status b,
  .field input, .field select, .recipe-input span) { font-size: 16px; }
html.readable-mode :is(.ticket-line h3, .ticket-line > b, .material-card dd, td) { font-size: 16px; }
html.readable-mode :is(button, input, select) { min-height: 48px; }

body.is-writing button[type="submit"],
body.is-writing #checkoutBtn,
body.is-writing #saveStoreBtn,
body.is-writing #resetDemoBtn { pointer-events: none; opacity: .5; cursor: wait; }

@media (max-width: 980px) {
  .sale-layout { grid-template-columns: 1fr; }
  .ticket { position: relative; top: 0; max-width: 620px; width: 100%; margin: 20px auto 0; }
  .material-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .topbar { height: 66px; padding: 10px 16px; }
  .wordmark-mark { width: 38px; height: 38px; }
  .wordmark b { font-size: 16px; }
  .wordmark small { display: none; }
  .topbar-actions { gap: 8px; }
  .sync-now-button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .readable-toggle { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .save-state span { font-size: 10px; }
  main { padding: 0 14px 104px; }
  .editorial-head, .page-title { display: block; padding: 42px 4px 34px; }
  h1 { font-size: 43px; }
  .page-title h1 { font-size: 39px; }
  .page-title > p { margin: 18px 0 0; }
  .day-note { display: grid; grid-template-columns: 1fr auto; align-items: end; margin-top: 30px; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--ink); }
  .day-note strong { grid-row: span 2; margin: 0; }
  .section-heading { align-items: start; }
  .section-heading p { display: none; }
  .quick-add-button { min-height: 42px; margin-left: auto; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .product-card { min-height: 145px; padding: 15px; }
  .product-card h3 { font-size: 18px; }
  .ticket { padding: 23px; }
  .stock-actions, .cost-toolbar { margin-top: -12px; overflow-x: auto; }
  .stock-row { grid-template-columns: 1fr 1fr; gap: 14px 8px; padding: 19px 3px; }
  .stock-row .product-name { grid-column: 1/-1; }
  .material-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .material-card { min-height: 150px; padding: 15px; }
  .material-card h3 { margin-bottom: 22px; }
  .recipe-row { grid-template-columns: 1fr auto; gap: 8px; }
  .recipe-row p { grid-column: 1/-1; grid-row: 2; }
  .report-title .date-picker { display: block; margin-top: 24px; }
  .report-cards { grid-template-columns: 1fr 1fr; }
  .report-cards article { min-height: 155px; padding: 19px; }
  .report-cards article:nth-child(2) { border-right: 0; }
  .report-cards article.accent { grid-column: 1/-1; border-top: 1px solid var(--ink); }
  .report-sheet { padding: 18px 12px; }
  .sale-log-row { grid-template-columns: 68px minmax(0, 1fr) 72px; }
  .sale-log-row button { grid-column: 1/-1; text-align: right; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { min-height: 0; padding: 24px; }
  .bottom-nav { left: 8px; right: 8px; bottom: 8px; transform: none; height: 62px; }
  .bottom-nav button { width: auto; flex: 1; }
  .bottom-nav span { display: block; font: 700 13px var(--serif); }
  .bottom-nav b { display: block; margin-top: 2px; font-size: 9px; }
  .recipe-editor { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .product-grid, .material-grid { grid-template-columns: 1fr; }
  .product-card { min-height: 130px; }
}
