@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap');

/* Soft Teal component styles. Every colour, space and radius comes from tokens.css. */
body { margin: 0; font-family: var(--font-sans); background: var(--bg-app); color: var(--text-primary); font-size: 15px; line-height: 24px; -webkit-font-smoothing: antialiased; }
.st-root, .st-root * { box-sizing: border-box; }
.st-num { font-variant-numeric: tabular-nums; }
.st-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.st-focus:focus-visible, .st-root :focus-visible { outline: 3px solid var(--primary-strong); outline-offset: 2px; }

/* workflow colour hooks: set --wf, --wf-tint, --wf-strong once, components read them */
.st-wf-receiving   { --wf: var(--receiving);    --wf-tint: var(--receiving-tint);    --wf-strong: var(--receiving-strong); }
.st-wf-requisition { --wf: var(--requisition);  --wf-tint: var(--requisition-tint);  --wf-strong: var(--requisition-strong); }
.st-wf-return      { --wf: var(--stock-return); --wf-tint: var(--stock-return-tint); --wf-strong: var(--stock-return-strong); }
.st-wf-waste       { --wf: var(--waste);        --wf-tint: var(--waste-tint);        --wf-strong: var(--waste-strong); }
.st-wf-procurement { --wf: var(--procurement);  --wf-tint: var(--procurement-tint);  --wf-strong: var(--procurement-strong); }
.st-wf-dashboard   { --wf: var(--primary);      --wf-tint: var(--primary-light);     --wf-strong: var(--primary-strong); }
.st-wf-count       { --wf: var(--stock-count);  --wf-tint: var(--stock-count-tint);  --wf-strong: var(--stock-count); }
.st-wf-settings    { --wf: var(--settings);     --wf-tint: var(--settings-tint);     --wf-strong: var(--settings-strong); }
.st-wf-neutral     { --wf: var(--primary);      --wf-tint: var(--primary-light);     --wf-strong: var(--primary-strong); }

/* Icon */
.st-icon { flex: none; display: inline-block; vertical-align: middle; }
.st-icon-tile { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--wf-tint, var(--primary-light)); color: var(--wf, var(--primary)); }
.st-icon-tile.lg { width: 56px; height: 56px; border-radius: var(--radius-lg); }
.st-icon-tile.sm { width: 32px; height: 32px; border-radius: var(--radius-sm); }

/* Button */
.st-btn { font: inherit; font-size: 15px; font-weight: 600; line-height: 20px; min-height: var(--touch-min); min-width: var(--touch-min); padding: 0 var(--space-4); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color .12s, border-color .12s; }
.st-btn:disabled { cursor: not-allowed; opacity: .5; }
.st-btn-primary { background: var(--primary-strong); color: var(--on-primary); }
.st-btn-primary:hover:not(:disabled) { background: var(--primary-strong); filter: brightness(.94); }
.st-btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-control); }
.st-btn-secondary:hover:not(:disabled) { background: var(--bg-app); }
.st-btn-ghost { background: transparent; color: var(--primary-strong); }
.st-btn-ghost:hover:not(:disabled) { background: var(--primary-light); }
.st-btn-danger { background: var(--waste-strong); color: var(--on-primary); }
.st-btn-lg { min-height: var(--touch-lg); font-size: 17px; padding: 0 var(--space-6); border-radius: var(--radius-lg); }
.st-btn-block { width: 100%; }
.st-btn-icon { padding: 0; width: var(--touch-min); }

/* AppHeader: always white */
.st-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; height: var(--header-height); background: var(--bg-header); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); }
.st-header-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }
.st-header-mark { flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--primary-light); color: var(--primary); display: grid; place-items: center; }
/* optional company logo: kept at its own proportions (height fixed, width follows), never cropped or recoloured */
.st-header-logo { flex: none; display: block; height: 44px; width: auto; max-width: 200px; object-fit: contain; object-position: left center; }
@media (max-width: 640px) { .st-header-logo { height: 36px; max-width: 150px; } }
.st-header-title { font-size: 16px; line-height: 22px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-header-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-header-actions { display: flex; align-items: center; gap: var(--space-2); }
.st-bell { position: relative; }
.st-bell-dot { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--accent-amber); color: var(--text-primary); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--bg-header); box-sizing: content-box; }
.st-user { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) 0 4px; min-height: var(--touch-min); border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-card); font: inherit; color: var(--text-primary); cursor: pointer; }
.st-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary-strong); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.st-user-name { font-size: 13px; font-weight: 600; line-height: 16px; text-align: left; }
.st-user-role { font-size: 11px; line-height: 14px; color: var(--text-secondary); text-align: left; }
@media (max-width: 640px) { .st-user-text { display: none; } .st-user { padding: 4px; } .st-header-hide-sm { display: none; } }

