:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  background: #f5f4ef;
  color: #183039;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #65a682;
  outline-offset: 2px;
}
input, select, textarea { min-height: 48px; border: 1px solid #d8ded9; border-radius: 12px; color: #183039; background: #fff; padding: 10px 13px; }
textarea { resize: vertical; min-height: 80px; }
input::placeholder { color: #87958f; }
input[type="radio"] { min-height: 0; accent-color: #196557; }
label { font-weight: 700; }
small, .muted { color: #687b78; }
button, .product-card, .nav-item { touch-action: manipulation; }

.shell { display: grid; grid-template-columns: 88px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100vh; padding: 21px 11px 14px; background: #142a32; color: #e7efe9; z-index: 20; }
.brand-mark { display: grid; place-items: center; width: 51px; height: 51px; border-radius: 16px; margin-bottom: 29px; background: #d5ed87; color: #142a32; font-size: 22px; font-weight: 900; letter-spacing: -3px; padding-right: 3px; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 66px; min-height: 70px; border: 0; border-radius: 15px; background: transparent; color: #a9bcb9; font-size: 11px; font-weight: 700; white-space: nowrap; }
.nav-item svg { width: 24px; height: 24px; stroke-width: 1.9; }
.nav-item:hover { color: #fff; background: #24414a; }
.nav-item.active { color: #142a32; background: #d5ed87; }
.rail-spacer { flex: 1; }
.rail .logout { color: #e7efe9; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 89px; padding: 18px 30px; border-bottom: 1px solid #e3e7e0; background: #fbfbf8; }
.topbar h1 { margin: 2px 0 0; font-size: clamp(24px, 2vw, 30px); letter-spacing: -.04em; line-height: 1.15; }
.eyebrow { display: block; color: #657a76; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.top-meta { display: flex; align-items: center; gap: 12px; }
.date-label { color: #657a76; font-size: 13px; font-weight: 700; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 33px; padding: 5px 11px; border: 1px solid #b9d7c5; border-radius: 999px; background: #ebf8ef; color: #2c7050; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.offline { border-color: #edc7b5; background: #fff0e9; color: #b85137; }
.content { padding: 26px 30px 40px; max-width: 1600px; margin: 0 auto; }
.banner { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 13px; margin-bottom: 20px; font-size: 13px; font-weight: 700; }
.banner svg { width: 20px; height: 20px; flex: 0 0 auto; }
.banner.warn { background: #fff2e3; color: #986130; border: 1px solid #efd1ad; }
.banner.info { background: #ecf4f3; color: #37645b; border: 1px solid #c6ded8; }
.banner.error { background: #ffefea; color: #a74235; border: 1px solid #edc1ba; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { font-size: 19px; letter-spacing: -.03em; margin: 0 0 3px; }
.section-head p { margin: 0; color: #71817b; font-size: 13px; }
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 11px; border: 1px solid transparent; padding: 10px 15px; font-size: 13px; font-weight: 800; white-space: nowrap; transition: transform .15s ease, background .15s ease; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn-primary { color: #fff; background: #176351; }
.btn-primary:hover:not(:disabled) { background: #0f5041; }
.btn-dark { color: #fff; background: #183039; }
.btn-dark:hover:not(:disabled) { background: #2d4850; }
.btn-soft { color: #205647; background: #e8f1eb; border-color: #d2e4d8; }
.btn-soft:hover:not(:disabled) { background: #dcece0; }
.btn-outline { color: #26443f; background: #fff; border-color: #cfd9d4; }
.btn-outline:hover:not(:disabled) { background: #f4f8f5; }
.btn-danger { color: #a83d35; background: #fff4f2; border-color: #efcfca; }
.btn-danger:hover:not(:disabled) { background: #ffeae5; }
.btn-lg { min-height: 54px; padding: 13px 19px; font-size: 15px; }
.btn-block { width: 100%; }
.card { background: #fff; border: 1px solid #e3e8e2; border-radius: 18px; box-shadow: 0 4px 16px rgba(28, 52, 49, .035); }

.pos-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 382px; gap: 19px; align-items: start; }
.catalog { min-width: 0; }
.search-box { display: flex; align-items: center; gap: 9px; height: 55px; border: 1px solid #dce4df; border-radius: 14px; background: #fff; padding: 0 15px; box-shadow: 0 3px 13px rgba(23, 50, 46, .025); }
.search-box svg { width: 20px; height: 20px; flex: 0 0 auto; color: #70857f; }
.search-box input { width: 100%; min-height: 0; border: 0; outline: 0; padding: 0; box-shadow: none; background: transparent; font-size: 15px; }
.scan-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 16px; }
.scan-row .search-box { border-color: #9ec5ae; background: #f9fffb; }
.scan-row .search-box:focus-within { box-shadow: 0 0 0 3px #cee9d6; }
.scan-row .btn { min-width: 92px; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 25px 1px 15px; }
.catalog-toolbar h2 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.count-label { font-size: 12px; font-weight: 800; color: #84918b; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px; }
.category-card-wrap { position: relative; min-width: 0; }
.category-card { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 150px; border: 1px solid #dce7de; border-radius: 17px; padding: 17px; background: #fff; color: #183039; text-align: left; box-shadow: 0 3px 12px rgba(22, 47, 41, .025); }
.category-card:hover:not(:disabled) { border-color: #7fb596; background: #fbfffb; }
.category-card-wrap.editable .category-card { min-height: 178px; padding-bottom: 55px; }
.category-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #e7f1e8; color: #39715c; }
.category-icon svg { width: 21px; height: 21px; }
.category-card strong { margin-top: 12px; font-size: 16px; font-weight: 900; }
.category-card small { margin-top: 3px; font-size: 12px; }
.category-arrow { position: absolute; top: 24px; right: 18px; color: #77958a; }
.category-arrow svg { width: 19px; height: 19px; }
.category-rename { position: absolute; left: 17px; bottom: 10px; min-height: 40px; border: 0; border-radius: 9px; padding: 6px 10px; background: #eef5ef; color: #176351; font-size: 11px; font-weight: 900; }
.category-trail { display: flex; align-items: center; gap: 13px; margin: 0 0 16px; color: #6c8278; font-size: 13px; font-weight: 700; }
.category-trail strong { color: #1f5948; font-size: 15px; }
.category-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 13px; }
.product-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 153px; border: 1px solid #e2e8e0; border-radius: 17px; padding: 17px; text-align: left; background: #fff; color: #183039; box-shadow: 0 3px 12px rgba(22, 47, 41, .025); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.product-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #a6ceb7; box-shadow: 0 9px 20px rgba(22, 47, 41, .075); }
.product-card.out { background: #f9f9f7; }
.product-card.short-stock { border-color: #e6d4b8; background: #fffcf6; }
.product-initial { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #386053; background: #e5f0e5; font-weight: 900; font-size: 16px; }
.product-card:nth-child(4n+2) .product-initial { background: #f3eadb; color: #976b41; }
.product-card:nth-child(4n+3) .product-initial { background: #e4edf4; color: #466982; }
.product-card:nth-child(4n+4) .product-initial { background: #f3e7ea; color: #8c5d6f; }
.product-name { display: block; margin-top: 12px; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 800; }
.product-sku { display: block; margin-top: 2px; color: #87958f; font-size: 11px; font-weight: 700; overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.product-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 4px; width: 100%; margin-top: auto; padding-top: 12px; }
.product-price { font-size: 15px; font-weight: 900; color: #176351; letter-spacing: -.02em; }
.stock-tag { font-size: 11px; font-weight: 800; color: #789084; white-space: nowrap; }
.stock-tag.low { color: #b26437; }
.stock-tag.out { color: #b3544e; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 220px; padding: 28px; text-align: center; color: #697e77; border: 1px dashed #cbdad0; border-radius: 17px; background: #fbfcf9; }
.empty-state strong { color: #284039; font-size: 16px; margin: 10px 0 4px; }
.empty-state svg { width: 31px; height: 31px; color: #8eafa1; }
.empty-state p { max-width: 340px; margin: 0; line-height: 1.55; font-size: 13px; }
.empty-state .btn { margin-top: 17px; }

.cart-panel { position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 132px); max-height: calc(100dvh - 132px); overflow-y: auto; }
.cart-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px 20px 15px; border-bottom: 1px solid #e8ede7; background: #fff; }
.cart-head h2 { margin: 0 0 3px; font-size: 19px; }
.cart-head p { margin: 0; color: #8b9891; font-size: 12px; }
.cart-body { flex: 0 0 auto; padding: 5px 20px; }
.cart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; color: #8a9a90; font-size: 13px; text-align: center; }
.cart-empty svg { width: 36px; height: 36px; margin-bottom: 12px; }
.cart-line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf0eb; }
.cart-line:last-child { border-bottom: 0; }
.cart-line-name { display: block; font-size: 13px; font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cart-line-meta { display: block; color: #89968f; font-size: 11px; margin-top: 3px; }
.cart-line-cost { display: block; color: #617968; font-size: 11px; margin-top: 4px; }
.cart-line-price { font-size: 13px; font-weight: 900; text-align: right; }
.cart-line-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cart-edit { min-height: 44px; border: 0; border-radius: 9px; padding: 8px 10px; background: #e8f1eb; color: #176351; font-size: 11px; font-weight: 900; }
.qty-stepper { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.cart-line-controls .qty-stepper { margin-top: 0; }
.qty-stepper button { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; border: 1px solid #d7e2da; border-radius: 9px; color: #34594d; background: #f6f9f5; font-size: 21px; line-height: 1; }
.qty-stepper span { min-width: 22px; text-align: center; font-weight: 800; font-size: 13px; }
.cart-footer { flex: 0 0 auto; padding: 15px 20px 20px; border-top: 1px solid #e8ede7; background: #fff; }
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.total-row span { color: #536d62; font-size: 13px; font-weight: 800; }
.total-row strong { color: #154d40; font-size: 27px; font-weight: 900; letter-spacing: -.05em; }
.payment-title { margin: 15px 0 9px; color: #60756b; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.segment { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px; border: 1px solid #d8e1da; border-radius: 10px; background: #fff; color: #576d63; font-size: 12px; font-weight: 800; }
.segment.active { color: #176351; border-color: #65ab8e; background: #eaf6ed; }
.payment-fields { display: grid; gap: 9px; margin-top: 12px; }
.payment-fields label { display: grid; gap: 6px; font-size: 11px; color: #536d62; }
.payment-fields input { width: 100%; height: 43px; min-height: 43px; font-size: 13px; }
.payment-amount-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.payment-summary { display: grid; gap: 5px; margin: 3px 0; padding: 10px 12px; border: 1px solid #dce8df; border-radius: 10px; background: #f6faf7; }
.payment-summary div { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: #5f7469; }
.payment-summary strong { color: #176351; font-size: 12px; text-align: right; }
.change-row { display: flex; justify-content: space-between; gap: 12px; color: #5f7469; font-size: 12px; font-weight: 700; }
.change-row strong { color: #176351; font-size: 15px; }
.fine-print { margin: 9px 0 12px; color: #9a714f; font-size: 11px; line-height: 1.45; }
.cart-footer .btn-lg { margin-top: 7px; }
.cart-launch, .drawer-backdrop { display: none; }

.tool-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tool-row .search-box { width: min(100%, 390px); }
.inventory-policy { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 17px 20px; }
.inventory-policy.enabled { border-color: #b7d9c5; background: #f6fbf7; }
.inventory-policy h3 { margin: 0 0 5px; font-size: 15px; }
.inventory-policy p { max-width: 730px; margin: 0; color: #687b78; font-size: 12px; line-height: 1.55; }
.inventory-policy small { display: block; margin-top: 7px; color: #a74235; font-size: 11px; }
.inventory-policy-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 116px; min-height: 48px; padding: 8px 12px; border: 1px solid #cfd9d4; border-radius: 12px; background: #fff; color: #31594b; font-size: 13px; white-space: nowrap; cursor: pointer; }
.inventory-policy-toggle input { width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 0; accent-color: #176351; cursor: pointer; }
.inventory-policy-toggle:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.product-view-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.product-view-tabs .btn[aria-pressed="true"] { border-color: #a6d0b5; }
.management-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 12px; color: #687b78; font-size: 12px; font-weight: 800; }
.management-selection .btn { margin-left: auto; }
.select-all { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: #31594b; cursor: pointer; }
.select-all input, .product-checkbox { width: 22px; height: 22px; min-height: 22px; padding: 0; margin: 0; accent-color: #176351; cursor: pointer; }
.product-select-label { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.selected-product-row { background: #f5faf6; }
.product-change-list { max-height: 220px; overflow-y: auto; margin: 15px 0 0; padding-left: 24px; color: #34534c; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.table-card { overflow: hidden; }
.management-table { overflow-x: auto; }
.management-table .data-table { min-width: 960px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: #f7f9f5; }
.data-table th { color: #768b7e; font-size: 11px; font-weight: 900; letter-spacing: .06em; text-align: left; white-space: nowrap; padding: 13px 18px; }
.data-table th:first-child { width: 68px; }
.data-table td { padding: 16px 18px; border-top: 1px solid #e9eee8; font-size: 13px; vertical-align: middle; }
.data-table .right { text-align: right; }
.data-table strong { display: block; font-weight: 800; }
.data-table small { display: block; margin-top: 3px; font-size: 11px; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.table-actions .btn { min-height: 44px; padding: 9px 11px; font-size: 11px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; background: #eaf4ea; color: #39725a; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.warn { background: #fff0df; color: #a36835; }
.badge.danger { background: #fff0ed; color: #a94e45; }
.badge.neutral { background: #edf1ef; color: #65766c; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 21px; }
.metric { padding: 19px 20px; }
.metric-label { color: #75877d; font-size: 12px; font-weight: 800; }
.metric-value { display: block; margin-top: 10px; font-size: clamp(21px, 2.5vw, 30px); font-weight: 900; letter-spacing: -.05em; white-space: nowrap; }
.metric-sub { display: block; color: #88978e; font-size: 11px; margin-top: 4px; }
.metric.accent { background: #1a584b; border-color: #1a584b; color: #fff; }
.metric.accent .metric-label, .metric.accent .metric-sub { color: #c5ddd0; }
.shift-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 17px; }
.shift-card { padding: 23px; }
.shift-card h2 { margin: 0 0 7px; font-size: 19px; }
.shift-card p { color: #697d72; font-size: 13px; line-height: 1.55; }
.shift-card .form-field { margin-top: 17px; }
.shift-card .btn { margin-top: 13px; }
.shift-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 17px; }
.shift-facts div { padding: 14px; border-radius: 12px; background: #f6f8f4; }
.shift-facts small { display: block; font-size: 11px; margin-bottom: 6px; }
.shift-facts strong { font-size: 16px; }
.payment-breakdown { display: grid; gap: 11px; margin-top: 19px; }
.payment-breakdown div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf0eb; padding-bottom: 10px; font-size: 13px; }
.payment-breakdown div:last-child { border-bottom: 0; }
.payment-breakdown strong { font-weight: 900; }

.report-filter { padding: 19px 20px; margin-bottom: 21px; }
.report-filter-fields { display: grid; grid-template-columns: minmax(155px, 1fr) minmax(155px, 1fr) auto; align-items: end; gap: 12px; }
.report-filter-fields .btn { min-height: 48px; }
.report-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.report-presets span { margin-right: 3px; color: #72877a; font-size: 12px; font-weight: 800; }
.report-state { margin-top: 20px; }
.report-metrics .metric-value { white-space: normal; overflow-wrap: anywhere; }
.report-export { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 21px; padding: 16px 19px; border: 1px solid #d7e5dc; border-radius: 15px; background: #eff7f1; }
.report-export strong { display: block; color: #245745; font-size: 14px; }
.report-export small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.45; }
.report-export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-export-actions .btn { text-decoration: none; }
.report-breakdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.report-section { min-width: 0; padding: 21px; }
.report-section-head h3 { margin: 0 0 5px; font-size: 17px; }
.report-section-head p { margin: 0; color: #73877b; font-size: 12px; line-height: 1.5; }
.report-breakdown { display: grid; gap: 10px; margin-top: 17px; }
.report-breakdown div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid #e9eee9; font-size: 13px; }
.report-breakdown div:last-child { border-bottom: 0; }
.report-breakdown strong { white-space: nowrap; }
.report-empty { margin: 0; color: #87968c; font-size: 13px; }
.report-block { margin-top: 25px; }
.report-table { overflow-x: auto; }
.report-table .data-table { min-width: 1080px; }
.report-table .data-table th:first-child { min-width: 145px; width: auto; }
.cost-missing { color: #a46634; font-weight: 700; }
.report-cost-warning { line-height: 1.55; }
.report-note { margin: 20px 0 0; color: #7c8d83; font-size: 12px; line-height: 1.6; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(15, 34, 39, .54); }
.modal { width: min(100%, 510px); max-height: min(90vh, 850px); overflow-y: auto; border-radius: 20px; background: #fff; box-shadow: 0 24px 65px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 23px 24px 12px; }
.modal-head h2 { font-size: 21px; margin: 0; }
.modal-head p { margin: 5px 0 0; color: #7c8d83; font-size: 12px; line-height: 1.4; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; border: 0; border-radius: 10px; background: #f1f4ef; color: #5a6c62; }
.catalog-limit { margin: -7px 0 14px; color: #7c8e83; font-size: 12px; }
.icon-btn svg { width: 20px; height: 20px; }
.modal-body { padding: 12px 24px 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.form-field { display: grid; gap: 7px; min-width: 0; font-size: 12px; color: #52675d; }
.form-field.wide { grid-column: 1 / -1; }
.form-field input, .form-field select, .form-field textarea { width: 100%; }
.form-help { display: block; color: #8b9a90; font-size: 11px; font-weight: 400; line-height: 1.4; }
.cart-price-preview { border: 1px solid #cee3d3; border-radius: 11px; padding: 12px 14px; background: #f3faf4; color: #176351; font-size: 13px; font-weight: 900; }
.cart-cost-preview { border: 1px solid #d9e1d9; border-radius: 11px; padding: 12px 14px; background: #f8faf6; color: #496658; font-size: 13px; font-weight: 800; }
.cost-editor-label { padding-top: 10px; border-top: 1px solid #e7ece7; }
.cost-editor-label strong { display: block; font-size: 14px; color: #214a3f; }
.cost-editor-label span { display: block; margin-top: 3px; font-size: 11px; color: #768b7e; line-height: 1.5; }
.sale-cost-summary { margin: 12px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.detail-list { display: grid; gap: 10px; margin: 14px 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid #edf1ec; font-size: 13px; }
.detail-list span { color: #77897e; }
.detail-list strong { text-align: right; overflow-wrap: anywhere; }
.receipt-lines { margin-top: 16px; padding: 12px 0; border-top: 1px dashed #d5ddd4; border-bottom: 1px dashed #d5ddd4; }
.receipt-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 12px; }
.receipt-lines span:last-child { font-weight: 800; white-space: nowrap; }
.receipt-lines small, #print-receipt .receipt-line small { display: block; color: #72847c; font-size: 11px; font-weight: 600; }
.notice-line { padding: 10px 12px; border-radius: 10px; background: #fff1e6; color: #a36938; font-size: 12px; line-height: 1.55; }

.auth-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, .8fr); min-height: 100vh; background: #f5f4ef; }
.auth-art { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(30px, 5vw, 70px); color: #eff7ed; background: radial-gradient(circle at 85% 20%, #2b6257 0, #142a32 47%, #10252d 100%); }
.auth-logo { display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 900; }
.auth-logo .brand-mark { width: 43px; height: 43px; margin: 0; border-radius: 12px; font-size: 18px; }
.auth-art h1 { max-width: 650px; margin: 70px 0 21px; font-size: clamp(36px, 5vw, 65px); line-height: 1.19; letter-spacing: -.07em; }
.auth-art h1 em { font-style: normal; color: #d5ed87; }
.auth-art p { max-width: 420px; color: #abc6bb; line-height: 1.75; }
.auth-art-footer { color: #abc6bb; font-size: 12px; }
.auth-side { display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(100%, 405px); }
.auth-kicker { color: #1e755c; font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.auth-card h2 { margin: 9px 0 10px; font-size: 31px; letter-spacing: -.05em; }
.auth-card p { margin: 0 0 29px; color: #75877d; line-height: 1.6; font-size: 13px; }
.auth-card .form-field { margin-bottom: 15px; }
.auth-card .btn { margin-top: 9px; }
.auth-disclaimer { margin-top: 24px; color: #8b9b90; font-size: 11px; line-height: 1.55; }
.loading-screen { display: grid; place-items: center; min-height: 100vh; color: #496457; font-size: 14px; font-weight: 800; }
.loading-screen span { display: block; margin: auto auto 12px; width: 35px; height: 35px; border: 3px solid #d8e7da; border-top-color: #176351; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.toast { padding: 13px 16px; border-radius: 12px; background: #183039; box-shadow: 0 12px 28px rgba(0,0,0,.16); color: white; font-size: 13px; font-weight: 700; line-height: 1.45; animation: toast-in .2s ease-out; }
.toast.error { background: #a94438; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#print-receipt { display: none; }

.purchase-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 17px; align-items: start; }
.purchase-picker, .purchase-entry, .purchase-draft { min-width: 0; padding: 21px; }
.purchase-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.purchase-card-head h3 { margin: 0 0 4px; font-size: 18px; }
.purchase-card-head p { margin: 0; color: #73877b; font-size: 12px; line-height: 1.55; }
.purchase-card-head > strong { color: #176351; white-space: nowrap; }
.purchase-scan-tools { display: grid; gap: 10px; margin-bottom: 16px; padding: 13px; border: 1px solid #cfe4d6; border-radius: 14px; background: #f5faf6; }
.purchase-camera-button { width: 100%; min-height: 54px; font-size: 15px; }
.purchase-camera-button svg { width: 21px; height: 21px; }
.purchase-camera-help { margin: 0; color: #56766a; font-size: 12px; line-height: 1.5; }
.purchase-barcode-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.purchase-barcode-form .search-box { min-width: 0; height: 51px; border-color: #a9cdb6; }
.purchase-barcode-form .search-box:focus-within { box-shadow: 0 0 0 3px #cee9d6; }
.purchase-barcode-form .btn { min-width: 66px; }
.purchase-scan-feedback { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff1e6; color: #8f5431; font-size: 12px; line-height: 1.5; }
.purchase-scan-feedback[hidden] { display: none; }
.purchase-products { display: grid; gap: 8px; max-height: 510px; overflow-y: auto; margin-top: 14px; }
.purchase-product { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 66px; padding: 10px 13px; border: 1px solid #dce7de; border-radius: 12px; background: #fbfdfb; color: #183039; text-align: left; }
.purchase-product:hover:not(:disabled), .purchase-product.selected { border-color: #75b491; background: #eff8f1; }
.purchase-product span { min-width: 0; }
.purchase-product span:last-child { text-align: right; }
.purchase-product strong, .purchase-product small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-product strong { font-size: 13px; }
.purchase-product small { margin-top: 3px; font-size: 11px; }
.purchase-empty { margin: 18px 0; color: #77897e; font-size: 13px; }
.purchase-select-empty { min-height: 270px; }
.purchase-selected { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #f0f6f0; }
.purchase-selected strong, .purchase-selected small { display: block; }
.purchase-selected small { margin-top: 2px; font-size: 11px; }
.purchase-selected .badge { white-space: nowrap; }
.purchase-item-form { display: grid; gap: 13px; margin-top: 15px; }
.purchase-item-form .form-field { min-width: 0; }
.purchase-item-form .form-field input, .purchase-item-form .form-field select, .purchase-post-form .form-field input { width: 100%; }
.purchase-phrase input { margin-top: 5px; }
.purchase-parse { justify-self: start; }
.purchase-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.purchase-preview { display: grid; gap: 5px; padding: 13px 14px; border: 1px solid #c8e0d0; border-radius: 12px; background: #f1f8f2; color: #285b47; font-size: 12px; line-height: 1.55; }
.purchase-preview strong { font-size: 14px; }
.purchase-draft { margin-top: 21px; }
.purchase-draft-lines { border-top: 1px solid #e6ebe6; }
.purchase-draft-line { display: flex; justify-content: space-between; gap: 16px; padding: 14px 2px; border-bottom: 1px solid #e9eee8; }
.purchase-draft-line > div { min-width: 0; }
.purchase-draft-line > div:last-child { text-align: right; }
.purchase-draft-line strong, .purchase-draft-line small { display: block; }
.purchase-draft-line small { margin-top: 4px; font-size: 11px; }
.purchase-line-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.purchase-line-actions .btn { min-height: 39px; padding: 7px 10px; }
.purchase-draft-empty { padding: 27px 8px; color: #85978b; text-align: center; font-size: 13px; border-block: 1px solid #e9eee8; }
.purchase-post-form { display: grid; gap: 15px; margin-top: 16px; }
.purchase-post-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 0; border-block: 1px solid #e7ede7; color: #56766a; font-size: 13px; font-weight: 800; }
.purchase-post-total strong { color: #145242; font-size: 25px; }
.purchase-post-form .fine-print { margin: 0; }
.purchase-history { margin-top: 26px; }
.purchase-history-list { display: grid; gap: 10px; }
.purchase-history-card { min-width: 0; overflow: hidden; }
.purchase-history-card summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 15px 19px; cursor: pointer; list-style-position: inside; }
.purchase-history-card summary > span { min-width: 0; }
.purchase-history-card summary strong, .purchase-history-card summary small { display: block; }
.purchase-history-card summary small { margin-top: 3px; font-size: 11px; }
.purchase-history-lines { padding: 4px 19px 15px; border-top: 1px solid #e8ede7; }
.purchase-history-lines > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0ec; font-size: 12px; }
.purchase-history-lines > div span { min-width: 0; }
.purchase-history-lines strong, .purchase-history-lines small { display: block; }
.purchase-history-lines small { margin-top: 3px; font-size: 11px; }
.purchase-history-lines p { margin-bottom: 0; font-size: 12px; }

@media (max-width: 1100px) {
  .purchase-workspace { grid-template-columns: 1fr; }
  .content { padding: 23px 22px 36px; }
  .pos-workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 15px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-export { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 900px) {
  .report-breakdown-grid { grid-template-columns: 1fr; }
  .pos-workspace { display: block; }
  .cart-panel { position: fixed; z-index: 41; top: 0; right: 0; width: min(430px, 92vw); max-height: 100dvh; height: 100dvh; border-radius: 20px 0 0 20px; transform: translateX(105%); transition: transform .22s ease; }
  .cart-panel.open { transform: translateX(0); }
  .drawer-backdrop { display: block; position: fixed; z-index: 40; inset: 0; border: 0; background: rgba(10,28,30,.45); }
  .cart-launch { display: flex; position: fixed; z-index: 30; right: 22px; bottom: 20px; align-items: center; justify-content: space-between; gap: 16px; min-width: 212px; min-height: 59px; padding: 13px 17px; border: 0; border-radius: 16px; background: #176351; color: #fff; box-shadow: 0 12px 28px rgba(18,78,62,.23); font-weight: 900; }
  .cart-launch small { color: #d2ebdc; }
  .catalog { padding-bottom: 76px; }
  .cart-close { display: grid !important; }
  .data-table td, .data-table th { padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 691px) and (max-height: 650px) {
  .rail { gap: 2px; overflow-y: auto; padding-top: 7px; padding-bottom: 6px; scrollbar-width: thin; }
  .brand-mark { margin-bottom: 2px; }
  .nav-item { min-height: 50px; }
}

@media (max-width: 690px) {
  .purchase-picker, .purchase-entry, .purchase-draft { padding: 16px; }
  .purchase-barcode-form { grid-template-columns: 1fr; }
  .purchase-barcode-form .btn { width: 100%; }
  .purchase-fields { grid-template-columns: 1fr; }
  .purchase-product { grid-template-columns: minmax(0, 1fr); }
  .purchase-product span:last-child { text-align: left; }
  .purchase-draft-line { align-items: flex-start; }
  .purchase-history-card summary { align-items: flex-start; flex-direction: column; }
  .purchase-post-total strong { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .report-filter-fields { grid-template-columns: 1fr; }
  .report-filter-fields .btn { width: 100%; }
  .report-export-actions { width: 100%; }
  .report-export-actions .btn { flex: 1 1 100%; }
  .shell { display: block; padding-bottom: 72px; }
  .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; flex-direction: row; justify-content: space-around; width: 100%; height: calc(67px + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom); border-top: 1px solid #29424a; }
  .rail .brand-mark, .rail-spacer, .rail .logout { display: none; }
  .nav-item { flex: 1; max-width: 92px; min-height: 56px; gap: 2px; border-radius: 10px; font-size: 10px; }
  .nav-item svg { width: 21px; height: 21px; }
  .topbar { padding: 15px 17px; min-height: 77px; }
  .topbar h1 { font-size: 24px; }
  .date-label { display: none; }
  .content { padding: 18px 15px 30px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .category-card { min-height: 145px; padding: 13px; }
  .category-create-row { grid-template-columns: 1fr; }
  .product-card { min-height: 145px; padding: 13px; }
  .product-price { font-size: 16px; }
  .scan-row { grid-template-columns: 1fr; }
  .scan-row .btn { display: none; }
  .summary-grid { gap: 9px; }
  .metric { padding: 15px; }
  .metric-value { font-size: 22px; }
  .shift-grid { grid-template-columns: 1fr; }
  .tool-row { align-items: stretch; }
  .tool-row .search-box, .tool-row .btn { width: 100%; }
  .management-selection { align-items: stretch; }
  .management-selection .btn { width: 100%; margin-left: 0; }
  .inventory-policy { align-items: stretch; flex-direction: column; gap: 12px; }
  .inventory-policy-toggle { justify-content: flex-start; width: 100%; }
  .table-card { overflow-x: auto; }
  .data-table { min-width: 600px; }
  .management-table .data-table { min-width: 960px; }
  .auth-page { display: block; min-height: 100vh; }
  .auth-art { min-height: 270px; padding: 23px 27px; }
  .auth-art h1 { margin: 30px 0 4px; font-size: 34px; }
  .auth-art p { display: none; }
  .auth-art-footer { display: none; }
  .auth-side { padding: 31px 24px; }
  .auth-card h2 { font-size: 27px; }
  .toast-region { bottom: calc(81px + env(safe-area-inset-bottom)); }
  .cart-launch { bottom: calc(81px + env(safe-area-inset-bottom)); right: 15px; }
}

@media print {
  @page { size: 80mm auto; margin: 4mm; }
  body { min-width: 0; background: #fff; color: #000; font-family: sans-serif; }
  #app, #toast-region { display: none !important; }
  #print-receipt { display: block !important; width: 72mm; max-width: 100%; margin: 0 auto; color: #000; font-size: 11px; line-height: 1.55; }
  #print-receipt h1 { margin: 0 0 8px; font-size: 18px; text-align: center; }
  #print-receipt .receipt-subtitle { text-align: center; font-weight: 800; margin-bottom: 12px; }
  #print-receipt .receipt-line { display: flex; justify-content: space-between; gap: 6px; }
  #print-receipt .receipt-line span:last-child { white-space: nowrap; }
  #print-receipt .receipt-line small { color: #333; font-size: 9px; }
  #print-receipt hr { border: 0; border-top: 1px dashed #000; margin: 10px 0; }
  #print-receipt .receipt-total { font-size: 15px; font-weight: 900; }
  #print-receipt .receipt-foot { text-align: center; margin-top: 12px; }
}
