.header-more { display: block; }
.managed-drafts-toolbar { display: grid; gap: 8px; flex: 0 0 auto; padding-top: var(--panel-content-gap); }
.managed-drafts-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin-top: 12px; }
.managed-drafts-content .order-home-orders { flex: 1 1 auto; min-height: 0; }
.modal.compact-modal { align-items: center; padding: 16px; background: transparent; }
.compact-modal > .sheet-card { position: relative; z-index: 1; width: 100%; max-width: var(--form-dialog-max-width); height: auto; min-height: 0; max-height: calc(var(--tg-viewport-height, 100dvh) - 32px - var(--safe-top) - var(--safe-bottom)); margin: 0; padding: 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.compact-modal > .label-lookup-sheet { max-width: 640px; }
.compact-modal > :is(.managed-drafts-sheet,.warehouse-products-sheet) { max-width: calc(var(--page-max-width) - 32px); height: min(780px, calc(var(--tg-viewport-height, 100dvh) - 32px - var(--safe-top) - var(--safe-bottom))); }
.compact-modal > .managed-drafts-sheet { background: var(--workspace-canvas); }
.compact-modal .history-heading { flex: 0 0 auto; min-height: var(--header-min-height); gap: 8px; }
.compact-modal .history-heading h2 { flex: 1; min-width: 0; font-size: var(--page-heading-size); line-height: 22px; overflow-wrap: anywhere; }
.compact-modal .history-heading > .close-button { position: static; flex: 0 0 var(--panel-close-width); margin: 0; }
.panel-header-title { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; color: var(--ink); font-size: var(--page-heading-size); line-height: 22px; font-weight: 700; }
.panel-header-title > h2 { flex: 1; min-width: 0; margin: 0; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal .sheet-card .panel-header-title > h2,.modal .confirm-card .panel-header-title > h2 { font: inherit; color: inherit; }
.modal .sheet-card .history-heading .panel-header-title > h2 { display: block; white-space: nowrap; -webkit-line-clamp: unset; }
.panel-header-separator { flex: 0 0 auto; color: var(--muted); font: inherit; }
.modal-parent-link { flex: 0 1 auto; display: inline-flex; align-items: center; max-width: 42%; min-width: 0; min-height: 32px; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; box-shadow: none; cursor: pointer; }
.modal-parent-link:hover > span { text-decoration: underline; text-underline-offset: 3px; }
.modal-parent-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-parent-link svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.modal-parent-link:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: 2px; border-radius: 4px; }
.organization-editor-content { min-height: 0; overflow-y: auto; padding-top: 12px; overscroll-behavior: contain; }
.organization-editor-card h2 { display: flex; align-items: center; gap: 8px; }
.compact-modal .debt-customer-create-content .telegram-settings-field-heading > span { color: var(--ink); }
.compact-modal .debt-customer-create-content .telegram-settings-field-heading > span > span { color: var(--danger); }
.organization-editor-content .organization-editor-help { margin-bottom: 12px; }
.organization-editor-content .organization-lifecycle { margin-top: 16px; }
.dialog-heading { flex: 0 0 auto; min-height: var(--header-min-height); display: flex; align-items: center; gap: 8px; width: 100%; padding: var(--header-padding-top) var(--header-inset) var(--header-padding-bottom); text-align: left; }
.dialog-heading > h2 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.dialog-heading > .close-button { position: static; flex: 0 0 var(--panel-close-width); margin: 0; }
.history-heading:has(> .panel-header-actions) { display: flex; flex-wrap: nowrap; gap: 8px; min-height: var(--header-min-height); }
.history-heading:has(> .panel-header-actions) > h2 { flex: 1; font-size: var(--page-heading-size); line-height: 22px; white-space: nowrap; }
.history-heading > .panel-header-actions { display: flex; flex-wrap: nowrap; align-items: center; flex: 0 0 auto; gap: 6px; margin-left: auto; overflow: visible; }
.history-heading > .panel-header-actions:empty { display: none; }
.history-heading:has(> .panel-header-actions) > .close-button { position: static; flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); margin: 0; }
.panel-header-actions > button, .panel-header-command { width: auto; height: var(--header-action-size); min-height: var(--header-action-size); padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #5faaa0; border-radius: var(--header-action-radius); background: var(--brand-light); color: var(--brand-dark); font-size: 11px; font-weight: 750; line-height: 1.3; white-space: nowrap; box-shadow: none; }
.panel-header-command:not(:disabled):hover { background: #cbe9e4; border-color: var(--brand); }
.panel-header-command:not(:disabled):active { background: var(--brand-dark); color: #fff; }
.history-heading:has(> .panel-header-actions) > div:not(.panel-header-actions) { flex: 1; min-width: 0; padding-right: 0; }
.history-heading:has(> .panel-header-actions) > div:not(.panel-header-actions) h2 { white-space: nowrap; }
.panel-header-actions > .panel-header-command { position: static; margin: 0; }
/* Nút menu của một panel: chỉ biểu tượng ba gạch, cùng khung 32×36 với X ở mọi màn (tên đọc từ aria-label/title). */
.panel-header-command:is(.is-menu, .is-icon), .panel-header-actions > .panel-header-command:is(.is-menu, .is-icon) { flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); padding: 0; }
.panel-header-command:is(.is-menu, .is-icon) svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.panel-header-actions svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#organizationModal:has(#organizationListView.hidden, #organizationToolbar.hidden) #organizationHeaderActions { display: none; }
#organizationToolbar .organization-search { grid-template-columns: minmax(0, 1fr); }
.organization-sheet { display: flex; flex-direction: column; min-height: 0; }
.organization-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-top: 12px; padding-bottom: 20px; }
.organization-search { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.organization-search input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font: inherit; }
.organization-refresh { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; }
.organization-refresh svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.branch-staff-count { color: var(--muted); font-weight: 400; }
.organization-lifecycle .secondary-button { width: auto; min-height: 36px; padding: 0 12px; }
.organization-list { display: grid; gap: 12px; margin-top: 12px; }
.organization-branch-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.organization-branch-heading { display: grid; grid-template-columns: 14px 20px minmax(0, 1fr) auto 32px; align-items: center; gap: 8px; min-height: 58px; padding: 10px 12px; border-radius: 12px; cursor: pointer; list-style: none; }
.organization-branch-heading::-webkit-details-marker { display: none; }
.organization-branch-heading:hover { background: #f2f7f5; }
.organization-branch-heading:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: 2px solid var(--brand); outline-offset: 2px; }
.organization-branch-card[open] > .organization-branch-heading { border-radius: 12px 12px 0 0; }
.organization-branch-main { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.organization-branch-main strong { font-size: 14px; line-height: 22px; overflow-wrap: anywhere; }
.organization-warehouse-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.organization-branch-chevron { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); }
.organization-branch-card[open] > .organization-branch-heading .organization-branch-chevron { transform: none; }
.organization-branch-content { margin: 0 12px 14px 43px; border-left: 1px solid var(--line); }
.organization-command.secondary-button { width: auto; min-height: 32px; height: 32px; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--brand-dark); font-size: 12px; font-weight: 650; white-space: nowrap; box-shadow: none; }
.organization-command:not(:disabled):hover { border-color: var(--brand); background: var(--brand-light); }
.organization-warehouse-children { min-width: 0; }
.organization-warehouse-row { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) 32px; align-items: center; gap: 8px; min-height: 46px; padding: 5px 0 5px 18px; }
.organization-warehouse-row::before, .organization-tree-add::before, .branch-staff::after { content: ''; position: absolute; left: 0; top: 23px; width: 12px; border-top: 1px solid var(--line); }
.branch-staff::after { top: 21px; }
.organization-warehouse-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.organization-warehouse-link { padding: 4px 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; line-height: 20px; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.organization-warehouse-link:hover { color: var(--brand); }
.organization-warehouse-link:focus-visible:where(:root:not([data-input-method="pointer"]) *), .organization-action-trigger:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: 2px solid var(--brand); outline-offset: 2px; }
.organization-tree-add { position: relative; padding: 7px 0 7px 18px; }
.organization-tree-add .organization-command { min-height: 32px; border: 0; padding: 0; background: transparent; }
.organization-tree-add .organization-command:hover { background: transparent; text-decoration: underline; }
.organization-actions { position: relative; display: block; }
.organization-action-trigger { display: grid; place-items: center; width: 32px; height: 32px; padding: 0 0 7px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 24px; cursor: pointer; }
.organization-action-trigger:hover, .organization-action-trigger[aria-expanded='true'] { background: var(--brand-light); color: var(--brand-dark); }
.organization-action-menu { position: absolute; z-index: 3; top: 36px; right: 0; min-width: 150px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 6px 20px #163c3224; }
.organization-action-menu .organization-command { width: 100%; border: 0; text-align: left; justify-content: flex-start; }
/* Xóa kho cùng kiểu nút Đăng xuất / Huỷ điều chuyển: nền đỏ nhạt, viền đỏ nhạt. */
.organization-lifecycle .organization-delete { border-color: #dca39b; background: #f9e2de; color: var(--danger); }
.organization-no-warehouse { margin: 0; padding: 12px 0 12px 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.organization-location-icon { flex: 0 0 auto; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--brand-dark); }
#viewWarehouseStock, #createOrganization { display: flex; align-items: center; gap: 8px; }
#createOrganization svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.organization-status { flex: 0 0 auto; font-size: 11px; line-height: 18px; color: var(--muted); }
.organization-branch-card .organization-status { padding: 2px 7px; border-radius: 5px; background: var(--surface-disabled); }
.organization-status.is-active { color: var(--brand-dark); }
.organization-branch-card .organization-status.is-active { background: var(--brand-light); }
.organization-branch-card .organization-status.is-setup { color: #87570c; background: #fff0cf; }
.organization-form { --form-label-width: 120px; --form-row-height: 38px; max-width: 520px; margin: 0 auto; }
.organization-form .telegram-settings-field { overflow: hidden; }
.organization-form select { min-width: 0; width: 100%; border: 0; padding: 0 10px; background: var(--surface); color: var(--ink); font: inherit; }
.organization-form input[readonly] { background: var(--surface-disabled); color: var(--muted); }
.organization-editor-help { max-width: 520px; margin: 0 auto 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.organization-editor-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.organization-editor-actions button { min-height: 38px; height: 38px; padding: 0 12px; }
.organization-form .organization-editor-actions .primary-button { margin: 0; min-height: 38px; height: 38px; border-radius: var(--control-radius); box-shadow: none; font-size: 13px; }
.organization-lifecycle { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.organization-retry { margin: 16px auto 0; min-height: 36px; width: auto; padding: 0 14px; }
.organization-scroll:not(:has(#organizationError:not(.hidden))) .organization-retry { display: none; }
@media (max-width: 480px) {
  .organization-branch-heading { grid-template-columns: 12px 18px minmax(0, 1fr) auto 32px; padding: 10px; gap: 6px; }
  .organization-branch-content { margin-left: 36px; margin-right: 10px; }
  .organization-branch-heading .organization-location-icon { width: 18px; height: 18px; }
  #organizationHeaderActions { justify-content: flex-start; }
}
@media (max-width: 380px) { .organization-status { max-width: 94px; text-align: right; } .organization-form { --form-label-width: 96px; } }
body:has(#authPanel:not(.hidden)) { background: var(--workspace-surround); }
.auth-panel { --auth-card-height: 398px; width: 100%; max-width: none; height: 100dvh; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 16px; padding: max(calc(24px + var(--safe-top)), calc((var(--auth-stable-vh, 100dvh) - 536px) / 2)) 20px calc(24px + var(--safe-bottom)); margin: 0 auto; overflow-y: auto; background: transparent; box-shadow: none; }
.auth-panel > :not(.information-help-popover) { width: 100%; max-width: 440px; flex-shrink: 0; }
/* Điện thoại: khung đăng nhập nằm sát phía trên để bàn phím không che ô đang nhập và nút đăng nhập. */
@media (max-width: 1099px) { .auth-panel { padding-top: calc(16px + var(--safe-top)); } }
.auth-brand { display: grid; align-content: start; gap: 8px; min-height: 72px; }
.auth-brand-heading { display: flex; align-items: center; gap: 10px; height: 40px; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 8px; box-shadow: none; }
.brand-mark:has(> img) { background: transparent; }
.brand-mark > img { display: block; width: 100%; height: 100%; }
.auth-brand h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: 0; color: var(--ink); }
.auth-brand p, .auth-help, .company-empty { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.6; }
.auth-brand .auth-brand-slogan { position: relative; min-height: 24px; font-size: 18px; line-height: 24px; font-weight: 650; letter-spacing: 0; color: var(--ink); text-wrap: balance; }
body:has(#loading:not(.hidden)), .splash { background: var(--workspace-canvas); }
.splash { position: relative; min-height: 100dvh; }
.startup-feedback { position: absolute; top: calc(50% + 58px); left: 24px; right: 24px; display: grid; justify-items: center; gap: 12px; font-size: 12px; line-height: 1.5; }
.startup-feedback .secondary-button { min-height: 36px; padding: 8px 16px; }
.splash-logo { position: relative; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--brand); }
.splash-logo::before { content: ""; position: absolute; inset: 4px; border: 2px solid rgba(255, 255, 255, .22); border-top-color: #fff; border-left-color: #fff; border-radius: 50%; animation: spin .9s linear infinite; will-change: transform; pointer-events: none; }
.splash-glyph { position: relative; width: 44px; height: 44px; overflow: hidden; }
.splash-glyph > * { position: absolute; inset: 0; margin: auto; opacity: 0; animation: splash-glyph-cycle 3.6s ease-in-out infinite; }
/* Start the first 600ms slot after the S has faded in. */
.splash-glyph > .splash-mark { animation-delay: -.15s; }
.splash-glyph > :nth-child(2) { animation-delay: .45s; }
.splash-glyph > :nth-child(3) { animation-delay: 1.05s; }
.splash-glyph > :nth-child(4) { animation-delay: 1.65s; }
.splash-glyph > :nth-child(5) { animation-delay: 2.25s; }
.splash-glyph > :nth-child(6) { animation-delay: 2.85s; }
.splash-glyph svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.splash-glyph .splash-mark { width: 44px; height: 44px; stroke-width: 55; }
@keyframes splash-glyph-cycle {
  0% { opacity: 0; transform: translateY(7px); }
  3.333%, 16.667% { opacity: 1; transform: translateY(0); }
  20%, 100% { opacity: 0; transform: translateY(-7px); }
}
@media (prefers-reduced-motion: reduce) {
  .splash-glyph > * {
    animation-name: splash-glyph-step;
    animation-timing-function: step-end;
    animation-duration: 3.6s !important;
    animation-iteration-count: infinite !important;
  }
}
@keyframes splash-glyph-step {
  0% { opacity: 1; }
  16.667%, 100% { opacity: 0; }
}
/* Reveal characters in place; the complete line always reserves its final size. */
.auth-brand-slogan.is-animated .auth-slogan-text { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.auth-slogan-character { animation: auth-slogan-reveal 1ms step-start both; animation-delay: calc(var(--letter-index) * 35ms); }
@keyframes auth-slogan-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .auth-slogan-character { animation: none; opacity: 1; } }
.auth-card { display: grid; align-content: start; gap: 18px; min-height: var(--auth-card-height); }
.platform-form { display: grid; gap: 10px; }
.platform-form:has(> .platform-section-title) { gap: var(--section-content-gap); }
.auth-card { padding: 24px; border: 1px solid var(--card-border); background: var(--surface); border-radius: var(--card-radius); }
.auth-card h2 { font-size: var(--page-heading-size); line-height: 24px; font-weight: 650; letter-spacing: 0; margin: 0; }
.auth-login-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: 44px; border-bottom: 1px solid #dfe4e8; }
.auth-login-tabs [role="tab"] { min-width: 0; height: 44px; padding: 8px 4px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: none; }
.auth-login-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--brand); color: var(--brand-dark); }
.auth-login-tabs [role="tab"]:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -3px; }
.auth-login-tabs [role="tab"]:disabled { cursor: progress; }
/* Keep the first input anchored while the shorter owner form leaves space below. */
.auth-login-body { min-height: 244px; display: flex; flex-direction: column; justify-content: flex-start; gap: 18px; }
.auth-login-body > * { flex: 0 0 auto; }
.auth-registration-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: 44px; margin: 0; padding: 0; border-bottom: 1px solid #dfe4e8; list-style: none; }
.auth-registration-steps li { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; height: 44px; padding: 0 4px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 12px; line-height: 18px; }
.auth-registration-steps li[aria-current="step"] { border-bottom-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.auth-step-number { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; line-height: 1; }
.auth-card .platform-form { align-content: start; gap: 12px; }
.auth-or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; line-height: 18px; }
.auth-or-divider::before, .auth-or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#recoveryMessage { overflow-wrap: anywhere; }
.auth-card .platform-form > .primary-button { height: 38px; min-height: 38px; margin-top: 8px; font-size: 13px; }
.auth-card .telegram-settings-field { --form-label-width: max(120px, 35%); height: calc(var(--form-row-height) + 2px); }
.auth-card .primary-button { height: 44px; min-height: 44px; padding: 0 12px; margin: 0; border-radius: 6px; background: var(--brand); font-size: 14px; font-weight: 650; box-shadow: none; }
.auth-card .primary-button:not(:disabled):hover { background: var(--brand-dark); box-shadow: none; }
.auth-card .primary-button:disabled { background: #9eb1ae; }
.auth-panel > .platform-error { min-height: 64px; margin: -12px 0 0; padding: 10px 12px; border-radius: 6px; background: transparent; line-height: 1.6; }
.platform-form .telegram-settings-field { border-color: var(--control-border); }
.auth-field-icon { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: var(--brand-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.employee-filters input, .employee-filters select { width: 100%; min-width: 0; height: 42px; border: 1px solid var(--control-border); border-radius: var(--control-radius); padding: 0 12px; background: var(--surface); color: var(--ink); font: inherit; }
.employee-filters input:focus-visible:where(:root:not([data-input-method="pointer"]) *), .employee-filters select:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: 0; }
.auth-card button, .platform-form .primary-button { min-height: 42px; }
.auth-card .information-help-button { min-height: 28px; }
.password-field > input { padding-right: 46px; }
.password-visibility { position: absolute; right: 0; top: 0; bottom: 0; width: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 0 9px 9px 0; background: transparent; color: var(--brand-dark); cursor: pointer; }
.auth-card .password-visibility { min-height: 0; }
.password-visibility svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility:not(:disabled):hover { background: var(--surface-selected); }
.password-visibility:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -3px; }
.company-choices { display: grid; gap: 10px; }
.company-choice { display: flex; flex-direction: column; text-align: left; gap: 5px; width: 100%; padding: 16px; border: 1px solid var(--card-border); border-radius: var(--card-radius); color: var(--ink); background: var(--surface); cursor: pointer; }
.company-choice:hover { background: var(--surface-selected); border-color: var(--card-border-hover); }
.company-choice span { color: var(--muted); font-size: 13px; }
.platform-error { color: var(--danger); background: var(--danger-light); border-radius: var(--control-radius); padding: 12px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.employees-sheet, .employee-editor-sheet, .company-settings-sheet { display: flex; flex-direction: column; min-height: 0; }
.employee-scroll, .platform-settings-scroll { overflow-y: auto; flex: 1; min-height: 0; padding-bottom: 20px; }
.panel-load-state { flex-direction: column; gap: 12px; text-align: center; }
.panel-load-state .history-spinner { width: 22px; height: 22px; }
.panel-load-state.is-error { color: var(--danger); }
.panel-load-state .secondary-button { width: auto; min-height: 36px; padding: 0 16px; }
.debt-bank-accounts-sheet > .panel-load-state { flex: 1; min-height: 0; }
/* Each employee row has one native button, stretched across all table columns. */
.employees-sheet .employee-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(110px,28%); gap: 8px; margin: var(--panel-content-gap) 0 8px; }
.employee-filters > input { min-width: 0; height: 42px; }
.employees-sheet .employee-filters > .workflow-assignment-control { min-width: 0; width: 100%; }
.employee-filters #employeeStatusFilterButton { width: 100%; height: 42px; justify-content: space-between; gap: 6px; padding: 0 10px; font-size: 13px; font-weight: 650; }
.employee-filters .app-filter-dropdown > span { position: static; flex: 1; min-width: 0; width: auto; height: auto; clip-path: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.employee-filters .app-filter-dropdown > svg { flex: 0 0 16px; width: 16px; height: 16px; }
.employee-filters .app-filter-dropdown[aria-pressed="true"]::after { content: none; }
.employee-table { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid #bfd0cc; border-radius: 14px; overflow: hidden; background: var(--surface); }
.employee-table > .employee-scroll { position: relative; padding-bottom: 0; scrollbar-gutter: stable; overscroll-behavior: contain; }
.employee-columns,.employee-record { display: grid; grid-template-columns: minmax(0,1fr) 110px; align-items: center; gap: 8px; padding: 0 11px; }
.employee-table.has-branches :is(.employee-columns,.employee-record) { grid-template-columns: minmax(0,1.15fr) 110px minmax(0,1fr); }
.employee-columns { flex: 0 0 auto; min-height: 30px; padding-right: calc(11px + var(--employee-scrollbar-size,0px)); border-bottom: 1px solid #d5e0dd; background: #f4f8f7; color: #536560; font-size: 9.5px; font-weight: 750; }
.employee-record { position: relative; min-height: 43px; border-bottom: 1px solid #cddbd8; background: var(--surface); color: var(--ink); }
.employee-table .employee-scroll.is-scrollable .employee-record:last-child { border-bottom: 0; }
.employee-list { display: block; }
.employee-account-cell,.employee-branch-cell { display: flex; align-self: stretch; align-items: center; min-width: 0; }
.employee-card { display: flex; align-items: center; width: 100%; min-width: 0; align-self: stretch; min-height: 42px; padding: 7px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.employee-card::after { content: ''; position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.employee-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; color: var(--ink); }
.employee-card-meta { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; line-height: 1.5; }
.employee-role { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.employee-access-status { flex: 0 0 12px; width: 12px; height: 12px; color: var(--danger); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.employee-branch-summary { display: block; min-width: 0; width: 100%; padding: 7px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.employee-record:hover,.employee-record:has(.employee-card:active) { background: var(--surface-selected); }
.employee-card:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: none; }
.employee-card:focus-visible:where(:root:not([data-input-method="pointer"]) *)::after { outline: var(--focus-width) solid var(--focus-color); outline-offset: -1px; }
.work-tasks-sheet,.work-task-view { display: flex; flex-direction: column; min-height: 0; }
.work-tasks-sheet { position: relative; }
.work-task-view { flex: 1; gap: 8px; padding-top: var(--panel-content-gap); }
.work-task-functions-control { position: relative; }
.work-task-functions-control > .work-task-functions-button { position: relative; }
.work-task-functions-button.has-notice::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.work-task-function-menu .header-more-item[aria-current="page"] { background: var(--brand-light); color: var(--brand-dark); }
.work-task-function-menu .header-more-item svg { width: 17px; height: 17px; flex: 0 0 auto; stroke-width: 1.9; }
.work-task-tabs { display: flex; flex: 0 0 auto; gap: 7px; padding-top: var(--panel-content-gap); padding-bottom: 12px; }
.work-task-tabs button { min-height: 34px; padding: 6px 13px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.work-task-tabs button[aria-selected="true"],.work-task-tabs .is-current { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 750; }
.employee-section-tabs { padding-bottom: 0; }
.work-task-filters,.work-task-person-filter { display: flex; gap: 8px; flex: 0 0 auto; min-width: 0; }
.work-task-filters input { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); padding: 0 11px; font: inherit; font-size: 13px; }
.work-task-filters #workTaskPerson { flex: 0 0 44%; width: 44%; max-width: 200px; min-width: 120px; height: 42px; }
.work-task-view #workTaskPerson { justify-content: space-between; gap: 6px; padding: 0 10px; color: var(--ink); font: inherit; font-size: 13px; font-weight: 650; }
.work-task-status-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; flex: 1; min-width: 0; min-height: 36px; }
.work-task-status-filters button:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -2px; }
.work-task-view .app-filter-dropdown > span { position: static; flex: 1; min-width: 0; width: auto; height: auto; clip-path: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.work-task-view .app-filter-dropdown > svg { width: 16px; height: 16px; flex-basis: 16px; }
.work-task-view .app-filter-dropdown[aria-pressed="true"]::after { content: none; }
.work-task-sync { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); }
.work-task-sync-status { min-height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.work-task-sync-status::before { content: ''; flex: 0 0 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.work-task-sync.is-offline .work-task-sync-status::before { background: var(--muted); }
.work-task-table { flex: 1; min-height: 0; min-width: 0; border: 1px solid #bfd0cc; border-radius: 14px; overflow: hidden; background: var(--surface); }
.work-task-scroll { height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.work-task-tail { height: 44px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 12px; }
.work-task-tail .history-spinner { flex: 0 0 auto; }
.work-task-tail button { min-height: 30px; padding: 0 9px; font-size: 12px; }
.work-task-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr) 108px 105px; min-width: 0; gap: 7px; align-items: center; padding-left: 11px; padding-right: 11px; }
@media(max-width:480px) { .work-task-grid { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) 64px 76px; gap: 5px; padding-left: 9px; padding-right: 9px; } }
.work-task-kpi-grid { display: grid; grid-template-columns: minmax(140px,1.6fr) repeat(5,minmax(78px,1fr)); min-width: 600px; gap: 7px; align-items: center; padding-left: 11px; padding-right: 11px; }
.work-task-columns { position: sticky; top: 0; z-index: 2; min-height: 30px; border-bottom: 1px solid #d5e0dd; background: #f4f8f7; color: #536560; font-size: 9.5px; font-weight: 750; }
.work-task-row { width: 100%; min-height: 43px; padding-top: 7px; padding-bottom: 7px; border: 0; border-bottom: 1px solid #cddbd8; border-radius: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; text-align: left; box-shadow: none; }
button.work-task-row { cursor: pointer; }
button.work-task-row:hover { background: var(--surface-selected); }
button.work-task-row:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -1px; }
.work-task-row > *,.work-task-columns > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-task-row > strong { color: var(--ink); font-size: 13px; font-weight: 750; }
.work-task-kpi-grid > :not(:first-child) { text-align: right; }
.work-task-status { color: var(--brand-dark); font-size: 12px; }
.work-task-status[data-status="overdue"] { color: var(--danger); }
.work-task-status[data-status="review"] { color: var(--profit-ink); }
.work-task-status[data-status="cancelled"] { color: var(--muted); }
.work-task-status[data-status="failed"] { color: var(--danger); }
.work-task-period { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; min-height: 42px; }
.work-task-period .sales-discount-dates { flex: 1; min-width: 0; }
.task-template-grid { display: grid; grid-template-columns: var(--task-template-number-width,28px) minmax(0,1fr) 95px 96px; gap: 8px; align-items: center; padding-left: 11px; padding-right: 11px; }
.task-template-grid > :first-child { min-width: 28px; }
.task-template-grid > .draft-order-number.task-template-long-number { width: max-content; padding: 0 4px; }
.task-template-recipient-settings { display: grid; gap: 8px; min-width: 0; }
.task-template-people.task-template-policy-people { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
@media(max-width:480px) { .task-template-grid { grid-template-columns: var(--task-template-number-width,28px) minmax(0,1fr) 70px 84px; gap: 6px; padding-left: 9px; padding-right: 9px; } }
#taskTemplateStatus { flex: 0 0 40%; max-width: 180px; height: 42px; padding: 0 10px; justify-content: space-between; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink); }
/* Lịch công việc: bảy ô thứ trong tuần như đồng hồ báo thức. */
.task-template-repeat { display: grid; gap: 8px; min-width: 0; }
.task-template-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.task-template-days > button { min-width: 0; min-height: 40px; padding: 0; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.task-template-days > button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.task-template-days > button:disabled { opacity: .55; cursor: default; }
.task-template-people-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.task-template-people-heading button { min-height: 32px; padding: 0 9px; font-size: 12px; }
.task-template-people { border: 1px solid #bfd0cc; border-radius: 12px; overflow: hidden; background: var(--surface); }
.task-template-person { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 8px 11px; border-bottom: 1px solid #cddbd8; font-size: 13px; cursor: pointer; }
.task-template-person input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: 0 0 auto; }
.task-template-person span { overflow-wrap: anywhere; }
.work-task-deadline > * { display: block; line-height: 15px; }
.work-task-deadline time { color: var(--muted); font-size: 11px; }
.work-task-time { grid-column: 2; grid-row: 1; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) 10px minmax(0,1fr); align-items: center; border-left: 1px solid var(--line); }
.work-task-time > span { text-align: center; }
.work-task-time .app-dropdown-button { border-left: 0; }
.work-task-pagination { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 8px; font-size: 12px; color: var(--muted); }
.work-task-pagination button { width: 32px; height: 32px; min-height: 32px; padding: 0; }
.work-task-pagination span { min-width: 100px; text-align: center; }
.work-task-pagination.is-single-page { visibility: hidden; pointer-events: none; }
.compact-modal > .work-task-dialog-sheet { max-width: var(--form-dialog-max-width); height: min(680px,calc(var(--tg-viewport-height,100dvh) - 32px - var(--safe-top) - var(--safe-bottom))); background: var(--workspace-canvas); }
.work-task-dialog-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; margin-top: var(--panel-content-gap); padding-bottom: 12px; }
.work-task-form { align-content: start; }
.work-task-description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; color: var(--ink); font-size: 13px; line-height: 1.6; }
.work-task-facts { margin: 0 0 12px; border: 1px solid #bfd0cc; border-radius: 12px; overflow: hidden; background: var(--surface); }
.work-task-facts > div { display: grid; grid-template-columns: minmax(100px,.8fr) minmax(0,1.2fr); gap: 8px; min-height: 36px; align-items: center; padding: 7px 10px; border-bottom: 1px solid #cddbd8; font-size: 12px; }
.work-task-facts > div:last-child { border-bottom: 0; }
.work-task-facts dt { color: var(--muted); }.work-task-facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.work-task-note-label { margin-bottom: 16px; }
.work-task-event { padding: 10px 0; border-bottom: 1px solid #cddbd8; color: var(--ink); font-size: 12px; }
.work-task-event > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 4px 8px; align-items: baseline; }
.work-task-event time { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.work-task-event p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.work-task-dialog-footer { flex: 0 0 auto; min-height: 53px; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.work-task-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.work-task-actions button,.work-task-dialog-footer > button { width: auto; min-height: 36px; margin: 0; padding: 0 10px; border-radius: var(--control-radius); box-shadow: none; font-size: 12px; }
.work-task-dialog-footer > .primary-button { align-self: stretch; min-height: 40px; }
.work-task-actions .task-template-delete { margin-right: auto; border-color: #f0c4c0; background: #fff; color: var(--danger); }
.work-task-actions .task-template-delete:not(:disabled):hover { background: #ffeceb; }
#employeeLoading { min-height: 120px; }
#employeeLoading.is-error { position: sticky; top: 0; z-index: 2; padding: 16px; border-bottom: 1px solid var(--line); background: var(--danger-light); }
.employee-table:has(.employee-list:not(.hidden)) #employeeLoading.is-error { position: absolute; top: auto; left: 8px; right: 8px; bottom: 8px; border: 1px solid var(--danger-border-soft); border-radius: var(--control-radius); }
@media(max-width:480px) {
 .employee-columns,.employee-record { grid-template-columns: minmax(0,1fr) 88px; gap: 6px; padding-left: 9px; padding-right: 9px; }
 .employee-columns { padding-right: calc(9px + var(--employee-scrollbar-size,0px)); }
 .employee-table.has-branches :is(.employee-columns,.employee-record) { grid-template-columns: minmax(0,1fr) 84px minmax(0,.95fr); }
 .employees-sheet .employee-filters { grid-template-columns: minmax(0,1fr) 110px; }
}
.auth-card .secondary-button, .employee-invite-card .secondary-button { border-radius: var(--control-radius); font-family: inherit; }
.employee-editor-sheet > .confirm-actions { flex: 0 0 auto; padding-top: 12px; border-top: 1px solid var(--line); }
.employee-editor-sheet > .confirm-actions:has(> .hidden:only-child) { display: none; }
.employee-empty { padding: 32px 14px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.employee-form { display: grid; gap: var(--section-gap); padding-top: 12px; }
.employee-form .telegram-settings-field { border-color: var(--control-border); }
.employee-permission .telegram-settings-history-toggle { grid-template-columns: minmax(0, 1fr) 74px; }
.employee-permission .telegram-settings-switch-control { padding: 0; place-items: center; }
.employee-permission .telegram-settings-switch { pointer-events: none; }
.employee-permission-heading { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--brand-dark); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.employee-permission-heading:first-child { margin-top: 0; }
.employee-permission-heading::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.employee-permission-heading.is-advanced { color: #8a5a0c; }
.employee-permission-heading.is-advanced::before { background: #d9902b; }
.employee-permission-heading .information-help-description { display: none; }
.employee-reinvite { min-height: 36px; padding: 5px 12px; justify-self: start; }
.employee-delete-panel { display: grid; gap: 12px; margin-top: 4px; padding: 14px; border: 1px solid var(--danger-border-soft); border-radius: var(--card-radius); background: var(--danger-light); }
.employee-delete-panel h3 { margin: 0 0 5px; color: var(--danger); font-size: 14px; font-weight: 700; }
.employee-delete-panel p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.6; }
.employee-delete-button { justify-self: start; min-height: 36px; padding: 0 12px; border: 1px solid var(--danger-border); border-radius: var(--control-radius); background: var(--surface); color: var(--danger); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.employee-delete-button:not(:disabled):hover { background: var(--danger-light); }
.employee-delete-button:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--danger); outline-offset: 1px; }
.employee-delete-description { font-size: 14px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.platform-section-title { margin: calc(var(--section-gap) - var(--section-content-gap)) 0 0; font-size: 14px; }
.platform-help-heading { display: flex; align-items: center; gap: 8px; }
.platform-help-heading h2, .platform-help-heading h3 { margin: 0; }
.platform-form small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; }
.company-settings-sheet { overflow: hidden; }
.company-settings-sheet > .platform-settings-scroll { padding-top: 14px; }
#companySettingsForm { grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--section-gap); }
.company-settings-sheet .telegram-settings-section-title { margin: 0; color: var(--ink); font-size: 14px; font-weight: 700; letter-spacing: normal; text-transform: none; }
.company-settings-link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; text-align: left; }
.company-settings-link > span { flex: 1; min-width: 0; }
.company-settings-link > svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.company-settings-load-state { height: 100%; min-height: 180px; flex-direction: column; gap: 12px; text-align: center; }
.company-settings-load-state .history-spinner { width: 22px; height: 22px; }
.company-settings-load-state.is-error { color: var(--danger); }
.company-settings-load-state .secondary-button { width: auto; min-height: 36px; margin-top: 4px; padding: 0 16px; }
.company-settings-sheet > .confirm-actions { flex: 0 0 auto; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); background: var(--canvas); }
.account-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--section-gap); padding: var(--panel-content-gap) 0 16px; }
.account-scroll > * { flex-shrink: 0; }
.account-self-settings { display: grid; gap: var(--section-gap); --form-row-height: 38px; }
.account-settings-group { display: grid; gap: var(--section-content-gap); }
.account-settings-heading { margin: 0; color: var(--brand-dark); font-size: 13px; font-weight: 750; line-height: 1.4; }
.account-password-section { display: grid; gap: var(--section-content-gap); margin-top: calc(var(--section-gap) - var(--section-content-gap)); }
.account-details { --form-row-height: 36px; display: grid; margin: 0; border: 1px solid var(--card-border); border-radius: var(--card-radius); background: var(--surface); overflow: hidden; }
.account-details > div { display: grid; grid-template-columns: var(--form-label-width) minmax(0, 1fr); }
.account-details > div + div { border-top: 1px solid var(--line); }
.account-details dt, .account-details dd { display: flex; align-items: center; min-width: 0; min-height: var(--form-row-height); margin: 0; padding: 6px 10px; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.account-details dt { background: #f5f8f7; color: var(--ink); border-right: 1px solid var(--line); font-size: var(--form-label-size); font-weight: var(--form-label-weight); }
.account-details dd { background: var(--surface-disabled); color: var(--text-disabled); font-weight: 600; }
.account-section { display: grid; gap: var(--section-content-gap); }
.account-section .platform-section-title { margin: 0; font-size: 13px; }
.account-section .auth-help { font-size: 12px; }
.account-actions { border: 1px solid var(--card-border); border-radius: var(--card-radius); overflow: hidden; }
.account-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; }
.account-actions .account-action { min-height: 38px; }
.account-action + .account-action { border-top: 1px solid var(--line); }
.account-action svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-action svg { color: var(--brand-dark); }
.account-action:not(:disabled):hover { background: var(--surface-selected); }
.account-action:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: calc(-1 * var(--focus-width)); }
.account-action:disabled { color: var(--text-disabled); background: var(--surface-disabled); cursor: progress; }
.account-scroll .primary-button { min-height: 40px; margin: 0; border: 1px solid var(--button-brand-hover); border-radius: var(--control-radius); padding: 8px 14px; font-size: 12px; font-weight: 700; box-shadow: none; }
.account-scroll .primary-button:not(:disabled):hover { box-shadow: none; }
.account-footer { flex: 0 0 auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); background: var(--canvas); }
.account-footer .primary-button { min-height: 44px; margin: 0; font-size: 13px; font-weight: 750; box-shadow: none; }
body:has(#accountPanelModal:not(.hidden)) .app-toast { bottom: calc(124px + var(--safe-bottom)); }
.account-sign-out { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #dca39b; border-radius: var(--control-radius); background: #f9e2de; color: var(--danger); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.account-sign-out svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.account-sign-out:not(:disabled):hover { border-color: #cc8e85; background: #f5d5ce; }
.account-sign-out:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--danger); outline-offset: 1px; }
.employee-invite-link { width: 100%; padding: 12px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font-size: 13px; }
.employee-invite-card { display: grid; gap: 16px; }
.employee-invite-card h2 { margin: 0; font-size: var(--page-heading-size); text-align: center; }
.employee-invite-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.employee-invite-card a { color: var(--brand-dark); text-decoration: underline; font-size: 14px; }
@media (max-width: 400px) {
  .auth-panel { padding-left: 16px; padding-right: 16px; }
  .auth-card { padding: 20px; }
}

.auth-links { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.auth-links button, .auth-card .auth-back-link { min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--brand-dark); font: inherit; font-size: 13px; cursor: pointer; }
.auth-card .auth-back-link { display: inline-flex; align-items: center; justify-content: center; gap: 6px; justify-self: center; }
.auth-back-link svg { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-links button:not(:disabled):hover, .auth-back-link:not(:disabled):hover { text-decoration: underline; }
.auth-links button:focus-visible:where(:root:not([data-input-method="pointer"]) *), .auth-back-link:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); }
.employee-credential-save { min-height: 40px; margin-top: 0; padding: 0 14px; border-radius: var(--control-radius); font-family: inherit; }
#employeeCredentialHelp { margin-top: 8px; font-size: 12px; }
#employeeShopUsername { font-size: 12px; }

/* Desktop columns follow complete sections; mobile keeps the same reading order. */
:is(.employee-editor-sheet, .company-settings-sheet, .account-sheet,
    .telegram-settings-sheet, .create-product-card, .debt-customer-create-sheet, .debt-admin-sheet) {
  container: settings-form / inline-size;
}
/* Hồ sơ khách hàng và Tạo khách hàng: mỗi trường một hàng ở mọi kích thước (chủ dự án 29/11/2026: điện thoại và MST không chung hàng). */
@container settings-form (min-width: 560px) {
  #debtRenameForm { --form-label-width: 128px; --form-row-height: 40px; }
}
/* Các form của panel chức năng khách (Hồ sơ, Ghi xuất, Điều chỉnh VAT) nằm thẳng trên nền panel, không có khung thẻ bọc trong. */
#debtAdminModal .debt-admin-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
@container settings-form (min-width: 560px) {
  :is(.employee-form, .create-product-grid) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    align-items: start;
    gap: 20px 16px;
  }
  :is(.employee-form, .create-product-grid) > :not(section) {
    grid-column: 1 / -1;
  }
  .employee-permissions-group, .employee-delete-panel, .product-identity-group, .product-images-group {
    grid-column: 1 / -1;
  }
  .product-details-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .product-fold { grid-column: 1 / -1; }
  .product-unit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .product-unit-row:has(> .hidden) { grid-template-columns: minmax(0, 1fr); }
  .product-fold-body { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .product-fold-body > .product-description-field { grid-column: 1 / -1; }
  .product-details-panel > .product-description-field { grid-column: 1 / -1; }
  .employee-permissions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
  }
  :is(.account-settings-group, .account-password-section, .debt-customer-create-content)
      > :not(.telegram-settings-field),
  .telegram-settings-field:has(> :is(#accountCurrentPassword, #debtCustomerCreateName, #debtCustomerCreateUnitName,
      #debtCustomerCreateEmail, textarea)), .debt-customer-create-content > .customer-partner-field {
    grid-column: 1 / -1;
  }
  :is(.employee-form, #companySettingsForm,
      .telegram-settings-form, .create-product-grid, .debt-customer-create-content) {
    --form-label-width: 128px;
    --form-row-height: 40px;
  }
  .product-form-field:has(> label) {
    --form-label-width: calc(100% - 64px);
  }
  .product-form-field > label { padding: 0; place-items: center; }
  .telegram-settings-section-title, .product-form-section-title {
    display: flex; align-items: center; min-height: 28px; line-height: 16px;
  }
  .product-form-group, .telegram-settings-group { align-content: start; }
  .product-form-panel, .telegram-settings-group-body { gap: 8px; }
  .company-document-group .telegram-settings-field-heading {
    overflow-wrap: anywhere;
  }
}
/* Nhãn Gửi thông báo dài hơn các form khác: rộng đủ để không xuống dòng. */
#telegramSettingsForm.telegram-settings-form { --form-label-width: 152px; }
.product-category-row { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.product-category-row > .product-form-field { flex: 1; min-width: 0; }
.create-product-card .product-form-header { gap: 8px; }
.create-product-card .product-form-header h2 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--page-heading-size); line-height: 22px; }
.create-product-modal.compact-modal > .create-product-card { display: flex; width: 100%; max-width: var(--form-dialog-max-width); height: min(700px,calc(var(--tg-viewport-height,100dvh) - 64px - var(--safe-top) - var(--safe-bottom))); min-height: 0; background: var(--workspace-canvas); }
.create-product-modal > .category-manager-sheet { display: flex; flex-direction: column; gap: 14px; width: 100%; min-height: 0; padding: 16px; overflow: hidden; background: var(--workspace-canvas); }
.category-manager-modal { align-items: center; padding: 20px 12px; background: rgba(11, 28, 25, .38); }
.category-manager-modal > .category-manager-sheet { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 620px; height: min(700px,calc(100dvh - 64px)); min-height: 0; padding: 16px; border: 1px solid #bfd0cc; border-radius: 14px; background: var(--workspace-canvas); box-shadow: 0 12px 36px rgba(11, 28, 25, .18); overflow: hidden; }
.category-manager-sheet .panel-heading { flex: 0 0 auto; padding: var(--header-padding-top) var(--header-inset) var(--header-padding-bottom); border-bottom: 1px solid var(--line); }
.category-manager-sheet h2 { margin: 0; font-size: 17px; line-height: 22px; }
.category-manager-table { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #bfd0cc; border-radius: 10px; background: #fff; }
.category-manager-table-heading, .category-manager-row { display: grid; grid-template-columns: 40px minmax(0,1fr) minmax(80px,.48fr) 64px 30px; align-items: center; }
.category-manager-table-heading { flex: 0 0 auto; min-height: 40px; border-bottom: 1px solid #d8e3e0; background: #f2f6f5; color: #586a65; font-size: var(--table-heading-size); line-height: 16px; font-weight: 700; }
.category-manager-table-heading > :first-child { text-align: center; }
.category-manager-table-heading > :nth-child(2), .category-manager-table-heading > :nth-child(3), .category-manager-table-heading > :nth-child(4) { padding: 0 10px; border-left: 1px solid #d8e3e0; }
.category-manager-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.category-manager-list { display: grid; }
.category-manager-empty { min-height: 144px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; color: var(--muted); font-size: 13px; }
.category-manager-empty svg { width: 30px; height: 30px; fill: none; stroke: #92b4ae; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.category-manager-row { min-height: 44px; border-bottom: 1px solid #d8e3e0; }
.category-manager-index { color: var(--brand-dark); font-size: var(--table-meta-size); font-variant-numeric: tabular-nums; text-align: center; }
.category-manager-cell { display: flex; align-items: center; min-width: 0; align-self: stretch; padding: 4px 5px; border-left: 1px solid #d8e3e0; }
.category-manager-name { min-width: 0; width: 100%; height: 32px; padding: 0 5px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); font: inherit; font-size: var(--table-body-size) !important; }
.category-manager-label-cell { gap: 4px; }
.category-manager-tag { position: relative; display: flex; flex: 0 1 auto; min-width: 0; height: 21px; padding: 3px 8px; overflow: hidden; border: 0; font-size: 10px; }
.category-manager-label-size { visibility: hidden; min-width: 0; white-space: pre; }
.category-manager-tag .category-manager-label { position: absolute; inset: 0; min-width: 0; width: 100%; height: 100%; padding: 0 8px; border: 0; border-radius: inherit; background: transparent; color: inherit; -webkit-text-fill-color: currentColor; font: inherit; font-size: var(--table-body-size) !important; }
.category-manager-tag { outline: 1px dashed #6fa8a0; outline-offset: 1px; cursor: text; }
.category-manager-tag:hover { outline-style: solid; }
.category-manager-tag:focus-within { outline: 1px solid var(--brand); outline-offset: 1px; }
.category-manager-table-heading > .category-manager-heading-help { display: flex; align-items: center; gap: 2px; }
.category-manager-heading-help .information-help-button { height: 28px; min-height: 0; margin: -4px 0; }
.category-manager-tag .category-manager-label:focus { outline: 0; box-shadow: none; }
.category-manager-label::placeholder { color: inherit; -webkit-text-fill-color: currentColor; opacity: .68; }
.category-manager-name::placeholder { color: #85938f; }
.category-manager-color-cell { justify-content: center; }
.category-color-button { width: 52px; height: 36px; padding: 0; border: 1px solid #98bdb5; border-radius: 6px; background: var(--swatch); }
.category-color-button:hover, .category-color-button[aria-expanded="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.category-color-popover { position: fixed; z-index: 1300; width: 280px; padding: 12px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 10px 28px rgba(11,28,25,.18); overflow: auto; font-size: 12px; }
.category-color-palette { display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; }
.category-color-swatch { height: 36px; padding: 0; border: 1px solid rgba(0,0,0,.18); border-radius: 6px; background: var(--swatch); }
.category-color-swatch[aria-pressed="true"] { outline: 2px solid var(--brand); outline-offset: 2px; }
.category-color-custom { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.category-color-custom label { grid-column: 1 / -1; font-weight: 600; }
.category-color-custom input { min-width: 0; width: 100%; height: 34px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.category-color-custom button { min-height: 34px; padding: 4px 10px; font-size: 12px; }
.category-delete-button { display: grid; place-items: center; width: 30px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--danger); }
.category-delete-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.category-delete-button:not(:disabled):hover { background: var(--danger-light); }
.category-manager-add { flex: 0 0 auto; min-height: 36px; margin: 7px; border: 0; border-radius: 9px; background: #e5f2ef; color: var(--brand-dark); font: inherit; font-size: var(--table-body-size); font-weight: 700; }
.category-manager-add:not(:disabled):hover { background: var(--brand-light); }
.category-manager-save.primary-button { flex: 0 0 auto; width: 100%; height: 42px; min-height: 42px; margin: 0; padding: 0 12px; border-radius: 10px; font-size: var(--table-body-size); }
.category-manager-sheet[aria-busy="true"] { cursor: progress; }
@media (max-width: 440px) {
  .category-manager-table-heading, .category-manager-row { grid-template-columns: 32px minmax(0,1fr) minmax(72px,.65fr) 50px 24px; }
  .category-manager-table-heading > :nth-child(n+2) { padding: 0 6px; }
  .category-manager-cell { padding: 4px; }
  .category-manager-color-cell { padding: 4px 2px; }
  .category-color-button { width: 44px; }
  .category-delete-button { width: 24px; }
  .category-manager-modal > .category-manager-sheet { padding: 12px; gap: 12px; }
  .category-manager-sheet .panel-heading { gap: 8px; }
}
.category-select-control, .create-product-location-control { display: flex; align-items: center; min-width: 0; grid-column: 2; grid-row: 1; border-left: 1px solid var(--line); }
.category-select-control > .app-dropdown-control, .create-product-location-control > .app-dropdown-control { flex: 1; }
.category-select-control > input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; background: transparent; color: inherit; padding: 0 8px; font: inherit; }
.category-inline-error { grid-column: 1 / -1; padding: 6px 8px; color: #ad3029; font-size: 12px; }
.app-dropdown-value { display: none !important; }
.app-date-value { display: none !important; }
.app-date-control { display: grid; min-width: 0; width: 100%; align-self: stretch; grid-column: 2; grid-row: 1; }
.app-date-button { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; min-width: 0; height: 100%; min-height: var(--form-row-height); padding: 5px 10px; border: 0; border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--form-value-size); font-weight: 650; text-align: left; box-shadow: none; }
.app-date-button:disabled { background: #eef2f1; color: #7d8b87; opacity: 1; }
.app-date-button svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: var(--brand-dark); stroke-width: 1.9; }
.telegram-settings-field .app-date-button:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: none; box-shadow: none; border-left-color: var(--line); }
.app-date-picker { position: fixed; z-index: 10000; width: 300px; padding: 10px; border: 1px solid var(--control-border); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow-y: auto; box-sizing: border-box; }
.app-date-heading { display: grid; grid-template-columns: 26px minmax(0,1fr) 76px 26px; align-items: center; gap: 4px; margin-bottom: 8px; }
.app-date-heading > button { height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--brand); font-size: 22px; padding: 0; box-shadow: none; }
.app-date-heading .app-dropdown-button { min-height: 30px; height: 30px; padding: 4px; font-size: 12px; border-radius: 6px; }
.app-date-heading .app-dropdown-button svg { width: 12px; }
.app-date-weekdays, .app-date-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; text-align: center; }
.app-date-weekdays { color: var(--muted); font-size: 11px; line-height: 24px; }
.app-date-grid button { height: 30px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); font-size: 12px; box-shadow: none; }
.app-date-grid .outside-month { color: var(--muted); }
.app-date-grid .is-today { border-color: var(--brand); }
.app-date-grid .is-selected { background: var(--brand); color: #fff; }
.app-date-grid button:not(:disabled):hover { background: var(--brand-light); color: var(--brand-dark); }
.app-date-grid button:disabled { opacity: .3; }
.app-date-footer { display: flex; justify-content: space-between; padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--line); }
.app-date-footer button { padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--brand); font-size: 12px; box-shadow: none; }
.app-dropdown-control { display: grid; min-width: 0; width: 100%; align-self: stretch; }
.app-dropdown-button { min-width: 0; height: 100%; border-radius: 0 9px 9px 0; border: 0; background: transparent; padding: 5px 10px; font: inherit; font-size: var(--form-value-size); font-weight: 650; }
.app-dropdown-picker { position: fixed; z-index: 10000; right: auto; bottom: auto; padding: 5px; border-radius: 11px; box-shadow: 0 12px 28px rgba(29,54,49,.16); }
.app-dropdown-picker .workflow-assignment-option { min-height: 40px; height: auto; padding: 8px 9px; border-radius: 8px; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.app-dropdown-picker .workflow-assignment-option[aria-selected="true"] { font-weight: 800; }
.app-dropdown-picker .workflow-assignment-option:disabled { opacity: .5; cursor: not-allowed; }
.app-dropdown-picker.app-dropdown-rich { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.app-dropdown-rich .app-dropdown-search { flex: 0 0 38px; min-height: 38px; width: 100%; min-width: 0; margin: 0; padding: 6px 10px; border: 1px solid var(--control-border); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.app-dropdown-search:focus { outline: 1px solid var(--brand); outline-offset: -1px; }
.app-dropdown-button.app-product-search { display:block;width:100%;cursor:text;text-align:left; }
.app-dropdown-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.app-dropdown-actions { flex: 0 0 auto; border-top: 1px solid var(--line); padding-top: 4px; }
.app-dropdown-actions:empty { display: none; }
.app-dropdown-action { color: var(--brand-dark); font-weight: 650; }
.app-dropdown-empty { padding: 10px; margin: 0; color: var(--muted); font-size: 12px; }
.app-dropdown-tree-group + .app-dropdown-tree-group { margin-top: 6px; }
.app-dropdown-tree-branch { width: 100%; min-height: 36px; display: flex; align-items: center; text-align: left; gap: 8px; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 650; }
.app-dropdown-tree-branch::before { content: '›'; color: var(--brand-dark); transform: rotate(90deg); }
.app-dropdown-tree-branch[aria-expanded='false']::before { transform: none; }
.app-dropdown-tree-children { border-left: 1px solid var(--line); margin: 0 0 4px 15px; padding-left: 12px; }
.app-dropdown-tree-children > button { position: relative; }
.app-dropdown-tree-children > button::before { content: ''; position: absolute; left: -12px; top: 18px; width: 12px; border-top: 1px solid var(--line); }
.operations-date-field > .app-date-control { width: 100%; min-width: 0; }
.operations-date-field .app-date-button { display: grid; grid-template-columns: minmax(0,1fr) 18px; width: 100%; font-size: var(--form-value-size,14px); font-weight: 650; padding: 5px 10px; background: transparent; }
.operations-date-field .app-date-button svg { width: 18px; height: 18px; stroke: var(--brand-dark); stroke-width: 1.9; }
.app-date-picker-payment .app-date-grid button { height: 36px; font-size: 14px; }
.app-date-picker-payment .app-date-heading > button { height: 34px; width: 100%; }
.category-filter-control { width: 155px; max-width: 100%; height: 32px; }
.category-filter-control .app-dropdown-button { min-height: 32px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; }
.category-filter-picker .workflow-assignment-option { min-height: 32px; height: 32px; padding: 5px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.category-filter-picker .workflow-assignment-option[aria-selected="true"] { font-weight: 700; }
@media (hover: hover) {
  .category-filter-control .app-dropdown-button:not(:disabled):hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); }
}
.telegram-settings-field > .app-dropdown-control { grid-column: 2; grid-row: 1; }
.telegram-settings-field .app-dropdown-button { border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; }
.telegram-settings-field.is-unlabelled { display: grid; grid-template-columns: minmax(0,1fr); }
.telegram-settings-field.is-unlabelled > .app-dropdown-control { grid-column: 1; }
.telegram-settings-field.is-unlabelled > .telegram-settings-field-heading { display: none; }
.telegram-settings-field.is-unlabelled .app-dropdown-button { border: 0; border-radius: inherit; }
.telegram-settings-field.is-unlabelled:has(.workflow-assignment-button:focus-visible:where(:root:not([data-input-method="pointer"]) *))::after { left: -1px; border-radius: inherit; }
.product-form-field > .category-select-control { min-width: 0; }
.product-form-field .category-select-control .app-dropdown-button { border-radius: 0 9px 9px 0; box-shadow: none; }
.source-pill.category-pill { color: var(--category-label-ink,var(--brand-dark)); background: var(--category-label-bg,#daeeeb); max-width: 100%; min-height: 21px; height: 21px; border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 750; line-height: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-manager-sheet .category-manager-tag.category-pill { min-height: 32px; height: 32px; padding: 6px 10px; font-size: var(--table-body-size); line-height: 18px; }
.category-manager-tag .category-manager-label { padding: 0 10px; }
.app-dropdown-label.category-pill, .app-dropdown-picker .category-pill { width: fit-content; flex: 0 1 auto; min-width: 0; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-dropdown-label.category-pill { display: block; }
.app-dropdown-picker .category-pill { display: block; max-width: 100%; }
.app-product-picker .app-product-option { padding: 11px 12px; border: 0; border-bottom: 1px solid #d3dfdc; border-radius: 0; }
.app-product-picker .source-pill.category-pill { display: inline-flex; }
.operations-transfer-product-history { display: flex; flex: 1; flex-direction: column; gap: 12px; overflow: hidden; }
.operations-transfer-product-history .product-card { flex: 0 0 auto; border-radius: 14px; }
.operations-transfer-product-history .product-history-columns { grid-template-columns: 76px minmax(0,1fr) 68px 64px; }
.operations-transfer-product-history .product-history-row { grid-template-columns: 76px minmax(0,1fr) 68px 64px; }
.operations-transfer-product-history .product-card h3 { font-size: 13px; line-height: 1.22; }
.category-choice-control .app-dropdown-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-choice-picker .app-dropdown-list { flex: 0 1 auto; scrollbar-gutter: auto; }
.category-choice-picker .workflow-assignment-option { height: 40px; min-height: 40px; }
.working-location {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0 0 6px;
  padding: 6px 10px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--surface);
  font-size: 13px;
  font-weight: 400;
  width: 100%;
  text-align: left;
  box-shadow: none;
  color: var(--ink);
}
.working-location > span:not(.working-location-divider) {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: calc(50% - 20px);
}
.working-location-divider { flex: 0 0 auto; color: var(--muted); font-size: 18px; line-height: 20px; }
.working-location svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--brand-dark);
}
.working-location [data-working-branch], .working-location [data-working-warehouse] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.working-location[role="button"]:not(:disabled) { cursor: pointer; }
.working-location[role="button"]:not(:disabled):hover { border-color: var(--brand); }
.working-location:disabled svg { color: inherit; }
.working-location[role="button"]::after { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: 0 4px 4px auto; }
.working-location[aria-expanded="true"] { border-color: var(--brand); }
.working-location[aria-expanded="true"]::after { transform: rotate(225deg); margin-bottom: -2px; }
.working-location-picker { overflow-y: auto; overscroll-behavior: contain; }
.working-location > .working-location-caption { flex: 0 0 auto; max-width: none; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.operations-sheet { background: #e6eeeb; box-shadow: none; }
.panel-navigation-host { position: relative; }
.panel-content-loading { background: transparent; }
.panel-loading-content:has(> .panel-content-loading:not(.panel-loading-layer):not(.hidden)) { display: flex; flex-direction: column; min-height: 0; }
.panel-loading-content > .panel-content-loading:not(.panel-loading-layer) { flex: 1 1 auto; }
.organization-scroll:has(#organizationLoading:not(.hidden)) { display: flex; flex-direction: column; }
.organization-scroll:has(#organizationLoading:not(.hidden)) > #organizationListView { flex: 1 1 auto; min-height: 0; }
.panel-loading-layer { position: absolute; z-index: 9; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; gap: 8px; padding: 24px; border: 0; border-radius: 0; background: var(--canvas); }
[data-loading-frame] > .panel-loading-layer { background: var(--surface); }
.panel-loading-layer .history-spinner { width: 22px; height: 22px; flex-shrink: 0; }
:is(.product-history-list,.operations-ledger-list,.debt-list,.debt-transactions,.ledger-report-rows)[data-loading-frame],.product-history-pane > .product-history-list { scrollbar-gutter: stable; }
/* Thẻ kho tự giữ vị trí cuộn khi đổi tab; tắt neo cuộn của trình duyệt để nó không tự dịch danh sách khi khung hiện lại. */
.product-history-pane > .product-history-list { overflow-anchor: none; }
.operations-pending { flex: 1 1 auto; min-height: 120px; }
.panel-navigation-state { animation: none; }
/* Keep cold content mounted at its final dimensions, revealing it in one paint. */
.sheet-card.has-cold-panel-loading > :not(.cold-panel-state) { visibility: hidden; }
.sheet-card.has-cold-panel-loading .cold-panel-navigation { z-index: 21; }
.sheet-card.has-cold-panel-loading :is(.cold-panel-close,.panel-header-title:has(.modal-parent-link)),
.sheet-card.has-cold-panel-loading .panel-header-title:has(.modal-parent-link) * { visibility: visible; }
.sheet-card.has-cold-panel-loading > .cold-panel-close { position: absolute; }
.modal.compact-modal:not([data-confirmation-dialog]) > .sheet-card[data-cold-frame] { height: var(--cold-panel-height); }
.cold-panel-state { position: absolute; z-index: 20; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; background: var(--canvas); color: var(--muted); border-radius: inherit; text-align: center; }
.cold-panel-state .history-spinner { flex: 0 0 22px; width: 22px; height: 22px; }
.cold-panel-state strong { color: var(--brand-dark); font-size: 14px; }
.cold-panel-state > span:not(.history-spinner) { max-width: min(290px,100%); color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.cold-panel-state.is-error :is(strong,span:not(.history-spinner)) { color: var(--danger); }
.cold-panel-state .secondary-button { width: auto; min-width: 104px; min-height: 38px; margin-top: 4px; padding: 0 18px; border-radius: 10px; font-size: 12px; font-weight: 750; }
.panel-navigation-button { position: relative; -webkit-text-fill-color: transparent; }
.panel-navigation-button > :not(.draft-action-spinner) { visibility: hidden; }
.product-history-sheet > .product-history-loading { flex: 1 1 auto; }
.product-history-action-control { position: relative; }
:is(.product-actions-menu, .catalog-functions-control .header-more-menu) .is-danger { color: var(--danger); }
.product-history-toolbar { display: none; }
/* Thanh tab là đầu khung nội dung (như tab Thông báo): chữ, gạch chân màu thương hiệu ở tab đang mở, chia đều bề ngang. */
.product-stock-tabs { flex: 0 0 auto; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 0; margin: 0; padding: 0 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface); }
.product-stock-tabs > .filter { position: relative; min-width: 0; min-height: 44px; padding: 0 10px; overflow: hidden; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; box-shadow: none; }
@media (max-width: 359px) { .product-stock-tabs > .filter { padding: 0 4px; } }
.product-stock-tabs > .filter:hover:not(.active) { background: transparent; color: var(--ink); }
.product-stock-tabs > .filter.active { background: transparent; color: var(--brand-dark); font-weight: 750; }
.product-stock-tabs > .filter::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.product-stock-tabs > .filter.active::after { background: var(--brand-dark); }
.product-history-sheet > .product-history-views { border: 1px solid #c5d5d1; border-radius: 13px; background: var(--surface); overflow: hidden; }
.product-history-views .product-history-list { border: 0; border-radius: 0; }
/* Panel khách hàng (docs/customer-detail.md): ba tab Thông tin / Hàng hay lấy / Công nợ trong một khung như Chi tiết hàng hoá. */
/* Panel khách hàng (docs/customer-detail.md): không có khung trắng bọc ngoài để thẻ không lồng nhau; thanh tab gạch chân nằm trên nền app
   (như tab Thông báo / Công việc), mỗi tab tự có thẻ trắng của mình như Tổng quan. */
.debt-detail-views { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; margin-top: 4px; }
.debt-detail-views > .debt-detail-tabs { padding: 0; border-bottom: 1px solid var(--line); background: transparent; }
.debt-detail-views > .debt-ledger-pane { position: relative; display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; padding-top: 12px; }
.debt-detail-views > .hidden { display: none; }
.debt-ledger-pane > .debt-balance-grid { margin: 0 0 9px; }
/* Thông tin: thẻ liên hệ rồi hai thẻ xếp hạng, cuộn trên nền app; chừa 2px hai bên để bóng thẻ không bị cắt. */
.debt-detail-views > .debt-info-pane { gap: var(--panel-content-gap, 12px); padding: 12px 2px 16px; background: transparent; }
.customer-profile-card { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); padding: 4px 14px; border: 1px solid #c5d6d2; border-radius: 14px; background: var(--surface); box-shadow: 0 4px 14px rgba(38, 66, 60, .05); }
.customer-profile-card.hidden { display: none; }
.customer-profile-line { grid-column: 1 / -1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid #e3ebe9; }
.customer-profile-line:first-child { border-top: 0; }
/* Trường trống gom vào một dòng nhạt cuối thẻ, bấm mở Hồ sơ khách hàng để bổ sung. */
.customer-profile-missing { width: 100%; margin: 0; padding-inline: 0; border-width: 1px 0 0; border-style: solid; border-color: #e3ebe9; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.customer-profile-missing .customer-profile-value { color: #8a9b97; font-size: 12.5px; font-weight: 500; }
.customer-profile-missing .customer-profile-icon { background: #eef3f2; color: #7f928d; }
@media (hover: hover) { .customer-profile-missing:hover .customer-profile-value { color: var(--brand-dark); text-decoration: underline; } }
.customer-profile-line.is-partner .customer-profile-badge { margin-left: 0; }
.customer-profile-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: #e5f2ef; color: var(--brand-dark); }
.customer-profile-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.customer-profile-value { flex: 1 1 auto; min-width: 0; color: #243833; font-size: 13px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.customer-profile-value > small { margin-right: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.customer-profile-line.is-unit-name:not(.is-empty) .customer-profile-value { color: #172925; font-size: 14px; font-weight: 750; }
.customer-profile-line.is-note:not(.is-empty) .customer-profile-value { color: #3e504c; font-weight: 500; white-space: pre-wrap; }
.customer-profile-line .product-info-copy { flex: 0 0 26px; }
/* Đối tác phân phối: viên nhỏ cuối dòng tên đơn vị (xuống dòng gọn khi tên dài trên màn hẹp). */
.customer-profile-line:first-child { flex-wrap: wrap; row-gap: 6px; }
.customer-profile-badge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 10px 3px 6px; border-radius: 999px; background: #0f766e; color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; white-space: nowrap; }
.customer-profile-badge i { width: 18px; height: 18px; display: grid; place-items: center; }
.customer-profile-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.debt-info-pane > .customer-rankings { flex: 0 0 auto; }
/* Lỗi tải hàng đã lấy nằm gọn trong vùng hai bảng, chừa chỗ cố định cho lỗi và Thử lại. */
.debt-info-pane > .customer-rankings.has-error { min-height: 180px; }
.debt-info-pane > .customer-rankings.has-error > :not(.panel-loading-layer) { visibility: hidden; }
/* Vòng tải giữa tab, nền app (không phải khung trắng nhỏ); thẻ trống phía sau ẩn đi để không lộ viền. */
.debt-info-pane > .panel-loading-layer { background: var(--canvas); }
.debt-info-pane.is-loading > :not(.panel-loading-layer) { visibility: hidden; }
.customer-rankings .overview-ranking-copy strong { font-size: 12.5px; }
.product-stock-refresh { z-index: 2; pointer-events: none; }
.product-history-views,.product-history-pane,.product-stock-pane { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; }
.product-history-pane > .product-history-loading { flex: 1 1 auto; }
.product-history-pane,.product-stock-pane { position: relative; }
.product-stock-list { overflow: auto; }
.product-stock-grid { display: grid; grid-template-columns: minmax(72px,1fr) minmax(72px,1fr) repeat(3,max-content); align-content: start; column-gap: 12px; }
.product-stock-grid > :is(.product-history-columns,.product-history-row) { grid-column: 1 / -1; grid-template-columns: subgrid; gap: 12px; }
.product-stock-grid > .product-history-columns { white-space: nowrap; }
.product-stock-grid > .product-history-columns > :nth-child(2) { text-align: left; }
.product-stock-row .product-history-customer { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-stock-row .product-history-quantity,.product-stock-row .product-history-stock-after { min-width: 0; max-width: 100%; white-space: nowrap; justify-self: end; overflow-x: auto; scrollbar-width: none; }
.product-stock-grid > .product-history-empty { grid-column: 1 / -1; }
.compact-modal > .warehouse-products-sheet { background: var(--canvas); }
.operations-sheet > .history-heading { flex: 0 0 auto; }
.operations-body { min-height: 0; overflow: auto; padding: 12px 0 20px; }
.operations-body h3 { font-size: 14px; margin: 0; line-height: 20px; }
.operations-body button:where(:not(.debt-summary-card)) { box-shadow: none; }
.operations-body button:not(.app-dropdown-button,.app-date-button,.app-filter-button,.debt-summary-card) svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.operations-body button:has(svg):not(.app-dropdown-button,.app-date-button,.debt-summary-card) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.operations-body button:empty { width: 36px; }
.fund-manager-form { display: flex; flex: 1; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.supplier-create-form { display: flex; flex: 1; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.supplier-create-viewport { flex: 1; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.supplier-create-columns, .supplier-create-row { display: grid; grid-template-columns: 36px minmax(144px,1.2fr) 120px minmax(160px,1fr) 30px; min-width: 490px; align-items: center; }
.supplier-create-columns { position: sticky; top: 0; z-index: 1; min-height: 40px; border-bottom: 1px solid #d8e3e0; background: #f2f6f5; color: #586a65; font-size: var(--table-heading-size); line-height: 16px; font-weight: 700; }
.supplier-create-columns > :first-child { text-align: center; }
.supplier-create-columns > :not(:first-child) { padding: 0 5px; border-left: 1px solid #d8e3e0; }
.supplier-create-row { min-height: 44px; border-bottom: 1px solid #d8e3e0; }
.supplier-create-row .category-manager-name { font-size: var(--table-body-size); }
.operations-supplier-create .category-manager-save { font-size: var(--table-body-size); }
.fund-manager-viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.fund-manager-columns, .fund-manager-row { display: grid; grid-template-columns: 36px minmax(120px,1fr) 126px minmax(110px,.8fr) 92px 30px; align-items: center; min-width: 514px; }
.fund-manager-columns > span { display: flex; align-items: center; gap: 2px; min-width: 0; }
.fund-manager-company { display: flex; justify-content: center; }
.fund-manager-company input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.fund-manager-columns { position: sticky; top: 0; z-index: 1; min-height: 40px; background: #f2f6f5; color: #586a65; border-bottom: 1px solid #d8e3e0; font-size: var(--table-heading-size); line-height: 16px; font-weight: 700; }
.fund-manager-columns > :first-child { text-align: center; }
.fund-manager-columns > :not(:first-child) { padding: 0 5px; border-left: 1px solid #d8e3e0; }
.fund-manager-row { min-height: 44px; border-bottom: 1px solid #d8e3e0; }
.fund-manager-row .category-manager-name { font-size: var(--table-body-size); }
.fund-manager-row .app-dropdown-button { min-width: 0; height: 32px; padding: 0 4px; border-color: transparent; background: transparent; font-size: var(--table-body-size); }
.fund-manager-row .app-dropdown-button svg { width: 12px; height: 12px; }
.fund-manager-row .app-dropdown-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-fund-manager .category-manager-save { font-size: var(--table-body-size); }
.operations-tabs { grid-template-columns: repeat(var(--tabs,4),minmax(0,1fr)); height: 44px; margin-bottom: 16px; }
.operations-tabs [role="tab"] { font-size: 12px; line-height: 16px; padding: 6px 2px; }
.operations-field { margin: 0 0 8px; min-width: 0; }
.operations-field > :is(input,select,textarea) { width: 100%; min-width: 0; box-sizing: border-box; }
.operations-field > .telegram-settings-field-heading { overflow-wrap: anywhere; }
.operations-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 12px; }
.operations-section { display: flex; align-items: center; gap: 7px; padding: 16px 0 8px; color: #00686d; }
.operations-section svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#operationsModal.compact-modal > .operations-sheet { max-width: 480px; }
#operationsModal.compact-modal .history-heading { min-height: var(--header-min-height); }
#operationsModal.compact-modal #operationsHeaderActions { display: none; }
#operationsModal.compact-modal .operations-body { padding: 16px 0 0; overscroll-behavior: contain; }
#operationsModal.compact-modal .platform-error { position: absolute; z-index: 2; bottom: 16px; left: 16px; right: 16px; max-height: calc(100% - 88px); overflow-y: auto; margin: 0; }
/* Nút Kho trên header: cùng cao nút header, nền trắng để phân biệt với nút chức năng, chỉ ghi tên kho. */
.location-chip, .panel-header-actions > .location-chip { flex: 0 1 auto; display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; width: auto; min-width: 168px; max-width: 260px; height: var(--header-action-size); min-height: var(--header-action-size); margin: 0; padding: 0 9px; border: 1px solid var(--control-border); border-radius: var(--header-action-radius); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.3; box-shadow: none; cursor: pointer; }
.location-chip.hidden, .panel-header-actions > .location-chip.hidden { display: none; }
.location-chip > svg, .panel-header-actions > .location-chip > svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.location-chip > .location-chip-icon { color: var(--brand-dark); }
.location-chip > .location-chip-chevron { margin-left: auto; color: var(--muted); }
.location-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-chip[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-light); }
.location-chip[aria-expanded="true"] > .location-chip-chevron { transform: rotate(180deg); }
.location-chip:disabled { border-color: #d7dfdd; background: #eef2f1; color: #7d8b87; opacity: 1; cursor: default; }
.location-chip:disabled > svg { color: inherit; }
@media (hover: hover) and (pointer: fine) { .location-chip:not(:disabled):hover { border-color: var(--brand); } }
.history-heading > .panel-header-actions > .header-more { width: auto; }
.history-heading:has(> .panel-header-actions > .location-chip:not(.hidden)) > .panel-header-actions { flex: 0 1 auto; min-width: 0; }
.history-heading:has(> .panel-header-actions > .location-chip:not(.hidden)) > .panel-header-actions > :not(.location-chip) { flex-shrink: 0; }
.history-heading:has(> .panel-header-actions > .location-chip:not(.hidden)) > :is(h2, .panel-header-title, div:not(.panel-header-actions)) { flex: 1 0 auto; }
/* Chọn hàng: nút Kho nằm trong thẻ đơn (điện thoại, trước mũi tên) hoặc cạnh X (desktop, desktop.css). */
.current-order-dock > .location-chip { position: absolute; z-index: 1; top: calc(50% - var(--header-action-size) / 2); right: 36px; max-width: 108px; padding: 0 7px; gap: 4px; }
.current-order-dock > .location-chip > .location-chip-icon { display: none; }
.current-order-dock:has(> .location-chip:not(.hidden)) .current-order-copy { margin-right: 110px; }
@media (max-width: 479px) {
  .panel-header-actions:has(> .location-chip:not(.hidden)) .panel-header-command:not(.quick-offer-open) { flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); padding: 0; gap: 0; font-size: 0; }
  .panel-header-actions:has(> .location-chip:not(.hidden)) .panel-header-command:not(.quick-offer-open) > span { display: none; }
  .panel-header-actions:has(> .location-chip:not(.hidden)) .panel-header-command > svg:not(:first-child) { display: none; }
  #catalogLocation > .location-chip-icon { display: none; }
}
@media (max-width: 639px) { .location-chip, .panel-header-actions > .location-chip { min-width: 0; } }
@media (max-width: 359px) { .panel-header-actions > .location-chip > .location-chip-icon { display: none; } }
.location-choice-group + .location-choice-group { margin-top: 6px; }
.location-choice-heading { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; color: var(--ink); font-size: 13px; font-weight: 650; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-choice-heading svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--brand-dark); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.location-choice-warehouses { display: grid; gap: 4px; margin: 4px 0 4px 15px; padding-left: 12px; border-left: 1px solid var(--line); }
.working-location-picker .operations-location-row { display: grid; grid-template-columns: 18px minmax(0,1fr) 18px; align-items: center; gap: 8px; font-weight: 650; }
.operations-location-row > svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.location-choice-name { min-width: 0; overflow: hidden; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.location-choice-all { margin-bottom: 6px; }
.operations-document-row { width: 100%; display: block; text-align: left; padding: 12px 4px; border: 0; border-bottom: 1px solid #cddbd8; background: var(--surface); color: var(--ink); }
.operations-document-row:hover { background: var(--surface-selected); }
.operations-row-heading { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.operations-muted { color: var(--muted); font-size: 11.5px; line-height: 18px; overflow-wrap: anywhere; }
.operations-status { font-size: 10px; font-weight: 750; line-height: 20px; padding: 1px 8px; color: var(--brand-dark); background: var(--brand-light); border-radius: 12px; width: fit-content; }
.status-dispatched { color: #875800; background: #ffedc7; }
.status-cancelled { color: #666; background: #dbe0df; }
.operations-transfer-line { display: grid; grid-template-columns: minmax(0,1fr) 190px 36px; gap: 8px; align-items: start; }
.operations-transfer-line .operations-field { --form-label-width: 72px; }
.operations-body form { margin-top: 12px; }
.operations-body .operations-submit { width: 100%; height: 40px; margin-top: 20px; margin-bottom: 12px; }
.operations-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.operations-actions button { padding: 6px 12px; }
.operations-actions > .operations-delivery-form { width: 100%; flex-basis: 100%; min-width: 0; }
.operations-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 16px; color: #61747a; font-size: 12px; }
.operations-next svg { transform: rotate(180deg); }
.operations-empty { text-align: center; padding: 32px 8px; color: #61747a; }
.operations-route { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.operations-table { width: 100%; border-collapse: collapse; font-size: 12.5px; color: #172925; margin: 12px 0; }
.operations-table :is(td,th) { border-bottom: 1px solid #d5e0dd; padding: 10px 7px; text-align: right; font-variant-numeric: tabular-nums; }
.operations-table :is(td,th):first-child { text-align: left; overflow-wrap: anywhere; }
.operations-table th { height: 40px; font-size: 11.5px; color: #41534f; font-weight: 700; background: #f4f8f7; }
.operations-table td:first-child { font-size: 13px; font-weight: 650; }
.operations-table td:not(:first-child) { font-weight: 700; }
.operations-table td:nth-child(2) { color: var(--ink); font-size: 13.5px; }
.operations-table td:not(:first-child) { white-space: nowrap; }
.operations-report { max-width: 100%; min-width: 0; overflow-x: auto; }
.operations-report .operations-table { min-width: 0; }
.operations-report .operations-purchase-table { min-width: 0; }
.operations-purchase-table :is(th,td):first-child { width: 40%; }
.operations-purchase-table :is(th,td):nth-child(n+2) { width: 20%; }
.operations-report { margin: 12px 0; border: 1px solid #bfd0cc; border-radius: 13px; background: var(--surface); }
.operations-report .operations-table { margin: 0; }
.operations-event { padding: 8px 0; margin: 0; border-bottom: 1px solid #c6d3d0; font-size: 12px; color: #61747a; }
.operations-fund-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px; padding: 14px 0; border-bottom: 1px solid #bdcdca; }
.operations-fund-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.operations-fund-row .operations-actions { grid-column: 1 / -1; margin: 4px 0 0; }
.operations-balance { font-size: 15px; font-weight: 750; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.operations-balance.is-negative, .operations-ledger-amount.is-negative { color: var(--danger); }
.operations-supplier-balances { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid #bdcdca; border-bottom: 1px solid #bdcdca; margin: 12px 0; }
.operations-supplier-balances > div { padding: 14px 8px; min-width: 0; }
.operations-supplier-balances span { display: block; color: #52635e; font-size: 10.5px; font-weight: 650; line-height: 18px; overflow-wrap: anywhere; }
.operations-supplier-balances strong { display: block; color: var(--danger); font-size: 15px; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.operations-supplier-balances strong.is-credit { color: var(--brand-dark); }
:is(.operations-editor-modal,.operations-supplier-modal) .operations-supplier-detail { display: flex; flex: 1; flex-direction: column; overflow: hidden; }
#supplierDetailModal .operations-supplier-detail { padding-top: 0; padding-bottom: 0; }
.operations-supplier-sheet > .platform-error { position: absolute; z-index: 2; bottom: calc(64px + var(--safe-bottom)); left: 16px; right: 16px; max-height: calc(100% - 88px); overflow-y: auto; margin: 0; }
.supplier-heading-copy { display: flex; flex: 1; align-items: baseline; gap: 8px; min-width: 0; }
.supplier-heading-copy > .panel-header-title { flex: 0 1 auto; }
.supplier-heading-copy p { min-width: 0; overflow: hidden; margin: 0; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.supplier-debt-balances { grid-template-columns: minmax(0,1fr); }
.supplier-debt-balances.has-company-balance { grid-template-columns: repeat(2,minmax(0,1fr)); }
.operations-supplier-detail .operations-supplier-documents.supplier-statement-list { margin-top: var(--panel-content-gap); }
.operations-supplier-detail .supplier-detail-actions button { display: flex; }
.supplier-statement-list .debt-transaction-info { display: block; text-overflow: ellipsis; white-space: nowrap; }
.supplier-statement-list .debt-transaction { align-items: baseline; align-content: center; }
.supplier-statement-list .debt-transaction > :last-child { position: relative; height: 0; align-self: center; }
.supplier-statement-list .debt-transaction-delete { position: absolute; top: 50%; right: 0; transform: translateY(-50%); }
.operations-supplier-detail .supplier-statement-list button.debt-transaction-delete svg { width: 13px; height: 13px; flex: 0 0 13px; stroke-width: 1.9; }
.operations-body .supplier-detail-actions button svg { width: 15px; height: 15px; flex: 0 0 15px; stroke-width: 1.8; }
.operations-supplier-detail .supplier-statement-list { display: grid; grid-template-columns: 68px minmax(54px,.72fr) minmax(76px,1.1fr) minmax(72px,max-content) 37px; column-gap: 4px; align-content: start; }
.supplier-statement-list > :is(.debt-transaction-columns,.debt-transaction) { grid-column: 1 / -1; grid-template-columns: subgrid; }
.supplier-statement-list > .operations-muted { grid-column: 1 / -1; }
.supplier-statement-pagination { min-height: 40px; padding-top: 4px; }
.supplier-statement-pagination.is-single-page { visibility: hidden; pointer-events: none; }
.operations-supplier-detail > :not(.operations-supplier-documents) { flex: 0 0 auto; }
.operations-supplier-detail .operations-supplier-balances { margin: 0 0 12px; }
.operations-supplier-detail .operations-supplier-balances > div { padding: 8px; }
.operations-supplier-detail .operations-section { margin: 0 0 8px; }
.operations-supplier-detail .operations-supplier-documents { margin-top: 0; }
.operations-ledger-supplier-imports > :is(.operations-ledger-columns,.supplier-import-row) { grid-template-columns: 58px minmax(0,1fr) minmax(90px,auto); gap: 4px; }
.operations-ledger-supplier-imports .operations-ledger-columns { min-height: 32px; font-size: 10.5px; }
.operations-supplier-detail .operations-ledger-list .supplier-import-row { min-height: 42px; height: 42px; padding: 7px 10px; background: var(--surface); }
.supplier-import-row time { color: #3e504c; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.supplier-import-row .supplier-import-copy { min-width: 0; overflow: hidden; color: #172925; font-size: 12.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.supplier-import-row .operations-ledger-amount { font-size: 12px; font-weight: 700; color: var(--danger); }
.supplier-import-row.is-cancelled { opacity: .65; }
.supplier-import-proof { display: flex; flex-direction: column; flex: 1 0 240px !important; min-height: 240px; margin: 14px 0 0; }
.supplier-import-proof img { flex: 1; min-height: 160px; height: 0; margin-bottom: 0; }
.operations-document-row { overflow-wrap: anywhere; }
.operations-purchase-line { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 36px; gap: 0 8px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid #bdcdca; }
.operations-purchase-line .operations-field:first-child { grid-column: 1 / -1; }
.operations-purchase-line .operations-field { --form-label-width: 85px; }
.operations-purchase-line > button { width: 36px; height: 40px; padding: 0; align-self: start; }
.operations-purchase-total { display: block; text-align: right; padding: 10px 0; font-size: 16px; font-weight: 600; color: var(--brand-dark); }
/* Operations use a stable list workspace and compact dialogs for individual tasks. */
#debtModal #debtError { position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 2; max-height: 140px; overflow: auto; background: #fff7f5; border: 1px solid #e7b8b3; border-radius: 10px; }
#debtCustomerCreateError { position: absolute; left: 16px; right: 16px; bottom: 68px; z-index: 2; max-height: 80px; overflow: auto; margin: 0; padding: 10px 12px; border: 1px solid #e7b8b3; border-radius: 10px; background: #fff7f5; }
#operationsModal.page-modal .operations-body { padding-top: 16px; }
#operationsModal.page-modal .platform-error { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 4; max-height: 100px; overflow: auto; }
.operations-body .operations-search-field { min-width: 0; margin: 0 0 8px; }
.operations-list-filters .operations-search-field { margin-bottom: 0; }
.operations-list-filters { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin-bottom: 12px; }
.operations-filter { display: flex; align-items: center; width: auto; margin-bottom: 12px; }
.operations-list-filters .operations-filter { margin-bottom: 0; }
.operations-body .operations-document-row { display: grid; gap: 10px; border: 1px solid #bdcdca; border-radius: 12px; padding: 14px; margin: 0 0 10px; background: #fff; text-align: left; }
.operations-row-heading { gap: 12px; }
.operations-row-heading > * { min-width: 0; }
.operations-row-heading > strong:last-child { font-variant-numeric: tabular-nums; }
.operations-route-arrow { color: #61747a; text-align: center; }
.operations-status { white-space: normal; text-align: center; }
.operations-funds { display: grid; gap: 12px; }
.operations-fund-row { border: 1px solid #bdcdca; border-radius: 12px; background: #fff; padding: 16px; gap: 14px; }
.operations-fund-row .operations-actions { gap: 6px; }
.operations-fund-row .operations-actions button { min-height: 32px; padding: 4px 10px; border-radius: 8px; }
.operations-fund-row .operations-balance { font-size: 15px; overflow-wrap: anywhere; }
.operations-period-link { display: block; border: 0; background: transparent; color: #61747a; margin: 12px 0 0 auto; padding: 4px 0; font-size: 12px; }
.operations-empty { display: grid; place-items: center; min-height: 160px; margin: 0; padding: 24px 16px; border: 1px dashed #bdcdca; border-radius: 12px; }
.operations-editor-modal > .operations-editor-sheet { max-width: 620px; background: #e6eeeb; }
.operations-editor-modal .operations-body { padding: 16px 0 0; }
.operations-editor-modal .operations-body > form:first-child { margin-top: 0; }
.operations-editor-modal .history-heading { flex: 0 0 auto; }
.operations-editor-modal .platform-error { position: absolute; left: 16px; right: 16px; bottom: 68px; z-index: 4; max-height: 100px; overflow: auto; pointer-events: none; box-shadow: 0 4px 16px #10282d20; }
.operations-editor-modal .operations-empty { min-height: 120px; }
.operations-editor-modal .operations-body > .operations-document-row { margin-bottom: 10px; }
.operations-editor-modal .operations-body .operations-submit { margin-bottom: 0; }
.operations-editor-modal .operations-supplier-editor { display: grid; flex: 1; align-content: start; gap: var(--section-gap); padding: var(--panel-content-gap) 1px 3px; }
.operations-editor-modal .operations-editor-sheet:has(> .operations-supplier-editor) { max-width: var(--form-dialog-max-width); background: #edf3f1; }
.operations-editor-sheet:has(> .operations-supplier-editor) > .history-heading { border-bottom-color: #d3dfdc; }
.operations-supplier-editor .debt-admin-card { margin: 0; }
.operations-supplier-editor .debt-admin-card h3 { line-height: 1.25; }
.operations-supplier-editor .operations-field { margin: 0; }
.operations-supplier-editor .operations-field textarea { resize: none; }
.operations-editor-modal:has(.operations-receipt-workspace) > .operations-editor-sheet { height: min(700px, calc(var(--tg-viewport-height, 100dvh) - 64px - var(--safe-top) - var(--safe-bottom))); }
.operations-editor-modal:has(.operations-money-form) > .operations-editor-sheet { height: min(600px, calc(var(--tg-viewport-height, 100dvh) - 64px - var(--safe-top) - var(--safe-bottom))); }
.operations-editor-modal .operations-receipt-workspace { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.operations-receipt-form { display: flex; flex: 1; min-width: 0; min-height: 0; flex-direction: column; margin: 0; }
.operations-receipt-content { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.operations-receipt-content > :not(.operations-receipt-lines) { flex: 0 0 auto; }
.operations-receipt-content > .operations-receipt-lines { overflow: visible; }
.operations-receipt-form > .operations-grid, .operations-receipt-form > .operations-field, .operations-receipt-add, .operations-product-results, .operations-receipt-footer { flex-shrink: 0; }
.operations-receipt-add { margin: 0 0 12px; }
.operations-receipt-add > .operations-field { width: 100%; margin: 0; }
.operations-receipt-note > .operations-field { width: 100%; }
.operations-product-form { container: settings-form / inline-size; }
.operations-product-form .operations-receipt-content { gap: 18px; padding-bottom: 12px; }
.operations-product-form .operations-grid { margin: 0; gap: 18px 12px; }
.operations-product-form .product-form-group { align-content: start; }
.operations-product-form .product-form-section-title { font-size: 11px; line-height: 16px; }
.operations-product-form .product-form-field textarea { resize: none; }
.operations-product-form .app-dropdown-control { width: 100%; min-width: 0; }
.operations-product-form .app-dropdown-button { min-height: var(--form-row-height); width: 100%; }
.operations-product-form .operations-submit { width: 100%; }
.operations-category-list { display: grid; gap: 8px; margin-top: 16px; }
.operations-money-preview { display: flex; align-items: center; min-height: 36px; margin-bottom: 8px; }
.operations-stock-name { display: block; margin: 0 0 12px; overflow-wrap: anywhere; }
.operations-supplier-history > summary { cursor: pointer; color: var(--brand-dark); padding: 16px 0; font-weight: 700; }
.operations-supplier-history { margin-top: 12px; }
.operations-supplier-history .operations-row-heading > strong { font-size: 12.5px; font-weight: 700; color: #172925; }
.operations-supplier-history [data-debt-direction="decrease"], .operations-body .operations-document-row:has(.operations-payment-amount.is-payment) { background: #d9f3ea; }
.operations-supplier-history .operations-row-heading > strong:last-child, .operations-payment-amount { font-size: 12px; color: var(--danger); }
.operations-supplier-history [data-debt-direction="decrease"] .operations-row-heading > strong:last-child, .operations-payment-amount.is-payment { color: var(--brand-dark); }
@container settings-form (min-width:560px) {
 .operations-product-form .product-form-field { --form-label-width: 128px; --form-row-height: 40px; }
 .operations-product-form .product-form-field:has(> label) { --form-label-width: calc(100% - 64px); }
}
.operations-receipt-footer > .operations-receipt-payment { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-bottom: 8px; }
.operations-receipt-payment .app-dropdown-control { width: 100%; min-width: 0; }
.operations-receipt-payment .app-dropdown-button { width: 100%; min-height: 36px; border: 1px solid #bdcdca; border-radius: 8px; background: #fff; }
.operations-receipt-payment input:disabled, .operations-receipt-payment .app-dropdown-button:disabled { opacity: .5; }
.operations-receipt-balance { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 8px; height: 50px; min-height: 50px; margin-bottom: 6px; }
.operations-receipt-balance .operations-muted { font-size: 11px; text-align: right; }
.operations-receipt-lines > .operations-empty { border: 0; background: transparent; margin: 0; }
.operations-receipt-lines { flex: 1; min-height: 100px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.operations-receipt-line { background: #fff; border: 1px solid #bdcdca; border-radius: 12px; padding: 8px; margin-bottom: 8px; }
.operations-receipt-line .operations-row-heading { gap: 8px; margin-bottom: 6px; align-items: center; }
.operations-receipt-line .operations-row-heading > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.operations-receipt-line .operations-row-heading > button { flex-shrink: 0; width: 28px; height: 28px; padding: 0; }
.operations-receipt-line .operations-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.operations-line-input { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.operations-line-input > span { font-size: 11px; color: #61747a; }
.operations-line-input > input { width: 100%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid #bdcdca; border-radius: 8px; background: #f7faf9; color: #172522; font-weight: 600; }
.operations-line-input > input:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: 2px solid #34827b; outline-offset: -1px; }
.operations-line-total { white-space: nowrap; font-size: 12px; }
.operations-receipt-footer { padding-top: 8px; border-top: 1px solid #bdcdca; }
.operations-receipt-footer .operations-purchase-total { padding: 4px 0; }
.operations-receipt-footer > p { font-size: 11px; margin: 4px 0 10px; }
.operations-receipt-actions { display: flex; gap: 8px; }
.operations-receipt-actions > button { flex: 1; min-height: 42px; margin: 0; width: auto; display: flex; align-items: center; justify-content: center; }
@media (max-height: 650px) {
 .operations-receipt-footer > .operations-receipt-payment { margin-bottom: 4px; }
 .operations-receipt-balance { margin-bottom: 4px; }
}
@media(max-width:560px) {
 .operations-fund-row { padding: 14px; }
 .operations-fund-row .operations-balance { font-size: 15px; }
 .operations-fund-row .operations-actions { gap: 6px; }
 .operations-fund-row .operations-actions button { padding-inline: 8px; }
 .operations-editor-modal .operations-purchase-line { grid-template-columns: minmax(0,1fr) 36px; }
 .operations-editor-modal .operations-purchase-line .operations-field:nth-child(2), .operations-editor-modal .operations-purchase-line .operations-field:nth-child(3) { grid-column: 1; }
 .operations-editor-modal .operations-purchase-line > button { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
}
@media(max-width:560px) {
 .operations-grid { grid-template-columns: minmax(0,1fr); }
 .operations-transfer-line { grid-template-columns: minmax(0,1fr) 36px; padding-bottom: 8px; border-bottom: 1px solid #bdcdca; margin-bottom: 12px; }
 .operations-transfer-line .operations-field:first-child { grid-column: 1 / -1; }
 .operations-transfer-line .operations-field { --form-label-width: 90px; }
 .operations-purchase-line .operations-field { --form-label-width: 64px; }
 .operations-purchase-line .operations-field:first-child { --form-label-width: 90px; }
}
/* Shared overview: fixed statistics and filters above one continuous, scrolling list. */
#operationsModal.page-modal .operations-overview { display: flex; flex-direction: column; overflow: hidden; padding-top: 0; padding-bottom: 0; }
.operations-overview > :not(.operations-ledger-list) { flex: 0 0 auto; }
.operations-ledger-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #bfd0cc; border-radius: 14px; background: #fff; }
.operations-ledger-list.operations-funds { display: block; }
.operations-ledger-columns { position: sticky; top: 0; z-index: 1; min-height: 40px; display: grid; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid #d5e0dd; background: #f4f8f7; color: #41534f; font-size: 11.5px; font-weight: 700; }
.operations-ledger-list .operations-document-row { min-height: 55px; display: grid; align-items: center; gap: 8px; margin: 0; padding: 9px 10px; border: 0; border-bottom: 1px solid #cddbd8; border-radius: 0; font-size: 13px; line-height: 18px; }
.operations-ledger-list .operations-document-row:hover { background: var(--surface-selected); }
/* Chuyển kho dùng đúng bốn cột của lịch sử hàng hoá; cột tuyến kho được co hết cỡ để giá trị dài luôn đủ số mà bảng không tràn ngang. */
.operations-ledger-list.operations-ledger-transfers { display: grid; grid-template-columns: 92px minmax(0,1fr) max-content max-content; align-content: start; column-gap: 14px; border-color: #c5d5d1; border-radius: 13px; }
.operations-ledger-transfers > :is(.operations-ledger-columns,.operations-transfer-row) { grid-column: 1 / -1; grid-template-columns: subgrid; gap: 14px; }
@media (max-width: 599px) { .operations-ledger-list.operations-ledger-transfers, .operations-ledger-transfers > :is(.operations-ledger-columns,.operations-transfer-row) { column-gap: 8px; } .operations-ledger-list.operations-ledger-transfers { grid-template-columns: 86px minmax(0,1fr) max-content max-content; } }
@media (max-width: 359px) { .operations-ledger-list.operations-ledger-transfers { grid-template-columns: 78px minmax(48px,1fr) max-content max-content; } .operations-ledger-list.operations-ledger-transfers, .operations-ledger-transfers > :is(.operations-ledger-columns,.operations-transfer-row) { column-gap: 6px; } .operations-ledger-transfers .product-history-waiting { font-size: 11px; letter-spacing: -.01em; } }
.operations-ledger-transfers > .operations-ledger-columns { padding: 9px 10px; font-size: 11.5px; line-height: 1.2; }
.operations-transfer-row .operations-transfer-quantity { min-width: 0; justify-self: stretch; }
.operations-transfer-row.is-waiting-sale .operations-transfer-quantity { color: var(--ink); }
.operations-transfer-row .operations-transfer-value { justify-self: stretch; white-space: nowrap; overflow-wrap: normal; }
.operations-ledger-transfers > .operations-transfer-empty { grid-column: 1 / -1; }
/* Lịch sử mặt hàng ở màn hình rất hẹp (320px): cột tối thiểu của .product-history-list (92/60/70/74px) cộng khoảng cách vượt bề rộng, nên bảng cuộn ngang. */
@media (max-width: 340px) { .product-history-list:not(.product-stock-list, .warehouse-products-list, .operations-ledger-transfers, .document-table) { grid-template-columns: 92px minmax(44px, 1fr) minmax(54px, max-content) minmax(62px, max-content); } }
.operations-ledger-purchases > :is(.operations-ledger-columns,.operations-document-row) { min-width: 0; grid-template-columns: minmax(0,1fr) 110px 72px; }
.operations-ledger-suppliers > :is(.operations-ledger-columns,.operations-document-row) { grid-template-columns: minmax(0,1fr) auto; }
.operations-ledger-suppliers > .operations-ledger-columns { padding-left: 11px; padding-right: 28px; color: #536560; font-size: 9.5px; font-weight: 750; }
.operations-ledger-suppliers .operations-document-row.operations-supplier-row { position: relative; display: grid; height: 43px; min-height: 43px; padding: 7px 28px 7px 11px; gap: 7px; }
.operations-ledger-suppliers .operations-supplier-row > svg { position: absolute; right: 8px; width: 14px; height: 14px; flex-basis: 14px; stroke: #78908b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.operations-ledger-suppliers .operations-ledger-columns > :last-child { text-align: right; }
.operations-ledger-copy { display: grid; min-width: 0; gap: 2px; }
.operations-ledger-copy strong, .operations-ledger-route { min-width: 0; color: #263632; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.operations-ledger-copy .operations-muted { color: #7b8986; font-size: 9.5px; font-weight: 500; line-height: 15px; }
.operations-ledger-amount { min-width: 0; color: var(--brand-dark); font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.operations-ledger-amount.is-debt { color: var(--danger); }
.operations-ledger-amount.is-credit { color: var(--brand-dark); }
.operations-ledger-suppliers .debt-customer-amount { color: var(--danger); font-size: 12px; font-weight: 650; }
.operations-ledger-suppliers .debt-customer-amount.is-credit { color: var(--brand-dark); }
.operations-ledger-purchases .operations-ledger-columns > :last-child { text-align: right; }
.operations-ledger-list .operations-status { max-width: 100%; font-size: 10px; line-height: 15px; padding: 3px 6px; }
.operations-ledger-funds .operations-ledger-columns { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.operations-ledger-funds .operations-ledger-columns > :last-child { text-align: right; }
.operations-ledger-funds .operations-fund-row { margin: 0; padding: 10px; gap: 6px; border: 0; border-bottom: 1px solid #cddbd8; border-radius: 0; font-size: 13px; }
.operations-ledger-funds .operations-balance { font-size: 12px; text-align: right; white-space: nowrap; overflow-wrap: normal; }
.operations-overview .operations-empty { min-height: 0; padding: 24px 8px; border: 0; border-radius: 0; }
.operations-ledger-list.has-overflowing-rows > :last-child:is(.operations-document-row,.operations-fund-row) { border-bottom-color: transparent; }
.category-manager-content.has-overflowing-rows .category-manager-row:last-child,
.fund-manager-viewport.has-overflowing-rows .fund-manager-row:last-child,
.supplier-create-viewport.has-overflowing-rows .supplier-create-row:last-child { border-bottom-color: transparent; }
/* Cashbook: balances and actual money movements, with setup in a compact child. */
#operationsModal.page-modal :is(.operations-cashbook-overview,.operations-supplier-overview) { flex: 1 1 auto; }
.operations-editor-modal .operations-overview { flex: 1 1 auto; display: flex; flex-direction: column; overflow: hidden; }
.operations-ledger-cashbook > :is(.operations-ledger-columns,.operations-document-row), .operations-ledger-funds .cashbook-source-row { grid-template-columns: minmax(0,1fr) auto; }
.cashbook-history .cashbook-empty { grid-column: 1 / -1; }
.cashbook-entry-balance.is-negative { color: var(--danger); }
.cashbook-entry-amount.is-in, .cashbook-in { color: var(--brand-dark); }
.cashbook-entry-amount.is-out, .cashbook-out { color: var(--danger); }
.cashbook-entry-amount.is-transfer { color: var(--muted); }
.cashbook-empty { display: grid; gap: 6px; text-align: center; }
.cashbook-empty strong { color: var(--brand-dark); }
.cashbook-empty .dashed-add-button { margin: 10px auto 0; }
/* Thẻ tổng dùng chung .debt-summary-card với Khách hàng và Nhà cung cấp; màu theo nghĩa: Số dư vàng, Thu xanh, Chi đỏ. */
.operations-cashbook-overview .operations-statistics [data-cash-metric="balance"] strong { color: var(--profit-ink); }
.operations-cashbook-overview .operations-statistics [data-cash-metric="in"] strong { color: var(--brand-dark); }
.operations-cashbook-overview .operations-statistics :is([data-cash-metric="out"] strong, strong.is-negative) { color: var(--danger); }
/* Thẻ Thu, Chi là nút lọc danh sách; hàng lọc dùng đúng lưới và ô chọn của Khách hàng (.debt-search-row). */
button.debt-summary-card { width: 100%; justify-items: start; align-items: normal; text-align: left; cursor: pointer; transition: border-color .16s ease; }
@media (hover: hover) and (pointer: fine) { button.debt-summary-card.is-customers:hover { border-color: var(--brand); } button.debt-summary-card.is-total:hover { border-color: var(--danger); } }
button.debt-summary-card.is-customers[aria-pressed="true"] { border-color: var(--brand); }
button.debt-summary-card.is-total[aria-pressed="true"] { border-color: var(--danger); }
button.debt-summary-card.is-customers[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--brand); }
button.debt-summary-card.is-total[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--danger); }
.cashbook-filters > .app-dropdown-control .app-dropdown-button { height: var(--filter-control-size); min-height: var(--filter-control-size); grid-template-columns: minmax(0,1fr) 16px; gap: 6px; padding: 0 10px; border: 1px solid #c8d9d5; border-radius: 11px; background: var(--surface); font-size: 13px; }
.cashbook-filters > .app-dropdown-control .app-dropdown-button > svg { width: 16px; height: 16px; }
.cashbook-source-chip > .location-chip-icon { flex: 0 0 16px; width: 16px; height: 16px; }
.cashbook-source-chip > .location-chip-icon > svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Danh sách: đúng kiểu lịch sử hàng hoá (khung, tiêu đề cột, dòng 40px nền trắng); mọi ô cùng chiều cao dòng chữ nên thẳng hàng, màu chỉ ở số tiền. */
.cashbook-history .operations-ledger-cashbook { display: grid; grid-template-columns: max-content minmax(0,1fr) minmax(0,.55fr) max-content; align-content: start; column-gap: 12px; border-color: #c5d5d1; border-radius: 13px; }
.cashbook-history .operations-ledger-cashbook.has-balance { grid-template-columns: max-content minmax(0,1fr) minmax(max-content,.4fr) minmax(max-content,.4fr); }
.cashbook-history .operations-ledger-cashbook > :is(.operations-ledger-columns,.cashbook-entry) { grid-column: 1 / -1; grid-template-columns: subgrid; gap: 12px; }
.cashbook-history .operations-ledger-columns { height: 40px; min-height: 40px; padding: 0 10px; line-height: 20px; }
.cashbook-history .operations-ledger-columns > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cashbook-history .cashbook-entry { height: 40px; min-height: 40px; padding: 0 10px; border-bottom-color: #d5e0dd; background: var(--surface); line-height: 20px; }
.cashbook-history button.cashbook-entry:is(:hover,:focus-visible) { background: #f2f8f6; }
.operations-editor-modal .cashbook-history { display: flex; flex: 1 1 auto; min-height: 0; }
.cashbook-entry > * { min-width: 0; overflow: hidden; line-height: 20px; text-overflow: ellipsis; white-space: nowrap; }
.cashbook-entry-date { color: #2f423e; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cashbook-entry-title { color: #172925; font-size: 13px; font-weight: 650; }
.cashbook-entry-info { color: #3e504c; font-size: 12px; }
.cashbook-entry.is-reversed .cashbook-entry-title { color: var(--muted); }
.cashbook-entry-amount { font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.cashbook-entry-balance { color: #172925; font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.operations-ledger-cashbook .operations-ledger-columns > :nth-child(n+4), .operations-ledger-cashbook.has-balance .operations-ledger-columns > :nth-child(3) { text-align: right; }
/* Điện thoại có nhiều chi nhánh: nút Chi nhánh thu về biểu tượng để nút Nguồn tiền đủ chữ. */
@media (max-width: 639px) {
 .panel-header-actions > #bookBranch:has(~ .cashbook-source-chip) { flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); min-width: 0; justify-content: center; padding: 0; }
 .panel-header-actions > #bookBranch:has(~ .cashbook-source-chip) > :is(.location-chip-name,.location-chip-chevron) { display: none; }
}
@media (max-width: 359px) {
 .cashbook-history .operations-ledger-cashbook, .cashbook-history .operations-ledger-cashbook > :is(.operations-ledger-columns,.cashbook-entry) { column-gap: 7px; }
}
#operationsModal.page-modal .cashbook-history { position: relative; display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.cashbook-history .operations-ledger-list.has-pages { padding-bottom: 38px; }
.operations-overview > :is(.operations-purchase-history,.operations-supplier-workspace) { position: relative; display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; }
:is(.operations-purchase-history,.operations-supplier-workspace) .operations-ledger-list.has-pages { padding-bottom: 38px; }
.operations-purchase-pagination, .operations-supplier-pagination { position: absolute; inset: auto 0 0; height: 38px; padding: 4px 10px; justify-content: space-between; border: 1px solid #bfd0cc; border-radius: 0 0 14px 14px; background: #f4f8f7; z-index: 2; }
:is(.operations-purchase-pagination,.operations-supplier-pagination) button { width: 30px; min-height: 28px; padding: 4px; }
:is(.operations-purchase-pagination,.operations-supplier-pagination) span { font-size: 11px; }
.cashbook-pagination { position: absolute; inset: auto 0 0; height: 38px; padding: 4px 10px; justify-content: space-between; border: 1px solid #bfd0cc; border-radius: 0 0 14px 14px; background: #f4f8f7; z-index: 2; }
.cashbook-pagination button { width: 30px; height: 30px; min-height: 30px; padding: 6px; }
.cashbook-pagination span { font-size: 11px; }
.cashbook-customer-balance { padding: 8px 0 16px; color: var(--danger); font-size: 15px; font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; }
.cashbook-customer-balance.is-credit { color: var(--brand-dark); }
.cashbook-customer-entry .operations-ledger-amount { font-size: 12px; color: var(--danger); }
.cashbook-customer-entry.is-payment .operations-ledger-amount { color: var(--brand-dark); }
.cashbook-form .operations-receipt-content { display: block; }
.cashbook-form .operations-grid { grid-template-columns: minmax(0,1fr); }
.cashbook-form .operations-receipt-footer { margin-top: auto; flex: 0 0 auto; }
.cashbook-form-footer:has(> .secondary-button) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.cashbook-form-footer > .secondary-button { min-height: 42px; }
.cashbook-form .operations-receipt-footer .operations-submit { margin: 0; min-height: 42px; }
.cashbook-form:has(.cashbook-proof-group) .operations-receipt-content { display: flex; }
.operations-receipt-content > .cashbook-proof-group { display: flex; flex-direction: column; flex: 1 0 146px; margin: 14px 0 12px; }
.cashbook-proof-group .product-form-section-title { margin: 0; font-size: 12px; line-height: 1.4; }
.cashbook-proof-group .product-form-section-title, .operations-field > .telegram-settings-field-heading:has(.information-help-button) { display: flex; align-items: center; gap: 2px; }
.operations-field .information-help-button { height: 28px; min-height: 0; margin: -4px 0; }
.cashbook-proof-field { position: relative; flex: 1; min-height: 110px; margin-top: 8px; }
.operations-body .cashbook-proof-group .cashbook-proof-choose { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden; border: 1.75px dashed #579b91; border-radius: 14px; background: #edf7f5; color: var(--brand-dark); }
.cashbook-proof-choose:focus-within { outline: var(--focus-width) solid var(--focus-color); outline-offset: -1px; }
.cashbook-proof-choose > svg, .cashbook-proof-choose > strong { position: relative; z-index: 2; pointer-events: none; }
.operations-body .cashbook-proof-group .cashbook-proof-choose > svg { width: 30px; height: 30px; flex: 0 0 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cashbook-proof-field > .debt-proof-preview { position: absolute; inset: 0; }
.cashbook-proof-field .debt-proof-preview img { cursor: default; }
.cashbook-proof-field.is-dragover .cashbook-proof-choose { border-style: solid; background: var(--brand-light); }
.cashbook-saved-proof img { display: block; width: 100%; height: 240px; object-fit: contain; margin: 12px 0; border-radius: 10px; background: #edf7f5; }
.cashbook-source-balance { display: block; font-size: 15px; font-weight: 750; line-height: 1.15; color: var(--brand-dark); font-variant-numeric: tabular-nums; margin: 16px 0; }
.cashbook-source-balance.is-negative { color: var(--danger); }
/* Popup chi tiết giao dịch: cùng khung và nội dung với thẻ thông báo (#notificationDetailModal). */
/* Lớp phủ tối của desktop nằm ở 69; z-index gán khi mở panel thấp hơn nên phải ép. */
#operationsEditorModal[data-detail-popup] { z-index: max(105, var(--modal-layer, 105)) !important; }
#operationsEditorModal[data-detail-popup] > .backdrop { background: transparent; }
#operationsEditorModal[data-detail-popup] > .sheet-card { display: flex; flex-direction: column; height: auto !important; min-height: 0; max-height: calc(var(--tg-viewport-height, 100dvh) - 32px); overflow: hidden; }
#operationsEditorModal[data-detail-popup] .cashbook-detail-popup { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.cashbook-detail-popup .cashbook-detail-lines, #operationsEditorModal .cashbook-detail-popup .notification-detail-actions > button { margin: 0; }
.cashbook-detail-popup .notification-detail-icon svg { width: 26px; height: 26px; }
.notification-detail-amount.is-out { color: var(--danger); }
.notification-detail-amount.is-transfer { color: var(--ink); }
.cashbook-detail-popup .cashbook-saved-proof { position: relative; flex: 0 0 auto; display: grid; place-items: center; height: 220px; overflow: hidden; border-radius: 12px; background: #edf7f5; }
.cashbook-detail-popup .cashbook-saved-proof img { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.cashbook-detail-popup .cashbook-saved-proof img:not([src]) { visibility: hidden; }
.cashbook-detail-popup .cashbook-saved-proof > button { position: relative; width: auto; }
/* Chứng từ nhập hàng: khung giữ sẵn chứa ảnh rồi bảng hàng, nhiều hơn thì cuộn trong khung. */
.cashbook-detail-popup .supplier-document-frame { align-content: center; overflow: auto; }
.cashbook-detail-popup .supplier-document-frame:has(.operations-report) { align-content: start; place-items: stretch; border: 1px solid var(--line); background: var(--surface); }
.cashbook-detail-popup .supplier-document-frame:has(.operations-report) > img { position: static; height: 180px; border-radius: 0; }
.cashbook-detail-popup .supplier-document-frame > .operations-report { margin: 0; border: 0; border-radius: 0; overflow: visible; max-width: none; }
.cashbook-detail-popup .supplier-document-frame .document-table { border: 0; border-radius: 0; }
.cashbook-detail-popup .supplier-document-frame .document-table :is(.product-history-columns,.product-history-row) { column-gap: 8px; }
.cashbook-detail-popup .supplier-document-frame .document-table .product-history-customer { font-size: 12px; }
.cashbook-detail-popup .supplier-document-frame .document-table :is(.product-history-quantity,.product-history-price) { font-size: 11.5px; }
.cashbook-detail-popup .supplier-document-frame .operations-muted { margin: 0; padding: 8px 10px; }
.cashbook-detail-lines { margin: 0 0 12px; }
.cashbook-detail-line { align-items: center; }
.cashbook-detail-line > dt { display: flex; align-items: center; gap: 2px; min-height: 18px; }
.cashbook-detail-line .information-help-button { margin-block: -8px; }
.cashbook-detail-line > :is(.cashbook-in,.cashbook-out) { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media(max-width:480px) {
}
#organizationStockView { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.organization-scroll:has(#organizationStockView:not(.hidden)) { display: flex; flex-direction: column; overflow: hidden; }
#organizationStockView > :not(#organizationStockTable) { flex: 0 0 auto; }
#organizationStockSummary { margin-top: 0; }
#organizationStockView .catalog-search-row { margin-bottom: 8px; }
/* Hàng trong một kho dùng đúng khung danh sách của panel Hàng hoá (#catalogPage): khung viền bo co theo nội dung, tự cuộn bên trong. */
#organizationStockTable { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; border: 1px solid #bfd0cc; border-radius: 14px; background: var(--surface); }
#organizationStockTable.is-pending { flex: 1 1 auto; }
#organizationStockTable:has(> #organizationStockEmpty:not(.hidden)) { border: 0; border-radius: 0; background: transparent; }
#organizationStockRows > .product-card { border: 0; border-bottom: 1px solid #d3dfdc; border-radius: 0; }
#organizationStockRows > .product-card:last-child { border-bottom: 0; }
#organizationStockTable:has(> .load-more:not(.hidden)) > #organizationStockRows > .product-card:last-child { border-bottom: 1px solid #d3dfdc; }
#organizationStockTable > .load-more:not(.hidden) { width: calc(100% - 20px); min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 7px; margin: 8px 10px 9px; padding: 0 12px; border: 0; border-radius: 9px; background: #e6f2ef; color: var(--brand-dark); font-size: 11.5px; font-weight: 650; line-height: 1; }
#organizationStockTable > .load-more:not(.hidden)::after { width: 6px; height: 6px; content: ""; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-1px) rotate(45deg); }
#organizationStockTable > .load-more:not(.hidden):active { background: #d3e9e4; }
@media (hover: hover) and (pointer: fine) { #organizationStockTable > .load-more:not(.hidden):hover { border: 0; background: #dcece8; color: var(--brand-dark); } }
#organizationModal:has(#organizationStockView:not(.hidden)) #organizationError { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 60px; max-height: 100px; overflow: auto; border: 1px solid #e7b8b3; border-radius: 10px; background: #fff7f5; }
#organizationModal:has(#organizationStockView:not(.hidden)) .organization-retry { position: absolute; right: 16px; bottom: 16px; margin: 0; }
@media(max-height:600px) {
 #operationsModal.page-modal .operations-overview { overflow-y: auto; }
 .operations-overview .operations-ledger-list { flex: 0 0 auto; height: 45dvh; min-height: 150px; }
 #operationsModal.page-modal .operations-transfer-overview { overflow: hidden; }
 .operations-transfer-overview .operations-ledger-list { flex: 1 1 auto; height: auto; }
 #operationsModal.page-modal .cashbook-history { flex: 0 0 auto; height: 45dvh; min-height: 150px; }
 .cashbook-history .operations-ledger-list { flex: 1 1 auto; height: auto; min-height: 0; }
 .operations-overview > .operations-supplier-workspace { flex: 0 0 auto; height: 45dvh; min-height: 150px; }
 .operations-supplier-workspace .operations-ledger-list { flex: 1 1 auto; height: auto; min-height: 0; }
 .organization-scroll:has(#organizationStockView:not(.hidden)) { overflow-y: auto; }
 #organizationStockView { flex: 0 0 auto; overflow: visible; }
 #organizationStockTable { flex: 0 1 auto; max-height: 45dvh; }
 #organizationStockTable.is-pending { flex: 0 0 auto; height: 45dvh; min-height: 150px; }
}

.app-dropdown-picker .app-category-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-dropdown-picker .workflow-assignment-option:has(.app-category-option-name) { gap: 8px; }
.operations-statistics [data-supplier-metric="accrued"] strong { color: var(--profit-ink); }
.operations-statistics [data-supplier-metric="paid"] strong { color: var(--brand-dark); }
/* Transfer stock in one compact task; the history stays visible behind it. */
#operationsModal.page-modal .operations-transfer-overview { flex: 1 1 auto; padding-top: var(--panel-content-gap); }
.operations-transfer-empty { align-content: center; gap: 8px; min-height: 180px !important; text-align: center; }
.operations-transfer-empty svg { width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.operations-transfer-empty strong { font-size: 13px; color: var(--brand-dark); }
.operations-transfer-empty > span { max-width: 300px; font-size: 12px; color: var(--muted); }
.operations-editor-modal:has(.operations-transfer-form) > .operations-editor-sheet { height: min(860px, calc(var(--tg-viewport-height, 100dvh) - 32px - var(--safe-top) - var(--safe-bottom))); }
.operations-transfer-workspace .operations-receipt-content { gap: 0; padding-right: 2px; }
.operations-transfer-workspace .operations-field { min-height: 42px; }
.operations-transfer-workspace .operations-section { padding-top: 12px; font-size: 12px; }
.operations-transfer-workspace .operations-empty { border: 0; margin: 0; background: transparent; text-align: center; font-size: 13px; }
.operations-transfer-items { flex: 1 0 auto; min-width: 0; min-height: 100px; margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); overflow: hidden; }
.operations-transfer-workspace .operations-receipt-content > .operations-transfer-items { flex-grow: 1; }
.operations-transfer-columns,.operations-transfer-item { grid-template-columns: minmax(0,1fr) 100px 134px; gap: 6px; padding-left: 6px; padding-right: 6px; }
.operations-transfer-columns { margin-bottom: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.operations-transfer-columns > span:last-child { padding-right: 34px; }
.operations-transfer-item-copy { display: grid; min-width: 0; gap: 3px; }
.operations-transfer-remaining { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: #3e504c; font-size: 12px; font-weight: 650; }
.operations-transfer-remaining.is-negative { color: var(--danger); }
.operations-transfer-controls { display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; gap: 6px; min-width: 0; }
.operations-transfer-item .cart-item-history { cursor: default; }
.operations-transfer-item-title { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.operations-transfer-item-title strong { font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.operations-transfer-item .operations-transfer-remove .x-icon { width: 15px; height: 15px; flex: 0 0 15px; stroke-width: 2; }
.compact-modal > .stock-out-batch-card { height: min(550px, 90dvh); }
.stock-out-batch-card > .history-heading { flex: 0 0 auto; }
.stock-out-batch-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: var(--panel-content-gap) var(--header-inset); }
.stock-out-batch-body > * { flex-shrink: 0; }
.stock-out-batch-warehouse { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.stock-out-batch-warehouse strong { text-align: right; overflow-wrap: anywhere; }
.stock-out-batch-body .stock-out-batch-items { margin-top: 0; }
.stock-out-batch-items .text-input { min-width: 0; padding-inline: 5px; text-align: center; }
.stock-out-batch-actions { flex: 0 0 auto; padding-inline: var(--header-inset); margin: 0; }
/* Nhập Excel: dùng hàng nhãn | ô nhập như Tạo hàng hóa; khung cố định, danh sách kết quả cuộn trong khung nên không đổi kích thước khi chọn file hay khi có kết quả. */
.compact-modal > .product-import-card { height: min(550px, 90dvh); }
.product-import-card > .history-heading { flex: 0 0 auto; }
.product-import-body { --form-label-width: 128px; --form-row-height: 40px; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--section-gap); padding: var(--panel-content-gap) var(--header-inset); overflow: hidden; }
.product-import-body > * { flex-shrink: 0; }
.product-import-body > .product-import-results { flex: 1 1 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
.product-import-picker { grid-column: 2; grid-row: 1; min-width: 0; min-height: var(--form-row-height); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 10px; border: 0; border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--form-value-size); font-weight: 650; text-align: left; box-shadow: none; }
.product-import-picker svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: var(--brand-dark); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.product-import-picker:disabled { opacity: 1; color: #929e9b; }
.product-import-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-import-file-name:empty::before { content: "Chọn file Excel (.xlsx)"; color: #87928f; font-weight: 500; }
.product-import-results-heading { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-import-results-heading > .product-form-section-title { margin-inline: 3px 0; }
.product-import-summary { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; font-weight: 750; }
.product-import-count { padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--brand-light); color: var(--brand-dark); }
.product-import-count.is-exists { background: #eef2f1; color: #3e504c; }
.product-import-count.is-error { background: var(--danger-light); color: var(--danger); }
.product-import-body .product-import-items { margin-top: 0; min-height: 0; display: flex; flex-direction: column; }
.product-import-items > [role="rowgroup"] { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.product-import-items > [role="rowgroup"]::-webkit-scrollbar { display: none; }
.product-import-columns, .product-import-row { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.1fr); gap: 6px; padding-left: 6px; padding-right: 6px; }
.product-import-columns { flex: 0 0 auto; margin-bottom: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.product-import-columns > span, .product-import-columns > span:nth-child(2), .product-import-columns > span:nth-child(3) { text-align: left; }
.product-import-columns > span:first-child { text-align: center; }
.product-import-row { align-items: start; }
.product-import-row > span { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 18px; }
.product-import-row > span:first-child { text-align: center; color: #61747a; }
.product-import-row > strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 18px; }
.product-import-row.is-new > span:last-child { color: var(--brand-dark); font-weight: 750; }
.product-import-row.is-exists > span:last-child { color: #61747a; }
.product-import-row.is-error > span:last-child { color: var(--danger); font-weight: 750; }
.product-import-items .operations-empty { flex: 1 1 auto; min-height: 0; border: 0; margin: 0; font-size: 13px; }
.product-import-actions { flex: 0 0 auto; padding-inline: var(--header-inset); margin: 0; }
.product-import-actions .secondary-button, .product-import-actions .primary-button { margin: 0; }
.product-import-row:has(.app-dropdown-control) { align-items: center; }
.product-import-result { min-width: 0; display: flex; align-items: center; gap: 2px; }
.product-import-result > .app-dropdown-control { flex: 1 1 auto; }
.product-import-result > .information-help-button { flex: 0 0 28px; }
.product-import-row .app-dropdown-control { display: flex; width: 100%; min-width: 0; }
.product-import-row .app-dropdown-button { width: 100%; min-width: 0; min-height: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 700; text-align: left; box-shadow: none; }
.product-import-row .app-dropdown-button .app-dropdown-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.product-import-row.is-add .app-dropdown-button { border-color: var(--brand); color: var(--brand-dark); }
.product-import-count.is-add { background: var(--brand-light); color: var(--brand-dark); }
.product-import-row.is-add > span:last-child { color: var(--brand-dark); font-weight: 750; }
.catalog-functions-control:not(:has(> .header-more-menu > .header-more-item:not(.hidden))) { display: none; }
.operations-transfer-workspace .operations-receipt-footer { flex: 0 0 auto; margin-top: 12px; }
.operations-transfer-workspace .operations-receipt-footer .operations-submit { height: 42px; margin: 0; }
.operations-transfer-footer { display: grid; grid-template-columns: minmax(0,1fr) 160px; align-items: stretch; gap: 8px; }
.operations-transfer-workspace .operations-transfer-footer .operations-submit { height: auto; min-height: 46px; }
.operations-transfer-totals { grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); margin: 0; }
.operations-transfer-totals strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-transfer-totals span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-transfer-totals .operations-transfer-total-value { overflow-x: auto; text-overflow: clip; scrollbar-width: none; }
/* Khung phiếu dùng chung (web/document-view.js): Phiếu chuyển kho, Phiếu nhập, Phiếu chiết khấu, Phiếu hoàn hàng. Biểu tượng, tiêu đề, chip, bảng hàng; tổng ở chân như đơn hàng. */
.document-view { display: flex; flex-direction: column; gap: 10px; }
.operations-transfer-workspace .operations-receipt-content.document-view { gap: 10px; }
.document-view > :is(.document-table,.document-facts) { margin-top: 8px; }
.document-view > .document-facts { flex: none; margin-bottom: 0; border-color: #c5d5d1; border-radius: 13px; }
.document-facts > div { padding-inline: 10px; }
.document-facts > div + div { border-top-color: #d5e0dd; }
.document-view > .document-facts + .document-table { margin-top: 2px; }
.document-title { max-width: 100%; color: var(--brand-dark); font-size: 20px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; text-wrap: balance; }
.document-view .label-detail-chip { max-width: 100%; min-width: 0; overflow: hidden; }
.document-view .label-detail-chip > span:last-child { min-width: 0; overflow: hidden; line-height: 1.3; text-overflow: ellipsis; }
:is(.document-code > span:last-child, .document-reference) { -webkit-user-select: text; user-select: text; cursor: text; }
.document-table.product-history-list:not(.product-stock-list,.warehouse-products-list) { flex: none; grid-template-columns: minmax(0,1fr) repeat(var(--document-columns, 2), minmax(48px,max-content)); column-gap: 14px; overflow: hidden; }
.document-table .product-history-columns > span:nth-child(n+2) { text-align: right; }
.document-table :is(.product-history-columns,.product-history-row) { column-gap: 14px; }
.document-rows { display: contents; }
.document-rows > .product-history-row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.document-table .product-history-row { height: auto; min-height: 40px; }
.document-table .product-history-row:last-child { border-bottom: 0; }
.document-table .product-history-customer { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.document-table :is(.product-history-quantity,.product-history-price) { min-width: 0; }
.document-table .product-history-price.is-out { color: var(--danger); }
.document-name > .category-pill, .document-name > :first-child:not(.document-sub) { display: inline-flex; margin-right: 6px; vertical-align: 1px; }
.product-history-row .document-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.product-history-row .document-sub > span:not(.discount-detail-rate) { color: inherit; font-size: 11px; }
.product-history-row .document-sub > .discount-detail-rate { color: #8a5211; font-size: 10px; }
.can-open-document-row { cursor: pointer; }
.can-open-document-row:is(:hover,:focus-visible) { background: #f2f8f6; }
.can-open-document-row:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -1px; }
.document-state { margin-top: auto; }
.document-totals strong { overflow-x: auto; text-overflow: clip; scrollbar-width: none; }
.document-actions { margin-top: 8px; }
/* Bốn cột (phiếu nhập) trên màn hẹp: chữ số nhỏ lại để đủ số, tên hàng xuống dòng trong ô. */
@media (max-width: 599px) {
  .document-table :is(.product-history-columns,.product-history-row) { column-gap: 8px; }
  .document-table.is-four :is(.product-history-quantity,.product-history-price) { font-size: 11.5px; }
  .document-table.is-four .product-history-customer { font-size: 12px; }
}
/* Phiếu chiết khấu và hoàn hàng: panel riêng cùng khung phiếu. */
.document-sheet { display: flex; flex-direction: column; overflow: hidden; }
.document-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: var(--panel-content-gap) 0 8px; }
.document-scroll::-webkit-scrollbar { display: none; }
.document-sheet > .history-detail-footer { flex: 0 0 auto; margin-top: 0; padding-top: 8px; border-top: 1px solid #bdcdca; }
.operations-transfer-confirmation { margin: 8px 0; }
.operations-transfer-detail-actions { display: flex; gap: 8px; }
.operations-transfer-detail-actions > button { flex: 1; height: 43px; min-height: 43px; margin: 0; padding: 0 16px; border-radius: var(--control-radius); font-size: 13.5px; font-weight: 750; }
.operations-transfer-detail-actions > .is-cancel { border: 1px solid #dca39b; background: #f9e2de; color: var(--danger); }
.operations-transfer-detail-actions > .is-cancel:hover { border-color: #cc8e85; background: #f5d5ce; }
.app-filter-source { display: none !important; }
:root { --filter-control-size: 42px; }
:is(.app-filter-button, .employee-filters .app-filter-button, .ledger-report-accounts .app-filter-button) { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 var(--filter-control-size); width: var(--filter-control-size); min-width: var(--filter-control-size); height: var(--filter-control-size); min-height: var(--filter-control-size); padding: 0; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--brand-dark); cursor: pointer; }
.app-filter-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-filter-button svg, .operations-body .app-filter-button svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; transform: none; }
.app-filter-button[aria-expanded] > svg { transform: none; }
.app-filter-button:not(.app-filter-dropdown)[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-light); }
.app-filter-button:not(.app-filter-dropdown)[aria-pressed="true"]::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand-dark); }
@media (hover: hover) and (pointer: fine) {
  .app-filter-button:hover { border-color: var(--brand); background: var(--brand-light); }
}
.app-filter-dropdown[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-light); }
.app-filter-picker, .app-filter-legacy-picker { position: fixed; z-index: 10000; box-sizing: border-box; overflow: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid #c8d9d5; border-radius: 11px; background: var(--surface); box-shadow: 0 12px 28px rgba(29,54,49,.16); }
.app-filter-heading { padding: 8px 9px 4px; color: var(--muted); font-size: 10.5px; font-weight: 750; }
.app-filter-group + .app-filter-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.app-filter-options { max-height: 160px; overflow-y: auto; overscroll-behavior: contain; }
.app-filter-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 8px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.app-filter-option > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.app-filter-option > span:last-child { flex: 0 0 auto; color: var(--brand-dark); visibility: hidden; }
.app-filter-option[aria-checked="true"] { background: var(--brand-light); color: var(--brand-dark); font-weight: 800; }
.app-filter-option[aria-checked="true"] > span:last-child { visibility: visible; }
.app-filter-option:hover, .app-filter-option:focus-visible:where(:root:not([data-input-method="pointer"]) *) { background: #f0f6f4; }
.app-filter-option:disabled { opacity: .5; cursor: default; }
.app-filter-search { width: 100%; height: 36px; min-width: 0; margin: 4px 0; padding: 5px 9px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.app-filter-picker [hidden] { display: none; }
.clear-input-positioned { position: relative; }
input.has-clear-input { padding-right: 36px !important; }
input.has-clear-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.input-clear-button { position: absolute; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 28px; min-width: 28px; height: 28px; min-height: 28px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); box-shadow: none; cursor: pointer; }
.input-clear-button > svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.input-clear-button:hover, .input-clear-button:focus-visible:where(:root:not([data-input-method="pointer"]) *) { background: var(--brand-light); color: var(--brand-dark); }
input.has-clear-input:is(:placeholder-shown,:disabled,:read-only) + .input-clear-button { display: none; }
.catalog-search-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: var(--panel-content-gap); min-width: 0; }
.catalog-search-row .product-search { flex: 1 1 auto; min-width: 0; margin: 0; }
.catalog-search-row .app-filter-dropdown { flex: 0 0 36%; width: 36%; min-width: 0; max-width: 200px; justify-content: space-between; gap: 8px; padding: 0 10px; color: var(--ink); font-size: 13px; font-weight: 650; }
.catalog-search-row .app-filter-dropdown > span { position: static; flex: 1; min-width: 0; width: auto; height: auto; clip-path: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.catalog-search-row .app-filter-dropdown > svg { width: 16px; height: 16px; flex-basis: 16px; }
.catalog-search-row .app-filter-dropdown[aria-expanded="true"] > svg { transform: rotate(180deg); }
.catalog-search-row .app-filter-dropdown[aria-pressed="true"]::after { content: none; }
.app-filter-dropdown-picker .app-filter-options { max-height: none; overflow: visible; }
.employee-filters > input, .catalog-search-row .product-search input { height: var(--filter-control-size); min-height: var(--filter-control-size); padding-top: 0; padding-bottom: 0; border-color: var(--control-border); border-radius: var(--control-radius); background: var(--surface); font-size: var(--form-value-size); }
.ledger-report-accounts { justify-content: flex-end; }
.operations-transfer-workspace .operations-receipt-footer > p { min-height: 32px; }
@media(max-width:480px) {
 .operations-transfer-columns,.operations-transfer-item { grid-template-columns: minmax(0,1fr) 76px 114px; }
 .operations-transfer-footer { grid-template-columns: minmax(0,1fr); }
 .operations-transfer-workspace .operations-grid { grid-template-columns: minmax(0,1fr); }
}
@media(max-width:430px) {
 .operations-transfer-columns,.operations-transfer-item { grid-template-columns: minmax(0,1fr) 70px 102px; }
 .operations-transfer-controls { grid-template-columns: minmax(0,1fr) 26px; }
 .operations-transfer-columns > span:last-child { padding-right: 32px; }
}
/* Branch assignments: stable parent overview and one compact editor. */
.branch-staff { position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 7px 0 7px 18px; }
.branch-staff-label { color: var(--ink); font-size: 13px; font-weight: 600; }
.branch-staff-count { min-width: 48px; font-size: 12px; white-space: nowrap; }
.branch-staff .organization-command { margin-left: auto; }
.compact-modal > .assignment-sheet { width: 100%; max-width: 640px; height: min(860px,calc(var(--tg-viewport-height,100dvh) - 32px - var(--safe-top) - var(--safe-bottom))); display: flex; flex-direction: column; gap: 0; min-height: 0; background: var(--workspace-canvas); }
.assignment-sheet > .history-heading { flex: 0 0 auto; }
.assignment-sheet #branchAssignmentsTitle { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
#branchAssignmentsName { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#branchAssignmentsCount { flex: 0 0 auto; }
.assignment-filters { display: flex; flex: 0 0 auto; gap: 8px; padding-top: var(--panel-content-gap); }
.assignment-filters input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--control-border); border-radius: var(--control-radius); padding: 0 10px; font: inherit; background: var(--surface); color: var(--ink); }
.assignment-filters .app-filter-dropdown { flex: 0 0 38%; max-width: 170px; width: auto; height: 40px; }
.assignment-table { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 12px; border: 1px solid #bfd0cc; border-radius: 14px; background: var(--surface); overflow: hidden; }
.assignment-row { display: grid; grid-template-columns: minmax(0,1fr) 100px 44px; align-items: center; gap: 8px; padding: 7px 11px; min-height: 43px; border-bottom: 1px solid #cddbd8; background: var(--surface); color: var(--ink); font-size: 13px; }
.assignment-scroll.is-scrollable .assignment-row:last-child { border-bottom: 0; }
.assignment-columns { flex: 0 0 auto; min-height: 30px; border-bottom: 1px solid #d5e0dd; background: #f4f8f7; color: #536560; font-size: 9.5px; font-weight: 750; }
.assignment-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.assignment-person { display: grid; min-width: 0; gap: 3px; }
.assignment-person strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-size: 13px; font-weight: 750; }
.assignment-role { font-size: 12px; color: var(--ink); min-width: 0; }
.assignment-row > :last-child { text-align: center; }
.assignment-row input { display: inline-block; width: 18px; height: 18px; margin: 0; accent-color: var(--brand); vertical-align: middle; }
.assignment-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 12px; font-size: 12px; color: var(--muted); }
.assignment-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.assignment-actions .secondary-button,.assignment-actions .primary-button { width: auto; min-height: 38px; height: 38px; margin: 0; padding: 0 12px; border-radius: var(--control-radius); font-size: 13px; box-shadow: none; white-space: nowrap; }
.assignment-filters .app-filter-dropdown { justify-content: space-between; gap: 6px; padding: 0 9px; font-size: 12px; font-weight: 650; }
.assignment-filters .app-filter-dropdown > span { position: static; flex: 1; min-width: 0; width: auto; height: auto; clip-path: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.assignment-filters .app-filter-dropdown > svg { width: 16px; height: 16px; flex-basis: 16px; }
.assignment-filters .app-filter-dropdown[aria-pressed="true"]::after { content: none; }
@media(max-width:480px) {
 .assignment-row { grid-template-columns: minmax(0,1fr) 78px 32px; gap: 5px; padding-left: 8px; padding-right: 8px; }
 .assignment-actions { width: 100%; }
 .assignment-actions .secondary-button,.assignment-actions .primary-button { padding: 0 9px; font-size: 12px; }
 .assignment-filters input { font-size: 13px; }
}

/* Business panels share the viewport on phones, including child steps. */
@media (max-width:600px) {
 .modal:not([data-compact-overlay]):not([data-confirmation-dialog]):is(.compact-modal,.category-manager-modal,:has(> form.confirm-card)) { padding:0 !important;align-items:stretch !important; }
 .modal:not([data-compact-overlay]):not([data-confirmation-dialog]):is(.compact-modal,.category-manager-modal,:has(> form.confirm-card)) > :is(.sheet-card,form.confirm-card) {
  width:100% !important;max-width:none !important;height:var(--tg-viewport-height,100dvh) !important;max-height:var(--tg-viewport-height,100dvh) !important;min-height:0 !important;
  margin:0 !important;border:0 !important;border-radius:0 !important;padding:calc(12px + var(--safe-top)) var(--page-gutter) calc(12px + var(--safe-bottom)) !important;
 }
 .modal.confirm-modal:not([data-confirmation-dialog]) > form.confirm-card { display:flex;flex-direction:column;overflow-y:auto;animation:none; }
 .modal.confirm-modal:not([data-confirmation-dialog]) > form.confirm-card > .confirm-actions { margin-top:auto;flex-shrink:0; }
}

/* Confirmations share a small frame on every screen; entry forms keep their own layout. */
.modal[data-confirmation-dialog] { align-items: center; padding: 16px; }
.modal[data-confirmation-dialog] > :is(.sheet-card,.confirm-card) { width: 100%; max-width: 390px; height: auto; min-height: 0; max-height: calc(var(--tg-viewport-height,100dvh) - 32px - var(--safe-top) - var(--safe-bottom)); margin: 0; padding: 18px; border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0; overflow-y: auto; text-align: center; }
/* Bộ chọn tháng xuất báo cáo là lớp thả xuống tuyệt đối: thẻ không được cắt (overflow) nó, nếu không lịch bị che nửa dưới. */
.modal[data-confirmation-dialog] > .confirm-card:has(.confirm-report-month-field:not(.hidden)) { overflow: visible; }
.modal[data-confirmation-dialog] :is(.history-heading,.dialog-heading) { flex: none; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: 0; text-align: center; }
.modal[data-confirmation-dialog] .panel-header-title { justify-content: center; }
.modal[data-confirmation-dialog] :is(.history-heading,.dialog-heading) h2 { margin: 0; font-size: 18px; line-height: 1.4; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.modal[data-confirmation-dialog] :is(.close-button,.modal-parent-link,.panel-header-separator,.panel-header-actions) { display: none !important; }
.confirmation-description { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; text-align: center; }
.confirmation-fields { display: grid; gap: 8px; margin-top: 16px; text-align: left; }
.account-form-stacked { --form-row-height: 42px; --form-label-width: min(128px,35%); }
.account-form-stacked :is(.account-profile-fields,.account-settings-group,.account-password-section) { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; margin: 0; }
.account-form-stacked .account-settings-heading { color: var(--ink); }
.account-form-stacked .account-details { --form-row-height: 42px; border: 0; border-radius: 0; background: transparent; gap: 8px; }
.account-form-stacked .account-details > div { border: 1px solid var(--card-border); border-radius: var(--control-radius); overflow: hidden; }
.account-form-stacked .account-details dd { font-size: var(--form-value-size); }
.notification-trigger { position: relative; }
.notifications-badge { position: absolute; top: -5px; right: -6px; min-width: 17px; min-height: 17px; padding: 1px 4px; border: 2px solid var(--canvas); border-radius: 12px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 750; line-height: 12px; pointer-events: none; }
.notifications-panel { position: fixed; z-index: 90; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; padding: 12px var(--page-gutter); background: var(--surface); color: var(--ink); box-shadow: 0 6px 20px rgba(29,54,49,.12); overflow: hidden; }
.notifications-panel[data-layout="fullscreen"] { border: 0; border-radius: 0; padding: calc(12px + var(--safe-top)) var(--page-gutter) calc(12px + var(--safe-bottom)); background: var(--canvas); box-shadow: none; }
.notifications-panel[data-suspended] { z-index: 52; }
.notifications-heading.history-heading { gap: var(--panel-action-gap); }
.notifications-heading h2 { flex: 1; min-width: 0; font-size: var(--page-heading-size); }
.notifications-command { position: relative; display: grid; place-items: center; width: 32px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--header-action-radius); background: transparent; color: var(--brand-dark); cursor: pointer; }
.notifications-command:not(:disabled):hover { background: var(--brand-light); }
.notifications-command:disabled { background: transparent !important; border-color: transparent !important; }
.notifications-command svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notifications-command.has-updates::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.notifications-scroll, .notifications-tasks-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.notification-row { position: relative; display: flex; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.notification-row:last-of-type { border-bottom-color: transparent; }
.notification-row:hover { background: var(--surface-soft); }
.notification-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.notification-symbol { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; align-self: center; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); }
.notification-symbol svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.notification-copy strong { font-size: 13px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.notification-copy strong { color: var(--brand-dark); font-weight: 600; }
.notification-row.is-unread { background: #e3f3ee; }
/* Việc quá hạn ở tab Công việc: hồng nhạt, chữ và biểu tượng đỏ của app. */
.notification-row.is-alert { background: #ffeceb; }
.notification-row.is-alert:hover { background: #ffe2df; }
.notification-row.is-alert.is-unread { background: #fddcd9; }
.notification-row.is-alert.is-unread:hover { background: #fcd0cc; }
.notification-row.is-alert .notification-symbol { background: #ffd9d5; color: var(--danger); }
.notification-row.is-alert .notification-copy strong { color: var(--danger); }
.notification-row.is-alert .notification-unread-dot { background: var(--danger); }
.notification-row.is-unread:hover { background: #d5ece5; }
/* Tiêu đề thông báo là câu chữ thường; chỉ tên người/khách/mặt hàng và số tiền (<b>) in đậm, dòng chưa đọc đậm hơn một bậc. Tên công việc ở tab Công việc giữ nguyên. */
/* Segoe UI (Windows) không có bậc 500 và 800 nhảy lên Black 900, nên phần đậm dùng Bold 700 và chữ thường được làm dày nhẹ bằng nét viền mảnh để hai phần cân nhau. */
.notification-row:not(.is-task) .notification-copy strong { font-weight: 400; -webkit-text-stroke: .25px currentColor; }
/* Chưa đọc chỉ dày nét hơn (text-stroke không đổi bề rộng chữ), không đổi font-weight: khi tự chuyển sang đã đọc tiêu đề không ngắt dòng lại nên danh sách không nhảy. */
.notification-row.is-unread .notification-copy strong { -webkit-text-stroke: .5px currentColor; }
.notification-copy strong b { font-weight: 700; }
.notification-copy > span { min-width: 0; font-size: 12px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.notification-copy > span:empty { display: none; }
.notification-copy > span { font-weight: 400; }
.notification-row.is-unread .notification-copy > span { -webkit-text-stroke: .4px currentColor; }
.notification-copy time { color: var(--muted); font-size: 11px; line-height: 1.4; white-space: nowrap; }
.notification-unread-dot { align-self: center; flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.notification-row:not(.is-unread) .notification-unread-dot { visibility: hidden; }
/* Thông báo trên desktop (cột phải) và di động (toàn màn hình) dùng chung một kiểu: không bao khung, chỉ có tiêu đề, đường kẻ mảnh giữa các dòng, chấm và nền nhạt cho dòng chưa đọc; mọi kích thước đều không có tab Chưa đọc (danh sách đã hiện đủ). */
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notifications-heading { padding-inline: 12px; }
/* Danh sách cách đường kẻ header một khoảng như cột Thông báo desktop, nền dòng chưa đọc không dính vào gạch chân tab. */
.notifications-panel[data-layout="fullscreen"] .notifications-heading { margin-bottom: var(--panel-content-gap); }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) :is(.notifications-scroll, .notifications-tasks-scroll) { border: 0; border-radius: 0; background: transparent; scrollbar-width: none; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row:hover { background: rgba(255, 255, 255, .6); }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-unread { border-bottom-color: transparent; background: rgba(15, 118, 110, .07); }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-unread:hover { background: rgba(15, 118, 110, .12); }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-symbol { background: #fff; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-alert { background: #ffeceb; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-alert:hover { background: #ffe2df; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-alert.is-unread { background: #fddcd9; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-alert.is-unread:hover { background: #fcd0cc; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-row.is-alert .notification-symbol { background: #fff; color: var(--danger); }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-copy strong { font-size: 14px; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-copy > span { font-size: 13px; }
.notifications-panel:is([data-layout="page"], [data-layout="fullscreen"]) .notification-copy time { font-size: 12px; }
/* Thanh cuộn custom chỉ dành cho cột Thông báo desktop; các bố cục khác luôn ẩn (kiểu bật nằm trong desktop.css). */
.notifications-scrollbar { display: none; }
.notifications-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; min-height: 100px; padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }
.notifications-state.is-error { color: var(--danger); }
.notifications-state-symbol { display: grid; place-items: center; width: 40px; height: 40px; color: var(--muted); }
.notifications-state-symbol svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.notifications-state .secondary-button,.notifications-more { width: auto; min-height: 36px; padding: 0 14px; font-size: 12px; }
.notifications-more { display: block; margin: 12px auto; }
.notification-detail-body { min-height: 0; overflow-y: auto; margin: 0; padding-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }

/* Bảng từ khóa tìm kiếm có đúng bố cục, kích thước hàng và nút của bảng từ lóng. */
.category-manager-modal > .alias-manager-sheet, .create-product-modal > .alias-manager-sheet { gap: 0; }
.alias-manager-sheet .alias-table-shell { margin-top: var(--panel-content-gap, 12px); }
.alias-table-header, .alias-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1.35fr) 30px; align-items: center; }
.alias-table-header { min-height: 32px; border-bottom: 1px solid #cad8d5; background: #f2f6f5; color: #586a65; font-size: 10.5px; font-weight: 650; }
.alias-table-header span { padding: 0 9px; }
.alias-table-header span + span { border-left: 1px solid #d5e1de; }
.alias-row { min-height: 34px; border-bottom: 1px solid #d8e3e0; }
.alias-cell { min-width: 0; height: 100%; display: flex; align-items: center; padding: 2px 5px; }
.alias-cell + .alias-cell { border-left: 1px solid #e0e8e6; }
.alias-cell input { width: 100%; min-width: 0; height: 26px; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 11.5px; font-weight: 500; line-height: 1.15; }
.alias-cell input:focus { outline: 0; border-color: #76aaa3; background: #f7fbfa; }
.alias-manager-sheet .alias-footer .primary-button { width: 100%; }
@media (max-width: 520px) { .alias-cell input { font-size: 11.5px !important; } }
.create-product-card .product-form-header { gap: var(--panel-action-gap); }
.product-form-header > .panel-header-actions { display: flex; flex: 0 0 auto; align-items: center; }
.product-form-header > .panel-header-actions > .product-aliases-icon { flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); min-width: var(--panel-close-width); height: var(--panel-close-height); min-height: var(--panel-close-height); padding: 0; }
.product-form-header > .panel-header-actions > .product-aliases-icon:disabled { cursor: default; opacity: .6; }

/* Chấm màu đứng trước tên danh mục / bộ lọc. */
.app-option-dot { display: inline-block; flex: 0 0 11px; width: 11px; height: 11px; margin-right: 9px; border-radius: 50%; background: var(--dot); vertical-align: -1px; }
.app-dropdown-picker .workflow-assignment-option > .app-option-dot { margin-right: 0; }
/* Biểu tượng nguồn tiền trong ô chọn: cùng cỡ và màu với ô chọn nguồn của Thanh toán công nợ; số liệu của lựa chọn canh phải. */
.fund-icon { flex: 0 0 25px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: #e5f3f0; color: var(--brand-dark); }
.fund-icon.is-company { background: #fff0cf; color: #8a5b00; }
.fund-icon.is-cash { background: #edf2f0; color: #506963; }
.fund-icon svg, .workflow-assignment-button .fund-icon svg, .workflow-assignment-button[aria-expanded="true"] .fund-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: none; }
.app-dropdown-button:has(.fund-icon) { padding-block: 0; }
.app-dropdown-label.has-icon { display: flex; align-items: center; gap: 8px; }
.app-option-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-dropdown-picker .workflow-assignment-option:has(> :is(.fund-icon,.app-option-text)) { gap: 8px; padding-block: 7px; }
.workflow-assignment-option[aria-selected="true"] > :is(.fund-icon.is-all,.fund-icon.is-personal) { background: var(--surface); }
.app-dropdown-picker .workflow-assignment-option > .app-option-text { flex: 1; }
.app-option-detail { flex: 0 0 auto; color: #3e504c; font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.app-option-detail.is-negative { color: var(--danger); }

/* Tem QR phân phối: panel chính (điều chuyển/thu hồi), panel danh sách, hộp thoại tra cứu/gán mã và máy quét camera dùng khung bảng, bộ lọc và form của app. */
.labels-sheet,.labels-view { display: flex; flex-direction: column; min-height: 0; }
.labels-sheet { position: relative; }
.labels-view { flex: 1; gap: 8px; padding-top: var(--panel-content-gap); }
.labels-views { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.labels-view.hidden { display: none; }
.labels-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; display: grid; align-content: start; gap: 18px; padding-bottom: 12px; }
.labels-scroll > .employee-form { padding-top: 0; }
.label-grid { display: grid; min-width: 0; gap: 7px; align-items: center; padding-left: 11px; padding-right: 11px; }
.label-grid.label-grid-assign { grid-template-columns: 48px minmax(190px,1fr) 96px 100px; column-gap: 12px; min-width: 540px; }
.label-grid-codes { grid-template-columns: 56px minmax(96px,1fr) 148px 70px 112px; min-width: 560px; }
/* Tạo mã tem: một form, ô ghép hai phần (mã | tên, seri đầu – seri cuối tự tính) và khung tình trạng. */
.label-issue { display: grid; gap: 8px; min-width: 0; }
.label-pair { grid-column: 2; grid-row: 1; display: grid; align-items: stretch; min-width: 0; border-left: 1px solid var(--line); }
.label-pair-code { grid-template-columns: 84px minmax(0, 1fr); }
.label-pair-serial { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.label-pair > span { align-self: center; color: var(--muted); }
.label-pair > input { width: 100%; min-width: 0; min-height: var(--form-row-height); padding: 0 10px; border: 0; border-radius: 0 9px 9px 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--form-value-size); font-weight: 650; outline: 0; }
.label-pair > input:not(:last-child) { border-radius: 0; }
.label-pair-site { grid-template-columns: clamp(68px, 20vw, 120px) auto minmax(0, 1fr); }
.label-pair-serial > :is(input, output) { text-align: center; }
.label-pair > output { align-self: center; min-width: 0; padding: 0 10px; color: var(--muted); font-size: var(--form-value-size); font-weight: 650; overflow-wrap: anywhere; }
.label-pair > input[readonly] { background: var(--surface-disabled); color: var(--muted); }
.label-pair-code > input:first-child { border-right: 1px solid var(--line); }
.label-pair > input:disabled { color: var(--text-disabled); }
.label-pair:focus-within { box-shadow: inset 0 0 0 1px var(--brand); border-radius: 0 9px 9px 0; }
.label-issue-facts { margin: 4px 0 0; }
.label-issue-facts > div { align-items: center; min-height: 48px; }
.label-issue-facts dt { display: inline-flex; align-items: center; gap: 4px; }
.label-issue-facts dd { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; font-variant-numeric: tabular-nums; }
.label-issue-facts .task-chip { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.label-issue-facts :is(.label-issue-site, #labelIssueNoSite).hidden { display: none; }
.label-issue-facts #labelIssueNoSite { color: var(--muted); font-weight: 600; }
.label-issue-facts .label-issue-site { cursor: pointer; }
.label-issue-facts .label-issue-site:not(:disabled):hover { filter: brightness(.97); }
.label-lot-detail { min-width: 0; }
.label-lot-facts { margin: 0; }
.label-lot-facts > div { align-items: center; min-height: 44px; }
.label-lot-download { width: 100%; margin-top: 12px; }
.label-lot-download.hidden { display: none; }
.label-grid-hold { grid-template-columns: 60px minmax(170px,1fr) 104px 64px; min-width: 520px; }
.label-grid-pair { grid-template-columns: minmax(0,1fr) 90px; }
.label-grid-codes > :nth-child(5),.label-grid-history > :nth-child(3),.label-grid-assign > :nth-child(4),.label-grid-hold > :nth-child(4),.label-grid-pair > :nth-child(2) { text-align: right; }
.label-product { font-weight: 750; }
.label-grid.is-actionable { cursor: pointer; }
.label-grid.is-actionable:hover { background: var(--surface-selected); }
.label-spent,.label-spent > span { color: var(--muted); }
.label-fact-value { display: flex; align-items: center; min-width: 0; padding: 5px 10px; font-weight: 650; overflow-wrap: anywhere; }
.label-result { padding: 12px; }
.label-result .employee-empty { padding: 28px 8px; }
.label-result .employee-empty.is-error { color: var(--danger); }
.label-result .platform-section-title { margin: 14px 0 6px; }
.label-result .work-task-facts { margin-bottom: 0; }
.work-task-row.is-bad,.work-task-row.is-bad > span { color: var(--danger); }
.label-code-box { flex: 0 0 38%; max-width: 170px; min-width: 110px; }
.label-code-box .workflow-assignment-control { height: 42px; }
.label-check-button { flex: 0 0 auto; min-height: 42px; padding: 0 14px; }
.label-state { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 12px; }
.label-state.is-error { color: var(--danger); }
.label-state.hidden { display: none; }
.label-entry-manual { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; gap: 4px; }
.label-entry-manual .label-entry-field > :is(input,textarea) { display: block; height: calc(var(--form-row-height) + 2px); min-width: 0; padding: 6px 34px 6px 8px; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--form-value-size); font-variant-numeric: tabular-nums; }
.label-entry-field > :is(input,textarea)::placeholder { font-size: var(--form-value-size); }
.label-entry-manual .label-entry-field > textarea { resize: none; line-height: calc(var(--form-row-height) - 12px); }
.label-entry-arrow { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#labelTransferListField { grid-column: 1 / -1; }
.label-entry-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.label-entry-actions:not(:has(> :not(.hidden):not(.label-entry-command))) > .label-entry-command { grid-column: 1 / -1; }
.label-entry-command { grid-column: 2; min-width: 160px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: calc(var(--form-row-height) + 2px); padding: 4px 8px; white-space: nowrap; }
.label-entry-command svg { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.label-transfer-table { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); }
.label-transfer-rows { flex: 1; overflow: auto; overscroll-behavior: contain; min-height: 0; }
.label-transfer-columns, .label-entry, .label-transfer-summary { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.65fr) 48px 28px; align-items: center; gap: 6px; padding: 6px 8px; }
.cart-columns.label-transfer-columns { flex-shrink: 0; margin: 0; border: 0; border-radius: 0; }
.label-transfer-columns > span:nth-child(2) { text-align: left; }
.label-entry, .label-transfer-summary, .label-transfer-empty { min-height: 40px; border-top: 1px solid var(--line); font-size: 12px; }
.label-transfer-columns > span:nth-child(3), .label-entry-quantity, .label-transfer-summary > :last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.label-entry strong, .label-entry-product, .label-transfer-summary > :first-child { overflow-wrap: anywhere; }
.label-entry strong, .label-entry-quantity { font-weight: 650; }
.label-entry-product, .label-transfer-empty { color: var(--muted); }
.label-entry.is-bad .label-entry-product { color: var(--danger); }
.label-transfer-summary > :first-child { grid-column: span 2; }
.label-transfer-empty { min-height: 100%; display: grid; place-items: center; padding: 8px; text-align: center; }
.label-entry-remove { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.label-entry-remove svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* Tem trùng (đang thuộc đại lý khác): nhập/quét là dòng tô đỏ (nền đỏ nhạt, seri đỏ có biểu tượng cảnh báo), không thêm dòng chữ;
   bấm dòng mở popup Tem bị trùng (seri, sản phẩm, đang thuộc ai, đoạn seri trùng, nút Bỏ dòng này). Cột Sản phẩm rộng hơn cột Seri. */
.label-entry-product { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.label-entry.is-conflict { background: #fff1ef; cursor: pointer; }
.label-entry.is-conflict:hover { background: #fde4e0; }
.label-entry.is-conflict > strong { display: inline-flex; align-items: flex-start; gap: 4px; color: var(--danger); }
.label-entry.is-conflict > strong svg { flex: 0 0 13px; width: 13px; height: 13px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.label-entry.is-conflict .label-entry-product { color: #8f3a31; }
/* Popup Tem bị trùng: khung lớn cố định (không đổi cỡ khi tải), header như panel (tiêu đề trái, nút X chung bên phải, đường kẻ dưới),
   thông tin dòng ở trên, phần còn lại là danh sách cuộn kiểu danh sách tem của Tem QR (khung #c5d5d1 bo 13px, tiêu đề cột nền #f4f8f7, dòng 40px).
   Ngoại lệ có chủ đích: popup xác nhận ẩn X, còn popup xem này chỉ có X để đóng. */
/* Popup nằm giữa màn hình như mọi popup của app, luôn một khung cố định (cuộn bên trong), không co theo nội dung. */
#labelDuplicateModal > .confirm-card { display: flex; flex-direction: column; width: min(600px, calc(100vw - 24px)); max-width: none; height: min(560px, calc(var(--tg-viewport-height, 100dvh) - 32px)); max-height: none; }
#labelDuplicateModal .dialog-heading.label-duplicate-heading { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 var(--panel-content-gap, 12px); padding: 0 0 8px; border-bottom: 1px solid var(--line); text-align: left; }
#labelDuplicateModal .label-duplicate-heading > .panel-header-title { flex: 1 1 auto; min-width: 0; justify-content: flex-start; text-align: left; }
#labelDuplicateModal .label-duplicate-heading h2 { min-width: 0; margin: 0; text-align: left !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#labelDuplicateModal[data-confirmation-dialog] .label-duplicate-heading > .close-button { display: grid !important; place-items: center; position: static; flex: 0 0 var(--panel-close-width); width: var(--panel-close-width); height: var(--panel-close-height); margin: 0; padding: 0; }
#labelDuplicateDetail { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
/* Nội dung popup Tem bị trùng: danh sách thông tin Seri/Sản phẩm, tiêu đề Đang thuộc, rồi mỗi khách một thẻ. Cả nội dung cuộn chung một vùng. */
.label-duplicate-body { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain; text-align: left; }
.label-duplicate-facts { flex: none; margin: 0; }
.label-duplicate-facts > div { padding: 10px 12px; }
.label-duplicate-facts dd { color: var(--ink); font-weight: 650; }
.label-duplicate-title { flex: none; margin: 4px 0 -2px; color: var(--ink); font-size: 13px; font-weight: 750; }
.label-duplicate-holders { display: flex; flex: none; flex-direction: column; gap: 8px; }
/* Thẻ khách: viền đỏ rất nhạt, dòng đầu nền #fff6f5 (tên đỏ đậm, nhãn số tem dạng viên, nút sao chép trắng), seri trùng chữ thường dễ đọc. */
.label-duplicate-holder { flex: none; overflow: hidden; border: 1px solid #f1d4d0; border-radius: 12px; background: var(--surface); }
.label-duplicate-owner { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 10px; min-height: 46px; padding: 5px 6px 5px 12px; border-bottom: 1px solid #f6e1de; background: #fff6f5; }
.label-duplicate-owner > strong { overflow: hidden; color: #9f2a1f; font-size: 13.5px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.label-duplicate-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; background: #fde4e0; color: #b42318; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.label-duplicate-copy { display: grid; place-items: center; width: 32px; height: 36px; padding: 0; border: 1px solid #ecc9c4; border-radius: var(--control-radius); background: #fff; color: #b42318; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.label-duplicate-copy:hover { border-color: #e2b1aa; background: #fff1ef; }
.label-duplicate-copy.is-done { border-color: #b9ddd3; background: #e3f3ee; color: #0f766e; }
.label-duplicate-copy:disabled { cursor: progress; opacity: .7; }
.label-duplicate-copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.label-duplicate-serials { margin: 0; padding: 10px 12px 11px; color: #2f423e; font-size: 13px; font-weight: 500; line-height: 1.7; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; cursor: text; }
.label-duplicate-serials.is-loading { color: var(--muted); }
.label-duplicate-more { display: block; min-height: 30px; margin: -2px 12px 11px; padding: 0 12px; border: 1px solid #ecc9c4; border-radius: var(--control-radius); background: #fff; color: #b42318; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.label-duplicate-more:hover { background: #fff1ef; }
.label-duplicate-more.hidden { display: none; }
.label-entry-same { color: var(--muted); font-size: 11.5px; font-style: italic; }
/* Mỗi nhóm trong form Tem QR trải hết chiều rộng, không bị co vào nửa lưới hai cột của form nhân viên. */
.label-form > section,.label-form > .confirm-actions { grid-column: 1 / -1; }
.label-form > .confirm-actions { padding-top: 0; border-top: 0; }
/* Gán mã tem: panel toàn màn hình như panel Chuyển kho; sản phẩm đã chọn là một thẻ chi tiết chiếm phần còn lại, không phải danh sách. */
.label-assign-actions { flex: 0 0 auto; margin-top: 12px; }
.operations-transfer-workspace .operations-receipt-content > .label-assign-product { flex: 0 0 auto; display: flex; flex-direction: column; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.label-assign-name-box { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); background: #f3f8f7; }
.label-assign-product-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.label-assign-product-name > .category-pill,.label-assign-product-name > .source-pill { margin-right: 6px; vertical-align: middle; }
.label-assign-name-box .label-assign-product-clear,.label-assign-name-box .label-assign-product-clear:hover,.label-assign-name-box .label-assign-product-clear:active { flex: 0 0 32px; width: 32px; height: 36px; min-height: 36px; border: 0; background: transparent; box-shadow: none; color: #b42318; }
.label-assign-name-box .label-assign-product-clear .x-icon { width: 20px; height: 20px; stroke-width: 3; }
.label-assign-name-box .label-assign-product-clear:hover { color: #8f1c14; }
.label-assign-list { display: flex; flex-direction: column; margin: 0; }
.label-assign-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 14px; font-size: 14px; line-height: 1.4; }
.label-assign-list > div + div { border-top: 1px solid var(--line); }
.label-assign-list dt { margin: 0; color: var(--muted); white-space: nowrap; }
.label-assign-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
/* Hai ô seri luôn cạnh nhau, cả trên điện thoại, để giống cột giữa của giao diện máy tính. */
.label-assign-form .operations-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 8px; }
.label-assign-form .operations-grid .operations-field { --form-label-width: 64px; }
.label-move-list { display: grid; gap: 8px; max-height: min(40vh, 320px); overflow-y: auto; scrollbar-width: none; text-align: left; }
.label-move-row { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; overflow-wrap: anywhere; }
.label-move-row > span { color: var(--muted); }
.label-assign-actions,.label-assign-actions.has-delete { grid-template-columns: minmax(0,1fr) 160px; }
.label-assign-actions.has-delete { grid-template-columns: minmax(0,1fr) 260px; }
.label-assign-actions .operations-transfer-totals { grid-template-columns: minmax(0,1fr); }
.label-assign-actions .operations-transfer-totals > div { text-align: left; border-left: 0; padding-left: 0; }
.label-assign-actions > .confirm-actions { margin: 0; padding: 0; border: 0; }
.label-assign-actions button { min-height: 46px; height: auto; margin: 0; }
/* Số tem gán và nút Gán mã luôn song song, cả trên điện thoại (khi sửa thì nút Xóa khoảng đứng cạnh Lưu thay đổi). */
@media (max-width: 480px) {
 .label-assign-actions { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
 .label-assign-actions.has-delete { grid-template-columns: minmax(0,1fr) minmax(0,1.7fr); }
 .label-assign-actions.has-delete .confirm-actions button { padding-left: 6px; padding-right: 6px; font-size: 12px; }
}
@media (max-width: 360px) {
 .label-assign-actions.has-delete .confirm-actions button { white-space: nowrap; font-size: 11px; }
}
}
.label-product-history { position: relative; display: flex; flex: 1; min-height: 0; }
.label-product-history > .product-history-list { flex: 1; min-height: 0; overflow: auto; }
.label-product-history-state { position: absolute; inset: 36px 1px 1px; background: var(--surface); }
.label-product-history .is-pending .product-history-empty { visibility: hidden; }
@media(max-width:480px) {
}
/* Nút xác nhận ghim ở đáy, danh sách tem giãn theo chiều cao còn lại. */
.label-transfer-form { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; padding-top: 0; }
.label-transfer-form > .labels-scroll { display: flex; flex-direction: column; gap: 16px; scrollbar-gutter: auto; }
#labelTransferCodeField { --form-label-width: 62px; grid-column: 1; width: min(100%, 220px); }
.label-transfer-form > .label-transfer-footer { flex: 0 0 auto; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: 0; padding-top: var(--panel-content-gap); border-top: 0; }
.label-transfer-footer > button { min-width: 0; padding: 6px 4px; line-height: 1.25; }
.label-transfer-totals.totals { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.label-transfer-totals span { white-space: nowrap; }
.label-transfer-totals strong { white-space: nowrap; overflow-x: auto; scrollbar-width: none; font-variant-numeric: tabular-nums; }
.label-transfer-items { flex: 1 0 116px; display: flex; flex-direction: column; min-height: 0; }
/* Danh sách gợi ý xổ ngay dưới ô nhập, kiểu gợi ý khách của màn tạo đơn nhưng nổi trên panel. */
.label-suggestions { position: fixed; z-index: 70; right: auto; }
.label-suggestions button { border-radius: 0; }
.label-suggestions button:hover { background: var(--surface-selected); }
.label-suggestion-empty { padding: 12px; color: var(--muted); font-size: 13px; }
/* Nút QR nằm trong ô nhập seri, bấm để mở camera quét mã vạch. */
.label-scan-field { position: relative; min-width: 0; flex: 1; }
.label-scan-field > :is(textarea,input) { width: 100%; box-sizing: border-box; padding-right: 50px; }
.label-scan-button { position: absolute; top: 5px; right: 5px; width: 32px; min-width: 32px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--control-radius); background: transparent; color: var(--ink); cursor: pointer; }
.label-scan-field > input + .label-scan-button { top: 50%; transform: translateY(-50%); }
.label-scan-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.label-scan-button:disabled { opacity: .5; cursor: default; }
.label-entry-field > .label-scan-button { inset: 1px 1px 1px auto; height: auto; width: 32px; transform: none; color: var(--brand-dark); }
.label-entry-field > input + .label-scan-button { top: 1px; transform: none; }
/* Hộp thoại tra cứu giữ chiều cao cố định để kết quả hiện ra không làm khung nhảy. */
.compact-modal > .label-lookup-sheet { height: min(560px, calc(var(--tg-viewport-height, 100dvh) - 32px - var(--safe-top) - var(--safe-bottom))); }
.label-lookup-form { padding-top: var(--panel-content-gap); }
.label-lookup-sheet .label-result { padding-top: 0; }
/* Kết quả tra cứu: thẻ tem như hàng đã chọn của Gán mã tem, rồi bảng kiểu danh sách lịch sử hàng hoá; đang tra cứu thì mờ kết quả cũ, không đổi khung. */
.label-lookup-sheet .label-lookup-result { display: flex; flex-direction: column; padding: 16px 0; }
.label-lookup-result > * { flex: none; }
.label-lookup-result[aria-busy="true"] > * { opacity: .5; }
.label-lookup-result.label-result .platform-section-title { margin: 16px 0 8px; }
.label-lookup-card,.label-lookup-summary { border: 1px solid #c5d5d1; border-radius: 13px; background: var(--surface); overflow: hidden; }
/* Thẻ và bảng cùng nhịp: dòng 40px, chữ 13px, lề trong 12px để mép chữ thẳng hàng giữa thẻ và bảng; nhãn và chip canh giữa theo dòng. */
.label-lookup-card .label-assign-name-box { min-height: 44px; padding: 10px 12px; }
.label-lookup-card .label-assign-product-name { font-size: 13.5px; }
:is(.label-lookup-card,.label-lookup-summary) .label-assign-list > div { align-items: center; min-height: 40px; padding: 8px 12px; font-size: 13px; }
:is(.label-lookup-card,.label-lookup-summary) .label-assign-list dd { font-variant-numeric: tabular-nums; }
.label-lookup-table .label-grid { padding-left: 12px; padding-right: 12px; }
.label-holder-status { display: inline-block; max-width: 100%; padding: 2px 9px; font-size: 12px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.label-lookup-table.work-task-table { flex: none; }
.label-lookup-summary + *,.label-lookup-table + .label-lookup-table { margin-top: 12px; }
.label-lookup-table .work-task-scroll { height: auto; scrollbar-gutter: auto; }
/* Khung camera giữ kích thước khi mở, quét, gặp lỗi và thử lại. */
/* Máy quét tem: toàn màn hình; camera ngang ở trên, khung danh sách tem vừa quét ở giữa, thanh tổng ở đáy giống panel Đơn hàng. */
.barcode-scanner-sheet { display: flex; flex-direction: column; min-height: 0; gap: 0; }
.barcode-scanner-stage { position: relative; flex: 0 0 auto; width: 100%; aspect-ratio: 16 / 9; max-height: 42dvh; margin-top: var(--panel-content-gap); overflow: hidden; border: 1px solid var(--line); border-radius: var(--card-radius); background: #0b1c19; }
.barcode-scanner-stage video { display: block; width: 100%; height: 100%; object-fit: cover; }
.barcode-scanner-stage:not([data-camera-ready]) video { visibility: hidden; }
.barcode-scanner-line { display: none; position: absolute; top: 50%; transform: translateY(-50%); inset-inline: 14%; height: 2px; border-radius: 2px; background: #34d399; pointer-events: none; }
.barcode-scanner-stage[data-camera-ready] .barcode-scanner-line { display: block; }
.barcode-scanner-stage::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px #34d399; opacity: 0; pointer-events: none; transition: opacity .15s; }
.barcode-scanner-stage.is-hit::after { opacity: 1; }
.barcode-scanner-status { position: absolute; inset: auto 8px 8px; padding: 6px 8px; border-radius: var(--control-radius); background: rgba(11,28,25,.78); color: #fff; font-size: 13px; font-weight: 650; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.barcode-scanner-status.hidden { display: none; }
.barcode-scanner-torch { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(11,28,25,.7); color: #fff; cursor: pointer; }
.barcode-scanner-torch.hidden { display: none; }
.barcode-scanner-torch[aria-pressed="true"] { background: #f5b301; color: #1b1b1b; }
.barcode-scanner-torch svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.barcode-scanner-results { display: none; }
.barcode-scanner-sheet.is-list .barcode-scanner-results { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; margin-top: var(--panel-content-gap); overflow: hidden; border: 1px solid #bfd0cc; border-radius: 14px; background: var(--surface); }
.barcode-scanner-columns, .barcode-scanner-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 32px; align-items: center; gap: 8px; padding: 0 10px; }
.cart-columns.barcode-scanner-columns { flex-shrink: 0; min-height: 36px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.barcode-scanner-columns > span:nth-child(2) { text-align: left; }
.barcode-scanner-empty { display: grid; place-items: center; min-height: 52px; padding: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.barcode-scanner-empty.hidden { display: none; }
.barcode-scanner-rows { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.barcode-scanner-row { min-height: 46px; border-bottom: 1px solid var(--line); }
.barcode-scanner-row:last-child { border-bottom: 0; }
.barcode-scanner-row.is-new { background: var(--surface-selected); }
.barcode-scanner-row-code { min-width: 0; font-size: var(--form-value-size); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: auto hidden; scrollbar-width: none; }
.barcode-scanner-row-note { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; line-height: 16px; }
.barcode-scanner-row.is-bad .barcode-scanner-row-note { color: var(--danger); }
.barcode-scanner-row-remove { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.barcode-scanner-row-remove:hover { background: var(--surface-selected); color: var(--danger); }
.barcode-scanner-row-remove svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.barcode-scanner-footer.confirm-actions { display: none; flex: 0 0 auto; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: var(--panel-content-gap); padding-top: 0; border-top: 0; }
.barcode-scanner-sheet.is-list .barcode-scanner-footer.confirm-actions { display: grid; }
.barcode-scanner-totals.totals { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.barcode-scanner-footer > button { min-width: 0; padding: 6px 4px; line-height: 1.25; }
.barcode-scanner-totals span { white-space: nowrap; }

/* Điều hướng di động: thanh dưới luôn hiện ở màn hình chính và trên mọi panel; panel dừng ngay phía trên thanh nên không bị che và không đổi chiều cao khi hộp thoại mở.
   Panel gốc (panel thấp nhất đang mở) không còn nút X vì đã có thanh dưới, nút Back và thao tác vuốt; panel con và hộp thoại vẫn giữ nút X. */
@media (max-width: 1099px) {
  body:has(#app:not(.hidden)) { --bottom-nav-space: calc(56px + var(--safe-bottom)); }
  body:has(#app:not(.hidden)) .modal.page-modal:not(.compact-modal):not(.order-documents-modal) { bottom: var(--bottom-nav-space); --safe-bottom: 0px; }
  body:has(#app:not(.hidden)) .modal.page-modal:not(.compact-modal):not(.order-documents-modal) > .sheet-card { height: 100%; max-height: 100%; }
  .modal[data-nav-root] .close-button { display: none !important; }
  /* Luồng tạo đơn / chi tiết đơn: ẩn thanh dưới, panel phủ tới đáy như trước. */
  body.nav-immersive .mobile-bottom-nav { display: none; }
  body.nav-immersive:has(#app:not(.hidden)) .modal.page-modal:not(.compact-modal):not(.order-documents-modal) { bottom: 0; --safe-bottom: unset; }
  .bottom-nav-item span { font-size: 10px; }
  /* Danh sách chức năng của tab Menu nổi phía trên cả panel đang mở. */
  #headerMoreMenu { z-index: 400 !important; }
  /* Chuyển tab: tab mới có nền nhạt hiện dần và biểu tượng nảy lên. */
  .bottom-nav-item { z-index: 1; }
  .bottom-nav-item::before { content: ""; position: absolute; inset: 5px 6px; border-radius: 14px; background: rgba(15, 118, 110, .12); opacity: 0; transform: scale(.7); transition: opacity .22s ease, transform .22s ease; z-index: -1; }
  .bottom-nav-item.active::before { opacity: 1; transform: scale(1); }
  .bottom-nav-item.active svg { animation: bottom-nav-pop .34s cubic-bezier(.34, 1.56, .64, 1); }
  .bottom-nav-item.active span { color: var(--brand-dark); font-weight: 800; }
  @keyframes bottom-nav-pop { 0% { transform: scale(.78) translateY(2px); } 100% { transform: scale(1) translateY(0); } }
}

/* Danh sách nhân viên chỉ đọc: không làm nổi dòng hay hiện con trỏ bấm. */
.employee-record.is-readonly .employee-card::after { pointer-events: none; cursor: default; }
.employee-record.is-readonly:hover { background: transparent; }

/* Chi tiết thông báo */
@keyframes notification-detail-in { from { opacity: 0; transform: scale(0.88) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes notification-detail-pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
#notificationDetailModal.modal.compact-modal,
#operationsEditorModal[data-detail-popup].modal.compact-modal { z-index: 105; align-items: center; padding: 16px; background: rgba(11, 28, 25, .5); }
#notificationDetailModal.modal.compact-modal > .sheet-card,
#operationsEditorModal[data-detail-popup].modal.compact-modal > .sheet-card { width: min(380px, calc(100vw - 32px)); max-width: 380px; margin: auto; padding: 20px 22px 22px; border: 1px solid rgba(15, 118, 110, 0.18); border-radius: 20px; background: #fff; box-shadow: 0 20px 48px -6px rgba(15, 118, 110, 0.22), 0 8px 18px -4px rgba(0, 0, 0, 0.08); animation: notification-detail-in .3s cubic-bezier(0.175, 0.885, 0.32, 1.15) both; }
.notification-detail-body { display: flex; flex-direction: column; align-items: stretch; gap: 14px; min-height: 0; overflow-y: auto; margin: 0; padding-top: 12px; }
.notification-detail-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 2px; text-align: center; }
.notification-detail-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #10b981, #0f766e); color: #fff; box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35); animation: notification-detail-pop .4s .08s cubic-bezier(0.175, 0.885, 0.32, 1.25) both; }
.notification-detail-icon.is-alert { background: linear-gradient(135deg, #f87171, #b42318); box-shadow: 0 6px 20px rgba(180, 35, 24, 0.3); }
.notification-detail-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notification-detail-amount { color: var(--brand-dark); font-size: 26px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.notification-detail-name { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.notification-detail-time { color: var(--muted); font-size: 12px; }
.notification-detail-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.notification-detail-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.notification-detail-list > div + div { border-top: 1px solid var(--line); }
.notification-detail-list dt { margin: 0; color: var(--muted); white-space: nowrap; }
.notification-detail-list dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.notification-detail-body .primary-button, .notification-detail-body .secondary-button { width: 100%; min-height: 42px; }
.notification-detail-actions { display: flex; flex-direction: column; gap: 8px; }
/* Hộp chi tiết công việc: rộng hơn hộp thông báo thường, hai nút song song, ba bước (chi tiết / ảnh chứng từ / lý do) trong cùng một hộp. */
#notificationDetailModal.is-task.modal.compact-modal > .sheet-card { display: flex; flex-direction: column; width: min(440px, calc(100vw - 24px)); max-width: 440px; min-height: min(740px, calc(100dvh - 32px)); padding: 22px 22px 22px; }
#notificationDetailModal.is-task .notification-detail-body { flex: 1 1 auto; }
#notificationDetailModal.is-task .notification-detail-body > .task-step:has(.task-proof) { flex: 1 1 auto; }
#notificationDetailModal.is-task .notification-detail-body > .task-step:has(.task-proof) .task-proof { flex: 1 1 auto; grid-template-rows: minmax(0, 1fr); }
#notificationDetailModal.is-task .notification-detail-body > .task-step:has(textarea) { flex: 1 1 auto; }
#notificationDetailModal.is-task .notification-detail-body > .task-step textarea { flex: 1 1 auto; }
#notificationDetailModal.is-task .notification-detail-body > .notification-detail-actions { margin-top: auto; }
#notificationDetailModal.is-task .notification-detail-icon { width: 64px; height: 64px; }
#notificationDetailModal.is-task .notification-detail-icon svg { width: 30px; height: 30px; }
#notificationDetailModal.is-task .notification-detail-name { font-size: 17px; font-weight: 800; }
#notificationDetailModal.is-task .notification-detail-list > div { padding: 13px 14px; font-size: 14px; }
/* Trạng thái (biểu tượng + màu) và hạn hoàn thành nằm cạnh nhau ngay dưới tên việc. */
.task-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.task-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; }
.task-chip svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.task-status.is-todo { border-color: #d5dde6; background: #eef2f6; color: #475569; }
.task-status.is-doing { border-color: #b9ddd3; background: #e3f3ee; color: #0f766e; }
.task-status.is-overdue { border-color: #f5c2bd; background: #fdecea; color: #b42318; }
.task-status.is-review { border-color: #f6dc92; background: #fef3c7; color: #b45309; }
.task-status.is-done { border-color: #b8e0c4; background: #e4f5e9; color: #15803d; }
.task-status.is-failed { border-color: #f6bdcc; background: #fde8ee; color: #9f1239; }
.task-status.is-cancelled { border-color: #dbe2ea; background: #f1f5f9; color: #64748b; }
.task-template-facts { display: grid; gap: 12px; }
.task-template-facts .task-chips { justify-content: flex-start; }
.task-template-block { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.task-template-block-title { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.task-template-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font-size: 14px; line-height: 1.55; }
.task-template-people-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-template-people-chips .task-chip { min-height: 30px; max-width: 100%; padding: 0 11px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 600; }
.task-chip.is-excluded { border-color: #dbe2ea; background: #f1f5f9; color: #64748b; }
.notification-detail-actions.is-pair { flex-direction: row; }
.notification-detail-body .notification-detail-actions.is-pair > button { flex: 1 1 0; min-width: 0; height: 46px; min-height: 46px; margin: 0; }
.task-step { display: grid; gap: 10px; min-width: 0; }
.task-step:has(textarea), .task-step:has(.task-proof) { grid-template-rows: auto minmax(0, 1fr); }
.task-step-title { margin: 0; color: var(--ink); font-size: 14px; font-weight: 700; }
.task-step-heading { display: flex; align-items: center; gap: 4px; min-width: 0; }
.task-step-heading > .platform-section-title { margin: 0; }
.task-step textarea { width: 100%; min-height: 132px; padding: 11px 12px; border: 1.5px solid var(--control-border); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.task-step textarea:focus { border-color: var(--brand); outline: 0; }
.task-proof { display: grid; gap: 8px; min-width: 0; }
.task-proof-choose { position: relative; display: grid; place-items: center; align-content: center; gap: 8px; height: 100%; min-height: 168px; padding: 16px; border: 1.5px dashed #8ab8b1; border-radius: 14px; background: #f5fbf9; color: var(--brand-dark); font: inherit; font-size: 14px; cursor: pointer; }
.task-proof-choose span { color: var(--muted); font-size: 12px; font-weight: 600; }
.task-proof-gallery { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.task-proof-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.task-proof-tile { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0b1c19; }
.task-proof-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.task-proof-tile.is-busy img { opacity: .45; }
.task-proof-tile.is-file { display: grid; place-items: center; align-content: center; gap: 2px; padding: 8px 6px; background: #f5fbf9; color: var(--brand-dark); text-align: center; }
.task-proof-tile.is-file svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.task-proof-tile.is-file.is-busy { opacity: .55; }
.task-proof-file-ext { color: var(--brand-dark); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.task-proof-file-name { display: -webkit-box; max-width: 100%; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.task-proof-tile .task-proof-remove { top: 5px; right: 5px; width: 26px; height: 26px; font-size: 17px; }
.task-proof-add { display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 1; padding: 0; border: 1.5px dashed #8ab8b1; border-radius: 12px; background: #f5fbf9; color: var(--brand-dark); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.task-proof-add svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.task-proof-add:hover { border-color: var(--brand); background: #e3f3ee; }
.task-proof-count { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.task-proof-choose svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.task-proof-choose:hover, .task-proof-choose:focus-within, .task-proof.is-dragging .task-proof-choose { border-color: var(--brand); background: #e3f3ee; }
.task-proof-choose:focus-within { box-shadow: 0 0 0 3px rgba(15, 118, 110, .16); }
/* Ô nhận ảnh dán phủ kín khung để bấm vào đâu cũng focus; chữ và con trỏ ẩn, chỉ nhận Ctrl+V / nhấn giữ Dán. */
.task-proof-paste-target { position: absolute; inset: 0; z-index: 0; border-radius: inherit; color: transparent; caret-color: transparent; cursor: pointer; outline: 0; overflow: hidden; }
.task-proof-choose > :not(.task-proof-paste-target) { position: relative; z-index: 1; pointer-events: none; }
.task-proof-choose > .task-proof-pick { pointer-events: auto; margin-top: 4px; min-height: 36px; padding: 0 14px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.task-proof-choose > .task-proof-pick:hover { border-color: var(--brand); }
.task-proof-gallery { position: relative; }
.task-proof-gallery > .task-proof-paste-target { border-radius: 14px; }
.task-proof-gallery > :not(.task-proof-paste-target) { position: relative; z-index: 1; }
.task-proof-gallery:focus-within .task-proof-count { color: var(--brand-dark); }
/* Ô Liên kết: một hàng gọn dưới ô chứng từ, dán là thêm ngay; thẻ liên kết cùng cỡ với thẻ tệp. */
.task-proof-link { display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-proof-link > svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: var(--brand-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-proof-link-input { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 12px; border: 1.5px solid var(--control-border); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.task-proof-link-input:focus { border-color: var(--brand); outline: 0; }
.task-proof-link-add { flex: 0 0 auto; min-width: 64px; height: 40px; padding: 0 14px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.task-proof-link-add:hover:not(:disabled) { border-color: var(--brand); }
.task-proof-link-input:disabled, .task-proof-link-add:disabled { opacity: .6; cursor: default; }
.task-proof-tile.is-link .task-proof-file-name { pointer-events: auto; text-decoration: underline; text-underline-offset: 2px; }
.task-proof-remove { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .62); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { #notificationDetailModal .sheet-card, #operationsEditorModal[data-detail-popup] .sheet-card, .notification-detail-icon { animation: none; } }
/* Menu ba chấm của panel thông báo */
.notifications-menu-wrap { position: relative; }
.notifications-menu { position: absolute; z-index: 6; top: calc(100% + 6px); right: 0; display: flex; flex-direction: column; min-width: 276px; padding: 6px; border-radius: 12px; background: #fff; box-shadow: 0 8px 28px rgba(15, 34, 30, .22), 0 0 0 1px var(--line); }
.notifications-menu.hidden { display: none; }
.notifications-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.notifications-menu-item:hover:not(:disabled), .notifications-menu-item:focus-visible { background: var(--surface-soft); outline: none; }
.notifications-menu-item:disabled { color: var(--muted); cursor: default; }
.notifications-menu-item svg { flex: 0 0 20px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notifications-sound-icon { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; }
.notifications-panel:not([data-layout="fullscreen"]) [data-close] { display: none; }.notifications-heading.history-heading > .notifications-menu-wrap { flex: 0 0 auto; overflow: visible; margin-left: auto; display: block; }
/* Nút Lọc thông báo (hành động / nhân viên) đứng trước nút ⋯, cùng khung nút header; đang lọc thì viền, nền xanh nhạt và chấm thương hiệu. Máy chủ chưa hỗ trợ lọc hoặc đang ở tab Công việc thì ẩn nhưng vẫn giữ chỗ nên header không nhảy. */
.notifications-heading.history-heading > .notifications-filter { flex: 0 0 auto; margin-left: auto; }
.notifications-heading.history-heading > .notifications-filter + .notifications-menu-wrap { margin-left: 0; }
.notifications-filter.is-unavailable, .notifications-panel[data-view="tasks"] .notifications-filter { visibility: hidden; }
.notifications-filter[aria-pressed="true"], .notifications-filter[aria-pressed="true"]:not(:disabled):hover { border-color: var(--brand); background: var(--brand-light); }
.notifications-filter[aria-pressed="true"]::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-dark); }
/* Khung Lọc thông báo (web/notification-filter.js): hàng nút mảng lớn bọc dòng, rồi ô tìm nhân viên và danh sách cao cố định 6 dòng
   (Tất cả + 5 người) để khung không co giãn khi gõ tìm; dài hơn màn hình thì cuộn trong khung với thanh cuộn mảnh của dropdown. */
.notification-filter { padding: 4px 8px 8px; }
.notification-filter-areas { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 1px 10px; }
.notification-filter-area { min-height: 32px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.notification-filter-area:hover { background: #f0f6f4; }
.notification-filter-area[aria-pressed="true"], .notification-filter-area[aria-pressed="true"]:hover { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.notification-filter-area:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.notification-filter-areas + .app-filter-heading { padding-top: 10px; border-top: 1px solid var(--line); }
.notification-filter-people { display: flex; flex-direction: column; height: 216px; }
.notification-filter-people .app-filter-option { flex: 0 0 36px; min-height: 36px; padding-block: 0; }
.notification-filter-people .app-filter-option[aria-selected="true"] { background: var(--brand-light); color: var(--brand-dark); font-weight: 800; }
.notification-filter-people .app-filter-option[aria-selected="true"] > span:last-child { visibility: visible; }
.notification-filter-people[aria-busy="true"] > * { opacity: .55; }
.notification-filter-empty { padding: 10px 9px; color: var(--muted); font-size: 13px; }
/* Điện thoại hẹp (dưới 380px): hai tab gọn lại để đủ chỗ cho nút lọc, ⋯ và X trên cùng một hàng, không đè chữ tab. */
@media (max-width: 379px) {
  .notifications-panel .notifications-heading.history-heading > .notifications-views { gap: 0; margin-left: -7px; }
  .notifications-panel .notifications-view-tab { padding-inline: 7px; font-size: 14px; }
  .notifications-panel .notifications-view-tab::after { left: 7px; right: 7px; }
}
/* Đổi bộ lọc: các dòng đang thấy mờ nhẹ tới khi có kết quả, không thay bằng vòng tải. */
.notifications-scroll[aria-busy="true"] > .notification-row { opacity: .55; }
/* Thông báo có danh sách hàng (nhập kho, hết hàng): hộp rộng và cao hơn để tên hàng dài hiện đủ. */
#notificationDetailModal.has-items.modal.compact-modal > .sheet-card { width: min(520px, calc(100vw - 32px)); max-width: 520px; }
#notificationDetailModal.has-items .notification-detail-items { max-height: min(460px, 56vh); }
#notificationDetailModal.has-items .notification-detail-body > * { flex-shrink: 0; }
.notification-detail-items { display: flex; flex-direction: column; max-height: min(260px, 38vh); overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.notification-detail-item { display: flex; justify-content: space-between; gap: 14px; width: 100%; padding: 9px 12px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; line-height: 1.4; text-align: left; }
button.notification-detail-item { cursor: pointer; }
button.notification-detail-item:hover, button.notification-detail-item:focus-visible { background: var(--surface-soft); }
button.notification-detail-item:hover span, button.notification-detail-item:focus-visible span { text-decoration: underline; text-underline-offset: 2px; }
button.notification-detail-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.notification-detail-item + .notification-detail-item { border-top: 1px solid var(--line); }
.notification-detail-item span { min-width: 0; overflow-wrap: anywhere; }
.notification-detail-item strong { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.notification-detail-more { padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
/* Hai tab Thông báo / Công việc thay tiêu đề của panel Thông báo; tab đầu thẳng hàng chữ với các dòng bên dưới. */
/* Gạch chân tab đang chọn nằm đè lên chính đường kẻ dưới header (tab kéo dài xuống tới đường kẻ), nên hàng tab chỉ có một đường kẻ; chữ vẫn canh giữa cùng hàng với nút ⋯. */
.notifications-heading.history-heading > .notifications-views { flex: 1 1 auto; align-self: stretch; align-items: stretch; gap: 6px; margin: 0 0 calc(-1 * (var(--header-padding-bottom) + 1px)) -10px; overflow: visible; }
.notifications-view-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; min-height: 36px; padding: 0 10px calc(var(--header-padding-bottom) + 1px); border: 0; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-size: 16px; font-weight: 650; line-height: 22px; white-space: nowrap; cursor: pointer; transition: color .15s ease; }
.notifications-view-tab:not(.is-active):hover { background: transparent; color: var(--ink); }
.notifications-view-tab.is-active { color: var(--brand-dark); font-weight: 750; }
.notifications-view-tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background-color .15s ease; }
.notifications-view-tab.is-active::after { background: var(--brand-dark); }
.notifications-view-tab:focus-visible { outline: none; }
.notifications-view-tab:focus-visible > span:first-child { border-radius: 4px; outline: 2px solid var(--brand); outline-offset: 3px; }
.notifications-view-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.notifications-panel[data-view="tasks"] .notifications-menu-wrap { visibility: hidden; }
.notification-row.is-task .notification-copy time { display: none; }
.notifications-tasks-more { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.notification-task-description { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-detail-loading > span:empty:not(.history-spinner), .cold-panel-state > span:empty:not(.history-spinner), .panel-loading-layer > span:empty:not(.history-spinner) { display: none; }
.cold-panel-state, .history-detail-loading, .panel-loading-layer { gap: 16px; }
.history-loading { gap: 12px; }
.cold-panel-state .history-spinner, .history-detail-loading .history-spinner, .panel-loading-layer .history-spinner { margin-bottom: 2px; }

/* Danh sách gợi ý (tìm khách, đại lý, mã số thuế...) dùng cùng kiểu với ô thả xuống của app: khung bo 11px đệm 5px, dòng bo 8px, dòng đang chọn nền xanh nhạt. */
.suggestions { padding: 5px; border: 1px solid #b8cfca; border-radius: 11px; box-shadow: 0 12px 28px rgba(29, 54, 49, .16); }
.suggestions button { min-height: 40px; padding: 8px 10px; border-bottom: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 650; }
.suggestions button.customer-suggestion { min-height: 44px; }
.suggestions button:hover, .suggestions button.is-retail-customer:hover { background: #f0f6f4; color: var(--ink); box-shadow: none; }
.suggestions button.is-retail-customer { background: var(--amber-light); }
.suggestions button.is-retail-customer:hover { background: #ffe9b8; }
.suggestions button:is(.is-keyboard-active, :focus-visible), .suggestions button.is-retail-customer:is(.is-keyboard-active, :focus-visible) { background: var(--brand-light); color: var(--brand-dark); box-shadow: none; }
.suggestions button + button { margin-top: 2px; }
.label-suggestions button { border-radius: 8px; }

/* Tải chi tiết đơn hàng: chỉ một vòng tải và dòng "Đang tải đơn hàng" ở giữa panel, không dựng khung rỗng; thẻ đơn hiện trọn vẹn khi tải xong.
   Nút X vẫn ở góc header để thoát ngay khi đổi ý. Hộp thoại giữ nguyên kích thước nên không nhảy bố cục khi dữ liệu về. */
#historyDetailModal:has(#historyDetailLoading:not(.hidden)) > .history-detail-sheet { position: relative; }
#historyDetailModal:has(#historyDetailLoading:not(.hidden)) :is(#historyDetailCustomer, .cart-columns, #historyDetailItems, .cart-scroll-hint, .history-detail-footer) { visibility: hidden; }
#historyDetailModal:has(#historyDetailLoading:not(.hidden)) .cart-items-shell { position: static; }
#historyDetailModal #historyDetailLoading:not(.hidden) {
  position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; z-index: 9;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  border: 0; background: transparent; box-shadow: none; animation: none;
}
#historyDetailModal #historyDetailLoading:not(.hidden)::before, #historyDetailModal #historyDetailLoading:not(.hidden)::after { content: none !important; display: none !important; }
#historyDetailModal #historyDetailLoading .history-spinner { display: block; width: 22px; height: 22px; margin: 0; }
#historyDetailModal #historyDetailLoading .history-spinner.hidden { display: none; }
#historyDetailModal #historyDetailLoading > strong { font-size: 14px; }
/* Chi tiết chiết khấu / hoàn hàng tải giống chi tiết đơn hàng: một vòng tải ở giữa panel, không dựng khung rỗng. */
#discountDetailModal:has(#discountDetailLoading:not(.hidden)) > .discount-detail-sheet { position: relative; }
#discountDetailModal:has(#discountDetailLoading:not(.hidden)) :is(.document-scroll, .history-detail-footer) { visibility: hidden; }
#discountDetailModal .history-heading > .close-button { z-index: 10; }
#discountDetailModal #discountDetailLoading:not(.hidden) {
  position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; z-index: 9;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  border: 0; background: transparent; box-shadow: none; animation: none;
}
#discountDetailModal #discountDetailLoading:not(.hidden)::before, #discountDetailModal #discountDetailLoading:not(.hidden)::after { content: none !important; display: none !important; }
#discountDetailModal #discountDetailLoading .history-spinner { display: block; width: 22px; height: 22px; margin: 0; }
#discountDetailModal #discountDetailLoading .history-spinner.hidden { display: none; }
#discountDetailModal #discountDetailLoading > strong { font-size: 14px; }
/* Mở đơn từ Đơn đang xử lý (hoặc tạo đơn cho nhân viên khác) khi chưa có dữ liệu: cả panel chỉ còn nút X và một vòng tải "Đang tải đơn hàng" ở giữa,
   không hiện tiêu đề khách, cột hay chân panel; giống tải chi tiết đơn hàng. */
#cartModal .cart-sheet:has(> .panel-navigation-state) { position: relative; }
#cartModal .cart-sheet:has(> .panel-navigation-state) > :not(.panel-navigation-state):not(.cold-panel-state):not(.close-button) { visibility: hidden; }
#cartModal .cart-sheet:has(> .panel-navigation-state) > .close-button { z-index: 10; }
#cartModal .cart-sheet > .panel-navigation-state {
  position: absolute !important; inset: 0 !important; top: 0 !important; left: 0 !important; width: auto !important; height: auto !important; z-index: 9;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  border: 0; border-radius: 0; background: var(--surface); box-shadow: none; animation: none;
}
#cartModal .cart-sheet > .panel-navigation-state .history-spinner { display: block; width: 22px; height: 22px; margin: 0; }
#cartModal .cart-sheet > .panel-navigation-state .history-spinner.hidden { display: none; }
#cartModal .cart-sheet > .panel-navigation-state > strong { font-size: 14px; }
/* Vùng hàng của đơn đang tải (holdCartForLabels): chân panel (tổng số lượng/tiền và các nút) chỉ hiện cùng nội dung đơn khi tải xong.
   visibility giữ nguyên chỗ nên bố cục không nhảy khi hiện lại, và nút ẩn không bấm hay tab tới được. */
#cartModal .cart-items-shell[data-loading-presentation="region"] ~ #cartOrderFooter { visibility: hidden; }
.employee-permission-heading.is-admin { color: var(--danger); }
.employee-permission-heading.is-admin::before { background: var(--danger); }

/* Danh sách thả xuống (ô chọn, gợi ý, bộ chọn nhân viên/ngân hàng/đơn vị...): hiện thanh cuộn khi nội dung dài hơn khung để biết còn cuộn xuống được,
   tự ẩn khi đã hiện hết (không chừa chỗ cho thanh cuộn). Thanh cuộn là một đường kẻ mảnh màu xanh ngọc, không có mũi tên ở hai đầu, giống thanh cuộn của cột Thông báo.
   Không dùng hiệu ứng mờ cho các danh sách này. */
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker) { scrollbar-width: auto; scrollbar-color: auto; scrollbar-gutter: auto; }
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker)::-webkit-scrollbar { display: block; width: 9px; height: 9px; }
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker)::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker)::-webkit-scrollbar-track { border-left: 4px solid transparent; border-right: 4px solid transparent; background: rgba(15, 118, 110, .14); background-clip: padding-box; }
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker)::-webkit-scrollbar-thumb { min-height: 36px; border: 3px solid transparent; border-radius: 999px; background: #34827b; background-clip: padding-box; }
:is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker)::-webkit-scrollbar-thumb:hover { border-width: 2px; background-color: #0f766e; }
@supports (-moz-appearance: none) {
  :is(.workflow-assignment-picker, .app-dropdown-list, .suggestions, .history-seller-picker, .debt-payment-bank-picker, .create-product-unit-picker, .history-order-transfer-options, .working-location-picker, .app-filter-options, .app-filter-picker) { scrollbar-width: thin; scrollbar-color: #34827b transparent; }
}

/* Chi tiết lần điều chuyển: các danh sách dính liền như hộp chi tiết thông báo, seri nhóm theo mã tem. */
.label-detail-view { display: flex; flex-direction: column; gap: 10px; padding-top: var(--panel-content-gap, 12px); }
.label-detail-view > .platform-section-title { margin: 8px 0 0; }
.label-detail-serials { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.label-detail-serial-group { padding: 8px 8px 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.label-detail-serial-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-detail-serial-head > strong { color: var(--brand-dark); font-size: 13px; }
/* Nút sao chép cùng khung 32×36px với các nút biểu tượng của app; seri bôi đen chọn được. */
.label-serial-copy { display: inline-grid; place-items: center; width: 32px; height: 36px; flex: 0 0 32px; padding: 0; border: 1px solid var(--control-border); border-radius: var(--control-radius); background: var(--surface); color: var(--brand-dark); cursor: pointer; }
.label-serial-copy:hover { background: #f2f8f6; }
.label-serial-copy:disabled { color: var(--text-disabled); background: var(--surface-disabled); cursor: not-allowed; }
/* Trang xác thực tem: tên miền (trạng thái + bản ghi DNS), giao diện trang và xem trước. */
.label-site { display: grid; gap: 8px; min-width: 0; }
.label-site-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.label-site-heading:not(:first-child) { margin-top: 8px; }
.label-site-heading > .operations-section { flex: 1; margin: 0; padding: 0; font-size: 15px; }
.label-site-heading > button.hidden { display: block !important; visibility: hidden; }
.label-site :is(.label-site-heading, .label-site-control) > .secondary-button { width: auto; flex: none; min-height: 32px; margin: 0; padding: 0 12px; font-size: 12.5px; }
.label-site-control { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 10px; border-left: 1px solid var(--line); }
.label-site-control :is(img, button).hidden { display: none; }
.label-site-control .label-serial-copy { flex: none; width: 32px; height: 32px; min-height: 32px; }
.label-site-control .task-chip { min-width: 0; min-height: 28px; padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
.label-site-fixed { grid-column: 2; grid-row: 1; display: flex; align-items: center; min-width: 0; padding: 0 10px; border-left: 1px solid var(--line); color: var(--muted); font-size: var(--form-value-size); font-weight: 650; overflow-wrap: anywhere; }
.label-site-fixed.hidden { display: none; }
.label-site-record { overflow: hidden; border: 1px solid #c5d5d1; border-radius: 13px; background: var(--surface); }
.label-grid-record { grid-template-columns: 50px minmax(28px, 1fr) minmax(128px, 2.2fr) 32px; }
.label-site-record > .label-grid.label-grid-record { column-gap: 7px; }
.label-site-record > .work-task-columns { position: static; }
.label-site-record > .work-task-columns > * { display: flex; align-items: center; overflow: visible; }
.label-site-record .information-help-button { height: 28px; min-height: 0; margin: -6px 0; }
.label-site-record > .label-grid:last-child { min-height: 44px; font-size: 12.5px; font-weight: 650; }
.label-site-value { min-width: 0; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.label-site-logo-frame { display: grid; place-items: center; flex: 0 1 72px; min-width: 0; height: 32px; overflow: hidden; border: 1px dashed var(--control-border); border-radius: 7px; background: #fff; }
.label-site-logo-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.label-site-colors { gap: clamp(5px, 2vw, 10px); }
.label-site-color { flex: 0 1 22px; min-width: 0; aspect-ratio: 1; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); cursor: pointer; }
.label-site-color[aria-checked="true"] { box-shadow: 0 0 0 2px var(--swatch); }
.label-site-preview { width: 100%; text-align: left; height: min(540px, calc(100dvh - 220px)); margin: 12px 0 0; overflow-y: auto; scrollbar-width: none; border: 1px solid #c5d5d1; border-radius: 13px; background: #f3f6f5; }
.label-dns-steps { display: grid; gap: 10px; margin: 0; padding: 0 0 4px 20px; text-align: left; font-size: 14px; line-height: 1.5; }
.label-dns-steps strong { overflow-wrap: anywhere; color: var(--brand-dark); }
.label-serial-copy.is-done { border-color: #b9ddd3; background: #e3f3ee; color: #0f766e; }
.label-serial-copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.label-detail-serial-group > p,.label-detail-serial-more { margin: 0; padding-right: 6px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; cursor: text; }

/* Danh sách tem (lịch sử điều chuyển, mã tem đã gán, danh sách mã tem, tem đại lý đang giữ) cùng kiểu danh sách lịch sử hàng hoá:
   khung viền #c5d5d1 bo 13px, tiêu đề cột 11.5px đậm trên nền #f4f8f7, dòng cao 40px chữ đậm hơn, các cột cách nhau đều. */
.work-task-table:has(.label-grid) { border-color: #c5d5d1; border-radius: 13px; }
.label-grid { column-gap: 14px; }
.work-task-columns.label-grid { min-height: 40px; padding-top: 9px; padding-bottom: 9px; border-bottom-color: #d5e0dd; background: #f4f8f7; color: #41534f; font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.work-task-row.label-grid { height: 40px; min-height: 40px; padding-top: 0; padding-bottom: 0; border-bottom-color: #d5e0dd; font-size: 12px; }
.work-task-row.label-grid > span { color: #2f423e; font-weight: 600; line-height: 1.3; }
.work-task-row.label-grid > :nth-child(2),.work-task-row.label-grid-pair > :first-child { color: #172925; font-size: 13px; font-weight: 650; }
.work-task-row.label-grid-history > :nth-child(3) { color: #172925; font-size: 13.5px; font-weight: 700; }
.work-task-row.label-grid.label-spent > span { color: var(--muted); }
.work-task-row.label-grid.is-bad > span { color: var(--danger); }
.work-task-row.label-grid:is(button,.is-actionable):hover { background: #f2f8f6; }
.label-grid-history { grid-template-columns: 96px minmax(0,1fr) 44px 112px; }
@media (max-width: 480px) { .label-grid-history { column-gap: 10px; grid-template-columns: 92px minmax(0,1fr) 40px 64px; } }

/* Chi tiết lần điều chuyển: spinner phủ panel cho tới khi tải xong, rồi hiện đủ biểu tượng, số tem, bảng sản phẩm và seri theo mã tem. */
.label-detail-sheet { position: relative; }
.label-detail-sheet .history-heading > .close-button { z-index: 10; }
#labelDetailLoading.label-detail-loading { justify-content: center; gap: 14px; padding: 24px 16px; background: var(--surface); text-align: center; }
#labelDetailLoading.label-detail-loading:not(.is-error) > span:not(.history-spinner) { color: var(--brand-dark); font-size: 14px; font-weight: 700; }
#labelDetailLoading.is-error > span:not(.history-spinner) { color: var(--danger); font-size: 13px; }
.label-detail-hero { padding-bottom: 4px; }
.label-detail-title { color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.label-detail-chips { margin-top: 6px; }
.label-detail-chip { min-height: 30px; padding: 0 11px; font-size: 12.5px; font-weight: 650; }
.label-detail-chip svg { width: 15px; height: 15px; flex-basis: 15px; color: var(--muted); }
.label-detail-chip-name { margin-right: -2px; color: var(--muted); font-weight: 600; }
.label-detail-note { margin: 4px 0 0; color: var(--ink); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.label-detail-note.hidden { display: none; }
.label-detail-products.product-history-list { display: block; flex: none; overflow: hidden; }
#labelDetailProducts :is(.product-history-columns,.product-history-row) { display: grid; grid-template-columns: minmax(0,1fr) max-content; column-gap: 14px; }
#labelDetailProducts .product-history-row { height: auto; min-height: 40px; }
#labelDetailProducts .product-history-row:last-child { border-bottom: 0; }
#labelDetailProducts .product-history-customer { white-space: normal; overflow-wrap: anywhere; }
#labelDetailProducts .product-history-columns span:last-child { text-align: right; }
/* Chuyển đại lý: ô tìm đại lý cùng hàng với nút Điều chuyển màu thương hiệu; Huỷ điều chuyển là nút viền đỏ nằm cuối panel, tách khỏi phần chuyển. */
.label-detail-view { min-height: 100%; }
.label-detail-manage { display: flex; flex: 1 0 auto; flex-direction: column; gap: 10px; }
.label-detail-manage.hidden { display: none; }
.label-reassign-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.label-reassign-row > input { min-width: 0; }
:is(.label-reassign-button,.label-detail-cancel) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; margin: 0; padding: 0 16px; border-radius: var(--control-radius); font-size: 13.5px; font-weight: 750; white-space: nowrap; cursor: pointer; }
:is(.label-reassign-button,.label-detail-cancel) svg { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.label-reassign-button { border: 1px solid transparent; background: var(--button-brand); color: #fff; box-shadow: 0 6px 14px rgba(52, 130, 123, .2); }
.label-reassign-button:disabled { border-color: var(--border-disabled); background: var(--surface-disabled); color: var(--text-disabled); box-shadow: none; cursor: not-allowed; }
/* Huỷ điều chuyển cùng kiểu nút Đăng xuất: nền đỏ nhạt, viền đỏ nhạt, chữ đỏ. */
.label-detail-cancel { width: 100%; margin-top: auto; border: 1px solid #dca39b; background: #f9e2de; color: var(--danger); }
.label-detail-cancel:not(:disabled):hover { border-color: #cc8e85; background: #f5d5ce; }
.label-detail-cancel:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--danger); outline-offset: 1px; }
.label-detail-cancel:disabled { border-color: var(--border-disabled); background: var(--surface-disabled); color: var(--text-disabled); cursor: not-allowed; }
.label-reassign-row { margin-bottom: 8px; }
.label-grid-history > :nth-child(4) { text-align: right; }
/* Lần điều chuyển đã chuyển tiếp sang đại lý khác: nền vàng nhạt, tên ghi bên cũ → bên mới. Lần bị thu hồi: nền đỏ nhạt ngay trên dòng gốc như dòng xuất huỷ của lịch sử hàng hoá, ghi Đã thu hồi sau tên đại lý (màn hẹp: xuống hàng dưới trong cùng dòng 40px). */
.work-task-row.label-grid.is-release { background: #ffdfda; }
.work-task-row.label-grid.is-release:hover { background: #fdd3cc; }
.work-task-row.label-grid.is-release > :nth-child(2),.work-task-row.label-grid.is-release > :nth-child(3) { color: #b42318; }
.work-task-row.label-grid.is-moved { background: var(--amber-light); }
.work-task-row.label-grid.is-moved:hover { background: #ffe9c2; }
.work-task-row.label-grid.is-moved > :nth-child(2),.work-task-row.label-grid.is-moved > :nth-child(3) { color: #875800; }
.label-name-parts { display: flex; min-width: 0; }
.label-name-extra { display: flex; min-width: 0; }
.label-name-parts > :first-child,.label-moved-to { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
.label-moved-to { margin-left: 4px; }
.label-recalled-tag { flex: none; white-space: nowrap; }
.label-recalled-tag::before { content: "\00a0- "; }
@media (max-width: 480px) {
  .label-name-parts { flex-direction: column; }
  .label-name-extra { font-size: 11.5px; font-weight: 600; }
  .label-moved-to { margin-left: 0; }
  .label-recalled-tag:first-child::before { content: none; }
}
/* Người chuyển, người thu hồi: các dòng cuối panel chi tiết, cùng nền với dòng trong danh sách. */
.label-detail-follow-ups { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 8px; }
.label-detail-follow-ups.hidden { display: none; }
.label-detail-follow-up { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; min-height: 40px; padding: 6px 14px; border-radius: 12px; background: #ffdfda; color: #b42318; font-size: 13px; font-weight: 650; }
.label-detail-follow-up.is-move { background: var(--amber-light); color: #875800; }
.label-detail-follow-up > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.label-detail-follow-up strong { min-width: 0; font-weight: 750; overflow-wrap: anywhere; }
.label-detail-follow-up :is(.label-detail-chip-name,.label-detail-follow-up-count) { flex: none; margin: 0; color: inherit; }
.label-detail-follow-up > .label-detail-follow-up-when { flex: none; white-space: nowrap; }
.label-detail-follow-up svg { width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Cột tên sản phẩm/mã trong các danh sách tem nhỏ và nhẹ hơn để hiện được nhiều tên hơn; cột seri sát về bên phải. */
.work-task-row.label-grid:is(.label-grid-assign,.label-grid-codes,.label-grid-hold) > :nth-child(2) { font-size: 12.5px; font-weight: 600; }
/* Tra cứu mã QR: lịch sử của một tem (Thời gian, Thao tác, Người thực hiện) và bảng tóm tắt khoảng seri; chip Đang thuộc giữ màu trạng thái trong bảng. */
.label-grid-trail { grid-template-columns: 104px minmax(0,1fr) 120px; }
.label-grid-trail > :nth-child(3) { text-align: right; }
.work-task-row.label-grid-trail.is-release { background: #ffdfda; }
.work-task-row.label-grid-trail.is-release > :nth-child(2) { color: #b42318; }
.label-lookup-product-cell > :is(.category-pill,.source-pill) { margin-right: 6px; vertical-align: middle; }
.work-task-row.label-grid > .label-holder-status { justify-self: start; color: var(--brand-dark); font-size: 12px; font-weight: 750; line-height: 18px; }
.work-task-row.label-grid > .label-holder-status.status-dispatched { color: #875800; }
@media (max-width: 480px) { .label-grid-trail { column-gap: 10px; grid-template-columns: 90px minmax(0,1fr) 76px; } }
/* Bảng nhiều cột: cột đầu canh trái, cột cuối canh phải (tiêu đề và từng dòng). */
.employee-columns > :last-child, .employee-record > :last-child, .work-task-grid > :last-child, .task-template-grid > :last-child { text-align: right; }
.employee-record > :last-child { justify-content: flex-end; }
.employee-branch-summary { text-align: right; }

/* Khách kênh bán (Shopee, TikTok Shop, Facebook): biểu tượng và màu của sàn trên dòng gợi ý khách, khung khách hàng của đơn và chip khách đã chọn. */
.sales-channel-logo { display:inline-block; flex:none; width:1.15em; height:1.15em; margin-right:6px; vertical-align:-.2em; background:currentColor; -webkit-mask:var(--sales-channel-logo) center/contain no-repeat; mask:var(--sales-channel-logo) center/contain no-repeat; }
.sales-channel-logo[data-sales-channel="shopee"] { --sales-channel-logo:url(/channel-shopee.svg); color:#ee4d2d; }
.sales-channel-logo[data-sales-channel="tiktokshop"] { --sales-channel-logo:url(/channel-tiktok.svg); color:#111; }
.sales-channel-logo[data-sales-channel="facebook"] { --sales-channel-logo:url(/channel-facebook.svg); color:#1877f2; }
.suggestions button.is-channel-customer[data-sales-channel="shopee"] { color:#b83a1f; background:#fff1ed; font-weight:700; }
.suggestions button.is-channel-customer[data-sales-channel="shopee"]:hover { background:#ffe4dc; }
.suggestions button.is-channel-customer[data-sales-channel="tiktokshop"] { color:#0b2e2d; background:#e9fafa; font-weight:700; }
.suggestions button.is-channel-customer[data-sales-channel="tiktokshop"]:hover { background:#d8f5f4; }
.suggestions button.is-channel-customer[data-sales-channel="facebook"] { color:#0f4cb3; background:#edf3ff; font-weight:700; }
.suggestions button.is-channel-customer[data-sales-channel="facebook"]:hover { background:#dde9ff; }
.suggestions button.is-channel-customer:is(.is-keyboard-active, :focus-visible) { box-shadow:inset 4px 0 0 var(--brand); }
.cart-customer[data-sales-channel="shopee"] { --customer-panel-bg:linear-gradient(135deg,#fff6f3 0%,#ffd9cd 100%); --customer-panel-border:#ee4d2d; --customer-panel-bg-hover:linear-gradient(135deg,#ffeee9 0%,#ffc9b9 100%); }
.cart-customer[data-sales-channel="shopee"] strong { color:#b83a1f; }
.cart-customer[data-sales-channel="tiktokshop"] { --customer-panel-bg:linear-gradient(135deg,#f3fefe 0%,#cdf3f1 100%); --customer-panel-border:#25c5c0; --customer-panel-bg-hover:linear-gradient(135deg,#e8fbfa 0%,#b9ebe8 100%); }
.cart-customer[data-sales-channel="tiktokshop"] strong { color:#0b2e2d; }
.cart-customer[data-sales-channel="facebook"] { --customer-panel-bg:linear-gradient(135deg,#f3f7ff 0%,#d3e2ff 100%); --customer-panel-border:#1877f2; --customer-panel-bg-hover:linear-gradient(135deg,#e8f0ff 0%,#c2d7ff 100%); }
.cart-customer[data-sales-channel="facebook"] strong { color:#0f4cb3; }
.selected-customer[data-sales-channel="shopee"], .draft-editor .selected-customer[data-sales-channel="shopee"] { border-color:#ee4d2d; color:#b83a1f; background:#fff1ed; }
.selected-customer[data-sales-channel="tiktokshop"], .draft-editor .selected-customer[data-sales-channel="tiktokshop"] { border-color:#25c5c0; color:#0b2e2d; background:#e9fafa; }
.selected-customer[data-sales-channel="facebook"], .draft-editor .selected-customer[data-sales-channel="facebook"] { border-color:#1877f2; color:#0f4cb3; background:#edf3ff; }
/* Đối tác phân phối (migration 0140): biểu tượng bắt tay nền xanh ngọc ở gợi ý khách khi tạo đơn và ở dòng của họ trong panel Khách hàng. */
.suggestions button.is-distribution-partner { color:var(--brand-dark); background:#e6f4f1; font-weight:750; }
.suggestions button.is-distribution-partner:hover { color:var(--brand-dark); background:#d5ece7; }
.suggestions button.is-distribution-partner:is(.is-keyboard-active, :focus-visible) { background:var(--brand-light); box-shadow:inset 4px 0 0 var(--brand); }
.debt-customer .debt-customer-copy { display:flex; align-items:center; gap:9px; }
.debt-customer .debt-customer-copy strong { min-width:0; }
/* Bộ biểu tượng loại khách dùng chung (`customerKindMarkup` trong retail-customer.js): cùng khung bo góc, cùng nét, chỉ khác cỡ theo nơi đặt.
   Khách thường: nền xanh ngọc nhạt, người xanh ngọc. Đối tác phân phối: nền xanh ngọc đậm, bắt tay trắng. Khách lẻ: hổ phách. Khách sàn: logo trên nền trắng. */
.customer-kind-mark { flex:none; display:inline-grid; place-items:center; width:22px; height:22px; border-radius:7px; color:var(--brand); background:#e2f1ee; box-shadow:inset 0 0 0 1px #c3e1da; vertical-align:middle; }
.customer-kind-mark svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.customer-kind-mark .sales-channel-logo { width:15px; height:15px; margin:0; vertical-align:0; }
.customer-kind-mark[data-customer-kind="partner"] { color:#fff; background:var(--brand); box-shadow:inset 0 0 0 1px var(--brand-dark), 0 1px 2px rgba(10,91,85,.25); }
.customer-kind-mark[data-customer-kind="retail"] { color:var(--profit-ink); background:#ffe9bd; box-shadow:inset 0 0 0 1px #f3cf86; }
.customer-kind-mark[data-customer-kind="channel"] { background:#fff; box-shadow:inset 0 0 0 1px #d6e3e0; }
.customer-kind-mark[data-sales-channel="shopee"] { box-shadow:inset 0 0 0 1px #ffc4b5; }
.customer-kind-mark[data-sales-channel="tiktokshop"] { box-shadow:inset 0 0 0 1px #a9e7e4; }
.customer-kind-mark[data-sales-channel="facebook"] { box-shadow:inset 0 0 0 1px #bcd2ff; }
.customer-kind-mark.is-choice { width:28px; height:28px; border-radius:9px; }
.customer-kind-mark.is-choice svg, .customer-kind-mark.is-choice .sales-channel-logo { width:18px; height:18px; }
/* Bộ lọc người bán ở lịch sử Đơn hàng: nhân viên có hình người, ba kênh bán (đơn khách kênh ghi doanh số cho kênh) có logo nền trắng và màu của kênh như gợi ý chọn khách. */
.history-seller-option:has(> .customer-kind-mark) { gap:9px; }
.history-seller-option.is-channel-seller { margin-top:3px; }
.history-seller-option.is-channel-seller[data-sales-channel="shopee"] { color:#b83a1f; background:#fff1ed; }
.history-seller-option.is-channel-seller[data-sales-channel="shopee"]:is(:hover, [aria-selected="true"]) { background:#ffe4dc; }
.history-seller-option.is-channel-seller[data-sales-channel="tiktokshop"] { color:#0b2e2d; background:#e9fafa; }
.history-seller-option.is-channel-seller[data-sales-channel="tiktokshop"]:is(:hover, [aria-selected="true"]) { background:#d8f5f4; }
.history-seller-option.is-channel-seller[data-sales-channel="facebook"] { color:#0f4cb3; background:#edf3ff; }
.history-seller-option.is-channel-seller[data-sales-channel="facebook"]:is(:hover, [aria-selected="true"]) { background:#dde9ff; }
.history-seller-option.is-channel-seller[aria-selected="true"] { box-shadow:inset 4px 0 0 var(--brand); }
/* Đơn hoàn của khách kênh bán: thay ô chọn nhân viên bằng tên kênh bị trừ doanh thu, cùng khung ô chọn và màu kênh như khách đã chọn ở Tạo đơn. */
.order-return-channel { box-sizing:border-box; display:flex; align-items:center; gap:8px; min-width:0; height:100%; padding:5px 10px; border-left:1px solid var(--line); border-radius:0 9px 9px 0; background:var(--surface); font-size:var(--form-value-size); font-weight:700; }
.order-return-channel[data-sales-channel="shopee"] { color:#b83a1f; background:#fff1ed; }
.order-return-channel[data-sales-channel="tiktokshop"] { color:#0b2e2d; background:#e9fafa; }
.order-return-channel[data-sales-channel="facebook"] { color:#0f4cb3; background:#edf3ff; }
/* Bộ lọc loại khách cùng hàng, bên phải ô tìm kiếm; rộng cố định để đổi lựa chọn không làm ô tìm co giãn. */
.debt-search-row { flex:0 0 auto; display:grid; grid-template-columns:minmax(0,1fr) 168px; gap:8px; margin:0 0 8px; }
.debt-search-row > .debt-search { margin:0; }
.debt-search-row .debt-partner-filter { width:100%; min-width:0; height:42px; min-height:42px; justify-content:space-between; gap:6px; padding:0 10px; border-color:#c8d9d5; border-radius:11px; color:var(--ink); font-size:13px; font-weight:650; }
.debt-search-row .debt-partner-filter > span { position:static; flex:1; min-width:0; width:auto; height:auto; clip-path:none; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; text-align:left; }
.debt-search-row .debt-partner-filter > svg { flex:0 0 16px; width:16px; height:16px; }
.debt-search-row .debt-partner-filter[aria-pressed="true"]::after { content:none; }
.debt-search-row .debt-partner-filter:disabled { cursor:default; opacity:.6; }
@media (max-width: 520px) { .debt-search-row { grid-template-columns:minmax(0,1fr) 140px; } }
@media (max-width: 520px) { .debt-search-row.cashbook-filters { grid-template-columns: minmax(0,1fr) 124px; } }
/* Chào hàng nhanh (docs/quick-offer.md): khung cố định, lưới ảnh vuông cuộn bên trong; ô đang chọn viền thương hiệu và dấu tích. */
.compact-modal > .quick-offer-card { height: min(640px, 90dvh); }
.quick-offer-card > .history-heading { flex: 0 0 auto; }
.quick-offer-toolbar { flex: 0 0 auto; display: flex; align-items: stretch; justify-content: space-between; gap: 8px; min-height: 36px; padding: var(--panel-content-gap) var(--header-inset) 8px; }
.quick-offer-toggle { flex: 0 0 auto; height: 36px; min-height: 36px; padding: 0 14px; font-size: 13px; }
.quick-offer-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 var(--header-inset) 12px; user-select: none; -webkit-user-select: none; }
.quick-offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.quick-offer-tile { position: relative; display: flex; flex-direction: column; aspect-ratio: 1 / 1; min-width: 0; padding: 0; overflow: hidden; border: 2px solid var(--brand); border-radius: 12px; background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.quick-offer-tile img { display: block; flex: 1 1 0; width: 100%; height: 100%; min-height: 0; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: opacity .12s ease; }
/* Máy tính: kéo ảnh (đã đổi sang ảnh to có nhãn) ra Zalo/Telegram. */
/* Lớp ảnh to có nhãn, trong suốt, phủ đúng ô: kéo lớp này ra là ảnh gửi đi; ảnh nhỏ và nhãn xem trước bên dưới không đổi. */
.quick-offer-tile img.quick-offer-drag { position: absolute; inset: 0; opacity: 0; -webkit-user-drag: element; cursor: grab; }
.quick-offer-tile .quick-offer-label, .quick-offer-tile .quick-offer-check { z-index: 1; }
/* Chọn kho: nút Kho dùng chung (createLocationChip), chiếm phần lớn hàng; Lọc hàng: cùng cỡ ô lọc ở danh sách Hàng hoá
   (36%, tối đa 200px). Hai ô cùng là dropdown chung createFilterMenu, cùng cao. */
.quick-offer-toolbar .app-filter-dropdown { flex: 0 0 36%; width: 36%; max-width: 200px; min-width: 0; height: auto; min-height: 40px; justify-content: space-between; gap: 8px; padding: 0 10px; color: var(--ink); font-size: 13px; font-weight: 650; }
.quick-offer-toolbar .location-chip { flex: 1 1 auto; max-width: none; height: auto; min-height: 40px; font-size: 13px; }
.quick-offer-toolbar .app-filter-dropdown > span { position: static; flex: 1; min-width: 0; width: auto; height: auto; clip-path: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.quick-offer-toolbar .app-filter-dropdown > svg { width: 16px; height: 16px; flex-basis: 16px; }
.quick-offer-toolbar .app-filter-dropdown[aria-pressed="true"]::after { content: none; }
/* Bật/tắt nhãn tên hàng (dải đỏ tên dòng + biến thể) cho cả lưới xem và ảnh tải/chia sẻ; ô vuông cùng cao hàng công cụ, tắt thì gạch chéo. */
.quick-offer-toolbar .quick-offer-labels { flex: 0 0 40px; width: 40px; min-width: 40px; height: auto; min-height: 40px; }
.quick-offer-labels[aria-pressed="false"] { color: var(--muted); }
.quick-offer-labels[aria-pressed="true"] .quick-offer-labels-slash { display: none; }
.quick-offer-grid.is-unlabeled .quick-offer-label { display: none; }
.quick-offer-tile.is-preparing::after { content: ""; position: absolute; inset: calc(50% - 12px) auto auto calc(50% - 12px); width: 24px; height: 24px; border: 3px solid rgba(255, 255, 255, .85); border-top-color: var(--brand); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); animation: spin .7s linear infinite; pointer-events: none; }
.quick-offer-marquee { position: absolute; z-index: 2; border: 1px solid var(--brand); border-radius: 3px; background: rgba(15, 118, 110, .12); pointer-events: none; }
/* Mọi ô cùng khung xanh thương hiệu 2px, chọn hay chưa chọn như nhau (dấu tích ở góc là dấu chọn duy nhất). */
.quick-offer-tile:focus-visible { outline: var(--focus-width) solid var(--brand); outline-offset: 2px; }
.quick-offer-check { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid #c5d5d1; border-radius: 50%; background: rgba(255, 255, 255, .92); color: transparent; }
.quick-offer-tile[aria-selected="true"] .quick-offer-check { border-color: var(--brand); background: var(--brand); color: #fff; }
.quick-offer-check svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.quick-offer-empty { padding: 32px 12px; text-align: center; }
.quick-offer-actions { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; margin: 0; padding: 10px var(--header-inset) 12px; border-top: 1px solid var(--line); }
.quick-offer-actions > button { min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#quickOfferSend:not([data-method="download"]) .quick-offer-icon-download, #quickOfferSend[data-method="download"] .quick-offer-icon-send { display: none; }
.quick-offer-actions svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.panel-header-command.quick-offer-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* Điện thoại hẹp: nút Chào hàng nhanh chỉ còn biểu tượng để header không tràn. */
/* Danh sách Hàng hoá: Chào hàng nhanh ưu tiên đủ chữ để nổi bật (thiếu chỗ cho tên panel thì thu về biểu tượng, is-compact); nút menu luôn là biểu tượng. */
.panel-header-command.quick-offer-open { flex: 0 0 auto; white-space: nowrap; }
.panel-header-command.quick-offer-open[hidden] { display: none; }
.panel-header-command.quick-offer-open.is-compact { flex-basis: var(--panel-close-width); width: var(--panel-close-width); padding: 0; }
.panel-header-command.quick-offer-open.is-compact > span { display: none; }
/* Ô nhóm chào hàng: xem trước dải nhãn đỏ sẽ in lên ảnh khi gửi (tên nhóm + biến thể còn bán). */
/* Dải nhãn nối phía trên ảnh (như ảnh gửi đi): trọn bề ngang ô, ảnh co lại bên dưới, không đè lên ảnh. */
.quick-offer-label { flex: 0 0 auto; order: -1; display: grid; gap: 1px; padding: 4px 30px 4px 8px; background: #e0242f; color: #fff; text-align: left; pointer-events: none; }
.quick-offer-label > strong { overflow: hidden; font-size: 10px; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.quick-offer-label > span { display: -webkit-box; overflow: hidden; font-size: 9.5px; font-weight: 700; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
/* Dòng hàng trong mục Ảnh sản phẩm: hai ô ngay trên các ô ảnh; Biến thể mờ đi khi chưa chọn dòng. */
.product-offer-fields { margin-bottom: 8px; }
/* Một trường: bên trái bấm chọn Dòng sản phẩm (có mũi tên), bên phải gõ Biến thể, ngăn bằng một đường kẻ dọc. */
.product-offer-line-value { position: relative; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); min-width: 0; }
.product-offer-line-value > .create-product-unit-picker { grid-column: 1 / -1; }
/* Cả trường (ô chọn, ô biến thể, gợi ý) là một khung chọn (`create-product-unit-control`): bấm vào gợi ý không làm ô mất
   focus (blurInputOnOutsidePointer), nếu không gợi ý đóng trước khi nhả chuột và không chọn được gì. */
.product-offer-line-value .create-product-offer-control { position: relative; display: grid; min-width: 0; }
.product-offer-line-value .create-product-offer-control > input { width: 100%; min-height: var(--form-row-height); height: 100%; padding: 5px 30px 5px 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: var(--form-value-size); cursor: pointer; }
.product-offer-line-value .create-product-offer-control > input:focus { outline: 0; box-shadow: none; }
.product-offer-line-value .create-product-offer-control > input:focus { cursor: text; }
.product-offer-chevron { position: absolute; top: 50%; right: 9px; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.product-offer-variant { min-width: 0; border-left: 1px solid var(--control-border); }
.product-offer-variant > input { width: 100%; height: 100%; min-height: var(--form-row-height); padding: 5px 10px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: var(--form-value-size); }
.product-offer-variant > input:focus { outline: 0; box-shadow: none; }
.product-offer-variant > input:disabled { background: transparent; color: #929e9b; -webkit-text-fill-color: #929e9b; opacity: 1; }
.product-offer-line-value { border-left: 1px solid var(--line); }
.product-offer-variant.is-disabled { opacity: .55; }
/* Thông tin thêm (0177): Kích thước là ba ô Dài | Rộng | Cao trong một hàng như ô Dòng sản phẩm | Biến thể; Mô tả cao ba dòng. */
.product-size-control { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; border-radius: 0 9px 9px 0; }
.product-size-control > input { width: 100%; min-width: 0; height: 100%; min-height: var(--form-row-height); padding: 5px 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: var(--form-value-size); text-align: left; }
.product-size-control > input + input { border-left: 1px solid var(--control-border); }
.product-size-control > input:focus { outline: 0; box-shadow: none; }
/* Hoa hồng nhân viên (0179): ô số và nút chọn % (phần trăm doanh thu) hoặc đ (số tiền mỗi đơn vị) cùng một hàng. */
.product-commission-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-width: 0; border-radius: 0 9px 9px 0; }
.product-commission-control > input { width: 100%; min-width: 0; height: 100%; min-height: var(--form-row-height); padding: 5px 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: var(--form-value-size); text-align: left; }
.product-commission-control > input:focus { outline: 0; box-shadow: none; }
.product-commission-type { display: inline-flex; margin-right: 6px; padding: 2px; border: 1px solid var(--control-border); border-radius: 8px; background: #f5f8f7; }
.product-commission-type > button { width: 30px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #5d6f6b; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.product-commission-type > button[aria-checked="true"] { background: var(--brand); color: #fff; }
.product-commission-type > button:disabled { cursor: default; opacity: .55; }
.product-description-field > textarea { min-height: 84px; padding: 8px 10px; line-height: 1.45; resize: none; }
/* Form hàng hoá gọn (chủ dự án 06/12/2026): Thông tin hàng hoá, Giá, Hóa đơn VAT luôn hiện; nhóm ít dùng (Thiết lập nâng cao, Thông tin khác) là thẻ gập
   như thẻ đơn hàng của Tạo chiết khấu, tiêu đề ghi các mục đã đặt; dòng chỉ dành cho hàng VAT ẩn hẳn với hàng không xuất hóa đơn. */
.product-form-field[hidden], .product-details-panel[hidden], .product-fold-body[hidden] { display: none !important; }
.product-fold { flex: 0 0 auto; min-width: 0; border: 1px solid #b8d4ce; border-radius: 11px; background: var(--surface); box-shadow: 0 2px 6px rgba(15, 76, 68, .08); }
.product-fold-heading { width: 100%; min-height: 46px; border-radius: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 8px 12px; border: 0; background: var(--surface); color: var(--brand-dark); font: inherit; text-align: left; cursor: pointer; }
.product-fold-heading:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--focus-color); outline-offset: -2px; box-shadow: none; }
.product-fold.is-open > .product-fold-heading { border-radius: 10px 10px 0 0; background: #e2f1ed; }
.product-fold-title { font-size: 13px; font-weight: 800; }
.product-fold-summary { min-width: 0; overflow: hidden; color: #637a73; font-size: 12px; font-weight: 600; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.product-fold-chevron { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.product-fold.is-open .product-fold-chevron { transform: rotate(180deg); }
.product-fold-body { padding: 10px; border-top: 1px solid #d3e4e0; }
.product-unit-row { min-width: 0; display: grid; gap: 6px; }

/* Gợi ý Dòng sản phẩm: danh sách tag cuộn bên trong, chân là thao tác sửa/xóa luôn thấy. */
#createProductOfferGroupPicker:not(.hidden) { display: flex; flex-direction: column; max-height: min(280px, 40dvh); overflow: hidden; }
.offer-group-options { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 0; padding: 3px; overflow-y: auto; overscroll-behavior: contain; }
.offer-group-tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 30px; padding: 0 12px; border: 1px solid #cfe3de; border-radius: 999px; background: #e5f2ef; color: var(--brand-dark); font: inherit; font-size: 12.5px; font-weight: 700; line-height: 16px; white-space: nowrap; cursor: pointer; }
.offer-group-tag-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.offer-group-tag-count { flex: 0 0 auto; color: #5f8a83; font-weight: 600; font-variant-numeric: tabular-nums; }
.offer-group-tag:hover, .offer-group-tag:focus-visible { border-color: #8cc2b8; background: #d6ece7; }
.offer-group-tag.is-selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.offer-group-tag.is-selected .offer-group-tag-count { color: rgba(255, 255, 255, .8); }
.offer-group-actions { margin-top: 4px; }
.offer-group-actions .app-dropdown-action { width: 100%; min-height: 34px; font-size: 12.5px; }
.product-offer-fields .product-form-field.is-disabled { opacity: .55; }
/* Ô đầu xem trước ảnh dòng hàng (hàng chưa có ảnh riêng): nhãn tối để khác nhãn Ảnh chính. */
.product-image-slot.is-shared .product-image-slot-badge { background: rgba(29, 54, 49, .8); }
/* Kéo thả đổi thứ tự ảnh ở form hàng hoá (ảnh đầu là ảnh chính): ô nhấc lên theo con trỏ, chỗ thả là ô nét đứt thương hiệu. */
.product-image-slot.is-sortable { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.product-image-slot.is-sortable img { -webkit-user-drag: none; pointer-events: none; }
.product-image-slot.is-sortable:focus-visible:where(:root:not([data-input-method="pointer"]) *) { outline: var(--focus-width) solid var(--brand); outline-offset: 1px; }
.product-image-slot.is-dragging { position: fixed; z-index: 130; margin: 0; border-color: var(--brand); box-shadow: 0 12px 26px rgba(15, 118, 110, .28); cursor: grabbing; pointer-events: none; will-change: transform; }
.product-image-slot.is-dragging .product-image-slot-action { visibility: hidden; }
.product-image-slot.is-drop-target { border: 1.5px dashed var(--brand); background: var(--brand-light); }
/* Panel Dòng hàng: bảng như quản lý Danh mục, cột ảnh nhỏ và số mặt hàng trong dòng. */
.offer-group-manager-sheet .category-manager-table-heading, .offer-group-manager-sheet .category-manager-row { grid-template-columns: 40px 56px minmax(0,1fr) 72px 30px; }
.offer-group-manager-sheet .category-manager-table-heading > :nth-child(5) { border-left: 0; }
.offer-group-manager-sheet .category-manager-table-heading > :nth-child(4), .offer-group-count { justify-content: flex-end; text-align: right; padding-right: 10px; }
.offer-group-image-cell { justify-content: center; }
.offer-group-thumb { width: 40px; height: 40px; }
.offer-group-count { color: var(--brand-dark); font-size: var(--table-body-size); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .offer-group-manager-sheet .category-manager-table-heading, .offer-group-manager-sheet .category-manager-row { grid-template-columns: 32px 50px minmax(0,1fr) 66px 24px; } }
.offer-group-manager-sheet .category-manager-table-heading > span { white-space: nowrap; }
/* Trang Bán hàng: ô Kho mặc định trên nút Tạo đơn. */
.order-home-toolbar > .working-location { margin: 0; }
/* Tên dài: chi nhánh thu trước để tên kho còn đủ chữ. */
.order-home-toolbar > .working-location > .working-location-branch { flex-shrink: 6; }
.order-home-toolbar > .working-location > .working-location-warehouse { max-width: none; }
.order-home-toolbar > .working-location.hidden, .working-location > .hidden { display: none !important; }