/* AppSidebar: white, active item = primary-light */
.st-sidebar { width: var(--sidebar-width); flex: none; background: var(--bg-header); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-3); overflow-y: auto; }
.st-side-group { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--text-secondary); padding: var(--space-4) var(--space-3) var(--space-2); text-transform: uppercase; }
.st-side-item { font: inherit; display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: 6px var(--space-3); border-radius: var(--radius-md); border: 0; background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; width: 100%; }
.st-side-item:hover { background: var(--bg-app); }
.st-side-item .st-icon-tile { width: 32px; height: 32px; border-radius: var(--radius-sm); }
.st-side-item[aria-current="page"] { background: var(--primary-light); }
.st-side-item[aria-current="page"] .st-icon-tile { background: var(--bg-card); color: var(--primary); }
.st-side-item[aria-current="page"] .st-side-label { color: var(--primary-strong); font-weight: 700; }
.st-side-label { font-size: 14px; font-weight: 600; line-height: 18px; }
.st-side-sub { font-size: 11px; line-height: 14px; color: var(--text-secondary); }
.st-side-item.is-locked { cursor: not-allowed; color: var(--text-secondary); }
.st-side-item.is-locked:hover { background: transparent; }
.st-side-item.is-locked .st-icon-tile { filter: grayscale(1); opacity: .6; }
.st-side-lock { margin-left: auto; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--bg-app); color: var(--text-secondary); }
.st-side-count { margin-left: auto; font-size: 12px; font-weight: 700; padding: 0 8px; line-height: 22px; border-radius: var(--radius-pill); background: var(--accent-amber); color: var(--text-primary); }

/* MobileBottomNavigation */
.st-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bg-header); border-top: 1px solid var(--border); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
.st-bottomnav.inline { position: static; }
.st-bn-item { font: inherit; border: 0; background: transparent; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: var(--radius-md); cursor: pointer; font-size: 11px; font-weight: 600; line-height: 14px; padding: 4px 2px; }
.st-bn-pill { display: grid; place-items: center; width: 52px; height: 30px; border-radius: var(--radius-pill); }
.st-bn-item[aria-current="page"] { color: var(--primary-strong); }
.st-bn-item[aria-current="page"] .st-bn-pill { background: var(--primary-light); color: var(--primary); }
.st-sheet-scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); display: flex; align-items: flex-end; }
.st-sheet { width: 100%; background: var(--bg-card); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-4) max(16px, env(safe-area-inset-right, 0px)) calc(var(--space-6) + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); box-shadow: var(--shadow-raised); display: grid; gap: var(--space-2); }
.st-sheet-grip { width: 40px; height: 4px; border-radius: var(--radius-pill); background: var(--border); margin: 0 auto var(--space-2); }

