:root {
  color-scheme: light;
  --ink: #1a2b34;
  --muted: #647680;
  --line: #dbe7ed;
  --soft: #f2f7f9;
  --paper: #ffffff;
  --brand: #1479b8;
  --brand-dark: #0b5f98;
  --brand-soft: #e8f5fb;
  --green: #247c59;
  --green-dark: #0c5835;
  --green-soft: #e8f5ed;
  --orange: #ef6737;
  --red: #c94343;
  --sidebar: #173747;
  --shadow: 0 14px 40px rgba(20, 57, 76, 0.14);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--soft); }
body { margin: 0; color: var(--ink); background: var(--soft); font-family: "Microsoft YaHei", "PingFang HK", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Keep input/text intrinsic widths from expanding the centered login grid. */
.login-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0,1fr); place-items: center; padding: 24px; background: #edf7fb; }
.login-panel { width: min(430px, 100%); min-width: 0; overflow-wrap: anywhere; background: var(--paper); border: 1px solid #ccdee7; box-shadow: var(--shadow); padding: 40px; }
.admin-brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; }
.admin-brand-logo { width: 44px; height: 42px; flex: 0 0 44px; object-fit: contain; padding: 2px; background: white; }
.admin-brand strong, .admin-brand small { display: block; letter-spacing: 0; }
.admin-brand strong { font-size: 18px; }
.admin-brand small { margin-top: 2px; color: #849088; font-size: 10px; }
.login-copy { margin: 54px 0 28px; }
.login-copy > span { color: var(--brand); font-size: 12px; font-weight: 800; }
.login-copy h1 { margin: 8px 0 0; font-size: 28px; line-height: 1.25; }
.login-panel form > label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.login-panel form .password-field + label { margin-top: 16px; }
.password-field { height: 48px; display: flex; align-items: center; border: 1px solid #cfd8d1; background: white; }
.password-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,121,184,.12); }
.password-field > svg { width: 18px; margin-left: 14px; color: #728078; }
.password-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 12px; }
.password-field .password-toggle { position: relative; z-index: 1; flex: 0 0 52px; width: 52px; height: 44px; margin-right: 2px; border: 2px solid #1479b8; background: #fff; color: #0b5c84; cursor: pointer; display: grid; place-items: center; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.password-field .password-toggle:hover { background: #eaf5fa; color: #084766; }
.password-field .password-toggle:active { background: #d9edf5; }
.password-field .password-toggle:focus-visible { outline: 3px solid #f4b942; outline-offset: -4px; }
.password-field .password-toggle[aria-pressed="true"] { background: #dff3ef; color: #08665f; border-color: #0f766e; }
.password-field .password-toggle svg { grid-area: 1 / 1; width: 26px; height: 26px; stroke-width: 2.4; pointer-events: none; }
.password-field .password-toggle svg[hidden] { display: none; }
.form-error { margin: 8px 0 0; color: var(--red); font-size: 12px; }
.login-submit { width: 100%; height: 48px; margin-top: 18px; border: 0; background: var(--brand); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-weight: 800; cursor: pointer; }
.login-submit:hover { background: var(--brand-dark); }
.login-submit svg { width: 18px; }
.back-store { display: inline-flex; align-items: center; gap: 7px; margin-top: 24px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-store svg { width: 16px; }

.admin-app { min-height: 100vh; }
.admin-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 232px; background: var(--sidebar); color: #dce5df; padding: 24px 16px; display: flex; flex-direction: column; }
.admin-sidebar .admin-brand { color: white; padding: 0 8px; }
.admin-sidebar .admin-brand small { color: #9cb8c7; }
.admin-nav { min-height: 0; margin-top: 42px; display: grid; gap: 6px; overflow-y: auto; }
.admin-nav button { position: relative; width: 100%; height: 44px; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: #b4c8d2; padding: 0 13px; cursor: pointer; font-size: 14px; text-align: left; }
.admin-nav button:hover { color: white; background: rgba(255,255,255,.06); }
.admin-nav button.active { color: white; background: var(--brand); }
.admin-nav svg { width: 19px; }
.admin-nav b { margin-left: auto; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; background: var(--orange); color: white; font-size: 11px; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 14px; font-size: 12px; color: #9cb8c7; }
.sidebar-footer a, .sidebar-footer div { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.sidebar-footer a:hover { color: white; }
.sidebar-footer svg { width: 15px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #4bd183; box-shadow: 0 0 0 3px rgba(75,209,131,.12); }
.sidebar-overlay { display: none; }

.admin-workspace { min-height: 100vh; margin-left: 232px; }
.admin-header { position: sticky; z-index: 20; top: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.header-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-title h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.header-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.account-badge { max-width: 220px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-app.sales-account .overview-layout { grid-template-columns: 1fr; }
.icon-command { width: 38px; height: 38px; border: 1px solid var(--line); background: white; display: inline-grid; place-items: center; cursor: pointer; }
.icon-command:hover { border-color: #9aa69e; background: var(--soft); }
.icon-command:disabled { opacity: .45; cursor: default; }
.icon-command svg { width: 17px; }
.table-row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.mobile-menu { display: none; }
.sync-button { height: 38px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--brand); color: white; padding: 0 15px; font-size: 13px; font-weight: 800; cursor: pointer; }
.sync-button:hover { background: var(--brand-dark); }
.sync-button:disabled { opacity: .7; cursor: wait; }
.sync-button svg { width: 16px; }
.sync-button.syncing svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.admin-content { padding: 28px 30px 46px; max-width: 1600px; margin: 0 auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); background: white; border: 1px solid var(--line); }
.metric { min-height: 122px; padding: 23px 24px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric > span svg { width: 16px; color: var(--green); }
.metric strong { display: block; margin: 10px 0 5px; font-size: 28px; line-height: 1; }
.metric small { color: #7b877f; font-size: 11px; }
.metric.loading span, .metric.loading strong, .metric.loading small { display: block; height: 11px; width: 55%; background: #edf1ee; color: transparent; }
.metric.loading strong { height: 27px; width: 35%; margin-top: 14px; }
.metric.loading small { width: 68%; }
.overview-layout { margin-top: 22px; display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 22px; }
.work-section { min-width: 0; background: white; border: 1px solid var(--line); padding: 24px; }
.discount-policy-overview { margin-bottom: 18px; border: 1px solid var(--line); background: white; }
.discount-policy-overview-heading { min-height: 82px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: #f8fbfc; }
.discount-policy-overview-heading > div { min-width: 0; }
.discount-policy-overview-heading span, .discount-policy-form-heading span { color: var(--green); font-size: 10px; font-weight: 900; }
.discount-policy-overview-heading h3, .discount-policy-form-heading h3 { margin: 4px 0 0; font-size: 16px; }
.discount-policy-overview-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.discount-policy-status { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #a9d5bc; border-radius: 4px; color: var(--green-dark); background: var(--green-soft); font-size: 10px; }
.discount-policy-status.inactive { border-color: #d4dade; color: #667680; background: #edf1f3; }
.discount-policy-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.discount-summary-item, .discount-summary-empty { min-width: 0; min-height: 118px; padding: 18px 22px; display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 12px; border-bottom: 1px solid var(--line); }
.discount-summary-item:nth-child(odd), .discount-summary-empty:nth-child(odd) { border-right: 1px solid var(--line); }
.discount-policy-summary > :last-child, .discount-policy-summary > :nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.discount-summary-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; color: var(--brand-dark); background: var(--brand-soft); }
.discount-summary-icon svg, .discount-summary-empty > svg { width: 17px; height: 17px; }
.discount-summary-title { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.discount-summary-title strong, .discount-summary-empty strong { min-width: 0; font-size: 13px; }
.discount-summary-title span { flex: 0 0 auto; padding: 3px 6px; border-radius: 3px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.discount-summary-title span.inactive { color: #6d767b; background: #edf1f3; }
.discount-summary-item p, .discount-summary-empty p { margin: 7px 0 0; color: #40535d; font-size: 11px; line-height: 1.55; }
.discount-summary-item small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.discount-summary-empty { min-height: 84px; align-items: center; color: var(--muted); }
.discount-summary-empty > svg { margin: 8px; }
.discount-policy-form-heading { margin-bottom: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.discount-policy-notice { min-height: 58px; display: flex; align-items: center; gap: 10px; margin: 16px 0; padding: 11px 13px; border: 1px solid #bcd8e6; color: #24566f; background: #eef8fc; }
.discount-policy-notice > svg { width: 18px; height: 18px; flex: 0 0 18px; }
.discount-policy-notice strong, .discount-policy-notice span { display: block; }
.discount-policy-notice strong { font-size: 11px; }
.discount-policy-notice span { margin-top: 3px; font-size: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-title span { color: var(--green); font-size: 10px; font-weight: 900; }
.section-title h2 { margin: 4px 0 0; font-size: 17px; }
.text-command { border: 0; background: transparent; color: var(--green); display: inline-flex; align-items: center; gap: 6px; padding: 4px; cursor: pointer; font-size: 12px; font-weight: 700; }
.text-command svg { width: 14px; }
.inventory-bars { display: grid; gap: 17px; }
.inventory-line { display: grid; grid-template-columns: 84px minmax(100px,1fr) 58px; align-items: center; gap: 12px; font-size: 12px; }
.inventory-line > span { color: var(--muted); }
.inventory-line > strong { text-align: right; font-size: 12px; }
.bar-track { height: 7px; background: #edf1ee; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--green); }
.inventory-line.orange .bar-track i { background: var(--orange); }
.inventory-line.gray .bar-track i { background: #87938b; }
.source-status { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 16px; font-size: 11px; }
.source-status strong { color: var(--ink); }
.data-freshness-alert { min-height: 58px; margin-bottom: 16px; padding: 12px 15px; display: flex; align-items: center; gap: 12px; border: 1px solid #efd09f; border-left: 4px solid #d48a20; color: #704a12; background: #fff8e9; }
.data-freshness-alert.danger { border-color: #e6b1b1; border-left-color: #b84b4b; color: #7e2f2f; background: #fff1f1; }
.data-freshness-alert svg { width: 20px; height: 20px; flex: 0 0 auto; }
.data-freshness-alert div { min-width: 0; }
.data-freshness-alert strong, .data-freshness-alert span { display: block; }
.data-freshness-alert strong { font-size: 12px; }
.data-freshness-alert span { margin-top: 4px; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.compact-orders { min-height: 190px; }
.compact-order { width: 100%; min-height: 62px; padding: 11px 0; border: 0; border-bottom: 1px solid #edf0ee; background: transparent; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; text-align: left; cursor: pointer; }
.compact-order:last-child { border-bottom: 0; }
.compact-order strong, .compact-order span, .compact-order small { display: block; }
.compact-order strong { font-size: 13px; }
.compact-order span { margin-top: 4px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-order b { align-self: center; font-size: 13px; }
.empty-copy { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.admin-search { width: min(520px, 100%); height: 42px; background: white; border: 1px solid var(--line); display: flex; align-items: center; }
.admin-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,122,75,.08); }
.admin-search svg { width: 17px; margin-left: 13px; color: #7c8880; }
.admin-search input { min-width: 0; flex: 1; height: 100%; padding: 0 12px; border: 0; outline: 0; background: transparent; }
.filter-select { height: 42px; display: flex; align-items: center; background: white; border: 1px solid var(--line); padding-left: 12px; }
.filter-select > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.filter-select select { height: 100%; border: 0; outline: 0; background: transparent; padding: 0 30px 0 9px; cursor: pointer; font-size: 12px; }
.bulk-bar { min-height: 46px; margin-bottom: 12px; padding: 7px 12px; background: var(--green-soft); border: 1px solid #bfe0cc; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bulk-bar select { height: 30px; border: 1px solid #b4cdbd; background: white; padding: 0 26px 0 8px; }
.bulk-bar button { height: 30px; border: 0; padding: 0 12px; background: var(--green); color: white; cursor: pointer; }
.bulk-bar .clear-selection { background: transparent; color: var(--muted); }
.table-tool { background: white; border: 1px solid var(--line); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 43px; background: #f7f9f7; color: #667169; border-bottom: 1px solid var(--line); padding: 0 13px; font-size: 11px; text-align: left; white-space: nowrap; }
.data-table td { height: 66px; border-bottom: 1px solid #edf0ee; padding: 8px 13px; font-size: 12px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcfb; }
.check-column { width: 42px; text-align: center !important; }
.check-column input, .row-check { width: 15px; height: 15px; accent-color: var(--green); }
.action-column { width: 70px; text-align: right !important; }
.product-table th:nth-child(2) { width: 32%; }
.product-table th:nth-child(3) { width: 18%; }
.product-table th:nth-child(4) { width: 175px; }
.product-table th:nth-child(5) { width: 130px; }
.product-table th:nth-child(6) { width: 130px; }
.product-table .action-column { width: 96px; }
.table-product { display: flex; align-items: center; gap: 11px; min-width: 0; }
.table-thumb { width: 45px; height: 45px; flex: 0 0 45px; object-fit: contain; background: #f2f5f2; border: 1px solid #e7ece8; }
.table-thumb-placeholder { width: 45px; height: 45px; flex: 0 0 45px; display: grid; place-items: center; background: #f2f5f2; color: #a3ada6; }
.table-thumb-placeholder svg { width: 18px; }
.table-product div { min-width: 0; }
.table-product strong, .table-product span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-product strong { font-size: 12px; }
.table-product span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.price-cell strong, .price-cell small { display: block; }
.price-cell small { margin-top: 3px; color: var(--orange); font-size: 9px; }
.stock-cell strong, .stock-cell small { display: block; }
.stock-cell small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.stock-cell.shortage strong { color: var(--red); }
.stock-cell.shortage.scheduled small { color: #a45d18; }
.stock-cell.shortage.delayed small { color: var(--red); }
.stock-cell.review strong { color: #a45d18; }
.stock-cell.review small { color: #a45d18; }
.status-pill.review { color: #95500d; background: #fff1d9; }
.status-stack { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 800; white-space: nowrap; }
.status-pill.hidden { color: #6b716d; background: #ecefed; }
.status-pill.featured { color: #a74623; background: #fff0e9; }
.row-edit { margin-left: auto; }
.table-empty { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 9px; color: var(--muted); }
.table-empty svg { width: 28px; }
.table-empty strong { font-size: 13px; }
.pagination { min-height: 56px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.pagination > div { display: flex; align-items: center; gap: 9px; }
.order-table { min-width: 1580px; }
.order-table th:nth-child(1) { width: 150px; }
.order-table th:nth-child(2) { width: 210px; }
.order-table th:nth-child(3) { width: 105px; }
.order-table th:nth-child(4) { width: 120px; }
.order-table th:nth-child(5) { width: 100px; }
.order-table th:nth-child(6) { width: 70px; }
.order-table th:nth-child(7) { width: 310px; }
.order-table th:nth-child(8) { width: 100px; }
.order-table th:nth-child(9) { width: 110px; }
.order-table th:nth-child(10) { width: 110px; }
.order-table th:nth-child(11) { width: 150px; }
.customer-cell strong, .customer-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-cell span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.customer-cell .delivery-hold-note { display: block; width: fit-content; margin-top: 5px; padding: 3px 6px; color: #9a3d23; background: #fff0e9; font-size: 9px; font-weight: 800; }
.order-delivery-cell strong, .order-delivery-cell span, .order-delivery-cell small { display: block; }
.order-delivery-cell strong { font-size: 11px; }
.order-delivery-cell span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.order-delivery-cell small { margin-top: 5px; color: #59645d; font-size: 9px; line-height: 1.4; overflow-wrap: anywhere; }
.order-delivery-cell .order-delivery-date { color: #a14b27; font-weight: 800; }
.order-status { display: inline-flex; align-items: center; height: 23px; padding: 0 8px; background: #edf1ee; color: #5e6861; font-size: 9px; font-weight: 800; }
.order-status.new { color: #a74623; background: #fff0e9; }
.order-status.confirmed, .order-status.picking { color: var(--green-dark); background: var(--green-soft); }
.order-status.delivering { color: #1b5f78; background: #e7f3f7; }
.order-status.cancelled { color: #984141; background: #faeaea; }

.admin-dialog { width: min(850px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; box-shadow: var(--shadow); color: var(--ink); }
.admin-dialog::backdrop { background: rgba(10,18,13,.56); }
.dialog-shell { margin: 0; }
.dialog-heading { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog-heading span { color: var(--green); font-size: 9px; font-weight: 900; }
.dialog-heading h2 { margin: 3px 0 0; font-size: 19px; }
.dialog-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.editor-layout { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 28px; padding: 24px; }
.image-editor { min-width: 0; }
.edit-image-preview { width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: #f4f6f4; border: 1px solid var(--line); overflow: hidden; color: #98a299; }
.edit-image-preview img { width: 100%; height: 100%; object-fit: contain; }
.edit-image-preview svg { width: 42px; }
.edit-image-gallery { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.edit-image-gallery:empty { display: none; }
.edit-image-gallery button { width: 45px; height: 45px; flex: 0 0 45px; overflow: hidden; padding: 2px; border: 1px solid var(--line); background: white; cursor: pointer; }
.edit-image-gallery button.active { border: 2px solid var(--green); padding: 1px; }
.edit-image-gallery img { width: 100%; height: 100%; object-fit: contain; }
.image-actions { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.image-actions label, .image-actions button { height: 34px; border: 1px solid var(--line); background: white; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 11px; }
.image-actions svg { width: 14px; }
.image-editor > small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.edit-fields { display: grid; align-content: start; gap: 9px; }
.edit-fields > label, .order-edit-row label { display: grid; gap: 6px; }
.edit-fields label > span, .order-edit-row label > span { font-size: 11px; font-weight: 800; }
.edit-fields input, .edit-fields textarea, .order-edit-row select, .order-edit-row textarea { width: 100%; border: 1px solid #cfd8d1; background: white; outline: 0; padding: 9px 10px; font-size: 12px; resize: vertical; }
.edit-fields input { height: 39px; }
.edit-fields input:focus, .edit-fields textarea:focus, .order-edit-row select:focus, .order-edit-row textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,122,75,.08); }
.field-help { min-height: 16px; color: var(--muted); font-size: 9px; }
.toggle-row { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 24px; }
.switch-control { position: relative; display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px !important; cursor: pointer; }
.switch-control input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.switch-control > span { position: relative; width: 36px; height: 20px; border-radius: 10px; background: #cbd3cd; transition: .2s; }
.switch-control > span::after { content: ""; position: absolute; width: 16px; height: 16px; top: 2px; left: 2px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch-control input:checked + span { background: var(--green); }
.switch-control input:checked + span::after { transform: translateX(16px); }
.switch-control input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 3px; }
.switch-control b { font-size: 11px; }
.dialog-footer { min-height: 66px; padding: 13px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.primary-command, .secondary-command { min-height: 38px; border: 0; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 12px; font-weight: 800; }
.primary-command { color: white; background: var(--green); }
.primary-command:hover { background: var(--green-dark); }
.primary-command:disabled { opacity: .55; cursor: wait; }
.secondary-command { color: var(--ink); background: #edf1ee; }
.primary-command svg { width: 15px; }
.order-detail { width: min(1180px, calc(100vw - 32px)); }
.customer-summary { margin: 20px 22px 0; padding: 14px 16px; background: var(--soft); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.customer-summary div { min-width: 0; }
.customer-summary span, .customer-summary strong { display: block; }
.customer-summary span { color: var(--muted); font-size: 9px; }
.customer-summary strong { margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.customer-summary .remarks { grid-column: 1 / -1; }
.customer-summary .delivery-hold-warning { padding: 10px 12px; border-left: 3px solid #c9512e; background: #fff0e9; color: #913a21; }
.customer-summary .delivery-hold-warning span { color: #a24a2e; }
.order-delivery-editor { padding: 16px 22px 0; }
.order-delivery-editor label, .order-delivery-editor span { display: block; }
.order-delivery-editor span { margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.order-delivery-editor textarea { width: 100%; min-height: 64px; resize: vertical; padding: 9px 11px; border: 1px solid var(--line); background: white; font: inherit; line-height: 1.45; outline: none; }
.order-delivery-editor textarea:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(25,112,72,.1); }
.order-lines-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px 0; }
.order-lines-heading > div span, .order-lines-heading > div strong { display: block; }
.order-lines-heading > div span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.order-lines-heading > div strong { margin-top: 3px; font-size: 12px; }
.order-lines-heading button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.order-lines-heading button svg { width: 15px; }
.order-product-search { position: relative; margin: 10px 22px 0; border: 1px solid var(--line); background: white; }
.order-product-search [role="search"] { height: 42px; display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: center; gap: 6px; padding: 0 10px; }
.order-product-search [role="search"] svg { width: 16px; color: var(--muted); }
.order-product-search input { width: 100%; min-width: 0; height: 40px; border: 0; outline: 0; font-size: 12px; }
.order-product-results { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line); }
.order-product-results > button { width: 100%; min-height: 54px; display: grid; grid-template-columns: minmax(0,1fr) auto 28px; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-bottom: 1px solid #edf0ee; background: white; text-align: left; cursor: pointer; }
.order-product-results > button:last-child { border-bottom: 0; }
.order-product-results > button:hover { background: #f4f8f5; }
.order-product-results > button span, .order-product-results > button strong, .order-product-results > button small { min-width: 0; display: block; }
.order-product-results > button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.order-product-results > button small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.order-product-results > button b { color: var(--green-dark); font-size: 11px; white-space: nowrap; }
.order-product-results > button svg { width: 16px; color: var(--green); }
.order-product-search-status { padding: 12px; color: var(--muted); font-size: 10px; }
/* Contain positioned accessibility labels inside the table's own scroller. */
.order-lines-wrap { position: relative; margin: 12px 22px 18px; max-height: 340px; overflow: auto; border: 1px solid var(--line); }
.order-lines-wrap table { width: 100%; min-width: 1010px; border-collapse: collapse; table-layout: fixed; }
.order-lines-wrap th, .order-lines-wrap td { padding: 9px 10px; border-bottom: 1px solid #edf0ee; font-size: 11px; text-align: left; }
.order-lines-wrap th { background: #f7f9f7; color: var(--muted); font-size: 10px; }
.order-lines-wrap th:nth-child(1) { width: 105px; }
.order-lines-wrap th:nth-child(2) { width: 230px; }
.order-lines-wrap th:nth-child(3) { width: 90px; }
.order-lines-wrap th:nth-child(4) { width: 165px; }
.order-lines-wrap th:nth-child(5) { width: 105px; }
.order-lines-wrap th:nth-child(6) { width: 115px; }
.order-lines-wrap th:nth-child(7) { width: 115px; }
.order-lines-wrap th:nth-child(8) { width: 52px; }
.order-lines-wrap input, .order-lines-wrap select { width: 100%; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid var(--line); background: white; outline: none; font-size: 11px; }
.order-lines-wrap input:focus, .order-lines-wrap select:focus { border-color: var(--green); }
.order-edit-product-name { display: block; overflow-wrap: anywhere; line-height: 1.4; }
.order-line-discount { display: grid; grid-template-columns: minmax(0,1fr) 18px; align-items: center; }
.order-line-discount span { color: var(--muted); text-align: right; font-size: 10px; }
.order-line-delete { width: 34px; height: 34px; color: #a23b2a; }
.order-line-delete:disabled { opacity: .3; cursor: not-allowed; }
.order-line-delete svg { width: 15px; }
.order-edit-loading { height: 90px; color: var(--muted); text-align: center !important; }
.sales-confirmation-row { background: #fffaf0; }
.sales-confirmation-note { display: block; margin-top: 4px; color: #a45d18; font-size: 9px; font-weight: 700; }
.order-edit-row { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 0 22px 20px; }
.order-edit-row select { height: 39px; }
.order-detail .dialog-footer { justify-content: space-between; flex-wrap: wrap; }
.order-detail .dialog-footer > strong { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; color: var(--orange); font-size: 20px; }
.order-detail .dialog-footer > strong small { color: var(--muted); font-size: 10px; font-weight: 700; }
.order-discount-cell strong, .order-discount-cell small { display: block; }
.order-discount-cell strong { color: #174f86; }
.order-discount-cell small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.image-order-dialog { width: min(1380px, calc(100vw - 32px)); }
.image-order-dialog .dialog-shell { width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.image-order-body { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 22px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.image-order-source { display: grid; align-content: start; gap: 10px; }
.image-order-source[hidden] { display: none; }
.image-order-dialog.manual-order .image-order-body { grid-template-columns: 1fr; }
.image-order-upload { min-height: 190px; max-height: 260px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #94a19a; background: #f8faf8; cursor: pointer; }
.image-order-upload:hover { border-color: var(--green); background: #f4faf6; }
.image-order-upload img { width: 100%; height: 100%; max-height: 260px; object-fit: contain; background: #eef1ef; }
.image-order-upload > span { display: grid; justify-items: center; gap: 6px; color: var(--muted); text-align: center; padding: 20px; }
.image-order-upload svg { width: 28px; height: 28px; color: var(--green); }
.image-order-upload strong { color: var(--ink); font-size: 13px; }
.image-order-upload small { font-size: 10px; }
.image-order-source > button { width: 100%; justify-content: center; }
.image-order-loading { position: relative; min-height: 58px; display: grid; grid-template-columns: 28px minmax(0,1fr); align-items: center; gap: 10px; overflow: hidden; padding: 10px 12px 13px; border: 1px solid #b7d2c2; background: #f2f8f4; color: var(--green); }
.image-order-loading[hidden] { display: none; }
.image-order-loading > svg { width: 24px; height: 24px; animation: image-order-spin .85s linear infinite; }
.image-order-loading > span:not(.image-order-loading-track) { display: grid; gap: 2px; min-width: 0; }
.image-order-loading strong { color: var(--ink); font-size: 11px; }
.image-order-loading small { color: var(--muted); font-size: 9px; }
.image-order-loading-track { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; overflow: hidden; background: #dbe9df; }
.image-order-loading-track i { position: absolute; top: 0; bottom: 0; width: 38%; background: var(--green); animation: image-order-progress 1.35s ease-in-out infinite; }
.is-spinning { animation: image-order-spin .85s linear infinite; }
@keyframes image-order-spin { to { transform: rotate(360deg); } }
@keyframes image-order-progress { from { left: -38%; } to { left: 100%; } }
.image-order-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; align-content: start; }
.image-order-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.image-order-fields input, .image-order-fields select, .image-order-fields textarea { width: 100%; min-width: 0; border: 1px solid var(--line); background: white; color: var(--ink); padding: 9px 10px; outline: none; }
.image-order-fields input, .image-order-fields select { height: 40px; }
.image-order-fields input:focus, .image-order-fields select:focus, .image-order-fields textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,122,75,.08); }
.image-order-fields .image-order-wide { grid-column: 1 / -1; }
.image-order-customer-summary { grid-column: span 2; min-height: 40px; display: flex; align-items: center; padding: 8px 11px; border-left: 3px solid #90a79a; background: #f5f7f5; color: var(--muted); font-size: 11px; }
.image-order-customer-summary.selected { border-left-color: var(--green); color: var(--ink); }
.image-order-results { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.image-order-result-summary { min-height: 40px; display: flex; align-items: center; gap: 16px; padding: 8px 22px; background: #f6f8f6; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.image-order-result-summary strong { color: var(--ink); }
.image-order-table-wrap { min-height: 180px; max-height: 44vh; overflow: auto; }
.image-order-table { width: 100%; min-width: 1120px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.image-order-table th { position: sticky; z-index: 2; top: 0; height: 40px; padding: 0 10px; background: #f7f9f7; border-bottom: 1px solid var(--line); color: #667169; font-size: 10px; text-align: left; white-space: nowrap; }
.image-order-table th:nth-child(1) { width: 14%; }
.image-order-table th:nth-child(2) { width: 31%; }
.image-order-table th:nth-child(3) { width: 10%; }
.image-order-table th:nth-child(4) { width: 16%; }
.image-order-table th:nth-child(5) { width: 12%; }
.image-order-table th:nth-child(6) { width: 13%; }
.image-order-table th:nth-child(7) { width: 52px; }
.image-order-table td { padding: 9px 10px; border-bottom: 1px solid #edf0ee; font-size: 11px; vertical-align: top; }
.image-order-table th:last-child, .image-order-table td:last-child { position: sticky; right: 0; z-index: 1; width: 52px; padding-right: 8px; padding-left: 8px; background: white; border-left: 1px solid #edf0ee; text-align: center; }
.image-order-table th:last-child { z-index: 3; background: #f7f9f7; }
.image-order-table td > strong, .image-order-table td > small { display: block; }
.image-order-table td > small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.image-order-table select, .image-order-table input { width: 100%; min-width: 0; height: 38px; border: 1px solid var(--line); background: white; padding: 0 8px; outline: none; font-size: 12px; }
.image-order-table select:focus, .image-order-table input:focus { border-color: var(--green); }
.image-order-product-choice { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 5px; }
.image-order-product-choice .icon-command, .image-order-product-search .icon-command { width: 38px; height: 38px; }
.image-order-product-search { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #e5ebe7; }
.image-order-product-search > div:first-child { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 5px; }
.image-order-search-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.image-order-search-status svg { width: 13px; height: 13px; animation: image-order-spin .85s linear infinite; }
.image-order-search-status.error { color: #ad3f2b; }
.image-order-search-results { max-height: 190px; overflow-y: auto; border: 1px solid var(--line); background: white; }
.image-order-search-results button { width: 100%; display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 2px 7px; padding: 7px 8px; border: 0; border-bottom: 1px solid #edf0ee; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.image-order-search-results button:last-child { border-bottom: 0; }
.image-order-search-results button:hover, .image-order-search-results button:focus-visible { background: #eef7f1; outline: none; }
.image-order-search-results strong { grid-row: span 2; color: var(--green); font-size: 10px; overflow-wrap: anywhere; }
.image-order-search-results span, .image-order-search-results small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-order-search-results span { font-size: 10px; }
.image-order-search-results small { color: var(--muted); font-size: 8px; }
.image-order-delete { width: 34px; height: 34px; color: #ad3f2b; }
.image-order-delete:hover { background: #fff0ed; color: #8e2f20; }
.image-order-quantity { display: grid; grid-template-columns: minmax(55px,1fr) minmax(50px,.8fr); gap: 5px; }
.image-order-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 7px; background: #eef7f1; color: #1f7049; font-size: 10px; line-height: 1.25; }
.image-order-status.review { background: #fff3da; color: #8a5b00; }
.image-order-status.warning { background: #fff0ed; color: #ad3f2b; }
.image-order-result-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 22px; border-bottom: 1px solid var(--line); }
.image-order-result-heading .image-order-result-summary { padding: 0; border: 0; }
.image-order-result-heading .secondary-command { flex: 0 0 auto; }
.image-order-ack { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 9px 22px; background: #fff5ee; border-top: 1px solid #f0cdbd; color: #8f3c28; font-size: 11px; }
.image-order-ack input { width: 17px; height: 17px; accent-color: var(--orange); }
.image-order-footer { justify-content: flex-end; }
.image-order-footer > strong { margin-right: auto; color: var(--orange); font-size: 19px; }
@media (prefers-reduced-motion: reduce) {
  .image-order-loading > svg, .image-order-loading-track i, .is-spinning, .image-order-search-status svg { animation-duration: 2.8s; }
}
.order-detail-actions { position: relative; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.order-detail-actions > button, .copy-sap-control > #copy-sap-order { height: auto; min-height: 38px; padding-block: 8px; }
.order-detail-actions svg { width: 15px; flex: 0 0 auto; }
.copy-sap-control { position: relative; display: flex; }
.copy-sap-control > #copy-sap-order { width: 100%; }
.copy-sap-confirm { position: absolute; z-index: 4; right: 0; bottom: calc(100% + 10px); width: min(310px, calc(100vw - 44px)); padding: 13px; border: 1px solid #aab7af; background: white; box-shadow: 0 10px 28px rgba(31,48,38,.18); }
.copy-sap-confirm[hidden], .order-lock-notice[hidden] { display: none; }
.copy-sap-confirm::after { content: ""; position: absolute; right: 34px; bottom: -6px; width: 10px; height: 10px; border-right: 1px solid #aab7af; border-bottom: 1px solid #aab7af; background: white; transform: rotate(45deg); }
.copy-sap-confirm > strong { display: block; color: var(--ink); font-size: 13px; }
.copy-sap-confirm p { margin: 5px 0 11px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.copy-sap-confirm > div { display: flex; justify-content: flex-end; gap: 7px; }
.copy-sap-confirm button { min-height: 34px; padding: 0 10px; font-size: 10px; white-space: nowrap; }
.order-lock-notice { min-height: 40px; margin: 0 22px 16px; padding: 9px 12px; display: flex; align-items: center; gap: 8px; border-left: 3px solid var(--green); background: var(--green-soft); color: var(--green-dark); font-size: 11px; font-weight: 800; }
.order-lock-notice svg { width: 16px; height: 16px; }
.order-detail.is-locked .order-lines-wrap input:disabled, .order-detail.is-locked .order-lines-wrap select:disabled, .order-detail.is-locked textarea:disabled { color: #606862; background: #f2f4f2; cursor: not-allowed; opacity: 1; }
.secondary-command:disabled { opacity: .55; cursor: not-allowed; }
.danger-command { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid #d8a6a6; border-radius: 4px; color: #9a3030; background: #fff5f5; font-weight: 800; cursor: pointer; }
.danger-command:hover { border-color: #bd6666; color: white; background: #b84343; }
.danger-command:disabled { border-color: var(--line); color: #9a9a9a; background: #f3f3f3; cursor: not-allowed; }
.admin-toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 32px)); transform: translateY(18px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 12px 16px; box-shadow: var(--shadow); font-size: 12px; transition: .2s; }
.admin-toast.show { transform: translateY(0); opacity: 1; }

.insight-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); margin-bottom: 16px; background: white; border: 1px solid var(--line); }
.usage-panel { min-width: 0; }
.usage-toolbar { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
.usage-unused { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.usage-note { color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.usage-error { color: #a12626; }
.usage-table { min-width: 820px; }
.usage-table td small { display: block; margin-top: 4px; color: var(--muted); }
.usage-trend { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 10px 0; }
.usage-day { flex: 1 0 38px; display: flex; align-items: center; flex-direction: column; justify-content: flex-end; min-height: 126px; gap: 5px; font-size: 10px; }
.usage-day i { display: block; width: 20px; min-height: 1px; background: var(--green); }
.usage-day small { color: var(--muted); white-space: nowrap; }
.usage-daily-details { margin-top: 12px; font-size: 12px; }
.usage-daily-details summary { cursor: pointer; padding: 8px 0; }
.usage-panel .rank-chart-row { grid-template-columns: 22px minmax(100px,200px) minmax(20px,1fr) 64px; }
.insight-metric { min-width: 0; min-height: 92px; padding: 17px 18px; border-right: 1px solid var(--line); }
.insight-metric:last-child { border-right: 0; }
.insight-metric span, .insight-metric strong, .insight-metric small { display: block; }
.insight-metric span { color: var(--muted); font-size: 10px; font-weight: 700; }
.insight-metric strong { margin: 8px 0 4px; overflow: hidden; text-overflow: ellipsis; font-size: 21px; white-space: nowrap; }
.insight-metric small { color: #879089; font-size: 9px; }
.analysis-tabs { margin-bottom: 14px; display: flex; overflow-x: auto; background: white; border: 1px solid var(--line); scrollbar-width: thin; }
.analysis-tabs button { min-width: max-content; height: 39px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.analysis-tabs button:hover { color: var(--ink); background: var(--soft); }
.analysis-tabs button.active { color: white; background: var(--green); }
.analytics-toolbar, .customer-toolbar { margin-bottom: 14px; }
.heat-toolbar { margin-bottom: 14px; justify-content: flex-start; flex-wrap: wrap; }
.heat-toolbar .admin-search { flex: 1 1 320px; }
.heat-customer-filter, .heat-seconds-filter { min-height: 42px; display: flex; align-items: center; gap: 8px; background: white; border: 1px solid var(--line); padding: 0 12px; }
.heat-customer-filter > span, .heat-seconds-filter > span:first-child { color: var(--muted); font-size: 11px; white-space: nowrap; }
.heat-customer-filter input { width: 160px; height: 40px; border: 0; outline: 0; text-transform: uppercase; }
.number-suffix { height: 40px; display: flex; align-items: center; }
.number-suffix input { width: 58px; height: 100%; border: 0; outline: 0; text-align: right; }
.number-suffix b { color: var(--muted); font-size: 11px; }
.heat-scope { min-height: 38px; margin: -2px 0 14px; padding: 9px 13px; border: 1px solid #b9d8c6; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 700; }
.heat-scope:empty { display: none; }
.order-scope { min-height: 38px; margin: -2px 0 14px; padding: 7px 10px 7px 13px; border: 1px solid #b9d8c6; background: var(--green-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.order-scope button { width: 24px; height: 24px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: inherit; }
.order-scope svg { width: 14px; }
.toolbar-selects { display: flex; align-items: center; gap: 10px; }
/* Wrap controls to the workspace width; wide data tables keep their own scroller. */
.customer-toolbar, .crm-toolbar, .order-toolbar { min-width: 0; flex-wrap: wrap; }
.customer-toolbar > .admin-search, .crm-toolbar > .admin-search, .order-toolbar > .admin-search { min-width: 0; }
.customer-toolbar > .toolbar-selects, .crm-toolbar > .toolbar-selects, .order-toolbar > .toolbar-selects { flex: 0 1 auto; min-width: 0; max-width: 100%; flex-wrap: wrap; }
.customer-toolbar .filter-select, .crm-toolbar .filter-select, .order-toolbar .filter-select { min-width: 0; max-width: 100%; }
/* Contain WebKit's closed native-option overflow without clipping the toolbar. */
.customer-toolbar .filter-select select, .crm-toolbar .filter-select select, .order-toolbar .filter-select select { flex: 1; min-width: 0; contain: paint; text-overflow: ellipsis; }
.order-toolbar .toolbar-selects > button { flex-shrink: 0; white-space: nowrap; }
@media (min-width: 761px) {
  .customer-toolbar > .admin-search, .crm-toolbar > .admin-search, .order-toolbar > .admin-search { flex: 1 1 260px; }
}
.analysis-chart-panel { margin-bottom: 14px; padding: 18px 20px; background: white; border: 1px solid var(--line); }
.analysis-chart-panel .section-title { margin-bottom: 14px; }
.analysis-chart-panel .section-title small { color: var(--muted); font-size: 9px; }
.rank-chart { display: grid; gap: 8px; }
.rank-chart-row { min-width: 0; display: grid; grid-template-columns: 22px minmax(150px,240px) minmax(120px,1fr) 90px; align-items: center; gap: 10px; font-size: 10px; }
.rank-chart-row > b { color: #8a948d; font-size: 10px; text-align: center; }
.rank-chart-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-chart-row > strong { text-align: right; font-size: 10px; }
.rank-track { height: 9px; background: #edf1ee; overflow: hidden; }
.rank-track i { display: block; height: 100%; background: var(--green); }
.rank-chart-row:nth-child(-n+3) .rank-track i { background: var(--orange); }
.analytics-table { min-width: 1120px; }
.heat-table { min-width: 1050px; }
.heat-table .rank-column { width: 60px; text-align: center; }
.heat-table th:nth-child(2) { width: 32%; }
.heat-table td:not(.heat-product-cell) { white-space: nowrap; }
.analytics-table .rank-column { width: 54px; text-align: center; }
.analytics-table th:nth-child(2) { width: 28%; }
.analytics-table th:nth-child(3) { width: 100px; }
.analytics-table th:nth-child(4) { width: 115px; }
.analytics-table th:nth-child(5) { width: 130px; }
.analytics-table th:nth-child(6) { width: 110px; }
.analytics-table th:nth-child(7), .analytics-table th:nth-child(8) { width: 100px; }
.analytics-rank { text-align: center; color: var(--muted); font-weight: 800; }
.heat-cell { display: flex; align-items: center; gap: 7px; }
.heat-score { min-width: 28px; color: var(--green-dark); font-weight: 900; }
.heat-track { width: 45px; height: 5px; background: #e6ebe7; }
.heat-track i { display: block; height: 100%; background: var(--green); }
.heat-label { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; color: #6c746f; background: #edf0ee; font-size: 8px; font-weight: 800; }
.heat-label.hot { color: #a74623; background: #fff0e9; }
.heat-label.strong { color: var(--green-dark); background: var(--green-soft); }
.trend-value { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; }
.trend-value.up { color: var(--green); }
.trend-value.down { color: var(--red); }
.trend-value svg { width: 12px; }
.analytics-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

.customer-table { min-width: 1240px; }
.customer-table th:nth-child(1) { width: 24%; }
.customer-table th:nth-child(2) { width: 130px; }
.customer-table th:nth-child(3) { width: 130px; }
.customer-table th:nth-child(4) { width: 125px; }
.customer-table th:nth-child(5) { width: 18%; }
.customer-table th:nth-child(6) { width: 115px; }
.customer-table th:nth-child(7), .customer-table th:nth-child(8) { width: 95px; }
.customer-cell-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.customer-mini-avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: white; background: #647168; font-size: 11px; font-weight: 900; }
.customer-cell-main > div { min-width: 0; }
.customer-cell-main strong, .customer-cell-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-cell-main span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.profile-badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tier-badge, .lifecycle-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 21px; padding: 0 7px; background: #edf0ee; color: #5f6862; font-size: 8px; font-weight: 900; }
.tier-badge.A { background: #fff0e9; color: #ad4926; }
.tier-badge.B { background: var(--green-soft); color: var(--green-dark); }
.lifecycle-badge.active, .lifecycle-badge.new { background: var(--green-soft); color: var(--green-dark); }
.lifecycle-badge.cooling, .lifecycle-badge.at-risk, .lifecycle-badge.lost { background: #fff1dd; color: #9b5b19; }
.lifecycle-badge.dormant, .lifecycle-badge.prospect { background: #ecefed; color: #6c746f; }
.customer-score { color: var(--muted); font-size: 9px; }
.preference-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overdue-value { color: var(--red); font-weight: 800; }

.customer-profile-dialog { width: min(980px,calc(100vw - 32px)); }
.customer-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.customer-avatar { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; color: white; background: var(--green); font-size: 15px !important; font-weight: 900 !important; }
.profile-body { max-height: calc(100vh - 170px); overflow-y: auto; padding: 20px 22px 24px; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.profile-tags span { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.profile-tags span.warning { color: #9b5b19; background: #fff1dd; }
.profile-tags span.danger { color: #994040; background: #faeaea; }
.profile-kpis { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); border: 1px solid var(--line); }
.profile-kpi { min-width: 0; padding: 13px 14px; border-right: 1px solid var(--line); }
.profile-kpi:last-child { border-right: 0; }
.profile-kpi span, .profile-kpi strong { display: block; }
.profile-kpi span { color: var(--muted); font-size: 8px; }
.profile-kpi strong { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.profile-grid { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-section { min-width: 0; border: 1px solid var(--line); padding: 15px; }
.profile-section-title { display: flex; align-items: center; gap: 7px; margin-bottom: 13px; }
.profile-section-title svg { width: 15px; color: var(--green); }
.profile-section-title strong { font-size: 12px; }
.profile-section dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 16px; }
.profile-section dl div { min-width: 0; }
.profile-section dt, .profile-section dd { margin: 0; }
.profile-section dt { color: var(--muted); font-size: 8px; }
.profile-section dd { margin-top: 4px; overflow-wrap: anywhere; font-size: 10px; font-weight: 700; }
.preference-list { display: grid; gap: 7px; }
.preference-item { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding-bottom: 7px; border-bottom: 1px solid #edf0ee; }
.preference-item:last-child { padding-bottom: 0; border-bottom: 0; }
.preference-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.preference-item strong { font-size: 10px; }
.customer-profile-dialog .dialog-footer > span { margin-right: auto; color: var(--muted); font-size: 9px; }

.crm-pipeline { margin-bottom: 14px; padding: 18px 20px 20px; background: white; border: 1px solid var(--line); }
.crm-pipeline .section-title { margin-bottom: 14px; }
.crm-pipeline .section-title small { color: var(--muted); font-size: 9px; }
.crm-stage-board { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); border: 1px solid var(--line); }
.crm-stage { min-width: 0; height: 72px; padding: 10px 12px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--muted); text-align: left; cursor: pointer; }
.crm-stage:last-child { border-right: 0; }
.crm-stage:hover { background: var(--soft); }
.crm-stage.active { color: white; background: var(--green); }
.crm-stage span, .crm-stage strong { display: block; }
.crm-stage span { overflow: hidden; text-overflow: ellipsis; font-size: 9px; font-weight: 800; white-space: nowrap; }
.crm-stage strong { margin-top: 7px; font-size: 20px; }
.crm-overview-grid { margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.crm-work-section { min-width: 0; min-height: 330px; padding: 18px 20px; background: white; border: 1px solid var(--line); }
.crm-work-section .section-title { margin-bottom: 12px; }
.crm-task-list, .crm-activity-list { display: grid; }
.crm-task-row, .crm-activity-row { min-width: 0; min-height: 54px; padding: 9px 0; border-bottom: 1px solid #edf0ee; display: grid; align-items: center; gap: 10px; }
.crm-task-row:last-child, .crm-activity-row:last-child { border-bottom: 0; }
.crm-task-row { grid-template-columns: 28px minmax(0,1fr) auto; }
.crm-task-check { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); background: white; color: var(--green); cursor: pointer; }
.crm-task-check:hover { color: white; background: var(--green); }
.crm-task-check svg { width: 14px; }
.crm-task-main, .crm-activity-main { min-width: 0; }
.crm-task-main strong, .crm-task-main span, .crm-activity-main strong, .crm-activity-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-task-main strong, .crm-activity-main strong { font-size: 11px; }
.crm-task-main span, .crm-activity-main span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.crm-task-due { color: var(--muted); font-size: 9px; font-weight: 800; text-align: right; }
.crm-task-due.overdue { color: var(--red); }
.crm-priority { width: 6px; height: 32px; background: #aab3ad; }
.crm-priority.high { background: var(--red); }
.crm-priority.low { background: #4f879d; }
.crm-activity-row { grid-template-columns: 28px minmax(0,1fr) auto; }
.crm-activity-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); }
.crm-activity-icon svg { width: 13px; }
.crm-activity-time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.crm-toolbar { margin-top: 18px; }
.crm-toolbar-selects { flex: 1; justify-content: flex-end; }
.crm-table { min-width: 1250px; }
.crm-table th:nth-child(1) { width: 24%; }
.crm-table th:nth-child(2) { width: 105px; }
.crm-table th:nth-child(3) { width: 150px; }
.crm-table th:nth-child(4) { width: 17%; }
.crm-table th:nth-child(5), .crm-table th:nth-child(6) { width: 150px; }
.crm-table th:nth-child(7) { width: 125px; }
.crm-table .action-column { width: 100px; }
.crm-stage-badge { display: inline-flex; min-height: 23px; align-items: center; padding: 0 8px; color: #56615a; background: #edf0ee; font-size: 9px; font-weight: 800; }
.crm-stage-badge.lead { color: #445d82; background: #eaf0f8; }
.crm-stage-badge.contacted { color: #7b6026; background: #f8f1df; }
.crm-stage-badge.opportunity { color: #a14b27; background: #fff0e9; }
.crm-stage-badge.customer { color: var(--green-dark); background: var(--green-soft); }
.crm-stage-badge.retention { color: #76558b; background: #f0eaf4; }
.crm-stage-badge.lost { color: #7a7f7c; background: #ecefed; }
.crm-owner-cell strong, .crm-owner-cell small, .crm-date-cell strong, .crm-date-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-owner-cell small, .crm-date-cell small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.crm-tag-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 48px; overflow: hidden; }
.crm-tag-list span { min-height: 20px; padding: 0 6px; display: inline-flex; align-items: center; color: #57625b; background: #edf0ee; font-size: 8px; font-weight: 800; }
.crm-actions { display: flex; justify-content: flex-end; gap: 5px; }
.crm-actions .icon-command { width: 32px; height: 32px; }
.crm-date-cell.overdue strong { color: var(--red); }

.crm-followup-dialog { width: min(980px,calc(100vw - 32px)); }
.crm-dialog-body { max-height: calc(100vh - 210px); overflow-y: auto; padding: 20px 22px 24px; }
.crm-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 14px; }
.crm-form-grid label, .crm-next-grid label { min-width: 0; display: grid; gap: 6px; }
.crm-form-grid label > span, .crm-next-grid label > span { font-size: 10px; font-weight: 800; }
.crm-form-grid input, .crm-form-grid select, .crm-form-grid textarea, .crm-next-grid input, .crm-next-grid select { width: 100%; border: 1px solid #cfd8d1; background: white; outline: 0; padding: 9px 10px; font-size: 12px; }
.crm-form-grid input, .crm-form-grid select, .crm-next-grid input, .crm-next-grid select { height: 39px; }
.crm-form-grid textarea { resize: vertical; }
.crm-form-grid input:focus, .crm-form-grid select:focus, .crm-form-grid textarea:focus, .crm-next-grid input:focus, .crm-next-grid select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,122,75,.08); }
.crm-wide-field { grid-column: 1 / -1; }
.crm-next-action, .crm-history-section { margin-top: 16px; padding: 15px; border: 1px solid var(--line); }
.crm-next-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(190px,1fr) 120px; gap: 12px; }
.crm-history { display: grid; }
.crm-history-row { min-width: 0; padding: 10px 0; border-bottom: 1px solid #edf0ee; display: grid; grid-template-columns: 92px minmax(0,1fr) auto; gap: 12px; }
.crm-history-row:last-child { border-bottom: 0; }
.crm-history-row > span { color: var(--muted); font-size: 9px; }
.crm-history-row div { min-width: 0; }
.crm-history-row strong, .crm-history-row p { display: block; margin: 0; }
.crm-history-row strong { font-size: 10px; }
.crm-history-row p { margin-top: 4px; color: #59635c; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.crm-history-row small { color: var(--muted); font-size: 9px; white-space: nowrap; }

.whatsapp-status { min-height: 86px; margin-bottom: 14px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: white; border: 1px solid var(--line); }
.whatsapp-status-main, .whatsapp-status-actions, .whatsapp-chat-person, .whatsapp-chat-controls { display: flex; align-items: center; gap: 11px; min-width: 0; }
.whatsapp-logo { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; color: white; background: #1f8f5f; }
.whatsapp-logo svg { width: 21px; }
.whatsapp-status-main > div { min-width: 0; }
.whatsapp-status-main > div > span { color: var(--green); font-size: 8px; font-weight: 900; }
.whatsapp-status-main h2 { margin: 3px 0 0; font-size: 16px; }
.whatsapp-status-main p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.connection-pill { min-height: 25px; padding: 0 8px; display: inline-flex; align-items: center; color: #745a22; background: #f8f1df; font-size: 9px; font-weight: 800; }
.connection-pill.connected { color: var(--green-dark); background: var(--green-soft); }
.connection-pill.disabled { color: #68716b; background: #ecefed; }
.whatsapp-inbox { height: calc(100vh - 344px); min-height: 580px; max-height: 760px; display: grid; grid-template-columns: 330px minmax(0,1fr); background: white; border: 1px solid var(--line); }
.whatsapp-contacts-panel { min-width: 0; height: 100%; border-right: 1px solid var(--line); }
.whatsapp-panel-heading, .whatsapp-chat-heading { min-height: 68px; padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.whatsapp-panel-heading span { color: var(--green); font-size: 8px; font-weight: 900; }
.whatsapp-panel-heading h2 { margin: 3px 0 0; font-size: 15px; }
.whatsapp-search { height: 40px; margin: 10px; display: flex; align-items: center; border: 1px solid var(--line); }
.whatsapp-search svg { width: 15px; margin-left: 10px; color: var(--muted); }
.whatsapp-search input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; padding: 0 9px; font-size: 11px; }
.whatsapp-contact-list { height: calc(100% - 129px); overflow-y: auto; }
.whatsapp-contact { width: 100%; min-width: 0; min-height: 72px; padding: 10px 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 9px; border: 0; border-top: 1px solid #edf0ee; background: white; text-align: left; cursor: pointer; }
.whatsapp-contact:hover { background: #f8faf8; }
.whatsapp-contact.active { background: var(--green-soft); }
.whatsapp-contact > div { min-width: 0; }
.whatsapp-contact strong, .whatsapp-contact span, .whatsapp-contact small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-contact strong { font-size: 11px; }
.whatsapp-contact span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.whatsapp-contact small { margin-top: 4px; color: #88918b; font-size: 8px; }
.whatsapp-contact-meta { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.whatsapp-unread { min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--green); font-size: 8px; font-weight: 900; }
.whatsapp-sales-flag { color: var(--orange); font-size: 8px; font-weight: 900; }
.whatsapp-chat-panel { min-width: 0; height: 100%; min-height: 0; }
.whatsapp-chat-empty { height: 100%; min-height: 0; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); }
.whatsapp-chat-empty svg { width: 34px; }
.whatsapp-chat-empty strong { color: var(--ink); font-size: 13px; }
.whatsapp-chat-empty span { font-size: 10px; }
.whatsapp-chat { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(180px,1fr) auto; }
.whatsapp-chat-heading { min-height: 68px; }
.whatsapp-chat-person > div { min-width: 0; }
.whatsapp-chat-person strong, .whatsapp-chat-person span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-chat-person strong { font-size: 12px; }
.whatsapp-chat-person span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.whatsapp-chat-controls select { height: 34px; border: 1px solid var(--line); background: white; padding: 0 24px 0 8px; font-size: 10px; }
.whatsapp-chat-controls .icon-command { width: 34px; height: 34px; }
.whatsapp-customer-link { min-height: 58px; padding: 8px 14px; display: grid; grid-template-columns: 150px 160px minmax(0,1fr); align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: #f8faf8; }
.whatsapp-customer-link label { min-width: 0; display: grid; gap: 3px; }
.whatsapp-customer-link label > span { color: var(--muted); font-size: 8px; }
.whatsapp-customer-link input { width: 100%; height: 28px; border: 1px solid #d5ddd7; background: white; padding: 0 7px; font-size: 10px; }
.whatsapp-customer-link > span { color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whatsapp-messages { min-height: 180px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 9px; background: #f2f5f2; }
.whatsapp-message { width: fit-content; max-width: min(72%,560px); padding: 9px 11px; color: #334038; background: white; border: 1px solid #dfe5e0; box-shadow: 0 1px 2px rgba(16,30,21,.04); }
.whatsapp-message.out { align-self: flex-end; color: #153824; background: #dff2e6; border-color: #c8e5d3; }
.whatsapp-message p { margin: 0; font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.whatsapp-message span { margin-top: 5px; display: flex; justify-content: flex-end; gap: 5px; color: #7b857e; font-size: 8px; }
.whatsapp-composer { padding: 11px 14px 13px; border-top: 1px solid var(--line); background: white; }
.whatsapp-compose-mode { margin-bottom: 8px; display: inline-flex; border: 1px solid var(--line); }
.whatsapp-compose-mode button { height: 27px; padding: 0 10px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 800; }
.whatsapp-compose-mode button:last-child { border-right: 0; }
.whatsapp-compose-mode button.active { color: white; background: var(--green); }
.whatsapp-composer textarea, .whatsapp-template-compose input { width: 100%; border: 1px solid #cfd8d1; outline: 0; padding: 8px 10px; resize: vertical; font-size: 11px; }
.whatsapp-template-compose { display: grid; grid-template-columns: minmax(180px,1fr) 90px minmax(180px,1fr); gap: 8px; }
.whatsapp-template-compose input { height: 38px; }
.whatsapp-compose-footer { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.whatsapp-compose-footer > span { color: var(--muted); font-size: 8px; }
.whatsapp-settings-dialog { width: min(920px,calc(100vw - 32px)); }
.whatsapp-settings-body { max-height: calc(100vh - 190px); overflow-y: auto; padding: 20px 22px 24px; }
.whatsapp-setup-notice { min-height: 58px; margin-bottom: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; color: #73521f; background: #fff5e5; border: 1px solid #f0d7ad; }
.whatsapp-setup-notice svg { width: 18px; flex: 0 0 18px; }
.whatsapp-setup-notice strong, .whatsapp-setup-notice span { display: block; }
.whatsapp-setup-notice strong { font-size: 10px; }
.whatsapp-setup-notice span { margin-top: 4px; font-size: 9px; overflow-wrap: anywhere; }
.whatsapp-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.whatsapp-settings-grid label, .whatsapp-new-body label { min-width: 0; display: grid; gap: 6px; }
.whatsapp-settings-grid label > span, .whatsapp-new-body label > span { font-size: 10px; font-weight: 800; }
.whatsapp-settings-grid input, .whatsapp-settings-grid textarea, .whatsapp-new-body input { width: 100%; border: 1px solid #cfd8d1; outline: 0; background: white; padding: 9px 10px; font-size: 11px; }
.whatsapp-settings-grid input, .whatsapp-new-body input { height: 39px; }
.whatsapp-settings-grid textarea { resize: vertical; }
.whatsapp-secret-field small { color: var(--muted); font-size: 8px; }
.whatsapp-wide-setting { grid-column: 1 / -1; }
.whatsapp-toggle-row { margin-top: 16px; padding: 12px 14px; display: flex; gap: 28px; background: var(--soft); border: 1px solid var(--line); }
.whatsapp-new-dialog { width: min(500px,calc(100vw - 32px)); }
.whatsapp-new-body { padding: 22px; }

.purchase-system-panel { min-width: 0; }
.purchase-commandbar { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.purchase-commandbar button, .purchase-metrics button, .purchase-quick-add button, .purchase-tool-controls button, .purchase-list-form button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; border: 1px solid #cfd7d1; border-radius: 4px; background: white; font-size: 11px; font-weight: 700; cursor: pointer; }
.purchase-commandbar button:hover, .purchase-metrics button:hover, .purchase-quick-add button:hover { border-color: var(--green); color: var(--green); }
.purchase-commandbar button svg, .purchase-metrics button svg, .purchase-quick-add button svg, .purchase-tool-controls button svg, .purchase-list-form button svg { width: 15px; }
.purchase-commandbar .primary-command { color: white; background: var(--green); border-color: var(--green); }
.purchase-filters { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)) minmax(360px,1.4fr); gap: 12px; padding: 15px 0 10px; }
.purchase-filters label, .purchase-parameters label { min-width: 0; display: flex; align-items: center; gap: 8px; }
.purchase-filters label > span, .purchase-parameters label > span { flex: 0 0 auto; font-size: 11px; font-weight: 800; }
.purchase-filters select, .purchase-filters input, .purchase-parameters input, .purchase-quick-add input, .purchase-list-form input { min-width: 0; height: 37px; border: 1px solid #cfd7d1; border-radius: 3px; background: white; padding: 0 9px; }
.purchase-filters select { flex: 1; }
.purchase-date input { width: 132px; }
.purchase-date b { color: var(--muted); font-size: 11px; }
.purchase-parameters { display: flex; flex-wrap: wrap; gap: 20px; padding: 9px 0 13px; }
.purchase-parameters input { width: 74px; color: #194eae; font-size: 14px; font-weight: 800; }
.purchase-parameters .discount-exception-field input { width: min(260px, 50vw); color: var(--ink); font-size: 12px; font-weight: 700; }
.purchase-parameters .critical span, .purchase-parameters .critical input { color: #d52f2f; }
.purchase-parameters .critical input { background: #fff5f5; }
.purchase-metrics { min-height: 50px; display: flex; align-items: center; gap: 26px; padding: 9px 14px; border-block: 1px solid var(--line); background: #f7f9f7; }
.purchase-metrics > div { display: flex; align-items: baseline; gap: 8px; }
.purchase-metrics span { font-size: 11px; font-weight: 800; }
.purchase-metrics strong { font-size: 18px; }
.purchase-metrics button:first-of-type { margin-left: auto; }
.purchase-quick-add { display: flex; align-items: center; gap: 9px; padding: 12px 0; }
.purchase-quick-add label { font-size: 11px; font-weight: 800; }
.purchase-quick-add input { width: min(340px,30vw); }
.purchase-status { min-height: 34px; display: flex; align-items: center; margin-bottom: 8px; padding: 0 10px; border-left: 3px solid var(--green); color: #4f5d53; background: #f2f6f3; font-size: 11px; }
.purchase-table-wrap { width: 100%; min-height: 360px; overflow: auto; border: 1px solid #d8ded9; background: white; }
.purchase-table { min-width: 2280px; width: 100%; border-collapse: separate; border-spacing: 0; font-size: 10px; }
.purchase-table th { position: sticky; top: 0; z-index: 2; height: 43px; padding: 6px 8px; border-right: 1px solid #dfe4e0; border-bottom: 1px solid #cdd5cf; background: #f1f4f2; white-space: pre-line; text-align: center; }
.purchase-table td { height: 36px; padding: 5px 8px; border-right: 1px solid #edf0ed; border-bottom: 1px solid #e8ece9; white-space: nowrap; text-align: center; }
.purchase-table th:nth-child(2), .purchase-table td:nth-child(2) { min-width: 260px; text-align: left; }
.purchase-table th:first-child, .purchase-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 92px; background: inherit; text-align: left; }
.purchase-table th:first-child { z-index: 3; background: #f1f4f2; }
.purchase-table tbody tr:hover { background: #f5faf6; }
.purchase-table tbody tr.high-volume { background: #ffe1e6; }
.purchase-table tbody tr.preorder { background: #fff5a8; }
.purchase-table tbody tr.selected { outline: 2px solid #2c6a46; outline-offset: -2px; }
.purchase-table tbody tr[draggable="true"] { cursor: grab; }
.purchase-table th[data-purchase-column] { cursor: help; }
.purchase-table td[data-purchase-quantity] { min-width: 86px; color: #b62525; font-weight: 800; }
.purchase-tool-dialog { width: min(1500px,96vw); }
.purchase-tool-dialog .dialog-shell, .purchase-list-dialog .dialog-shell, .purchase-draft-dialog .dialog-shell { width: 100%; max-height: 90vh; }
.purchase-tool-controls { display: flex; align-items: center; gap: 9px; padding: 12px 20px; }
.purchase-tool-controls form { width: 280px; height: 37px; display: flex; align-items: center; border: 1px solid #cfd7d1; }
.purchase-tool-controls form svg { width: 16px; margin-left: 10px; }
.purchase-tool-controls form input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 9px; }
.purchase-region-tabs { flex: 1; display: flex; gap: 5px; overflow-x: auto; }
.purchase-region-tabs button.active { color: white; border-color: var(--green); background: var(--green); }
.purchase-tool-mode-controls { min-height: 48px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 8px 20px; border-top: 1px solid var(--line); background: #f7f9f7; }
.purchase-tool-mode-controls[hidden] { display: none; }
.purchase-tool-mode-controls form, .purchase-tool-mode-controls label { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 800; }
.purchase-tool-mode-controls input, .purchase-tool-mode-controls select { height: 34px; border: 1px solid #cfd7d1; background: white; padding: 0 8px; }
.purchase-tool-mode-controls button { min-height: 34px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #cfd7d1; background: white; padding: 0 10px; cursor: pointer; }
.tool-table { min-height: 520px; max-height: 68vh; border-inline: 0; }
.purchase-list-form { display: grid; grid-template-columns: 160px 1fr 1fr auto; gap: 9px; padding: 14px 20px; }
.purchase-list-filter { display: flex; justify-content: flex-end; padding: 0 20px 10px; }
.purchase-list-filter label { display: inline-flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 800; }
.purchase-list-filter select { min-width: 240px; height: 35px; border: 1px solid #cfd7d1; background: white; padding: 0 8px; }
.purchase-list-dialog { width: min(940px,94vw); }
.purchase-list-dialog .purchase-table { min-width: 850px; }
.purchase-draft-dialog { width: min(720px,94vw); }
.purchase-draft-list { display: grid; gap: 8px; max-height: 65vh; overflow-y: auto; padding: 18px 20px; }
.purchase-draft-list button { min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 8px 13px; border: 1px solid #d5ddd7; background: white; text-align: left; cursor: pointer; }
.purchase-draft-list button:hover { border-color: var(--green); }
.purchase-draft-list button span, .purchase-draft-list button strong { display: block; }
.purchase-draft-list button span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.purchase-add-dialog { width: min(1180px,96vw); }
.purchase-add-dialog .dialog-shell { width: 100%; max-height: 90vh; }
.purchase-add-modes { display: flex; gap: 6px; padding: 14px 20px 8px; }
.purchase-add-modes label { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid #cfd7d1; background: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.purchase-add-modes label:has(input:checked) { color: white; border-color: var(--green); background: var(--green); }
.purchase-add-search { display: flex; gap: 8px; padding: 8px 20px 12px; }
.purchase-add-search input { flex: 1; height: 38px; border: 1px solid #cfd7d1; padding: 0 10px; }
.purchase-add-search button { min-width: 90px; border: 1px solid var(--green); color: white; background: var(--green); }
.purchase-add-table { min-height: 390px; max-height: 56vh; border-inline: 0; }
.purchase-add-table .purchase-table { min-width: 1100px; }
.purchase-add-table .purchase-table th:first-child, .purchase-add-table .purchase-table td:first-child { min-width: 42px; width: 42px; text-align: center; }
.purchase-context-menu { position: fixed; z-index: 80; min-width: 210px; padding: 5px; border: 1px solid #ccd5ce; background: white; box-shadow: 0 12px 30px rgba(21,35,26,.2); }
.purchase-context-menu[hidden] { display: none; }
.purchase-context-menu button { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 0 9px; font-size: 10px; text-align: left; cursor: pointer; }
.purchase-context-menu button:hover { background: var(--soft); }
.purchase-context-menu svg { width: 14px; }

.user-management-summary { min-height: 82px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.user-management-summary > div { min-width: 0; }
.user-management-summary span { color: var(--brand); font-size: 10px; font-weight: 900; }
.user-management-summary h2 { margin: 5px 0 0; font-size: 20px; }
.user-management-summary p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.user-toolbar { margin-top: 14px; }
.user-total { color: var(--muted); font-size: 12px; white-space: nowrap; }
.user-table { min-width: 1050px; }
.user-table td:first-child strong, .user-table td:first-child small { display: block; }
.user-table td:first-child small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.user-table code { color: #174f86; font-family: Consolas, monospace; font-size: 12px; font-weight: 700; }
.muted-value { color: var(--muted); }
.permission-count, .account-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 3px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.permission-count { color: #174f86; background: #eaf3fa; }
.account-status.enabled { color: var(--green-dark); background: var(--green-soft); }
.account-status.disabled { color: #8b3d3d; background: #fbeaea; }
.table-action { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: white; padding: 0 10px; color: var(--brand-dark); cursor: pointer; font-size: 11px; font-weight: 800; white-space: nowrap; }
.table-action:hover { border-color: var(--brand); background: var(--brand-soft); }
.table-action svg { width: 14px; }
.user-editor-dialog { width: min(760px, calc(100vw - 24px)); }
.user-editor-dialog .dialog-shell { width: 100%; }
.user-editor-body { padding: 22px 24px; }
.user-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.user-editor-grid > label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.user-editor-grid input, .user-editor-grid select { width: 100%; min-width: 0; height: 40px; border: 1px solid #ccd8de; background: white; padding: 0 11px; outline: 0; font-size: 13px; }
.user-editor-grid input:focus, .user-editor-grid select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,121,184,.1); }
.user-editor-grid input[readonly] { color: var(--muted); background: var(--soft); }
.user-enabled-control { align-self: end; min-height: 40px; display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 9px !important; padding: 0 10px; border: 1px solid var(--line); color: var(--ink) !important; }
.user-enabled-control input { width: 17px; height: 17px; padding: 0; accent-color: var(--green); }
.permission-fieldset { margin: 22px 0 0; padding: 16px; border: 1px solid var(--line); }
.permission-fieldset legend { padding: 0 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.permission-grid label { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #e2e9ed; background: #fafcfd; font-size: 11px; cursor: pointer; }
.permission-grid input { width: 16px; height: 16px; accent-color: var(--brand); }
.user-editor-dialog .danger-command { margin-right: auto; }

@media (max-width: 1050px) {
  .purchase-filters { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .overview-layout { grid-template-columns: 1fr; }
  .product-table { min-width: 900px; }
  .order-table { min-width: 1580px; }
  .insight-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .insight-metric { border-bottom: 1px solid var(--line); }
  .insight-metric:nth-child(3) { border-right: 0; }
  .profile-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .profile-kpi { border-bottom: 1px solid var(--line); }
  .crm-stage-board { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .crm-stage:nth-child(3) { border-right: 0; }
  .crm-stage:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .crm-overview-grid { grid-template-columns: 1fr; }
  .whatsapp-inbox { grid-template-columns: 280px minmax(0,1fr); }
  .whatsapp-customer-link { grid-template-columns: 1fr 1fr; }
  .whatsapp-customer-link > span { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .user-management-summary { align-items: flex-start; }
  .user-management-summary .primary-command { flex: 0 0 auto; padding-inline: 11px; }
  .user-table-wrap { overflow: visible; border: 0; background: transparent; }
  .user-table { min-width: 0; border-collapse: separate; border-spacing: 0 10px; }
  .user-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
  .user-table tr { padding: 8px 14px; border: 1px solid var(--line); background: white; }
  .user-table td { min-height: 36px; height: auto; padding: 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #edf0ee; text-align: right; }
  .user-table td::before { content: attr(data-label); flex: 0 0 92px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; }
  .user-table td:last-child { border-bottom: 0; }
  .user-table td:first-child { align-items: flex-start; }
  .user-editor-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr 1fr; }
  .user-editor-body { max-height: calc(100vh - 185px); overflow-y: auto; padding: 16px; }
  .discount-policy-overview-heading { align-items: flex-start; padding: 16px; }
  .discount-policy-summary { grid-template-columns: 1fr; }
  .discount-summary-item, .discount-summary-empty { min-height: 0; padding: 16px; border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .discount-summary-item:last-child, .discount-summary-empty:last-child { border-bottom: 0 !important; }
  .purchase-filters { grid-template-columns: 1fr; }
  .purchase-date { flex-wrap: wrap; }
  .purchase-metrics { align-items: stretch; flex-direction: column; gap: 8px; }
  .purchase-metrics button:first-of-type { margin-left: 0; }
  .purchase-quick-add { align-items: stretch; flex-direction: column; }
  .purchase-quick-add input { width: 100%; }
  .purchase-list-form { grid-template-columns: 1fr; }
  .purchase-add-modes, .purchase-tool-controls { align-items: stretch; flex-direction: column; }
  .purchase-add-modes label, .purchase-tool-controls form { width: 100%; }
  .purchase-add-search { flex-direction: column; }
  .login-screen { background: var(--soft); padding: 14px; }
  .login-panel { padding: 30px 24px; }
  .login-copy { margin-top: 44px; }
  .admin-sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
  .admin-sidebar.open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
  .sidebar-overlay { position: fixed; z-index: 25; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(8,14,10,.48); }
  .sidebar-overlay.open { display: block; }
  .admin-workspace { margin-left: 0; }
  .admin-header { height: 64px; padding: 0 14px; }
  .mobile-menu { display: inline-grid; border: 0; }
  .header-title h1 { font-size: 17px; }
  .header-title p { display: none; }
  .sync-button { width: 38px; padding: 0; justify-content: center; }
  .sync-button span { display: none; }
  .admin-content { padding: 16px 14px 36px; }
  .metric { min-height: 108px; padding: 18px; }
  .metric strong { font-size: 24px; }
  .overview-layout { margin-top: 14px; gap: 14px; }
  .work-section { padding: 18px; }
  .source-status { display: grid; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-selects { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-select { width: 100%; }
  .filter-select select { flex: 1; }
  .bulk-bar { flex-wrap: wrap; }
  .pagination { min-height: 68px; }
  .editor-layout { grid-template-columns: 1fr; max-height: calc(100vh - 170px); overflow-y: auto; padding: 18px; }
  .image-editor { width: min(280px,100%); margin: 0 auto; }
  .dialog-heading { padding: 15px 18px; }
  .dialog-footer { padding: 12px 18px; }
  .customer-summary { grid-template-columns: 1fr 1fr; margin: 14px 16px 0; }
  .customer-summary .remarks { grid-column: 1 / -1; }
  .order-delivery-editor { padding: 14px 16px 0; }
  .order-lines-heading { align-items: flex-start; padding: 16px 16px 0; }
  .order-product-search { margin: 10px 16px 0; }
  .order-lines-wrap { margin: 14px 16px; }
  .order-lines-wrap table { min-width: 1010px; }
  .order-edit-row { grid-template-columns: 1fr; padding: 0 16px 18px; }
  .image-order-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .image-order-dialog .dialog-shell { max-height: calc(100vh - 16px); }
  .image-order-body { grid-template-columns: 1fr; gap: 16px; padding: 16px; overflow-y: auto; }
  .image-order-upload { min-height: 160px; max-height: 220px; }
  .image-order-fields { grid-template-columns: 1fr; }
  .image-order-customer-summary, .image-order-fields .image-order-wide { grid-column: auto; }
  .image-order-fields input, .image-order-fields select, .image-order-fields textarea,
  .image-order-table input, .image-order-table select { font-size: 16px; }
  .image-order-result-summary { align-items: flex-start; flex-direction: column; gap: 3px; padding: 10px 16px; }
  .image-order-table-wrap { max-height: 38vh; }
  .image-order-ack { align-items: flex-start; padding: 10px 16px; }
  .image-order-footer { flex-wrap: wrap; }
  .image-order-footer > strong { flex: 0 0 100%; }
  .insight-metrics { grid-template-columns: 1fr 1fr; }
  .insight-metric:nth-child(2n) { border-right: 0; }
  .insight-metric:nth-child(3) { border-right: 1px solid var(--line); }
  .insight-metric strong { overflow: visible; font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
  .rank-chart-row { grid-template-columns: 20px minmax(100px,1fr) 70px; }
  .rank-chart-row .rank-track { display: none; }
  .heat-toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .heat-toolbar .admin-search { grid-column: 1 / -1; width: 100%; }
  .heat-customer-filter, .heat-seconds-filter { min-width: 0; width: 100%; }
  .heat-customer-filter { grid-column: 1 / -1; }
  .heat-customer-filter input { min-width: 0; width: 100%; }
  .heat-table-tool { overflow: visible; border: 0; background: transparent; }
  .heat-table { min-width: 0; width: 100%; border-collapse: separate; border-spacing: 0 10px; }
  .heat-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .heat-table tbody, .heat-table tr, .heat-table td { display: block; width: 100%; }
  .heat-table tr { position: relative; margin-bottom: 10px; padding: 10px 14px 8px; border: 1px solid var(--line); background: white; }
  .heat-table td { min-height: 30px; padding: 7px 0; border-bottom: 1px solid #edf0ee; text-align: right; }
  .heat-table td:last-child { border-bottom: 0; }
  .heat-table td:not(.heat-product-cell) { display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: normal; }
  .heat-table td:not(.heat-product-cell)::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; }
  .heat-table .heat-product-cell { padding: 5px 0 10px; text-align: left; }
  .heat-table .analytics-rank { position: absolute; z-index: 1; top: 8px; right: 10px; width: auto; min-height: 22px; padding: 3px 7px; border: 0; background: var(--soft); }
  .heat-table .analytics-rank::before { display: none; }
  .heat-table .table-product { padding-right: 34px; }
  .profile-body { padding: 16px; }
  .profile-kpis { grid-template-columns: 1fr 1fr; }
  .profile-kpi:nth-child(2n) { border-right: 0; }
  .profile-grid { grid-template-columns: 1fr; }
  .crm-pipeline, .crm-work-section { padding: 16px; }
  .crm-toolbar-selects { grid-template-columns: 1fr; }
  .crm-dialog-body { padding: 16px; }
  .crm-form-grid { grid-template-columns: 1fr; }
  .crm-wide-field { grid-column: auto; }
  .crm-next-grid { grid-template-columns: 1fr; }
  .crm-history-row { grid-template-columns: 72px minmax(0,1fr); }
  .crm-history-row small { grid-column: 2; }
  .whatsapp-status { align-items: stretch; flex-direction: column; }
  .whatsapp-status-actions { justify-content: space-between; }
  .whatsapp-inbox { height: auto; min-height: 620px; max-height: none; grid-template-columns: 1fr; }
  .whatsapp-contacts-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .whatsapp-contact-list { height: 300px; }
  .whatsapp-chat-panel, .whatsapp-chat-empty, .whatsapp-chat { min-height: 620px; }
  .whatsapp-chat-heading { align-items: stretch; flex-direction: column; }
  .whatsapp-chat-controls { justify-content: space-between; }
  .whatsapp-customer-link { grid-template-columns: 1fr; }
  .whatsapp-customer-link > span { grid-column: auto; }
  .whatsapp-message { max-width: 88%; }
  .whatsapp-template-compose { grid-template-columns: 1fr; }
  .whatsapp-settings-body { padding: 16px; }
  .whatsapp-settings-grid { grid-template-columns: 1fr; }
  .whatsapp-wide-setting { grid-column: auto; }
  .whatsapp-toggle-row { align-items: flex-start; flex-direction: column; gap: 14px; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 15px 13px; }
  .metric > span { font-size: 10px; }
  .metric strong { font-size: 22px; }
  .header-actions { gap: 5px; }
  .header-actions .icon-command { width: 34px; }
  .sync-button { width: 34px; }
  .inventory-line { grid-template-columns: 70px minmax(70px,1fr) 48px; gap: 8px; }
  .dialog-footer .primary-command { flex: 1; }
  .order-detail .dialog-footer { flex-wrap: wrap; }
  .order-detail .dialog-footer > strong { flex: 0 0 100%; }
  .order-detail-actions { width: 100%; flex-wrap: wrap; }
  .order-detail .order-detail-actions > button, .order-detail .order-detail-actions > .copy-sap-control { min-width: 0; flex: 1 1 160px; }
  .order-detail-actions > button, .copy-sap-control > #copy-sap-order { min-height: 42px; padding: 8px 9px; white-space: normal; }
  .copy-sap-confirm { max-width: 100%; right: 50%; transform: translateX(50%); }
  .copy-sap-confirm > div { flex-wrap: wrap; }
  .copy-sap-confirm button { flex: 1 1 auto; white-space: normal; }
  .copy-sap-confirm::after { right: 50%; margin-right: -5px; }
  .toolbar-selects { grid-template-columns: 1fr; }
  .heat-toolbar { grid-template-columns: 1fr; }
  .heat-toolbar .admin-search, .heat-customer-filter { grid-column: auto; }
  .customer-dialog-heading .customer-avatar { display: none; }
}
.discount-rule-title { margin-top: 28px; margin-bottom: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.discount-rule-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #d9e2e8);
}
.discount-order-rule { grid-template-columns: 1.1fr 1.5fr .8fr .7fr 1fr auto auto; }
.discount-customer-product-rule { grid-template-columns: 1.1fr 1.4fr 1.5fr .7fr auto auto; }
.discount-promotion-rule { grid-template-columns: 1.1fr 1.5fr .7fr 1fr 1fr auto auto; }
.discount-rule-row input, .discount-rule-row select { min-width: 0; height: 36px; }
.discount-rule-row select { border: 1px solid #cfd7d1; background: white; padding: 0 8px; }
@media (max-width: 900px) {
  .discount-order-rule, .discount-customer-product-rule, .discount-promotion-rule { grid-template-columns: 1fr 1fr; }
}
:root .operator-admin-dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 24px); box-sizing: border-box; overflow: auto; overflow-wrap: anywhere; padding: 20px; border: 1px solid #c9dce9; border-radius: 10px; }
.operator-admin-dialog::backdrop { background: rgba(10,30,45,.48); }
.operator-admin-dialog label { display: grid; gap: 6px; margin-block: 12px; }
.operator-admin-dialog input { min-width: 0; padding: 9px; font-size: 16px; border: 1px solid #c9dce9; border-radius: 5px; }
.operator-admin-dialog .operator-enabled { display: flex; gap: 8px; align-items: center; }
.operator-admin-dialog button { padding: 8px 10px; border: 1px solid #c9dce9; border-radius: 5px; margin: 3px; background: #f3f8fb; color: #174f86; }
.operator-admin-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid #c9dce9; padding-block: 8px; }
/* Per-customer stock permission; keep a usable touch target on narrow screens. */
.stock-visibility-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; cursor: pointer; }
.stock-visibility-toggle input { width: 18px; height: 18px; accent-color: #176c50; }
/* Private image-generation audit: kept inside the existing scrollable table. */
.product-ai-summary { margin: 10px 0 14px; color: var(--text-muted, #64748b); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.product-toolbar { flex-wrap: wrap; }
.product-ai-cell { min-width: 170px; max-width: 280px; }
.product-table { min-width: 1200px; }
.product-table th:nth-child(7) { width: 220px; }
.product-ai-cell small { font-size: 11px; color: #64748b; }
.product-ai-details { margin-top: 7px; font-size: 11px; white-space: normal; }
.product-ai-details summary { cursor: pointer; color: #17694e; padding: 7px 0; }
.product-ai-details dl { margin: 6px 0; max-width: 240px; }
.product-ai-details dt { margin-top: 7px; color: #64748b; }
.product-ai-details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.product-ai-details ol { padding-left: 19px; max-width: 240px; }
.product-ai-details li { margin: 5px 0; overflow-wrap: anywhere; }
