:root {
  color-scheme: light;
  --ui-text-scale: 1;
  --ink: #222b45;
  --muted: #77809a;
  --line: #e9edf4;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --navy: #202847;
  --primary: #6659d9;
  --primary-dark: #5549c8;
  --shadow: 0 12px 36px rgba(37, 47, 80, .06);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:root[data-text-size="large"] { --ui-text-scale: 1.12; }
:root[data-text-size="largest"] { --ui-text-scale: 1.25; }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 14px 35px; background: var(--surface); border-bottom: 1px solid var(--line); }
.quick-actions:empty { display: none; }
.quick-action { display: inline-flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--canvas); font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 650; }
.quick-action:hover { border-color: var(--primary); background: #eeecff; }
kbd { padding: 3px 6px; border: 1px solid #dce0ec; border-radius: 5px; background: #fff; color: #66708a; font-size: calc(11px * var(--ui-text-scale, 1)); font-family: inherit; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.counterparties-tabs { margin-bottom: 18px; }
.trade-line.sale-line-row { min-width: 1040px; width: 100%; grid-template-columns: minmax(190px, 1.8fr) minmax(125px, 1.15fr) minmax(78px, .7fr) minmax(125px, 1.05fr) minmax(175px, 1.45fr) minmax(105px, .95fr) minmax(130px, 1fr) 34px; align-items: end; gap: 8px; padding: 12px; background: #fafbfe; }
.trade-line .trade-unit-price-field { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.trade-line .trade-discount-field { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: #555e74; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; }
.trade-line .trade-line-field-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-line .trade-discount-inputs { display: grid; grid-template-columns: minmax(74px, .8fr) minmax(80px, 1fr); gap: 6px; }
.trade-line .price-history { display: flex; min-width: 0; min-height: 13px; align-items: center; flex-wrap: nowrap; gap: 4px; overflow: hidden; margin: 0; padding: 0; font-size: calc(9px * var(--ui-text-scale, 1)); line-height: 1.2; white-space: nowrap; }
.trade-line .price-history > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.trade-line .price-history .text-button { flex: 0 0 auto; padding: 0; font-size: inherit; }
.sale-lines { overflow-x: auto; padding-bottom: 3px; }
.trade-line .sale-line-remove { width: 34px; height: 38px; align-self: end; border-color: #f0dfe2; color: #b54d5b; font-size: calc(20px * var(--ui-text-scale, 1)); }
.return-line { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.return-line label { display: flex; flex-direction: column; gap: 7px; font-size: calc(12px * var(--ui-text-scale, 1)); }
.return-line .form-hint { margin: 6px 0 0; }
.settings-advanced { padding: 16px 0; border-top: 1px solid var(--line); margin-top: 18px; }
.settings-advanced summary { cursor: pointer; color: var(--primary); font-size: calc(14px * var(--ui-text-scale, 1)); font-weight: 650; }
.settings-advanced[open] summary { margin-bottom: 18px; }
.app-dialog .dialog-actions { position: sticky; bottom: 0; z-index: 2; padding-top: 14px; padding-bottom: 10px; background: #fff; box-shadow: 0 -8px 16px #ffffffed; }
.trade-line.sale-line-row label { font-size: calc(12px * var(--ui-text-scale, 1)); }
.trade-line input, .trade-line select { min-height: 40px; font-size: calc(13px * var(--ui-text-scale, 1)); }
.dashboard-activity { display: flex; align-items: center; justify-content: space-between; gap: 15px; width: 100%; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); text-align: left; background: transparent; color: var(--ink); font-size: calc(12px * var(--ui-text-scale, 1)); }
.dashboard-activity:hover { color: var(--primary); }

@media (max-width: 700px) {
  .quick-actions { padding: 12px 16px; gap: 8px; }
  .quick-action { flex: 1 1 140px; }
  .quick-action kbd { display: none; }
  .trade-order-tabs { align-items: center; flex-direction: row; gap: 6px; }
  .trade-order-add-tab { align-self: auto; margin: 0 0 5px; }
  .trade-product-scan-row { grid-template-columns: minmax(0, 1fr); }
.trade-line.sale-line-row { min-width: 1040px; grid-template-columns: minmax(190px, 1.8fr) minmax(125px, 1.15fr) minmax(78px, .7fr) minmax(125px, 1.05fr) minmax(175px, 1.45fr) minmax(105px, .95fr) minmax(130px, 1fr) 34px; }
  .return-line { grid-template-columns: minmax(0, 1fr); }
}

.app-layout { min-height: 100vh; display: flex; }
.sidebar { width: 252px; flex: 0 0 252px; background: var(--navy); color: #e7e9f7; padding: 25px 15px 18px; display: flex; flex-direction: column; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 11px 30px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row strong { font-size: calc(16px * var(--ui-text-scale, 1)); letter-spacing: -.2px; }
.brand-row span { margin-top: 4px; color: #aeb5d0; font-size: calc(12px * var(--ui-text-scale, 1)); }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(140deg, #9288ff, #6257d9); color: #fff; font-weight: 800; font-size: calc(21px * var(--ui-text-scale, 1)); box-shadow: 0 8px 18px rgba(79, 70, 196, .28); }
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; background: #fff; object-fit: contain; }
.nav-caption { padding: 0 12px; margin: 0 0 10px; color: #858eae; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 750; letter-spacing: 1px; }
.nav-caption-spaced { margin-top: 27px; }
.main-navigation { display: flex; flex-direction: column; gap: 5px; }
.nav-item { width: 100%; min-height: 43px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 9px; background: transparent; color: #c0c6dc; text-align: left; padding: 0 12px; font-size: calc(13px * var(--ui-text-scale, 1)); transition: background .15s ease, color .15s ease; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { color: #fff; background: #38375f; box-shadow: inset 3px 0 0 #938aff; }
.nav-icon { width: 19px; text-align: center; color: #a5a3eb; font-size: calc(17px * var(--ui-text-scale, 1)); }
.sidebar-bottom { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-note { display: flex; align-items: center; gap: 8px; color: #aab2cc; font-size: calc(11px * var(--ui-text-scale, 1)); padding: 0 4px 14px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #51d5a0; box-shadow: 0 0 0 4px rgba(81,213,160,.12); }
.logout-button { border: 0; background: transparent; color: #bfc5d8; display: flex; align-items: center; gap: 9px; font-size: calc(12px * var(--ui-text-scale, 1)); padding: 8px 4px; }
.logout-button:hover { color: #fff; }

.workspace { min-width: 0; flex: 1; }
.topbar { height: 73px; display: flex; align-items: center; justify-content: space-between; padding: 0 35px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-start, .topbar-actions { display: flex; align-items: center; min-width: 0; }
.topbar-start { gap: 15px; }
.topbar-actions { gap: 10px; }
.sidebar-collapse-toggle, .topbar-action { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #626c85; }
.sidebar-collapse-toggle { width: 36px; flex: 0 0 auto; padding: 0; font-size: calc(17px * var(--ui-text-scale, 1)); }
.sidebar-collapse-toggle:hover, .topbar-action:hover { border-color: #c9c5f1; background: #f8f7ff; color: var(--primary); }
.topbar-action { gap: 7px; padding: 0 10px; font-size: calc(12px * var(--ui-text-scale, 1)); font-weight: 620; }
.help-icon { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 750; }
.text-size-picker { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: calc(10px * var(--ui-text-scale, 1)); white-space: nowrap; }
.text-size-picker select { height: 36px; min-width: 76px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); padding: 0 8px; font: inherit; font-size: calc(11px * var(--ui-text-scale, 1)); }
.breadcrumb-home { max-width: 260px; overflow: hidden; border: 0; background: transparent; padding: 0; color: inherit; font: inherit; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.breadcrumb-home:hover { color: var(--primary); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #939bb0; font-size: calc(12px * var(--ui-text-scale, 1)); }
.breadcrumbs strong { color: #414a63; font-weight: 650; }
.crumb-divider { color: #d4d8e2; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #eeecff; color: #6257d9; font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 700; }
.user-copy strong, .user-copy span { display: block; }
.user-copy strong { font-size: calc(12px * var(--ui-text-scale, 1)); font-weight: 650; }
.user-copy span { color: var(--muted); font-size: calc(10px * var(--ui-text-scale, 1)); margin-top: 3px; }
.page-content { max-width: 1500px; margin: 0 auto; padding: 32px 35px 46px; }
@media (max-width: 900px) {
  .help-label, .text-size-label, .user-copy { display: none; }
  .topbar-action { width: 36px; padding: 0; }
  .breadcrumb-home { max-width: 130px; }
  .breadcrumbs strong { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.eyebrow { margin: 0 0 8px; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 760; letter-spacing: 1.05px; color: #928acb; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: calc(25px * var(--ui-text-scale, 1)); letter-spacing: -.65px; font-weight: 690; }
.muted { margin: 0; color: var(--muted); font-size: calc(12px * var(--ui-text-scale, 1)); line-height: 1.6; }
.date-chip { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #66708a; font-size: calc(11px * var(--ui-text-scale, 1)); white-space: nowrap; }
.calendar-icon { color: #7268dc; font-size: calc(15px * var(--ui-text-scale, 1)); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { min-height: 133px; position: relative; overflow: hidden; padding: 18px 18px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 15px rgba(39,48,75,.025); }
.metric-label { color: #79829a; font-size: calc(11px * var(--ui-text-scale, 1)); }
.metric-value { margin-top: 17px; font-size: calc(24px * var(--ui-text-scale, 1)); font-weight: 680; letter-spacing: -.4px; }
.metric-footnote { margin-top: 5px; color: #9ba2b2; font-size: calc(10px * var(--ui-text-scale, 1)); }
.metric-icon { width: 30px; height: 30px; position: absolute; right: 16px; top: 15px; display: grid; place-items: center; border-radius: 9px; font-size: calc(16px * var(--ui-text-scale, 1)); }
.metric-purple { background: #f0eeff; color: #6e63de; }
.metric-blue { background: #eaf3ff; color: #4d8ae3; }
.metric-orange { background: #fff4e7; color: #e59b42; }
.metric-green { background: #e8f8f1; color: #36ae7a; }
.setup-panel { display: flex; align-items: center; gap: 14px; padding: 17px 19px; border: 1px solid #e4e2fa; border-radius: 12px; background: linear-gradient(105deg, #f5f4ff 0%, #fff 78%); margin-bottom: 19px; }
.setup-icon { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; background: #ebe9ff; color: var(--primary); font-size: calc(18px * var(--ui-text-scale, 1)); }
.setup-copy { flex: 1; }
.setup-copy h2 { margin: 0 0 5px; font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 680; }
.setup-copy p { margin: 0; color: var(--muted); font-size: calc(11px * var(--ui-text-scale, 1)); line-height: 1.5; }
.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; padding: 0 13px; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 650; transition: background .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { border-color: #dedcf4; background: #fff; color: #5c55bb; }
.button-secondary:hover { background: #f7f6ff; }
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(255px, 1fr); gap: 16px; }
.content-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 15px rgba(39,48,75,.025); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-heading h2 { margin: 0 0 5px; font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 680; }
.card-heading p { margin: 0; color: var(--muted); font-size: calc(10px * var(--ui-text-scale, 1)); }
.quiet-badge { border-radius: 20px; background: #f3f4f8; color: #9299aa; font-size: calc(9px * var(--ui-text-scale, 1)); padding: 6px 8px; white-space: nowrap; }
.empty-state { min-height: 153px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px 20px 10px; text-align: center; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #f4f3ff; color: #8279dd; font-size: calc(21px * var(--ui-text-scale, 1)); }
.empty-state p { max-width: 380px; margin: 12px 0 0; color: #9299aa; font-size: calc(10px * var(--ui-text-scale, 1)); line-height: 1.6; }
.telegram-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #e9f6ff; color: #319ad2; font-size: calc(14px * var(--ui-text-scale, 1)); }
.bot-status-row { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: #343d57; font-size: calc(12px * var(--ui-text-scale, 1)); }
.bot-status-row .status-dot { flex: 0 0 auto; }
.status-dot-off { background: #c8cbd5; box-shadow: 0 0 0 4px rgba(120,127,145,.1); }
.bot-pairing-help { margin-bottom: 14px; }
.bot-pairing-result { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; margin-top: 17px; border: 1px solid #e7e5fb; border-radius: 9px; background: #faf9ff; padding: 14px; color: #4f5870; font-size: calc(11px * var(--ui-text-scale, 1)); }
.bot-pairing-result p { margin: 0; color: #747d92; }
.bot-pairing-result code { border-radius: 6px; background: #efedff; padding: 8px 10px; color: #5147bd; font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 700; }
.bot-enable-option { display: flex; align-items: center; gap: 8px; color: #555e74; font-size: calc(11px * var(--ui-text-scale, 1)); }
.bot-enable-option input { accent-color: var(--primary); }
.bot-description { margin: 19px 0 18px; color: #7e879b; font-size: calc(11px * var(--ui-text-scale, 1)); line-height: 1.65; }
.text-button { display: inline-flex; align-items: center; gap: 9px; border: 0; background: transparent; color: #6359ca; padding: 0; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 670; }
.text-button:hover { color: #3f35a6; }
.module-placeholder { min-height: 290px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.module-placeholder h2 { margin: 14px 0 6px; font-size: calc(15px * var(--ui-text-scale, 1)); }
.module-placeholder p { max-width: 430px; margin: 0 0 18px; color: var(--muted); font-size: calc(12px * var(--ui-text-scale, 1)); line-height: 1.6; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #eae8ff, transparent 52%), var(--canvas); }
.login-card { width: min(100%, 405px); padding: 35px 34px 27px; border: 1px solid #eceef4; border-radius: 17px; background: #fff; box-shadow: 0 22px 70px rgba(43,48,82,.1); }
.brand-mark-large { width: 45px; height: 45px; margin-bottom: 22px; }
.login-card .eyebrow { margin-bottom: 9px; }
.login-card h1 { font-size: calc(24px * var(--ui-text-scale, 1)); }
.login-card .muted { margin-bottom: 25px; }
.login-card form { display: flex; flex-direction: column; }
.login-card label { margin: 13px 0 7px; color: #4c556d; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 650; }
.login-card input { height: 42px; border: 1px solid #dfe3ed; border-radius: 8px; padding: 0 11px; color: var(--ink); outline: none; }
.login-card input:focus { border-color: #8d85e4; box-shadow: 0 0 0 3px rgba(102,89,217,.12); }
.button-wide { width: 100%; min-height: 42px; margin-top: 20px; font-size: calc(12px * var(--ui-text-scale, 1)); }
.button:disabled { cursor: wait; opacity: .7; }
.form-error { margin: 12px 0 0; color: #c24754; font-size: calc(11px * var(--ui-text-scale, 1)); line-height: 1.5; }
.login-footnote { margin: 19px 0 0; padding-top: 16px; border-top: 1px solid #eff1f5; color: #9aa1af; text-align: center; font-size: calc(10px * var(--ui-text-scale, 1)); line-height: 1.5; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: 360px; padding: 12px 16px; border: 1px solid #e5e7ef; border-radius: 9px; background: #fff; box-shadow: var(--shadow); color: var(--ink); font-size: calc(12px * var(--ui-text-scale, 1)); }

.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.table-card { padding: 0; overflow: hidden; }
.document-list-scroll { height: clamp(180px, 34vh, 340px); overflow: auto; }
.document-detail-card { margin-top: 16px; }
.selectable-row { cursor: pointer; outline: none; }
.selectable-row:hover td, .selectable-row:focus td { background: #f8f7ff; }
.selectable-row.is-selected td { background: #f1efff; }
.selectable-row.is-selected td:first-child { box-shadow: inset 3px 0 #6759d9; }
.table-secondary-text { margin-top: 4px; color: #929aae; font-size: calc(10px * var(--ui-text-scale, 1)); }
.debt-balance-card, .cash-transactions-card { margin-top: 18px; }
.debt-balance-card .table-toolbar, .cash-account-card .table-toolbar { justify-content: space-between; }
.debt-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.debt-pagination .button:disabled { cursor: default; }
.user-roles-card { margin-top: 18px; }
.bot-admin-card { margin-top: 18px; }
.table-toolbar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.search-field { width: min(100%, 370px); display: flex; align-items: center; gap: 9px; border: 1px solid #e4e7ef; border-radius: 8px; padding: 0 11px; color: #939bb0; }
.search-field input { width: 100%; height: 36px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: calc(11px * var(--ui-text-scale, 1)); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; text-align: left; }
.data-table th { padding: 12px 16px; background: #fafbfe; color: #7b849a; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; white-space: nowrap; }
.data-table td { padding: 13px 16px; border-top: 1px solid #f0f2f6; color: #4a536a; font-size: calc(11px * var(--ui-text-scale, 1)); vertical-align: middle; }
.data-table td strong { color: #303a54; font-weight: 680; }
.numeric-cell { text-align: right !important; white-space: nowrap; }
.table-subtext { display: block; margin-top: 4px; color: #929aae; font-size: calc(10px * var(--ui-text-scale, 1)); }
.table-empty { height: 120px; text-align: center !important; color: #9199ab !important; }
.status-badge { display: inline-flex; align-items: center; border-radius: 30px; padding: 5px 9px; background: #f0f2f6; color: #6d768b; font-size: calc(10px * var(--ui-text-scale, 1)); white-space: nowrap; }
.status-posted, .status-converted { background: #e9f8f1; color: #26885f; }
.status-cancelled { background: #fff0f0; color: #b75259; }
.quotation-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; padding: 9px 12px; border: 1px solid #c7dcf4; border-radius: 8px; background: #eff6ff; color: #275682; font-size: calc(12px * var(--ui-text-scale, 1)); }
.stock-tracking-button { border-radius: 6px; background: #f3f2ff; padding: 6px 8px; white-space: nowrap; }
.stock-tracking-button:hover { background: #e9e6ff; }
.unit-chip { display: inline-flex; margin: 2px 3px 2px 0; border-radius: 5px; background: #f3f4fa; color: #68718a; padding: 4px 6px; font-size: calc(10px * var(--ui-text-scale, 1)); white-space: nowrap; }
.error-text { color: #bd4954 !important; }

.app-dialog { width: min(900px, calc(100% - 24px)); max-width: 900px; max-height: min(90vh, 900px); overflow: auto; padding: 23px; border: 1px solid #e5e8f0; border-radius: 15px; background: #fff; color: var(--ink); box-shadow: 0 24px 90px rgba(30,38,67,.22); }
.app-dialog.trade-entry-dialog { width: min(1180px, calc(100% - 24px)); max-width: 1180px; max-height: min(94vh, 1100px); }
.trade-entry-help { margin-top: -7px; padding: 11px 13px; border: 1px solid #e9e7fb; border-radius: 9px; background: #f8f7ff; color: #665ca4; }
.trade-order-tabs { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.trade-order-tab-list { display: flex; min-width: 0; flex: 1; gap: 4px; overflow-x: auto; }
.trade-order-tab { display: flex; min-width: 0; max-width: 260px; min-height: 40px; flex: 0 0 auto; align-items: center; overflow: hidden; gap: 2px; padding: 0 3px 0 0; border-bottom: 2px solid transparent; border-radius: 7px 7px 0 0; background: transparent; }
.trade-order-tab-select { min-width: 0; max-width: 220px; min-height: 38px; flex: 1 1 auto; overflow: hidden; padding: 0 10px; border: 0; background: transparent; color: #707a91; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 650; }
.trade-order-tab:hover, .trade-order-tab.is-active { background: #f7f6ff; }
.trade-order-tab:hover .trade-order-tab-select { color: var(--primary); }
.trade-order-tab.is-active { border-bottom-color: var(--primary); }
.trade-order-tab.is-active .trade-order-tab-select { color: #5146b8; }
.trade-order-tab-close { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; margin-right: 2px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #7b8499; font-size: calc(17px * var(--ui-text-scale, 1)); line-height: 1; }
.trade-order-tab-close:hover { background: #eceaf9; color: #b54d5b; }
.trade-order-add-tab { margin-bottom: 5px; white-space: nowrap; }
.app-dialog [hidden] { display: none !important; }
.app-dialog::backdrop { background: rgba(27,34,58,.38); backdrop-filter: blur(2px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; font-size: calc(19px * var(--ui-text-scale, 1)); letter-spacing: -.3px; }
.icon-button { width: 32px; height: 32px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid #e7e9f0; border-radius: 8px; background: #fff; color: #69728a; font-size: calc(19px * var(--ui-text-scale, 1)); line-height: 1; }
.icon-button:hover { background: #f6f7fb; }
.dialog-form { display: flex; flex-direction: column; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid label, .conversion-row label, .sale-line-row label { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: #555e74; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; }
.form-grid .checkbox-field, .checkbox-field { display: flex; flex-direction: row; align-items: center; gap: 9px; color: #555e74; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 650; }
.checkbox-field input, .form-grid .checkbox-field input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.form-grid input, .form-grid select, .conversion-row input, .sale-line-row input, .sale-line-row select { width: 100%; height: 38px; min-width: 0; border: 1px solid #dfe3ed; border-radius: 7px; background: #fff; color: #29324b; padding: 0 9px; outline: 0; font-size: calc(11px * var(--ui-text-scale, 1)); }
.form-grid input:focus, .form-grid select:focus, .conversion-row input:focus, .sale-line-row input:focus, .sale-line-row select:focus { border-color: #8d85e4; box-shadow: 0 0 0 3px rgba(102,89,217,.1); }
.form-grid input[readonly] { background: #f7f8fb; color: #747e94; }
.field-wide { grid-column: 1 / -1; }
.form-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.form-section-heading h3 { margin: 0 0 4px; font-size: calc(12px * var(--ui-text-scale, 1)); }
.form-section-heading p { margin: 0; color: #8a93a7; font-size: calc(10px * var(--ui-text-scale, 1)); line-height: 1.5; }
.conversion-rows { display: flex; flex-direction: column; gap: 8px; }
.conversion-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; align-items: end; gap: 9px; }
.sale-lines { display: flex; flex-direction: column; gap: 10px; }
.trade-product-scan-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto; align-items: end; gap: 9px; padding: 12px; border: 1px solid #e8eaf2; border-radius: 9px; background: #fbfbfe; }
.trade-product-scan-row label { color: #555e74; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; }
.trade-product-scan-row input { min-width: 0; height: 40px; border: 1px solid #dfe3ed; border-radius: 7px; padding: 0 10px; color: var(--ink); font: inherit; font-size: calc(12px * var(--ui-text-scale, 1)); }
.sale-line-row { display: grid; grid-template-columns: minmax(160px, 1.6fr) minmax(130px, 1.25fr) minmax(90px, .8fr) minmax(105px, .9fr) minmax(100px, .85fr) minmax(90px, .8fr) 32px; align-items: end; gap: 8px; padding: 12px; border: 1px solid #edf0f5; border-radius: 9px; background: #fcfcfe; }
.sale-line-total { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #737d93; font-size: calc(10px * var(--ui-text-scale, 1)); }
.sale-line-total strong { color: #303a54; font-size: calc(11px * var(--ui-text-scale, 1)); white-space: nowrap; }
.sale-total-preview { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 13px; color: #69738a; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sale-total-preview strong { color: #292f4c; font-size: calc(18px * var(--ui-text-scale, 1)); }
.form-hint, .dialog-intro { margin: 0; color: #858ea3; font-size: calc(10px * var(--ui-text-scale, 1)); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }
.document-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.document-detail-heading .eyebrow { margin-bottom: 5px; }
.document-detail-heading h2 { margin: 0; font-size: calc(16px * var(--ui-text-scale, 1)); }
.document-detail-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.document-detail-empty { min-height: 120px; }
.document-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 17px; }
.document-summary-inline { display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 0 0 10px; }
.document-summary-inline > div { flex-direction: row; align-items: baseline; gap: 6px; border-radius: 0; background: transparent; padding: 0; }
.document-summary-inline span { white-space: nowrap; }
.help-page-copy { margin: 13px 0; padding: 13px; border: 1px solid #ebe9fb; border-radius: 9px; background: #f8f7ff; }
.help-page-copy h3, .help-shortcuts h3 { margin: 0 0 8px; color: #38415b; font-size: calc(12px * var(--ui-text-scale, 1)); }
.help-page-copy p { margin: 0; color: #68728a; font-size: calc(11px * var(--ui-text-scale, 1)); line-height: 1.6; }
.help-shortcuts { display: grid; gap: 7px; margin: 14px 0 8px; }
.help-shortcut-row { display: flex; align-items: center; gap: 10px; color: #5d6780; font-size: calc(11px * var(--ui-text-scale, 1)); }
.help-shortcut-row kbd { min-width: 62px; text-align: center; }
.document-summary > div, .document-totals > div { min-width: 0; display: flex; flex-direction: column; gap: 5px; border-radius: 8px; background: #f7f8fc; padding: 11px; }
.document-summary span, .document-totals span { color: #8891a5; font-size: calc(10px * var(--ui-text-scale, 1)); }
.document-summary strong, .document-totals strong { color: #343d57; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 680; overflow-wrap: anywhere; }
.detail-table-scroll { max-height: 310px; border: 1px solid #edf0f5; border-radius: 8px; }
.detail-table-scroll .data-table { min-width: 600px; }
.document-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.customer-code-badge { border-radius: 7px; background: #f1efff; padding: 8px 11px; color: #6256c7; font-size: calc(11px * var(--ui-text-scale, 1)); }
.customer-summary { margin: 0; }
.detail-note { margin: 13px 0 0; padding: 11px; border-left: 3px solid #dcd9fb; background: #f8f7ff; color: #66708a; font-size: calc(11px * var(--ui-text-scale, 1)); }
.inline-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-radius: 8px; background: #fff8e9; padding: 10px; color: #8b7046; font-size: calc(10px * var(--ui-text-scale, 1)); }
.role-name-field { display: flex; flex-direction: column; gap: 6px; color: #555e74; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; }
.role-name-field input { height: 38px; border: 1px solid #dfe3ed; border-radius: 7px; padding: 0 9px; font-size: calc(11px * var(--ui-text-scale, 1)); }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-group { min-width: 0; margin: 0; padding: 11px; border: 1px solid #e9ecf3; border-radius: 9px; }
.permission-group legend { padding: 0 5px; color: #4f5870; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 680; }
.permission-option { display: flex; align-items: flex-start; gap: 8px; padding: 5px 2px; color: #657088; font-size: calc(10px * var(--ui-text-scale, 1)); line-height: 1.4; }
.permission-option input { margin: 1px 0 0; accent-color: var(--primary); }
.list-toolbar { align-items: center; flex-wrap: wrap; }
.list-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.list-filters > label, .report-filters > label { display: flex; min-width: 116px; flex-direction: column; gap: 5px; color: #778198; font-size: calc(9px * var(--ui-text-scale, 1)); font-weight: 650; }
.list-filters input, .list-filters select, .product-toolbar select, .report-filters input, .report-filters select, .settings-form select, .settings-form textarea { min-width: 0; height: 34px; border: 1px solid #dfe3ed; border-radius: 7px; background: #fff; color: #29324b; padding: 0 8px; font: inherit; font-size: calc(10px * var(--ui-text-scale, 1)); }
.list-filters input[type="date"] { width: 132px; }
.list-filters select { min-width: 118px; }
.date-range-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 0 18px 13px; }
.date-range-preset { min-height: 31px; padding: 0 12px; border: 1px solid #e1e5ef; border-radius: 18px; background: #fff; color: #67718a; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; white-space: nowrap; }
.date-range-preset:hover { border-color: #b9b3ef; color: var(--primary); }
.date-range-preset.is-active { border-color: #d8d4fb; background: #f1efff; color: #5549be; }
.report-filter-card .date-range-presets { padding: 14px 0 0; }
.cash-period-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 18px 14px; }
.cash-period-metric { padding: 11px 13px; border: 1px solid #edf0f6; border-radius: 9px; background: #fafbfe; }
.cash-period-metric span { display: block; color: #7b849a; font-size: calc(10px * var(--ui-text-scale, 1)); }
.cash-period-metric strong { display: block; margin-top: 5px; color: #303a54; font-size: calc(15px * var(--ui-text-scale, 1)); font-variant-numeric: tabular-nums; }
.settings-card { margin-bottom: 16px; padding: 19px; }
.settings-card .card-heading { margin-bottom: 16px; }
.settings-card h2 { margin: 0; font-size: calc(14px * var(--ui-text-scale, 1)); }
.settings-form { display: flex; flex-direction: column; gap: 13px; }
.settings-form .form-grid > label:not(.checkbox-field) { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: #555e74; font-size: calc(10px * var(--ui-text-scale, 1)); font-weight: 650; }
.settings-form .form-grid input:not([type="checkbox"]), .settings-form select { width: 100%; height: 38px; border: 1px solid #dfe3ed; border-radius: 7px; background: #fff; color: #29324b; padding: 0 9px; font-size: calc(11px * var(--ui-text-scale, 1)); }
.settings-form textarea { width: 100%; height: 82px; padding: 9px; resize: vertical; font-size: calc(11px * var(--ui-text-scale, 1)); }
.logo-preview { display: flex; align-items: center; gap: 15px; grid-column: 1 / -1; }
.logo-preview img { width: 120px; height: 72px; border: 1px solid #e4e7ef; border-radius: 8px; object-fit: contain; }
.report-filter-card { padding: 16px; margin-bottom: 16px; }
.report-filters { display: grid; grid-template-columns: 1.1fr .75fr .75fr 1.4fr auto; align-items: end; gap: 10px; }
.report-filters > label { min-width: 0; }
.report-filters input, .report-filters select { width: 100%; height: 38px; font-size: calc(11px * var(--ui-text-scale, 1)); }
.report-search-field { min-width: 180px !important; }
.report-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.report-actions .button { min-height: 36px; padding: 0 11px; font-size: calc(10px * var(--ui-text-scale, 1)); }
.report-result-card .data-table { min-width: 920px; }
.report-result-card .table-toolbar { justify-content: space-between; }
.report-result-card .data-table td { white-space: nowrap; }

@media (max-width: 1080px) {
  .sidebar { width: 220px; flex-basis: 220px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 701px) {
  .app-layout.is-sidebar-collapsed .sidebar { width: 76px; flex-basis: 76px; align-items: center; padding: 20px 9px 14px; }
  .app-layout.is-sidebar-collapsed .brand-row { justify-content: center; padding: 0 0 25px; }
  .app-layout.is-sidebar-collapsed .brand-row > div:last-child,
  .app-layout.is-sidebar-collapsed .nav-caption,
  .app-layout.is-sidebar-collapsed .nav-item > span:last-child,
  .app-layout.is-sidebar-collapsed .sidebar-note,
  .app-layout.is-sidebar-collapsed .logout-button > span:last-child { display: none; }
  .app-layout.is-sidebar-collapsed .main-navigation { width: 100%; align-items: center; }
  .app-layout.is-sidebar-collapsed .nav-item { width: 48px; justify-content: center; padding: 0; }
  .app-layout.is-sidebar-collapsed .nav-icon { font-size: calc(19px * var(--ui-text-scale, 1)); }
  .app-layout.is-sidebar-collapsed .sidebar-bottom { width: 100%; padding: 12px 0 0; }
  .app-layout.is-sidebar-collapsed .logout-button { width: 48px; justify-content: center; margin: auto; font-size: calc(17px * var(--ui-text-scale, 1)); }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; flex-basis: 64px; align-items: center; padding: 18px 8px 12px; }
  .brand-row { padding: 0 0 25px; }
  .brand-row > div:last-child, .nav-caption, .nav-item > span:last-child, .sidebar-note, .logout-button > span:last-child { display: none; }
  .main-navigation { width: 100%; align-items: center; }
  .nav-item { width: 45px; min-height: 44px; justify-content: center; padding: 0; }
  .nav-icon { font-size: calc(19px * var(--ui-text-scale, 1)); }
  .sidebar-bottom { width: 100%; display: flex; justify-content: center; padding: 12px 0 0; }
  .logout-button { width: 45px; justify-content: center; font-size: calc(17px * var(--ui-text-scale, 1)); }
  .topbar { height: 62px; padding: 0 16px; }
  .user-copy { display: none; }
  .page-content { padding: 24px 16px 32px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .bottom-grid { grid-template-columns: 1fr; }
  .setup-panel { align-items: flex-start; flex-wrap: wrap; }
  .setup-copy { min-width: calc(100% - 60px); }
  .setup-panel .button { margin-left: 52px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .sale-line-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sale-line-row > .sale-line-remove { justify-self: end; }
  .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-search-field { grid-column: 1 / -1; }
  .report-actions { grid-column: 1 / -1; }
}
@media (max-width: 470px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 125px; padding: 14px 12px; }
  .metric-icon { right: 10px; top: 10px; }
  .metric-label { max-width: calc(100% - 28px); line-height: 1.35; }
  .metric-value { margin-top: 19px; font-size: calc(20px * var(--ui-text-scale, 1)); }
  .breadcrumbs { font-size: calc(10px * var(--ui-text-scale, 1)); }
  h1 { font-size: calc(21px * var(--ui-text-scale, 1)); }
  .login-card { padding: 29px 22px 22px; }
  .app-dialog { padding: 17px; }
  .form-grid, .document-summary, .document-totals { grid-template-columns: 1fr; }
  .report-filters { grid-template-columns: 1fr; }
  .report-search-field, .report-actions { grid-column: auto; }
  .permission-groups { grid-template-columns: 1fr; }
  .form-grid .field-wide { grid-column: auto; }
  .form-section-heading { align-items: flex-start; flex-direction: column; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
}

.mobile-menu-toggle { display: none; }
@media (max-width: 700px) {
  .app-layout { display: block; }
  .app-layout .sidebar { position: relative; width: 100%; min-width: 0; padding: 12px 16px; }
  .app-layout .brand-row { padding: 0; min-height: 42px; }
  .app-layout .brand-row > div { display: block; }
  .app-layout .brand-row span { display: none; }
  .sidebar .brand-row strong { display: block; max-width: 205px; font-size: calc(14px * var(--ui-text-scale, 1)); }
  .sidebar .nav-caption, .sidebar .sidebar-note { display: none; }
  .sidebar .main-navigation { display: none; }
  .sidebar.is-menu-open .main-navigation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding-top: 14px; }
  .sidebar .nav-item { width: 100%; min-height: 44px; justify-content: center; padding: 7px; text-align: center; border: 1px solid #ffffff20; font-size: calc(12px * var(--ui-text-scale, 1)); }
  .sidebar .nav-item span:not(.nav-icon) { display: inline; }
  .sidebar .nav-icon { display: none; }
  .sidebar .sidebar-bottom { display: none; }
  .sidebar.is-menu-open .sidebar-bottom { display: flex; justify-content: flex-end; padding: 7px 0 0; border: 0; margin: 0; }
  .sidebar .logout-button span { display: inline; }
  .mobile-menu-toggle { display: inline-flex; align-items: center; position: absolute; right: 16px; top: 13px; min-height: 40px; padding: 8px 12px; border: 1px solid #ffffff40; border-radius: 8px; background: transparent; color: #fff; font: inherit; font-size: calc(12px * var(--ui-text-scale, 1)); }
}

@media (max-width: 700px) {
  .sidebar .brand-row > .brand-mark { display: grid; }
  .sidebar .logout-button { width: auto; font-size: calc(12px * var(--ui-text-scale, 1)); }
}
@media (max-width: 700px) {
  .topbar { height: auto; min-height: 62px; gap: 8px; padding: 9px 12px; }
  .topbar-start { flex: 1 1 auto; gap: 7px; }
  .topbar-actions { flex: 0 0 auto; gap: 6px; }
  .sidebar-collapse-toggle, .help-label, .text-size-label { display: none; }
  .topbar-action { width: 36px; padding: 0; }
  .text-size-picker select { width: 82px; min-width: 82px; padding: 0 5px; }
  .breadcrumbs { min-width: 0; gap: 6px; font-size: calc(10px * var(--ui-text-scale, 1)); }
  .breadcrumb-home { min-width: 0; max-width: 88px; }
  .breadcrumbs strong { min-width: 0; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Giao diện làm việc cho bán hàng và các danh mục. */
:root { --canvas: #edf2f8; --primary: #197bd2; --primary-dark: #1264ad; }
.page-content { max-width: none; }
.button-secondary { border-color: #cbd7e4; color: #175c9c; }
.button-secondary:hover { background: #eef6ff; }
.quick-action:hover { background: #eaf4ff; }
.dashboard-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 17px; }
.dashboard-shortcut { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 72px; padding: 12px 16px; border: 1px solid #dbe2e9; border-radius: 8px; background: #fff; color: #1c2e43; text-align: left; font-size: calc(13px * var(--ui-text-scale, 1)); }
.dashboard-shortcut:hover { border-color: #86bced; background: #f8fbff; }
.dashboard-shortcut span { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 8px; background: #1b7bd2; color: #fff; font-size: calc(18px * var(--ui-text-scale, 1)); }
.dashboard-shortcut:nth-child(2) span, .dashboard-shortcut:nth-child(6) span { background: #6650de; }
.dashboard-shortcut:nth-child(3) span, .dashboard-shortcut:nth-child(5) span { background: #099a88; }
.dashboard-shortcut:nth-child(4) span { background: #079d76; }
.dashboard-shortcut:nth-child(7) span { background: #f26d13; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { border-color: #dbe2e9; border-radius: 8px; box-shadow: none; }
.metric-value { color: #1c7cd0; }
.party-toolbar { flex-wrap: wrap; gap: 12px; }
.party-debt-filter { display: inline-flex; align-items: center; gap: 7px; color: #43566a; font-size: calc(12px * var(--ui-text-scale, 1)); }
.party-debt-filter input { accent-color: #197bd2; }
.party-debt-total { color: #5b6e80; font-size: calc(12px * var(--ui-text-scale, 1)); }
.party-debt-total strong, .party-owing { color: #e03940; }
.invoice-history-tabs { display: flex; gap: 8px; margin: 0 0 15px; border-bottom: 1px solid #d3dfeb; }
.invoice-history-tabs button { min-height: 39px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #446581; font: inherit; font-size: calc(12px * var(--ui-text-scale, 1)); }
.invoice-history-tabs button.is-active { border-color: #197bd2; color: #1469b8; font-weight: 700; }
.cash-receipt-button { background: #08a375; color: #fff; }
.cash-receipt-button:hover { background: #087c5a; }
.cash-payment-button { background: #ed424a; color: #fff; }
.cash-payment-button:hover { background: #cc3039; }
.report-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 16px; }
.report-shortcut-group { display: grid; align-content: start; gap: 7px; }
.report-shortcut-group h2 { margin: 0 0 5px; color: #197bd2; font-size: calc(13px * var(--ui-text-scale, 1)); text-transform: uppercase; }
.report-shortcut-group button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 6px; background: #d5ecff; color: #175e9f; text-align: left; font: inherit; font-size: calc(12px * var(--ui-text-scale, 1)); }
.report-shortcut-group button:hover { background: #bfe0fb; }
.report-stock-summary { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 12px 16px; border-bottom: 1px solid #e3eaf2; background: #f4f9ff; }
.report-stock-summary div { display: flex; flex-wrap: wrap; gap: 5px; color: #446581; font-size: calc(12px * var(--ui-text-scale, 1)); }
.report-stock-summary strong { color: #174e86; }

@media (min-width: 761px) {
  .sidebar { padding: 0 12px 18px; background: #fff; color: #24649e; border-right: 1px solid #dce5ee; }
  .brand-row { height: 56px; min-height: 56px; margin: 0 -12px 10px; padding: 0 15px; background: #1157a5; color: #fff; }
  .brand-row span, .nav-caption { display: none; }
  .brand-row strong { overflow: hidden; max-width: 165px; text-overflow: ellipsis; white-space: nowrap; }
  .brand-mark { width: 36px; height: 36px; border-radius: 7px; background: #fff; color: #1879c8; box-shadow: none; }
  .main-navigation { gap: 3px; }
  .nav-item { min-height: 40px; border-radius: 7px; color: #1b6eb7; font-size: calc(13px * var(--ui-text-scale, 1)); font-weight: 600; }
  .nav-item:hover { background: #e9f3fc; color: #155b9f; }
  .nav-item.is-active { background: #1c7bd2; color: #fff; box-shadow: none; }
  .nav-icon { color: inherit; }
  .sidebar-bottom { border-color: #e2e8ef; }
  .sidebar-note, .logout-button { color: #54718e; }
  .logout-button:hover { color: #155b9f; }
  .topbar { height: 56px; padding: 0 22px; border-color: #1864b1; background: #1767bb; color: #fff; }
  .topbar-action, .sidebar-collapse-toggle { border-color: #ffffff45; background: #ffffff12; color: #fff; }
  .breadcrumbs, .breadcrumbs strong, .crumb-divider, .text-size-picker, .user-copy span { color: #eef7ff; }
  .breadcrumb-home:hover { color: #fff; text-decoration: underline; }
  .app-layout.is-sidebar-collapsed .sidebar { padding: 0 9px 14px; }
  .app-layout.is-sidebar-collapsed .brand-row { width: calc(100% + 18px); height: 56px; margin: 0 -9px 10px; padding: 0; }
}

.is-sales-entry .quick-actions { display: none; }
.is-sales-entry .page-content { padding: 18px 20px 30px; }
.sales-workspace-header, .sales-order-toolbar, .sales-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sales-workspace-header h1 { margin: 0; color: #197bd2; text-transform: uppercase; font-size: calc(22px * var(--ui-text-scale, 1)); }
.sales-workspace-actions, .sales-order-toolbar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sales-workspace .button { min-height: 38px; font-size: calc(12px * var(--ui-text-scale, 1)); }
.sales-workspace .button kbd { margin-right: 7px; }
.sales-workspace-tabs { display: flex; flex-wrap: wrap; align-items: stretch; gap: 3px; margin: 17px 0 10px; border-bottom: 1px solid #cfdbe7; }
.sales-workspace-tab { display: flex; align-items: center; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; }
.sales-workspace-tab.is-active { border-color: #d4dee9; background: #fff; }
.sales-workspace-tab button, .sales-workspace-add-tab { min-height: 38px; border: 0; background: transparent; color: #265d8b; font-size: calc(12px * var(--ui-text-scale, 1)); }
.sales-workspace-tab button:first-child { padding: 0 9px 0 13px; font-weight: 650; }
.sales-workspace-tab button:last-child { padding: 0 10px 0 3px; color: #7d8da0; font-size: 19px; }
.sales-workspace-tab button:last-child:hover { color: #db3a40; }
.sales-workspace-add-tab { min-width: 40px; color: #197bd2; font-size: 22px; }
.sales-workspace-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(250px, 1fr); align-items: start; gap: 12px; }
.sales-order-panel, .sales-customer-card, .sales-summary-card { min-width: 0; border: 1px solid #dce4ec; border-radius: 8px; background: #fff; }
.sales-order-panel { min-height: 65vh; padding: 10px; }
.sales-order-toolbar { flex-wrap: wrap; margin-bottom: 10px; }
.sales-order-toolbar label { display: flex; align-items: center; gap: 7px; color: #5b6d80; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-order-toolbar input, .sales-note-label input, .sales-note-label select, .sales-picker-search input, .sales-picker-fields input { min-width: 0; min-height: 36px; padding: 7px 9px; border: 1px solid #cbd6e1; border-radius: 6px; background: #fff; color: #23374b; font: inherit; }
.sales-order-table-scroll { overflow-x: auto; }
.sales-order-table { width: 100%; min-width: 1020px; }
.sales-order-table th, .sales-picker-list .data-table th { background: #e2edf9; color: #174e86; }
.sales-order-table td { padding: 6px 5px; }
.sales-order-table td:nth-child(2), .sales-order-table td:nth-child(4) { white-space: nowrap; }
.sales-order-table td:nth-child(5), .sales-order-table td:nth-child(6), .sales-order-table td:nth-child(7), .sales-order-table td:nth-child(8) { width: 105px; }
.sales-order-table td input { width: 100%; min-width: 76px; height: 33px; padding: 4px 6px; border: 1px solid #d5dee8; border-radius: 5px; text-align: right; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-order-table td input.sales-line-note { min-width: 120px; text-align: left; }
.sales-price-control { display: flex; align-items: center; gap: 3px; }
.sales-price-control button { flex: 0 0 26px; width: 26px; height: 33px; padding: 0; border: 1px solid #d5dee8; border-radius: 5px; background: #f5f9fd; color: #197bd2; font-size: 17px; }
.sales-price-control button:hover { background: #e2edf9; }
.sales-order-table td select { width: 100%; min-width: 65px; height: 33px; border: 1px solid #d5dee8; border-radius: 5px; background: #fff; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-order-table th:last-child, .sales-order-table td:last-child:not([colspan]) { position: sticky; right: 0; width: 42px; background: #fff; }
.sales-order-table th:last-child { z-index: 2; background: #e2edf9; }
.sales-order-table td:last-child:not([colspan]) { z-index: 1; }
.sales-order-table .sales-order-empty { height: 110px; text-align: center; }
.sales-order-aside { display: grid; gap: 10px; }
.sales-customer-card, .sales-summary-card { padding: 14px; }
.sales-card-heading strong { font-size: calc(13px * var(--ui-text-scale, 1)); }
.sales-customer-name { display: block; margin: 12px 0; color: #df3439; font-size: calc(18px * var(--ui-text-scale, 1)); }
.sales-note-label { display: grid; gap: 5px; color: #586d80; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-note-label input, .sales-note-label select { width: 100%; }
.sales-summary-card { background: #e9f8ed; }
.sales-summary-card > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: calc(12px * var(--ui-text-scale, 1)); }
.sales-summary-card strong { text-align: right; overflow-wrap: anywhere; }
.sales-summary-card .sales-summary-total { align-items: baseline; margin-top: 8px; padding-top: 12px; border-top: 1px solid #c5dfcb; font-weight: 700; }
.sales-summary-total strong { color: #197bd2; font-size: calc(22px * var(--ui-text-scale, 1)); }
.sales-summary-card .form-hint { margin-top: 8px; }
.app-dialog.sales-picker-dialog { width: min(1100px, calc(100vw - 32px)); }
.sales-picker-search { display: block; margin: 12px 0; }
.sales-picker-search input { width: 100%; }
.sales-picker-list { max-height: min(48vh, 500px); overflow: auto; border: 1px solid #e0e8f0; }
.sales-picker-list .data-table { width: 100%; min-width: 520px; }
.sales-picker-list thead th { position: sticky; top: 0; z-index: 1; }
.sales-picker-list .selectable-row { cursor: pointer; }
.sales-picker-list .selectable-row:hover, .sales-picker-list .selectable-row:focus, .sales-picker-list .selectable-row.is-selected, .sales-picker-list .selectable-row.is-keyboard-active { outline: none; background: #d4eaff; }
.sales-picker-form { margin-top: 12px; padding: 13px; border-radius: 8px; background: #e7f4ff; }
.sales-picker-form > strong { display: block; margin-bottom: 5px; }
.sales-picker-product-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 5px; }
.sales-picker-units { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sales-picker-units button { min-height: 27px; padding: 3px 8px; border: 1px solid #c9dcec; border-radius: 5px; background: #f5f9fc; color: #365b7b; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-picker-units button.is-active { border-color: #197bd2; background: #fff; color: #155b9f; font-weight: 700; }
.sales-picker-stock { margin-left: auto; color: #1465a9; font-size: calc(11px * var(--ui-text-scale, 1)); }
.sales-picker-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.sales-picker-fields label { display: grid; gap: 5px; min-width: 0; color: #43566a; font-size: calc(11px * var(--ui-text-scale, 1)); font-weight: 650; }
.sales-picker-form .dialog-actions { padding-bottom: 0; background: transparent; box-shadow: none; }

@media (max-width: 1500px) {
  .sales-workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .sales-order-panel { min-height: 300px; }
  .sales-order-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dashboard-shortcuts, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .report-shortcuts { grid-template-columns: minmax(0, 1fr); }
  .is-sales-entry .page-content { padding: 14px 12px 24px; }
  .sales-workspace-header { align-items: flex-start; flex-direction: column; }
  .sales-workspace-actions { width: 100%; }
  .sales-order-aside { grid-template-columns: minmax(0, 1fr); }
  .sales-picker-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