/* PageHeading */
.st-pagehead { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.st-pagehead-main { display: flex; align-items: center; gap: var(--space-3); flex: 1 1 260px; min-width: 0; }
.st-pagehead h1 { margin: 0; font-size: 22px; line-height: 32px; font-weight: 700; text-wrap: balance; }
.st-pagehead p { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.st-pagehead-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Card base */
.st-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }

/* ActionCard */
.st-action { font: inherit; text-align: left; color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-4); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); min-height: 88px; cursor: pointer; width: 100%; transition: border-color .12s, transform .12s; }
.st-action:hover { border-color: var(--wf); }
.st-action:active { transform: scale(.99); }
.st-action-title { font-size: 17px; line-height: 24px; font-weight: 700; }
.st-action-sub { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.st-action-count { font-size: 13px; font-weight: 700; color: var(--wf-strong); background: var(--wf-tint); border-radius: var(--radius-pill); padding: 2px 10px; white-space: nowrap; }
.st-action.tall { grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: start; min-height: 148px; padding: var(--space-6) var(--space-4) var(--space-4); }
.st-action.tall .st-icon-tile { grid-column: 1; }
.st-action.tall .st-action-count { grid-column: 2; grid-row: 1; justify-self: end; }
.st-action.tall .st-action-text { grid-column: 1 / -1; align-self: end; }
.st-action-chev { color: var(--text-secondary); }

/* DepartmentSelector */
.st-depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--space-4); }
.st-dept { font: inherit; position: relative; text-align: left; color: var(--text-primary); background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); min-height: 176px; cursor: pointer; transition: border-color .12s, background-color .12s; }
.st-dept:hover { border-color: var(--border-control); }
.st-dept[aria-checked="true"] { border-color: var(--primary-strong); background: var(--primary-light); }
.st-dept[aria-checked="true"] .st-icon-tile { background: var(--bg-card); }
.st-dept-check { position: absolute; top: var(--space-3); right: var(--space-3); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-strong); color: var(--on-primary); }
.st-dept-th { font-size: 18px; line-height: 26px; font-weight: 700; }
.st-dept-en { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.st-dept[aria-checked="true"] .st-dept-en { color: var(--text-primary); }
.st-dept-code { margin-top: auto; align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--text-primary); background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 8px; }

/* ProductCard */
.st-product { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: grid; grid-template-columns: 96px 1fr; gap: var(--space-4); padding: var(--space-4); align-items: center; }
.st-product.scanned { grid-template-columns: 1fr; align-items: start; border: 2px solid var(--wf); box-shadow: var(--shadow-raised); padding: var(--space-4); }
@media (min-width: 560px) { .st-product.scanned { grid-template-columns: 160px 1fr; gap: var(--space-6); padding: var(--space-6); } }
.st-product-img { width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: var(--radius-md); background: var(--bg-app); border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; }
.st-product.scanned .st-product-img { max-width: 220px; justify-self: center; }
.st-product-img img, .st-product-img svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-product-body { display: grid; gap: var(--space-2); min-width: 0; }
.st-product-name { font-size: 17px; line-height: 26px; font-weight: 600; }
.st-product.scanned .st-product-name { font-size: 22px; line-height: 32px; font-weight: 700; }
.st-product-en { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.st-product-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.st-chip { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; font-weight: 600; line-height: 18px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--bg-app); border: 1px solid var(--border); color: var(--text-primary); white-space: nowrap; }
.st-product-qty { display: flex; align-items: baseline; gap: var(--space-2); }
.st-product-qty strong { font-size: 40px; line-height: 48px; font-weight: 700; color: var(--wf-strong); font-variant-numeric: tabular-nums; }

/* BarcodeScanner */
.st-scanner { background: var(--bg-card); border: 2px dashed var(--wf); border-radius: var(--radius-lg); padding: var(--space-6) var(--space-4); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); justify-items: center; text-align: center; min-width: 0; }
.st-scanner[data-status="ok"] { border-style: solid; }
.st-scanner[data-status="error"] { border-style: solid; border-color: var(--waste); background: var(--waste-tint); }
.st-scan-btn { font: inherit; display: inline-flex; align-items: center; gap: var(--space-3); min-height: 72px; padding: 0 var(--space-8); border-radius: var(--radius-lg); border: 0; background: var(--wf-strong); color: var(--on-primary); font-size: 20px; font-weight: 700; cursor: pointer; }
.st-scan-btn:hover { filter: brightness(.94); }
.st-scan-hint { font-size: 14px; line-height: 20px; color: var(--text-secondary); max-width: 40ch; }
.st-scan-manual { display: flex; gap: var(--space-2); width: 100%; max-width: 420px; }
.st-scan-manual input { flex: 1; min-width: 0; }
.st-scan-beam { width: 100%; max-width: 280px; height: 4px; border-radius: var(--radius-pill); background: var(--wf-tint); overflow: hidden; position: relative; }
.st-scan-beam::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--wf); border-radius: inherit; animation: st-beam 1.1s ease-in-out infinite alternate; }
@keyframes st-beam { from { transform: translateX(0); } to { transform: translateX(150%); } }

