/* Admin tidy layer: «Заказы и обращения» (unlayered, wins over @layer legacy).
   Dense list (≥ 8 rows at 1440×900), one toolbar, calm drawer; scale 11–24 px, controls 30/36 px. */

/* Heading, view tabs, stage tabs */
.orders-workspace .ow-heading { padding: 14px 18px 8px; }
.orders-workspace .ow-heading h2 { font-size: 20px; }
.orders-workspace .ow-heading p { margin-top: 2px; font-size: 12px; }
.app-shell .orders-workspace .ow-icon, .app-shell .ow-drawer .ow-icon { flex-basis: 34px; width: 34px; height: 34px; padding: 7px; border-radius: 8px; }
.ow-tabs { padding: 0 18px; }
.ow-tabs button { padding: 10px 0; font-size: 14px; }
.ow-stages { padding: 12px 18px 0; }
.ow-stages button { min-height: 38px; padding: 7px 12px 7px 16px; font-size: 13px; }
.ow-stages button:first-child { padding-left: 12px; }

/* One toolbar: search, quick chips, filters toggle */
.orders-workspace .ow-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 18px; }
.ow-toolbar .ow-search { position: relative; display: block; flex: 1 1 240px; max-width: 380px; min-width: 200px; }
.ow-toolbar .ow-search > svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #6b7c81; pointer-events: none; }
.app-shell .ow-toolbar .ow-search input { width: 100%; min-height: 36px; padding: 0 12px 0 34px; border: 1px solid #cdd7d9; border-radius: 8px; background: #fff; color: #26383e; font: inherit; font-size: 14px; }
.ow-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ow-toolbar .ow-quick { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; }
.ow-toolbar .ow-quick button { min-height: 32px; gap: 7px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.ow-toolbar .ow-quick b { color: #6a7b80; font-weight: 600; }
.ow-toolbar .ow-quick button[aria-pressed="true"] b { color: inherit; }
.ow-toolbar__end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.ow-filter-toggle[aria-expanded="true"] { background: #f1f5f6; border-color: #aebcc1; }
.ow-filter-toggle b { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #c9470a; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.ow-toolbar .ow-advanced { display: grid; flex-basis: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 4px 0 2px; }
.is-inquiries .ow-toolbar .ow-advanced { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ow-toolbar .ow-advanced[hidden] { display: none; }
.ow-toolbar .ow-advanced label { display: grid; gap: 4px; min-width: 0; color: #526269; font-size: 12px; }
.app-shell .ow-toolbar .ow-advanced :is(input, select) { width: 100%; min-width: 0; min-height: 34px; padding: 0 10px; border: 1px solid #cdd7d9; border-radius: 8px; background: #fff; color: #26383e; font: inherit; font-size: 13px; }

/* Result line and bulk bars */
.orders-workspace .ow-results { min-height: 36px; padding: 6px 18px; font-size: 12px; }
.ow-bulk { padding: 8px 18px; }
.ow-bulk > span { font-size: 13px; }
.ow-bulk--inquiries label { display: flex; align-items: center; gap: 6px; color: #6b4a33; font-size: 12px; }
.app-shell .ow-bulk--inquiries select { min-height: 30px; padding: 0 8px; border: 1px solid #d9c3b2; border-radius: 8px; background: #fff; font: inherit; font-size: 13px; }

/* Dense table: two short lines per row at most */
.orders-workspace .ow-table { font-size: 13px; }
.orders-workspace .ow-table th { padding: 8px 10px; font-size: 12px; }
.orders-workspace .ow-table td { padding: 7px 10px; line-height: 1.35; vertical-align: middle; }
.orders-workspace .ow-table th:first-child, .orders-workspace .ow-table td:first-child { width: 36px; padding-right: 0; }
.orders-workspace .ow-table small { margin-top: 1px; font-size: 12px; }
.orders-workspace .ow-table td > strong, .orders-workspace .ow-table td > small { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orders-workspace .ow-table small .ow-issue { display: inline-flex; align-items: center; gap: 3px; margin: 0 0 0 8px; font-size: 12px; vertical-align: top; }
.orders-workspace .ow-table .ow-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.orders-workspace .ow-table .ow-items { max-width: 320px; }
.orders-workspace .ow-badge { padding: 2px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.ow-order-link { font-variant-numeric: tabular-nums; }
.ow-muted { color: #7b8a8f; }
.ow-topic span, .ow-topic small { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ow-table tr.is-cursor td { background: #fff6ef; }
.ow-table tr.is-cursor td:first-child { box-shadow: inset 3px 0 #c9470a; }
.orders-workspace .ow-table-scroll { max-height: min(720px, calc(100vh - 220px)); }

/* Footer with the keyboard hint */
.orders-workspace .ow-pagination { padding: 10px 18px; gap: 14px; }
.ow-keys { color: #6b7c81; font-size: 12px; white-space: nowrap; }
.ow-keys kbd { display: inline-block; min-width: 18px; margin: 0 1px; padding: 0 4px; border: 1px solid #cfd8db; border-bottom-width: 2px; border-radius: 4px; background: #fff; color: #3c4e54; font-family: inherit; font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; }
@media (max-width: 1100px) { .ow-keys { display: none; } }

/* Drawer: calm form, actions always in reach */
.ow-drawer > header { padding: 10px 16px; }
.ow-drawer > header h2 { font-size: 14px; font-weight: 650; }
.ow-drawer-body { padding: 16px 18px 0; }
.ow-drawer-body .site-request-detail h2 { font-size: 20px; }
.ow-drawer .site-request-detail h3 { margin: 0 0 8px; font-size: 16px; }
.ow-drawer .site-request-manager-form { gap: 12px; padding: 16px 0 0; background: #fff; }
.ow-drawer .site-request-manager-form label { gap: 6px; font-size: 13px; font-weight: 650; }
.ow-drawer .site-request-manager-form :is(textarea, select, input:not([type="checkbox"]):not([type="file"])) { border-radius: 8px; font-weight: 400; }
.ow-drawer .site-request-manager-form__actions { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 -18px; padding: 10px 18px; border-top: 1px solid #e1e8e9; background: rgba(255, 255, 255, 0.97); box-shadow: 0 -6px 16px rgba(24, 34, 41, 0.06); }
.ow-drawer .site-request-manager-form__buttons { margin-left: auto; }
.ow-drawer .inquiry-history { margin-bottom: 18px; }
.ow-drawer .ozon-order-panel, .ow-drawer .yandex-order-panel, .ow-drawer .site-request-inventory, .ow-drawer .site-request-order { border-radius: 8px; }
.ow-drawer .field-help { font-size: 12px; }

/* Reply templates in the form */
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: -4px; }
.rt-bar[hidden] { display: none; }
.app-shell .rt-bar .rt-pick, .ow-drawer .site-request-manager-form .rt-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.rt-pick > span { display: inline-flex; align-items: center; gap: 6px; color: #526269; font-size: 13px; }
.rt-pick > span svg { width: 16px; height: 16px; }
.app-shell .rt-pick select, .rt-pick select { min-height: 30px; max-width: 300px; padding: 0 8px; border: 1px solid #cdd7d9; border-radius: 8px; background: #fff; font: inherit; font-size: 13px; font-weight: 400; }
.rt-loading { color: #6b7c81; font-size: 12px; }
.rt-note { flex-basis: 100%; color: #9a5a0c; font-size: 12px; }

/* Templates editor */
.rt-dialog { width: min(860px, calc(100vw - 40px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid #cad6d8; border-radius: 10px; color: #26383e; box-shadow: 0 18px 60px rgba(16, 44, 52, 0.25); }
.rt-dialog::backdrop { background: rgba(23, 43, 58, 0.45); }
.rt-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e1e8e9; }
.rt-dialog h2 { margin: 0; font-size: 16px; }
.rt-dialog header p { margin: 4px 0 0; color: #6b7c81; font-size: 12px; }
.rt-dialog code { padding: 1px 5px; border-radius: 4px; background: #f1f5f6; font-size: 12px; }
.rt-dialog .ow-icon { display: inline-flex; width: 34px; height: 34px; padding: 7px; align-items: center; justify-content: center; border: 1px solid #ccd6d9; border-radius: 8px; background: #fff; cursor: pointer; }
.rt-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 360px; }
.rt-list { display: grid; align-content: start; gap: 2px; padding: 10px; border-right: 1px solid #e1e8e9; background: #f7f9f9; overflow: auto; max-height: 60vh; }
.rt-list > button:not(.button) { padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #33474d; font: inherit; font-size: 13px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-list > button:not(.button):hover { background: #eef3f4; }
.rt-list > button[aria-current="true"] { background: #fff; box-shadow: inset 3px 0 #c9470a, 0 0 0 1px #dfe6e8; font-weight: 650; }
.rt-list .button { margin-top: 8px; }
.rt-edit { display: grid; align-content: start; gap: 12px; padding: 14px 18px; }
.rt-edit label { display: grid; gap: 5px; color: #33474d; font-size: 13px; font-weight: 600; }
.rt-edit :is(input, textarea) { width: 100%; padding: 8px 10px; border: 1px solid #cdd7d9; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400; color: #26383e; }
.rt-edit input { min-height: 36px; }
.rt-edit textarea { min-height: 220px; resize: vertical; line-height: 1.5; }
.rt-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-vars .danger { margin-left: auto; }
.rt-meta, .rt-empty { color: #6b7c81; font-size: 12px; }
.rt-error { margin: 0 18px; padding: 10px 12px; border-left: 3px solid #ba3b32; background: #fff1ef; color: #a22b27; font-size: 13px; }
.rt-error[hidden] { display: none; }
.rt-dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e1e8e9; }

/* «Покупатели и подключения» */
.ow-legacy .ow-tabs { margin-bottom: 12px; border-radius: 8px; }
.customer-workspace-layout { gap: 12px; padding: 12px; }
.customer-list-item { padding: 10px 14px; }
.customer-card-detail { padding: 18px; }
.customer-card-detail__head h2 { font-size: 20px; }
.customer-section-head h3 { font-size: 16px; }
.app-shell .site-request-shell.is-connections .kicker { font-size: 11px; }

@media (max-width: 1280px) {
  .ow-toolbar .ow-search { max-width: none; }
  .ow-toolbar .ow-advanced { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .orders-workspace .ow-toolbar { padding: 10px 12px; }
  .ow-toolbar .ow-search { flex-basis: 100%; min-width: 0; }
  .ow-toolbar__end { margin-left: 0; }
  .ow-toolbar .ow-advanced, .is-inquiries .ow-toolbar .ow-advanced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .orders-workspace .ow-table td { padding: 0; }
  .orders-workspace .ow-table td > strong, .orders-workspace .ow-table td > small, .ow-topic span, .ow-topic small { max-width: none; white-space: normal; }
  .ow-drawer .site-request-manager-form__actions { margin: 0 -12px; padding: 10px 12px; }
  .rt-body { grid-template-columns: 1fr; }
  .rt-list { max-height: 160px; border-right: 0; border-bottom: 1px solid #e1e8e9; }
}

/* Inquiries: numbers and dates on one line, columns that fit 1280 px without sideways scrolling */
.orders-workspace .ow-order-link { white-space: nowrap; overflow-wrap: normal; }
.is-inquiries .ow-table td:nth-child(3) { white-space: nowrap; }
.is-inquiries .ow-table th:nth-child(6), .is-inquiries .ow-table td:nth-child(6) { min-width: 180px; max-width: 280px; }
.is-inquiries .ow-table td:nth-child(7) { min-width: 0; }
.is-inquiries .ow-table td:nth-child(8), .is-inquiries .ow-table td:nth-child(9) { min-width: 0; }
.is-inquiries .ow-topic span, .is-inquiries .ow-topic small { max-width: 280px; }
.is-inquiries .ow-table td.ow-topic { width: 38%; max-width: 0; }
.is-inquiries .ow-topic span, .is-inquiries .ow-topic small { max-width: 100%; }
.ow-table small.ow-warn { color: #973d25; }
.ow-reply small { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-inquiries .ow-table td:nth-child(5) { min-width: 0; }

/* Template picker never wraps its label; drawer fields at the shared 36 px */
.rt-pick > span { flex: none; white-space: nowrap; }
.app-shell .rt-pick select, .ow-drawer .site-request-manager-form .rt-pick select { width: auto; min-width: 220px; }
.ow-drawer .site-request-manager-form select, .ow-drawer .site-request-manager-form input[type="text"] { min-height: 36px; padding-block: 0; }
.ow-drawer .inquiry-workflow-fields { gap: 12px; }
.ow-drawer .site-request-manager-form .inquiry-needs-reply { min-height: 36px; }

/* «Покупатели и подключения»: title left, actions right, calmer cards */
.app-shell .site-request-shell.is-connections .section-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-shell .site-request-shell.is-connections .section-row > div { margin-right: auto; }
.app-shell .site-request-shell.is-connections h2, .app-shell .ow-legacy ~ .editor-card h2 { font-size: 20px; }
.app-shell .site-request-shell.is-connections .integration-readiness-list { gap: 10px; }
.app-shell .site-request-shell.is-connections :is(.ozon-readiness, .yandex-readiness) { border-radius: 8px; }
.app-shell .ow-legacy ~ .editor-card, .app-shell .ow-legacy ~ details.editor-card { border-radius: 10px; }
.app-shell .customer-cards, .app-shell .customer-migration { margin: 0 0 12px; padding: 16px 18px; border: 1px solid #dfe6e8; border-radius: 10px; background: #fff; }
.app-shell .customer-cards .cc-toolbar h2, .app-shell .customer-migration h2 { font-size: 20px; }
.app-shell .customer-cards .cc-icon { width: 34px; height: 34px; flex-basis: 34px; padding: 7px !important; }
.app-shell .customer-cards .cc-list:empty, .app-shell .customer-cards .cc-list > p { margin: 0; padding: 14px; color: #6b7c81; font-size: 13px; }
.app-shell .customer-cards .cc-detail > p.muted { color: #6b7c81; font-size: 14px; font-weight: 500; }
/* The Bitrix check is a rare admin tool: its buttons stay secondary, the screen keeps one orange action. */
.app-shell .customer-migration .button.primary { border-color: #ced5d9; background: #fff; color: var(--ink, #171a1d); box-shadow: none; }
.app-shell .customer-migration .button.primary:hover { background: #f5f7f8; }
.app-shell details.customer-import-card { padding: 0; }
.app-shell details.customer-import-card > summary { padding: 14px 18px; }
.ow-toolbar .ow-advanced label { font-weight: 600; }
.app-shell .ow-toolbar .ow-advanced :is(input, select), .app-shell .ow-bulk--inquiries select { font-weight: 400; }

/* «API для выгрузки заказов и продаж» (Продажи → Аккаунты и подключения; public/export-api.js) */
.app-shell .xa { display: grid; gap: 12px; margin: 0 0 12px; padding: 16px 18px; border: 1px solid #dfe6e8; border-radius: 10px; background: #fff; color: #26383e; }
.xa__loading { margin: 0; color: #6b7c81; font-size: 13px; }
.xa__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.app-shell .xa__head h2 { margin: 0 0 4px; font-size: 20px; }
.xa__head p { margin: 0; max-width: 760px; color: #5f6f74; font-size: 13px; line-height: 1.5; }
.xa__head .button { flex: none; }
.xa-card { padding: 12px 14px; border: 1px solid #e3e9ea; border-radius: 8px; background: #fafbfb; }
.xa-url > label { display: block; margin-bottom: 6px; color: #46565b; font-size: 12px; font-weight: 650; }
.xa-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-shell .xa-row input, .xa-dialog .xa-row input { flex: 1 1 300px; min-width: 0; min-height: 30px; padding: 0 10px; border: 1px solid #cdd7d9; border-radius: 8px; background: #fff; color: #26383e; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.xa-hint { margin: 8px 0 0; color: #6b7c81; font-size: 12px; line-height: 1.5; }
.xa code, .xa-dialog code { padding: 1px 5px; border-radius: 4px; background: #eef3f4; font-size: 12px; }
.xa-keys h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.xa-keys h3 span { color: #6b7c81; font-size: 12px; font-weight: 500; }
.xa-list { display: grid; margin: 0; padding: 0; list-style: none; }
.xa-key { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 10px 0; border-top: 1px solid #e6ecec; }
.xa-list > .xa-key:first-child { border-top: 0; padding-top: 2px; }
.xa-key__main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; font-size: 14px; }
.xa-key__main b { overflow-wrap: anywhere; }
.xa-key__meta { grid-column: 1; margin: 0; color: #6b7c81; font-size: 12px; line-height: 1.45; }
.xa-key .button { grid-column: 2; grid-row: 1 / span 2; }
.xa-key.is-revoked .xa-key__main { color: #6b7c81; }
.xa-key.is-revoked .xa-key__main b { font-weight: 600; }
.xa-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; background: #eef1f3; color: #4f5f64; font-size: 11px; font-weight: 650; white-space: nowrap; }
.xa-pill.is-personal { background: #fff4e5; color: #8a4b00; }
.xa-empty { margin: 0; color: #6b7c81; font-size: 13px; }
.xa-revoked { margin-top: 8px; }
.xa-revoked > summary { color: #5f6f74; font-size: 12px; font-weight: 650; cursor: pointer; }
.xa-revoked .xa-list { margin-top: 6px; }
.rt-dialog.xa-dialog { width: min(560px, calc(100vw - 32px)); }
.xa-form, .xa-created { display: grid; gap: 14px; padding: 16px 18px; }
.xa-form .rt-error { margin: 0; }
.xa-field { display: grid; gap: 5px; color: #33474d; font-size: 13px; font-weight: 600; }
.xa-field input { width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid #cdd7d9; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 400; color: #26383e; }
.xa-field small, .xa-check small { color: #6b7c81; font-size: 12px; font-weight: 400; line-height: 1.45; }
.xa-check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid #e3e9ea; border-radius: 8px; background: #fafbfb; font-size: 13px; cursor: pointer; }
.xa-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; }
.xa-check b { display: block; margin-bottom: 2px; font-weight: 650; }
.xa-warning { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-left: 3px solid #c9470a; border-radius: 0 8px 8px 0; background: #fff6ef; color: #6e3410; font-size: 13px; line-height: 1.45; }
.xa-warning svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: #c9470a; }
.xa-created .xa-hint { margin: 0; }
@media (max-width: 700px) {
  .app-shell .xa { padding: 14px; }
  .xa__head { flex-direction: column; gap: 10px; }
  .xa-row .button { flex: 1 1 auto; }
  .xa-key { grid-template-columns: minmax(0, 1fr); }
  .xa-key .button { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
}
