/* ═══════════════════════════════════════════════════════════════
   admin-premium.css — LDSP premium admin UI design system
   ═══════════════════════════════════════════════════════════════
   R27 Stage 2: новый дизайн-язык для admin-экранов (Cluster B/A/C/D/E)
   BEM с префиксом .a-* · 0 inline styles · Inter font · warm palette
   OPT-IN: подключается через <link> в web/index.html, но пока
   НИ ОДИН существующий admin-экран его не использует.
   Starting point для поэтапной миграции в R28+ (OrdersTable → Kanban
   → OrderDetail admin → Dashboard → Kpi → Analytics → Ops → MatDb etc).

   Design tokens общие с client-screens.css (тёплый off-white, deep
   green brand, Inter) — staff увидит тот же визуальный язык что
   клиенты. Но density компактнее: staff работает долго и нужно больше
   информации на экране.
   ═══════════════════════════════════════════════════════════════ */

.ldsp-admin {
  /* Palette — тот же warm off-white + deep green brand что в client */
  --bg: #F2EFE9;
  --surface: #FDFCF9;
  --surface-2: #FBFAF6;
  --surface-3: #F8F5EE;
  --text: #1C1B14;
  --text-2: rgba(28, 27, 20, 0.65);
  --muted: rgba(28, 27, 20, 0.50);
  --muted-2: rgba(28, 27, 20, 0.35);
  --border: rgba(28, 27, 20, 0.09);
  --border-strong: rgba(28, 27, 20, 0.16);
  --brand: #0C7A45;
  --brand-2: #085C33;
  --brand-3: #0A6A3C;
  --brand-light: rgba(12, 122, 69, 0.10);
  --brand-glow: rgba(12, 122, 69, 0.20);
  --brand-warm: #E8B14A;
  --warn: #C96B0A;
  --warn-light: rgba(201, 107, 10, 0.10);
  --bad: #C8231D;
  --bad-light: rgba(200, 35, 29, 0.10);
  --info: #1E6FC8;
  --info-light: rgba(30, 111, 200, 0.10);
  --violet: #6D3FD6;
  --violet-light: rgba(109, 63, 214, 0.10);
  --shadow-1: 0 2px 14px rgba(28, 27, 20, 0.07), 0 1px 3px rgba(28, 27, 20, 0.04);
  --shadow-2: 0 10px 38px rgba(28, 27, 20, 0.12), 0 4px 10px rgba(28, 27, 20, 0.06);
  --shadow-3: 0 22px 60px rgba(28, 27, 20, 0.18), 0 8px 20px rgba(28, 27, 20, 0.08);
  --shadow-brand: 0 6px 24px rgba(12, 122, 69, 0.24);

  /* Radii — compact admin sizes */
  --a-r8: 8px;
  --a-r10: 10px;
  --a-r12: 12px;
  --a-r14: 14px;
  --a-r16: 16px;

  --a-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --a-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --a-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --a-dur-fast: 180ms;
  --a-dur: 280ms;
  --a-dur-slow: 520ms;

  /* Admin-specific sizing (compact vs client spacious) */
  --a-sidebar-w: 220px;
  --a-sidebar-collapsed-w: 60px;
  --a-topbar-h: 52px;
  --a-row-h: 36px;

  font-family: var(--a-font);
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.01em;
  min-height: 100vh;
}
.ldsp-admin *,
.ldsp-admin *::before,
.ldsp-admin *::after { box-sizing: border-box; }

/* ─── Keyframes (prefixed to avoid collision with client-screens) ─── */
@keyframes a-fadeUp { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes a-slideInLeft { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes a-scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes a-rowFlash { 0% { background: var(--brand-light); } 100% { background: transparent; } }
@keyframes a-cardFlash {
  0% { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
  100% { border-color: var(--border); box-shadow: none; }
}
@keyframes a-cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes a-blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.35; } }
@keyframes a-toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes a-drawerIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes a-cmdIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT: shell with collapsible sidebar + main content
   ═══════════════════════════════════════════════════════════════ */

.a-shell {
  display: grid;
  grid-template-columns: var(--a-sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.a-shell--collapsed { grid-template-columns: var(--a-sidebar-collapsed-w) 1fr; }

/* ─── Sidebar ─── */
.a-side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.a-side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.a-side__logo {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.a-side__name { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.a-side__subtitle {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 1px;
}

.a-side__search {
  margin: 6px 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--a-dur-fast) var(--a-ease);
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.a-side__search:hover {
  border-color: var(--brand-glow);
  background: var(--brand-light);
  color: var(--brand);
}
.a-side__kbd {
  margin-left: auto;
  font-family: ui-monospace, monospace;
  font-size: 9px;
  padding: 2px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}

.a-side__group-t {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 10px 4px;
}
.a-side__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--a-dur-fast) var(--a-ease);
  position: relative;
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  letter-spacing: -0.005em;
  width: 100%;
  text-align: left;
}
.a-side__item:hover { background: var(--brand-light); color: var(--brand); }
.a-side__item.is-active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}
.a-side__item.is-active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--brand);
  border-radius: 2px;
}
.a-side__item svg { flex-shrink: 0; color: currentColor; opacity: 0.85; }
.a-side__item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}
.a-side__item-badge--muted { background: rgba(28, 27, 20, 0.08); color: var(--muted); }

.a-side__user {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.a-side__user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--a-dur-fast) var(--a-ease);
}
.a-side__user-row:hover { background: var(--surface-2); }
.a-side__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8B14A 0%, #C08820 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}
.a-side__user-name { font-size: 12px; font-weight: 600; }
.a-side__user-role {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ─── Main column ─── */
.a-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* ─── Topbar ─── */
.a-topbar {
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--a-topbar-h);
  animation: a-fadeUp 400ms var(--a-ease);
}
.a-topbar__crumbs {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.a-topbar__crumbs b {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.a-topbar__crumb-sep {
  width: 10px;
  height: 10px;
  color: var(--muted-2);
  flex-shrink: 0;
}
.a-topbar__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Live pill (SSE stream indicator) ─── */
.a-live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 999px;
  white-space: nowrap;
}
.a-live-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: a-blink 1.2s infinite;
}
.a-live-pill--offline { background: rgba(28, 27, 20, 0.06); color: var(--muted); }
.a-live-pill--offline .a-live-pill__dot {
  background: var(--muted);
  animation: none;
}

/* ─── Content area ─── */
.a-content {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
}

/* ─── Page header ─── */
.a-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.a-page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
}
.a-page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}
.a-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — compact admin sizes
   ═══════════════════════════════════════════════════════════════ */

.a-btn {
  font-family: var(--a-font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--a-r8);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all var(--a-dur-fast) var(--a-ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
}
.a-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
  border-color: var(--muted);
}
.a-btn:active { transform: scale(0.97); }
.a-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-light);
  border-color: var(--brand);
}
.a-btn:disabled,
.a-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.a-btn--primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.a-btn--primary:hover {
  background: var(--brand-2);
  box-shadow: var(--shadow-brand);
  border-color: var(--brand-2);
}
.a-btn--sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}
.a-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.a-btn--ghost:hover { background: var(--brand-light); color: var(--brand); }
.a-btn--icon { padding: 7px; }
.a-btn--danger {
  color: var(--bad);
  border-color: rgba(200, 35, 29, 0.3);
}
.a-btn--danger:hover { background: var(--bad-light); }

/* ═══════════════════════════════════════════════════════════════
   STAT CARDS — with inline sparklines
   ═══════════════════════════════════════════════════════════════ */

.a-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .a-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .a-stats { grid-template-columns: 1fr; } }

.a-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--a-dur) var(--a-ease);
}
.a-stat:hover {
  border-color: var(--brand-glow);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}
.a-stat__l {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.a-stat__v {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.a-stat__v--brand { color: var(--brand); }
.a-stat__v--warn { color: var(--warn); }
.a-stat__v--bad { color: var(--bad); }
.a-stat__delta {
  font-size: 11px;
  font-weight: 600;
}
.a-stat__delta--up { color: var(--brand); }
.a-stat__delta--down { color: var(--bad); }
.a-stat__spark {
  position: absolute;
  right: 12px;
  bottom: 10px;
  height: 28px;
  width: 70px;
  pointer-events: none;
  opacity: 0.55;
}

/* ═══════════════════════════════════════════════════════════════
   FILTERS BAR — search + chips + inline buttons
   ═══════════════════════════════════════════════════════════════ */

.a-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r12);
  padding: 10px 14px;
}
.a-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.a-search__input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  font-family: var(--a-font);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  letter-spacing: -0.005em;
  color: var(--text);
}
.a-search__input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.a-search__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.a-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--a-dur-fast) var(--a-ease);
  white-space: nowrap;
  font-family: inherit;
}
.a-chip:hover { border-color: var(--brand-glow); color: var(--brand); }
.a-chip.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
}
.a-chip__count {
  margin-left: 5px;
  font-size: 10px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════
   DATA TABLE — sticky header, sortable, hover, row flash on new
   ═══════════════════════════════════════════════════════════════ */

.a-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  overflow: hidden;
}
.a-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.a-table th {
  background: var(--surface-2);
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}
.a-table th.is-sortable { cursor: pointer; }
.a-table th.is-sortable:hover { color: var(--brand); background: var(--brand-light); }
.a-table th.a-table__num,
.a-table td.a-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.a-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.a-table tbody tr {
  cursor: pointer;
  transition: background var(--a-dur-fast) var(--a-ease);
}
.a-table tbody tr:hover td { background: var(--surface-2); }
.a-table tbody tr.is-new td { animation: a-rowFlash 2s var(--a-ease); }
.a-table tbody tr.is-selected td { background: var(--brand-light); }
.a-table tbody tr:last-child td { border-bottom: none; }
.a-table__note {
  color: var(--muted);
  font-size: 11px;
}

.a-pager {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
}