/* Text input */
.st-input { font: inherit; font-size: 16px; min-height: var(--touch-min); padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); }
.st-input::placeholder { color: var(--text-secondary); }

/* QuantityInput */
.st-qty { display: grid; gap: var(--space-2); }
.st-qty-label { font-size: 14px; font-weight: 600; }
.st-qty-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: stretch; border: 1px solid var(--border-control); border-radius: var(--radius-lg); background: var(--bg-card); overflow: hidden; max-width: 360px; }
.st-qty-row button { font: inherit; border: 0; background: var(--bg-app); color: var(--text-primary); min-height: 72px; cursor: pointer; display: grid; place-items: center; }
.st-qty-row button:hover:not(:disabled) { background: var(--primary-light); color: var(--primary-strong); }
.st-qty-row button:disabled { color: var(--border-control); cursor: not-allowed; }
.st-qty-field { display: flex; align-items: center; justify-content: center; gap: var(--space-2); border-left: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0 var(--space-2); }
.st-qty-field input { font: inherit; width: 100%; min-width: 0; max-width: 5ch; border: 0; background: transparent; text-align: center; font-size: 40px; line-height: 48px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.st-qty-field input::-webkit-outer-spin-button, .st-qty-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.st-qty-unit { font-size: 14px; color: var(--text-secondary); font-weight: 600; }
.st-qty-help { font-size: 13px; color: var(--text-secondary); }

/* StockStatusBadge: icon + word, never colour alone */
.st-badge { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; font-weight: 700; line-height: 18px; padding: 3px 10px 3px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.st-badge-in, .st-badge-done { background: var(--status-success-tint); color: var(--status-success); }
.st-badge-low, .st-badge-pending { background: var(--status-warning-tint); color: var(--status-warning); }
.st-badge-out, .st-badge-rejected { background: var(--status-danger-tint); color: var(--status-danger); }
.st-badge-draft { background: var(--status-info-tint); color: var(--status-info); }

/* Notice banner (used by scanner, summary, errors) */
.st-notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: 15px; line-height: 22px; text-align: left; }
.st-notice strong { display: block; font-weight: 700; }
.st-notice-danger { background: var(--status-danger-tint); color: var(--status-danger); border: 1px solid var(--waste); }
.st-notice-warning { background: var(--status-warning-tint); color: var(--status-warning); border: 1px solid var(--procurement); }
.st-notice-success { background: var(--status-success-tint); color: var(--status-success); border: 1px solid var(--receiving); }
.st-notice-info { background: var(--status-info-tint); color: var(--status-info); border: 1px solid var(--requisition); }

/* ConfirmationDialog */
.st-dialog-scrim { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: grid; place-items: center; padding: var(--space-4); }
.st-dialog { width: min(100%, 520px); max-height: calc(100% - 32px); overflow-y: auto; background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); padding: var(--space-6); display: grid; gap: var(--space-4); }
.st-dialog h2 { margin: 0; font-size: 18px; line-height: 28px; font-weight: 700; }
.st-dialog-body { font-size: 15px; line-height: 24px; color: var(--text-primary); }
.st-dialog-actions { display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }
.st-dialog-actions .st-btn { flex: 1 1 140px; }

/* SearchAndFilter */
.st-search { display: grid; gap: var(--space-3); }
.st-search-box { position: relative; }
.st-search-box .st-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.st-search-box input { width: 100%; padding-left: 44px; min-height: 48px; border-radius: var(--radius-md); }
.st-filters { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.st-filter { font: inherit; flex: none; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--border-control); background: var(--bg-card); color: var(--text-primary); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2); }
.st-filter[aria-pressed="true"] { background: var(--primary-light); border-color: var(--primary-strong); color: var(--primary-strong); }

