:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #74777d;
  --line: #e5e5e7;
  --canvas: #f5f5f6;
  --surface: #ffffff;
  --green: #d71920;
  --green-dark: #202124;
  --green-soft: #fcebed;
  --orange: #be6b2d;
  --orange-soft: #fff1e2;
  --red: #c6232d;
  --red-soft: #fcebed;
  --shadow: 0 18px 50px rgba(25, 25, 28, .16);
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body { margin: 0; color: var(--ink); font-family: Inter, "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; font-size: 14px; line-height: 1.5; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(25,116,90,.22); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed !important; }
.boot-state, .loading-block, .page-loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.boot-state { min-height: 100vh; }
.page-loading { min-height: 360px; }
.loading-block { min-height: 92px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid #c5d5cc; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px 18px; background: var(--green-dark); color: #f4faf7; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; color: #fff; background: var(--green); border-radius: 7px; font-weight: 800; font-size: 17px; }
.sidebar .brand-mark { color: var(--green-dark); background: #d0e88d; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand span { margin-top: 2px; color: #a9c2b8; font-size: 11px; }
.side-nav { display: grid; gap: 6px; padding-top: 22px; }
.nav-item { min-height: 44px; display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 10px; border: 0; border-radius: 5px; color: #c4d7cf; background: transparent; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active { color: var(--green-dark); background: #e7f1eb; font-weight: 700; }
.nav-glyph { width: 25px; height: 25px; display: inline-grid; place-items: center; border: 1px solid currentColor; border-radius: 5px; font-size: 11px; font-weight: 700; }
.sidebar-bottom { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.14); }
.sync-status { display: flex; align-items: center; gap: 8px; color: #d5e7dc; font-size: 12px; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #bee16d; box-shadow: 0 0 0 3px rgba(190,225,109,.13); }
.sidebar-note { margin-top: 8px; color: #89a89c; font-size: 11px; }
.main-column { min-width: 0; }
.topbar { height: 82px; display: flex; align-items: center; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-heading { margin-right: auto; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.3; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; }
.account-area { display: flex; align-items: center; gap: 10px; }
.account-avatar { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green-dark); background: #deeee5; border-radius: 50%; font-weight: 700; }
.account-copy { min-width: 96px; }
.account-copy strong, .account-copy span { display: block; }
.account-copy strong { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account-copy span { color: var(--muted); font-size: 11px; }
.menu-toggle { display: none; width: 36px; height: 36px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; background: white; cursor: pointer; }
.menu-toggle span { display: block; width: 16px; height: 2px; margin: 3px auto; background: var(--ink); }
.page-content { width: min(100%, 1500px); margin: 0 auto; padding: 30px 34px 58px; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.welcome-row h2 { margin: 0 0 4px; font-size: 25px; line-height: 1.2; }
.subtle { margin: 0; color: var(--muted); }
.welcome-actions, .toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; background: transparent; font-size: 12px; font-weight: 650; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: #12624d; }
.button-dark { color: #fff; background: var(--green-dark); }
.button-dark:hover { background: #245a4b; }
.button-outline { border-color: #cbd8d0; color: #374940; background: #fff; }
.button-outline:hover { border-color: var(--green); color: var(--green-dark); background: #f3f8f5; }
.button-quiet { border-color: transparent; color: #57675e; background: transparent; }
.button-quiet:hover { color: var(--green-dark); background: #edf3ef; }
.button-full { width: 100%; min-height: 43px; }
.button-small { min-height: 29px; padding: 0 9px; font-size: 11px; }
.logout-button { min-height: 32px; padding: 0 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 30px; }
.metric { min-height: 142px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.metric-green { border-color: #c6dfd2; background: #eef7f1; }
.metric-dark { border-color: var(--green-dark); color: #f5fbf8; background: var(--green-dark); }
.metric-orange { border-color: #f0d8bd; background: var(--orange-soft); }
.metric-light { background: #fff; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-dark .metric-top { color: #c2d8ce; }
.metric-index { font-size: 10px; opacity: .7; }
.metric > strong { display: block; margin-top: 13px; font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1; }
.metric small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.metric-dark small { color: #b7cfc4; }
.metric-pair { white-space: nowrap; font-size: 23px !important; }
.metric-pair i { color: #8b9991; font-style: normal; font-size: 15px; }
.section-block { margin-top: 30px; }
.section-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.section-heading .eyebrow { margin-bottom: 3px; }
.section-heading-inline { margin: 0; }
.table-section { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.table-section .table-wrap { border: 0; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.data-table th { height: 39px; padding: 0 13px; border-bottom: 1px solid var(--line); color: #65736b; background: #f8faf8; font-size: 10px; font-weight: 700; white-space: nowrap; }
.data-table td { height: 58px; padding: 8px 13px; border-bottom: 1px solid #edf1ee; vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcfb; }
.data-table td strong, .data-table td small { display: block; }
.data-table td strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.data-table td small { margin-top: 3px; color: #87938c; font-size: 10px; }
.number-cell { text-align: right !important; font-variant-numeric: tabular-nums; }
.date-cell { color: #65736b; font-variant-numeric: tabular-nums; }
.amount-negative { color: var(--red) !important; }
.amount-positive { color: var(--green) !important; }
.row-actions { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.row-badge { display: inline-block; margin-left: 7px; padding: 2px 5px; border-radius: 3px; color: var(--red); background: var(--red-soft); font-size: 9px; font-weight: 700; }
.type-tag, .status-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.type-in { color: var(--green); background: var(--green-soft); }
.type-out { color: #a04c33; background: #f9ece7; }
.type-adjustment { color: #936122; background: #fff2d8; }
.status-active { color: var(--green); background: var(--green-soft); }
.status-disabled { color: #7c5b56; background: #f1e9e7; }
.table-empty { height: 100px !important; color: var(--muted); text-align: center; }
.table-empty .empty-state { min-height: 96px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px; color: var(--muted); white-space: normal; text-align: center; }
.empty-state strong { color: var(--ink); font-size: 12px; }
.empty-state span { max-width: 350px; font-size: 11px; }
.empty-mark { color: #9aaba1; font-size: 18px; line-height: 1; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.filter-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.search-box { width: clamp(240px,31vw,390px); height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #cbd8d0; border-radius: 5px; color: #78877e; background: #fff; }
.search-box > span { font-size: 18px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input:focus-visible { outline: 0; }
.check-label { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; color: #56645d; font-size: 11px; white-space: nowrap; }
.check-label input { width: 15px; height: 15px; accent-color: var(--green); }
.select-inline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.select-inline select { height: 36px; min-width: 100px; padding: 0 24px 0 9px; border: 1px solid #cbd8d0; border-radius: 5px; color: var(--ink); background: #fff; }
.catalog-summary { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.catalog-summary strong { color: var(--ink); }
.summary-separator { height: 13px; border-left: 1px solid #ccd6d0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pager > div { display: flex; gap: 6px; }
.users-toolbar { min-height: 44px; }
.error-panel { max-width: 680px; margin: 44px auto; padding: 22px; border: 1px solid #e9c7c2; border-radius: 6px; color: var(--red); background: #fff; }
.error-panel strong { font-size: 15px; }
.error-panel p { margin: 7px 0 16px; color: var(--muted); }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg,#edf4ef 0%,#f8faf8 58%,#e8f1eb 100%); }
.auth-panel { width: min(100%, 410px); padding: 30px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 14px 42px rgba(26,56,44,.09); }
.auth-panel .brand-mark { margin-bottom: 20px; }
.auth-panel h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.auth-intro { margin: 9px 0 20px; color: var(--muted); font-size: 12px; }
.auth-foot { margin: 17px 0 0; color: #87938c; font-size: 10px; text-align: center; }
.form-stack { display: grid; gap: 13px; }
.form-stack label { display: grid; gap: 6px; color: #394940; font-size: 11px; font-weight: 650; }
.form-stack input, .form-stack select, .form-stack textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #cbd8d0; border-radius: 5px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 400; }
.form-stack input::placeholder { color: #9ba79f; }
.form-stack small { color: var(--muted); font-size: 10px; font-weight: 400; }
.inline-error { margin: 0 0 13px; padding: 9px 10px; border-radius: 4px; color: var(--red); background: var(--red-soft); font-size: 11px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(20,36,29,.48); }
.modal-panel { width: min(100%, 600px); max-height: min(92vh,820px); overflow: auto; padding: 21px; border: 1px solid rgba(255,255,255,.6); border-radius: 7px; background: #fff; box-shadow: var(--shadow); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.modal-heading h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.icon-close { width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: #53645a; background: #fff; font-size: 21px; line-height: 1; cursor: pointer; }
.icon-close:hover { color: var(--red); background: #faf2f0; }
.modal-form { gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.label-optional { color: #87938c; font-size: 10px; font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 7px; padding-top: 13px; border-top: 1px solid #edf1ee; }
.form-note { padding: 9px 10px; border-left: 3px solid #b2cfbd; color: #62736a; background: #f2f7f3; font-size: 11px; }
.import-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.import-summary strong { color: var(--green); font-size: 19px; }
.import-summary i { height: 15px; margin: 0 5px; border-left: 1px solid var(--line); }
.validation-list { display: grid; gap: 5px; max-height: 170px; overflow: auto; margin: 10px 0; padding: 10px 12px; border: 1px solid #efd1cc; border-radius: 5px; color: #91463c; background: #fff8f7; font-size: 11px; }
.validation-list strong { margin-bottom: 3px; }
.import-preview-wrap { max-height: 220px; overflow: auto; margin: 12px 0; }
.import-preview-wrap .data-table { min-width: 420px; }
.import-preview-wrap .subtle { padding: 6px 4px; font-size: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: min(420px, calc(100vw - 32px)); padding: 11px 15px; border: 1px solid #b6d3c0; border-radius: 5px; color: #174d3c; background: #f1faf4; box-shadow: 0 6px 24px rgba(23,61,47,.12); font-size: 12px; }
.toast-error { border-color: #e5b6b0; color: #913e36; background: #fff4f2; }
.sidebar-scrim { display: none; }
.mobile-stock-nav { display: none; }
@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 210px minmax(0,1fr); }
  .page-content { padding-right: 24px; padding-left: 24px; }
  .topbar { padding-right: 24px; padding-left: 24px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar-row { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(280px,84vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 19; display: block; visibility: hidden; background: rgba(13,31,24,.35); opacity: 0; transition: opacity .2s, visibility .2s; }
  .menu-open .sidebar-scrim { visibility: visible; opacity: 1; }
  .topbar { height: 68px; gap: 11px; padding: 0 15px; }
  .menu-toggle { display: block; }
  .topbar h1 { font-size: 17px; }
  .topbar .eyebrow { display: none; }
  .account-area { gap: 7px; }
  .account-avatar { width: 30px; height: 30px; font-size: 11px; }
  .account-copy { display: none; }
  .logout-button { min-height: 30px; padding: 0 7px; font-size: 11px; }
  .page-content { padding: 22px 15px 42px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .welcome-row h2 { font-size: 22px; }
  .welcome-actions { width: 100%; }
  .welcome-actions .button { flex: 1; }
  .metric-grid { gap: 8px; margin-bottom: 24px; }
  .metric { min-height: 122px; padding: 13px; }
  .metric > strong { font-size: 25px; }
  .metric-pair { font-size: 19px !important; }
  .section-block { margin-top: 24px; }
  .toolbar-row { gap: 10px; }
  .filter-form { width: 100%; }
  .search-box { width: 100%; flex: 1 1 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1 1 auto; }
  .catalog-summary { align-items: flex-start; flex-wrap: wrap; }
  .table-wrap { overflow-x: auto; }
  .data-table { min-width: 660px; }
  .compact-table { min-width: 550px; }
  .product-table { min-width: 830px; }
  .pager { align-items: flex-start; flex-direction: column; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-panel { width: 100%; max-height: 92vh; padding: 18px 15px max(18px, env(safe-area-inset-bottom)); border-radius: 9px 9px 0 0; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-panel { padding: 25px 21px; }
  .toast { right: 12px; bottom: 12px; }
}
@media (max-width: 390px) {
  .metric-index { display: none; }
  .metric-top { font-size: 11px; }
  .metric-pair { font-size: 17px !important; }
  .button { padding-right: 10px; padding-left: 10px; }
}

/* Tai Xin Da brand and responsive application shell */
.app-shell { grid-template-columns: 252px minmax(0,1fr); }
.sidebar { background: #fff; color: var(--ink); border-right: 1px solid var(--line); }
.sidebar-brand { min-height: 78px; gap: 13px; padding: 0 4px 20px; border-bottom-color: var(--line); }
.sidebar-logo { display: block; width: 144px; height: 58px; flex: 0 0 144px; object-fit: cover; object-position: center; }
.sidebar-brand-copy { min-width: 0; }
.sidebar-brand strong { color: var(--ink); font-size: 13px; white-space: nowrap; }
.sidebar-brand span { color: var(--muted); }
.sidebar .brand-mark { display: none; }
.side-nav { gap: 5px; padding-top: 20px; }
.nav-item { min-height: 46px; color: #56585d; border-radius: 5px; }
.nav-item:hover { color: #b6161d; background: #fff4f4; }
.nav-item.active { position: relative; color: #bd171f; background: #fcebed; }
.nav-item.active::before { position: absolute; inset: 9px auto 9px 0; width: 3px; border-radius: 0 2px 2px 0; background: #d71920; content: ""; }
.nav-glyph { border-color: #e5d9da; color: #7c5557; }
.nav-item.active .nav-glyph { border-color: #eab7ba; color: #c5161e; }
.sidebar-bottom { border-top-color: var(--line); }
.sync-status { color: #55585d; }
.status-dot { background: #35a36b; box-shadow: 0 0 0 3px rgba(53,163,107,.12); }
.sidebar-note { color: #85878c; }
.topbar { box-shadow: 0 2px 8px rgba(24,24,28,.025); }
.account-avatar { color: #a6131a; background: #fcebed; }
.button-primary { background: #d71920; }
.button-primary:hover { background: #ba1119; }
.button-dark { background: #252629; }
.button-dark:hover { background: #414247; }
.button:focus-visible, input:focus-visible, select:focus-visible { outline-color: rgba(215,25,32,.24); }
.metric { border-radius: 5px; }
.metric-green { border-color: #eadbdd; background: #fff; }
.metric-dark { border-color: #252629; background: #252629; }
.metric-orange { border-color: #efd8bd; background: #fff8ef; }
.metric-top { color: #686a70; }
.metric-dark .metric-top { color: #d6d6d8; }
.auth-screen { grid-template-columns: minmax(0,1fr) minmax(350px,430px); justify-items: stretch; align-items: center; gap: clamp(40px,9vw,150px); padding: clamp(36px,8vw,120px); background: #fff; }
.auth-brand { width: min(100%, 560px); justify-self: end; text-align: center; }
.auth-logo { display: block; width: min(100%, 520px); height: auto; aspect-ratio: 2.1; margin: 0 auto; object-fit: cover; object-position: center; }
.auth-rule { display: block; width: 42px; height: 3px; margin: 20px auto 13px; background: #d71920; }
.auth-brand > p { margin: 0; color: #424348; font-size: 15px; font-weight: 650; }
.auth-panel { width: 100%; max-width: 430px; justify-self: start; padding: 35px; border-color: #e8e8ea; border-radius: 6px; box-shadow: 0 18px 54px rgba(28,28,32,.07); }
.auth-panel .brand-mark { display: none; }
.auth-panel .eyebrow { margin-bottom: 7px; color: #c51b23; }
.form-stack input, .form-stack select, .form-stack textarea { min-height: 42px; }
.button-full { min-height: 43px; }
.modal-backdrop { backdrop-filter: blur(3px); }
.icon-close { display: grid; place-items: center; }
.icon-close:hover { color: #c51b23; }
.audit-table td:nth-child(4) { min-width: 220px; white-space: normal; }
.audit-table td:nth-child(4) strong { max-width: 520px; }
.product-thumb { width: 42px; height: 42px; display: inline-grid; flex: 0 0 42px; place-items: center; object-fit: cover; border: 1px solid #e7e7e9; border-radius: 4px; background: #f6f6f7; }
.product-thumb-empty { color: #909197; font-size: 11px; }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-cell > div { min-width: 0; }
.product-image-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.product-image-edit > img, .product-image-edit > .product-thumb { width: 72px; height: 72px; flex-basis: 72px; }
.product-image-edit > label:not(.check-label) { flex: 1 1 220px; }
.stock-mode { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: #394940; font-size: 11px; font-weight: 650; }
.stock-mode small { color: var(--muted); font-size: 10px; font-weight: 400; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: #f5f5f6; }
.segmented button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 3px; color: #606168; background: transparent; font-size: 11px; cursor: pointer; }
.segmented button.selected { color: #a8131a; background: #fff; box-shadow: 0 1px 3px rgba(20,20,20,.12); font-weight: 700; }
.product-table { min-width: 980px; }
.alert-table { min-width: 740px; }
@media (min-width: 721px) and (max-width: 1050px) {
  .app-shell { grid-template-columns: 194px minmax(0,1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .sidebar-logo { width: 104px; height: 46px; flex-basis: 104px; }
  .sidebar-brand { gap: 7px; }
  .sidebar-brand-copy strong { font-size: 11px; }
  .topbar { padding-right: 21px; padding-left: 21px; }
  .page-content { padding: 25px 21px 48px; }
  .auth-screen { gap: 36px; padding: 48px; }
  .auth-logo { aspect-ratio: 2.1; }
}
@media (min-width: 721px) and (max-width: 850px) {
  .auth-screen { grid-template-columns: minmax(0,1fr); justify-items: center; gap: 22px; padding: 34px; }
  .auth-brand, .auth-panel { justify-self: center; }
  .auth-logo { width: min(100%, 330px); }
}
@media (max-width: 720px) {
  .sidebar { background: #fff; }
  .sidebar-brand { min-height: 72px; }
  .sidebar-logo { width: 148px; height: 60px; flex-basis: 148px; }
  .password-button { min-height: 30px; padding: 0 5px; font-size: 10px; }
  .auth-screen { width: 100%; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; overflow-x: clip; padding: 28px 18px max(28px, env(safe-area-inset-bottom)); }
  .auth-brand { width: 100%; max-width: 330px; min-width: 0; flex: 0 1 auto; justify-self: auto; }
  .auth-logo { width: min(100%, 310px); aspect-ratio: 2.1; }
  .auth-rule { margin: 8px auto 5px; }
  .auth-brand > p { font-size: 12px; }
  .auth-panel { width: 100%; max-width: 430px; min-width: 0; flex: 0 1 auto; justify-self: auto; padding: 23px 20px; }
}
@media (max-width: 390px) {
  .sidebar-logo { width: 130px; height: 54px; flex-basis: 130px; }
  .sidebar-brand-copy strong { font-size: 12px; }
  .auth-screen { gap: 10px; padding-right: 14px; padding-left: 14px; }
  .auth-panel { padding: 20px 17px; }
  .account-area { gap: 3px; }
  .password-button { font-size: 9px; }
}

.nav-item.nav-primary { margin-bottom: 3px; color: #a9151c; background: #fff4f4; font-weight: 700; }
.nav-item.nav-primary .nav-glyph { border-color: #ecc3c5; color: #bc171f; }
.nav-item.nav-primary.active { color: #a9151c; background: #fcebed; }
.stock-picker { margin-top: 8px; }
.quick-filters { display: grid; gap: 10px; }
.quick-filters .search-box { width: min(100%, 540px); height: 44px; }
.category-chips { display: flex; gap: 7px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: thin; }
.category-chip { min-height: 40px; flex: 0 0 auto; padding: 0 14px; border: 1px solid #dfe1e4; border-radius: 5px; color: #56585d; background: #fff; font-size: 12px; cursor: pointer; }
.category-chip:hover, .category-chip.selected { border-color: #d71920; color: #b4161d; background: #fff4f4; }
.quick-group { margin-top: 22px; }
.quick-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quick-group-heading h3 { margin: 0; font-size: 15px; }
.quick-group-heading > span { color: var(--muted); font-size: 11px; }
.quick-product-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(165px,1fr)); gap: 10px; }
.quick-product-card { min-width: 0; display: grid; grid-template-rows: 112px auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #fff; text-align: left; cursor: pointer; }
.quick-product-card:hover:not(:disabled) { border-color: #d71920; box-shadow: 0 3px 12px rgba(38,35,36,.08); }
.quick-product-card:disabled { cursor: default; }
.quick-product-image { width: 100%; height: 112px; display: grid; place-items: center; object-fit: cover; border-bottom: 1px solid #eeeff0; background: #f5f5f6; }
.quick-product-placeholder { color: #999ba0; font-size: 12px; }
.quick-product-copy { min-width: 0; display: grid; gap: 4px; padding: 9px 10px 10px; }
.quick-product-copy > strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.quick-product-copy > small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.quick-product-stock { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: #707177; font-size: 10px; }
.quick-product-stock b { color: var(--ink); font-size: 12px; }
.quick-load-more { width: 100%; min-height: 44px; margin-top: 12px; }
.favorite-mark { color: #d71920; font-size: 12px; }
.product-mobile-list { display: none; }
.product-mobile-card { min-width: 0; padding: 12px; border-bottom: 1px solid var(--line); background: #fff; }
.product-mobile-card:first-child { border-top: 1px solid var(--line); }
.product-mobile-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product-mobile-name { min-width: 0; flex: 1; }
.product-mobile-name > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.product-mobile-name > small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.mobile-category { display: inline-block; margin-top: 5px; color: #a9151c; font-size: 10px; }
.product-mobile-stock { flex: 0 0 auto; text-align: right; }
.product-mobile-stock > strong, .product-mobile-stock > small { display: block; }
.product-mobile-stock > strong { font-size: 18px; line-height: 1.1; }
.product-mobile-stock > small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.product-mobile-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 9px 0 0 52px; color: #707177; font-size: 10px; }
.product-mobile-extra { margin: 9px 0 0 52px; color: #55575c; font-size: 11px; }
.product-mobile-extra summary { width: fit-content; color: #686a70; cursor: pointer; }
.product-mobile-extra > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.product-mobile-extra > div > span { min-width: 0; overflow-wrap: anywhere; }
.product-mobile-extra small { display: block; margin-bottom: 2px; color: var(--muted); font-size: 10px; }
.mobile-edit-product { min-height: 38px; width: 100%; margin-top: 10px; }
.private-field-label { color: #a9151c; font-size: 10px; font-weight: 500; }
.field-config-list { display: grid; gap: 8px; }
.field-config-row { min-width: 0; display: grid; grid-template-columns: 28px minmax(120px,1fr) 100px auto 68px; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; }
.field-order { color: var(--muted); font-size: 11px; text-align: center; }
.field-label-input { min-width: 0; display: grid; gap: 4px; color: #56585d; font-size: 10px; }
.field-label-input input { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid #cbd8d0; border-radius: 4px; background: #fff; }
.field-type { min-width: 0; display: grid; gap: 4px; color: #56585d; font-size: 10px; }
.field-type select { width: 100%; min-height: 38px; padding: 0 8px; border: 1px solid #cbd8d0; border-radius: 4px; color: var(--ink); background: #fff; }
.field-visibility { display: flex; align-items: center; gap: 6px; color: #56585d; white-space: nowrap; font-size: 11px; }
.field-visibility input { width: 16px; height: 16px; accent-color: #d71920; }
.field-order-actions { display: flex; justify-content: flex-end; gap: 4px; }
.field-order-actions .icon-close { width: 30px; height: 32px; flex-basis: 30px; font-size: 15px; }
.field-config-actions { display: flex; justify-content: flex-start; }
@media (max-width: 720px) {
  .page-content { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .mobile-stock-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 18; display: grid; grid-template-columns: repeat(auto-fit,minmax(0,1fr)); gap: 8px; padding: 8px 15px max(8px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -3px 14px rgba(25,30,27,.08); }
  .mobile-stock-link { min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #dfc8c9; border-radius: 5px; color: #a9151c; background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
  .mobile-stock-link.active { border-color: #bd171f; color: #fff; background: #bd171f; }
  .stock-welcome { flex-direction: row; align-items: center; }
  .stock-welcome .welcome-actions { width: auto; }
  .stock-welcome .button { min-height: 40px; white-space: nowrap; }
  .quick-filters .search-box { width: 100%; }
  .category-chip { min-height: 42px; padding: 0 13px; }
  .quick-product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .quick-product-card { grid-template-rows: 92px auto; }
  .quick-product-image { height: 92px; }
  .quick-product-copy { padding: 8px; }
  .product-catalog-table { display: none; }
  .product-mobile-list { display: block; margin-top: 20px; overflow: hidden; border-bottom: 1px solid var(--line); background: #fff; }
  .field-config-row { grid-template-columns: 20px minmax(0,1fr) auto; gap: 7px; }
  .field-label-input { grid-column: 2 / -1; }
  .field-type { grid-column: 2; }
  .field-visibility { grid-column: 3; }
  .field-order-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .field-order-actions .icon-close { width: 42px; height: 40px; flex-basis: 42px; }
}
@media (max-width: 390px) {
  .quick-product-grid { gap: 7px; }
  .quick-product-card { grid-template-rows: 82px auto; }
  .quick-product-image { height: 82px; }
  .quick-product-copy > strong { font-size: 11px; }
  .stock-welcome .subtle { max-width: 240px; }
  .field-config-row { padding: 7px; }
}

.permission-fieldset { min-width: 0; margin: 2px 0; padding: 12px; border: 1px solid var(--line); border-radius: 5px; }
.permission-fieldset legend { padding: 0 5px; color: #394940; font-size: 12px; font-weight: 700; }
.permission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.permission-option { min-width: 0; display: flex !important; align-items: center; gap: 8px !important; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; color: #41464b !important; background: #fff; font-size: 12px !important; font-weight: 500 !important; cursor: pointer; }
.permission-option input { width: 17px; height: 17px; flex: 0 0 17px; margin: 0; accent-color: var(--green); }
.permission-option span { min-width: 0; }
.permission-list { min-width: 300px; max-width: 390px; display: flex; flex-wrap: wrap; gap: 4px; }
.permission-pill { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 6px; border-radius: 3px; color: #7b8086; background: #f0f1f2; font-size: 10px; line-height: 1.3; white-space: nowrap; }
.permission-pill.enabled { color: #286047; background: #e8f3ec; }
.user-note-cell { max-width: 240px; white-space: normal; overflow-wrap: anywhere; }
.users-table { min-width: 1080px; }
@media (max-width: 720px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea { font-size: 16px !important; }
  .permission-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .permission-list { min-width: 310px; }
}



.password-control { position: relative; display: block; width: 100%; min-width: 0; }
.password-control > input { width: 100%; padding-right: 64px !important; }
.password-visibility { position: absolute; top: 1px; right: 2px; bottom: 1px; min-width: 56px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--green-dark); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.password-visibility:hover { background: rgba(0, 0, 0, .04); }
.password-visibility:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.password-control > input::-ms-reveal, .password-control > input::-ms-clear { display: none; }
.warning-control { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.warning-control input { width: 80px; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); font: inherit; text-align: right; }
.warning-control .button { min-height: 36px; }
.product-table th[draggable] { cursor: grab; }
.product-table th[draggable]:active { cursor: grabbing; }
.product-table th.column-drop-target { box-shadow: inset 3px 0 var(--green); background: #fbeeed; }
.column-grip { display: inline-block; margin-left: 7px; color: #999; font-size: 15px; }
.column-order-list { margin: 16px 0; border: 1px solid var(--line); border-radius: 6px; }
.column-order-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.column-order-row:last-child { border-bottom: 0; }
.column-order-row > span { min-width: 0; overflow-wrap: anywhere; }
.column-order-row > div { display: flex; flex-shrink: 0; gap: 6px; }
.column-order-row .button { width: 44px; min-height: 44px; font-size: 17px; }
.product-mobile-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 14px; }
.product-mobile-detail { min-width: 0; overflow-wrap: anywhere; }
.product-mobile-detail > small { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.product-warning-detail { grid-column: 1 / -1; }
.product-mobile-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 720px) {
  .warning-control input { width: 100px; min-height: 44px; }
  .warning-control .button, .product-mobile-actions .button { min-height: 44px; }
}
.date-filter { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 12px; }
.date-filter input { min-width: 135px; min-height: 38px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #fff; }
.report-note { margin-top: 10px; }
.report-table th[draggable] { cursor: grab; }
.stock-mode[hidden] { display: none; }
.movement-valuation, .valuation-total { display: grid; gap: 8px; padding: 18px; background: #fcf3ef; border: 1px solid #efd8ce; border-radius: 8px; overflow-wrap: anywhere; }
.movement-valuation span, .movement-valuation small, .valuation-total span, .valuation-total small { color: var(--muted); font-size: 13px; }
.movement-valuation strong { font-size: 20px; color: var(--ink); }
.valuation-total { margin: 18px 0; }
.valuation-total strong { font-size: clamp(25px, 5vw, 38px); color: var(--ink); }
.report-table th.column-drop-target { box-shadow: inset 3px 0 var(--green); background: #fbeeed; }
.column-order-row .check-label { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .date-filter { flex: 1 1 160px; }
  .date-filter input { min-width: 0; width: 100%; min-height: 44px; }
}
