:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17231f;
  background: #f2f5f2;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(circle at 20% -10%, #e5f2eb 0, transparent 34%), #f2f5f2; }
button, input, select { font: inherit; }
button { cursor: pointer; }
input, select { min-width: 0; border: 1px solid #d8dfda; border-radius: 11px; padding: 12px 13px; color: #17231f; background: #fff; outline: none; }
input:focus, select:focus { border-color: #08775e; box-shadow: 0 0 0 3px #08775e1c; }
button:disabled { cursor: not-allowed; opacity: .58; }
.eyebrow { margin: 0 0 6px; color: #08775e; font-size: 12px; font-weight: 900; letter-spacing: .17em; }
.muted { color: #6d7873; }
.error { color: #c93f30 !important; }
.success { color: #08775e !important; }
.form-message { min-height: 22px; margin: 13px 0 0; font-size: 14px; line-height: 1.5; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(380px, 560px); align-items: center; gap: 7vw; padding: 7vw; background: linear-gradient(120deg, #0b342c 0 48%, transparent 48%), radial-gradient(circle at 85% 20%, #d8f04f45, transparent 30%), #eef3ef; }
.login-brand { align-self: start; display: flex; align-items: center; gap: 14px; color: #fff; }
.login-brand strong, .app-brand strong { display: block; font-size: 20px; }
.login-brand small, .app-brand small { display: block; margin-top: 2px; font-size: 9px; letter-spacing: .17em; opacity: .64; }
.brand-mark { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; color: #17342e; background: #d8f04f; font-weight: 950; letter-spacing: -.06em; }
.login-card { width: 100%; padding: 44px; border: 1px solid #e0e7e2; border-radius: 26px; background: #fffffffff2; box-shadow: 0 30px 90px #13251f1c; backdrop-filter: blur(8px); }
.login-card h1 { margin: 4px 0 8px; font-size: 38px; letter-spacing: -.045em; }
.login-card > label { display: grid; gap: 7px; margin: 19px 0; color: #45504b; font-size: 14px; font-weight: 650; }
.login-card button, .checkout-card > button, .create-user-form button[type="submit"] { width: 100%; min-height: 50px; border: 0; border-radius: 12px; color: #17342e; background: #d8f04f; font-weight: 900; }

.app-header { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 270px 1fr auto; align-items: center; gap: 28px; min-height: 78px; padding: 0 max(24px, calc((100vw - 1720px) / 2)); border-bottom: 1px solid #dce3de; background: #ffffffed; backdrop-filter: blur(16px); }
.app-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.app-brand .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
nav { justify-self: center; display: flex; gap: 6px; padding: 5px; border-radius: 13px; background: #eef2ef; }
nav button { border: 0; border-radius: 9px; padding: 9px 17px; color: #68736e; background: transparent; font-weight: 750; }
nav button.active { color: #fff; background: #0d493d; box-shadow: 0 5px 14px #0d493d24; }
.account-area { display: flex; align-items: center; justify-content: flex-end; gap: 13px; }
.account-area > div:first-child { text-align: right; }
.account-area strong, .account-area small { display: block; }
.account-area small { color: #7a847f; font-size: 11px; }
.balance-pill { padding: 9px 13px; border-radius: 10px; color: #0a654f; background: #e7f5ef; font-weight: 850; }
.icon-button { border: 1px solid #dce3de; border-radius: 10px; padding: 9px 12px; color: #55605b; background: #fff; }

main { width: min(1720px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 80px; }
.page-view > .page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 5px 0; font-size: clamp(30px, 4vw, 52px); line-height: 1.08; letter-spacing: -.045em; }
.page-heading p:last-child { margin: 8px 0 0; }
.secondary, .primary-small, .danger-small { border-radius: 10px; padding: 10px 15px; font-weight: 800; }
.secondary { border: 1px solid #d8dfda; color: #08775e; background: #fff; }
.primary-small { border: 0; color: #fff; background: #08775e; }
.danger-small { border: 1px solid #efc4be; color: #b93629; background: #fff5f3; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-grid article { padding: 17px 19px; border: 1px solid #dfe5e0; border-radius: 15px; background: #fff; }
.summary-grid span, .summary-grid small, .summary-grid strong { display: block; }
.summary-grid span { color: #6d7873; font-size: 13px; }
.summary-grid strong { margin: 7px 0 3px; font-size: 25px; }
.summary-grid small { color: #89928e; }

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 220px 160px auto; gap: 12px; margin-bottom: 16px; }
.toolbar input, .toolbar select { min-height: 48px; }
#count { align-self: center; min-width: 58px; color: #69736f; text-align: right; }
.shop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: start; gap: 28px; }
.products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.product-card { position: relative; display: grid; gap: 8px; min-height: 185px; padding: 18px 18px 18px 50px; border: 1px solid #dfe5e0; border-radius: 16px; color: inherit; background: #fff; text-align: left; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.product-card:not(:disabled):hover { transform: translateY(-2px); border-color: #9ab7ad; }
.product-card.active { border-color: #08775e; box-shadow: 0 0 0 2px #08775e; }
.product-card:disabled { cursor: default; opacity: 1; padding-left: 18px; }
.product-card strong { align-self: start; min-height: 44px; line-height: 1.45; }
.product-card small { padding-right: 48px; color: #76807b; }
.check { position: absolute; left: 16px; top: 17px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #b8c4bf; border-radius: 6px; color: #08775e; font-weight: 900; }
.product-card.active .check { color: #fff; border-color: #08775e; background: #08775e; }
.tag { position: absolute; right: 14px; top: 14px; padding: 4px 8px; border-radius: 999px; color: #08775e; background: #e6f5ef; font-size: 12px; }
.meta { color: #68736e; }
.prices { align-self: end; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price { color: #c44a26; font-size: 23px; font-weight: 900; }
.prices del { color: #8b9590; font-size: 13px; }
aside { position: sticky; top: 98px; }
.checkout-card { padding: 25px; border-radius: 20px; color: #fff; background: #123a32; box-shadow: 0 20px 50px #17352e24; }
.checkout-heading { display: block; }
.checkout-card h2 { margin: 0 0 17px; font-size: 25px; }
.mobile-checkout-close, .mobile-checkout-backdrop, .mobile-cart { display: none; }
.checkout-card > label { display: grid; gap: 7px; margin: 16px 0; color: #d8e2de; font-size: 14px; }
.input-suffix { position: relative; display: block; }
.input-suffix input { width: 100%; padding-right: 82px; }
.input-suffix b { position: absolute; right: 13px; top: 13px; color: #71807a; font-weight: 500; }
.selected { min-height: 72px; display: grid; gap: 12px; padding: 14px; border-radius: 12px; color: #d8e0dd; background: #ffffff0d; }
.empty-selection { display: block; }
.selected-list { display: grid; gap: 10px; }
.selected-list div, .selected-total { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; min-width: 0; }
.selected-list span { min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.selected-list b { flex: none; }
.selected-total { padding-top: 12px; border-top: 1px solid #ffffff25; color: #fff; }

.panel { margin-bottom: 18px; padding: 22px; border: 1px solid #dde4df; border-radius: 17px; background: #fff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0 0 4px; }
.panel-heading p { margin: 0; color: #737d78; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1fr 150px; align-items: end; gap: 12px; }
.form-grid label { display: grid; gap: 7px; color: #4d5853; font-size: 13px; font-weight: 700; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading { padding: 21px 22px 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 16px; border-bottom: 1px solid #e4e9e5; text-align: left; vertical-align: top; }
th { color: #69736f; background: #f6f8f6; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
td { font-size: 14px; }
td small { display: block; margin-top: 5px; color: #7b8580; }
td input { width: 150px; padding: 9px 10px; }
.user-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.user-actions .secondary { min-height: 38px; padding: 8px 12px; }
.switch { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.switch input { width: auto; }
.order-filters { display: grid; grid-template-columns: 1fr 220px 220px auto; gap: 12px; }
.orders-table code { display: block; color: #0a654f; font-weight: 800; }
.order-products { display: grid; gap: 4px; max-width: 430px; }
.order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: max-content; }
.order-action { border: 0; padding: 2px 0; color: #08775e; background: transparent; font-weight: 750; white-space: nowrap; }
.order-action:hover { text-decoration: underline; }
.order-action-danger { color: #b93629; }
.order-action-placeholder { color: #89928e; }
.order-message-row > td { padding: 0; background: #fbfcfb; }
.order-message-content { padding: 26px 30px 32px; border-top: 3px solid #dce8e2; }
.order-message-loading { padding: 28px; color: #6d7873; text-align: center; }
.order-message-frame { display: block; width: 100%; min-height: 240px; border: 0; background: #fff; }
.status { display: inline-block; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 850; white-space: nowrap; }
.status-succeeded { color: #08775e; background: #e3f3ed; }
.status-processing, .status-cancelling { color: #765315; background: #fff1c9; }
.status-needs_review, .status-cancel_review { color: #a54828; background: #ffebe2; }
.status-failed { color: #9c3025; background: #f9e3df; }
.status-cancelled { color: #66716c; background: #e9eeeb; }
.empty { padding: 30px; color: #6b7671; text-align: center; }

.ledger-dialog { width: min(820px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 22px; color: #18202a; background: #f5f7f5; box-shadow: 0 30px 100px #071c1845; overflow: hidden; }
.ledger-dialog::backdrop { background: #102924a6; backdrop-filter: blur(6px); }
.ledger-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px 28px 18px; background: #fff; }
.ledger-dialog-header h2 { margin: 3px 0 0; font-size: 25px; }
.ledger-dialog-header .eyebrow { margin: 0; }
.dialog-close { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; color: #52605a; background: #edf1ee; font-size: 26px; line-height: 1; }
.ledger-summary { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 28px 18px; background: #fff; }
.ledger-summary span { padding: 9px 12px; border-radius: 10px; color: #64706b; background: #f1f5f2; font-size: 13px; }
.ledger-summary strong { margin-left: 5px; color: #12372f; }
.ledger-timeline { position: relative; display: grid; gap: 14px; max-height: calc(100vh - 205px); padding: 22px 28px 30px 50px; overflow-y: auto; }
.ledger-timeline::before { position: absolute; top: 24px; bottom: 30px; left: 33px; width: 2px; background: #d6e0db; content: ""; }
.ledger-entry { position: relative; padding: 18px; border: 1px solid #dfe6e2; border-radius: 15px; background: #fff; box-shadow: 0 5px 16px #17372e0a; }
.ledger-dot { position: absolute; top: 22px; left: -24px; width: 12px; height: 12px; border: 3px solid #f5f7f5; border-radius: 50%; background: #08775e; box-shadow: 0 0 0 2px #08775e; }
.ledger-debit .ledger-dot { background: #c44a26; box-shadow: 0 0 0 2px #c44a26; }
.ledger-entry-head, .ledger-entry-head > div { display: flex; align-items: center; gap: 12px; }
.ledger-entry-head { justify-content: space-between; }
.ledger-entry-head time { color: #7b8580; font-size: 12px; }
.ledger-amount { color: #08775e; font-size: 20px; white-space: nowrap; }
.ledger-debit .ledger-amount { color: #c44a26; }
.ledger-balances { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.ledger-balances span { padding: 7px 9px; border-radius: 8px; color: #6d7873; background: #f3f6f4; font-size: 12px; }
.ledger-note { margin: 11px 0 0; color: #64706b; font-size: 13px; }
.ledger-order-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 13px; padding-top: 12px; border-top: 1px dashed #dce3df; color: #65716c; font-size: 12px; }
.ledger-products { display: grid; gap: 7px; margin-top: 10px; }
.ledger-products > div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 12px; border-radius: 9px; background: #f7f9f7; }
.ledger-products span { min-width: 0; }
.ledger-products span:last-child { flex: none; text-align: right; }
.ledger-products strong, .ledger-products b { display: block; font-size: 13px; }
.ledger-products small { display: block; margin-top: 3px; color: #7b8580; font-size: 11px; }

.confirm-dialog { width: min(540px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 24px; color: #18202a; background: #fff; box-shadow: 0 30px 100px #071c1845; overflow: hidden; }
.confirm-dialog::backdrop { background: #102924a6; backdrop-filter: blur(6px); }
.confirm-dialog[data-mode="cancel"] .confirm-accent { background: linear-gradient(90deg, #b4372a, #ea745d); }
.confirm-dialog[data-mode="cancel"] .confirm-icon { color: #fff; background: #c94c3b; }
.confirm-dialog[data-mode="cancel"] .confirm-submit { background: #b93e30; box-shadow: 0 8px 20px #b93e3035; }
.confirm-accent { height: 7px; background: linear-gradient(90deg, #08775e, #50b88f 58%, #d8f04f); }
.confirm-content { padding: 30px; }
.confirm-heading { display: flex; align-items: center; gap: 16px; }
.confirm-icon { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 15px; color: #17342e; background: #d8f04f; font-size: 24px; font-weight: 900; }
.confirm-eyebrow { margin: 0 0 3px; color: #08775e; font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.confirm-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.confirm-warning { margin: 22px 0 18px; padding: 13px 15px; border-radius: 12px; color: #75511a; background: #fff5d9; font-size: 14px; line-height: 1.55; }
.confirm-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0 0 15px; }
.confirm-facts div { padding: 12px; border: 1px solid #e3e8e4; border-radius: 11px; background: #f7f9f7; }
.confirm-facts dt { margin-bottom: 5px; color: #78817d; font-size: 11px; }
.confirm-facts dd { margin: 0; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.confirm-items { display: grid; gap: 9px; max-height: 220px; padding: 14px; overflow-y: auto; border: 1px solid #e3e8e4; border-radius: 13px; }
.confirm-items div { display: flex; justify-content: space-between; gap: 18px; font-size: 14px; }
.confirm-items b { flex: none; }
.confirm-total { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0; }
.confirm-total span { color: #69736f; }
.confirm-total strong { color: #c44a26; font-size: 30px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.confirm-actions button { min-height: 50px; border: 0; border-radius: 13px; font-weight: 850; }
.confirm-cancel { color: #46504c; background: #edf1ee; }
.confirm-submit { color: #fff; background: #08775e; box-shadow: 0 8px 20px #08775e35; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 48px)); padding: 14px 18px; border-radius: 12px; color: #fff; background: #08775e; box-shadow: 0 14px 40px #152b2538; font-weight: 700; }
.toast-error { background: #b84133; }

@media (max-width: 1300px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid button { align-self: end; }
}

@media (max-width: 1050px) {
  .app-header { grid-template-columns: 1fr auto; padding: 12px 20px; }
  .app-header nav { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .shop-layout { display: block; }
  #view-shop { padding-bottom: 92px; }
  #checkout-panel { position: fixed; z-index: 70; inset: auto 0 0; width: 100%; max-height: 92dvh; padding: 0 12px max(12px, env(safe-area-inset-bottom)); transform: translateY(110%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
  .checkout-open #checkout-panel { transform: translateY(0); pointer-events: auto; }
  .checkout-card { width: min(620px, 100%); max-height: calc(92dvh - max(12px, env(safe-area-inset-bottom))); margin: 0 auto; padding: 22px; border-radius: 24px 24px 16px 16px; overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 -18px 60px #071c1852; }
  .checkout-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .checkout-card h2 { margin: 0; }
  .mobile-checkout-close { display: grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; border: 1px solid #ffffff20; border-radius: 50%; color: #fff; background: #ffffff12; font-size: 28px; line-height: 1; }
  .mobile-checkout-backdrop { position: fixed; z-index: 60; inset: 0; display: block; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; background: #071c1899; backdrop-filter: blur(4px); transition: opacity .2s ease; pointer-events: none; }
  .checkout-open .mobile-checkout-backdrop { opacity: 1; pointer-events: auto; }
  .checkout-open { overflow: hidden; }
  .mobile-cart { position: fixed; z-index: 45; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 66px; padding: 9px 10px 9px 18px; border: 1px solid #ffffff2e; border-radius: 18px; color: #fff; background: #123a32f5; box-shadow: 0 14px 45px #102b2545; backdrop-filter: blur(14px); text-align: left; }
  .mobile-cart span, .mobile-cart small, .mobile-cart strong { display: block; }
  .mobile-cart span { min-width: 0; }
  .mobile-cart small { margin-bottom: 3px; color: #b9c9c3; font-size: 11px; }
  .mobile-cart strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-cart b { flex: none; padding: 13px 16px; border-radius: 12px; color: #17342e; background: #d8f04f; font-size: 14px; }
  .mobile-cart:disabled { opacity: .9; }
  .mobile-cart:disabled b { color: #758079; background: #dfe5e1; }
  .order-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { background: radial-gradient(circle at 10% -5%, #deeee6 0, transparent 28%), #f2f5f2; }
  .login-view { display: flex; flex-direction: column; justify-content: center; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 85% 12%, #d8f04f45, transparent 28%), #eef3ef; }
  .login-brand { align-self: auto; margin: 0 8px 32px; color: #17342e; }
  .login-brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
  .login-card { padding: 28px 22px; border-radius: 22px; box-shadow: 0 22px 60px #13251f17; }
  .login-card h1 { font-size: 32px; }
  .login-card > label { margin: 16px 0; }
  input, select { min-height: 46px; font-size: 16px; }
  .app-header { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; min-height: 0; padding: max(10px, env(safe-area-inset-top)) 12px 9px; }
  .app-brand { min-width: 0; gap: 8px; }
  .app-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }
  .app-brand strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .app-brand small { display: none; }
  .account-area > div:first-child { display: none; }
  .account-area { gap: 6px; }
  .balance-pill { max-width: 128px; padding: 8px 9px; overflow: hidden; font-size: 0; text-overflow: ellipsis; white-space: nowrap; }
  .balance-pill::after { font-size: 12px; content: attr(data-compact); }
  .icon-button { min-height: 36px; padding: 7px 9px; font-size: 12px; }
  .app-header nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; overflow: visible; }
  nav button { min-height: 40px; padding: 8px 6px; font-size: 13px; white-space: nowrap; }
  main { width: min(100% - 24px, 720px); padding: 24px 0 108px; }
  .page-view > .page-heading { align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  #view-shop > .page-heading { flex-direction: column; }
  #view-shop > .page-heading .secondary { align-self: flex-end; margin-top: -4px; }
  .page-heading h1 { font-size: 30px; }
  .page-heading p:last-child { font-size: 13px; line-height: 1.55; }
  .page-heading .secondary { flex: none; min-width: 54px; min-height: 42px; padding: 9px 10px; font-size: 0; }
  .page-heading .secondary::after { font-size: 13px; content: "刷新"; }
  .summary-grid { display: flex; gap: 10px; margin: 0 -12px 16px; padding: 0 12px 2px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
  .summary-grid::-webkit-scrollbar { display: none; }
  .summary-grid article { flex: 0 0 min(72vw, 230px); padding: 14px 16px; scroll-snap-align: start; }
  .summary-grid strong { font-size: 21px; }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .toolbar input { grid-column: 1 / -1; }
  .toolbar input, .toolbar select { min-height: 46px; }
  #count { grid-column: 1 / -1; min-width: 0; padding: 0 2px; font-size: 12px; text-align: left; }
  .products { grid-template-columns: 1fr; gap: 10px; }
  .product-card { gap: 6px; min-height: 0; padding: 15px 14px 15px 46px; border-radius: 15px; }
  .product-card:active { transform: scale(.992); }
  .product-card strong { min-height: 0; padding-right: 4px; font-size: 15px; }
  .product-card small { padding-right: 44px; }
  .check { left: 14px; top: 15px; width: 21px; height: 21px; }
  .tag { right: 12px; top: 12px; }
  .price { font-size: 21px; }
  .mobile-cart { min-height: 64px; border-radius: 17px; }
  .mobile-cart b { padding: 12px 13px; font-size: 13px; }
  .checkout-card { max-height: calc(92dvh - max(10px, env(safe-area-inset-bottom))); padding: 20px 18px; border-radius: 23px 23px 13px 13px; }
  .checkout-card h2 { font-size: 22px; }
  .checkout-card > label { margin: 13px 0; }
  .selected { max-height: 27dvh; overflow-y: auto; }
  .selected-list div { font-size: 13px; }
  .panel { padding: 17px 15px; border-radius: 16px; }
  .page-heading, .panel-heading { align-items: flex-start !important; }
  .panel-heading { gap: 12px; margin-bottom: 14px; }
  .panel-heading h2 { font-size: 21px; }
  .panel-heading p { font-size: 12px; line-height: 1.5; }
  .form-grid, .order-filters { grid-template-columns: 1fr; }
  .form-grid { gap: 10px; }
  .create-user-form button[type="submit"] { margin-top: 2px; }
  .order-filters { gap: 9px; }
  .order-filters .primary-small { min-height: 46px; }
  .table-panel { border: 0; background: transparent; overflow: visible; }
  .table-panel > .panel-heading { margin-bottom: 10px; padding: 17px 15px; border: 1px solid #dde4df; border-radius: 16px; background: #fff; }
  .table-scroll { overflow: visible; }
  .table-scroll table, .table-scroll tbody { display: block; width: 100%; }
  .table-scroll thead { display: none; }
  .table-scroll tr { display: grid; margin-bottom: 10px; padding: 4px 14px; border: 1px solid #dde4df; border-radius: 16px; background: #fff; box-shadow: 0 6px 20px #17372e08; }
  .table-scroll td { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: 10px; padding: 11px 0; border-bottom: 1px solid #e8ece9; overflow-wrap: anywhere; }
  .table-scroll td::before { color: #7b8580; font-size: 12px; font-weight: 700; content: attr(data-label); }
  .table-scroll td:last-child { border-bottom: 0; }
  .table-scroll td.empty { display: block; padding: 28px 8px; }
  .table-scroll td.empty::before { display: none; }
  .table-scroll td input { width: 100%; }
  .user-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); white-space: normal; }
  .user-actions button { width: 100%; }
  .switch { min-height: 38px; }
  .order-products { max-width: none; }
  .order-actions { min-width: 0; gap: 8px 14px; }
  .order-action { min-height: 34px; padding: 5px 0; font-size: 14px; }
  .table-scroll tr.order-message-row { margin-top: -11px; padding: 0; border-top: 0; border-radius: 0 0 16px 16px; box-shadow: 0 10px 22px #17372e0c; }
  .table-scroll .order-message-row td { display: block; padding: 0; border: 0; }
  .table-scroll .order-message-row td::before { display: none; }
  .order-message-content { padding: 18px 14px 22px; border-top-width: 2px; }
  .orders-table code { font-size: 12px; overflow-wrap: anywhere; }
  .confirm-dialog, .ledger-dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .confirm-content { max-height: calc(92dvh - 7px); padding: 22px 18px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .confirm-heading { gap: 13px; }
  .confirm-heading h2 { font-size: 22px; }
  .confirm-warning { margin: 18px 0 14px; }
  .confirm-facts, .confirm-actions { grid-template-columns: 1fr; }
  .confirm-items { max-height: 24dvh; }
  .confirm-actions { position: sticky; bottom: 0; margin: 0 -4px -4px; padding-top: 10px; background: #fff; }
  .confirm-submit { grid-row: 1; }
  .confirm-cancel { grid-row: 2; }
  .ledger-dialog-header { padding: 21px 20px 16px; }
  .ledger-summary { padding: 0 20px 16px; }
  .ledger-timeline { max-height: calc(92dvh - 185px); padding: 18px 18px max(24px, env(safe-area-inset-bottom)) 40px; }
  .ledger-timeline::before { left: 26px; }
  .ledger-entry-head, .ledger-entry-head > div, .ledger-products > div { align-items: flex-start; flex-direction: column; }
  .ledger-products span:last-child { text-align: left; }
  .toast { right: 12px; bottom: 92px; max-width: calc(100% - 24px); }
  .checkout-open .toast { bottom: 18px; }
}

@media (max-width: 390px) {
  .balance-pill { max-width: 108px; }
  .page-heading h1 { font-size: 29px; }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-cart { padding-left: 14px; }
  .mobile-cart b { padding-right: 10px; padding-left: 10px; }
  .table-scroll td { grid-template-columns: 76px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
