:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: #18212b;
  background: #f4f6f8;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --line: #d9e0e6;
  --line-strong: #b7c2cc;
  --text: #18212b;
  --muted: #65717d;
  --primary: #146c63;
  --primary-hover: #0f5750;
  --danger: #a7362b;
  --danger-bg: #fff3f1;
  --warning: #9a6200;
  --success: #147346;
  --focus: #287fc1;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #eef2f4;
}

.auth-panel {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 14px 36px rgba(25, 41, 56, 0.1);
}

.auth-panel h1 { margin: 18px 0 8px; font-size: 25px; }
.auth-panel p { margin: 0 0 24px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  background: #fff;
  color: white;
  font-weight: 800;
  font-size: 17px;
  border-radius: 16px;
  overflow: hidden;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.language-button { position: fixed; top: 18px; right: 20px; border: 1px solid var(--line); background: white; padding: 8px 12px; border-radius: 6px; color: var(--text); }

.form-stack { display: grid; gap: 16px; }
label > span { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; color: #34414d; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: white;
  color: var(--text);
  padding: 8px 10px;
}
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 8px 13px;
  font-weight: 650;
}
button:disabled { opacity: 0.48; cursor: not-allowed; }
.primary { background: var(--primary); color: white; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.secondary { background: white; border-color: var(--line-strong); color: var(--text); }
.secondary:hover:not(:disabled) { background: #eef3f5; }
.danger { background: var(--danger-bg); border-color: #e7b8b2; color: var(--danger); }
.compact { min-height: 44px; padding: 5px 10px; font-size: 13px; }
.icon-button { width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; font-size: 24px; color: var(--muted); }
.link-button { min-height: 44px; padding: 3px 7px; border: 0; background: transparent; color: #12625b; font-size: 13px; }
.table-link { min-height: 44px; padding: 3px 0; border: 0; background: transparent; color: #12625b; text-align: left; text-decoration: underline; }
.link-button.danger-text { color: var(--danger); }
.form-status { min-height: 22px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.form-status.error { color: var(--danger); }
.form-status.success { color: var(--success); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  background: #153738;
  color: white;
  border-right: 1px solid #0d2a2b;
}
.sidebar-brand { display: flex; gap: 11px; align-items: center; min-height: 76px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { margin-top: 3px; font-size: 12px; color: #b9cccc; }
.sidebar nav { display: grid; gap: 3px; padding: 14px 10px; }
.nav-button { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; color: #d6e2e2; text-align: left; }
.nav-button:hover, .nav-button.active { background: #245151; color: white; }
.nav-glyph { width: 24px; font: 700 11px/1 Consolas, monospace; color: #89b5b1; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 13px; }
.sidebar-footer span { display: block; overflow-wrap: anywhere; }
.sidebar-footer .muted { color: #adc2c2; margin-top: 3px; }

.workspace { grid-column: 2; min-width: 0; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 21px; }
.topbar p { margin: 3px 0 0; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.global-status { margin: 14px 24px 0; padding: 10px 12px; border: 1px solid var(--line); background: white; border-radius: 5px; font-size: 13px; }
.global-status.error { color: var(--danger); border-color: #e5aaa3; background: var(--danger-bg); }
.global-status.success { color: var(--success); border-color: #add9c3; background: #effaf4; }

.view { display: none; padding: 20px 24px 40px; }
.view.active { display: block; }
.toolbar { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.filter-group { display: flex; gap: 8px; width: min(620px, 100%); }
.filter-group input { flex: 1; }
.filter-group select { width: 150px; }
.section-note { margin: 0; color: var(--muted); font-size: 13px; }

.table-wrap { width: 100%; overflow-x: auto; overflow-y: visible; border: 1px solid var(--line); background: white; overscroll-behavior-inline: contain; }
table { width: 100%; min-width: 840px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e7ebef; vertical-align: middle; text-align: left; font-size: 13px; }
th { position: sticky; top: 0; background: #eef2f4; color: #43505c; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: #f8fafb; }
tbody tr:last-child td { border-bottom: 0; }
.actions-column { width: 210px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.status-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.status-badge.enabled { color: #126340; background: #e9f7ef; }
.status-badge.disabled { color: #8c3028; background: #fbecea; }
.status-badge.warning { color: #845400; background: #fff4d9; }
.scope-list, .permission-list { display: flex; flex-wrap: wrap; gap: 4px; }
.scope-chip, .permission-chip { display: inline-block; border: 1px solid #cdd8dc; background: #f4f8f8; padding: 2px 6px; border-radius: 4px; font-size: 11px; overflow-wrap: anywhere; }
.empty { padding: 32px; text-align: center; color: var(--muted); background: white; border: 1px solid var(--line); }

.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; }
.segmented button { border: 0; border-right: 1px solid var(--line-strong); border-radius: 0; background: white; color: var(--muted); }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: #dfeceb; color: #124d48; }
.filter-bar { display: flex; align-items: end; gap: 10px; margin-bottom: 10px; }
.filter-bar > input { width: min(440px, 100%); }
.filter-bar label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.filter-bar label input { width: 150px; color: var(--text); font-size: 14px; }

.data-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr); gap: 18px; }
.data-main, .snapshot-band { border: 1px solid var(--line); background: white; padding: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.drop-zone { min-height: 170px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 20px; border: 2px dashed #a8b4bf; border-radius: 6px; background: #f9fbfc; text-align: center; cursor: pointer; }
.drop-zone.drag { border-color: var(--primary); background: #edf7f6; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.actions-row { display: flex; gap: 9px; margin-top: 14px; }
.actions-row.no-margin { margin-top: 0; }
.subsection-title { margin-top: 24px; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.advanced-sources { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.advanced-sources summary { cursor: pointer; font-weight: 700; }
.reference-upload { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.reference-list { display: grid; gap: 6px; margin-top: 10px; }
.reference-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 90px auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 7px; font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.metric { border: 1px solid var(--line); padding: 10px; min-height: 68px; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 7px; font-size: 15px; overflow-wrap: anywhere; }
.message-list { display: grid; gap: 7px; margin-top: 12px; }
.message-item { padding: 8px 10px; border-left: 3px solid var(--warning); background: #fff9ea; font-size: 12px; }
.message-item.error { border-left-color: var(--danger); background: #fff0ef; }
.detail-list { margin: 0; display: grid; }
.detail-list div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid #e8ecef; }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }

.operator-heading { align-items: flex-start; }
.operator-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.operator-tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.operator-tab.active { border-bottom-color: var(--primary); color: var(--primary); background: #edf7f6; }
.operator-pane[hidden] { display: none; }
.operator-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 18px; align-items: start; }
.release-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 0.55fr); }
.operator-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 14px; }
.operator-table-wrap table { min-width: 920px; }
.operator-detail-card, .release-selection-card { min-width: 0; padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.operator-detail-card h3, .release-selection-card h3 { margin: 0 0 5px; font-size: 17px; }
.operator-detail-card h4 { margin: 0 0 8px; font-size: 13px; }
.operator-detail-card section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.operator-detail-card .detail-list { margin-top: 8px; }
.operator-detail-card details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.operator-detail-card details summary { cursor: pointer; font-weight: 700; }
.operator-report { max-height: 280px; overflow: auto; margin: 8px 0 0; padding: 10px; background: #18272a; color: #d8ece8; border-radius: 4px; font: 11px/1.5 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.operator-status { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.operator-status .status-badge { margin-right: 3px; }
.release-selection-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.release-selection-card label > span { margin: 0; }
.change-preview { margin-top: 14px; padding: 12px; border: 1px solid var(--line); background: var(--surface-subtle); min-height: 90px; }
.change-preview section + section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.change-preview h4 { margin: 0 0 5px; font-size: 12px; }
.change-preview ul { margin: 5px 0 0; padding-left: 18px; }
.operator-danger { color: var(--danger); }
.operator-success { color: var(--success); }
.operator-warn { color: var(--warning); }
@media (max-width: 1100px) {
  .operator-layout, .release-layout { grid-template-columns: 1fr; }
  .operator-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.location-heading { align-items: flex-start; }
.location-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.location-tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.location-tab.active { border-bottom-color: var(--primary); color: var(--primary); background: #edf7f6; }
.location-tab:focus-visible { position: relative; z-index: 1; outline-offset: -3px; }
.location-pane[hidden] { display: none; }
.location-pane-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.location-pane-heading h3 { margin: 0 0 4px; font-size: 16px; }
.location-operation-panel { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); background: var(--surface-subtle); }
.location-operation-panel[aria-disabled="true"], .location-operation-panel.is-read-only { border-color: #d4b6b1; background: #fff8f6; }
.location-operation-panel[aria-disabled="true"] .location-operation-action, .location-operation-panel.is-read-only .location-operation-action { pointer-events: none; }
.location-mutation-toolbar:empty { display: none; }
.location-mutation-toolbar > .row-actions { justify-content: flex-start; margin: 0; }
.location-mutation-toolbar .location-city-action-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.location-mutation-toolbar .location-city-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 48px; padding: 4px 8px; border: 1px solid var(--line); background: white; }
.location-mutation-toolbar .location-city-actions strong { margin-right: 4px; }
.location-operation-heading { margin-bottom: 12px; }
.location-operation-heading h3 { margin: 0 0 4px; font-size: 15px; }
.location-operation-set { min-width: 0; margin: 0; padding: 0; border: 0; }
.location-operation-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.location-operation-group { min-width: 0; padding: 12px; border: 1px solid var(--line); background: var(--surface); }
.location-operation-group h4 { margin: 0 0 9px; font-size: 13px; }
.location-operation-list { display: grid; gap: 7px; }
.location-operation-action { width: 100%; min-height: 48px; text-align: left; overflow-wrap: anywhere; }
.location-operation-action[data-target-scope]:not([data-target-scope="none"]) { border-style: dashed; }
.location-operation-context { display: grid; grid-template-columns: auto minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line-strong); background: white; font-size: 12px; }
.location-operation-context > * { min-width: 0; overflow-wrap: anywhere; }
.location-operation-context strong { color: var(--text); }
.context-label { color: var(--muted); font-weight: 700; }
.location-read-only-message { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--warning); background: #fff9ea; color: var(--warning); font-size: 12px; }
#locationsView button, #locationsView input, #locationsView select, #locationsView textarea { min-height: 48px; }
#locationsView .location-tab, #locationsView .link-button, #locationsView .table-link { min-height: 48px; }
#locationsView .checkbox-row input { width: 48px; min-height: 48px; }
.location-filter-field { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 12px; }
.location-filter-field > span { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.location-filters { display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px; }
.location-catalog-wrap { border-radius: 5px; }
.location-catalog-wrap { overflow-x: auto; overflow-y: visible; }
.location-catalog-table { min-width: 960px; table-layout: fixed; }
.location-catalog-table th, .location-catalog-table td { overflow-wrap: anywhere; }
.location-catalog-table th:nth-child(1) { width: 13%; }
.location-catalog-table th:nth-child(2) { width: 18%; }
.location-catalog-table th:nth-child(3) { width: 10%; }
.location-catalog-table th:nth-child(4), .location-catalog-table th:nth-child(5) { width: 11%; }
.location-catalog-table th:nth-child(6) { width: 12%; }
.location-catalog-table th:nth-child(7), .location-catalog-table th:nth-child(8) { width: 9%; }
.location-catalog-table .actions-column { width: 220px; min-width: 220px; }
.location-catalog-table .row-actions { justify-content: flex-start; min-width: max-content; }
#locationCatalogTable [data-location-action="edit"], #locationCatalogTable [data-location-operation] { display: none !important; }
.location-pagination { display: flex; justify-content: flex-end; margin-top: 12px; }
.mapping-state { display: inline-flex; padding: 3px 6px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.mapping-state.mapped { color: #126340; background: #e9f7ef; }
.mapping-state.historical { color: #765114; background: #fff4d9; }
.mapping-state.unmapped { color: #8c3028; background: #fbecea; }
.location-detail-card { padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.detail-header h3 { margin: 3px 0; font-size: 21px; }
.eyebrow { margin: 0; color: var(--primary); font-size: 12px; font-weight: 700; }
.detail-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 16px; }
.detail-sections > section, .technical-details { min-width: 0; padding: 14px; border: 1px solid var(--line); background: var(--surface-subtle); }
.detail-sections h4 { margin: 0 0 8px; font-size: 14px; }
.detail-empty, .detail-section-note { margin: 0; color: var(--muted); font-size: 12px; }
.detail-sublist { display: grid; gap: 6px; margin-top: 12px; font-size: 12px; }
.mapping-row { display: grid; grid-template-columns: .7fr 1.2fr 1fr; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.blocker-list, .audit-history { margin: 8px 0 0; padding-left: 18px; font-size: 12px; }
.audit-history li { margin: 5px 0; }
.audit-history li span { display: block; color: var(--muted); }
.technical-details { grid-column: 1 / -1; }
.technical-details .detail-list code { overflow-wrap: anywhere; }
.technical-details summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.technical-restricted-empty { margin-top: 10px; padding: 12px; border: 1px dashed var(--line-strong); background: white; color: var(--muted); font-size: 12px; }
.technical-restricted-empty strong { display: block; margin-bottom: 4px; color: var(--warning); }
.technical-restricted-empty p { margin: 0; }
.technical-access-note { margin: 12px 0 0; padding: 10px 12px; border: 1px dashed var(--line); background: var(--surface-subtle); color: var(--muted); font-size: 12px; }
.warning-text { color: var(--warning); }
.success-text { color: var(--success); }
.change-warning { margin-bottom: 14px; padding: 10px; border-left: 3px solid var(--warning); background: #fff9ea; color: var(--warning); font-size: 13px; }
.change-preview { max-height: 220px; overflow: auto; padding: 10px; background: #18212b; color: #eef6f6; white-space: pre-wrap; overflow-wrap: anywhere; }
.compact-heading { margin-bottom: 10px; }
.scope-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface-subtle); font-size: 12px; }
.scope-key { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 8px; border-radius: 12px; font-weight: 700; }
.scope-key.direct { color: #235b8f; background: #eaf3fb; }
.scope-key.effective { color: #126340; background: #e9f7ef; }
.table-head-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; white-space: normal; }
.location-mutation-fields fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.location-mutation-fields label > span { min-width: 0; }
.location-mutation-fields input, .location-mutation-fields select, .location-mutation-fields textarea { min-height: 48px; }
.location-mutation-fields .checkbox-row { align-items: center; min-height: 48px; }
.location-mutation-fields .checkbox-row > span { margin: 0; }
.field-error { min-height: 22px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }

.modal { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; box-shadow: 0 18px 50px rgba(16, 31, 44, 0.25); }
.modal::backdrop { background: rgba(22, 34, 45, 0.45); }
.modal-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px; overflow-y: auto; max-height: calc(100vh - 190px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #f8fafb; }
.modal .form-status { padding: 0 18px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-grid .full { grid-column: 1 / -1; }
.checkbox-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px; border: 1px solid var(--line); max-height: 260px; overflow: auto; }
.checkbox-row { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; }
.checkbox-row input { width: 16px; min-height: 16px; margin: 1px 0 0; }
.stock-location-access { min-width: 0; margin: 2px 0 0; padding: 12px; border: 1px solid var(--line-strong); background: #fbfdfd; }
.stock-location-access legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.stock-location-demo-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.stock-location-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.stock-location-actions { display: flex; gap: 8px; }
.stock-location-count { color: var(--muted); font-size: 12px; }
.stock-location-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 280px; overflow: auto; }
.stock-location-option { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 8px; border: 1px solid var(--line); background: white; cursor: pointer; }
.stock-location-option:hover { border-color: var(--line-strong); background: #f5faf9; }
.stock-location-option > span { display: block; margin: 0; font-size: 12px; font-weight: 500; }
.stock-location-option > .stock-location-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stock-location-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-location-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.stock-location-option input { width: 16px; min-height: 16px; margin: 0; }
.stock-location-option.is-disabled { opacity: .65; }
.location-kind-tag { display: inline-flex; align-items: center; width: fit-content; padding: 2px 5px; border-radius: 10px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.location-kind-tag.primary { color: #126340; background: #e9f7ef; }
.location-kind-tag.consignment { color: #765114; background: #fff4d9; }
.stock-location-option > .location-kind-tag { justify-self: end; }
.stock-location-empty { margin: 0; padding: 12px; border: 1px dashed var(--line); }
.stock-scope-chip { display: inline-flex; align-items: center; gap: 4px; }
.stock-scope-chip .location-kind-tag { font-size: 9px; }
.secret-modal { width: min(480px, calc(100vw - 28px)); }
.secret-value { display: block; padding: 18px; border: 1px solid #aec6c3; background: #edf7f6; font-size: 22px; text-align: center; overflow-wrap: anywhere; user-select: all; }
.pairing-qr { display: block; width: min(280px, 100%); margin: 0 auto 14px; border: 1px solid var(--line); background: white; }
.confirm-modal { width: min(470px, calc(100vw - 28px)); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 70px minmax(0, 1fr); }
  .sidebar { width: 70px; }
  .sidebar-brand { justify-content: center; padding: 12px 8px; }
  .sidebar-brand > div:last-child, .nav-button span:last-child, .sidebar-footer { display: none; }
  .nav-button { justify-content: center; }
  .workspace { grid-column: 2; }
  .data-layout { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 640px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar-brand { display: none; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .nav-button { flex-direction: column; justify-content: center; gap: 3px; min-height: 54px; padding: 6px 4px; }
  .nav-button span:last-child { display: inline; max-width: 100%; font-size: 11px; line-height: 1.15; overflow-wrap: anywhere; }
  .workspace { min-width: 0; }
  .topbar { padding: 12px; display: block; }
  .topbar-actions { margin-top: 10px; justify-content: flex-start; }
  .view { padding: 14px 12px 30px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-group { flex-direction: column; }
  .filter-group select { width: 100%; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar label input { width: 100%; }
  .field-grid, .checkbox-list, .stock-location-grid, .metrics, .location-filters, .detail-sections { grid-template-columns: 1fr; }
  .location-operation-groups { grid-template-columns: 1fr; }
  .location-operation-context { grid-template-columns: 1fr; gap: 4px; }
  .location-tabs { display: grid; grid-template-columns: 1fr; }
  .location-tab { width: 100%; text-align: left; }
  .location-catalog-table th, .location-catalog-table td { padding: 8px 6px; font-size: 11px; }
  .location-catalog-table { min-width: 960px; table-layout: fixed; }
  .location-catalog-table .actions-column { width: 220px; min-width: 220px; }
  .detail-header { display: block; }
  .detail-header .row-actions { justify-content: flex-start; margin-top: 10px; }
  .mapping-row { grid-template-columns: 1fr; gap: 3px; }
  .reference-upload, .reference-row { grid-template-columns: 1fr; }
}