.a-rates-grid {
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  background: var(--surface);
  overflow: hidden;
}
.a-matdb-grid,
.a-proc-grid {
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  background: var(--surface);
  overflow: hidden;
}
.a-rates-grid .ag-header-cell-text {
  font-size: 11px;
  font-weight: 700;
}
.a-rates-grid .ag-cell {
  font-size: 12px;
}
.a-rates-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.a-rates-toolbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.a-rates-search--sm {
  width: 180px;
}
.a-rates-search--md {
  width: 200px;
}
.a-rates-section-title {
  font-weight: 800;
}
.a-rates-section-subtitle {
  font-size: 12px;
  color: #64748b;
}
.a-rates-form-grid {
  background: rgba(248,250,252,.96);
  border: 1px solid rgba(15,23,42,.1);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
  gap: 10px;
}
.a-rates-form-label {
  font-size: 13px;
}
.a-rates-form-label--span2 {
  grid-column: span 2;
}
.a-rates-field-control {
  display: block;
  margin-top: 4px;
  width: 100%;
}
.a-rates-form-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.a-rates-skeleton-lg {
  height: 200px;
  border-radius: 8px;
}
.a-rates-skeleton-md {
  height: 180px;
  border-radius: 8px;
}
.a-rates-table {
  width: 100%;
}
.a-rates-table--md {
  font-size: 13px;
}
.a-rates-table--sm {
  font-size: 12px;
}
.a-rates-empty-cell {
  text-align: center;
  padding: 20px;
  color: #94a3b8;
}
.a-rates-cell-right {
  text-align: right;
}
.a-rates-cell-meta {
  font-size: 12px;
  color: #64748b;
}
.a-rates-cell-meta-warn {
  font-size: 12px;
  color: #b45309;
}
.a-rates-cell-semibold {
  font-weight: 600;
}
.a-rates-cell-mono-sm {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}
.a-rates-cell-right-meta {
  text-align: right;
  font-size: 11px;
  color: #64748b;
}
.a-rates-cell-right-strong {
  text-align: right;
  font-weight: 600;
}
.a-rates-cell-fs11-muted {
  font-size: 11px;
  color: #64748b;
}
.a-rates-users-title {
  font-weight: 800;
  margin-bottom: 6px;
}
.a-rates-users-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}
.a-rates-users-search {
  width: 260px;
  margin-bottom: 12px;
}
.a-rates-head-right {
  text-align: right;
}
.a-rates-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.a-rates-header-actions {
  display: flex;
  gap: 8px;
}
.a-rates-table-actions {
  display: flex;
  gap: 6px;
}
.a-rates-btn-sm {
  font-size: 12px;
}
.a-rates-code {
  font-size: 11px;
}
.a-rates-lock-banner {
  margin-bottom: 12px;
}
.a-rates-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.a-rates-subtabs__btn {
  font-size: 13px;
}
.a-rates-import-shell {
  max-width: 720px;
}
.a-rates-import-title {
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 15px;
}
.a-rates-import-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 18px;
}
.a-rates-import-dropzone {
  border: 2px dashed var(--a-drop-border, rgba(15,23,42,.15));
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  background: var(--a-drop-bg, #fafbfc);
  transition: all var(--a-dur-fast) var(--a-ease);
  margin-bottom: 16px;
}
.a-rates-import-dropzone.is-drag-over {
  border-color: rgba(12,122,69,.5);
  background: rgba(12,122,69,.03);
}
.a-rates-import-dropzone__icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.a-rates-import-dropzone__hint {
  font-size: 14px;
  color: #475569;
  margin-bottom: 12px;
}
.a-rates-import-dropzone__filename {
  font-weight: 600;
  color: var(--brand);
}
.a-rates-import-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.a-rates-import-confirm {
  padding: 10px 14px;
  background: rgba(220,38,38,.06);
  border: 1px solid rgba(220,38,38,.2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
}
.a-rates-import-confirm__title {
  font-weight: 700;
  font-size: 13px;
}
.a-rates-import-confirm__text {
  font-size: 12px;
  color: #64748b;
}
.a-rates-import-confirm__actions {
  display: flex;
  gap: 6px;
}
.a-rates-btn--grow {
  flex: 1;
}
.a-rates-btn--danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #dc2626;
  font-weight: 700;
}
.a-rates-import-preview {
  border: 1px solid rgba(34,197,94,.2);
  border-radius: 12px;
  padding: 16px;
  background: rgba(34,197,94,.03);
}
.a-rates-import-preview.is-error {
  border-color: rgba(220,38,38,.2);
  background: rgba(220,38,38,.03);
}
.a-rates-import-preview__title {
  font-weight: 800;
  margin-bottom: 8px;
}
.a-rates-import-preview__title.is-error {
  color: #dc2626;
}
.a-rates-import-preview__title.is-ok {
  color: #16a34a;
  margin-bottom: 12px;
}
.a-rates-import-preview__line {
  font-size: 12px;
}
.a-rates-import-preview__line.is-error {
  color: #dc2626;
}
.a-rates-import-preview__more {
  font-size: 12px;
  color: #94a3b8;
}
.a-rates-import-preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.a-rates-import-metric {
  text-align: center;
  padding: 10px;
  border: 1px solid rgba(15,23,42,.07);
  border-radius: 8px;
}
.a-rates-import-metric__value {
  font-size: 22px;
  font-weight: 800;
}
.a-rates-import-metric__label {
  font-size: 11px;
  color: #64748b;
}
.a-rates-import-diff {
  font-size: 12px;
  color: #475569;
}
.a-rates-import-diff__title {
  font-weight: 700;
  margin-bottom: 6px;
}
.a-rates-import-diff__line {
  margin-bottom: 3px;
}
.a-rates-import-diff__op {
  margin-right: 6px;
}
.a-rates-import-diff__op.is-add {
  color: #16a34a;
}
.a-rates-import-diff__op.is-del {
  color: #dc2626;
}
.a-rates-import-diff__op.is-edit {
  color: #d97706;
}
.a-rates-import-diff__prices {
  color: #94a3b8;
}
.a-matdb-grid .ag-header-cell-text,
.a-proc-grid .ag-header-cell-text {
  font-size: 11px;
  font-weight: 700;
}
.a-matdb-grid .ag-cell,
.a-proc-grid .ag-cell {
  font-size: 12px;
}
.a-matdb-grid--compact .ag-cell {
  font-size: 11px;
}

.a-import-shell {
  max-width: 720px;
}
.a-import-shell--narrow {
  max-width: 600px;
}
.a-import-note {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}
.a-import-dropzone {
  border: 2px dashed var(--a-drop-border, rgba(15,23,42,.15));
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  background: var(--a-drop-bg, #fafbfc);
  transition: all var(--a-dur-fast) var(--a-ease);
  margin-bottom: 16px;
}
.a-import-dropzone__icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.a-import-dropzone__hint {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 12px;
}
.a-import-dropzone__filename {
  font-weight: 600;
  color: var(--brand);
}
.a-import-dropzone input[type="file"],
.a-rates-import-dropzone input[type="file"] {
  max-width: 100%;
  color: #475569;
  font-size: 13px;
}
.a-import-dropzone input[type="file"]::file-selector-button,
.a-rates-import-dropzone input[type="file"]::file-selector-button {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  padding: 6px 12px;
  border-radius: 8px;
  margin-right: 10px;
  cursor: pointer;
  font-weight: 600;
}
.a-import-main-btn {
  font-size: 14px;
  padding: 10px 32px;
}
.a-import-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
}
.a-import-result.is-ok {
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.2);
}
.a-import-result.is-error {
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
}
.a-import-result__title {
  font-weight: 600;
  margin-bottom: 4px;
}
.a-import-result__text {
  font-size: 13px;
}
.a-import-result__warn {
  margin-top: 8px;
  font-size: 12px;
  color: #b45309;
}
.a-import-result__action {
  margin-top: 8px;
}
.a-import-preview-scroll {
  margin-bottom: 16px;
  max-height: 200px;
  overflow: auto;
}
.a-import-preview-table {
  font-size: 12px;
}
.a-import-done {
  border: 1px solid rgba(34,197,94,.2);
  border-radius: 12px;
  padding: 24px;
  background: rgba(34,197,94,.04);
  text-align: center;
}
.a-import-done__icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.a-import-header {
  margin-bottom: 20px;
}
.a-import-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.a-import-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}
.a-import-step {
  flex: 1;
  text-align: center;
  position: relative;
}
.a-import-step__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15,23,42,.1);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin: 0 auto 4px;
  font-size: 12px;
}
.a-import-step__dot.is-active {
  background: var(--brand);
  color: #fff;
}
.a-import-step__label {
  font-size: 11px;
  color: #94a3b8;
}
.a-import-step__label.is-active {
  color: var(--brand);
}
.a-import-step__label.is-current {
  font-weight: 700;
}
.a-import-step__line {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: rgba(15,23,42,.1);
}
.a-import-step__line.is-active {
  background: var(--brand);
}
.a-import-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.a-import-field {
  font-size: 13px;
}
.a-import-field__control {
  display: block;
  margin-top: 4px;
  width: 100%;
}
.a-import-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.a-import-checkbox {
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  margin-top: 20px;
}
.a-import-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.a-import-metric {
  text-align: center;
  padding: 10px;
  border: 1px solid rgba(15,23,42,.07);
  border-radius: 8px;
}
.a-import-metric__value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}
.a-import-metric__value.is-bad {
  color: #dc2626;
}
.a-import-metric__label {
  font-size: 11px;
  color: #64748b;
}
.a-import-alert {
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.a-import-alert--error {
  border: 1px solid rgba(220,38,38,.2);
  background: rgba(220,38,38,.03);
  color: #dc2626;
}
.a-import-alert--warn {
  border: 1px solid rgba(245,158,11,.2);
  background: rgba(245,158,11,.03);
  color: #d97706;
}
.a-import-alert__title {
  font-weight: 700;
  margin-bottom: 8px;
}
.a-import-alert__line {
  font-size: 12px;
  margin-bottom: 3px;
}
.a-import-alert__more {
  font-size: 12px;
  color: #94a3b8;
}
.a-import-preview-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}
.a-import-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.a-import-done__title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 8px;
}
.a-import-done__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.a-import-done__value {
  font-size: 24px;
  font-weight: 800;
}
.a-import-done__value.is-created {
  color: var(--brand);
}
.a-import-done__value.is-updated {
  color: #2563eb;
}
.a-import-done__value.is-skipped {
  color: #94a3b8;
}
.a-import-done__label {
  font-size: 12px;
  color: #64748b;
}
.a-matdb-search {
  width: 220px;
}
.a-matdb-summary {
  padding: 12px 16px;
  margin: 12px 0 8px;
}
.a-matdb-summary__selected {
  margin-left: 12px;
  color: #64748b;
}
.a-matdb-statebar {
  padding: 10px 16px;
  margin: 0 0 12px;
  font-size: 12px;
  color: #475569;
}
.a-matdb-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 12px;
}
.a-matdb-sort {
  width: 180px;
  font-size: 12px;
}
.a-matdb-filter-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  cursor: pointer;
}
.a-matdb-main-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: 8px;
}
.a-matdb-main-tab-btn {
  font-size: 13px;
}
.a-matdb-catalog-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.a-matdb-table-wrap {
  flex: 1;
  overflow: auto;
}
.a-matdb-skeleton {
  height: 420px;
  border-radius: 8px;
}
.a-matdb-inspector {
  width: 380px;
  flex-shrink: 0;
}
.a-matdb-inspector-card {
  padding: 16px;
  position: sticky;
  top: 16px;
}
.a-matdb-inspector-skeleton {
  height: 220px;
}
.a-matdb-inspector-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.a-matdb-inspector-title {
  font-weight: 800;
  font-size: 15px;
}
.a-matdb-inspector-sub {
  font-size: 12px;
  color: #64748b;
}
.a-matdb-inspector-close {
  font-size: 12px;
}
.a-matdb-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15,23,42,.45);
  z-index: var(--z-modal, 9000);
}
.a-matdb-modal--quick {
  background: rgba(15,23,42,.38);
}
.a-matdb-modal--overlay {
  background: rgba(15,23,42,.38);
}
.a-matdb-modal--json,
.a-matdb-modal--op-edit,
.a-matdb-modal--create,
.a-matdb-modal--detail {
  background: rgba(15,23,42,.45);
}
.a-matdb-detail-modal {
  width: min(960px, calc(100vw - 32px));
  max-height: 88vh;
  overflow: auto;
  padding: 20px;
}
.a-matdb-detail-modal__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.a-matdb-detail-modal__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 10px;
  background: rgba(248,250,252,.72);
}
.a-matdb-detail-modal__panel {
  padding: 12px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
}
.a-matdb-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.a-matdb-modal-title {
  font-size: 16px;
  font-weight: 800;
}
.a-matdb-modal-hint {
  font-size: 12px;
  color: #64748b;
}
.a-matdb-json-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: 86vh;
  padding: 20px;
  overflow: auto;
}
.a-matdb-json-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}
.a-matdb-json-modal__title {
  font-size: 16px;
  font-weight: 800;
}
.a-matdb-json-modal__hint {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}
.a-matdb-json-modal__textarea {
  min-height: 340px;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
.a-matdb-json-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.a-matdb-op-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
.a-matdb-op-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.a-matdb-op-modal__label,
.a-matdb-create-modal__label {
  font-size: 13px;
}
.a-matdb-op-modal__control,
.a-matdb-create-modal__control {
  display: block;
  margin-top: 4px;
  width: 100%;
  font-size: 12px;
}
.a-matdb-op-modal__check {
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  grid-column: 1 / -1;
  font-size: 13px;
}
.a-matdb-op-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.a-matdb-op-modal__archive-btn {
  margin-right: auto;
  color: #dc2626;
  font-size: 12px;
}
.a-matdb-quick-modal {
  width: min(720px, calc(100vw - 32px));
  max-height: 80vh;
  padding: 20px;
  overflow: auto;
}
.a-matdb-quick-modal__presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.a-matdb-quick-modal__preset-btn {
  min-height: 72px;
  font-weight: 700;
}
.a-matdb-overlay {
  padding: 18px;
  max-height: 82vh;
  overflow: auto;
}
.a-matdb-overlay--archives {
  width: min(920px, calc(100vw - 32px));
}
.a-matdb-overlay--duplicates,
.a-matdb-overlay--units {
  width: min(980px, calc(100vw - 32px));
}
.a-matdb-overlay__filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.a-matdb-overlay__mode-select {
  width: 180px;
}
.a-matdb-overlay__search-input {
  width: 240px;
}
.a-matdb-overlay__skeleton {
  height: 220px;
}
.a-matdb-overlay__empty-cell {
  text-align: center;
  padding: 28px;
  color: #94a3b8;
}
.a-matdb-overlay__empty-block {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
}
.a-matdb-overlay__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.a-matdb-overlay__btn-sm {
  font-size: 12px;
}
.a-matdb-duplicates__group-card {
  padding: 14px;
  margin-bottom: 12px;
}
.a-matdb-duplicates__group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.a-matdb-duplicates__group-meta {
  font-size: 12px;
  color: #64748b;
}
.a-matdb-duplicates__rows {
  display: grid;
  gap: 6px;
}
.a-matdb-duplicates__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15,23,42,.06);
  font-size: 12px;
}
.a-matdb-units__create-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.a-matdb-units__actions {
  display: flex;
  gap: 6px;
}
.a-matdb-create-modal {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
}
.a-matdb-create-modal__title {
  margin-bottom: 16px;
}
.a-matdb-create-modal__form {
  display: grid;
  gap: 10px;
}
.a-matdb-create-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a-matdb-create-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.a-matdb-lock-banner {
  margin-bottom: 12px;
}
.a-matdb-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.a-matdb-header-check {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
}
.a-matdb-empty-cell {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
}
.a-matdb-empty-block {
  padding: 32px;
  text-align: center;
  color: #94a3b8;
}
.a-matdb-empty-text {
  color: #94a3b8;
  font-size: 12px;
}
.a-matdb-row-clickable {
  cursor: pointer;
}
.a-matdb-row-clickable.is-selected {
  background: rgba(59,130,246,.06);
}
.a-matdb-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.a-matdb-group-card {
  padding: 16px;
}
.a-matdb-group-card__title {
  font-weight: 800;
}
.a-matdb-group-card__meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}
.a-matdb-groups {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid rgba(15,23,42,.07);
  padding-right: 12px;
  margin-right: 12px;
}
.a-matdb-groups__title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.a-matdb-groups__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 2px;
  color: #475569;
}
.a-matdb-groups__item.is-root {
  margin-bottom: 4px;
}
.a-matdb-groups__item.is-selected {
  background: rgba(12,122,69,.1);
  color: #0c7a45;
  font-weight: 700;
}
.a-matdb-groups__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-matdb-groups__actions {
  display: flex;
  gap: 2px;
  opacity: .5;
}
.a-matdb-groups__actions.is-disabled {
  opacity: .25;
}
.a-matdb-groups__icon-btn {
  font-size: 9px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 3px;
}
.a-matdb-groups__icon-btn:disabled {
  cursor: not-allowed;
}
.a-matdb-groups__icon-btn--danger {
  color: #dc2626;
}
.a-matdb-groups__icon-btn--danger.is-armed {
  color: #b91c1c;
}
.a-matdb-groups__rename,
.a-matdb-groups__create {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.a-matdb-groups__rename-input {
  flex: 1;
  font-size: 11px;
  padding: 2px 6px;
}
.a-matdb-groups__mini-btn {
  font-size: 10px;
  padding: 2px 5px;
}
.a-matdb-groups__footer {
  margin-top: 8px;
}
.a-matdb-groups__add-btn {
  font-size: 11px;
  width: 100%;
}
.a-matdb-edit-form {
  margin-top: 12px;
  border-top: 1px solid rgba(15,23,42,.07);
  padding-top: 10px;
}
.a-matdb-edit-form__toggle {
  font-size: 11px;
  width: 100%;
}
.a-matdb-edit-form__grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.a-matdb-edit-form__pairs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a-matdb-edit-form__label {
  font-size: 12px;
}
.a-matdb-edit-form__control {
  display: block;
  margin-top: 2px;
  width: 100%;
  font-size: 12px;
}
.a-matdb-edit-form__checkbox {
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}
.a-matdb-edit-form__actions {
  display: flex;
  gap: 6px;
}
.a-matdb-edit-form__save {
  flex: 1;
  font-size: 12px;
}
.a-matdb-edit-form__btn {
  font-size: 12px;
}
.a-matdb-inspector-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.a-matdb-overview-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15,23,42,.06);
  font-size: 12px;
}
.a-matdb-overview-row__label {
  color: #64748b;
}
.a-matdb-overview-row__value {
  font-weight: 600;
}
.a-matdb-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.a-matdb-overview-ops {
  margin-top: 12px;
}
.a-matdb-section-title-xs {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}
.a-matdb-section-title-xxs {
  font-weight: 700;
  font-size: 12px;
}
.a-matdb-list-row {
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(15,23,42,.04);
}
.a-matdb-list-row--spaced {
  padding: 6px 0;
  border-bottom-color: rgba(15,23,42,.06);
}
.a-matdb-history-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.a-matdb-history-row__title {
  font-weight: 700;
  font-size: 12px;
}
.a-matdb-history-row__meta {
  font-size: 11px;
  color: #64748b;
}
.a-matdb-caption {
  font-size: 11px;
  color: #64748b;
}
.a-matdb-stack {
  display: grid;
  gap: 10px;
}
.a-matdb-stack-sm {
  display: grid;
  gap: 8px;
}
.a-matdb-stack-xs {
  display: grid;
  gap: 6px;
}
.a-matdb-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.a-matdb-actions-row--end {
  justify-content: flex-end;
}
.a-matdb-actions-row--tight {
  gap: 4px;
}
.a-matdb-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.a-matdb-binding-card {
  padding: 10px;
  display: grid;
  gap: 8px;
}
.a-matdb-binding-card__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.a-matdb-binding-card__grid {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.a-matdb-readiness-score {
  font-size: 12px;
  color: #475569;
}
.a-matdb-bullet-row {
  font-size: 12px;
  padding: 3px 0;
}
.a-matdb-bullet-row--error {
  color: #b91c1c;
}
.a-matdb-bullet-row--warn {
  color: #92400e;
}
.a-matdb-impact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a-matdb-impact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.a-matdb-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.a-matdb-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.a-matdb-summary-grid__item {
  font-size: 12px;
}
.a-matdb-summary-grid__label {
  color: #94a3b8;
}
.a-matdb-pricing-rule {
  padding: 8px;
  border: 1px solid rgba(15,23,42,.07);
  border-radius: 6px;
  font-size: 12px;
}
.a-matdb-pricing-rule__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.a-matdb-pricing-rule__description {
  color: #64748b;
  margin-top: 3px;
}
.a-matdb-pricing-rule__discount {
  color: #0c7a45;
}
.a-matdb-pricing-rule__markup {
  color: #d97706;
}
.a-matdb-companion-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
  color: #475569;
}
.a-matdb-companion-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(15,23,42,.06);
  font-size: 12px;
}
.a-matdb-inspector-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.a-matdb-inspector-actions__btn {
  flex: 1;
  font-size: 12px;
}
.a-matdb-delta {
  font-weight: 600;
}
.a-matdb-delta.is-pos {
  color: #16a34a;
}
.a-matdb-delta.is-neg {
  color: #dc2626;
}
.a-matdb-action-restore {
  color: #0c7a45;
  font-weight: 600;
}
.a-matdb-action-delete {
  color: #dc2626;
  font-weight: 600;
}
.a-matdb-table-compact {
  width: 100%;
  font-size: 11px;
}
.a-matdb-skeleton-md {
  height: 180px;
}
.a-matdb-skeleton-sm {
  height: 160px;
}
.a-matdb-skeleton-xs {
  height: 120px;
}
.a-matdb-btn-sm {
  font-size: 12px;
}
.a-matdb-btn-xs {
  font-size: 11px;
}
.a-matdb-btn-xxs {
  font-size: 10px;
  padding: 1px 5px;
}
.a-matdb-badge-left {
  margin-left: 6px;
}
.a-matdb-mb-sm {
  margin-bottom: 10px;
}
.a-matdb-mb-md {
  margin-bottom: 12px;
}
.a-rates-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15,23,42,.45);
  z-index: var(--z-modal, 9000);
}
.a-rates-modal__card {
  width: min(360px, calc(100vw - 32px));
  padding: 20px;
}
.a-rates-modal__title {
  font-weight: 800;
  margin-bottom: 8px;
}
.a-rates-modal__hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}
.a-rates-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.a-rates-modal__danger-btn {
  background: #dc2626;
  color: #fff;
  border: 1px solid #dc2626;
  font-weight: 700;
}
@media (max-width: 900px) {
  .a-matdb-units__create-row,
  .a-matdb-op-modal__grid,
  .a-matdb-create-modal__grid,
  .a-matdb-edit-form__pairs,
  .a-matdb-impact-grid,
  .a-matdb-summary-grid,
  .a-matdb-binding-card__grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES — compact with animated dot for active states
   ═══════════════════════════════════════════════════════════════ */

.a-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: normal;
  letter-spacing: 0;
}
.a-status__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.a-status--draft { background: rgba(28, 27, 20, 0.05); color: var(--muted); }
.a-status--draft .a-status__dot { background: var(--muted); }
.a-status--calc { background: var(--info-light); color: var(--info); }
.a-status--calc .a-status__dot { background: var(--info); }
.a-status--submit { background: var(--violet-light); color: var(--violet); }
.a-status--submit .a-status__dot { background: var(--violet); }
.a-status--pay { background: var(--warn-light); color: var(--warn); }
.a-status--pay .a-status__dot { background: var(--warn); animation: a-blink 1.5s infinite; }
.a-status--paid { background: var(--brand-light); color: var(--brand); }
.a-status--paid .a-status__dot { background: var(--brand); }
.a-status--work { background: rgba(12, 122, 69, 0.15); color: var(--brand-2); }
.a-status--work .a-status__dot { background: var(--brand); animation: a-blink 1.2s infinite; }
.a-status--ship { background: rgba(30, 111, 200, 0.15); color: var(--info); }
.a-status--ship .a-status__dot { background: var(--info); }
.a-status--closed { background: rgba(28, 27, 20, 0.08); color: var(--text-2); }
.a-status--closed .a-status__dot { background: var(--text-2); }
.a-status--cancel { background: var(--bad-light); color: var(--bad); }
.a-status--cancel .a-status__dot { background: var(--bad); }