/* ResponsiveDataTable */
.st-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.st-table-scroll { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.st-table caption { text-align: left; padding: var(--space-4) var(--space-4) var(--space-2); font-size: 16px; font-weight: 700; }
.st-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-secondary); letter-spacing: .02em; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--bg-card); white-space: nowrap; }
.st-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.st-table tr:last-child td { border-bottom: 0; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table tbody tr.clickable { cursor: pointer; }
.st-table tbody tr.clickable:hover td { background: var(--bg-app); }
.st-table-cards { display: none; }
@media (max-width: 640px) {
  .st-table-wrap.responsive .st-table-scroll { display: none; }
  .st-table-wrap.responsive .st-table-cards { display: grid; }
  .st-table-wrap.responsive { background: transparent; border: 0; overflow: visible; }
}
.st-table-cards { gap: var(--space-3); }
.st-tcard { font: inherit; text-align: left; color: inherit; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-2); width: 100%; }
.st-tcard-row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 14px; }
.st-tcard-row span:first-child { color: var(--text-secondary); }
.st-tcard-title { font-weight: 700; font-size: 16px; }

/* TransactionSummary */
.st-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.st-summary-head { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-4); border-bottom: 1px solid var(--border); background: var(--wf-tint); }
.st-summary-head h3 { margin: 0; font-size: 18px; line-height: 26px; }
.st-summary-head p { margin: 0; font-size: 13px; color: var(--text-primary); }
.st-summary-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border); }
.st-summary-meta dt { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.st-summary-meta dd { margin: 0; font-size: 15px; font-weight: 600; }
.st-summary-items { list-style: none; margin: 0; padding: 0; }
.st-summary-item { display: grid; grid-template-columns: 48px 1fr auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.st-summary-thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--bg-app); border: 1px solid var(--border); overflow: hidden; }
.st-summary-thumb svg, .st-summary-thumb img { width: 100%; height: 100%; display: block; }
.st-summary-name { font-weight: 600; font-size: 15px; line-height: 22px; }
.st-summary-code { font-size: 12px; color: var(--text-secondary); }
.st-summary-qty { text-align: right; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-summary-qty small { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-left: 4px; }
.st-summary-warn { grid-column: 2 / -1; display: flex; gap: var(--space-2); align-items: center; font-size: 13px; font-weight: 600; color: var(--status-warning); }
.st-summary-total { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4); font-weight: 700; }
.st-summary-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }

/* KPIStatCard */
.st-kpi { font: inherit; text-align: left; color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-4); display: grid; gap: var(--space-2); width: 100%; }
button.st-kpi { cursor: pointer; }
button.st-kpi:hover { border-color: var(--wf); }
.st-kpi-top { display: flex; align-items: center; gap: var(--space-3); }
.st-kpi-label { font-size: 14px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.st-kpi-value { font-size: 30px; line-height: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }
.st-kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }
.st-kpi-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.st-kpi-delta.up { color: var(--status-success); }
.st-kpi-delta.down { color: var(--status-danger); }
.st-kpi-delta.flat { color: var(--text-secondary); }
.st-kpi-link { color: var(--primary-strong); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }

/* Empty / Loading / Error */
.st-state { display: grid; justify-items: center; text-align: center; gap: var(--space-3); padding: var(--space-8) var(--space-4); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.st-state h3 { margin: 0; font-size: 18px; line-height: 26px; }
.st-state p { margin: 0; font-size: 14px; line-height: 22px; color: var(--text-secondary); max-width: 44ch; }
.st-state-error { border-color: var(--waste); }
.st-skel { display: grid; gap: var(--space-3); width: 100%; }
.st-skel-row { height: 56px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--bg-app) 25%, var(--border) 50%, var(--bg-app) 75%); background-size: 200% 100%; animation: st-shimmer 1.4s linear infinite; }
@keyframes st-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.st-spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--primary-light); border-top-color: var(--primary); animation: st-spin .8s linear infinite; }
@keyframes st-spin { to { transform: rotate(360deg); } }

/* LanguageSwitcher */
.st-lang { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--bg-app); border: 1px solid var(--border); }
.st-lang button { font: inherit; min-height: 38px; min-width: 44px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 700; cursor: pointer; }
.st-lang button[aria-pressed="true"] { background: var(--bg-card); color: var(--primary-strong); box-shadow: var(--shadow-card); }

/* preview helpers */
.st-preview { padding: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.st-preview.col { flex-direction: column; align-items: stretch; }

@media (prefers-reduced-motion: reduce) { .st-scan-beam::after, .st-skel-row, .st-spinner { animation: none; } .st-action, .st-dept { transition: none; } }
