:root {
  color-scheme: light;
  --green: #087052;
  --green-dark: #052d24;
  --green-ink: #0c211b;
  --amber: #f7b83d;
  --canvas: #f3f7f5;
  --surface: #ffffff;
  --basket: #eaf2ef;
  --border: #9bafa7;
  --muted: #597069;
  --danger: #b83c2a;
  --shadow: 0 20px 70px rgba(2, 37, 28, .2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { overflow: hidden; color: var(--green-ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, select { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid #8fd6bc; outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.app-frame { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { min-height: 92px; display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 2.2vw, 34px); color: #fff; background: var(--green); }
.square-button { width: 62px; height: 62px; border: 1px solid #1b8469; border-radius: 18px; color: #fff; background: var(--green-dark); font-size: 30px; cursor: pointer; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; color: #16342a; background: var(--amber); font-size: 22px; font-weight: 900; }
.brand-mark.large { width: 70px; height: 70px; margin: 0 auto 18px; border-radius: 20px; font-size: 28px; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 25px; line-height: 1; }
.brand-copy span { max-width: 340px; overflow: hidden; color: #d4eee5; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.online-orders { min-width: 160px; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 18px; border: 1px solid #168a6c; border-radius: 16px; color: #fff; background: var(--green-dark); cursor: pointer; }
.online-orders span { color: #c8e6dc; font-size: 13px; }
.online-orders strong { color: var(--amber); font-size: 23px; }
.connection-status { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.connection-status i { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.connection-status[data-state="online"] i { background: #b8ed7d; }
.connection-status[data-state="offline"] i { background: #ff8e7c; }
.account-button { min-height: 44px; padding: 0 4px; border: 0; border-bottom: 1px solid rgba(255,255,255,.55); color: #fff; background: transparent; font-size: 13px; cursor: pointer; }

.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(360px, .72fr) minmax(0, 1.5fr); grid-template-areas: "basket catalog"; }
html[data-handedness="left"] .workspace { grid-template-columns: minmax(0, 1.5fr) minmax(360px, .72fr); grid-template-areas: "catalog basket"; }
.basket-panel { grid-area: basket; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--basket); }
html[data-handedness="left"] .basket-panel { border-right: 0; border-left: 1px solid var(--border); }
.basket-heading { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 22px; border-bottom: 1px solid #c2d0ca; }
.basket-heading span, .eyebrow { margin: 0; color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .11em; }
.basket-heading h2 { margin: 5px 0 0; font-size: 22px; text-transform: uppercase; }
.basket-heading select { max-width: 135px; min-height: 45px; padding: 0 34px 0 14px; border: 1px solid #99ada5; border-radius: 999px; color: var(--green); background: #f7fbf9; }
.basket-lines { min-height: 0; flex: 1; overflow: auto; }
.empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 30px; color: var(--muted); text-align: center; }
.empty-state span { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid #a5b9b1; border-radius: 50%; font-size: 28px; }
.empty-state p { max-width: 240px; margin: 0; font-size: 17px; }
.basket-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 17px 20px; border-bottom: 1px solid #c5d4ce; background: rgba(255,255,255,.34); }
.line-copy { min-width: 0; }
.line-copy strong { display: block; font-size: 16px; line-height: 1.25; }
.line-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.line-price { display: grid; justify-items: end; gap: 9px; }
.line-price > strong { color: var(--green); font-size: 17px; }
.quantity { display: flex; align-items: center; gap: 7px; }
.quantity button { width: 38px; height: 38px; border: 1px solid #8ea69d; border-radius: 10px; color: var(--green-dark); background: #fff; font-size: 19px; cursor: pointer; }
.quantity span { min-width: 25px; text-align: center; font-weight: 800; }
.basket-summary { padding: 16px 20px 20px; border-top: 1px solid #afc1ba; background: #f6faf8; }
.basket-summary dl { display: grid; gap: 6px; margin: 0 0 12px; }
.basket-summary dl div, .grand-total { display: flex; justify-content: space-between; gap: 20px; }
.basket-summary dt, .basket-summary dd { margin: 0; color: var(--muted); font-size: 14px; }
.grand-total { align-items: baseline; }
.grand-total span { font-size: 20px; font-weight: 900; }
.grand-total strong { color: #e69b0d; font-size: clamp(30px, 3vw, 43px); }
.basket-actions { display: grid; grid-template-columns: .6fr 1.4fr; gap: 10px; margin-top: 14px; }
.secondary-action, .primary-action, .danger-action { min-height: 58px; border: 0; border-radius: 14px; font-weight: 850; cursor: pointer; }
.secondary-action { border: 1px solid #91a69d; color: var(--green-dark); background: #fff; }
.primary-action { color: #16352a; background: var(--amber); }
.danger-action { color: #fff; background: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }

.catalog-panel { grid-area: catalog; min-width: 0; overflow: auto; padding: 20px; background: var(--canvas); }
.category-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.category-tabs button { min-height: 62px; padding: 10px; border: 1px solid var(--border); border-radius: 15px; color: var(--green-ink); background: #fff; font-weight: 750; cursor: pointer; }
.category-tabs button.active { border-color: var(--green); color: #fff; background: var(--green); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px; }
.product-tile { min-height: 172px; display: flex; flex-direction: column; align-items: flex-start; padding: 19px; border: 1px solid rgba(7,46,36,.34); border-radius: 20px; color: #102119; text-align: left; cursor: pointer; box-shadow: 0 4px 0 rgba(3,42,31,.12); transition: transform .12s ease, filter .12s ease; }
.product-tile:hover { transform: translateY(-2px); filter: brightness(1.035); }
.product-tile strong { font-size: 18px; line-height: 1.24; }
.product-tile small { margin-top: 7px; opacity: .7; font-size: 13px; }
.product-tile > span { margin-top: auto; font-size: 21px; }
.tone-lime { background: #9dcc4d; }
.tone-purple { color: #fff; background: #5f34ae; }
.tone-violet { color: #fff; background: #813bc8; }
.tone-amber { background: #f0b33c; }
.tone-blue { color: #fff; background: #2677a9; }
.tone-rose { color: #fff; background: #a84969; }

.drawer-layer { position: fixed; z-index: 40; inset: 0; display: flex; }
.drawer-layer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; border: 0; background: rgba(3, 22, 17, .7); backdrop-filter: blur(3px); }
.side-drawer { position: relative; width: min(430px, 92vw); height: 100dvh; display: flex; flex-direction: column; color: var(--green-ink); background: var(--surface); box-shadow: var(--shadow); animation: drawer-in .18s ease-out; }
html[data-handedness="left"] .drawer-layer { justify-content: flex-end; }
html[data-handedness="left"] .side-drawer { animation-name: drawer-in-left; }
.drawer-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 18px; color: #fff; background: var(--green); }
.drawer-header div { min-width: 0; display: grid; gap: 4px; }
.drawer-header strong, .drawer-header small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-header small { color: #d4eee5; }
.drawer-header > button { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.45); border-radius: 12px; color: #fff; background: transparent; font-size: 26px; cursor: pointer; }
.drawer-nav { min-height: 0; flex: 1; overflow: auto; padding: 10px; }
.drawer-nav > button { width: 100%; min-height: 62px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px 11px; border: 0; border-radius: 13px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.drawer-nav > button:hover { background: color-mix(in srgb, var(--green) 12%, transparent); }
.drawer-nav > button > span { color: var(--green); font-size: 24px; text-align: center; }
.drawer-nav > button div { display: grid; gap: 3px; }
.drawer-nav > button strong { font-size: 16px; }
.drawer-nav > button small { color: var(--muted); font-size: 12px; }
.drawer-nav > button > b { min-width: 27px; padding: 4px 7px; border-radius: 999px; color: #fff; background: var(--green); text-align: center; }
.drawer-nav hr { margin: 8px 10px; border: 0; border-top: 1px solid var(--border); }
.drawer-nav .drawer-danger > span, .drawer-nav .drawer-danger strong { color: var(--danger); }
.side-drawer footer { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes drawer-in-left { from { transform: translateX(100%); } }

.catalog-edit-mode .product-tile { position: relative; outline: 3px dashed rgba(255,255,255,.72); outline-offset: -8px; cursor: grab; }
.catalog-edit-mode .product-tile::after { content: "EDIT · DRAG"; position: absolute; top: 9px; right: 9px; padding: 4px 7px; border-radius: 999px; color: #fff; background: rgba(3,22,17,.72); font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.product-tile.dragging { opacity: .45; }
.product-tile.drag-target { outline-color: var(--amber); transform: scale(1.025); }

.activity-content { display: grid; gap: 10px; margin-top: 22px; }
.activity-empty { padding: 35px 20px; border: 1px dashed var(--border); border-radius: 16px; color: var(--muted); text-align: center; }
.activity-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 15px; border: 1px solid var(--border); border-radius: 15px; background: color-mix(in srgb, var(--surface) 88%, var(--green) 12%); }
.activity-row div { min-width: 0; display: grid; gap: 4px; }
.activity-row small { color: var(--muted); line-height: 1.4; }
.activity-row > strong { color: var(--green); font-size: 18px; }
.activity-row button { min-height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--green-ink); background: var(--surface); cursor: pointer; }
.activity-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.activity-actions button { min-height: 50px; padding: 0 18px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 24px; }
#product-dialog { width: min(960px, calc(100% - 32px)); }
.product-editor { width: 100%; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.editor-actions button, #copy-product { min-height: 48px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--green-ink); font-weight: 800; }
#copy-product { width: auto; height: auto; flex-shrink: 0; font-size: 13px; }
.product-editor .sheet-heading > div { min-width: 0; flex: 1; }
.product-editor .sheet-heading > button[value="cancel"] { flex-shrink: 0; }
.editor-hint { padding: 12px; border-radius: 10px; background: var(--surface); }
.modifier-editor-group { padding: 16px; border: 1px solid var(--border); border-radius: 12px; margin: 16px 0; }
.modifier-editor-group summary { font-weight: 800; cursor: pointer; }
.modifier-editor-option { margin: 14px 0; padding: 12px; border-left: 3px solid var(--border); }
.special-request-editor, .template-library label { display: grid; gap: 8px; margin: 16px 0; }
.special-request-editor textarea, .template-library input, .template-library select { padding: 12px; width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 10px; color: var(--green-ink); background: var(--surface); font: inherit; }
.editor-grid label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; }
.editor-grid input, .editor-grid select { width: 100%; min-height: 52px; padding: 0 13px; border: 1px solid var(--border); border-radius: 12px; color: var(--green-ink); background: var(--surface); }
.check-row { display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; cursor: pointer; }
.check-row input { width: 24px; height: 24px; accent-color: var(--green); }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: var(--muted); }
.editor-save { width: 100%; margin-top: 12px; }

.login-layer { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(3, 22, 17, .78); backdrop-filter: blur(7px); }
.login-layer[hidden] { display: none; }
.login-card { width: min(500px, 100%); padding: 36px; border: 1px solid #c4d3cd; border-radius: 26px; background: #fbfdfc; box-shadow: var(--shadow); }
.login-card .eyebrow { text-align: center; }
.login-card h1 { margin: 8px 0 10px; font-size: 34px; line-height: 1.05; text-align: center; }
.login-copy { margin: 0 auto 24px; color: var(--muted); line-height: 1.5; text-align: center; }
.login-card label { display: block; margin: 14px 0 7px; font-size: 14px; font-weight: 800; }
.login-card input { width: 100%; min-height: 58px; padding: 0 16px; border: 1px solid #8ea49b; border-radius: 13px; color: var(--green-ink); background: #fff; font-size: 18px; }
.otp-field input { text-align: center; letter-spacing: .35em; font-size: 26px; font-weight: 850; }
.login-submit { width: 100%; min-height: 60px; margin-top: 10px; border: 0; border-radius: 14px; color: #fff; background: var(--green); font-weight: 850; cursor: pointer; }
.text-button { width: 100%; margin-top: 14px; border: 0; color: var(--green); background: transparent; cursor: pointer; }
.login-card small { display: block; margin-top: 20px; color: #73847d; line-height: 1.45; text-align: center; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 14px; }

.sheet { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 24px; background: transparent; box-shadow: var(--shadow); }
.sheet::backdrop { background: rgba(3, 22, 17, .76); backdrop-filter: blur(5px); }
.sheet-card { max-height: calc(100dvh - 32px); overflow: auto; padding: 28px; border-radius: 24px; background: #f9fcfa; }
.sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.sheet-heading h2 { margin: 6px 0 0; font-size: 31px; }
.sheet-heading > button { width: 46px; height: 46px; border: 1px solid #a3b4ad; border-radius: 13px; color: var(--green-dark); background: #fff; font-size: 26px; cursor: pointer; }
.modifier-groups { display: grid; gap: 22px; margin-top: 24px; }
.modifier-group { padding-top: 20px; border-top: 1px solid #ccd8d3; }
.modifier-group:first-child { padding-top: 0; border-top: 0; }
.modifier-group header { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.modifier-group h3 { margin: 0; font-size: 17px; }
.modifier-group header span { color: var(--muted); font-size: 13px; }
.modifier-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.modifier-option { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid #9fb1aa; border-radius: 13px; color: var(--green-ink); background: #fff; text-align: left; cursor: pointer; }
.modifier-option.selected { border: 3px solid var(--green); background: #e5f3ed; }
.modifier-option small { color: var(--muted); }
.sheet-footer { position: sticky; bottom: -28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 24px -28px -28px; padding: 16px 28px 22px; border-top: 1px solid #bdccc6; background: #fff; }
.sheet-footer strong { color: var(--green); font-size: 28px; }
.sheet-footer button { min-width: 250px; }
.amount-due { display: flex; align-items: center; justify-content: space-between; margin: 24px 0; padding: 22px; border-radius: 18px; color: #fff; background: var(--green); }
.amount-due span { font-size: 12px; font-weight: 850; letter-spacing: .1em; }
.amount-due strong { color: #fff; font-size: 42px; }
.checkout-card fieldset { padding: 0; border: 0; }
.checkout-card legend { margin-bottom: 10px; font-weight: 850; }
.payment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.payment-option { min-height: 110px; padding: 14px; border: 1px solid #9cafA7; border-radius: 15px; color: var(--green-ink); background: #fff; cursor: pointer; }
.payment-option.selected { border: 3px solid var(--green); background: #e5f3ed; }
.payment-option strong, .payment-option small { display: block; }
.payment-option small { margin-top: 6px; color: var(--muted); }
.pay-later-panel { display: grid; gap: 8px; margin-top: 18px; font-weight: 850; }
.pay-later-panel[hidden] { display: none; }
.pay-later-panel select { min-height: 54px; padding: 0 14px; border: 1px solid #94aaa1; border-radius: 13px; color: var(--green-ink); background: #fff; }
.checkout-note { color: var(--muted); font-size: 14px; line-height: 1.45; }
.confirm-payment { width: 100%; margin-top: 8px; }
.setting-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid #cad7d1; }
.setting-block h3 { margin: 0 0 7px; }
.setting-block p { margin: 0 0 13px; color: var(--muted); line-height: 1.5; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.segmented button { min-height: 54px; border: 1px solid #94aaa1; border-radius: 13px; color: var(--green-dark); background: #fff; cursor: pointer; }
.segmented button.active { border-color: var(--green); color: #fff; background: var(--green); }
.setting-block > button { min-width: 220px; }

.success-toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 440px; padding: 17px 20px; border-radius: 15px; color: #fff; background: var(--green-dark); box-shadow: var(--shadow); line-height: 1.4; }
.print-sheet { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --green-ink: #edf7f3;
  --canvas: #101915;
  --surface: #16231e;
  --basket: #14251f;
  --border: #4b655b;
  --muted: #a9bbb4;
  --shadow: 0 20px 70px rgba(0, 0, 0, .48);
}
html[data-theme="dark"] .basket-heading,
html[data-theme="dark"] .basket-line,
html[data-theme="dark"] .basket-summary,
html[data-theme="dark"] .sheet-card,
html[data-theme="dark"] .login-card { background: var(--surface); }
html[data-theme="dark"] .basket-heading,
html[data-theme="dark"] .basket-line,
html[data-theme="dark"] .basket-summary,
html[data-theme="dark"] .setting-block,
html[data-theme="dark"] .modifier-group { border-color: var(--border); }
html[data-theme="dark"] .category-tabs button,
html[data-theme="dark"] .quantity button,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .segmented button,
html[data-theme="dark"] .modifier-option,
html[data-theme="dark"] .payment-option,
html[data-theme="dark"] .sheet-heading > button,
html[data-theme="dark"] .login-card input,
html[data-theme="dark"] .pay-later-panel select,
html[data-theme="dark"] .basket-heading select { color: var(--green-ink); background: #20322b; border-color: var(--border); }
html[data-theme="dark"] .modifier-option.selected,
html[data-theme="dark"] .payment-option.selected { background: #173e31; }
html[data-theme="dark"] .sheet-footer { background: #1b2d26; border-color: var(--border); }

@media (max-width: 900px) {
  .topbar { min-height: 76px; gap: 10px; padding: 8px 12px; }
  .square-button, .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
  .brand-copy strong { font-size: 20px; }
  .brand-copy span, .online-orders span { display: none; }
  .online-orders { min-width: 64px; min-height: 52px; justify-content: center; padding: 6px; }
  .connection-status b { display: none; }
  .workspace, html[data-handedness="left"] .workspace { grid-template-columns: minmax(300px, .76fr) minmax(540px, 1.4fr); }
  .catalog-panel { padding: 14px; }
  .product-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}

@media (max-width: 680px) {
  body { overflow: auto; }
  .app-frame { min-width: 0; }
  .brand-copy span { display: block; max-width: 150px; }
  .online-orders { margin-left: auto; }
  .account-button { display: none; }
  .workspace, html[data-handedness="left"] .workspace { display: flex; flex-direction: column; }
  .catalog-panel { order: 1; overflow: visible; }
  .basket-panel, html[data-handedness="left"] .basket-panel { order: 2; min-height: 480px; border: 0; border-top: 1px solid var(--border); }
  .category-tabs { display: flex; overflow: auto; }
  .category-tabs button { min-width: 130px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-tile { min-height: 145px; padding: 15px; }
  .login-card { padding: 28px 22px; }
  .modifier-options, .payment-grid { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
  .sheet-footer { align-items: stretch; flex-direction: column; }
  .sheet-footer button { min-width: 0; }
}

@media print {
  body > * { display: none !important; }
  body > .print-sheet { display: block !important; color: #000; background: #fff; font: 12pt/1.35 ui-monospace, monospace; }
  .print-sheet h1 { margin: 0 0 4mm; font-size: 17pt; text-align: center; }
  .print-sheet .print-centre { text-align: center; }
  .print-sheet hr { margin: 4mm 0; border: 0; border-top: 1px dashed #000; }
  .print-sheet table { width: 100%; border-collapse: collapse; }
  .print-sheet td { padding: 1.5mm 0; vertical-align: top; }
  .print-sheet td:last-child { text-align: right; }
  .print-sheet .print-total { font-size: 15pt; font-weight: 900; }
  @page { size: 80mm auto; margin: 8mm 5mm 0; }
}