/* ═══════════════════════════════════════════════════════════════
   INLINE AVATARS (for people/client cells in tables)
   ═══════════════════════════════════════════════════════════════ */

.a-avatar-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.a-avatar-inline__img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.a-avatar-c1 { background: linear-gradient(135deg, #E8B14A 0%, #C08820 100%); }
.a-avatar-c2 { background: linear-gradient(135deg, #0C7A45 0%, #085C33 100%); }
.a-avatar-c3 { background: linear-gradient(135deg, #1E6FC8 0%, #144E90 100%); }
.a-avatar-c4 { background: linear-gradient(135deg, #6D3FD6 0%, #4E2BA8 100%); }
.a-avatar-c5 { background: linear-gradient(135deg, #C8231D 0%, #8F1713 100%); }

/* ═══════════════════════════════════════════════════════════════
   KANBAN — 6-column board with flash on new, draggable cards
   ═══════════════════════════════════════════════════════════════ */

.a-kb {
  display: grid;
  grid-template-columns: repeat(6, minmax(230px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
@media (max-width: 1200px) { .a-kb { grid-template-columns: repeat(3, minmax(230px, 1fr)); } }
@media (max-width: 700px) { .a-kb { grid-template-columns: 1fr; } }

.a-kb-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: 560px;
}
.a-kb-col.is-drop-target { background: var(--brand-light); }
.a-kb-col__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.a-kb-col__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.a-kb-col__t {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
}
.a-kb-col__count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.a-kb-col__sum {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.a-kb-col__body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a-kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r10);
  padding: 10px 12px;
  cursor: grab;
  transition: all var(--a-dur-fast) var(--a-ease);
  font-size: 12px;
  animation: a-cardIn 400ms var(--a-ease) both;
}
.a-kb-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--brand-glow);
}
.a-kb-card:active { cursor: grabbing; }
.a-kb-card.is-dragging { opacity: 0.5; }
.a-kb-card.is-new { animation: a-cardFlash 2s var(--a-ease); }
.a-kb-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.a-kb-card__num {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  letter-spacing: -0.01em;
}
.a-kb-card__title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.a-kb-card__meta {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.a-kb-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.a-kb-card__sum {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.a-kb-card__days {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.a-kb-card__days--urgent { color: var(--warn); font-weight: 600; }
.a-kb-card__days--overdue { color: var(--bad); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   SIDE DRAWER — 520px right-side detail panel
   ═══════════════════════════════════════════════════════════════ */

.a-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 20, 0.3);
  z-index: 40;
  animation: a-fadeUp 200ms var(--a-ease);
}
.a-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  z-index: 41;
  display: flex;
  flex-direction: column;
  animation: a-drawerIn 300ms var(--a-ease);
}
.a-drawer__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.a-drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.a-drawer__close:hover { background: var(--surface-2); color: var(--text); }
.a-drawer__body { flex: 1; overflow-y: auto; padding: 0; }
.a-drawer__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   PANELS & CARDS (admin-compact variants)
   ═══════════════════════════════════════════════════════════════ */

.a-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  padding: 18px;
}
.a-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.a-panel__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.a-panel__actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.a-sec-t {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

/* ─── Action card (used on OrderDetail admin workbench) ─── */
.a-action-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 900px) { .a-action-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .a-action-strip { grid-template-columns: 1fr; } }

.a-action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r14);
  padding: 14px;
  cursor: pointer;
  transition: all var(--a-dur) var(--a-ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.a-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
  border-color: var(--brand-glow);
}
.a-action-card:disabled,
.a-action-card[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.a-action-card__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.a-action-card__icon--warn { background: var(--warn-light); color: var(--warn); }
.a-action-card__icon--info { background: var(--info-light); color: var(--info); }
.a-action-card__icon--bad { background: var(--bad-light); color: var(--bad); }
.a-action-card__icon--muted { background: rgba(28, 27, 20, 0.06); color: var(--muted); }
.a-action-card__t { font-size: 12px; font-weight: 600; letter-spacing: -0.01em; }
.a-action-card__d {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   COMMAND PALETTE (Cmd+K) — overlay with grouped results
   ═══════════════════════════════════════════════════════════════ */

.a-cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 20, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 60;
  animation: a-fadeUp 180ms var(--a-ease);
}
.a-cmd {
  background: var(--surface);
  border-radius: var(--a-r16);
  box-shadow: var(--shadow-3);
  border: 1px solid var(--border);
  width: 600px;
  max-width: 90%;
  overflow: hidden;
  animation: a-cmdIn 280ms var(--a-ease-spring);
}
.a-cmd__input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.a-cmd__input-wrap svg { color: var(--muted); }
.a-cmd__input {
  border: none;
  background: transparent;
  font-family: var(--a-font);
  font-size: 15px;
  flex: 1;
  outline: none;
  letter-spacing: -0.01em;
  color: var(--text);
}
.a-cmd__input-kbd {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  padding: 3px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
}
.a-cmd__results {
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}
.a-cmd__group-t {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px 4px;
}
.a-cmd__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--a-dur-fast) var(--a-ease);
  background: none;
  border: none;
  font-family: inherit;
  color: inherit;
  width: 100%;
  text-align: left;
}
.a-cmd__item:hover,
.a-cmd__item.is-focused {
  background: var(--brand-light);
  color: var(--brand);
}
.a-cmd__item svg { color: currentColor; opacity: 0.7; flex-shrink: 0; }
.a-cmd__item-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
.a-cmd__foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: var(--muted);
  flex-wrap: wrap;
}
.a-cmd__foot span { display: flex; align-items: center; gap: 4px; }

/* ═══════════════════════════════════════════════════════════════
   TOAST — premium notification (bottom-right, slide-in)
   ═══════════════════════════════════════════════════════════════ */

.a-toast-host {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.a-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r12);
  box-shadow: var(--shadow-2);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 360px;
  min-width: 280px;
  font-size: 12px;
  animation: a-toastIn 360ms var(--a-ease-spring);
  pointer-events: auto;
}
.a-toast__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.a-toast__icon--info { background: var(--info-light); color: var(--info); }
.a-toast__icon--warn { background: var(--warn-light); color: var(--warn); }
.a-toast__icon--bad { background: var(--bad-light); color: var(--bad); }
.a-toast__body { flex: 1; min-width: 0; }
.a-toast__t {
  font-weight: 600;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}
.a-toast__d {
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   TIMELINE — vertical status journey (used in OrderDetail)
   ═══════════════════════════════════════════════════════════════ */

.a-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.a-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.a-timeline__item {
  position: relative;
  padding: 6px 0 12px 26px;
  font-size: 12px;
}
.a-timeline__item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
}
.a-timeline__item--current::before {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.a-timeline__item--done::before {
  background: var(--brand);
  border-color: var(--brand);
}
.a-timeline__item--bad::before {
  background: var(--bad);
  border-color: var(--bad);
}
.a-timeline__t { font-weight: 500; color: var(--text); }
.a-timeline__m {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.a-timeline__note {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 3px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — collapse sidebar on tablet, stack on mobile
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-side { display: none; }
  .a-content { padding: 14px; }
  .a-topbar { padding: 10px 14px; }
  .a-page-title { font-size: 20px; }
  .a-drawer { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   R28 additions — primitives used by OrdersTable rewrite
   ═══════════════════════════════════════════════════════════════ */

/* ─── Banner (scenario notice from Dashboard → OrdersTable) ─── */
.a-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--a-r12);
  background: var(--info-light);
  border: 1px solid rgba(30, 111, 200, 0.18);
  animation: a-fadeUp 320ms var(--a-ease);
}
.a-banner__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--info);
  letter-spacing: -0.01em;
}
.a-banner > button { margin-left: auto; }

/* ─── Input primitives ─── */
.a-input {
  font-family: var(--a-font);
  font-size: 13px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--a-r8);
  background: var(--surface);
  color: var(--text);
  letter-spacing: -0.005em;
  transition: all var(--a-dur-fast) var(--a-ease);
}
.a-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.a-input:disabled { opacity: 0.55; cursor: not-allowed; }
.a-input--sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.a-input--date { width: 100%; }
.a-input--date + .a-input--date { margin-top: 6px; }
.a-input--multi { min-height: 90px; width: 100%; }

/* a-btn is-active state (toggle filters button) */
.a-btn.is-active {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--brand-glow);
}
/* Block-width btn (used in preview panel) */
.a-btn--block { width: 100%; justify-content: center; }
.a-btn--block + .a-btn--block { margin-top: 6px; }

/* ─── Chiprow (preset chips + saved views) ─── */
.a-chiprow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.a-chiprow__sep {
  color: var(--muted-2);
  font-size: 12px;
  padding: 0 4px;
  user-select: none;
}
.a-chip--saved {
  display: inline-flex;
  padding: 0;
  overflow: hidden;
  border-color: var(--brand-glow);
  background: var(--brand-light);
  color: var(--brand);
}
.a-chip__body {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  padding: 4px 8px;
  letter-spacing: inherit;
}
.a-chip__body:hover { background: var(--brand-glow); }
.a-chip__close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 7px;
  color: var(--muted);
}
.a-chip__close:hover { background: rgba(200, 35, 29, 0.1); color: var(--bad); }
.a-savedview-edit {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.a-savedview-edit .a-input { width: 160px; }

/* ─── Filter panel (expanded filters area) ─── */
.a-filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--a-r12);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  animation: a-fadeUp 240ms var(--a-ease);
}
.a-filter-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.a-filter-field__l {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.a-filter-flags { display: flex; flex-direction: column; gap: 4px; }
.a-filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

/* ─── Checkbox row ─── */
.a-check {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-2);
}
.a-check input[type="checkbox"] { accent-color: var(--brand); margin: 0; }
.a-check:hover { color: var(--text); }

/* ─── Bulk action bar ─── */
.a-bulkbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--brand-light);
  border: 1px solid var(--brand-glow);
  border-radius: var(--a-r10);
  margin-bottom: 10px;
  font-size: 13px;
  animation: a-fadeUp 260ms var(--a-ease);
}
.a-bulkbar__count { font-weight: 600; color: var(--brand-2); }
.a-bulkbar__reason { flex: 1; min-width: 180px; }

/* ─── Table row layout — table + preview side by side ─── */
.a-table-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.a-table-row > .a-table-wrap { flex: 1; min-width: 0; }

/* Table row highlight states (preview / selected) */
.a-table tbody tr.is-preview td { background: var(--info-light); }
.a-table tbody tr.is-selected td { background: var(--brand-light); }
.a-table tbody tr.is-preview.is-selected td {
  background: linear-gradient(90deg, var(--brand-light) 0%, var(--info-light) 100%);
}

/* ─── Pagination ─── */
.a-pager {
  padding: 14px 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
}
.a-pager__btns { display: flex; gap: 6px; }

/* ─── Pill (tiny inline flag) ─── */
.a-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  margin-right: 3px;
  white-space: nowrap;
}
.a-pill--bad { background: var(--bad-light); color: var(--bad); }
.a-pill--violet { background: var(--violet-light); color: var(--violet); }

/* ═══════════════════════════════════════════════════════════════
   Scoped: OrdersTable specifics (.a-orders + .a-orders__*)
   ═══════════════════════════════════════════════════════════════ */
.a-orders {
  font-family: var(--a-font);
  color: var(--text);
  --bg: #F2EFE9;
  --surface: #FDFCF9;
  --surface-2: #FBFAF6;
  --text: #1C1B14;
  --text-2: rgba(28, 27, 20, 0.65);
  --muted: rgba(28, 27, 20, 0.50);
  --muted-2: rgba(28, 27, 20, 0.35);
  --border: rgba(28, 27, 20, 0.09);
  --border-strong: rgba(28, 27, 20, 0.16);
  --brand: #0C7A45;
  --brand-2: #085C33;
  --brand-light: rgba(12, 122, 69, 0.10);
  --brand-glow: rgba(12, 122, 69, 0.20);
  --warn: #C96B0A;
  --warn-light: rgba(201, 107, 10, 0.10);
  --bad: #C8231D;
  --bad-light: rgba(200, 35, 29, 0.10);
  --info: #1E6FC8;
  --info-light: rgba(30, 111, 200, 0.10);
  --violet: #6D3FD6;
  --violet-light: rgba(109, 63, 214, 0.10);
  --a-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --a-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --a-dur: 280ms;
  --a-dur-fast: 180ms;
  --a-r8: 8px;
  --a-r10: 10px;
  --a-r12: 12px;
  --a-r14: 14px;
  letter-spacing: -0.01em;
}
.a-orders *,
.a-orders *::before,
.a-orders *::after { box-sizing: border-box; }
.a-orders .a-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 4px; }
.a-orders .a-page-sub { font-size: 12px; color: var(--text-2); margin: 0; }
.a-orders .a-page-head { margin-bottom: 14px; }

.a-orders__tablewrap { overflow-x: auto; }
.a-orders__table { font-size: 13px; }
.a-orders__th-check,
.a-orders__td-check {
  width: 36px;
  text-align: center !important;
}
.a-orders__td-check input[type="checkbox"] { accent-color: var(--brand); cursor: pointer; }
.a-orders__num {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.a-orders__code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-weight: 600;
  font-size: 12px;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.a-orders__flag-dot {
  font-size: 10px;
  line-height: 1;
  margin-left: 2px;
}
.a-orders__flag-dot--bad { color: var(--bad); }
.a-orders__flag-dot--warn { color: var(--warn); }
.a-orders__client {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-orders__date {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.a-orders__age {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.a-orders__flags { font-size: 11px; white-space: nowrap; }
.a-orders__empty {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 13px;
}
.a-orders__empty .arm-shell-skeleton-line {
  height: 14px;
  width: 60%;
  margin: 0 auto;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  border-radius: 4px;
  animation: a-skeleton 1.4s ease-in-out infinite;
}
@keyframes a-skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Margin percent color-coding (was inline style; now deterministic class) */
.a-ord-margin { font-weight: 600; white-space: nowrap; }
.a-ord-margin--ok { color: var(--brand); }
.a-ord-margin--warn { color: var(--warn); }
.a-ord-margin--bad { color: var(--bad); }

/* ─── Preview panel (sticky 300px column to the right of table) ─── */
.a-orders__preview {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 12px;
  padding: 14px;
  font-size: 13px;
  animation: a-fadeUp 260ms var(--a-ease);
}
.a-orders__preview .a-panel__head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.a-orders__preview-code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-weight: 700;
  color: var(--brand);
  font-size: 14px;
}
.a-orders__preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.a-orders__preview-kv { min-width: 0; }
.a-orders__preview-l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  margin-bottom: 2px;
}
.a-orders__preview-v {
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
}
.a-orders__preview-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Responsive: stack preview below on narrow screens */
@media (max-width: 1100px) {
  .a-table-row { flex-direction: column; }
  .a-orders__preview { width: 100%; position: static; }
}

/* ═══════════════════════════════════════════════════════════════
   R28.1 additions — drawer + modal preview, compact layout, chips
   ═══════════════════════════════════════════════════════════════ */

/* Compact page head: title left, attention chips right */
.a-page-head--compact {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.a-attention { display: flex; gap: 6px; flex-wrap: wrap; }
.a-attn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--a-dur-fast) var(--a-ease);
}
.a-attn:hover { transform: translateY(-1px); }
.a-attn__dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.a-attn--bad { background: var(--bad-light); color: var(--bad); border-color: rgba(200, 35, 29, 0.2); }
.a-attn--bad .a-attn__dot { background: var(--bad); }
.a-attn--warn { background: var(--warn-light); color: var(--warn); border-color: rgba(201, 107, 10, 0.2); }
.a-attn--warn .a-attn__dot { background: var(--warn); }
.a-attn--neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.a-attn--neutral .a-attn__dot { background: var(--muted); }

/* Thin banner */
.a-banner--thin {
  padding: 6px 12px;
  gap: 10px;
  font-size: 12px;
}
.a-banner__accent {
  width: 3px;
  height: 14px;
  background: var(--info);
  border-radius: 2px;
  flex-shrink: 0;
}
.a-banner__close {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 3px 7px;
  font-family: inherit;
}
.a-banner__close:hover { color: var(--text); }

/* Compact one-row filters */
.a-filters--row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.a-filters--row .a-search { flex: 1; min-width: 180px; max-width: 260px; }
.a-filters--row .a-search__input { font-size: 12px; padding: 5px 10px 5px 28px; }
.a-filters--row .a-search__icon { left: 8px; }
.a-filters__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* Thin bulk bar */
.a-bulkbar--thin {
  padding: 6px 12px;
  font-size: 12px;
  margin-bottom: 8px;
  gap: 10px;
}
.a-bulkbar__sep {
  width: 1px;
  height: 16px;
  background: rgba(12, 122, 69, 0.3);
  flex-shrink: 0;
}

/* Pager enhancements */
.a-pager__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* ─── Drawer preview (420px slide-in from right) ─── */
.a-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 20, 0.25);
  z-index: 40;
  animation: a-fadeIn 180ms var(--a-ease);
}
.a-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 48px rgba(28, 27, 20, 0.15);
  z-index: 41;
  display: flex;
  flex-direction: column;
  animation: a-slideInRight 280ms var(--a-ease);
}
@keyframes a-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes a-slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.a-drawer__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}
.a-drawer__code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.a-drawer__code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-weight: 700;
  color: var(--brand);
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.01em;
}
.a-drawer__sub {
  font-size: 12px;
  color: var(--text-2);
}
.a-drawer__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.a-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.a-drawer__section-l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 8px;
}
.a-drawer__kvgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.a-drawer__kv {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
}
.a-drawer__kv--brand { background: var(--brand-light); }
.a-drawer__kv--wide { grid-column: 1 / -1; }
.a-drawer__kv-l {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
}
.a-drawer__kv-v {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.a-drawer__kv--brand .a-drawer__kv-v {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.a-drawer__kv-v--small { font-size: 11px; margin-top: 1px; }
.a-drawer__section-l + .a-drawer__kvgrid + .a-drawer__section-l { margin-top: 6px; }
.a-drawer__meta {
  font-size: 10px;
  color: var(--muted);
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.a-drawer__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── Modal preview (centred 980px) ─── */
.a-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 20, 0.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: a-fadeIn 200ms var(--a-ease);
}
.a-modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(28, 27, 20, 0.25);
  width: 96%;
  max-width: 980px;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: a-modalIn 260ms var(--a-ease);
}
@keyframes a-modalIn {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.a-modal__head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  flex-shrink: 0;
}
.a-modal__code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.a-modal__code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-weight: 700;
  color: var(--brand);
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.02em;
}
.a-modal__sub {
  font-size: 13px;
  color: var(--text-2);
}
.a-modal__head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.a-modal__body {
  flex: 1;
  overflow: auto;
  padding: 14px 20px;
}
.a-modal__grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr 0.85fr 0.7fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.a-modal__section-l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Cut map */
.a-modal__cutmap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.a-modal__cutmap svg { width: 100%; display: block; }
.a-modal__cutmap-tabs {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.a-sheet-tab {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font-family: inherit;
}
.a-sheet-tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
}
.a-modal__cutmap-waste {
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
}

/* Summary grid inside modal */
.a-modal__sumgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.a-modal__kv {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 7px 10px;
}
.a-modal__kv--brand { background: var(--brand-light); }
.a-modal__kv--wide { grid-column: 1 / -1; }
.a-modal__kv-l {
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
}
.a-modal__kv-v {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.a-modal__kv-v--small { font-size: 11px; margin-top: 1px; }
.a-modal__kv--brand .a-modal__kv-v {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand);
  letter-spacing: -0.02em;
}

/* Estimate block */
.a-modal__estimate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
}
.a-modal__est-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
}
.a-modal__est-row:last-child { border-bottom: none; }
.a-modal__est-row--total {
  padding: 6px 0 2px;
  border-top: 1.5px solid rgba(28, 27, 20, 0.12);
  border-bottom: none;
  margin-top: 3px;
  font-weight: 700;
}
.a-modal__est-l { color: var(--text-2); }
.a-modal__est-v { font-variant-numeric: tabular-nums; font-weight: 500; }
.a-modal__est-v--total { color: var(--brand); font-size: 13px; font-weight: 700; }

/* Compact timeline */
.a-modal__timeline {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.a-tl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.a-tl__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.a-tl__label { font-weight: 500; color: var(--text-2); }
.a-tl__date {
  color: var(--muted);
  margin-left: auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.a-tl--done .a-tl__dot { background: var(--brand); }
.a-tl--done .a-tl__label { color: var(--text); font-weight: 600; }
.a-tl--active .a-tl__dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.a-tl--warn .a-tl__dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(201, 107, 10, 0.2);
}
.a-tl--warn .a-tl__label { color: var(--warn); font-weight: 600; }
.a-tl--warn .a-tl__date { color: var(--warn); font-weight: 600; }

/* Action chips row */
.a-actionchips {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.a-actionchip {
  padding: 5px 11px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  transition: transform var(--a-dur-fast) var(--a-ease);
}
.a-actionchip:hover { transform: translateY(-1px); }
.a-actionchip--brand {
  background: var(--brand-light);
  border-color: rgba(12, 122, 69, 0.25);
  color: var(--brand-2);
  font-weight: 600;
}
.a-actionchip--info {
  background: rgba(30, 111, 200, 0.06);
  border-color: rgba(30, 111, 200, 0.22);
  color: var(--info);
}
.a-actionchip--violet {
  background: var(--violet-light);
  border-color: rgba(109, 63, 214, 0.22);
  color: var(--violet);
}
.a-actionchips__flex { flex: 1; }
.a-search--sm { min-width: 180px; max-width: 220px; flex-shrink: 0; }
.a-search__input--sm { font-size: 11px !important; padding: 5px 10px 5px 26px !important; }

/* Items table in modal */
.a-modal__items {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.a-modal__items-table { font-size: 11px; }
.a-modal__items-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}
.a-modal__items-table td { padding: 5px 10px; border-bottom: 1px solid rgba(28, 27, 20, 0.05); }
.a-modal__items-num { width: 36px; color: var(--muted); }
.a-modal__items-mat { color: var(--text-2); }
.a-modal__items-sheet { color: var(--muted); font-family: ui-monospace, monospace; }
.a-modal__items-cmt { color: var(--text-2); font-size: 10px; }

/* Edge dots (4 edges of a cut part) */
.a-edgedots { display: inline-flex; gap: 1px; }
.a-edgedot {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--border-strong);
  display: inline-block;
}
.a-edgedot.is-on { background: var(--brand); }

/* Modal footer */
.a-modal__foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.a-modal__foot-meta {
  font-size: 11px;
  color: var(--muted);
}
.a-modal__foot-btns {
  display: flex;
  gap: 8px;
}

/* Responsive: stack modal grid on narrow screens */
@media (max-width: 900px) {
  .a-modal__grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .a-modal__grid {
    grid-template-columns: 1fr;
  }
  .a-drawer { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   R29 additions — Kanban .a-kb* + EditModal + modal size variants
   ═══════════════════════════════════════════════════════════════ */

/* ── Modal size variants (sm, md, lg — used by WipModal / EditModal) ── */
.a-modal--sm { max-width: 420px; }
.a-modal--md { max-width: 780px; }
.a-modal--lg { max-width: 1100px; }

/* ── Kanban root ── */
.a-kb {}

.a-kb--loading {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.a-kb-skel {
  height: 300px;
  border-radius: 12px;
}

/* ── Toolbar (search + toggles + refresh) ── */
.a-kb-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.a-kb-toolbar .a-search {
  flex: 0 0 220px;
  min-width: 180px;
}
.a-kb-toolbar .a-search__input {
  font-size: 12px;
  padding: 5px 10px 5px 28px;
}
.a-kb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  cursor: pointer;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  transition: background var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease);
}
.a-kb-toggle.is-active {
  background: var(--brand-light);
  border-color: rgba(12, 122, 69, 0.25);
  color: var(--brand-2);
  font-weight: 500;
}
.a-kb-toggle input[type="checkbox"] {
  margin: 0;
  width: 12px;
  height: 12px;
  accent-color: var(--brand);
}

/* ── Board: horizontal scroll of columns ── */
.a-kb-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 16px;
  min-height: 420px;
}
.a-kb-board--main {
  min-height: 520px;
}

/* ── Swimlane mode (grouped by tenant) ── */
.a-kb-swimlanes {
  display: grid;
  gap: 18px;
}
.a-kb-swimlane {
  padding: 14px 16px;
}
.a-kb-swimlane__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.a-kb-swimlane__dot {
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--info);
}
.a-kb-swimlane__title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.a-kb-swimlane__count {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

/* ── Column ── */
.a-kb-col {
  min-width: 196px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a-kb-col.is-drag-target {
  background: rgba(30, 111, 200, 0.04);
  border-radius: 10px;
}
.a-kb-col__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--border-strong);
  transition: border-bottom-color var(--a-dur-fast) var(--a-ease);
}
.a-kb-col__head--submit { border-bottom-color: #1E6FC8; }
.a-kb-col__head--calc { border-bottom-color: #C96B0A; }
.a-kb-col__head--pay { border-bottom-color: #eab308; }
.a-kb-col__head--paid { border-bottom-color: var(--brand); }
.a-kb-col__head--work { border-bottom-color: #6D3FD6; }
.a-kb-col__head--ship { border-bottom-color: #06b6d4; }
.a-kb-col__head--closed { border-bottom-color: #22c55e; }

.a-kb-col__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-2);
}
.a-kb-col__head--submit .a-kb-col__label { color: #1E6FC8; }
.a-kb-col__head--calc .a-kb-col__label { color: #C96B0A; }
.a-kb-col__head--pay .a-kb-col__label { color: #A0730A; }
.a-kb-col__head--paid .a-kb-col__label { color: var(--brand); }
.a-kb-col__head--work .a-kb-col__label { color: #6D3FD6; }

.a-kb-col__count {
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
}
.a-kb-col__count:hover {
  background: var(--surface-2);
  color: var(--text);
}
.a-kb-col__count.is-over {
  color: var(--bad);
  font-weight: 600;
}
.a-kb-col__over-mark {
  margin-left: 4px;
}

.a-kb-col__empty {
  padding: 20px;
  text-align: center;
  color: var(--border-strong);
  font-size: 11px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  transition: border-color var(--a-dur-fast) var(--a-ease);
}
.a-kb-col__empty.is-drag-target {
  border-color: rgba(30, 111, 200, 0.3);
  color: var(--info);
}

/* ── Card ── */
.a-kb-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
  position: relative;
  transition: transform var(--a-dur-fast) var(--a-ease), box-shadow var(--a-dur-fast) var(--a-ease);
}
.a-kb-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(28, 27, 20, 0.08);
}
.a-kb-card:active { cursor: grabbing; }
.a-kb-card--ok { border-left-color: #22c55e; }
.a-kb-card--warn { border-left-color: #f59e0b; }
.a-kb-card--critical { border-left-color: #ef4444; }
.a-kb-card--blocked {
  background: #fffaf7;
}

.a-kb-card__code {
  font-family: ui-monospace, 'SF Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--brand);
  letter-spacing: -0.01em;
}
.a-kb-card__client {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-kb-card__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 10px;
  color: var(--muted);
}
.a-kb-card__parts {}
.a-kb-card__age {
  font-weight: 500;
}
.a-kb-age--ok { color: var(--brand); }
.a-kb-age--warn { color: var(--warn); }
.a-kb-age--critical { color: var(--bad); font-weight: 600; }

.a-kb-card__total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(28, 27, 20, 0.05);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.a-kb-card__block {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  background: rgba(200, 35, 29, 0.1);
  color: var(--bad);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════
   R29 EditModal — 2-col grid with status/priority/deadline/comment
   ═══════════════════════════════════════════════════════════════ */

.a-edit-modal {}
.a-edit-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.a-edit-col {}
.a-edit-col__l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 10px;
}
.a-edit-field {
  display: block;
  margin-bottom: 12px;
}
.a-edit-field__l {
  font-size: 11px;
  color: var(--text-2);
  display: block;
  margin-bottom: 4px;
}
.a-edit-field__req {
  color: var(--muted);
  font-weight: 400;
}
.a-edit-field .a-input {
  width: 100%;
  font-size: 12px;
  padding: 7px 11px;
}
.a-textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

/* Priority button group */
.a-edit-priority {
  display: flex;
  gap: 4px;
}
.a-edit-priority__btn {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease);
}
.a-edit-priority__btn:hover {
  background: var(--surface-2);
}
.a-edit-priority__btn.is-active {
  background: var(--brand-light);
  color: var(--brand-2);
  border-color: rgba(12, 122, 69, 0.25);
  font-weight: 600;
}

/* Hard block toggle */
.a-edit-hardblock {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  transition: background var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease);
}
.a-edit-hardblock:hover {
  background: var(--surface-2);
}
.a-edit-hardblock.is-active {
  background: rgba(200, 35, 29, 0.04);
  border-color: rgba(200, 35, 29, 0.25);
}
.a-edit-hardblock input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--bad);
}
.a-edit-hardblock__title {
  font-weight: 600;
}
.a-edit-hardblock.is-active .a-edit-hardblock__title {
  color: var(--bad);
}
.a-edit-hardblock__hint {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* Read-only summary inside EditModal right column */
.a-edit-summary {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
}
.a-edit-summary__l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 6px;
}
.a-edit-summary__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.a-edit-summary__kl {
  color: var(--muted);
  font-size: 10px;
}
.a-edit-summary__kv {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.a-edit-summary__kv--brand {
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.a-edit-summary__note {
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(28, 27, 20, 0.06);
}

/* WipModal fields */
.a-wip__title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.01em;
}
.a-wip__field {
  display: block;
  margin-bottom: 14px;
}
.a-wip__label {
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.a-wip__hint {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.a-wip__field .a-input {
  width: 100%;
}
.a-wip__check {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.4;
}

/* Spin animation for refresh icon */
.a-btn.is-spin svg,
.a-btn.is-spin {
  animation: a-spin 600ms linear infinite;
}
@keyframes a-spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 700px) {
  .a-edit-modal__grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   R30 additions — Items editor inside EditModal
   ═══════════════════════════════════════════════════════════════ */

/* Items section container */
.a-edit-items {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.a-edit-items__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.a-edit-items__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Loading skeletons */
.a-edit-items__loading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}
.a-edit-items__loading .arm-shell-skeleton-line {
  height: 32px;
  border-radius: 6px;
}

/* Empty state */
.a-edit-items__empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

/* Table wrapper — horizontal scroll if overflows */
.a-edit-items__tablewrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.a-edit-items__table {
  width: 100%;
  font-size: 11px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.a-edit-items__table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  padding: 6px 8px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 1;
}
.a-edit-items__table tbody td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  vertical-align: middle;
}
.a-edit-items__table tbody tr:last-child td {
  border-bottom: none;
}
.a-edit-items__table tbody tr:hover {
  background: rgba(28, 27, 20, 0.015);
}

/* Inline inputs inside table */
.a-input--sm {
  padding: 4px 8px !important;
  font-size: 11px !important;
  height: 28px;
}
.a-input--num {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Column sizing */
.a-edit-items__col-num { width: 30px; color: var(--muted); font-size: 10px; }
.a-edit-items__col-name { min-width: 150px; }
/* R49: material column for multi-decor orders. Override indicator = amber left border */
.a-edit-items__col-material { min-width: 140px; max-width: 180px; }
.a-edit-items__material-override {
  border-left: 3px solid #EF9F27;
  background: #FDF7EC;
}

/* R49.1: Group separator row — visual divider between different material groups */
.a-edit-items__group-row {
  background: linear-gradient(to right, #F1EFE8, #F8F6F3);
}
.a-edit-items__group-row td {
  padding: 8px 12px !important;
  font-size: 11px;
  color: var(--a-muted, #5F5E5A);
  border-top: 1px solid var(--border-tertiary, #D3D1C7);
  border-bottom: 0.5px solid var(--border-tertiary, #D3D1C7);
}
.a-edit-items__group-label {
  font-weight: 500;
  color: var(--a-text, #2C2C2A);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 10px;
}
.a-edit-items__group-count {
  margin-left: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--a-muted, #888780);
}
.a-edit-items__group-actions {
  float: right;
}
.a-edit-items__group-bulk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--a-muted, #5F5E5A);
}
.a-edit-items__group-bulk select {
  min-width: 180px;
  font-size: 11px;
}

/* R51: Offcuts management screen */
.a-offcuts {
  padding: 20px 24px;
  max-width: 1400px;
}
.a-offcuts__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.a-offcuts__err {
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #FCEBEB;
  color: #791F1F;
  border-radius: 6px;
  font-size: 12px;
}
.a-offcuts__kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.a-offcuts__kpi-card {
  padding: 14px 18px;
  background: #F8F6F3;
  border: 0.5px solid var(--border-tertiary, #D3D1C7);
  border-radius: 8px;
}
.a-offcuts__kpi-card--muted { opacity: 0.7; }
.a-offcuts__kpi-l {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--a-muted, #5F5E5A);
  margin-bottom: 4px;
}
.a-offcuts__kpi-v {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--a-text, #2C2C2A);
}
.a-offcuts__kpi-sub {
  font-size: 11px;
  color: var(--a-muted, #888780);
  margin-top: 2px;
  font-family: var(--font-mono, monospace);
}
.a-offcuts__bymat {
  margin-bottom: 20px;
}
.a-offcuts__filters {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.a-offcuts__filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--a-muted);
}
.a-offcuts__filter select { min-width: 200px; }
.a-offcuts__table {
  width: 100%;
}
.a-offcuts__empty {
  padding: 32px;
  text-align: center;
  color: var(--a-muted, #888780);
  font-size: 12px;
}
.a-offcuts__pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.a-offcuts__pill--ok {
  background: #E1F5EE;
  color: #085041;
}
.a-offcuts__pill--used {
  background: #E6F1FB;
  color: #185FA5;
}
.a-offcuts__pill--off {
  background: #F1EFE8;
  color: #888780;
}
.a-offcuts__source code {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--a-muted, #5F5E5A);
}
.a-offcuts__actions {
  text-align: right;
}
.a-edit-items__col-dim { width: 80px; }
.a-edit-items__col-qty { width: 62px; }
.a-edit-items__col-th { width: 62px; }
.a-edit-items__col-grain { width: 82px; }
.a-edit-items__col-rotate { width: 76px; }
.a-edit-items__col-edge { width: 90px; text-align: center; }
.a-edit-items__col-note { min-width: 120px; }
.a-edit-items__col-del { width: 32px; text-align: center; }
.a-edit-items__grain-select,
.a-edit-items__rotate-select {
  padding: 2px 4px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.01em;
}

/* Edge toggles — 4 buttons arranged as top/right/bottom/left around a centre.
 * R45: buttons now show thickness text (— / 0.4 / 2) instead of just on/off dot.
 * Click cycles 0 → 0.4 → 2 → 0. Colors: gray (—), amber (0.4), teal (2). */
.a-edit-items__edges {
  display: grid;
  grid-template-columns: 22px 22px 22px;
  grid-template-rows: 16px 16px 16px;
  gap: 1px;
  width: 66px;
  height: 48px;
  margin: 0 auto;
}
.a-edit-items__edge-btn {
  padding: 0;
  border: 1px solid transparent;
  background: var(--a-surface-muted, #F1EFE8);
  color: var(--a-muted, #888780);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-family: var(--font-mono, monospace);
  font-weight: 500;
  border-radius: 2px;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease);
  min-width: 0;
  line-height: 1;
}
.a-edit-items__edge-btn--top    { grid-area: 1 / 2 / 2 / 3; }
.a-edit-items__edge-btn--right  { grid-area: 2 / 3 / 3 / 4; }
.a-edit-items__edge-btn--bottom { grid-area: 3 / 2 / 4 / 3; }
.a-edit-items__edge-btn--left   { grid-area: 2 / 1 / 3 / 2; }
.a-edit-items__edge-btn.is-04 {
  background: #FAEEDA;
  color: #633806;
  border-color: #EF9F27;
}
.a-edit-items__edge-btn.is-1 {
  background: #EAF3DE;
  color: #27500A;
  border-color: #639922;
}
.a-edit-items__edge-btn.is-2 {
  background: #E1F5EE;
  color: #085041;
  border-color: #0F6E56;
}
.a-edit-items__edge-btn:hover {
  filter: brightness(0.95);
}
.a-edit-items__edge-val {
  font-variant-numeric: tabular-nums;
}
/* R45 back-compat: keep old edge-dot class styled (hz-pure-slim fallback paths may emit it) */
.a-edit-items__edge-dot {
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--border-strong);
  display: inline-block;
}

/* R45: Bulk edge picker — 4 sides × 3 thickness buttons each.
 * Replaces R34 binary toggle. Uniform rows (all parts same value for this side)
 * get .is-on highlight on the matching thickness button. */
.a-edit-items__bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--a-surface-muted, #F1EFE8);
  border-radius: 6px;
  font-size: 11px;
}
.a-edit-items__bulk-l {
  font-weight: 500;
  color: var(--a-muted, #5F5E5A);
}
.a-edit-items__bulk-side {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
}
.a-edit-items__bulk-side-l {
  font-size: 10px;
  color: var(--a-muted, #5F5E5A);
  margin-right: 4px;
  font-weight: 500;
}
.a-edit-items__bulk-btn {
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border: 0.5px solid var(--border-tertiary, #D3D1C7);
  background: white;
  color: var(--a-muted, #5F5E5A);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 3px;
  transition: background var(--a-dur-fast) var(--a-ease);
}
.a-edit-items__bulk-btn:first-of-type { border-radius: 3px 0 0 3px; }
.a-edit-items__bulk-btn:last-of-type { border-radius: 0 3px 3px 0; }
.a-edit-items__bulk-btn.is-on {
  background: #0F6E56;
  color: white;
  border-color: #0F6E56;
}
.a-edit-items__bulk-btn:hover:not(:disabled) {
  background: var(--a-surface-hover, #E8E6DE);
}
.a-edit-items__bulk-btn.is-on:hover:not(:disabled) {
  background: #085041;
}
.a-edit-items__bulk-hint {
  margin-left: auto;
  color: var(--a-muted, #888780);
  font-size: 11px;
}

/* R45: Edge running totals footer — per-thickness meters summary */
.a-edit-items__totals {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  margin-top: 8px;
  background: var(--a-surface-muted, #F1EFE8);
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.a-edit-items__totals-l {
  font-weight: 500;
  color: var(--a-muted, #5F5E5A);
  font-size: 11px;
}
.a-edit-items__totals-bucket {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.a-edit-items__totals-bucket--0_4 {
  background: #FAEEDA;
  color: #633806;
}
.a-edit-items__totals-bucket--1 {
  background: #EAF3DE;
  color: #27500A;
}
.a-edit-items__totals-bucket--2 {
  background: #E1F5EE;
  color: #085041;
}

/* Delete button */
.a-edit-items__del {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
}
.a-edit-items__del:hover {
  background: rgba(200, 35, 29, 0.08);
  color: var(--bad);
  border-color: rgba(200, 35, 29, 0.18);
}

/* Validation errors */
.a-edit-items__errors {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(200, 35, 29, 0.2);
  background: rgba(200, 35, 29, 0.04);
  border-radius: 7px;
}
.a-edit-items__error {
  font-size: 11px;
  color: var(--bad);
  padding: 2px 0;
}
.a-edit-items__error-more {
  font-size: 10px;
  color: var(--muted);
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(200, 35, 29, 0.12);
}

/* Dirty state indicator */
.a-edit-items__dirty {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--warn);
  background: var(--warn-light);
  border: 1px solid rgba(201, 107, 10, 0.2);
  border-radius: 7px;
}

/* Warn variant of summary note */
.a-edit-summary__note--warn {
  color: var(--warn);
  font-weight: 500;
  border-top-color: rgba(201, 107, 10, 0.15);
}

/* Responsive: on narrow screens, horizontal scroll of items table */
@media (max-width: 900px) {
  .a-edit-items__col-dim { width: 72px; }
  .a-edit-items__col-qty { width: 58px; }
  .a-edit-items__col-th { width: 58px; }
}

/* ═══════════════════════════════════════════════════════════════
   R31 additions — EditModal tabs + EstimateOverrideTab + HistoryTab
   ═══════════════════════════════════════════════════════════════ */

/* ── Tabs strip ──────────────────────────────────────────────── */
.a-edit-tabs {
  padding: 0 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.a-edit-tabs__tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: -1px;
  transition: color var(--a-dur-fast) var(--a-ease), border-bottom-color var(--a-dur-fast) var(--a-ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.a-edit-tabs__tab:hover { color: var(--text); }
.a-edit-tabs__tab.is-active {
  color: var(--brand);
  font-weight: 600;
  border-bottom-color: var(--brand);
}
.a-edit-tabs__badge {
  font-size: 10px;
  background: rgba(28, 27, 20, 0.06);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}
.a-edit-tabs__tab.is-active .a-edit-tabs__badge {
  background: rgba(12, 122, 69, 0.15);
  color: var(--brand);
  font-weight: 700;
}
.a-edit-tabs__badge--violet {
  background: var(--violet-light) !important;
  color: var(--violet) !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── EstimateOverrideTab ─────────────────────────────────────── */
.a-edit-estimate {}
.a-edit-estimate__info {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  background: var(--violet-light);
  border: 1px solid rgba(109, 63, 214, 0.22);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  margin-bottom: 12px;
}
.a-edit-estimate__info svg { color: var(--violet); flex-shrink: 0; }
.a-edit-estimate__info b { color: var(--text); }

.a-edit-estimate__loading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.a-edit-estimate__loading .arm-shell-skeleton-line {
  height: 28px;
  border-radius: 6px;
}

.a-edit-estimate__empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.a-edit-estimate__tablewrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.a-edit-estimate__table {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.a-edit-estimate__table thead th {
  background: var(--surface-2);
  padding: 7px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.a-edit-estimate__table tbody td {
  padding: 4px 10px;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  vertical-align: middle;
}
.a-edit-estimate__table tbody tr:last-child td {
  border-bottom: none;
}
.a-edit-estimate__col-title { }
.a-edit-estimate__col-unit { width: 70px; }
.a-edit-estimate__col-qty { width: 90px; }
.a-edit-estimate__col-price { width: 110px; }
.a-edit-estimate__col-cost { width: 100px; color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.a-edit-estimate__col-sum { width: 110px; }
.a-edit-estimate__col-del { width: 32px; }

/* R35: cost cell — editable for manual, readonly tint for engine */
.a-edit-estimate__cost-cell {
  position: relative;
}
.a-edit-estimate__cost-input {
  background: var(--violet-light) !important;
  color: var(--violet);
}
.a-edit-estimate__cost-readonly {
  display: inline-block;
  width: 100%;
  text-align: right;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  padding: 4px 7px;
}
.a-edit-estimate__cost-readonly--empty {
  color: var(--muted);
  font-style: italic;
}

.a-edit-estimate__table .a-input--sm {
  padding: 4px 7px;
  font-size: 11px;
  height: auto;
  width: 100%;
}
.a-edit-estimate__table .a-input--num {
  text-align: right;
  background: var(--surface-2);
}
.a-edit-estimate__title {
  font-weight: 500;
  color: var(--text);
}
.a-edit-estimate__title-input {
  color: var(--violet);
  font-weight: 500;
  background: var(--violet-light) !important;
}
.a-edit-estimate__unit { color: var(--muted); font-size: 11px; }
.a-edit-estimate__sum {
  font-weight: 600;
  color: var(--text);
}

.a-edit-estimate__row--manual .a-edit-estimate__sum { color: var(--violet); }

.a-edit-estimate__add {
  border-style: dashed !important;
  color: var(--brand) !important;
  border-color: rgba(12, 122, 69, 0.4) !important;
  margin-bottom: 14px;
}
.a-edit-estimate__add:hover {
  background: var(--brand-light) !important;
}

.a-edit-estimate__footer {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  align-items: start;
}
.a-edit-estimate__note {
  display: block;
}
.a-edit-estimate__note .a-textarea {
  margin-top: 4px;
  width: 100%;
}

.a-edit-estimate__totals {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.a-edit-estimate__totals-l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 8px;
}
.a-edit-estimate__totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.a-edit-estimate__totals-row span:last-child {
  font-weight: 500;
}
.a-edit-estimate__totals-row--strike span:last-child {
  text-decoration: line-through;
  color: var(--muted);
}
.a-edit-estimate__totals-row--final {
  padding: 6px 0 0;
  border-top: 1.5px solid rgba(28, 27, 20, 0.12);
  margin-top: 6px;
  font-weight: 700;
  font-size: 12px;
}
.a-edit-estimate__totals-row--final span:last-child {
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}
.a-edit-estimate__totals-delta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 4px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.a-edit-estimate__totals-delta--pos { color: var(--warn); }
.a-edit-estimate__totals-delta--neg { color: var(--bad); }

/* R35: cost + margin block in totals panel */
.a-edit-estimate__totals-margin {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(28, 27, 20, 0.08);
}
.a-edit-estimate__totals-row--margin {
  padding: 4px 0 0;
  border-top: 1px solid rgba(28, 27, 20, 0.08);
  margin-top: 4px;
  font-weight: 600;
  font-size: 11px;
}
.a-edit-estimate__totals-row--margin span:last-child {
  color: var(--brand);
  font-weight: 700;
}
.a-edit-estimate__totals-row--margin-neg span:last-child {
  color: var(--bad);
}

/* R36: Permission-lock UI */
.a-pill.a-pill--amber {
  background: rgba(234, 162, 32, 0.12);
  color: #B48020;
  border: 1px solid rgba(234, 162, 32, 0.28);
}
.a-edit__lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  cursor: help;
}
.a-edit__lock-pill:hover {
  background: rgba(234, 162, 32, 0.18);
}
.a-edit-estimate__locked-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(234, 162, 32, 0.10);
  border: 1px solid rgba(234, 162, 32, 0.28);
  border-left: 3px solid #B48020;
  border-radius: 6px;
  color: #8E6719;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
/* Label-based buttons can't use :disabled — we use a class */
.a-btn.is-disabled,
.a-btn.is-disabled:hover {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* R37: Structured XLSX import errors panel */
.a-edit-items__import-errors {
  margin: 8px 0 10px;
  background: rgba(200, 35, 29, 0.04);
  border: 1px solid rgba(200, 35, 29, 0.22);
  border-left: 3px solid var(--bad);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
}
.a-edit-items__import-errors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.a-edit-items__import-errors-title {
  color: var(--bad);
  font-weight: 700;
  font-size: 12px;
}
.a-edit-items__import-errors-actions {
  display: flex;
  gap: 6px;
}
.a-edit-items__import-errors-actions label.a-btn {
  cursor: pointer;
  position: relative;
}
.a-edit-items__import-errors-summary {
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.a-edit-items__import-errors-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
  border-top: 1px dashed rgba(200, 35, 29, 0.16);
  padding-top: 6px;
}
.a-edit-items__import-errors-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(200, 35, 29, 0.08);
  font-variant-numeric: tabular-nums;
}
.a-edit-items__import-errors-row:last-child {
  border-bottom: none;
}
.a-edit-items__import-errors-row-num {
  flex-shrink: 0;
  width: 48px;
  font-weight: 700;
  color: var(--bad);
  font-size: 10px;
}
.a-edit-items__import-errors-row-name {
  flex-shrink: 0;
  min-width: 140px;
  max-width: 200px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-edit-items__import-errors-row-field {
  flex-shrink: 0;
  min-width: 60px;
  color: var(--muted);
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.a-edit-items__import-errors-row-msg {
  flex: 1;
  color: var(--text-2);
}
.a-edit-items__import-errors-row--E_BAD_DIMENSION .a-edit-items__import-errors-row-num { color: #B45309; }
.a-edit-items__import-errors-row--E_BAD_QTY .a-edit-items__import-errors-row-num { color: #B45309; }

/* R38: Upload progress bar */
.a-edit-items__import-progress {
  margin: 8px 0 10px;
  background: rgba(12, 122, 69, 0.04);
  border: 1px solid rgba(12, 122, 69, 0.22);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
}
.a-edit-items__import-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}
.a-edit-items__import-progress-pct {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.a-edit-items__import-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(12, 122, 69, 0.10);
  border-radius: 3px;
  overflow: hidden;
}
.a-edit-items__import-progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width 120ms ease-out;
  border-radius: 3px;
}

/* R38: Soft warnings panel (amber, success-with-flags) */
.a-edit-items__import-warnings {
  margin: 8px 0 10px;
  background: rgba(234, 162, 32, 0.06);
  border: 1px solid rgba(234, 162, 32, 0.28);
  border-left: 3px solid #B48020;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
}
.a-edit-items__import-warnings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.a-edit-items__import-warnings-title {
  color: #8E6719;
  font-weight: 700;
  font-size: 12px;
}
.a-edit-items__import-warnings-summary {
  color: var(--text-2);
  margin-bottom: 6px;
}
.a-edit-items__import-errors-row--warn .a-edit-items__import-errors-row-num {
  color: #B48020;
}
.a-edit-items__import-errors-row--W_LARGE_DIMENSION .a-edit-items__import-errors-row-num,
.a-edit-items__import-errors-row--W_LARGE_QTY .a-edit-items__import-errors-row-num {
  color: #B48020;
}

/* Danger button variant for "Сбросить override" */
.a-btn--danger {
  color: var(--bad);
  border-color: rgba(200, 35, 29, 0.25);
}
.a-btn--danger:hover:not(:disabled) {
  background: rgba(200, 35, 29, 0.06);
}

/* ── HistoryTab ──────────────────────────────────────────────── */
.a-edit-history {
  position: relative;
  padding-left: 18px;
}
.a-edit-history__line {
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 10px;
  width: 1px;
  background: rgba(28, 27, 20, 0.1);
}
.a-edit-history__loading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.a-edit-history__loading .arm-shell-skeleton-line {
  height: 42px;
  border-radius: 6px;
}
.a-edit-history__empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 12px;
}

.a-edit-history__item {
  position: relative;
  margin-bottom: 14px;
}
.a-edit-history__item:last-child {
  margin-bottom: 0;
}
.a-edit-history__dot {
  position: absolute;
  left: -16px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(28, 27, 20, 0.3);
}
.a-edit-history__item--brand .a-edit-history__dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 122, 69, 0.15);
}
.a-edit-history__item--info .a-edit-history__dot {
  background: var(--info);
  box-shadow: 0 0 0 3px rgba(30, 111, 200, 0.15);
}
.a-edit-history__item--warn .a-edit-history__dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(201, 107, 10, 0.15);
}
.a-edit-history__item--bad .a-edit-history__dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(200, 35, 29, 0.15);
}
.a-edit-history__item--violet .a-edit-history__dot {
  background: var(--violet);
  box-shadow: 0 0 0 3px rgba(109, 63, 214, 0.15);
}

.a-edit-history__body {}
.a-edit-history__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.a-edit-history__title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}
.a-edit-history__title--info { color: var(--info); }
.a-edit-history__title--warn { color: var(--warn); }
.a-edit-history__title--bad { color: var(--bad); }
.a-edit-history__title--violet { color: var(--violet); }
.a-edit-history__title--brand { color: var(--brand); }

.a-edit-history__date {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.a-edit-history__actor {
  font-size: 10px;
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
}
.a-edit-history__actor--admin {
  background: rgba(109, 63, 214, 0.1);
  color: var(--violet);
  font-weight: 500;
}

.a-edit-history__details {
  background: var(--surface-2);
  border-left: 2px solid var(--border-strong);
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.45;
}
.a-edit-history__item--info .a-edit-history__details { border-left-color: rgba(30, 111, 200, 0.3); }
.a-edit-history__item--warn .a-edit-history__details { border-left-color: rgba(201, 107, 10, 0.3); }
.a-edit-history__item--bad .a-edit-history__details { border-left-color: rgba(200, 35, 29, 0.3); }
.a-edit-history__item--violet .a-edit-history__details { border-left-color: rgba(109, 63, 214, 0.3); }
.a-edit-history__item--brand .a-edit-history__details { border-left-color: rgba(12, 122, 69, 0.3); }

.a-edit-history__diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
}
.a-edit-history__diff-from {
  color: var(--muted);
  text-decoration: line-through;
}
.a-edit-history__diff-arrow {
  color: var(--muted);
}
.a-edit-history__diff-to {
  font-weight: 600;
  color: var(--text);
}

.a-edit-history__changes {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.a-edit-history__change {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  flex-wrap: wrap;
}
.a-edit-history__change-field {
  color: var(--muted);
  font-weight: 500;
  text-transform: capitalize;
}
.a-edit-history__more {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

/* Responsive: stack estimate footer on narrow screens */
@media (max-width: 800px) {
  .a-edit-estimate__footer {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   R32 — OrderDetail .a-order* primitives (structure + info + items)
   Note: estimate/cut/compare/exports tabs still use legacy classes —
   will be migrated in R33.
   ═══════════════════════════════════════════════════════════════ */

/* Root + loading/error states */
.a-order {
  max-width: 1280px;
  padding: 14px;
}
.a-order--drawer {
  /* matches arm-order-panel open state */
}
.a-order--empty,
.a-order--error {
  padding: 24px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.a-order--loading {
  padding: 16px;
}
.a-order__skel {
  height: 420px;
  border-radius: 8px;
}

/* Header actions */
.a-order__head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.a-order__import-label {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.a-order__import-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Export menu strip */
.a-order__export-menu {
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  align-items: center;
}
.a-order__export-label {
  font-size: 12px;
  color: var(--muted);
}

/* KPI strip */
.a-order__kpi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.a-order__kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.a-order__kpi-card--brand {
  border-color: rgba(12, 122, 69, 0.18);
  background: var(--brand-light);
}
.a-order__kpi-l {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 3px;
}
.a-order__kpi-v {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.a-order__kpi-card--brand .a-order__kpi-v { color: var(--brand); }

/* Status flow (progress bar) */
.a-order__flow {
  display: flex;
  gap: 2px;
  margin: 12px 0;
  font-size: 11px;
}
.a-order__flow-step {
  flex: 1;
  padding: 4px 2px;
  text-align: center;
  border-radius: 4px;
  background: rgba(28, 27, 20, 0.04);
  color: var(--muted);
  font-weight: 400;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
}
.a-order__flow-step--done {
  background: var(--brand-light);
  color: var(--brand);
}
.a-order__flow-step--active {
  font-weight: 700;
}

/* Cross-order compare panel */
.a-order__compare {
  padding: 14px;
  margin: 12px 0;
  display: grid;
  gap: 12px;
}
.a-order__compare-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.a-order__compare-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.a-order__compare-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.a-order__compare-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.a-order__compare-input {
  width: 220px;
}
.a-order__compare-flags {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-2);
}
.a-order__compare-hint {
  color: var(--muted);
  font-size: 11px;
}
.a-order__compare-result {
  padding: 12px;
  background: var(--surface-2);
  border-radius: 8px;
}
.a-order__compare-error {
  color: var(--bad);
  font-size: 12px;
}
.a-order__compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  font-size: 12px;
}
.a-order__compare-kv {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.a-order__compare-empty {
  color: var(--muted);
  font-size: 12px;
}

/* Tabs strip (separate namespace from .a-edit-tabs — different context) */
.a-order-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.a-order-tabs__tab {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  transition: background var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
}
.a-order-tabs__tab:hover:not(.is-active) {
  background: var(--surface-2);
  color: var(--text);
}
.a-order-tabs__tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
}

/* TAB: info — 2-column grid main + aside */
.a-order__info-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}
.a-order__info-main {
  padding: 16px;
}
.a-order__info-aside {
  display: grid;
  gap: 14px;
}
.a-order__info-section {
  padding: 14px 16px;
}
.a-panel__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Details table (.a-table--details) — key-value vertical layout */
.a-table--details {
  width: 100%;
  font-size: 13px;
  border-collapse: separate;
  border-spacing: 0;
}
.a-table--details td {
  padding: 6px 4px;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
}
.a-table--details tr:last-child td { border-bottom: none; }
.a-table--details__k {
  font-weight: 600;
  color: var(--text-2);
  width: 35%;
}
.a-table--details__v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Move-status form inside info aside */
.a-order__move-form {
  display: grid;
  gap: 8px;
}

/* Cut KPI subset in info aside */
.a-order__cut-kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.a-order__cut-kpi .a-order__kpi-v { font-size: 14px; }

.a-order__cut-svg {
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: auto;
}

/* R47: CutExplain — engine rejection stats + warnings */
.a-cut-explain {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--a-surface-muted, #F1EFE8);
  border-radius: 6px;
  font-size: 12px;
}
.a-cut-explain__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.a-cut-explain__title {
  font-weight: 500;
  color: var(--a-muted, #5F5E5A);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.a-cut-explain__meta {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--a-muted, #888780);
  padding: 2px 6px;
  background: rgba(0,0,0,0.04);
  border-radius: 3px;
}
.a-cut-explain__rejections {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.a-cut-explain__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 400;
}
.a-cut-explain__pill b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.a-cut-explain__pill--err {
  background: #FCEBEB;
  color: #791F1F;
}
.a-cut-explain__pill--warn {
  background: #FAEEDA;
  color: #633806;
}
.a-cut-explain__warnings {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 11px;
  color: var(--a-muted, #5F5E5A);
}
.a-cut-explain__warnings li {
  margin: 2px 0;
}

/* R48: CutSolverPicker — admin-only algorithm/heuristic controls */
.a-cut-solver {
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--a-surface-muted, #F1EFE8);
  border: 0.5px solid var(--border-tertiary, #D3D1C7);
  border-radius: var(--border-radius-md, 8px);
  font-size: 12px;
}
.a-cut-solver__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.a-cut-solver__title {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--a-muted, #5F5E5A);
}
.a-cut-solver__admin-pill {
  font-size: 10px;
  padding: 1px 7px;
  background: #FAEEDA;
  color: #633806;
  border-radius: 8px;
  font-family: var(--font-mono, monospace);
}
.a-cut-solver__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.a-cut-solver__label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--a-muted, #5F5E5A);
}
.a-cut-solver__label select {
  min-width: 140px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}
.a-cut-solver__actual {
  margin-top: 8px;
  font-size: 11px;
  color: var(--a-muted, #5F5E5A);
}
.a-cut-solver__actual code {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(0,0,0,0.04);
  border-radius: 3px;
  color: var(--a-text, #2C2C2A);
}
.a-cut-solver__hint {
  margin-top: 6px;
  font-size: 11px;
  color: #633806;
  background: #FAEEDA;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}
.a-cut-solver__err {
  margin-top: 6px;
  font-size: 11px;
  color: #791F1F;
  background: #FCEBEB;
  padding: 4px 8px;
  border-radius: 4px;
}

.a-order__empty-hint {
  color: var(--muted);
  font-size: 12px;
}

/* Revisions list */
.a-order__revs-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.a-order__revs-summary {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.a-order__revs {
  display: grid;
  gap: 6px;
}
.a-order__rev {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.a-order__rev--pinned {
  border-color: rgba(12, 122, 69, 0.25);
  background: var(--brand-light);
}
.a-order__rev-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.a-order__rev-title {
  font-weight: 700;
}
.a-order__rev-pinned-mark {
  margin-left: 6px;
  color: var(--brand);
  font-size: 10px;
  letter-spacing: 0.03em;
}
.a-order__rev-meta {
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.a-order__rev-actions {
  display: flex;
  gap: 4px;
}

/* TAB: items */
.a-order__items {}
.a-order__items-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.a-order__items-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.a-order__items-skel {
  height: 200px;
  border-radius: 8px;
}
.a-order__empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.a-order__items-wrap {
  overflow-x: auto;
}
.a-order__items-table {
  font-size: 12px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.a-order__items-table thead th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.a-order__items-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  vertical-align: middle;
}
.a-order__items-num {
  color: var(--muted);
  width: 36px;
}
.a-order__items-name {
  font-weight: 500;
}
.a-order__items-note {
  font-size: 11px;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 900px) {
  .a-order__info-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   R33 — OrderDetail finalization: estimate/cut/compare/exports tabs
   ═══════════════════════════════════════════════════════════════ */

/* ── EstimateGrid (Tab Калькуляция) ─────────────────────────── */
.a-order__estimate {}
.a-order__estimate-totals {
  margin: 0 0 14px;
}
.a-order__estimate-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.a-order__estimate-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.a-order__estimate-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  align-items: center;
}
.a-order__estimate-col {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid transparent;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
}
.a-order__estimate-col:hover {
  background: var(--surface);
  border-color: var(--border);
}
.a-order__estimate-col.is-active {
  background: var(--brand-light);
  color: var(--brand-2);
  border-color: rgba(12, 122, 69, 0.22);
  font-weight: 500;
}
.a-order__estimate-col input[type="checkbox"] {
  margin: 0;
  accent-color: var(--brand);
}

.a-order__estimate-wrap {
  overflow: auto;
}
.a-order__estimate-table {
  font-size: 12px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.a-order__estimate-table thead th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.a-order__estimate-table tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  vertical-align: middle;
}
.a-order__estimate-num {
  color: var(--muted);
  width: 32px;
  font-variant-numeric: tabular-nums;
}
.a-order__estimate-section td {
  background: var(--brand-light);
  font-weight: 700;
  font-size: 12px;
  color: var(--brand);
  padding: 7px 10px !important;
  letter-spacing: -0.01em;
}
.a-order__estimate-subtotal td {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 11px;
  color: var(--text-2);
}
.a-order__estimate-subtotal td:last-child {
  color: var(--text);
  font-size: 12px;
}

/* ── Tab Раскрой ─────────────────────────────────────────────── */
.a-order__cut {}
.a-order__cut-strip {
  margin: 0 0 14px;
}
.a-order__cut-map {
  padding: 14px 16px;
  overflow: auto;
}
.a-order__cut-map .a-order__cut-svg {
  margin-top: 10px;
}

/* ── Tab Сравнение ────────────────────────────────────────────── */
.a-order__compare-tab {
  display: grid;
  gap: 14px;
}
.a-order__compare-summary {
  padding: 14px 16px;
}
.a-order__compare-summary-text {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.45;
}
.a-order__compare-grids {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.a-order__compare-list {
  padding: 14px 16px;
}
.a-order__compare-row {
  padding: 7px 0;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  font-size: 12px;
}
.a-order__compare-row:last-child { border-bottom: none; }
.a-order__compare-row-label {
  font-weight: 600;
  color: var(--text);
}
.a-order__compare-row-meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ── Tab Экспорт ──────────────────────────────────────────────── */
.a-order__exports {
  display: grid;
  gap: 14px;
}
.a-order__exports-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0;
}
.a-order__exports-btn {
  font-size: 13px;
  padding: 10px 20px;
}
.a-order__exports-contract {
  padding: 14px 16px;
}
.a-order__exports-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(28, 27, 20, 0.05);
  font-size: 12px;
}
.a-order__exports-row:last-child { border-bottom: none; }
.a-order__exports-key {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.a-order__exports-url {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 800px) {
  .a-order__compare-grids {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════
   R34 — Items editor UX: inline validation + XLSX import in modal
   + duplicate-row + bulk toggle edges
   ═══════════════════════════════════════════════════════════════ */

/* XLSX import label — hidden file input pattern (like a-order__import-label) */
.a-edit-items__import {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.a-edit-items__import-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* Bulk edge toggle bar — appears above items table when items.length > 0 */
.a-edit-items__bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.a-edit-items__bulk-l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.a-edit-items__bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-family: inherit;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease), border-color var(--a-dur-fast) var(--a-ease);
}
.a-edit-items__bulk-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}
.a-edit-items__bulk-btn.is-on {
  background: var(--brand-light);
  border-color: rgba(12, 122, 69, 0.3);
  color: var(--brand-2);
  font-weight: 600;
}
.a-edit-items__bulk-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.a-edit-items__bulk-hint {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* Per-row validation — red input border + row tinted background */
.a-input.is-err,
.a-input--num.is-err {
  border-color: rgba(200, 35, 29, 0.45) !important;
  background: rgba(200, 35, 29, 0.04) !important;
}
.a-input.is-err:focus,
.a-input--num.is-err:focus {
  border-color: var(--bad) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(200, 35, 29, 0.1);
}
.a-edit-items__row--err td {
  background: rgba(200, 35, 29, 0.02);
}

.a-edit-items__err-row td {
  padding: 4px 10px !important;
  background: rgba(200, 35, 29, 0.05);
  font-size: 10px;
  color: var(--bad);
  font-weight: 500;
  border-bottom: 1px solid rgba(200, 35, 29, 0.12) !important;
  letter-spacing: 0.01em;
}

/* Actions column (duplicate + delete) */
.a-edit-items__col-actions {
  width: 60px;
  white-space: nowrap;
  text-align: right;
}
.a-edit-items__col-actions td,
td.a-edit-items__col-actions {
  padding-right: 6px;
}
.a-edit-items__dup {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 3px 5px;
  border-radius: 4px;
  transition: background var(--a-dur-fast) var(--a-ease), color var(--a-dur-fast) var(--a-ease);
  margin-right: 2px;
}
.a-edit-items__dup:hover {
  background: var(--brand-light);
  color: var(--brand);
}

/* Compact errors summary bar (replaces old line-by-line list) */
.a-edit-items__errors-bar {
  padding: 8px 12px;
  margin-top: 8px;
  background: rgba(200, 35, 29, 0.06);
  border: 1px solid rgba(200, 35, 29, 0.2);
  border-radius: 6px;
  color: var(--bad);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}
.a-edit-items__errors-bar b {
  font-weight: 700;
}
.a-edit-items__errors-bar--critical {
  background: rgba(200, 35, 29, 0.12);
  border-color: rgba(200, 35, 29, 0.35);
  font-weight: 600;
}


/* --- R60 ARM operational shell: compact contour, no glass overload --- */
.arm-shell { background: linear-gradient(180deg, #f8f6f1 0%, #f2eee4 100%); }
.arm-shell::before { content: none; }
.arm-sidebar, .arm-shell-header, .arm-savedviews-host, .arm-toolbar-host, .arm-inspector-host, #armSelectionHost, #armStatusHost {
  position: relative;
  background: rgba(255,253,248,.94) !important;
  border: 1px solid rgba(38,34,25,.10);
  box-shadow: 0 10px 24px rgba(38,34,25,.05);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.arm-shell-header, .arm-savedviews-host, .arm-toolbar-host, .arm-inspector-host, #armSelectionHost, #armStatusHost { border-radius: 16px; margin: 8px 18px 0; }
.arm-workstation, .arm-main-col { padding-bottom: 20px; }
.arm-shell #armSavedViewsHost,
.arm-shell #armToolbarHost,
.arm-shell #armSelectionHost,
.arm-shell #armInspectorHost,
.arm-shell #armStatusHost { display: block; }
.arm-shell #armDetailHost { display: none; }
.arm-shell .arm-workstation { grid-template-columns: minmax(0, 1fr); max-width: none; gap: 14px; padding: 16px 20px 20px; }
.arm-shell[data-shell-inspector='closed'] #armInspectorHost { display: none; }
#hzArmDock.arm-dock--inline {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: auto;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 18px 0;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#hzArmDock.arm-dock--inline::before { content: none; }
.arm-dock__meta { display: none; }
.arm-dock__cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arm-dock__cluster--nav { margin-bottom: 2px; }
.arm-dock__cluster--context { margin-bottom: 2px; }
.arm-dock__cluster--utility { justify-content: flex-start; }
.arm-dock__btn, .arm-dock__cmd {
  min-height: 34px;
  border-radius: 10px !important;
  border: 1px solid rgba(38,34,25,.14) !important;
  background: rgba(255,253,248,.90) !important;
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease;
}
.arm-dock__btn:hover, .arm-dock__cmd:hover {
  transform: none;
  border-color: rgba(47,105,72,.35) !important;
  background: rgba(255,255,255,.98) !important;
  box-shadow: none;
}
.arm-dock__btn.primary, .arm-dock__btn--primary-action {
  background: linear-gradient(180deg, #3c8260, #2f6948) !important;
  border-color: rgba(47,105,72,.24) !important;
  color: #fffdf8 !important;
}
.arm-dock__btn .arm-dock__icon { display: inline-flex; align-items: center; justify-content: center; }
.arm-dock__cmd { min-width: 36px; font-weight: 800; }
.arm-shell-band-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; color: #475569; }
.arm-shell-band-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(38,34,25,.10);
  border-radius: 999px;
  background: rgba(255,253,248,.84);
}
.arm-shell-band-row .btn,
.arm-shell-band-row .arm-shell-chip {
  min-height: 30px;
}
.arm-shell #armToolbarHost .arm-toolbar-host__label,
.arm-shell #armSavedViewsHost .arm-shell-react-band__label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(23,24,20,.50);
}
.arm-shell #armInspectorHost {
  position: relative;
  top: auto;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(38,34,25,.10);
  background: rgba(255,253,248,.90);
  box-shadow: none;
}
.arm-inspector-host__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12px; color: #475569; }
.arm-inspector-host__meta b { color: #0f172a; }
.arm-shell #armSelectionHost { min-height: 0; padding: 0 20px 4px; }
.arm-shell #armSelectionHost > div {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(38,34,25,.09);
  border-radius: 999px;
  background: rgba(255,253,248,.72);
  font-size: 12px;
  color: #475569;
}
.arm-shell #armStatusHost { padding: 0 20px 10px; }
.arm-shell-statusbar--compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 14px;
  border: 1px solid rgba(38,34,25,.10);
  background: rgba(255,253,248,.86);
}
.arm-shell-statusbar--compact .arm-shell-statuspill { min-height: 30px; padding: 4px 10px; }
.arm-shell-statusbar--compact .btn { margin-left: auto; min-height: 32px; }
.arm-shell[data-arm-current-tab='dash'] #armInspectorHost,
.arm-shell[data-arm-current-tab='kanban'] #armInspectorHost,
.arm-shell[data-arm-current-tab='import'] #armInspectorHost,
.arm-shell[data-arm-current-tab='kpi'] #armInspectorHost,
.arm-shell[data-arm-current-tab='exports'] #armInspectorHost,
.arm-shell[data-arm-current-tab='delivery'] #armInspectorHost,
.arm-shell[data-arm-current-tab='outbox'] #armInspectorHost,
.arm-shell[data-arm-current-tab='dlq'] #armInspectorHost,
.arm-shell[data-arm-current-tab='analytics'] #armInspectorHost,
.arm-shell[data-arm-current-tab='ops'] #armInspectorHost,
.arm-shell[data-arm-current-tab='calc'] #armInspectorHost,
.arm-shell[data-arm-current-tab='rates'] #armInspectorHost,
.arm-shell[data-arm-current-tab='offcuts'] #armInspectorHost {
  display: none;
}
.arm-shell[data-arm-current-tab='dash'] #armSelectionHost,
.arm-shell[data-arm-current-tab='dash'] #armStatusHost,
.arm-shell[data-arm-current-tab='kanban'] #armSelectionHost,
.arm-shell[data-arm-current-tab='kanban'] #armStatusHost,
.arm-shell[data-arm-current-tab='import'] #armSelectionHost,
.arm-shell[data-arm-current-tab='import'] #armStatusHost,
.arm-shell[data-arm-current-tab='kpi'] #armSelectionHost,
.arm-shell[data-arm-current-tab='kpi'] #armStatusHost,
.arm-shell[data-arm-current-tab='exports'] #armSelectionHost,
.arm-shell[data-arm-current-tab='exports'] #armStatusHost,
.arm-shell[data-arm-current-tab='delivery'] #armSelectionHost,
.arm-shell[data-arm-current-tab='delivery'] #armStatusHost,
.arm-shell[data-arm-current-tab='outbox'] #armSelectionHost,
.arm-shell[data-arm-current-tab='outbox'] #armStatusHost,
.arm-shell[data-arm-current-tab='dlq'] #armSelectionHost,
.arm-shell[data-arm-current-tab='dlq'] #armStatusHost,
.arm-shell[data-arm-current-tab='analytics'] #armSelectionHost,
.arm-shell[data-arm-current-tab='analytics'] #armStatusHost,
.arm-shell[data-arm-current-tab='ops'] #armSelectionHost,
.arm-shell[data-arm-current-tab='ops'] #armStatusHost,
.arm-shell[data-arm-current-tab='calc'] #armSelectionHost,
.arm-shell[data-arm-current-tab='calc'] #armStatusHost,
.arm-shell[data-arm-current-tab='rates'] #armSelectionHost,
.arm-shell[data-arm-current-tab='rates'] #armStatusHost,
.arm-shell[data-arm-current-tab='offcuts'] #armSelectionHost,
.arm-shell[data-arm-current-tab='offcuts'] #armStatusHost {
  display: none !important;
}
.a-rates-workbench__grid { display:grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .82fr); gap: 16px; align-items: start; }
.a-rates-workbench__table, .a-rates-workbench__editor, .dc-table-card, .dc-health-card { border-radius: 22px; background: rgba(255,255,255,.68); backdrop-filter: blur(18px) saturate(165%); -webkit-backdrop-filter: blur(18px) saturate(165%); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 24px 44px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.78); }
.a-rates-workbench__table { padding: 14px; }
.a-rates-workbench__editor { position: sticky; top: 22px; padding: 16px; }
.a-rates-workbench__title, .dc-table-toolbar__title, .dc-health-card__title { font-size: 14px; font-weight: 900; color: #0f172a; }
.a-rates-workbench__sub, .dc-table-toolbar__sub { margin-top: 4px; font-size: 12px; color: #64748b; }
.a-rates-workbench__editor-head, .a-rates-workbench__table-head, .dc-table-toolbar { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.a-rates-workbench__editor-body { display:grid; gap: 14px; margin-top: 14px; }
.a-rates-form-grid--stacked { display:grid; gap:12px; }
.a-rates-form-grid--compact-2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.a-rates-form-grid--compact-3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.a-rates-form-label--checkbox { display:flex; align-items:center; gap:8px; }
.a-rates-workbench__editor-summary { display:grid; gap:10px; padding: 12px 14px; border-radius: 18px; background: rgba(248,250,252,.86); border: 1px solid rgba(148,163,184,.14); }
.a-rates-workbench__editor-summary span { display:block; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:#64748b; }
.a-rates-workbench__editor-summary b { display:block; margin-top:4px; font-size:13px; color:#0f172a; }
.a-rates-workbench__empty { display:grid; gap:8px; padding: 18px 16px; border-radius: 18px; background: rgba(248,250,252,.78); color: #64748b; }
.a-rates-form-actions--sticky { position: sticky; bottom: 0; padding-top: 6px; background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.88) 28%); }
.dc-page-actions { display:flex; gap:8px; flex-wrap:wrap; }
.dc-summary-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 18px 0; }
.dc-summary-card { display:grid; gap:4px; padding: 18px 16px !important; border-radius: 22px; text-align:left; background: rgba(255,255,255,.70); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 18px 30px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.78); }
.dc-summary-card__eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .10em; text-transform: uppercase; color: rgba(71,85,105,.78); }
.dc-summary-card__value { font-size: 28px; line-height: 1; color: #0f172a; }
.dc-summary-card__sub { font-size: 12px; color: #64748b; }
.dc-summary-card--accent { background: linear-gradient(180deg, rgba(99,102,241,.10), rgba(255,255,255,.74)); }
.dc-summary-card--warn { background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(255,255,255,.74)); }
.dc-summary-card--danger { background: linear-gradient(180deg, rgba(239,68,68,.10), rgba(255,255,255,.74)); }
.dc-summary-card--ok { background: linear-gradient(180deg, rgba(16,185,129,.10), rgba(255,255,255,.74)); }
.dc-table-card { padding: 16px; }
.dc-table-toolbar__actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.dc-filter-select, .dc-filter-search { min-width: 170px; }
.dc-filter-search { min-width: 260px; }
.dc-table-wrap { margin-top: 14px; overflow:auto; border-radius: 18px; }
.dc-table th { white-space: nowrap; }
.dc-order-link { appearance:none; border:none; background:none; padding:0; font:inherit; font-weight:800; color:#4338ca; cursor:pointer; }
.dc-customer-cell { display:grid; gap:4px; }
.dc-customer-cell span { font-size:12px; color:#64748b; }
.dc-status-badge--ready_to_ship { background: rgba(99,102,241,.10); color:#4338ca; }
.dc-status-badge--shipped { background: rgba(59,130,246,.10); color:#0369a1; }
.dc-status-badge--closed { background: rgba(16,185,129,.10); color:#047857; }
.dc-next-step { color:#475569; }
.dc-row-actions { text-align:right; }
.dc-row-action { min-width: 94px; }
.dc-empty-cell { color:#94a3b8; text-align:center; padding: 22px 12px !important; }
.dc-empty-cell--board { padding: 16px 0; }
.dc-board-grid { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 12px; }
.dc-board-column { padding: 16px; border-radius: 22px; }
.dc-board-column__head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 10px; }
.dc-board-column__title { font-size:13px; font-weight:900; }
.dc-board-card { padding: 12px 13px; margin-bottom: 10px; border-radius: 18px; background: rgba(255,255,255,.76); cursor:pointer; }
.dc-board-card__top { display:flex; justify-content:space-between; gap:10px; align-items:center; }
.dc-board-card__sub { margin-top:4px; font-size:12px; color:#64748b; }
.dc-board-card__action { width:100%; margin-top:10px; }
.dc-health-card { padding: 18px; margin-top: 12px; }
.dc-health-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.dc-health-row { display:flex; justify-content:space-between; gap:10px; padding: 10px 12px; border-radius: 16px; background: rgba(248,250,252,.84); border: 1px solid rgba(148,163,184,.14); }
.dc-skeleton { height: 240px; border-radius: 20px; margin: 16px 0; }
.a-matdb-edit-form--advanced .a-matdb-edit-form__grid { gap: 16px; }
.a-matdb-edit-form__section { display:grid; gap:10px; padding: 14px; border-radius: 20px; background: rgba(248,250,252,.84); border: 1px solid rgba(148,163,184,.14); }
.a-matdb-edit-form__section-title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.a-matdb-edit-form__pairs--wide { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.a-matdb-edit-form__label--select { display:grid; gap:6px; }
.a-matdb-edit-form__toggles { display:flex; gap:12px; flex-wrap:wrap; }
.a-matdb-op-modal__label--span2 { grid-column: span 2; }
.a-matdb-op-modal__textarea { min-height: 88px; resize: vertical; }
@media (max-width: 1180px) {
  #hzArmDock.arm-dock--inline { margin-left: 12px; margin-right: 12px; }
  .arm-dock__cluster--utility { justify-content: flex-start; }
  .a-rates-workbench__grid { grid-template-columns: 1fr; }
  .a-rates-workbench__editor { position: static; }
}
@media (max-width: 920px) { .dc-board-grid { grid-template-columns: 1fr; } .a-rates-form-grid--compact-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .arm-shell-header,
  .arm-savedviews-host,
  .arm-toolbar-host,
  .arm-inspector-host,
  #armSelectionHost,
  #armStatusHost { margin-left: 12px; margin-right: 12px; }
  #hzArmDock.arm-dock--inline { margin-left: 12px; margin-right: 12px; padding: 10px; }
  .arm-dock__btn-label { display: none; }
  .arm-dock__cluster { justify-content: flex-start; }
  .dc-filter-search, .dc-filter-select { min-width: 100%; }
  .a-rates-form-grid--compact-2 { grid-template-columns: 1fr; }
  .a-matdb-op-modal__label--span2 { grid-column: auto; }
}

/* ===== R57 main-screen polish: dash / kpi / analytics / tables ===== */
.a-dash,
.a-kpi,
.a-analytics { display: grid; gap: 18px; }

.a-dash__hero,
.a-kpi-card,
.a-analytics-card,
.a-dash-card {
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 24px;
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  box-shadow: 0 24px 48px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.78);
}

.a-dash__hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .75fr);
  gap: 18px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.a-dash__hero::before,
.a-kpi-card::before,
.a-analytics-card::before,
.a-dash-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(99,102,241,.12), transparent 36%), radial-gradient(circle at bottom left, rgba(16,185,129,.10), transparent 42%);
  opacity: .95;
}
.a-dash__hero-copy,
.a-dash__hero-side,
.a-kpi-card > *,
.a-analytics-card > *,
.a-dash-card > * { position: relative; z-index: 1; }
.a-dash__eyebrow,
.a-dash-kpi__eyebrow,
.a-kpi-summary-card__eyebrow,
.a-analytics-summary__eyebrow,
.a-dash__next-eyebrow,
.a-dash-card__title,
.a-kpi-card__title,
.a-analytics-card__title { letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.a-dash__eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(79,70,229,.08); border: 1px solid rgba(99,102,241,.14); color: #4338ca; font-size: 11px; }
.a-dash__title { margin: 14px 0 8px; font-size: 28px; line-height: 1.08; letter-spacing: -.03em; color: #0f172a; }
.a-dash__sub { margin: 0; max-width: 64ch; color: #475569; font-size: 14px; line-height: 1.6; }
.a-dash__attention { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.a-dash__attention-chip { appearance: none; border: 1px solid rgba(148,163,184,.18); background: rgba(248,250,252,.82); color: #334155; border-radius: 999px; padding: 9px 12px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .18s cubic-bezier(.16,1,.3,1), background .18s ease, border-color .18s ease; }
.a-dash__attention-chip:hover { transform: translateY(-1px); background: rgba(255,255,255,.95); border-color: rgba(99,102,241,.28); }
.a-dash__attention-chip.is-passive { cursor: default; }
.a-dash__hero-side { display: grid; gap: 12px; }
.a-dash__next,
.a-dash__sync { padding: 16px; border-radius: 20px; background: rgba(248,250,252,.82); border: 1px solid rgba(148,163,184,.14); }
.a-dash__next--brand { background: linear-gradient(180deg, rgba(99,102,241,.10), rgba(248,250,252,.88)); }
.a-dash__next--warn { background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(248,250,252,.88)); }
.a-dash__next--danger { background: linear-gradient(180deg, rgba(239,68,68,.10), rgba(248,250,252,.88)); }
.a-dash__next--ok { background: linear-gradient(180deg, rgba(16,185,129,.10), rgba(248,250,252,.88)); }
.a-dash__next-title { display: block; margin-top: 6px; font-size: 18px; line-height: 1.2; color: #0f172a; }
.a-dash__next-body { display: block; margin-top: 6px; font-size: 13px; line-height: 1.55; color: #475569; }
.a-dash__next-btn { margin-top: 12px; width: 100%; justify-content: center; }
.a-dash__sync { display: grid; gap: 6px; }
.a-dash__sync-label,
.a-dash-kpi__eyebrow,
.a-kpi-summary-card__eyebrow,
.a-analytics-summary__eyebrow,
.a-dash__next-eyebrow,
.a-dash-card__sub,
.a-kpi-card__sub,
.a-analytics-card__sub { color: #64748b; font-size: 11px; }
.a-dash__sync-value { color: #0f172a; font-size: 18px; line-height: 1.1; }
.a-dash__refresh { justify-content: center; }
.a-dash__scenarios,
.a-dash__kpis,
.a-kpi__summary-grid,
.a-analytics__summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.a-dash__scenario,
.a-dash-kpi,
.a-kpi-summary-card,
.a-analytics-summary {
  appearance: none;
  text-align: left;
  cursor: pointer;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.78);
  background: rgba(255,255,255,.74);
  padding: 16px;
  box-shadow: 0 20px 34px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.82);
  backdrop-filter: blur(16px) saturate(165%);
  -webkit-backdrop-filter: blur(16px) saturate(165%);
  transition: transform .18s cubic-bezier(.16,1,.3,1), box-shadow .18s ease, border-color .18s ease;
}
.a-dash__scenario:hover,
.a-dash-kpi:hover,
.a-kpi-summary-card:hover,
.a-analytics-summary:hover { transform: translateY(-2px); border-color: rgba(99,102,241,.24); box-shadow: 0 24px 42px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.82); }
.a-dash__scenario { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.a-dash__scenario-icon { width: 42px; height: 42px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #4338ca; background: rgba(99,102,241,.10); }
.a-dash__scenario-copy { display: grid; gap: 4px; }
.a-dash__scenario-copy strong { font-size: 14px; color: #0f172a; }
.a-dash__scenario-copy small { font-size: 12px; color: #64748b; }
.a-dash__scenario-value { font-size: 22px; font-weight: 900; color: #0f172a; }
.a-dash__scenario--incident .a-dash__scenario-icon { color: #dc2626; background: rgba(239,68,68,.10); }
.a-dash__scenario--pay .a-dash__scenario-icon { color: #b45309; background: rgba(245,158,11,.12); }
.a-dash-kpi,
.a-kpi-summary-card,
.a-analytics-summary { display: grid; gap: 5px; }
.a-dash-kpi__value,
.a-kpi-summary-card__value,
.a-analytics-summary__value { font-size: 24px; line-height: 1; color: #0f172a; }
.a-dash-kpi__sub,
.a-kpi-summary-card__sub,
.a-analytics-summary__sub { font-size: 12px; color: #64748b; line-height: 1.45; }
.a-dash-kpi--danger,
.a-kpi-summary-card--danger,
.a-analytics-summary--danger { background: linear-gradient(180deg, rgba(239,68,68,.10), rgba(255,255,255,.78)); }
.a-dash-kpi--warn,
.a-kpi-summary-card--warn,
.a-analytics-summary--warn { background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(255,255,255,.78)); }
.a-kpi-summary-card--brand,
.a-analytics-summary--brand { background: linear-gradient(180deg, rgba(99,102,241,.10), rgba(255,255,255,.78)); }
.a-dash__content-grid,
.a-kpi__workbench,
.a-analytics__chart-grid,
.a-analytics__leader-grid { display: grid; gap: 16px; }
.a-dash__content-grid { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .92fr); align-items: start; }
.a-kpi__workbench,
.a-analytics__chart-grid,
.a-analytics__leader-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
.a-dash-card,
.a-kpi-card,
.a-analytics-card { position: relative; padding: 18px; }
.a-dash-card__head,
.a-kpi-card__head,
.a-analytics-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.a-dash-card__title,
.a-kpi-card__title,
.a-analytics-card__title { font-size: 13px; color: #0f172a; }
.a-dash-card__sub,
.a-kpi-card__sub,
.a-analytics-card__sub { display: block; margin-top: 4px; font-size: 12px; line-height: 1.5; }
.a-dash-card__empty,
.a-analytics__empty,
.a-kpi__empty-row { color: #94a3b8; padding: 18px; text-align: center; }
.a-dash-table-wrap,
.a-kpi__table-wrap { overflow: auto; border-radius: 18px; }
.a-dash-table tbody tr,
.a-kpi__table tbody tr { cursor: pointer; }
.a-dash-table__link { appearance: none; border: none; background: none; padding: 0; font: inherit; color: #4338ca; font-weight: 800; cursor: pointer; }
.a-dash-inbox { display: grid; gap: 8px; }
.a-dash-inbox__item { appearance: none; width: 100%; text-align: left; border: 1px solid rgba(148,163,184,.14); background: rgba(248,250,252,.82); border-radius: 16px; padding: 12px 13px; cursor: pointer; transition: transform .16s cubic-bezier(.16,1,.3,1), border-color .16s ease; }
.a-dash-inbox__item:hover { transform: translateY(-1px); border-color: rgba(99,102,241,.22); }
.a-dash-inbox__item.is-unread { background: linear-gradient(180deg, rgba(59,130,246,.08), rgba(248,250,252,.92)); }
.a-dash-inbox__row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.a-dash-inbox__title { color: #0f172a; font-size: 13px; }
.a-dash-inbox__meta { color: #94a3b8; font-size: 11px; white-space: nowrap; }
.a-dash-inbox__summary { display: block; margin-top: 4px; font-size: 12px; line-height: 1.45; color: #64748b; }
.a-dash-card__footer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.a-kpi__actions,
.a-analytics__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.a-kpi__periods,
.a-analytics__periods { display: flex; gap: 4px; flex-wrap: wrap; }
.a-kpi__loading-grid,
.a-analytics__loading-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.a-kpi__loading-card,
.a-analytics__loading-card { height: 88px; border-radius: 12px; }
.a-kpi__loading-panel,
.a-analytics__loading-panel { height: 280px; border-radius: 14px; margin-top: 12px; }
.a-kpi__bar-list { display: grid; gap: 10px; margin-top: 10px; }
.a-kpi__bar-row,
.a-analytics__leader-row { display: grid; gap: 6px; }
.a-kpi__bar-row-top,
.a-analytics__leader-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #475569; }
.a-kpi__bar-row-top b,
.a-analytics__leader-row-top b { color: #0f172a; font-weight: 700; }
.a-kpi-bar,
.a-analytics__bar { height: 7px; border-radius: 999px; background: rgba(15,23,42,.06); overflow: hidden; }
.a-kpi-bar__fill,
.a-analytics__bar-fill { height: 100%; border-radius: 999px; }
.a-kpi-card--table .a-table thead th,
.a-dash-table thead th,
.a-orders__table thead th,
.a-order__items-table thead th,
.a-order__estimate-table thead th { position: sticky; top: 0; background: rgba(248,250,252,.94); backdrop-filter: blur(10px); z-index: 2; }
.a-kpi__table td.is-danger { color: #dc2626; font-weight: 700; }
.a-analytics__attention { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-radius: 20px; background: rgba(255,255,255,.70); border: 1px solid rgba(255,255,255,.76); box-shadow: 0 18px 30px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.8); }
.a-analytics__attention-label { font-size: 12px; font-weight: 800; color: #64748b; margin-right: 6px; }
.a-analytics__attention-danger { border-color: rgba(239,68,68,.26) !important; color: #dc2626 !important; }
.a-analytics__leaderboard { display: grid; gap: 10px; }
.a-analytics__leader-row { appearance: none; width: 100%; text-align: left; border: 1px solid rgba(148,163,184,.14); background: rgba(248,250,252,.84); border-radius: 16px; padding: 12px; cursor: pointer; transition: transform .16s cubic-bezier(.16,1,.3,1), border-color .16s ease; }
.a-analytics__leader-row:hover { transform: translateY(-1px); border-color: rgba(99,102,241,.22); }
.a-analytics__leader-row-top span { color: #64748b; }
.a-order__kpi,
.a-order__compare,
.a-order__info-main,
.a-order__info-aside,
.a-order__estimate-cols,
.a-order__compare-summary,
.a-order__exports,
.a-order__cut-map,
.a-order__items-wrap,
.a-order__estimate-wrap { background: rgba(255,255,255,.70); border: 1px solid rgba(255,255,255,.76); border-radius: 22px; backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); box-shadow: 0 22px 42px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.82); }
.a-order__head-actions .a-btn,
.a-order-tabs__tab,
.a-drawer,
.a-orders__preview,
.a-drawer__kv { box-shadow: 0 12px 24px rgba(15,23,42,.05); }
.a-order-tabs { background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.76); box-shadow: 0 16px 28px rgba(15,23,42,.06), inset 0 1px 0 rgba(255,255,255,.82); }
.a-orders__tablewrap,
.a-order__items-wrap,
.a-order__estimate-wrap { border-radius: 18px; }
.a-orders__table tbody tr:hover td,
.a-order__items-table tbody tr:hover td,
.a-order__estimate-table tbody tr:hover td,
.a-kpi__table tbody tr:hover td,
.a-dash-table tbody tr:hover td { background: rgba(99,102,241,.035); }
@media (max-width: 1180px) {
  .a-dash__hero,
  .a-dash__content-grid,
  .a-kpi__workbench,
  .a-analytics__chart-grid,
  .a-analytics__leader-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .a-dash__hero,
  .a-dash-card,
  .a-kpi-card,
  .a-analytics-card { padding: 16px; }
  .a-dash__scenario { grid-template-columns: auto 1fr; }
  .a-dash__scenario-value { grid-column: 2; justify-self: end; }
  .a-kpi__loading-grid,
  .a-analytics__loading-grid { grid-template-columns: 1fr 1fr; }
  .a-dash__sync,
  .a-dash__next { padding: 14px; }
}

/* --- R58 orders/detail table-first + AG Grid polish --- */
.a-orders__table-shell { min-height: 420px; }
.a-orders__grid-loading { padding: 18px; border-radius: 20px; background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.78); box-shadow: 0 18px 30px rgba(15,23,42,.06), inset 0 1px 0 rgba(255,255,255,.82); }
.a-orders-grid { border-radius: 20px; overflow: hidden; background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.78); box-shadow: 0 22px 40px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.82); }
.a-orders-grid .ag-header { background: rgba(248,250,252,.92); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(148,163,184,.16); }
.a-orders-grid .ag-header-cell-text { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.a-orders-grid .ag-cell { display: flex; align-items: center; font-size: 13px; color: #0f172a; }
.a-orders-grid .ag-row { border-bottom: 1px solid rgba(148,163,184,.10); }
.a-orders-grid .ag-row-hover .ag-cell { background: rgba(99,102,241,.04); }
.a-orders-grid .ag-row-selected .ag-cell { background: rgba(16,185,129,.08) !important; }
.a-orders-grid__row--preview .ag-cell { box-shadow: inset 0 1px 0 rgba(99,102,241,.08), inset 0 -1px 0 rgba(99,102,241,.08); }
.a-orders-grid__row--overdue .ag-cell:first-child { box-shadow: inset 3px 0 0 rgba(239,68,68,.72); }
.a-orders-grid__row--stale .ag-cell:first-child { box-shadow: inset 3px 0 0 rgba(245,158,11,.72); }
.a-orders-grid__code { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.a-orders-grid__code-text { font-family: ui-monospace,'SF Mono',monospace; font-weight: 700; font-size: 12px; color: var(--brand); letter-spacing: -.01em; }
.a-orders-grid__flag-dot { font-size: 10px; line-height: 1; }
.a-orders-grid__flag-dot--bad { color: #dc2626; }
.a-orders-grid__flag-dot--warn { color: #d97706; }
.a-orders-grid__client { font-weight: 600; color: #111827; }
.a-orders-grid__date { color: #475569; font-size: 12px; }
.a-orders-grid__age { color: #64748b; font-size: 12px; }
.a-orders-grid__flags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.a-orders-grid__flags-empty { color: #94a3b8; font-size: 12px; }
.a-order-tabs--sticky { position: sticky; top: 12px; z-index: 8; }
.a-order__items-sub { margin-top: 3px; color: #64748b; font-size: 12px; }
.a-order__items-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.a-order__items-summary-card { padding: 12px 14px; border-radius: 16px; background: rgba(248,250,252,.84); border: 1px solid rgba(148,163,184,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.a-order__items-summary-card span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.a-order__items-summary-card strong { display: block; margin-top: 6px; font-size: 20px; line-height: 1.1; color: #0f172a; }
.a-order__items-grid-shell { border-radius: 20px; overflow: hidden; background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.78); box-shadow: 0 22px 40px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.82); }
.a-order__items-grid .ag-header { background: rgba(248,250,252,.92); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(148,163,184,.16); }
.a-order__items-grid .ag-header-cell-text { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.a-order__items-grid .ag-cell { display: flex; align-items: center; font-size: 13px; color: #0f172a; }
.a-order__items-grid .ag-row-hover .ag-cell { background: rgba(99,102,241,.035); }
@media (max-width: 900px) {
  .a-order__items-summary { grid-template-columns: 1fr; }
}

/* R59 OrderDetail max workstation */
.a-order__items--workstation{display:flex;flex-direction:column;gap:14px}.a-order__items-head--sticky{position:sticky;top:0;z-index:5;padding:14px 16px;border-radius:22px;background:rgba(255,255,255,.78);border:1px solid rgba(255,255,255,.68);box-shadow:0 18px 42px rgba(15,23,42,.10);backdrop-filter:blur(22px) saturate(170%)}.a-order__items-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.a-order__items-summary--extended{grid-template-columns:repeat(auto-fit,minmax(126px,1fr));gap:10px}.a-order__items-validation{padding:12px 14px;border:1px solid rgba(245,158,11,.25);background:rgba(255,251,235,.86);color:#92400e;border-radius:16px;font-size:13px}.a-order__items-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px;border-radius:18px;background:rgba(248,250,252,.72);border:1px solid rgba(148,163,184,.16)}.a-order__items-search{min-width:280px;flex:1}.a-order__items-filter-count{font-size:12px;font-weight:800;color:#64748b;margin-left:auto}.a-order__items-bulk{display:flex;flex-direction:column;gap:10px}.a-order__items-bulk-title{font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:#64748b}.a-order__items-bulk-row{display:flex;align-items:end;gap:8px;flex-wrap:wrap}.a-order__items-bulk-row label{display:flex;flex-direction:column;gap:4px;min-width:110px}.a-order__items-bulk-row label span{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#64748b}.a-order__bulk-material{min-width:240px!important}.a-order__items-workbench{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:14px;align-items:start}.a-order__items-main{min-width:0;display:flex;flex-direction:column;gap:12px}.a-order__items-grid-shell{border-radius:20px;overflow:hidden;background:rgba(255,255,255,.72);border:1px solid rgba(148,163,184,.18);box-shadow:0 18px 42px rgba(15,23,42,.10)}.a-order__items-wrap--editable{border-radius:22px;border:1px solid rgba(148,163,184,.18);background:rgba(255,255,255,.82);box-shadow:0 18px 44px rgba(15,23,42,.10);overflow:auto}.a-order__items-table--editable{min-width:1380px}.a-order__items-table--editable thead th{position:sticky;top:0;z-index:2;background:rgba(248,250,252,.96);backdrop-filter:blur(14px)}.a-order__items-table--editable tbody tr{transition:background .16s ease,box-shadow .16s ease}.a-order__items-table--editable tbody tr:hover td{background:rgba(59,130,246,.035)}.a-order__items-table--editable tbody tr.is-selected td{background:rgba(59,130,246,.075)}.a-order__items-table--editable .a-input--sm{min-height:32px;font-size:12px;padding:6px 8px}.a-input--num{max-width:82px;text-align:right}.a-order__material-select{min-width:210px}.a-order__edge-select{min-width:66px}.a-order__items-row-actions{display:flex;align-items:center;gap:5px;white-space:nowrap}.a-btn--xs{height:28px;padding:0 8px;border-radius:9px;font-size:11px}.a-btn--danger{color:#b91c1c;border-color:rgba(239,68,68,.25);background:rgba(254,242,242,.82)}.a-order__item-inspector{position:sticky;top:92px;display:flex;flex-direction:column;gap:12px;border-radius:24px;background:rgba(255,255,255,.78);backdrop-filter:blur(22px) saturate(170%)}.a-order__item-inspector-title{font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:#64748b}.a-order__item-inspector-name{font-size:18px;font-weight:900;letter-spacing:-.02em;color:#0f172a}.a-order__item-inspector-grid{display:grid;grid-template-columns:96px minmax(0,1fr);gap:8px 12px;font-size:13px}.a-order__item-inspector-grid span{color:#64748b}.a-order__item-inspector-grid strong{color:#0f172a;font-weight:800;line-height:1.35}.a-order__item-note-card{padding:12px;border-radius:16px;background:rgba(241,245,249,.8);border:1px solid rgba(148,163,184,.14);font-size:13px;line-height:1.5;color:#334155}.a-pill--amber{background:rgba(245,158,11,.11);border:1px solid rgba(245,158,11,.24);color:#92400e}@media (max-width:1180px){.a-order__items-workbench{grid-template-columns:1fr}.a-order__item-inspector{position:relative;top:auto;order:-1}.a-order__items-head--sticky{position:relative;top:auto}}@media (max-width:760px){.a-order__items-head--sticky{align-items:stretch}.a-order__items-actions,.a-order__items-tools,.a-order__items-bulk-row{align-items:stretch}.a-order__items-actions .a-btn,.a-order__items-tools .a-input,.a-order__items-bulk-row .a-btn,.a-order__items-bulk-row label{width:100%;min-width:0}.a-order__items-filter-count{margin-left:0}.a-order__item-inspector-grid{grid-template-columns:1fr}}
