/*
  KLS / TRUCKEN Orders CRM Visual Override V3
  Scope: visual-only styling for the Orders screen and shared topbar.
  Connected after app.css to neutralize legacy Orders-specific visual layers.
*/

:root {
  --ops-bg-0: #0b1118;
  --ops-bg-1: #111a24;
  --ops-page: #e9eef5;
  --ops-page-2: #f3f6fa;
  --ops-panel: #ffffff;
  --ops-panel-soft: #f8fafc;
  --ops-ink: #101828;
  --ops-ink-2: #334155;
  --ops-muted: #64748b;
  --ops-faint: #94a3b8;
  --ops-line: #d9e2ec;
  --ops-line-soft: #e8edf3;
  --ops-line-strong: #c8d2df;
  --ops-blue: #1664d9;
  --ops-blue-hover: #0f55bd;
  --ops-blue-soft: #eaf2ff;
  --ops-green: #059669;
  --ops-red: #dc2626;
  --ops-red-soft: #fff1f2;
  --ops-shadow: 0 18px 44px -30px rgba(15, 23, 42, 0.45);
  --ops-shadow-soft: 0 8px 20px -18px rgba(15, 23, 42, 0.45);
  --ops-radius-xl: 18px;
  --ops-radius-lg: 14px;
  --ops-radius-md: 10px;
  --ops-ease: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#view-templates .orders-billing-menu {
  position: relative;
  display: inline-flex;
}

#view-templates .orders-billing-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 190px;
  padding: 8px;
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
}

#view-templates .orders-billing-menu__panel button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
  color: #102033;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

#view-templates .orders-billing-menu__panel button:hover {
  background: rgba(47, 123, 255, 0.1);
}

#view-templates .orders-billing-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#view-templates .orders-billing-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(31, 45, 61, 0.1);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.9);
}

#view-templates .orders-billing-list__item span,
#view-templates .orders-billing-list__amount span {
  display: block;
  margin-top: 2px;
  color: rgba(43, 58, 80, 0.62);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#view-templates .orders-billing-list__amount {
  text-align: right;
}

#view-templates .orders-billing-modal {
  position: static;
  top: auto;
  z-index: auto;
  display: block;
  margin: 0;
  padding: 0;
  overscroll-behavior: auto;
  background: transparent;
  backdrop-filter: none;
}

#view-templates .orders-billing-modal__card {
  width: 100%;
  max-height: none;
  overflow: visible;
  border: 1px solid rgba(31, 45, 61, 0.12);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.32);
}

#view-templates .orders-billing-modal__header,
#view-templates .orders-billing-modal__footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(31, 45, 61, 0.1);
}

#view-templates .orders-billing-modal__footer {
  border-top: 1px solid rgba(31, 45, 61, 0.1);
  border-bottom: 0;
}

#view-templates .orders-billing-modal__header h3 {
  margin: 0;
  font-size: 22px;
}

#view-templates .orders-billing-modal__header p {
  margin: 4px 0 0;
  color: rgba(43, 58, 80, 0.68);
}

#view-templates .orders-billing-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 22px 6px;
}

#view-templates .orders-billing-modal__grid label {
  display: grid;
  gap: 0;
  color: rgba(43, 58, 80, 0.72);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#view-templates .orders-billing-modal__wide {
  grid-column: 1 / -1;
}

#view-templates .orders-billing-modal__checkbox {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

#view-templates .orders-billing-preview {
  padding: 12px 22px 18px;
}

#view-templates .orders-billing-preview__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#view-templates .orders-billing-preview__summary div {
  padding: 12px;
  border: 1px solid rgba(47, 123, 255, 0.12);
  border-radius: 16px;
  background: rgba(47, 123, 255, 0.06);
}

#view-templates .orders-billing-preview__summary span {
  display: block;
  color: rgba(43, 58, 80, 0.62);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#view-templates .orders-billing-alert {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.26);
  border-radius: 16px;
  background: rgba(255, 247, 237, 0.9);
  color: #78350f;
}

#view-templates .orders-billing-alert.is-danger {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(254, 242, 242, 0.94);
  color: #7f1d1d;
}

#view-templates .orders-billing-alert ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

#view-templates .orders-billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

#view-templates .orders-billing-workspace {
  container-type: inline-size;
  display: grid;
  gap: 12px;
  min-width: 0;
}

#view-templates .orders-billing-readiness,
#view-templates .orders-billing-type-panel,
#view-templates .orders-billing-builder__card,
#view-templates .orders-billing-order-fields {
  border: 1px solid var(--orders-surface-line-soft, rgba(31, 45, 61, 0.1));
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.32);
}

#view-templates .orders-billing-readiness {
  display: grid;
  gap: 12px;
  padding: 14px;
}

#view-templates .orders-billing-readiness__header,
#view-templates .orders-billing-type-panel__header,
#view-templates .orders-billing-builder__header,
#view-templates .orders-billing-builder__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#view-templates .orders-billing-readiness__header h3,
#view-templates .orders-billing-type-panel__header h3,
#view-templates .orders-billing-builder__header h3 {
  margin: 0;
  color: #263f59;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
}

#view-templates .orders-billing-readiness__header p,
#view-templates .orders-billing-type-panel__header p,
#view-templates .orders-billing-builder__header p {
  margin: 3px 0 0;
  color: var(--orders-surface-muted, #637083);
  font-size: 12px;
  line-height: 1.35;
}

#view-templates .orders-billing-readiness__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#view-templates .orders-billing-readiness__card {
  display: grid;
  gap: 5px;
  min-height: 112px;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-left: 3px solid rgba(148, 163, 184, 0.78);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.88);
}

#view-templates .orders-billing-readiness__card.is-ready {
  border-left-color: var(--ops-green, #059669);
  background: rgba(236, 253, 245, 0.72);
}

#view-templates .orders-billing-readiness__card.is-warning,
#view-templates .orders-billing-readiness__card.is-pending {
  border-left-color: #d97706;
  background: rgba(255, 247, 237, 0.76);
}

#view-templates .orders-billing-readiness__card.is-danger {
  border-left-color: var(--ops-red, #dc2626);
  background: rgba(255, 241, 242, 0.78);
}

#view-templates .orders-billing-readiness__card > span,
#view-templates .orders-billing-type-card > span,
#view-templates .orders-billing-builder__section-head span {
  color: var(--orders-surface-muted, #637083);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

#view-templates .orders-billing-readiness__card strong,
#view-templates .orders-billing-type-card strong {
  color: #172a40;
  font-size: 13px;
  line-height: 1.2;
}

#view-templates .orders-billing-readiness__card small,
#view-templates .orders-billing-type-card small {
  color: #536276;
  font-size: 11px;
  line-height: 1.35;
}

#view-templates .orders-billing-workspace__grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(420px, 1.18fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

#view-templates .orders-billing-workspace.is-building .orders-billing-workspace__grid {
  grid-template-columns: 1fr;
}

#view-templates .orders-billing-doc-history,
#view-templates .orders-billing-create {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#view-templates .orders-billing-type-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

#view-templates .orders-billing-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#view-templates .orders-billing-type-card {
  display: grid;
  gap: 7px;
  min-height: 144px;
  padding: 14px;
  border: 1px solid rgba(38, 63, 89, 0.14);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 253, 0.98) 100%);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ops-ease, 150ms ease), box-shadow var(--ops-ease, 150ms ease), transform var(--ops-ease, 150ms ease);
}

#view-templates .orders-billing-type-card:hover:not(:disabled),
#view-templates .orders-billing-type-card.is-selected {
  border-color: rgba(22, 100, 217, 0.46);
  box-shadow: 0 14px 26px -22px rgba(22, 100, 217, 0.9);
  transform: translateY(-1px);
}

#view-templates .orders-billing-type-card:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

#view-templates .orders-billing-builder {
  min-width: 0;
}

#view-templates .orders-billing-builder__card {
  overflow: visible;
}

#view-templates .orders-billing-builder__header,
#view-templates .orders-billing-builder__footer {
  padding: 14px;
  border-bottom: 1px solid var(--orders-surface-line-soft, rgba(31, 45, 61, 0.1));
}

#view-templates .orders-billing-builder__footer {
  border-top: 1px solid var(--orders-surface-line-soft, rgba(31, 45, 61, 0.1));
  border-bottom: 0;
}

#view-templates .orders-billing-builder__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#view-templates .orders-billing-builder__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  gap: 12px;
  padding: 14px;
  align-items: start;
}

#view-templates .orders-billing-builder__main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#view-templates .orders-billing-builder__section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(38, 63, 89, 0.1);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.74);
}

#view-templates .orders-billing-builder__section-head {
  display: grid;
  gap: 2px;
}

#view-templates .orders-billing-builder__section-head h4 {
  margin: 0;
  color: #263f59;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

#view-templates .orders-billing-builder .orders-billing-modal__grid,
#view-templates .orders-billing-builder__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
}

#view-templates .orders-billing-builder .orders-billing-modal__grid label,
#view-templates .orders-billing-builder__grid label {
  gap: 4px;
}

#view-templates .orders-billing-builder__wide {
  grid-column: 1 / -1;
}

#view-templates .orders-billing-preview-summary {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(22, 100, 217, 0.14);
  border-radius: 12px;
  background: rgba(234, 242, 255, 0.62);
}

#view-templates .orders-billing-preview-summary .orders-billing-preview__summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#view-templates .orders-billing-order-fields {
  padding: 12px;
}

#view-templates .orders-billing-order-fields > summary {
  cursor: pointer;
  color: #263f59;
  font-size: 12px;
  font-weight: 850;
}

#view-templates .orders-billing-order-fields .orders-panel {
  margin-top: 12px;
  box-shadow: none;
}

#view-templates .orders-buyer-resolution {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(245, 158, 11, 0.26);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.9);
  color: #78350f;
}

#view-templates .orders-buyer-resolution__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#view-templates .orders-buyer-resolution__header span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

#view-templates .orders-buyer-resolution__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#view-templates .orders-buyer-resolution__card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(120, 53, 15, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

#view-templates .orders-buyer-resolution__card.is-selected {
  border-color: rgba(22, 100, 217, 0.42);
  background: rgba(234, 242, 255, 0.82);
  color: #1e3a5f;
}

#view-templates .orders-buyer-resolution__card span {
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

#view-templates .orders-buyer-resolution__card strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.25;
}

#view-templates .orders-buyer-resolution__card small {
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.35;
}

body[data-theme="dark"] #view-templates .orders-billing-menu__panel,
body[data-theme="dark"] #view-templates .orders-billing-modal__card {
  border-color: rgba(148, 163, 184, 0.22);
  background: #111c2a;
  color: #e8eef7;
}

body[data-theme="dark"] #view-templates .orders-billing-list__item,
body[data-theme="dark"] #view-templates .orders-billing-preview__summary div,
body[data-theme="dark"] #view-templates .orders-billing-readiness,
body[data-theme="dark"] #view-templates .orders-billing-type-panel,
body[data-theme="dark"] #view-templates .orders-billing-builder__card,
body[data-theme="dark"] #view-templates .orders-billing-order-fields {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(25, 40, 60, 0.88);
}

body[data-theme="dark"] #view-templates .orders-billing-readiness__header h3,
body[data-theme="dark"] #view-templates .orders-billing-type-panel__header h3,
body[data-theme="dark"] #view-templates .orders-billing-builder__header h3,
body[data-theme="dark"] #view-templates .orders-billing-builder__section-head h4,
body[data-theme="dark"] #view-templates .orders-billing-type-card strong,
body[data-theme="dark"] #view-templates .orders-billing-readiness__card strong {
  color: #e8eef7;
}

body[data-theme="dark"] #view-templates .orders-billing-readiness__card,
body[data-theme="dark"] #view-templates .orders-billing-type-card,
body[data-theme="dark"] #view-templates .orders-billing-builder__section,
body[data-theme="dark"] #view-templates .orders-billing-preview-summary,
body[data-theme="dark"] #view-templates .orders-buyer-resolution,
body[data-theme="dark"] #view-templates .orders-buyer-resolution__card {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.52);
}

@media (max-width: 720px) {
  #view-templates .orders-billing-modal {
    padding: 10px;
  }

  #view-templates .orders-billing-modal__grid,
  #view-templates .orders-billing-preview__summary,
  #view-templates .orders-billing-readiness__grid,
  #view-templates .orders-billing-workspace__grid,
  #view-templates .orders-billing-type-grid,
  #view-templates .orders-buyer-resolution__grid,
  #view-templates .orders-billing-builder__layout,
  #view-templates .orders-billing-builder .orders-billing-modal__grid,
  #view-templates .orders-billing-builder__grid {
    grid-template-columns: 1fr;
  }

  #view-templates .orders-billing-modal__header,
  #view-templates .orders-billing-modal__footer,
  #view-templates .orders-billing-readiness__header,
  #view-templates .orders-billing-builder__header,
  #view-templates .orders-billing-builder__footer {
    align-items: stretch;
    flex-direction: column;
  }

}

@container (max-width: 760px) {
  #view-templates .orders-billing-readiness__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-templates .orders-billing-workspace__grid,
  #view-templates .orders-billing-type-grid,
  #view-templates .orders-billing-builder__layout {
    grid-template-columns: 1fr;
  }

  #view-templates .orders-billing-type-card {
    min-height: 104px;
  }

  #view-templates .orders-billing-builder .orders-billing-modal__grid,
  #view-templates .orders-billing-builder__grid,
  #view-templates .orders-billing-preview-summary .orders-billing-preview__summary {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 520px) {
  #view-templates .orders-billing-readiness__grid {
    grid-template-columns: 1fr;
  }

  #view-templates .orders-billing-readiness__card {
    min-height: 0;
  }
}

/* Performance: keep the order card drawer on the compositor layer and avoid expensive full-screen blur while it slides. */
#view-templates .orders-drawer-backdrop,
#view-templates .orders-modal__backdrop {
  backdrop-filter: none !important;
}

#view-templates .orders-drawer {
  transform: translate3d(calc(100% + 24px), 0, 0) !important;
  transition: transform 0.2s cubic-bezier(0.2, 0.72, 0.22, 1) !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  contain: layout paint style !important;
}

#view-templates .orders-crm.is-detail-open .orders-drawer {
  transform: translate3d(0, 0, 0) !important;
}

#view-templates .orders-detail__inner--opening .orders-detail__header {
  contain: layout paint !important;
}

#view-templates .orders-detail-opening {
  content-visibility: auto;
  contain-intrinsic-size: 260px;
}

/* Native drawer scrolling: keep browser wheel physics, but reduce offscreen paint work inside the long order card. */
#view-templates .orders-detail {
  scroll-behavior: auto !important;
  overscroll-behavior: contain !important;
  contain: layout !important;
  overflow-y: auto !important;
  min-height: 0 !important;
  will-change: scroll-position !important;
}

#view-templates .orders-detail__inner {
  transform: translateZ(0);
  min-height: 100% !important;
  padding-bottom: max(72px, calc(72px + env(safe-area-inset-bottom, 0px))) !important;
}

#view-templates .orders-detail .orders-panel {
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 220px;
}

#view-templates .orders-detail .orders-previewbox,
#view-templates .orders-detail .orders-documents {
  content-visibility: auto;
  contain-intrinsic-size: 180px;
}

#view-templates .orders-detail .orders-panel:last-child,
#view-templates .orders-detail .orders-panel--driver,
#view-templates .orders-detail .orders-panel--billing,
#view-templates .orders-detail .orders-billing-modal__card,
#view-templates .orders-detail .orders-billing-builder__card {
  content-visibility: visible !important;
  contain: none !important;
}

#view-templates .orders-detail__inner::after {
  content: "";
  display: block;
  flex: 0 0 max(32px, env(safe-area-inset-bottom, 0px));
}

html,
body {
  background: var(--ops-bg-0);
}

body {
  color: var(--ops-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.topbar {
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #111a24 0%, #0d141c 100%) !important;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.04), 0 16px 34px -30px rgba(0,0,0,0.9);
}

.topbar__brand {
  color: #f8fafc !important;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.topbar__brand-subtitle {
  color: #93a4b8 !important;
}

.topbar__module-nav {
  padding: 3px;
  gap: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045) !important;
}

.topbar-nav-button {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent !important;
  color: #a8b3c2 !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  transition: color var(--ops-ease), background var(--ops-ease), border-color var(--ops-ease);
}

.topbar-nav-button:hover {
  color: #f8fafc !important;
  background: rgba(255,255,255,0.07) !important;
}

.topbar-nav-button.is-active {
  color: #ffffff !important;
  border-color: rgba(120, 174, 255, 0.36);
  background: linear-gradient(180deg, #2b7cf1 0%, #1b68da 100%) !important;
  box-shadow: 0 8px 18px -14px rgba(27, 104, 218, 0.74);
}

.pill-button--avatar-only {
  border: 1px solid rgba(255,255,255,0.1) !important;
  background: rgba(255,255,255,0.06) !important;
}

.pill-button--avatar-only .avatar {
  background: #dbeafe !important;
  color: #123e88 !important;
  font-weight: 800;
}

#view-templates.orders-view {
  background: var(--ops-page) !important;
}

#view-templates .orders-crm {
  height: 100%;
  min-height: calc(100dvh - 70px);
  padding: 14px 16px 16px;
  background:
    radial-gradient(900px 420px at 50% -280px, rgba(22,100,217,0.18), rgba(22,100,217,0) 62%),
    linear-gradient(180deg, #edf2f7 0%, #e9eef5 100%) !important;
  color: var(--ops-ink);
  gap: 0;
}

#view-templates .orders-board {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--ops-radius-xl);
  border: 1px solid var(--ops-line-strong);
  background: var(--ops-panel);
  box-shadow: var(--ops-shadow);
}

#view-templates .orders-board,
body[data-theme="dark"] #view-templates .orders-board {
  background: var(--ops-panel) !important;
}

#view-templates .orders-board__toolbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 420px) minmax(320px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid #456587;
  background: linear-gradient(180deg, #304a67 0%, #263f59 100%);
  color: #f8fafc;
}

#view-templates .orders-board__titlewrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#view-templates .orders-board__titleline {
  display: flex;
  align-items: center;
  gap: 8px;
}

#view-templates .orders-board__title {
  margin: 0;
  font-family: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: clamp(24px, 2vw, 30px);
  line-height: 1;
  font-style: normal !important;
  font-weight: 850;
  letter-spacing: -0.045em;
  text-transform: none;
  color: #ffffff !important;
}

#view-templates .orders-board__year-select {
  min-width: 92px;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(205, 225, 248, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #f8fbff;
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
  cursor: pointer;
  outline: none;
}

#view-templates .orders-board__year-select:focus {
  border-color: rgba(147, 197, 253, 0.9);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.24);
}

#view-templates .orders-board__subtitle {
  margin: 0;
  color: #c1d2e7 !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#view-templates .panel-help {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #aab6c5;
  font-weight: 800;
}

#view-templates .orders-board__searchslot {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-templates .orders-filter--search {
  width: min(100%, 420px);
  min-width: 260px;
  max-width: 420px;
}

#view-templates .orders-filter__label {
  display: none !important;
}

#view-templates .orders-filter__input {
  width: 100%;
  min-height: 38px;
  padding: 9px 14px 9px 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.11) !important;
  background-color: rgba(255,255,255,0.94) !important;
  color: #111827 !important;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none !important;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 13px center;
}

#view-templates .orders-filter__input:focus {
  border-color: rgba(96,165,250,0.65) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18) !important;
}

#view-templates .orders-board__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#view-templates .orders-board__actions .ghost-button,
#view-templates .orders-board__actions .primary {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform var(--ops-ease), background var(--ops-ease), border-color var(--ops-ease), color var(--ops-ease), box-shadow var(--ops-ease);
}

#view-templates .orders-board__actions .ghost-button {
  border: 1px solid rgba(205, 225, 248, 0.2) !important;
  background: rgba(255,255,255,0.09) !important;
  color: #eef5ff !important;
  box-shadow: none !important;
}

#view-templates .orders-board__actions .ghost-button:hover {
  background: rgba(255,255,255,0.14) !important;
  border-color: rgba(225, 238, 255, 0.3) !important;
  color: #ffffff !important;
}

#view-templates .orders-board__actions .primary {
  border: 1px solid rgba(142, 194, 255, 0.42) !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 22px -16px rgba(43, 118, 233, 0.72);
}

#view-templates .orders-board__actions .ghost-button:active,
#view-templates .orders-board__actions .primary:active {
  transform: translateY(1px);
}

#view-templates .orders-machine-tabs {
  flex-shrink: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ops-line);
  background: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}

#view-templates .orders-machine-tabs__scroller {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

#view-templates .orders-machine-card,
#view-templates .orders-machine-tab-action {
  min-width: 122px;
  min-height: 54px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--ops-line) !important;
  background: #ffffff !important;
  color: var(--ops-ink-2) !important;
  box-shadow: var(--ops-shadow-soft);
  gap: 5px;
}

#view-templates .orders-machine-card:hover,
#view-templates .orders-machine-tab-action:hover {
  transform: translateY(-1px);
  border-color: #b6c5d8 !important;
  background: #ffffff !important;
}

#view-templates .orders-machine-card.is-active {
  border-color: #acc7ee !important;
  background: linear-gradient(180deg, #edf4ff 0%, #dde9fb 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(68, 121, 214, 0.14), 0 8px 16px -14px rgba(53, 91, 158, 0.46);
  color: #1f4f93 !important;
}

#view-templates .orders-machine-card__top {
  gap: 8px;
}

#view-templates .orders-machine-card__plate {
  font-size: 14px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.02em;
}

#view-templates .orders-machine-card__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  font-size: 12px;
}

#view-templates .orders-machine-card__count {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #edf2f7 !important;
  color: #475569 !important;
  font-size: 10px;
  font-weight: 850;
}

#view-templates .orders-machine-card.is-active .orders-machine-card__count {
  background: rgba(35, 98, 196, 0.12) !important;
  color: #1f4f93 !important;
}

#view-templates .orders-machine-card__status {
  font-size: 9px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ops-muted) !important;
}

#view-templates .orders-machine-card__status--route {
  color: var(--ops-green) !important;
}

#view-templates .orders-machine-card.is-active .orders-machine-card__status {
  color: rgba(31, 79, 147, 0.74) !important;
}

#view-templates .orders-machine-card--create,
#view-templates .orders-machine-tab-action {
  min-width: 86px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #475569 !important;
}

#view-templates .orders-machine-tab-action--danger {
  border-color: #fecdd3 !important;
  background: var(--ops-red-soft) !important;
  color: var(--ops-red) !important;
}

#view-templates .orders-notice {
  flex-shrink: 0;
}

#view-templates .orders-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-top: none !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 55px, rgba(217,226,236,0.72) 55px, rgba(217,226,236,0.72) 56px) !important;
}

#view-templates .orders-table {
  width: 100%;
  min-width: 1220px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: transparent !important;
  font-size: 13px;
}

#view-templates .orders-table__label-row .orders-table__head,
#view-templates .orders-table__head {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid var(--ops-line-strong) !important;
  border-right: 1px solid var(--ops-line) !important;
  background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%) !important;
  color: #526174 !important;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

#view-templates .orders-table__head:first-child {
  border-left: none;
}

#view-templates .orders-table__cell {
  height: 56px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ops-line-soft) !important;
  border-right: 1px solid var(--ops-line-soft) !important;
  background: transparent !important;
  color: var(--ops-ink-2) !important;
  vertical-align: middle;
}

#view-templates .orders-table__cell:last-child,
#view-templates .orders-table__head:last-child {
  border-right: none !important;
}

#view-templates .orders-table__row {
  background: #ffffff !important;
  transition: background var(--ops-ease), box-shadow var(--ops-ease);
}

#view-templates .orders-table__row:nth-child(even) {
  background: #fbfdff !important;
}

#view-templates .orders-table__row:hover {
  background: #f1f7ff !important;
}

#view-templates .orders-table__row.is-selected {
  background: #eaf2ff !important;
  box-shadow: inset 4px 0 0 var(--ops-blue) !important;
}

#view-templates .orders-table__row.has-route-group {
  background: hsl(var(--route-hue, 152) 84% 97%) !important;
}

#view-templates .orders-table__row.has-route-group:hover {
  background: hsl(var(--route-hue, 152) 78% 95%) !important;
}

#view-templates .orders-table__row.has-route-group.is-selected {
  background: hsl(var(--route-hue, 152) 72% 93%) !important;
  box-shadow: inset 4px 0 0 hsl(var(--route-hue, 152) 68% 42%) !important;
}

#view-templates .orders-table__order-num {
  color: #0f172a !important;
  font-size: 14px;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.015em;
}

#view-templates .orders-table__order-sub,
#view-templates .orders-table__party-meta,
#view-templates .orders-table__date-sub,
#view-templates .orders-table__location-meta,
#view-templates .orders-route-summary__meta {
  color: #7d8b9e !important;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#view-templates .orders-table__date-main,
#view-templates .orders-table__location-place,
#view-templates .orders-table__party-name,
#view-templates .orders-route-summary__place {
  color: #172033 !important;
  font-weight: 750;
}

#view-templates .orders-table__date {
  color: #172033 !important;
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 0.01em;
}

#view-templates .orders-table__location-place,
#view-templates .orders-route-summary__place {
  font-size: 14px;
}

#view-templates .orders-table__party-name {
  font-size: 13px;
}

#view-templates .orders-table__money {
  color: #0f172a !important;
  font-size: 15px;
  font-weight: 850;
}

#view-templates .orders-table__km {
  color: #0f172a !important;
  font-size: 14px;
  font-weight: 850;
}

#view-templates .orders-table__payment-term,
#view-templates .orders-table__doc-chip,
#view-templates .orders-table__truck-card,
#view-templates .orders-table__link--map {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--ops-line) !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 11px;
  font-weight: 800;
  box-shadow: none !important;
}

#view-templates .orders-table__truck-card {
  background: var(--ops-blue-soft) !important;
  border-color: #cfe0ff !important;
  color: #1356bf !important;
}

#view-templates .orders-table__link--map:hover {
  border-color: #b7cdf5 !important;
  background: #f8fbff !important;
  color: var(--ops-blue-hover) !important;
}

#view-templates .orders-table__row-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--ops-line) !important;
  background: #ffffff !important;
  color: #64748b !important;
}

#view-templates .orders-table__row-action:hover {
  color: var(--ops-blue-hover) !important;
  border-color: #b7cdf5 !important;
  background: #f8fbff !important;
}

#view-templates .orders-route-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

#view-templates .orders-route-summary__point {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#view-templates .orders-route-summary__point--end {
  text-align: right;
}

#view-templates .orders-route-summary__meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

#view-templates .orders-route-summary__point--end .orders-route-summary__meta {
  justify-content: flex-end;
}

#view-templates .orders-flag-badge {
  width: 16px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(100, 98, 92, 0.12), 0 0 0 1px rgba(255,255,255,0.55);
  background: linear-gradient(180deg, #d7d1c8 0%, #c8c2b9 100%);
  flex-shrink: 0;
}

#view-templates .orders-flag-badge[data-country="PL"] { background: linear-gradient(180deg, #ffffff 0 50%, #d7344a 50% 100%); }
#view-templates .orders-flag-badge[data-country="DE"] { background: linear-gradient(180deg, #1d1d1d 0 33%, #bf2f3a 33% 66%, #d0a533 66% 100%); }
#view-templates .orders-flag-badge[data-country="FR"] { background: linear-gradient(90deg, #335ecf 0 33%, #ffffff 33% 66%, #db3f53 66% 100%); }
#view-templates .orders-flag-badge[data-country="IT"] { background: linear-gradient(90deg, #2f9d61 0 33%, #ffffff 33% 66%, #d6454f 66% 100%); }
#view-templates .orders-flag-badge[data-country="ES"] { background: linear-gradient(180deg, #c6353a 0 24%, #e2c04f 24% 76%, #c6353a 76% 100%); }
#view-templates .orders-flag-badge[data-country="PT"] { background: linear-gradient(90deg, #1f7d57 0 40%, #d1474e 40% 100%); }
#view-templates .orders-flag-badge[data-country="RO"] { background: linear-gradient(90deg, #245ec4 0 33%, #e0c04f 33% 66%, #d44951 66% 100%); }
#view-templates .orders-flag-badge[data-country="HU"] { background: linear-gradient(180deg, #c94b53 0 33%, #ffffff 33% 66%, #2f9a61 66% 100%); }
#view-templates .orders-flag-badge[data-country="GR"] { background: repeating-linear-gradient(180deg, #2f67c8 0 14%, #ffffff 14% 28%); }
#view-templates .orders-flag-badge[data-country="SE"] { background: linear-gradient(90deg, #2a66bc 0 100%); box-shadow: inset 0 0 0 999px rgba(214, 184, 70, 0), inset 5px 0 0 0 rgba(214,184,70,0.95), inset 0 4px 0 0 rgba(214,184,70,0.95); }
#view-templates .orders-flag-badge[data-country="DK"] { background: linear-gradient(90deg, #c63f4c 0 100%); box-shadow: inset 5px 0 0 0 rgba(255,255,255,0.95), inset 0 4px 0 0 rgba(255,255,255,0.95); }
#view-templates .orders-flag-badge[data-country="FI"] { background: linear-gradient(90deg, #ffffff 0 100%); box-shadow: inset 5px 0 0 0 rgba(51,100,195,0.95), inset 0 4px 0 0 rgba(51,100,195,0.95), inset 0 0 0 1px rgba(100,98,92,0.12), 0 0 0 1px rgba(255,255,255,0.55); }
#view-templates .orders-flag-badge[data-country="IE"] { background: linear-gradient(90deg, #2e9c62 0 33%, #ffffff 33% 66%, #d18d40 66% 100%); }
#view-templates .orders-flag-badge[data-country="BG"] { background: linear-gradient(180deg, #ffffff 0 33%, #2f9860 33% 66%, #c94850 66% 100%); }
#view-templates .orders-flag-badge[data-country="HR"] { background: linear-gradient(180deg, #c94950 0 33%, #ffffff 33% 66%, #3167c6 66% 100%); }
#view-templates .orders-flag-badge[data-country="SI"] { background: linear-gradient(180deg, #ffffff 0 33%, #3369c8 33% 66%, #d14a50 66% 100%); }
#view-templates .orders-flag-badge[data-country="LV"] { background: linear-gradient(180deg, #91404c 0 42%, #ffffff 42% 58%, #91404c 58% 100%); }
#view-templates .orders-flag-badge[data-country="EE"] { background: linear-gradient(180deg, #4b8fc8 0 33%, #1b1b1b 33% 66%, #ffffff 66% 100%); }
#view-templates .orders-flag-badge[data-country="LU"] { background: linear-gradient(180deg, #dc5960 0 33%, #ffffff 33% 66%, #63b4df 66% 100%); }
#view-templates .orders-flag-badge[data-country="CY"] { background: linear-gradient(180deg, #ffffff 0 100%); }
#view-templates .orders-flag-badge[data-country="MT"] { background: linear-gradient(90deg, #ffffff 0 50%, #d54b54 50% 100%); }
#view-templates .orders-flag-badge[data-country="NL"] { background: linear-gradient(180deg, #c94a52 0 33%, #ffffff 33% 66%, #356cc6 66% 100%); }
#view-templates .orders-flag-badge[data-country="BE"] { background: linear-gradient(90deg, #1f1f1f 0 33%, #e0b930 33% 66%, #d94c50 66% 100%); }
#view-templates .orders-flag-badge[data-country="AT"] { background: linear-gradient(180deg, #d54755 0 33%, #ffffff 33% 66%, #d54755 66% 100%); }
#view-templates .orders-flag-badge[data-country="LT"] { background: linear-gradient(180deg, #d5bc45 0 33%, #3a9b61 33% 66%, #c74953 66% 100%); }
#view-templates .orders-flag-badge[data-country="SK"] { background: linear-gradient(180deg, #ffffff 0 33%, #4069c8 33% 66%, #d64957 66% 100%); }
#view-templates .orders-flag-badge[data-country="CZ"] { background: linear-gradient(180deg, #ffffff 0 50%, #d84b55 50% 100%); }

#view-templates .orders-table__route-rail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 52px;
}

#view-templates .orders-table__route-rail-arrow {
  color: #7c7467;
  font-size: 12px;
  font-weight: 800;
}

#view-templates .orders-empty {
  border-top: 1px solid var(--ops-line);
  background: #ffffff;
}

#view-templates .orders-pagination {
  flex-shrink: 0;
  border-top: 1px solid var(--ops-line);
  background: #f8fafc;
}

#view-templates .orders-selection-summary {
  border: 1px solid var(--ops-line-strong) !important;
  border-radius: 12px;
  background: rgba(255,255,255,0.96) !important;
  box-shadow: 0 12px 28px -20px rgba(15,23,42,0.35) !important;
}

@media (max-width: 1180px) {
  #view-templates .orders-board__toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  #view-templates .orders-board__searchslot {
    justify-content: stretch;
  }

  #view-templates .orders-filter--search {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 760px) {
  #view-templates .orders-crm {
    padding: 8px;
  }

  #view-templates .orders-board {
    border-radius: 14px;
  }

  #view-templates .orders-board__toolbar {
    padding: 14px;
  }

  #view-templates .orders-board__actions {
    width: 100%;
    flex-wrap: wrap;
  }

  #view-templates .orders-board__actions .ghost-button,
  #view-templates .orders-board__actions .primary {
    flex: 1 1 160px;
  }
}

body[data-orders-palette-preview="slate"] .topbar-nav-button.is-active {
  border-color: rgba(129, 169, 228, 0.34);
  background: linear-gradient(180deg, #315b90 0%, #274b78 100%) !important;
  box-shadow: 0 8px 18px -14px rgba(39, 75, 120, 0.88);
}

body[data-orders-palette-preview="slate"] #view-templates .orders-board__toolbar {
  border-bottom-color: #233447;
  background: linear-gradient(180deg, #203142 0%, #172635 100%);
}

body[data-orders-palette-preview="slate"] #view-templates .orders-board__title {
  color: #f7fbff !important;
}

body[data-orders-palette-preview="slate"] #view-templates .orders-board__subtitle {
  color: #a9bfd6 !important;
}

body[data-orders-palette-preview="slate"] #view-templates .orders-board__actions .ghost-button {
  border-color: rgba(177, 201, 231, 0.16) !important;
  background: rgba(255,255,255,0.065) !important;
  color: #dbe8f5 !important;
}

body[data-orders-palette-preview="slate"] #view-templates .orders-board__actions .primary {
  border-color: rgba(129, 169, 228, 0.36) !important;
  background: linear-gradient(180deg, #315b90 0%, #274b78 100%) !important;
  box-shadow: 0 12px 22px -16px rgba(39, 75, 120, 0.88);
}

body[data-orders-palette-preview="slate"] #view-templates .orders-machine-card.is-active {
  border-color: #31465e !important;
  background: linear-gradient(180deg, #2b3d52 0%, #243447 100%) !important;
  box-shadow: 0 12px 24px -18px rgba(26, 39, 54, 0.85);
}

body[data-orders-palette-preview="soft"] .topbar-nav-button.is-active {
  border-color: rgba(120, 174, 255, 0.36);
  background: linear-gradient(180deg, #2b7cf1 0%, #1b68da 100%) !important;
  box-shadow: 0 8px 18px -14px rgba(27, 104, 218, 0.74);
}

body[data-orders-palette-preview="soft"] #view-templates .orders-board__toolbar {
  border-bottom-color: #456587;
  background: linear-gradient(180deg, #304a67 0%, #263f59 100%);
}

body[data-orders-palette-preview="soft"] #view-templates .orders-board__title {
  color: #f8fbff !important;
}

body[data-orders-palette-preview="soft"] #view-templates .orders-board__subtitle {
  color: #c1d2e7 !important;
}

body[data-orders-palette-preview="soft"] #view-templates .orders-board__actions .ghost-button {
  border-color: rgba(205, 225, 248, 0.2) !important;
  background: rgba(255,255,255,0.09) !important;
  color: #eef5ff !important;
}

body[data-orders-palette-preview="soft"] #view-templates .orders-board__actions .primary {
  border-color: rgba(142, 194, 255, 0.42) !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  box-shadow: 0 12px 22px -16px rgba(43, 118, 233, 0.72);
}

body[data-orders-palette-preview="soft"] #view-templates .orders-machine-card.is-active {
  border-color: #acc7ee !important;
  background: linear-gradient(180deg, #edf4ff 0%, #dde9fb 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(68, 121, 214, 0.14), 0 8px 16px -14px rgba(53, 91, 158, 0.46);
  color: #1f4f93 !important;
}

body[data-orders-palette-preview="soft"] #view-templates .orders-machine-card.is-active .orders-machine-card__count {
  background: rgba(35, 98, 196, 0.12) !important;
  color: #1f4f93 !important;
}

body[data-orders-palette-preview="soft"] #view-templates .orders-machine-card.is-active .orders-machine-card__status {
  color: rgba(31, 79, 147, 0.74) !important;
}

.orders-palette-preview {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px -22px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(14px);
}

.orders-palette-preview__title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}

.orders-palette-preview__actions {
  display: flex;
  gap: 0;
}

.orders-palette-preview__btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid #d9e2ec;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  transition: background var(--ops-ease), border-color var(--ops-ease), color var(--ops-ease), transform var(--ops-ease);
}

.orders-palette-preview__btn:hover {
  border-color: #afc7ea;
  color: #1859c2;
  background: #f8fbff;
}

.orders-palette-preview__btn.is-active {
  border-color: rgba(22, 100, 217, 0.42);
  background: #eaf2ff;
  color: #0f55bd;
}

/* Orders connected surfaces: drawer, route builder, modals */
#view-templates {
  --orders-surface-bg: #eef3f8;
  --orders-surface-panel: #ffffff;
  --orders-surface-panel-soft: #f7fafc;
  --orders-surface-rail: #edf4ff;
  --orders-surface-line: #cfdae7;
  --orders-surface-line-soft: #e3eaf2;
  --orders-surface-ink: #101828;
  --orders-surface-muted: #637083;
  --orders-surface-header: linear-gradient(180deg, #304a67 0%, #263f59 100%);
  --orders-surface-header-line: #456587;
  --orders-surface-blue: #2b76e9;
  --orders-surface-blue-soft: #eaf2ff;
  --orders-surface-green: #0b9f70;
  --orders-surface-shadow: 0 22px 54px -34px rgba(15, 23, 42, 0.48);
}

#view-templates .orders-drawer-backdrop,
#view-templates .orders-modal__backdrop {
  background: rgba(17, 26, 36, 0.42) !important;
  backdrop-filter: blur(5px);
}

#view-templates .orders-drawer,
#view-templates .orders-route-drawer,
#view-templates .orders-modal__card,
#view-templates .orders-screen-preview__surface {
  border-color: var(--orders-surface-line) !important;
  background:
    radial-gradient(720px 280px at 50% -180px, rgba(43, 118, 233, 0.13), rgba(43, 118, 233, 0) 62%),
    linear-gradient(180deg, #f8fbff 0%, var(--orders-surface-bg) 100%) !important;
  color: var(--orders-surface-ink) !important;
  box-shadow: var(--orders-surface-shadow) !important;
}

#view-templates .orders-drawer {
  top: 10px !important;
  right: 10px !important;
  bottom: 10px !important;
  border-radius: 18px !important;
}

#view-templates .orders-detail__inner {
  gap: 12px !important;
  padding: 14px !important;
  padding-bottom: max(72px, calc(72px + env(safe-area-inset-bottom, 0px))) !important;
}

#view-templates .orders-detail__header,
#view-templates .orders-route-drawer__header {
  padding: 15px 16px !important;
  border: 1px solid var(--orders-surface-header-line) !important;
  border-radius: 14px !important;
  background: var(--orders-surface-header) !important;
  color: #f8fbff !important;
  box-shadow: 0 12px 26px -22px rgba(15, 23, 42, 0.55);
}

#view-templates .orders-route-drawer__header {
  margin: 0 0 2px !important;
}

#view-templates .orders-detail__header h2,
#view-templates .orders-route-drawer__header h3,
#view-templates .orders-modal__title {
  color: inherit !important;
  font-family: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-style: normal !important;
  letter-spacing: -0.035em !important;
}

#view-templates .orders-detail__header h2,
#view-templates .orders-route-drawer__header h3 {
  font-size: 21px !important;
  font-weight: 850 !important;
}

#view-templates .orders-detail__header p,
#view-templates .orders-route-drawer__desc {
  color: #c1d2e7 !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

#view-templates .orders-detail__actions,
#view-templates .orders-route-drawer__actions {
  gap: 8px !important;
}

#view-templates .orders-detail__meta {
  min-height: 24px;
  gap: 8px;
}

#view-templates .orders-detail-tabs {
  position: sticky !important;
  top: -14px !important;
  z-index: 35 !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 8px !important;
  border: 1px solid rgba(169, 186, 207, 0.42) !important;
  border-radius: 14px !important;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(238, 245, 253, 0.96)) !important;
  box-shadow: 0 14px 28px -26px rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
}

#view-templates .orders-detail-tabs__button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 0 10px !important;
  border: 1px solid rgba(169, 186, 207, 0.7) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #31506f !important;
  font: inherit !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  letter-spacing: -0.01em !important;
  cursor: pointer !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: background var(--ops-ease), border-color var(--ops-ease), color var(--ops-ease), transform var(--ops-ease);
}

#view-templates .orders-detail-tabs__button span {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#view-templates .orders-detail-tabs__button strong {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 999px !important;
  background: rgba(49, 91, 144, 0.12) !important;
  color: inherit !important;
  font-size: 10px !important;
  font-weight: 900 !important;
}

#view-templates .orders-detail-tabs__button:hover {
  border-color: rgba(43, 118, 233, 0.46) !important;
  background: #f4f8ff !important;
  color: #1859c2 !important;
}

#view-templates .orders-detail-tabs__button.is-active {
  border-color: rgba(21, 60, 99, 0.22) !important;
  background: linear-gradient(180deg, #315b90 0%, #24476f 100%) !important;
  color: #f8fbff !important;
  box-shadow: 0 10px 20px -16px rgba(15, 23, 42, 0.62);
}

#view-templates .orders-detail-tabs__button.is-active strong {
  background: rgba(255, 255, 255, 0.18) !important;
}

#view-templates .orders-detail-section-stack,
#view-templates .orders-detail-section {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  min-width: 0 !important;
}

#view-templates .orders-detail-section[hidden] {
  display: none !important;
}

#view-templates .orders-detail-section__intro {
  display: flex !important;
  align-items: baseline !important;
  gap: 8px !important;
  min-width: 0 !important;
  padding: 0 2px !important;
}

#view-templates .orders-detail-section__intro span {
  color: #263f59 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

#view-templates .orders-detail-section__intro p {
  min-width: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: var(--orders-surface-muted) !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#view-templates .orders-detail__meta .orders-muted,
#view-templates .orders-muted {
  color: var(--orders-surface-muted) !important;
}

#view-templates .orders-panel,
#view-templates .orders-route-setup,
#view-templates .orders-route-section,
#view-templates .orders-route-result,
#view-templates .orders-previewbox__stage,
#view-templates .orders-screen-preview__body,
#view-templates .orders-truckline__panel {
  border: 1px solid var(--orders-surface-line-soft) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 10px 22px -20px rgba(15, 23, 42, 0.32);
}

#view-templates .orders-panel {
  gap: 12px !important;
  padding: 14px !important;
}

#view-templates .orders-panel__header {
  min-height: 26px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--orders-surface-line-soft);
}

#view-templates .orders-panel__header h3,
#view-templates .orders-route-section__title {
  color: #263f59 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
  letter-spacing: -0.01em;
}

#view-templates .orders-form {
  gap: 10px !important;
}

#view-templates .orders-form__field {
  gap: 0 !important;
}

#view-templates .orders-form__label,
#view-templates .orders-form__checkbox-label,
#view-templates .orders-route-setup__label {
  color: #78869a !important;
  font-size: 10px !important;
  font-weight: 850 !important;
  letter-spacing: 0.09em !important;
}

#view-templates .orders-form__input,
#view-templates .orders-route-setup__field input,
#view-templates .orders-route-setup__field select,
#view-templates .orders-form__readonly,
#view-templates .orders-route-setup__fixed,
#view-templates .orders-truckline,
#view-templates .orders-modal__input-wrap input {
  min-height: 36px !important;
  border-color: var(--orders-surface-line) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: var(--orders-surface-ink) !important;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

#view-templates .orders-form__input:focus,
#view-templates .orders-route-setup__field input:focus,
#view-templates .orders-route-setup__field select:focus,
#view-templates .orders-modal__input-wrap input:focus {
  border-color: rgba(43, 118, 233, 0.58) !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.13) !important;
}

#view-templates .orders-form__textarea {
  min-height: 78px !important;
}

#view-templates .orders-form__field--checkbox {
  min-height: 38px !important;
  border-color: var(--orders-surface-line-soft) !important;
  background: var(--orders-surface-panel-soft) !important;
}

#view-templates .orders-truckline {
  padding: 10px 12px !important;
}

#view-templates .orders-truckline.is-open,
#view-templates .orders-truckline:hover {
  border-color: rgba(43, 118, 233, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.1) !important;
}

#view-templates .orders-truckline__value {
  color: #1c324a !important;
}

#view-templates .orders-truckline__meta,
#view-templates .orders-truckline__mark,
#view-templates .orders-form__map-placeholder,
#view-templates .orders-previewbox__info p,
#view-templates .orders-screen-preview__header p,
#view-templates .orders-route-setup__hint,
#view-templates .orders-route-section__hint,
#view-templates .orders-route-section__empty,
#view-templates .orders-route-avail__body span,
#view-templates .orders-route-item__addr,
#view-templates .orders-route-item__addr-full,
#view-templates .orders-route-result__hint {
  color: var(--orders-surface-muted) !important;
}

#view-templates .orders-detail .ghost-button,
#view-templates .orders-route-drawer .ghost-button,
#view-templates .orders-modal .ghost-button,
#view-templates .orders-route-result__map,
#view-templates .orders-doc-card__actions a,
#view-templates .orders-doc-card__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--orders-surface-line) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #315b90 !important;
  font: inherit;
  font-weight: 800 !important;
  text-decoration: none !important;
  box-shadow: 0 8px 16px -16px rgba(15, 23, 42, 0.32);
  cursor: pointer;
}

#view-templates .orders-detail .ghost-button:hover,
#view-templates .orders-route-drawer .ghost-button:hover,
#view-templates .orders-modal .ghost-button:hover,
#view-templates .orders-route-result__map:hover,
#view-templates .orders-doc-card__actions a:hover,
#view-templates .orders-doc-card__actions button:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
  color: #1859c2 !important;
}

#view-templates .orders-detail__danger {
  border-color: rgba(220, 38, 38, 0.25) !important;
  background: #fff7f7 !important;
  color: #b42318 !important;
}

#view-templates .orders-route-drawer__inner {
  gap: 12px !important;
  padding: 14px !important;
}

#view-templates .orders-route-drawer {
  top: 10px !important;
  right: 10px !important;
  bottom: 10px !important;
  width: clamp(520px, 42vw, 760px) !important;
  border-radius: 18px !important;
}

#view-templates .orders-route-setup {
  padding: 12px !important;
}

#view-templates .orders-route-drawer__status {
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 1px solid #c7d9f3 !important;
  border-radius: 12px !important;
  background: var(--orders-surface-blue-soft) !important;
  color: #1f4f93 !important;
  font-weight: 800 !important;
}

#view-templates .orders-route-section {
  padding: 12px !important;
}

#view-templates .orders-route-section + .orders-route-section {
  border-top: 1px solid var(--orders-surface-line-soft) !important;
}

#view-templates .orders-route-section--pickup .orders-route-section__title {
  color: #315b90 !important;
}

#view-templates .orders-route-section--delivery .orders-route-section__title {
  color: #087f5b !important;
}

#view-templates .orders-route-section__count,
#view-templates .orders-route-item__seq--pickup {
  background: var(--orders-surface-blue-soft) !important;
  color: #315b90 !important;
}

#view-templates .orders-route-section--delivery .orders-route-section__count,
#view-templates .orders-route-item__seq--delivery {
  background: #e8f8f1 !important;
  color: #087f5b !important;
}

#view-templates .orders-route-avail,
#view-templates .orders-route-item,
#view-templates .orders-doc-card {
  border-color: var(--orders-surface-line-soft) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
}

#view-templates .orders-route-avail:hover,
#view-templates .orders-route-avail.is-selected,
#view-templates .orders-route-item:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
}

#view-templates .orders-route-avail__check {
  border-color: #b8c7d8 !important;
  border-radius: 8px !important;
}

#view-templates .orders-route-avail.is-selected .orders-route-avail__check {
  border-color: var(--orders-surface-blue) !important;
  background: var(--orders-surface-blue) !important;
}

#view-templates .orders-route-item.is-drop-before {
  border-top-color: var(--orders-surface-blue) !important;
  box-shadow: inset 0 2px 0 var(--orders-surface-blue) !important;
}

#view-templates .orders-route-item.is-drop-after {
  border-bottom-color: var(--orders-surface-blue) !important;
  box-shadow: inset 0 -2px 0 var(--orders-surface-blue) !important;
}

#view-templates .orders-route-result {
  align-items: center;
  padding: 13px 14px !important;
  border-color: #bfe4d4 !important;
  background: linear-gradient(180deg, #f2fbf7 0%, #e9f8f1 100%) !important;
}

#view-templates .orders-route-result__badge {
  border-radius: 10px !important;
  background: #dff5ec !important;
  color: #087f5b !important;
}

#view-templates .orders-route-result__km {
  color: #172033 !important;
  font-size: 22px !important;
}

#view-templates .orders-route-drawer__footer {
  padding-top: 12px !important;
  border-top-color: var(--orders-surface-line-soft) !important;
}

#view-templates .orders-route-drawer__footer .primary,
#view-templates .orders-modal__actions .primary {
  min-height: 38px !important;
  border: 1px solid rgba(142, 194, 255, 0.42) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  box-shadow: 0 12px 22px -16px rgba(43, 118, 233, 0.72) !important;
}

#view-templates .orders-route-drawer__footer .primary:disabled,
#view-templates .orders-modal__actions .primary:disabled {
  opacity: 0.48 !important;
}

#view-templates .orders-modal__actions .orders-modal__danger-btn {
  border-color: rgba(220, 38, 38, 0.34) !important;
  background: linear-gradient(180deg, #f05252 0%, #dc2626 100%) !important;
  box-shadow: 0 12px 22px -16px rgba(220, 38, 38, 0.7) !important;
}

#view-templates .orders-modal__card {
  width: min(560px, calc(100% - 32px)) !important;
  padding: 18px !important;
  border-radius: 18px !important;
}

#view-templates .orders-modal__eyebrow {
  color: #315b90 !important;
}

#view-templates .orders-modal__title {
  color: #172033 !important;
  font-size: 24px !important;
}

#view-templates .orders-modal__text {
  color: var(--orders-surface-muted) !important;
}

#view-templates .orders-modal__user {
  border-color: #c7d9f3 !important;
  background: var(--orders-surface-blue-soft) !important;
  color: #1f4f93 !important;
}

#view-templates .orders-previewbox__stage,
#view-templates .orders-previewbox__canvas,
#view-templates .orders-screen-preview__body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 250, 252, 0.96)),
    var(--orders-surface-panel-soft) !important;
}

#view-templates .orders-previewbox.is-active .orders-previewbox__stage,
#view-templates .orders-previewbox.is-active .orders-previewbox__canvas {
  border-color: #acc7ee !important;
  background:
    linear-gradient(180deg, rgba(234, 242, 255, 0.78), rgba(248, 251, 255, 0.96)),
    var(--orders-surface-panel-soft) !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.12) !important;
}

#view-templates .orders-screen-preview__header h3 {
  color: #172033 !important;
}

#view-templates .orders-screen-preview__status {
  border-color: #c7d9f3 !important;
  background: var(--orders-surface-blue-soft) !important;
  color: #1f4f93 !important;
}

#view-templates .orders-doc-card__thumb {
  border-color: var(--orders-surface-line-soft) !important;
  background: linear-gradient(180deg, #f4f8ff 0%, #eaf2ff 100%) !important;
  color: #315b90 !important;
}

@media (max-width: 860px) {
  #view-templates .orders-drawer,
  #view-templates .orders-route-drawer {
    inset: 8px !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 14px !important;
  }

  #view-templates .orders-detail__header,
  #view-templates .orders-route-drawer__titlebar,
  #view-templates .orders-route-setup__row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #view-templates .orders-form {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #view-templates .orders-form__field--span-2 {
    grid-column: span 1 !important;
  }

  #view-templates .orders-detail-tabs {
    display: flex !important;
    overflow-x: auto !important;
    grid-template-columns: none !important;
    scroll-snap-type: x proximity;
  }

  #view-templates .orders-detail-tabs__button {
    flex: 0 0 auto !important;
    min-width: 92px !important;
    scroll-snap-align: start;
  }

  #view-templates .orders-detail-section__intro {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 2px !important;
  }
}

/* Tetris firm palette
   Loaded after app.css to replace legacy dark Tetris layers without touching Orders. */
#view-workspace {
  --tetris-shell: var(--ops-page);
  --tetris-shell-2: var(--ops-page-2);
  --tetris-panel: var(--ops-panel);
  --tetris-panel-soft: var(--ops-panel-soft);
  --tetris-ink: var(--ops-ink);
  --tetris-ink-2: var(--ops-ink-2);
  --tetris-muted: var(--ops-muted);
  --tetris-faint: var(--ops-faint);
  --tetris-line: var(--ops-line);
  --tetris-line-soft: var(--ops-line-soft);
  --tetris-line-strong: var(--ops-line-strong);
  --tetris-blue: var(--ops-blue);
  --tetris-blue-hover: var(--ops-blue-hover);
  --tetris-blue-soft: var(--ops-blue-soft);
  --tetris-header-bg: linear-gradient(180deg, #304a67 0%, #263f59 100%);
  --tetris-header-line: #456587;
  --tetris-green: #087f5b;
  --tetris-green-soft: #e8f8f1;
  --tetris-amber: #9a6a12;
  --tetris-amber-soft: #fff8e6;
  --tetris-red: #b42318;
  --tetris-red-soft: #fff1f2;
  color: var(--tetris-ink) !important;
}

#view-workspace.workspace,
body[data-theme="dark"] #view-workspace.workspace {
  margin: 0 !important;
  padding: 10px 10px 10px !important;
  gap: 10px !important;
  min-height: calc(100dvh - 52px) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f3f5f8 !important;
  box-shadow: none !important;
  grid-template-columns: clamp(190px, 11.2vw, 220px) minmax(0, 1fr) !important;
}

#view-workspace .workspace__panel,
#view-workspace .workspace__canvas {
  min-width: 0 !important;
  min-height: 0 !important;
}

#view-workspace .workspace__panel {
  display: flex !important;
}

#view-workspace .workspace__canvas {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  align-self: stretch !important;
  --canvas-ruler-left: 56px;
}

#view-workspace .panel-card--planner,
body[data-theme="dark"] #view-workspace .panel-card--planner {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: 1px solid rgba(214, 222, 234, 0.9) !important;
  border-radius: var(--ops-radius-xl) !important;
  background: #ffffff !important;
  color: var(--tetris-ink) !important;
  box-shadow: 0 18px 38px -30px rgba(92, 112, 141, 0.28) !important;
}

#view-workspace .panel-header,
body[data-theme="dark"] #view-workspace .panel-header {
  flex-shrink: 0 !important;
  padding: 16px 16px 14px !important;
  border-bottom: 1px solid var(--tetris-header-line) !important;
  border-radius: var(--ops-radius-xl) var(--ops-radius-xl) 0 0 !important;
  background: #e9eef5 !important;
  color: #233247 !important;
}

#view-workspace .panel-header__titleline {
  gap: 8px !important;
}

#view-workspace .panel-header h2,
body[data-theme="dark"] #view-workspace .panel-header h2 {
  margin: 0 !important;
  color: #233247 !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
  font-weight: 850 !important;
  letter-spacing: -0.04em !important;
}

#view-workspace .panel-header p,
body[data-theme="dark"] #view-workspace .panel-header p {
  margin: 6px 0 0 !important;
  color: #c1d2e7 !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

#view-workspace .panel-help,
body[data-theme="dark"] #view-workspace .panel-help {
  margin: 12px 0 0 !important;
  padding: 10px 12px !important;
  border: 1px solid rgba(140, 156, 179, 0.42) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.72) !important;
  color: #5f7087 !important;
}

#view-workspace .panel-card--planner .panel-scroll,
body[data-theme="dark"] #view-workspace .panel-card--planner .panel-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 14px !important;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.94) 0%, rgba(255, 255, 255, 0.96) 100%),
    var(--tetris-panel) !important;
}

#view-workspace .field-grid {
  gap: 10px !important;
}

#view-workspace .field {
  gap: 0 !important;
}

#view-workspace .field label,
body[data-theme="dark"] #view-workspace .field label {
  color: var(--tetris-muted) !important;
  font-size: 11px !important;
  font-weight: 850 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
}

#view-workspace .field input,
body[data-theme="dark"] #view-workspace .field input {
  min-height: 42px !important;
  border: 1px solid var(--tetris-line) !important;
  border-radius: 11px !important;
  background: #ffffff !important;
  color: var(--tetris-ink) !important;
  font-size: 14px !important;
  font-weight: 750 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76) !important;
  transition: border-color var(--ops-ease), box-shadow var(--ops-ease), background var(--ops-ease) !important;
}

#view-workspace .field input:hover,
body[data-theme="dark"] #view-workspace .field input:hover {
  border-color: var(--tetris-line-strong) !important;
}

#view-workspace .field input:focus,
body[data-theme="dark"] #view-workspace .field input:focus {
  border-color: #acc7ee !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.13) !important;
}

#view-workspace .field-stepper {
  right: 5px !important;
  gap: 3px !important;
}

#view-workspace .field-stepper__btn,
body[data-theme="dark"] #view-workspace .field-stepper__btn {
  border: 1px solid var(--tetris-line-soft) !important;
  background: var(--tetris-panel-soft) !important;
  color: var(--tetris-ink-2) !important;
  box-shadow: none !important;
}

#view-workspace .field-stepper__btn:hover,
body[data-theme="dark"] #view-workspace .field-stepper__btn:hover {
  border-color: #acc7ee !important;
  background: var(--tetris-blue-soft) !important;
  color: #1859c2 !important;
}

#view-workspace .panel-actions--planner,
#view-workspace .canvas-actions,
#view-workspace .canvas-zone-footer__actions,
#view-workspace .canvas-footer-actions {
  gap: 8px !important;
}

#view-workspace .panel-actions--planner button,
#view-workspace .panel-open-bulk,
#view-workspace .canvas-action,
#view-workspace .zone-btn,
#view-workspace .canvas-footer-actions .canvas-reset-btn,
body[data-theme="dark"] #view-workspace .panel-actions--planner button,
body[data-theme="dark"] #view-workspace .panel-open-bulk,
body[data-theme="dark"] #view-workspace .canvas-action,
body[data-theme="dark"] #view-workspace .zone-btn,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn {
  min-height: 38px !important;
  border: 1px solid var(--tetris-line) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: var(--tetris-ink-2) !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  box-shadow: var(--ops-shadow-soft) !important;
  transition: border-color var(--ops-ease), background var(--ops-ease), color var(--ops-ease), transform var(--ops-ease) !important;
}

#view-workspace .panel-actions--planner button:hover,
#view-workspace .panel-open-bulk:hover,
#view-workspace .canvas-action:hover,
#view-workspace .zone-btn:hover,
#view-workspace .canvas-footer-actions .canvas-reset-btn:hover,
body[data-theme="dark"] #view-workspace .panel-actions--planner button:hover,
body[data-theme="dark"] #view-workspace .panel-open-bulk:hover,
body[data-theme="dark"] #view-workspace .canvas-action:hover,
body[data-theme="dark"] #view-workspace .zone-btn:hover,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
  color: #1859c2 !important;
  transform: translateY(-1px) !important;
}

#view-workspace .panel-actions--planner button.primary,
#view-workspace .canvas-footer-actions .canvas-quickadd-btn,
body[data-theme="dark"] #view-workspace .panel-actions--planner button.primary,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn {
  border-color: rgba(142, 194, 255, 0.42) !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 22px -16px rgba(43, 118, 233, 0.72) !important;
}

#view-workspace .panel-actions--planner button.primary:hover,
#view-workspace .canvas-footer-actions .canvas-quickadd-btn:hover,
body[data-theme="dark"] #view-workspace .panel-actions--planner button.primary:hover,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn:hover {
  border-color: rgba(142, 194, 255, 0.58) !important;
  background: linear-gradient(180deg, #2f7ded 0%, #1f65cf 100%) !important;
  color: #ffffff !important;
}

#view-workspace .zone-btn.is-active,
body[data-theme="dark"] #view-workspace .zone-btn.is-active {
  border-color: #acc7ee !important;
  background: var(--tetris-blue-soft) !important;
  color: #1859c2 !important;
  box-shadow: inset 3px 0 0 var(--tetris-blue), var(--ops-shadow-soft) !important;
}

#view-workspace .panel-actions--planner button.danger,
#view-workspace .canvas-footer-actions .canvas-reset-btn,
body[data-theme="dark"] #view-workspace .panel-actions--planner button.danger,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn {
  border-color: rgba(220, 38, 38, 0.22) !important;
  background: var(--tetris-red-soft) !important;
  color: var(--tetris-red) !important;
}

#view-workspace .canvas-header,
body[data-theme="dark"] #view-workspace .canvas-header {
  flex: 0 0 auto !important;
  padding: 16px 18px 14px !important;
  width: calc(100% - clamp(180px, 10.6vw, 220px) - 8px) !important;
  border: 1px solid rgba(214, 222, 234, 0.9) !important;
  border-bottom: 0 !important;
  border-radius: var(--ops-radius-xl) var(--ops-radius-xl) 0 0 !important;
  background: #e9eef5 !important;
  color: #233247 !important;
  box-shadow: 0 18px 36px -30px rgba(92, 112, 141, 0.18) !important;
}

#view-workspace .canvas-header h2,
body[data-theme="dark"] #view-workspace .canvas-header h2 {
  margin: 0 !important;
  color: #233247 !important;
  font-size: clamp(24px, 2.1vw, 32px) !important;
  line-height: 1 !important;
  font-weight: 850 !important;
  letter-spacing: -0.045em !important;
}

#view-workspace .canvas-header p,
body[data-theme="dark"] #view-workspace .canvas-header p {
  margin: 6px 0 0 !important;
  color: #c1d2e7 !important;
  font-size: 13px !important;
}

#view-workspace .canvas-board,
body[data-theme="dark"] #view-workspace .canvas-board {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  flex: 0 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) clamp(180px, 10.6vw, 220px) !important;
  grid-template-rows: var(--planner-stage-fit-height, minmax(0, 1fr)) auto !important;
  column-gap: 12px !important;
  row-gap: 12px !important;
  align-content: start !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--tetris-ink) !important;
  box-shadow: none !important;
}

#view-workspace #stage {
  grid-column: 1 !important;
  grid-row: 1 !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 12px 12px 0 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(214, 222, 234, 0.92) !important;
  border-radius: 0 0 var(--ops-radius-xl) var(--ops-radius-xl) !important;
  background: #dde4ee !important;
  box-shadow: 0 18px 38px -30px rgba(92, 112, 141, 0.28) !important;
}

#view-workspace .ruler-frame {
  width: 100% !important;
  height: 100% !important;
}

#view-workspace .ruler-frame .ruler-corner,
#view-workspace .ruler-frame .ruler-x,
#view-workspace .ruler-frame .ruler-y,
body[data-theme="dark"] #view-workspace .ruler-frame .ruler-corner,
body[data-theme="dark"] #view-workspace .ruler-frame .ruler-x,
body[data-theme="dark"] #view-workspace .ruler-frame .ruler-y {
  background: rgba(245, 248, 252, 0.74) !important;
}

#view-workspace .ruler-frame .ruler-corner {
  border-right-color: rgba(172, 188, 209, 0.72) !important;
  border-bottom-color: rgba(172, 188, 209, 0.72) !important;
}

#view-workspace #bayCanvas,
body[data-theme="dark"] #view-workspace #bayCanvas {
  --grid-line-major: rgba(120, 137, 161, 0.42);
  --grid-line-minor: rgba(164, 177, 194, 0.34);
  border: 1px solid rgba(161, 175, 195, 0.82) !important;
  border-radius: 0 18px 18px 18px !important;
  background-color: #d0dbea !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

#view-workspace .tick-x,
#view-workspace .tick-y,
body[data-theme="dark"] #view-workspace .tick-x,
body[data-theme="dark"] #view-workspace .tick-y {
  background: rgba(51, 65, 85, 0.2) !important;
}

#view-workspace .tick--major,
body[data-theme="dark"] #view-workspace .tick--major {
  background: rgba(23, 32, 51, 0.5) !important;
}

#view-workspace .label,
#view-workspace .measure-label,
body[data-theme="dark"] #view-workspace .label,
body[data-theme="dark"] #view-workspace .measure-label {
  border: 1px solid var(--tetris-line) !important;
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--tetris-ink-2) !important;
  font-weight: 800 !important;
  box-shadow: var(--ops-shadow-soft) !important;
}

#view-workspace .measure-line.h,
#view-workspace .measure-line.v,
body[data-theme="dark"] #view-workspace .measure-line.h,
body[data-theme="dark"] #view-workspace .measure-line.v {
  border-color: rgba(43, 118, 233, 0.7) !important;
}

#view-workspace .canvas-zone-footer,
body[data-theme="dark"] #view-workspace .canvas-zone-footer {
  grid-column: 1 !important;
  grid-row: 2 !important;
  margin: 0 !important;
  padding: 0 12px 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--tetris-ink) !important;
  box-shadow: none !important;
}

#view-workspace .canvas-board__footer,
body[data-theme="dark"] #view-workspace .canvas-board__footer {
  grid-column: 2 !important;
  grid-row: 1 / span 2 !important;
  align-self: stretch !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid rgba(214, 222, 234, 0.92) !important;
  border-radius: var(--ops-radius-xl) !important;
  background: #ffffff !important;
  color: var(--tetris-ink) !important;
  box-shadow: 0 18px 38px -30px rgba(92, 112, 141, 0.28) !important;
}

#view-workspace .canvas-metrics {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

#view-workspace .canvas-metric,
body[data-theme="dark"] #view-workspace .canvas-metric {
  min-height: 72px !important;
  align-items: flex-start !important;
  justify-content: center !important;
  padding: 12px !important;
  border: 1px solid rgba(220, 227, 237, 0.96) !important;
  border-radius: 12px !important;
  background: #fbfcfe !important;
  color: var(--tetris-ink) !important;
  box-shadow: none !important;
}

#view-workspace .canvas-metric__label,
body[data-theme="dark"] #view-workspace .canvas-metric__label {
  color: var(--tetris-muted) !important;
  font-size: 10px !important;
  font-weight: 850 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

#view-workspace .canvas-metric__value,
body[data-theme="dark"] #view-workspace .canvas-metric__value {
  margin-top: 4px !important;
  color: #172033 !important;
  font-size: 28px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: -0.04em !important;
}

#view-workspace .canvas-metric__value.warn {
  color: var(--tetris-red) !important;
}

#view-workspace .canvas-footer-actions .canvas-quickadd-btn,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn {
  min-height: 70px !important;
  border-radius: 12px !important;
}

#view-workspace .canvas-quickadd-btn__title {
  font-size: 20px !important;
  font-weight: 900 !important;
  letter-spacing: -0.03em !important;
}

#view-workspace .canvas-quickadd-btn__meta {
  color: rgba(255, 255, 255, 0.78) !important;
}

#view-workspace .color-card--rail,
body[data-theme="dark"] #view-workspace .color-card--rail {
  margin-top: auto !important;
  padding: 12px !important;
  border: 1px solid rgba(220, 227, 237, 0.96) !important;
  border-radius: 12px !important;
  background: #fbfcfe !important;
  color: var(--tetris-ink) !important;
  box-shadow: none !important;
}

#view-workspace .color-card--rail .color-card__header strong,
body[data-theme="dark"] #view-workspace .color-card--rail .color-card__header strong {
  color: var(--tetris-ink) !important;
  font-weight: 900 !important;
}

#view-workspace .color-card--rail .bulk-hint,
body[data-theme="dark"] #view-workspace .color-card--rail .bulk-hint {
  color: var(--tetris-muted) !important;
}

#view-workspace .color-card--rail .color-row {
  gap: 7px !important;
}

#view-workspace .color-swatch,
body[data-theme="dark"] #view-workspace .color-swatch {
  border: 1px solid rgba(176, 185, 196, 0.6) !important;
  background: linear-gradient(180deg, #d7dde6 0%, #b0b9c4 100%) !important;
  color: #233247 !important;
  box-shadow: 0 8px 18px -18px rgba(30, 41, 59, 0.42) !important;
  cursor: default !important;
}

#view-workspace .color-swatch:hover,
body[data-theme="dark"] #view-workspace .color-swatch:hover {
  border-color: rgba(120, 136, 156, 0.72) !important;
  transform: none !important;
}

#view-workspace .color-swatch.is-active,
body[data-theme="dark"] #view-workspace .color-swatch.is-active {
  border-color: rgba(96, 112, 132, 0.82) !important;
  box-shadow: 0 0 0 3px rgba(176, 185, 196, 0.28) !important;
}

#view-workspace .pallet {
  border-radius: 9px !important;
  border-width: 1px !important;
  box-shadow: 0 32px 60px -38px rgba(39, 50, 66, 0.44), 0 18px 34px -30px rgba(68, 82, 102, 0.24) !important;
}

#view-workspace .pallet.color-neutral,
#view-workspace .pallet.color-blue,
#view-workspace .pallet.color-green,
#view-workspace .pallet.color-amber,
#view-workspace .pallet.color-rose,
#view-workspace .pallet.color-slate {
  background: #b0b9c4 !important;
  border-color: rgba(123, 136, 154, 0.72) !important;
}

#view-workspace .pallet.last {
  box-shadow: 0 38px 68px -42px rgba(44, 56, 74, 0.48), 0 20px 38px -32px rgba(95, 110, 130, 0.28) !important;
}

#view-workspace .pallet .size,
#view-workspace .pallet .weight,
body[data-theme="dark"] #view-workspace .pallet .size,
body[data-theme="dark"] #view-workspace .pallet .weight {
  border: 1px solid rgba(255, 255, 255, 0.54) !important;
  background: rgba(255, 255, 255, 0.68) !important;
  color: #172033 !important;
  backdrop-filter: blur(4px) saturate(108%) !important;
}

#view-workspace .pallet .color-index,
body[data-theme="dark"] #view-workspace .pallet .color-index {
  color: rgba(255, 255, 255, 0.94) !important;
  text-transform: uppercase !important;
  text-shadow: 0 2px 9px rgba(27, 36, 50, 0.7), -1px 0 rgba(27, 36, 50, 0.84), 1px 0 rgba(27, 36, 50, 0.84), 0 -1px rgba(27, 36, 50, 0.84), 0 1px rgba(27, 36, 50, 0.84) !important;
}

#view-workspace .color-row.is-readonly .color-swatch,
body[data-theme="dark"] #view-workspace .color-row.is-readonly .color-swatch {
  pointer-events: none !important;
}

.pallet-letter-menu,
body[data-theme="dark"] .pallet-letter-menu {
  position: fixed !important;
  z-index: 1200 !important;
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 0 !important;
  padding: 8px !important;
  border: 1px solid rgba(201, 210, 222, 0.96) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.44) !important;
  backdrop-filter: blur(12px) saturate(120%) !important;
}

.pallet-letter-menu[hidden],
body[data-theme="dark"] .pallet-letter-menu[hidden] {
  display: none !important;
}

.pallet-letter-menu__button,
body[data-theme="dark"] .pallet-letter-menu__button {
  min-width: 38px !important;
  min-height: 38px !important;
  border: 1px solid rgba(176, 185, 196, 0.74) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #dde3ea 0%, #c1cad4 100%) !important;
  color: #233247 !important;
  display: grid !important;
  place-items: center !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease !important;
}

.pallet-letter-menu__button:hover,
.pallet-letter-menu__button.is-active,
body[data-theme="dark"] .pallet-letter-menu__button:hover,
body[data-theme="dark"] .pallet-letter-menu__button.is-active {
  border-color: rgba(114, 128, 148, 0.88) !important;
  box-shadow: 0 10px 20px -18px rgba(44, 56, 74, 0.52), 0 0 0 3px rgba(176, 185, 196, 0.24) !important;
  text-shadow: 0 1px 2px rgba(23, 32, 51, 0.24) !important;
  transform: translateY(-1px) !important;
}

.pallet-letter-menu__button--danger,
body[data-theme="dark"] .pallet-letter-menu__button--danger {
  border-color: rgba(214, 96, 96, 0.55) !important;
  background: linear-gradient(180deg, #f4d6d6 0%, #e8b8b8 100%) !important;
  color: transparent !important;
  position: relative !important;
}

.pallet-letter-menu__button--danger::before,
body[data-theme="dark"] .pallet-letter-menu__button--danger::before {
  content: '\00d7';
  color: #8b1e1e !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  transform: translateY(-1px) !important;
}

.pallet-letter-menu__button--danger:hover,
.pallet-letter-menu__button--danger.is-active,
body[data-theme="dark"] .pallet-letter-menu__button--danger:hover,
body[data-theme="dark"] .pallet-letter-menu__button--danger.is-active {
  border-color: rgba(180, 58, 58, 0.78) !important;
  box-shadow: 0 10px 20px -18px rgba(140, 32, 32, 0.42), 0 0 0 3px rgba(214, 96, 96, 0.16) !important;
  transform: translateY(-1px) !important;
}

#view-workspace .bulk-modal,
body[data-theme="dark"] #view-workspace .bulk-modal {
  background: rgba(11, 17, 24, 0.44) !important;
  backdrop-filter: blur(6px) saturate(112%) !important;
}

#view-workspace .bulk-modal__card,
body[data-theme="dark"] #view-workspace .bulk-modal__card {
  border: 1px solid var(--tetris-line-strong) !important;
  border-radius: 18px !important;
  background: var(--tetris-panel) !important;
  color: var(--tetris-ink) !important;
  box-shadow: var(--ops-shadow) !important;
}

#view-workspace .bulk-modal__header,
body[data-theme="dark"] #view-workspace .bulk-modal__header {
  border-bottom: 1px solid var(--tetris-header-line) !important;
  background: var(--tetris-header-bg) !important;
  color: #ffffff !important;
}

#view-workspace .bulk-modal__title,
body[data-theme="dark"] #view-workspace .bulk-modal__title {
  color: #ffffff !important;
  font-weight: 900 !important;
}

#view-workspace .bulk-modal__close,
body[data-theme="dark"] #view-workspace .bulk-modal__close {
  border: 1px solid rgba(193, 210, 231, 0.24) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d8e6f7 !important;
}

#view-workspace .bulk-modal__textarea,
body[data-theme="dark"] #view-workspace .bulk-modal__textarea {
  border: 1px solid var(--tetris-line) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: var(--tetris-ink) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76) !important;
}

#view-workspace .bulk-modal__textarea:focus,
body[data-theme="dark"] #view-workspace .bulk-modal__textarea:focus {
  border-color: #acc7ee !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.13) !important;
}

#view-workspace .bulk-modal__actions .primary,
body[data-theme="dark"] #view-workspace .bulk-modal__actions .primary {
  border: 1px solid rgba(142, 194, 255, 0.42) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  color: #ffffff !important;
  font-weight: 850 !important;
}

#view-workspace .canvas-action:focus-visible,
#view-workspace .zone-btn:focus-visible,
#view-workspace .panel-actions button:focus-visible,
#view-workspace .panel-open-bulk:focus-visible,
#view-workspace .canvas-quickadd-btn:focus-visible,
#view-workspace .canvas-reset-btn:focus-visible,
#view-workspace .color-swatch:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 4px rgba(43, 118, 233, 0.16) !important;
}

#view-workspace :is(.canvas-action, .zone-btn, .panel-actions button, .panel-open-bulk, .canvas-quickadd-btn, .canvas-reset-btn):disabled,
body[data-theme="dark"] #view-workspace :is(.canvas-action, .zone-btn, .panel-actions button, .panel-open-bulk, .canvas-quickadd-btn, .canvas-reset-btn):disabled {
  border-color: var(--tetris-line-soft) !important;
  background: #eef4fb !important;
  color: var(--tetris-faint) !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 0.8 !important;
}

@media (max-width: 1100px) {
  #view-workspace.workspace,
  body[data-theme="dark"] #view-workspace.workspace {
    grid-template-columns: 1fr !important;
    padding: 10px !important;
  }

  #view-workspace .canvas-board,
  body[data-theme="dark"] #view-workspace .canvas-board {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(460px, 1fr) auto auto !important;
  }

  #view-workspace .canvas-zone-footer,
  body[data-theme="dark"] #view-workspace .canvas-zone-footer {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  #view-workspace .canvas-board__footer,
  body[data-theme="dark"] #view-workspace .canvas-board__footer {
    grid-column: 1 !important;
    grid-row: 3 !important;
    border-left: 0 !important;
    border-top: 1px solid var(--tetris-line) !important;
    border-radius: 0 0 var(--ops-radius-xl) var(--ops-radius-xl) !important;
  }
}

@media (max-width: 720px) {
  #view-workspace.workspace,
  body[data-theme="dark"] #view-workspace.workspace {
    padding: 8px !important;
  }

  #view-workspace .canvas-header,
  body[data-theme="dark"] #view-workspace .canvas-header {
    padding: 14px !important;
  }

  #view-workspace .canvas-board,
  body[data-theme="dark"] #view-workspace .canvas-board {
    min-height: 0 !important;
  }

  #view-workspace .canvas-metrics {
    grid-template-columns: 1fr !important;
  }
}

/* Unified admin + app theme layer */
.topbar__theme {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #c8d6e7 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.topbar__theme:hover {
  border-color: rgba(120, 174, 255, 0.34) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.topbar__theme .theme-toggle__icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.9;
}

.account-theme-toggle {
  display: flex !important;
  gap: 0 !important;
  padding: 6px 12px 10px !important;
}

.account-theme-btn {
  border: 1px solid var(--ops-line-soft) !important;
  background: #ffffff !important;
  color: var(--ops-ink-2) !important;
  font-weight: 800 !important;
}

.account-theme-btn:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
  color: #1859c2 !important;
}

.account-theme-btn.is-active {
  border-color: #acc7ee !important;
  background: var(--ops-blue-soft) !important;
  color: #1859c2 !important;
}

#view-admin.admin-view {
  background: var(--ops-page) !important;
  color: var(--ops-ink) !important;
}

#view-admin .admin-screen {
  min-height: calc(100dvh - 52px) !important;
  background:
    radial-gradient(900px 420px at 50% -280px, rgba(22, 100, 217, 0.18), rgba(22, 100, 217, 0) 62%),
    linear-gradient(180deg, #edf2f7 0%, #e9eef5 100%) !important;
}

#view-admin .admin-layout {
  gap: 14px !important;
  padding: 14px 16px 16px !important;
}

#view-admin .admin-hero {
  padding: 18px !important;
  border: 1px solid #456587 !important;
  border-radius: var(--ops-radius-xl) !important;
  background: linear-gradient(180deg, #304a67 0%, #263f59 100%) !important;
  color: #f8fafc !important;
  box-shadow: var(--ops-shadow) !important;
}

#view-admin .admin-hero h2 {
  color: #ffffff !important;
  font-size: clamp(26px, 2vw, 34px) !important;
  font-weight: 900 !important;
  letter-spacing: -0.05em !important;
}

#view-admin .admin-hero p {
  color: #c1d2e7 !important;
}

#view-admin .admin-overview__card,
#view-admin .admin-quicklink-card {
  border: 1px solid rgba(193, 210, 231, 0.2) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
  box-shadow: none !important;
}

#view-admin .admin-overview__label,
#view-admin .admin-quicklink-card__copy span {
  color: #c1d2e7 !important;
}

#view-admin .admin-overview__value {
  color: #ffffff !important;
  font-weight: 900 !important;
}

#view-admin .admin-card,
#view-admin .admin-company-editor {
  border: 1px solid var(--ops-line-strong) !important;
  border-radius: var(--ops-radius-xl) !important;
  background: var(--ops-panel) !important;
  color: var(--ops-ink) !important;
  box-shadow: var(--ops-shadow) !important;
}

#view-admin .admin-card {
  padding: 18px !important;
}

#view-admin .admin-card h3 {
  color: #172033 !important;
  font-size: 21px !important;
  font-weight: 900 !important;
  letter-spacing: -0.035em !important;
}

#view-admin .admin-card p,
#view-admin .admin-company-tile__meta,
#view-admin .admin-company-editor__head span,
#view-admin .admin-subtle-note,
#view-admin .admin-list__main span,
#view-admin .admin-empty,
#view-admin .admin-loading {
  color: var(--ops-muted) !important;
}

#view-admin .admin-inline-form,
#view-admin .admin-grid-form {
  gap: 10px !important;
}

#view-admin .orders-filter__input {
  min-height: 38px !important;
  border: 1px solid var(--ops-line) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: var(--ops-ink) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03) !important;
}

#view-admin .orders-filter__input:focus {
  border-color: rgba(43, 118, 233, 0.58) !important;
  box-shadow: 0 0 0 3px rgba(43, 118, 233, 0.13) !important;
}

#view-admin .primary,
#view-admin .ghost-button {
  min-height: 38px !important;
  border-radius: 10px !important;
  font-weight: 850 !important;
}

#view-admin .primary {
  border: 1px solid rgba(142, 194, 255, 0.42) !important;
  background: linear-gradient(180deg, #3f8dff 0%, #2b76e9 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 22px -16px rgba(43, 118, 233, 0.72) !important;
}

#view-admin .primary:hover {
  background: linear-gradient(180deg, #2f7ded 0%, #1f65cf 100%) !important;
}

#view-admin .ghost-button {
  border: 1px solid var(--ops-line) !important;
  background: #ffffff !important;
  color: #315b90 !important;
}

#view-admin .ghost-button:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
  color: #1859c2 !important;
}

#view-admin .danger-button,
#view-admin .ghost-button.danger-button {
  border-color: rgba(220, 38, 38, 0.25) !important;
  background: #fff7f7 !important;
  color: #b42318 !important;
}

#view-admin .admin-company-grid,
#view-admin .admin-list {
  gap: 10px !important;
}

#view-admin .admin-company-tile,
#view-admin .admin-list__item,
#view-admin .admin-mini-stat,
#view-admin .admin-empty,
#view-admin .admin-loading,
#view-admin .admin-notice {
  border: 1px solid var(--ops-line-soft) !important;
  border-radius: 14px !important;
  background: var(--ops-panel-soft) !important;
  color: var(--ops-ink) !important;
}

#view-admin .admin-company-tile:hover {
  border-color: #acc7ee !important;
  background: #f4f8ff !important;
  transform: translateY(-1px) !important;
}

#view-admin .admin-company-tile.is-active {
  border-color: #acc7ee !important;
  background: var(--ops-blue-soft) !important;
  box-shadow: inset 4px 0 0 var(--ops-blue) !important;
}

#view-admin .admin-company-tile__title,
#view-admin .admin-list__main strong,
#view-admin .admin-company-editor__head strong,
#view-admin .admin-mini-stat strong {
  color: #172033 !important;
}

#view-admin .admin-mini-stat__label {
  color: var(--ops-muted) !important;
}

#view-admin .admin-company-tile__status--active,
#view-admin .admin-status--accepted,
#view-admin .admin-status--active {
  background: #e8f8f1 !important;
  color: #087f5b !important;
}

#view-admin .admin-company-tile__status--disabled,
#view-admin .admin-status--revoked,
#view-admin .admin-status--disabled {
  background: var(--ops-red-soft) !important;
  color: #b42318 !important;
}

#view-admin .admin-status--pending {
  background: #fff8e6 !important;
  color: #9a6a12 !important;
}

#view-admin .admin-notice--success {
  border-color: #bfe4d4 !important;
  background: #e8f8f1 !important;
  color: #087f5b !important;
}

#view-admin .admin-notice--error {
  border-color: rgba(220, 38, 38, 0.25) !important;
  background: var(--ops-red-soft) !important;
  color: #b42318 !important;
}

body[data-theme="dark"] {
  --ops-bg-0: #0b1118;
  --ops-bg-1: #111a24;
  --ops-page: #101821;
  --ops-page-2: #141f2b;
  --ops-panel: #182433;
  --ops-panel-soft: #1e2c3c;
  --ops-ink: #eef5fc;
  --ops-ink-2: #d0dceb;
  --ops-muted: #9cadc0;
  --ops-faint: #718197;
  --ops-line: rgba(169, 186, 207, 0.2);
  --ops-line-soft: rgba(169, 186, 207, 0.12);
  --ops-line-strong: rgba(169, 186, 207, 0.28);
  --ops-blue-soft: rgba(68, 142, 255, 0.18);
  --ops-red-soft: rgba(220, 38, 38, 0.12);
  --ops-shadow: 0 22px 54px -34px rgba(0, 0, 0, 0.62);
  --ops-shadow-soft: 0 12px 26px -22px rgba(0, 0, 0, 0.58);
  background: #0b1118 !important;
  color: var(--ops-ink) !important;
}

body[data-theme="dark"] .app-main {
  background:
    radial-gradient(1000px 500px at 50% -330px, rgba(68, 142, 255, 0.15), rgba(68, 142, 255, 0) 64%),
    linear-gradient(180deg, #111a24 0%, #0f1720 100%) !important;
}

body[data-theme="dark"] .account-drawer {
  border-color: var(--ops-line-strong) !important;
  background: #111a24 !important;
  color: var(--ops-ink) !important;
}

body[data-theme="dark"] .account-drawer__section + .account-drawer__section {
  border-top-color: var(--ops-line-soft) !important;
}

body[data-theme="dark"] .account-theme-btn {
  border-color: var(--ops-line-soft) !important;
  background: #162131 !important;
  color: var(--ops-ink-2) !important;
}

body[data-theme="dark"] .account-theme-btn:hover,
body[data-theme="dark"] .account-theme-btn.is-active {
  border-color: rgba(120, 174, 255, 0.34) !important;
  background: rgba(43, 118, 233, 0.16) !important;
  color: #dbeafe !important;
}

body[data-theme="dark"] #view-templates {
  --orders-surface-bg: #121c27;
  --orders-surface-panel: #182433;
  --orders-surface-panel-soft: #1e2c3c;
  --orders-surface-rail: #162231;
  --orders-surface-line: rgba(169, 186, 207, 0.22);
  --orders-surface-line-soft: rgba(169, 186, 207, 0.12);
  --orders-surface-ink: #eef5fc;
  --orders-surface-muted: #9cadc0;
  --orders-surface-header: linear-gradient(180deg, #263d57 0%, #1d3045 100%);
  --orders-surface-header-line: rgba(142, 194, 255, 0.24);
  --orders-surface-blue-soft: rgba(68, 142, 255, 0.18);
  --orders-surface-shadow: 0 22px 54px -34px rgba(0, 0, 0, 0.68);
}

body[data-theme="dark"] #view-templates.orders-view,
body[data-theme="dark"] #view-templates .orders-crm {
  background:
    radial-gradient(1000px 460px at 50% -290px, rgba(68, 142, 255, 0.14), rgba(68, 142, 255, 0) 64%),
    linear-gradient(180deg, #121c27 0%, #101821 100%) !important;
  color: var(--orders-surface-ink) !important;
}

body[data-theme="dark"] #view-templates .orders-board,
body[data-theme="dark"] #view-templates .orders-drawer,
body[data-theme="dark"] #view-templates .orders-route-drawer,
body[data-theme="dark"] #view-templates .orders-modal__card,
body[data-theme="dark"] #view-templates .orders-screen-preview__surface {
  border-color: var(--orders-surface-line) !important;
  background:
    radial-gradient(720px 280px at 50% -180px, rgba(68, 142, 255, 0.1), rgba(68, 142, 255, 0) 62%),
    linear-gradient(180deg, #182433 0%, #15202d 100%) !important;
  color: var(--orders-surface-ink) !important;
  box-shadow: var(--orders-surface-shadow) !important;
}

body[data-theme="dark"] #view-templates .orders-board__toolbar,
body[data-theme="dark"] #view-templates .orders-detail__header,
body[data-theme="dark"] #view-templates .orders-route-drawer__header {
  border-color: var(--orders-surface-header-line) !important;
  background: var(--orders-surface-header) !important;
  color: #f8fbff !important;
}

body[data-theme="dark"] #view-templates .orders-detail-tabs {
  border-color: rgba(148, 163, 184, 0.26) !important;
  background:
    linear-gradient(180deg, rgba(24, 36, 51, 0.98), rgba(18, 30, 43, 0.96)) !important;
}

body[data-theme="dark"] #view-templates .orders-detail-tabs__button {
  border-color: rgba(148, 163, 184, 0.24) !important;
  background: rgba(31, 48, 66, 0.92) !important;
  color: #dbeafe !important;
}

body[data-theme="dark"] #view-templates .orders-detail-tabs__button:hover {
  border-color: rgba(96, 165, 250, 0.42) !important;
  background: rgba(38, 60, 84, 0.96) !important;
  color: #eff6ff !important;
}

body[data-theme="dark"] #view-templates .orders-detail-tabs__button.is-active {
  border-color: rgba(96, 165, 250, 0.38) !important;
  background: linear-gradient(180deg, #2d5e99 0%, #1f456f 100%) !important;
  color: #f8fbff !important;
}

body[data-theme="dark"] #view-templates .orders-detail-section__intro span {
  color: #eaf1f8 !important;
}

body[data-theme="dark"] #view-templates .orders-search,
body[data-theme="dark"] #view-templates .orders-board__search,
body[data-theme="dark"] #view-templates .orders-board__search input,
body[data-theme="dark"] #view-templates .orders-form__input,
body[data-theme="dark"] #view-templates .orders-form__readonly,
body[data-theme="dark"] #view-templates .orders-route-setup__field input,
body[data-theme="dark"] #view-templates .orders-route-setup__field select,
body[data-theme="dark"] #view-templates .orders-route-setup__fixed,
body[data-theme="dark"] #view-templates .orders-truckline,
body[data-theme="dark"] #view-templates .orders-modal__input-wrap input {
  border-color: var(--orders-surface-line) !important;
  background: #f5f8fc !important;
  color: #172033 !important;
}

body[data-theme="dark"] #view-templates .orders-form__input,
body[data-theme="dark"] #view-templates .orders-form__readonly,
body[data-theme="dark"] #view-templates .orders-route-setup__field input,
body[data-theme="dark"] #view-templates .orders-route-setup__field select,
body[data-theme="dark"] #view-templates .orders-route-setup__fixed,
body[data-theme="dark"] #view-templates .orders-truckline,
body[data-theme="dark"] #view-templates .orders-modal__input-wrap input {
  background: #14202d !important;
  color: var(--orders-surface-ink) !important;
}

body[data-theme="dark"] #view-templates .orders-table-wrap {
  background:
    linear-gradient(180deg, rgba(18, 28, 39, 0.98) 0%, rgba(15, 24, 34, 0.98) 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 55px, rgba(169, 186, 207, 0.055) 55px, rgba(169, 186, 207, 0.055) 56px) !important;
}

body[data-theme="dark"] #view-templates .orders-table__head {
  border-color: var(--orders-surface-line) !important;
  background: linear-gradient(180deg, #1b2a3a 0%, #162331 100%) !important;
  color: #a9bad0 !important;
}

body[data-theme="dark"] #view-templates .orders-table__cell {
  border-color: var(--orders-surface-line-soft) !important;
  color: var(--orders-surface-ink) !important;
}

body[data-theme="dark"] #view-templates .orders-table__row {
  background: #152231 !important;
}

body[data-theme="dark"] #view-templates .orders-table__row:nth-child(even) {
  background: #182737 !important;
}

body[data-theme="dark"] #view-templates .orders-table__row:hover {
  background: #1d3146 !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.is-selected {
  background: rgba(68, 142, 255, 0.18) !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.has-route-group {
  background: hsl(var(--route-hue, 152) 24% 18%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.has-route-group:hover {
  background: hsl(var(--route-hue, 152) 25% 21%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__order-num,
body[data-theme="dark"] #view-templates .orders-table__date,
body[data-theme="dark"] #view-templates .orders-table__date-main,
body[data-theme="dark"] #view-templates .orders-table__location-place,
body[data-theme="dark"] #view-templates .orders-table__party-name,
body[data-theme="dark"] #view-templates .orders-table__money,
body[data-theme="dark"] #view-templates .orders-table__km,
body[data-theme="dark"] #view-templates .orders-route-summary__place {
  color: #eaf1f8 !important;
}

body[data-theme="dark"] #view-templates .orders-table__order-sub,
body[data-theme="dark"] #view-templates .orders-table__party-meta,
body[data-theme="dark"] #view-templates .orders-table__date-sub,
body[data-theme="dark"] #view-templates .orders-table__location-meta,
body[data-theme="dark"] #view-templates .orders-route-summary__meta,
body[data-theme="dark"] #view-templates .orders-muted {
  color: #93a4b8 !important;
}

body[data-theme="dark"] #view-templates .orders-table__payment-term,
body[data-theme="dark"] #view-templates .orders-table__doc-chip,
body[data-theme="dark"] #view-templates .orders-table__truck-card,
body[data-theme="dark"] #view-templates .orders-table__link--map,
body[data-theme="dark"] #view-templates .orders-table__row-action,
body[data-theme="dark"] #view-templates .orders-detail .ghost-button,
body[data-theme="dark"] #view-templates .orders-route-drawer .ghost-button,
body[data-theme="dark"] #view-templates .orders-modal .ghost-button,
body[data-theme="dark"] #view-templates .orders-route-result__map,
body[data-theme="dark"] #view-templates .orders-doc-card__actions a,
body[data-theme="dark"] #view-templates .orders-doc-card__actions button {
  border-color: var(--orders-surface-line) !important;
  background: #1f3042 !important;
  color: #dbeafe !important;
}

body[data-theme="dark"] #view-templates .orders-panel,
body[data-theme="dark"] #view-templates .orders-route-setup,
body[data-theme="dark"] #view-templates .orders-route-section,
body[data-theme="dark"] #view-templates .orders-route-avail,
body[data-theme="dark"] #view-templates .orders-route-item,
body[data-theme="dark"] #view-templates .orders-doc-card,
body[data-theme="dark"] #view-templates .orders-previewbox__stage,
body[data-theme="dark"] #view-templates .orders-screen-preview__body,
body[data-theme="dark"] #view-templates .orders-truckline__panel {
  border-color: var(--orders-surface-line-soft) !important;
  background: rgba(24, 36, 51, 0.94) !important;
  color: var(--orders-surface-ink) !important;
}

body[data-theme="dark"] #view-templates .orders-panel__header h3,
body[data-theme="dark"] #view-templates .orders-route-section__title,
body[data-theme="dark"] #view-templates .orders-modal__title,
body[data-theme="dark"] #view-templates .orders-screen-preview__header h3 {
  color: #eaf1f8 !important;
}

body[data-theme="dark"] #view-workspace {
  --tetris-panel: #111a24;
  --tetris-panel-soft: #162131;
  --tetris-ink: #eaf1f8;
  --tetris-ink-2: #c8d6e7;
  --tetris-muted: #93a4b8;
  --tetris-faint: #64748b;
  --tetris-line: rgba(148, 163, 184, 0.18);
  --tetris-line-soft: rgba(148, 163, 184, 0.11);
  --tetris-line-strong: rgba(148, 163, 184, 0.25);
  --tetris-blue-soft: rgba(43, 118, 233, 0.16);
  --tetris-header-bg: linear-gradient(180deg, #20354d 0%, #152438 100%);
  --tetris-header-line: rgba(120, 174, 255, 0.22);
}

body[data-theme="dark"] #view-workspace.workspace {
  background:
    radial-gradient(900px 420px at 50% -280px, rgba(43, 118, 233, 0.16), rgba(43, 118, 233, 0) 62%),
    linear-gradient(180deg, #0b1118 0%, #070c12 100%) !important;
}

body[data-theme="dark"] #view-workspace .panel-card--planner,
body[data-theme="dark"] #view-workspace .canvas-board,
body[data-theme="dark"] #view-workspace .bulk-modal__card {
  border-color: var(--tetris-line-strong) !important;
  background: var(--tetris-panel) !important;
  color: var(--tetris-ink) !important;
  box-shadow: var(--ops-shadow) !important;
}

body[data-theme="dark"] #view-workspace .panel-header,
body[data-theme="dark"] #view-workspace .canvas-header,
body[data-theme="dark"] #view-workspace .bulk-modal__header {
  border-color: var(--tetris-header-line) !important;
  background: var(--tetris-header-bg) !important;
}

body[data-theme="dark"] #view-workspace .panel-card--planner .panel-scroll,
body[data-theme="dark"] #view-workspace .canvas-board__footer,
body[data-theme="dark"] #view-workspace .canvas-zone-footer,
body[data-theme="dark"] #view-workspace .color-card--rail,
body[data-theme="dark"] #view-workspace .canvas-metric {
  border-color: var(--tetris-line-soft) !important;
  background: var(--tetris-panel-soft) !important;
  color: var(--tetris-ink) !important;
}

body[data-theme="dark"] #view-workspace .field input,
body[data-theme="dark"] #view-workspace .field-stepper__btn,
body[data-theme="dark"] #view-workspace .panel-actions--planner button,
body[data-theme="dark"] #view-workspace .panel-open-bulk,
body[data-theme="dark"] #view-workspace .canvas-action,
body[data-theme="dark"] #view-workspace .zone-btn,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn,
body[data-theme="dark"] #view-workspace .bulk-modal__textarea {
  border-color: var(--tetris-line) !important;
  background: #0d1520 !important;
  color: var(--tetris-ink) !important;
}

body[data-theme="dark"] #view-workspace #bayCanvas {
  --grid-line-major: rgba(148, 163, 184, 0.14);
  --grid-line-minor: rgba(148, 163, 184, 0.07);
  border-color: var(--tetris-line-strong) !important;
  background:
    linear-gradient(rgba(13, 21, 32, 0.9), rgba(13, 21, 32, 0.9)),
    linear-gradient(90deg, var(--grid-line-minor) 1px, transparent 1px),
    linear-gradient(0deg, var(--grid-line-minor) 1px, transparent 1px),
    linear-gradient(180deg, #111a24 0%, #0d1520 100%) !important;
}

body[data-theme="dark"] #view-workspace .ruler-frame .ruler-corner,
body[data-theme="dark"] #view-workspace .ruler-frame .ruler-x,
body[data-theme="dark"] #view-workspace .ruler-frame .ruler-y {
  background: #111a24 !important;
}

body[data-theme="dark"] #view-workspace .canvas-metric__value,
body[data-theme="dark"] #view-workspace .color-card--rail .color-card__header strong,
body[data-theme="dark"] #view-workspace .admin-list__main strong {
  color: #eaf1f8 !important;
}

body[data-theme="dark"] #view-admin.admin-view,
body[data-theme="dark"] #view-admin .admin-screen {
  background:
    radial-gradient(900px 420px at 50% -280px, rgba(43, 118, 233, 0.16), rgba(43, 118, 233, 0) 62%),
    linear-gradient(180deg, #0b1118 0%, #070c12 100%) !important;
  color: var(--ops-ink) !important;
}

body[data-theme="dark"] #view-admin .admin-hero {
  border-color: rgba(120, 174, 255, 0.22) !important;
  background: linear-gradient(180deg, #20354d 0%, #152438 100%) !important;
}

body[data-theme="dark"] #view-admin .admin-card,
body[data-theme="dark"] #view-admin .admin-company-editor,
body[data-theme="dark"] #view-admin .admin-company-tile,
body[data-theme="dark"] #view-admin .admin-list__item,
body[data-theme="dark"] #view-admin .admin-mini-stat,
body[data-theme="dark"] #view-admin .admin-empty,
body[data-theme="dark"] #view-admin .admin-loading,
body[data-theme="dark"] #view-admin .admin-notice {
  border-color: var(--ops-line-soft) !important;
  background: var(--ops-panel) !important;
  color: var(--ops-ink) !important;
}

body[data-theme="dark"] #view-admin .admin-mini-stat,
body[data-theme="dark"] #view-admin .admin-list__item,
body[data-theme="dark"] #view-admin .admin-company-tile {
  background: var(--ops-panel-soft) !important;
}

body[data-theme="dark"] #view-admin .admin-card h3,
body[data-theme="dark"] #view-admin .admin-company-tile__title,
body[data-theme="dark"] #view-admin .admin-list__main strong,
body[data-theme="dark"] #view-admin .admin-company-editor__head strong,
body[data-theme="dark"] #view-admin .admin-mini-stat strong {
  color: #eaf1f8 !important;
}

body[data-theme="dark"] #view-admin .orders-filter__input,
body[data-theme="dark"] #view-admin .ghost-button {
  border-color: var(--ops-line) !important;
  background: #0d1520 !important;
  color: var(--ops-ink) !important;
}

body[data-theme="dark"] #view-admin .ghost-button:hover,
body[data-theme="dark"] #view-admin .admin-company-tile:hover {
  border-color: rgba(120, 174, 255, 0.34) !important;
  background: rgba(43, 118, 233, 0.16) !important;
  color: #dbeafe !important;
}

body[data-theme="dark"] #view-admin .admin-company-tile.is-active {
  border-color: rgba(120, 174, 255, 0.34) !important;
  background: rgba(43, 118, 233, 0.16) !important;
}

body[data-theme="dark"] #view-admin .danger-button,
body[data-theme="dark"] #view-admin .ghost-button.danger-button {
  border-color: rgba(220, 38, 38, 0.28) !important;
  background: rgba(220, 38, 38, 0.12) !important;
  color: #fca5a5 !important;
}

/* Dark theme visual polish: graphite-blue surfaces, no white islands. */
body[data-theme="dark"] .topbar {
  border-bottom-color: rgba(169, 186, 207, 0.12) !important;
  background: linear-gradient(180deg, #121c27 0%, #0f1720 100%) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03) !important;
}

body[data-theme="dark"] .topbar__module-nav,
body[data-theme="dark"] .grouped,
body[data-theme="dark"] .pill-button--avatar-only {
  border-color: rgba(169, 186, 207, 0.16) !important;
  background: rgba(24, 36, 51, 0.82) !important;
}

body[data-theme="dark"] #view-templates .orders-board {
  overflow: hidden !important;
  border-color: rgba(169, 186, 207, 0.2) !important;
  background: #182433 !important;
}

body[data-theme="dark"] #view-templates .orders-board__toolbar {
  background:
    radial-gradient(700px 180px at 50% -120px, rgba(96, 165, 250, 0.16), transparent 68%),
    linear-gradient(180deg, #263d57 0%, #1d3045 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-board__actions .ghost-button,
body[data-theme="dark"] #view-templates .orders-board__actions .primary {
  min-height: 38px !important;
  border-color: rgba(169, 186, 207, 0.24) !important;
  box-shadow: 0 12px 22px -18px rgba(0, 0, 0, 0.54) !important;
}

body[data-theme="dark"] #view-templates .orders-board__actions .ghost-button {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #e3eefb !important;
}

body[data-theme="dark"] #view-templates .orders-search,
body[data-theme="dark"] #view-templates .orders-board__search {
  border-color: rgba(169, 186, 207, 0.3) !important;
  background: rgba(20, 32, 45, 0.96) !important;
  box-shadow: 0 10px 20px -18px rgba(0, 0, 0, 0.5) !important;
}

body[data-theme="dark"] #view-templates .orders-search input,
body[data-theme="dark"] #view-templates .orders-board__search input {
  background: transparent !important;
  color: var(--orders-surface-ink) !important;
}

body[data-theme="dark"] #view-templates .orders-filter--search .orders-filter__input {
  border-color: rgba(169, 186, 207, 0.28) !important;
  background-color: rgba(20, 32, 45, 0.96) !important;
  color: var(--orders-surface-ink) !important;
  box-shadow: 0 10px 20px -18px rgba(0, 0, 0, 0.5) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a9bad0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") !important;
}

body[data-theme="dark"] #view-templates .orders-filter--search .orders-filter__input::placeholder {
  color: #9cadc0 !important;
}

body[data-theme="dark"] #view-templates .orders-machine-tabs {
  border-bottom-color: rgba(169, 186, 207, 0.14) !important;
  background:
    linear-gradient(180deg, rgba(30, 44, 60, 0.98) 0%, rgba(24, 36, 51, 0.98) 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-machine-tabs__scroller {
  scrollbar-color: rgba(169, 186, 207, 0.28) transparent;
}

body[data-theme="dark"] #view-templates .orders-machine-card,
body[data-theme="dark"] #view-templates .orders-machine-tab-action {
  border-color: rgba(169, 186, 207, 0.15) !important;
  background: linear-gradient(180deg, #223346 0%, #1b2a3a 100%) !important;
  color: #d7e4f2 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 18px -18px rgba(0, 0, 0, 0.75) !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card:hover,
body[data-theme="dark"] #view-templates .orders-machine-tab-action:hover {
  border-color: rgba(142, 194, 255, 0.32) !important;
  background: linear-gradient(180deg, #263a50 0%, #203247 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card.is-active,
body[data-theme="dark"] #view-templates .orders-machine-card[aria-pressed="true"] {
  border-color: rgba(142, 194, 255, 0.44) !important;
  background:
    radial-gradient(180px 90px at 18% 0%, rgba(96, 165, 250, 0.2), transparent 72%),
    linear-gradient(180deg, #26415f 0%, #203552 100%) !important;
  color: #f3f8ff !important;
  box-shadow: inset 0 0 0 1px rgba(142, 194, 255, 0.12), inset 4px 0 0 #448eff, 0 12px 22px -18px rgba(0, 0, 0, 0.78) !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card__plate,
body[data-theme="dark"] #view-templates .orders-machine-card__truck {
  color: #edf6ff !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card__status {
  color: #a9bad0 !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card__status--route {
  color: #9be7c7 !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card__count {
  background: rgba(215, 228, 242, 0.1) !important;
  color: #d7e4f2 !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card.is-active .orders-machine-card__count {
  background: rgba(142, 194, 255, 0.22) !important;
  color: #eef7ff !important;
}

body[data-theme="dark"] #view-templates .orders-machine-card--create {
  border-style: dashed !important;
  color: #d7e4f2 !important;
}

body[data-theme="dark"] #view-templates .orders-machine-tab-action--danger {
  border-color: rgba(248, 113, 113, 0.24) !important;
  background: rgba(127, 29, 29, 0.2) !important;
  color: #fca5a5 !important;
}

body[data-theme="dark"] #view-templates .orders-table-wrap {
  border-top: 1px solid rgba(169, 186, 207, 0.12) !important;
  background:
    radial-gradient(900px 360px at 50% 0%, rgba(96, 165, 250, 0.055), transparent 70%),
    linear-gradient(180deg, #152231 0%, #121c27 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__head {
  background: linear-gradient(180deg, #203047 0%, #192638 100%) !important;
  color: #aebdd0 !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.has-route-group {
  background:
    linear-gradient(90deg, hsl(var(--route-hue, 152) 32% 20%) 0%, hsl(var(--route-hue, 152) 25% 18%) 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.has-route-group:hover {
  background:
    linear-gradient(90deg, hsl(var(--route-hue, 152) 34% 23%) 0%, hsl(var(--route-hue, 152) 27% 21%) 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__row.has-route-group.is-selected,
body[data-theme="dark"] #view-templates .orders-table__row.has-route-group.is-route-selected {
  background:
    linear-gradient(90deg, hsl(var(--route-hue, 152) 36% 25%) 0%, hsl(var(--route-hue, 152) 28% 22%) 100%) !important;
}

body[data-theme="dark"] #view-templates .orders-table__cell {
  border-bottom-color: rgba(169, 186, 207, 0.15) !important;
  border-right-color: rgba(169, 186, 207, 0.12) !important;
}

body[data-theme="dark"] #view-templates .orders-table__link--map {
  background: rgba(68, 142, 255, 0.13) !important;
  color: #dbeafe !important;
}

body[data-theme="dark"] #view-templates .orders-table__row-action {
  background: rgba(68, 142, 255, 0.11) !important;
}

body[data-theme="dark"] #view-workspace.workspace,
body[data-theme="dark"] #view-admin .admin-screen {
  background:
    radial-gradient(1000px 500px at 50% -330px, rgba(68, 142, 255, 0.15), rgba(68, 142, 255, 0) 64%),
    linear-gradient(180deg, #121c27 0%, #101821 100%) !important;
}

/* Typography polish: calmer weights for long daily-use screens. */
#view-workspace,
#view-templates,
#view-admin {
  --ui-weight-strong: 760;
  --ui-weight-title: 730;
  --ui-weight-body-strong: 650;
  --ui-weight-control: 690;
  --ui-weight-label: 640;
}

.topbar__brand {
  font-weight: 760 !important;
  letter-spacing: 0.06em !important;
}

.topbar__brand-subtitle {
  font-weight: 560 !important;
  letter-spacing: 0.08em !important;
}

.topbar-nav-button,
.zoom-button,
.zoom-indicator,
.pill-button,
.ghost-button,
.primary {
  font-weight: var(--ui-weight-control) !important;
}

#view-workspace .panel-header h2,
#view-workspace .canvas-header h2,
#view-admin .admin-hero h2,
#view-templates .orders-board__title {
  font-weight: var(--ui-weight-title) !important;
  letter-spacing: -0.04em !important;
  text-shadow: none !important;
}

#view-workspace .panel-header h2 {
  font-size: 20px !important;
}

#view-workspace .canvas-header h2 {
  font-size: clamp(23px, 1.7vw, 29px) !important;
}

#view-admin .admin-hero h2,
#view-templates .orders-board__title {
  font-size: clamp(24px, 1.7vw, 30px) !important;
}

#view-workspace .panel-header p,
#view-workspace .canvas-header p,
#view-admin .admin-hero p,
#view-templates .orders-board__subtitle {
  font-weight: 560 !important;
}

#view-workspace .field label,
#view-workspace .canvas-metric__label,
#view-workspace .color-card--rail .bulk-hint,
#view-admin .admin-overview__label,
#view-admin .admin-mini-stat__label,
#view-templates .orders-table__head,
#view-templates .orders-machine-card__status,
#view-templates .orders-filter__label,
#view-templates .orders-form__label,
#view-templates .orders-route-setup__label {
  font-weight: var(--ui-weight-label) !important;
}

#view-workspace .field input,
#view-admin .orders-filter__input,
#view-templates .orders-filter__input,
#view-templates .orders-form__input,
#view-templates .orders-route-setup__field input,
#view-templates .orders-route-setup__field select {
  font-weight: 580 !important;
}

#view-workspace .panel-actions--planner button,
#view-workspace .panel-open-bulk,
#view-workspace .canvas-action,
#view-workspace .zone-btn,
#view-workspace .canvas-footer-actions .canvas-reset-btn,
#view-workspace .canvas-footer-actions .canvas-quickadd-btn,
#view-admin .primary,
#view-admin .ghost-button,
#view-templates .orders-board__actions .ghost-button,
#view-templates .orders-board__actions .primary,
#view-templates .orders-machine-card,
#view-templates .orders-machine-tab-action,
#view-templates .orders-table__link--map,
#view-templates .orders-table__doc-chip,
#view-templates .orders-table__payment-term {
  font-weight: var(--ui-weight-control) !important;
}

#view-workspace .canvas-metric__value,
#view-admin .admin-overview__value,
#view-admin .admin-mini-stat strong {
  font-weight: var(--ui-weight-strong) !important;
}

#view-workspace .canvas-metric__value {
  font-size: 25px !important;
  letter-spacing: -0.035em !important;
}

#view-workspace .canvas-quickadd-btn__title {
  font-size: 19px !important;
  font-weight: var(--ui-weight-strong) !important;
}

#view-workspace .color-card--rail .color-card__header strong,
#view-admin .admin-card h3,
#view-admin .admin-company-tile__title,
#view-admin .admin-list__main strong,
#view-admin .admin-company-editor__head strong,
#view-templates .orders-table__order-num,
#view-templates .orders-table__date,
#view-templates .orders-table__date-main,
#view-templates .orders-table__location-place,
#view-templates .orders-table__party-name,
#view-templates .orders-table__money,
#view-templates .orders-table__km,
#view-templates .orders-route-summary__place,
#view-templates .orders-machine-card__plate {
  font-weight: var(--ui-weight-body-strong) !important;
}

#view-admin .admin-card h3 {
  font-size: 20px !important;
}

#view-templates .orders-machine-card__plate {
  font-size: 13px !important;
  letter-spacing: -0.01em !important;
}

#view-templates .orders-machine-card__count {
  font-weight: var(--ui-weight-control) !important;
}

#view-templates .orders-table__money,
#view-templates .orders-table__km {
  font-size: 14px !important;
}

#view-templates .orders-table__order-sub,
#view-templates .orders-table__party-meta,
#view-templates .orders-table__date-sub,
#view-templates .orders-table__location-meta,
#view-templates .orders-route-summary__meta {
  font-weight: 620 !important;
}

/* Typography softening: make the dark working UI calmer and less shouty. */
:root {
  --trucken-ui-font: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --trucken-title-weight: 650;
  --trucken-strong-weight: 640;
  --trucken-control-weight: 600;
  --trucken-label-weight: 580;
}

body,
button,
input,
select,
textarea {
  font-family: var(--trucken-ui-font) !important;
}

.topbar__brand {
  font-weight: 720 !important;
  letter-spacing: 0.055em !important;
}

.topbar__brand-subtitle {
  font-weight: 500 !important;
  letter-spacing: 0.075em !important;
}

.topbar-nav-button,
.zoom-button,
.zoom-indicator,
.topbar__theme,
.account-theme-btn,
.pill-button,
.ghost-button,
.primary {
  font-weight: var(--trucken-control-weight) !important;
}

#view-workspace .panel-header h2,
#view-workspace .canvas-header h2,
#view-admin .admin-hero h2,
#view-templates .orders-board__title {
  font-family: var(--trucken-ui-font) !important;
  font-weight: var(--trucken-title-weight) !important;
  letter-spacing: -0.025em !important;
  text-shadow: none !important;
}

#view-workspace .panel-header h2 {
  font-size: 19px !important;
}

#view-workspace .canvas-header h2 {
  font-size: clamp(22px, 1.55vw, 27px) !important;
}

#view-workspace .panel-header p,
#view-workspace .canvas-header p,
#view-admin .admin-hero p,
#view-templates .orders-board__subtitle {
  font-weight: 500 !important;
}

#view-workspace .field label,
#view-workspace .canvas-metric__label,
#view-workspace .color-card--rail .bulk-hint,
#view-admin .admin-overview__label,
#view-admin .admin-mini-stat__label,
#view-templates .orders-table__head,
#view-templates .orders-machine-card__status,
#view-templates .orders-filter__label,
#view-templates .orders-form__label,
#view-templates .orders-route-setup__label {
  font-weight: var(--trucken-label-weight) !important;
  letter-spacing: 0.045em !important;
}

#view-workspace .field input,
#view-admin .orders-filter__input,
#view-templates .orders-filter__input,
#view-templates .orders-form__input,
#view-templates .orders-route-setup__field input,
#view-templates .orders-route-setup__field select {
  font-weight: 500 !important;
}

#view-workspace .panel-actions--planner button,
#view-workspace .panel-open-bulk,
#view-workspace .canvas-action,
#view-workspace .zone-btn,
#view-workspace .canvas-footer-actions .canvas-reset-btn,
#view-workspace .canvas-footer-actions .canvas-quickadd-btn,
#view-admin .primary,
#view-admin .ghost-button,
#view-templates .orders-board__actions .ghost-button,
#view-templates .orders-board__actions .primary,
#view-templates .orders-machine-card,
#view-templates .orders-machine-tab-action,
#view-templates .orders-table__link--map,
#view-templates .orders-table__doc-chip,
#view-templates .orders-table__payment-term {
  font-weight: var(--trucken-control-weight) !important;
}

#view-workspace .canvas-metric__value,
#view-admin .admin-overview__value,
#view-admin .admin-mini-stat strong {
  font-weight: 650 !important;
  letter-spacing: -0.025em !important;
}

#view-workspace .canvas-metric__value {
  font-size: 23px !important;
}

#view-workspace .canvas-quickadd-btn__title {
  font-size: 18px !important;
  font-weight: 650 !important;
  letter-spacing: -0.015em !important;
}

#view-workspace .canvas-quickadd-btn__meta,
#view-workspace .canvas-footer-actions .canvas-reset-btn {
  font-weight: var(--trucken-control-weight) !important;
}

#view-workspace .color-card--rail .color-card__header strong,
#view-admin .admin-card h3,
#view-admin .admin-company-tile__title,
#view-admin .admin-list__main strong,
#view-admin .admin-company-editor__head strong,
#view-templates .orders-table__order-num,
#view-templates .orders-table__date,
#view-templates .orders-table__date-main,
#view-templates .orders-table__location-place,
#view-templates .orders-table__party-name,
#view-templates .orders-table__money,
#view-templates .orders-table__km,
#view-templates .orders-route-summary__place,
#view-templates .orders-machine-card__plate {
  font-weight: var(--trucken-strong-weight) !important;
}

#view-workspace .label,
#view-workspace .measure-label {
  font-weight: 560 !important;
}

#view-workspace .pallet .size,
#view-workspace .pallet .weight,
#view-templates .orders-table__order-sub,
#view-templates .orders-table__party-meta,
#view-templates .orders-table__date-sub,
#view-templates .orders-table__location-meta,
#view-templates .orders-route-summary__meta {
  font-weight: 520 !important;
}

/* Final dark-mode typography authority for Tetris. */
body[data-theme="dark"] #view-workspace .panel-header h2,
body[data-theme="dark"] #view-workspace .canvas-header h2 {
  font-family: var(--trucken-ui-font) !important;
  font-weight: var(--trucken-title-weight) !important;
  letter-spacing: -0.025em !important;
  text-shadow: none !important;
}

body[data-theme="dark"] #view-workspace .panel-header h2 {
  font-size: 19px !important;
}

body[data-theme="dark"] #view-workspace .canvas-header h2 {
  font-size: clamp(22px, 1.55vw, 27px) !important;
}

body[data-theme="dark"] #view-workspace .field label,
body[data-theme="dark"] #view-workspace .canvas-metric__label,
body[data-theme="dark"] #view-workspace .color-card--rail .bulk-hint {
  font-weight: var(--trucken-label-weight) !important;
  letter-spacing: 0.045em !important;
}

body[data-theme="dark"] #view-workspace .field input {
  font-weight: 500 !important;
}

body[data-theme="dark"] #view-workspace .panel-actions--planner button,
body[data-theme="dark"] #view-workspace .panel-open-bulk,
body[data-theme="dark"] #view-workspace .canvas-action,
body[data-theme="dark"] #view-workspace .zone-btn,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn {
  font-weight: var(--trucken-control-weight) !important;
}

body[data-theme="dark"] #view-workspace .canvas-metric__value {
  font-size: 23px !important;
  font-weight: 650 !important;
  letter-spacing: -0.025em !important;
}

body[data-theme="dark"] #view-workspace .canvas-quickadd-btn__title {
  font-size: 18px !important;
  font-weight: 650 !important;
  letter-spacing: -0.015em !important;
}

body[data-theme="dark"] #view-workspace .canvas-quickadd-btn__meta,
body[data-theme="dark"] #view-workspace .canvas-footer-actions .canvas-reset-btn {
  font-weight: var(--trucken-control-weight) !important;
}

body[data-theme="dark"] #view-workspace .color-card--rail .color-card__header strong {
  font-weight: var(--trucken-strong-weight) !important;
}

body[data-theme="dark"] #view-workspace .label,
body[data-theme="dark"] #view-workspace .measure-label {
  border-color: rgba(142, 194, 255, 0.38) !important;
  background:
    linear-gradient(180deg, rgba(43, 63, 86, 0.98) 0%, rgba(30, 45, 63, 0.98) 100%) !important;
  color: #e8f2ff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 14px -10px rgba(0, 0, 0, 0.9) !important;
  text-shadow: none !important;
  font-size: 11px !important;
  font-weight: 560 !important;
}

body[data-theme="dark"] #view-workspace .pallet .size,
body[data-theme="dark"] #view-workspace .pallet .weight {
  font-weight: 520 !important;
}

/* Wide order card: closer to the page-like reference layout on desktop. */
@media (min-width: 861px) {
  #view-templates .orders-crm.is-detail-open .orders-drawer-backdrop {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  #view-templates .orders-crm.is-detail-open .orders-screen-preview {
    display: none !important;
  }

  #view-templates .orders-drawer {
    top: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    left: clamp(240px, 24vw, 520px) !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 18px 44px -28px rgba(15, 23, 42, 0.34) !important;
  }

  body[data-theme="dark"] #view-templates .orders-drawer {
    background: #111c2a !important;
  }

  #view-templates .orders-detail {
    height: 100% !important;
    overflow: hidden !important;
  }

  #view-templates .orders-detail__inner {
    display: grid !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    gap: 8px !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 12px 16px !important;
  }

  #view-templates .orders-detail__inner::after {
    display: none !important;
  }

  #view-templates .orders-detail__inner--empty {
    display: flex !important;
  }

  #view-templates .orders-detail__header {
    align-items: flex-start !important;
    padding: 4px 0 10px !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe7f0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #111827 !important;
    box-shadow: none !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail__header {
    border-color: rgba(148, 163, 184, 0.18) !important;
    background: transparent !important;
    color: #eaf1f8 !important;
  }

  #view-templates .orders-detail__header h2 {
    margin: 0 0 3px !important;
    color: #0b7899 !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail__header h2 {
    color: #8bd7ff !important;
  }

  #view-templates .orders-detail__header p {
    max-width: 86ch !important;
    margin: 0 !important;
    overflow: hidden !important;
    color: #5d6b7c !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #view-templates .orders-detail__headline-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 18px !important;
    margin-top: 8px !important;
    color: #334155 !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  #view-templates .orders-detail__headline-meta span {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    max-width: min(34ch, 100%) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #view-templates .orders-detail__headline-meta small {
    color: #7b8797 !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-transform: uppercase !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail__headline-meta {
    color: #c8d6e7 !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail__headline-meta small {
    color: #93a4b8 !important;
  }

  #view-templates .orders-detail__actions {
    gap: 6px !important;
  }

  #view-templates .orders-detail .ghost-button {
    min-height: 30px !important;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
  }

  #view-templates .orders-detail__meta {
    min-height: 18px !important;
    gap: 6px 10px !important;
  }

  #view-templates .orders-detail__meta .orders-muted {
    font-size: 11px !important;
  }

  #view-templates .orders-detail-tabs {
    position: static !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 18px !important;
    margin: 0 !important;
    padding: 0 0 6px !important;
    overflow-x: auto !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe7f0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    scrollbar-width: none !important;
  }

  #view-templates .orders-detail-tabs::-webkit-scrollbar {
    display: none !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail-tabs {
    border-color: rgba(148, 163, 184, 0.18) !important;
    background: transparent !important;
  }

  #view-templates .orders-detail-tabs__button {
    position: relative !important;
    flex: 0 0 auto !important;
    min-height: 32px !important;
    min-width: 0 !important;
    padding: 0 0 7px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #26364a !important;
    box-shadow: none !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
  }

  #view-templates .orders-detail-tabs__button::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -7px;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: transparent;
  }

  #view-templates .orders-detail-tabs__button:hover,
  #view-templates .orders-detail-tabs__button.is-active {
    background: transparent !important;
    color: #087ea4 !important;
  }

  #view-templates .orders-detail-tabs__button.is-active::after {
    background: #0b87aa;
  }

  body[data-theme="dark"] #view-templates .orders-detail-tabs__button {
    background: transparent !important;
    color: #dbeafe !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail-tabs__button:hover,
  body[data-theme="dark"] #view-templates .orders-detail-tabs__button.is-active {
    background: transparent !important;
    color: #8bd7ff !important;
  }

  body[data-theme="dark"] #view-templates .orders-detail-tabs__button.is-active::after {
    background: #8bd7ff;
  }

  #view-templates .orders-detail-tabs__button strong {
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    background: #e8f2ff !important;
    color: #0b7899 !important;
    font-size: 9px !important;
  }

  #view-templates .orders-detail-section-stack {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #view-templates .orders-detail-section {
    height: 100% !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding-right: 2px !important;
  }

  #view-templates .orders-detail-section[data-detail-section-panel="billing"] {
    overflow: hidden !important;
  }

  #view-templates .orders-detail-section__intro {
    display: none !important;
  }

  #view-templates .orders-panel,
  #view-templates .orders-billing-readiness,
  #view-templates .orders-billing-type-panel,
  #view-templates .orders-billing-builder__card,
  #view-templates .orders-billing-order-fields,
  #view-templates .orders-billing-list__item,
  #view-templates .orders-billing-preview-summary,
  #view-templates .orders-billing-builder__section,
  #view-templates .orders-billing-type-card,
  #view-templates .orders-billing-readiness__card {
    border-radius: 8px !important;
  }

  #view-templates .orders-billing-workspace {
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    height: 100% !important;
    min-height: 0 !important;
    gap: 10px !important;
    overflow: hidden !important;
  }

  #view-templates .orders-billing-readiness {
    gap: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #view-templates .orders-billing-readiness__header {
    display: none !important;
  }

  #view-templates .orders-billing-readiness__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #view-templates .orders-billing-readiness__card {
    min-height: 82px !important;
    padding: 10px !important;
    background: #ffffff !important;
  }

  body[data-theme="dark"] #view-templates .orders-billing-readiness__card {
    background: rgba(24, 36, 51, 0.94) !important;
  }

  #view-templates .orders-billing-readiness__card small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  #view-templates .orders-billing-workspace__grid {
    grid-template-columns: minmax(250px, 0.36fr) minmax(0, 1fr) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    align-items: stretch !important;
  }

  #view-templates .orders-billing-workspace.is-building .orders-billing-workspace__grid {
    grid-template-columns: minmax(210px, 0.24fr) minmax(0, 1fr) !important;
  }

  #view-templates .orders-billing-doc-history,
  #view-templates .orders-billing-create,
  #view-templates .orders-billing-builder,
  #view-templates .orders-billing-builder__card {
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  #view-templates .orders-billing-doc-history .orders-panel--billing {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  #view-templates .orders-billing-doc-history .orders-panel__header {
    min-height: 24px !important;
    padding-bottom: 6px !important;
  }

  #view-templates .orders-billing-list {
    min-height: 0 !important;
    overflow: auto !important;
    padding-right: 2px !important;
  }

  #view-templates .orders-billing-list__item {
    gap: 8px !important;
    padding: 10px !important;
  }

  #view-templates .orders-billing-actions {
    gap: 5px !important;
    margin-top: 6px !important;
  }

  #view-templates .orders-billing-actions .ghost-button,
  #view-templates .orders-doc-card__actions a,
  #view-templates .orders-doc-card__actions button {
    min-height: 26px !important;
    padding: 0 8px !important;
    border-radius: 7px !important;
    font-size: 11px !important;
  }

  #view-templates .orders-billing-type-panel {
    align-content: start !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 12px !important;
    overflow: auto !important;
  }

  #view-templates .orders-billing-type-panel__header {
    align-items: flex-start !important;
  }

  #view-templates .orders-billing-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #view-templates .orders-billing-type-card {
    min-height: 104px !important;
    padding: 12px !important;
  }

  #view-templates .orders-billing-builder__card {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-builder__header {
    grid-row: 1 !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-alert {
    grid-row: 2 !important;
    margin: 10px 12px 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 4px 10px !important;
    align-items: center !important;
    max-height: 72px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-alert strong,
  #view-templates .orders-billing-builder__card > .orders-billing-alert div {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-alert .orders-inline-action {
    grid-column: 2 !important;
    grid-row: 1 / span 2 !important;
    min-height: 30px !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-alert {
    display: none !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-builder__layout {
    grid-row: 3 !important;
  }

  #view-templates .orders-billing-builder__card > .orders-billing-builder__footer {
    grid-row: 4 !important;
  }

  #view-templates .orders-billing-builder__header,
  #view-templates .orders-billing-builder__footer {
    padding: 10px 12px !important;
  }

  #view-templates .orders-billing-builder__header h3 {
    font-size: 14px !important;
  }

  #view-templates .orders-billing-builder__header p {
    font-size: 11px !important;
  }

  #view-templates .orders-billing-builder__layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr) !important;
    gap: 10px !important;
    min-height: 0 !important;
    padding: 10px !important;
    overflow: hidden !important;
  }

  #view-templates .orders-billing-builder__main,
  #view-templates .orders-billing-preview-summary {
    min-height: 0 !important;
    height: 100% !important;
    overflow: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(99, 116, 139, 0.36) transparent !important;
  }

  #view-templates .orders-billing-builder__main::-webkit-scrollbar,
  #view-templates .orders-billing-preview-summary::-webkit-scrollbar,
  #view-templates .orders-billing-list::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
  }

  #view-templates .orders-billing-builder__main::-webkit-scrollbar-thumb,
  #view-templates .orders-billing-preview-summary::-webkit-scrollbar-thumb,
  #view-templates .orders-billing-list::-webkit-scrollbar-thumb {
    border-radius: 999px !important;
    background: rgba(99, 116, 139, 0.28) !important;
  }

  #view-templates .orders-billing-builder__main::-webkit-scrollbar-track,
  #view-templates .orders-billing-preview-summary::-webkit-scrollbar-track,
  #view-templates .orders-billing-list::-webkit-scrollbar-track {
    background: transparent !important;
  }

  #view-templates .orders-billing-builder__main::-webkit-scrollbar-button,
  #view-templates .orders-billing-preview-summary::-webkit-scrollbar-button,
  #view-templates .orders-billing-list::-webkit-scrollbar-button {
    display: none !important;
  }

  #view-templates .orders-billing-builder__main {
    padding-right: 2px !important;
  }

  #view-templates .orders-billing-builder__section {
    gap: 8px !important;
    padding: 10px !important;
  }

  #view-templates .orders-billing-builder .orders-billing-modal__grid,
  #view-templates .orders-billing-builder__grid {
    gap: 8px !important;
  }

  #view-templates .orders-billing-builder .orders-form__input,
  #view-templates .orders-billing-builder select.orders-form__input {
    min-height: 34px !important;
  }

  #view-templates .orders-billing-preview-summary {
    align-content: start !important;
    padding: 10px !important;
  }

  #view-templates .orders-billing-preview-summary .orders-billing-preview__summary {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #view-templates .orders-billing-preview__summary div {
    padding: 9px 10px !important;
    border-radius: 8px !important;
  }

  #view-templates .orders-billing-order-fields {
    max-height: 46px !important;
    overflow: hidden !important;
    padding: 10px 12px !important;
  }

  #view-templates .orders-billing-order-fields[open] {
    max-height: min(280px, 34vh) !important;
    overflow: auto !important;
  }
}

/* Account popover must stay attached to the top-right corner, not behave like a side drawer. */
.account-drawer {
  right: var(--account-drawer-right, 16px) !important;
  left: auto !important;
  width: min(300px, calc(100vw - 24px)) !important;
  max-height: min(420px, var(--account-drawer-max-height, calc(100vh - 72px))) !important;
  transform-origin: top right !important;
}

.account-drawer.is-settings-open {
  top: 24px !important;
  right: 24px !important;
  width: min(1080px, calc(100vw - 48px)) !important;
  max-height: calc(100vh - 48px) !important;
  border-radius: 16px !important;
}

.account-drawer__content {
  max-height: inherit !important;
  overflow-y: auto !important;
}

.account-drawer.is-settings-open .account-drawer__content {
  padding: 12px !important;
}

@media (max-width: 520px) {
  .account-drawer {
    width: calc(100vw - 24px) !important;
  }

  .account-drawer.is-settings-open {
    top: 12px !important;
    right: 12px !important;
    width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
  }

  .account-settings__grid {
    grid-template-columns: 1fr;
  }

  .account-settings__stamp {
    grid-template-columns: 1fr;
  }

  .account-settings__footer {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Mobile adaptation: compact shell, stacked work areas, inner scrolling for dense tools. */
@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden !important;
  }

  body {
    min-width: 0 !important;
  }

  .app-main,
  .app-shell.is-sidebar-open .app-main {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .topbar,
  body[data-active-view="templates"] .topbar,
  body[data-active-view="templates"][data-theme="dark"] .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 90 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand actions"
      "nav nav" !important;
    align-items: center !important;
    min-height: 0 !important;
    height: auto !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 10px !important;
    gap: 8px !important;
  }

  .topbar__lead {
    display: contents !important;
  }

  .topbar__brandblock {
    grid-area: brand !important;
    min-width: 0 !important;
  }

  .topbar__brand {
    font-size: 20px !important;
    line-height: 1 !important;
    letter-spacing: 0.08em !important;
  }

  .topbar__brand-subtitle {
    margin-top: 2px !important;
    font-size: 9px !important;
  }

  .topbar__module-nav {
    grid-area: nav !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 42px !important;
    padding: 4px !important;
    gap: 4px !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    scrollbar-width: none !important;
    border-radius: 16px !important;
  }

  .topbar__module-nav::-webkit-scrollbar {
    display: none !important;
  }

  .topbar-nav-button {
    flex: 1 0 auto !important;
    min-width: max-content !important;
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    line-height: 1 !important;
  }

  .topbar__actions,
  body[data-active-view="templates"] .topbar__actions {
    grid-area: actions !important;
    position: static !important;
    justify-self: end !important;
    align-self: center !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    gap: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  #topbarWorkspaceControls {
    display: none !important;
  }

  .topbar__theme,
  .pill-button--avatar-only,
  #accountButton {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 12px !important;
  }

  .pill-button--avatar-only .avatar,
  #accountButton .avatar {
    width: 100% !important;
    height: 100% !important;
    font-size: 13px !important;
  }

  .company-context-banner {
    margin: 8px 10px 0 !important;
    border-radius: 14px !important;
  }

  .account-drawer {
    top: var(--account-drawer-top, 58px) !important;
    right: 8px !important;
    width: calc(100vw - 16px) !important;
    max-height: min(520px, calc(100dvh - 72px)) !important;
    border-radius: 18px !important;
  }

  #view-workspace.workspace,
  body[data-theme="dark"] #view-workspace.workspace {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    min-height: auto !important;
    padding: 10px !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  #view-workspace .workspace__canvas {
    order: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #view-workspace .workspace__panel {
    order: 2 !important;
    min-width: 0 !important;
  }

  #view-workspace .panel-card--planner,
  body[data-theme="dark"] #view-workspace .panel-card--planner,
  #view-workspace .canvas-board,
  body[data-theme="dark"] #view-workspace .canvas-board {
    border-radius: 18px !important;
  }

  #view-workspace .panel-header,
  body[data-theme="dark"] #view-workspace .panel-header,
  #view-workspace .canvas-header,
  body[data-theme="dark"] #view-workspace .canvas-header {
    padding: 14px 16px !important;
  }

  #view-workspace .canvas-header h2,
  body[data-theme="dark"] #view-workspace .canvas-header h2 {
    font-size: 24px !important;
  }

  #view-workspace .panel-header h2,
  body[data-theme="dark"] #view-workspace .panel-header h2 {
    font-size: 18px !important;
  }

  #view-workspace .canvas-board,
  body[data-theme="dark"] #view-workspace .canvas-board {
    display: block !important;
    min-height: 560px !important;
    padding: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #view-workspace #stage,
  #view-workspace .ruler-frame {
    width: 680px !important;
    min-width: 680px !important;
    max-width: none !important;
  }

  #view-workspace #stage {
    min-height: 520px !important;
  }

  #view-workspace .canvas-board__footer,
  body[data-theme="dark"] #view-workspace .canvas-board__footer {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  #view-workspace .canvas-zone-footer,
  body[data-theme="dark"] #view-workspace .canvas-zone-footer {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  #view-workspace .canvas-actions,
  #view-workspace .canvas-zone-footer__actions,
  #view-workspace .canvas-footer-actions {
    display: flex !important;
    flex-wrap: wrap !important;
  }

  #view-workspace .zone-btn {
    flex: 1 1 84px !important;
  }

  #view-workspace .canvas-metrics {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #view-workspace .canvas-footer-actions .canvas-quickadd-btn {
    width: 100% !important;
    min-height: 58px !important;
  }

  #view-workspace .color-card--rail,
  body[data-theme="dark"] #view-workspace .color-card--rail {
    width: 100% !important;
  }

  #view-workspace .color-card--rail .color-row {
    justify-content: space-between !important;
  }

  #view-templates.orders-view,
  body[data-theme="dark"] #view-templates.orders-view {
    min-height: auto !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  #view-templates .orders-board,
  body[data-theme="dark"] #view-templates .orders-board {
    border-radius: 20px !important;
    overflow: hidden !important;
  }

  #view-templates .orders-board__toolbar,
  body[data-theme="dark"] #view-templates .orders-board__toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 16px !important;
    gap: 12px !important;
  }

  #view-templates .orders-board__title {
    font-size: 30px !important;
    line-height: 1 !important;
  }

  #view-templates .orders-board__subtitle {
    font-size: 13px !important;
  }

  #view-templates .orders-board__searchslot,
  #view-templates .orders-board__controls,
  #view-templates .orders-board__actions,
  #view-templates .orders-filter--search {
    width: 100% !important;
    max-width: none !important;
  }

  #view-templates .orders-board__actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #view-templates .orders-board__actions .ghost-button,
  #view-templates .orders-board__actions .primary {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    font-size: 14px !important;
  }

  #view-templates .orders-filter--search .orders-filter__input,
  #view-templates .orders-board__search input {
    min-height: 46px !important;
    font-size: 15px !important;
  }

  #view-templates .orders-machine-tabs,
  #view-templates .orders-machine-tabs__scroller {
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #view-templates .orders-machine-card {
    flex: 0 0 150px !important;
    min-width: 150px !important;
    min-height: 76px !important;
  }

  #view-templates .orders-machine-tab-action {
    flex: 0 0 92px !important;
    min-height: 76px !important;
  }

  #view-templates .orders-table-wrap {
    max-height: calc(100dvh - 340px) !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #view-templates .orders-table {
    min-width: 760px !important;
  }

  #view-templates .orders-table__head,
  #view-templates .orders-table__cell {
    padding: 10px 12px !important;
    font-size: 12px !important;
  }

  #view-templates .orders-table__row {
    min-height: 58px !important;
  }

  #view-admin .admin-screen,
  body[data-theme="dark"] #view-admin .admin-screen {
    min-height: auto !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  #view-admin .admin-layout,
  #view-admin .admin-workgrid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  #view-admin .admin-hero,
  body[data-theme="dark"] #view-admin .admin-hero,
  #view-admin .admin-card,
  body[data-theme="dark"] #view-admin .admin-card {
    border-radius: 20px !important;
    padding: 18px !important;
  }

  #view-admin .admin-hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  #view-admin .admin-hero h2 {
    font-size: 30px !important;
    line-height: 1.08 !important;
  }

  #view-admin .admin-hero p,
  #view-admin .admin-card__head p {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }

  #view-admin .admin-overview {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  #view-admin .admin-overview__card {
    min-height: 84px !important;
    padding: 14px 16px !important;
  }

  #view-admin .admin-overview__value {
    font-size: 34px !important;
  }

  #view-admin .admin-quicklink-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    padding: 14px !important;
  }

  #view-admin .admin-inline-form,
  #view-admin .admin-grid-form,
  #view-admin .admin-company-editor__head,
  #view-admin .admin-list__item,
  #view-admin .admin-list__actions,
  #view-admin .admin-company-tile__actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #view-admin .orders-filter__input,
  #view-admin .primary,
  #view-admin .ghost-button {
    width: 100% !important;
    min-height: 42px !important;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .topbar__brand {
    font-size: 18px !important;
  }

  .topbar-nav-button {
    padding: 0 10px !important;
    font-size: 11px !important;
  }

  #view-workspace.workspace,
  #view-templates.orders-view,
  #view-admin .admin-screen {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  #view-workspace #stage,
  #view-workspace .ruler-frame {
    width: 640px !important;
    min-width: 640px !important;
  }
}

/* Mobile correction: keep hidden views hidden and make topbar occupy real height. */
.view:not(.is-active) {
  display: none !important;
}

#view-workspace.view:not(.is-active),
#view-templates.view:not(.is-active),
#view-admin.view:not(.is-active) {
  display: none !important;
}

body #view-workspace.view:not(.is-active),
body #view-templates.view:not(.is-active),
body #view-admin.view:not(.is-active),
body[data-theme="dark"] #view-workspace.view:not(.is-active),
body[data-theme="dark"] #view-templates.view:not(.is-active),
body[data-theme="dark"] #view-admin.view:not(.is-active) {
  display: none !important;
}

@media (max-width: 720px) {
  .topbar,
  body[data-active-view="templates"] .topbar,
  body[data-active-view="templates"][data-theme="dark"] .topbar {
    display: block !important;
    min-height: 104px !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 10px !important;
  }

  .topbar__lead {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    min-width: 0 !important;
  }

  .topbar__brandblock {
    grid-area: auto !important;
    padding-right: 92px !important;
    transform: none !important;
  }

  .topbar__module-nav {
    grid-area: auto !important;
    margin: 8px 0 0 !important;
  }

  .topbar__actions,
  body[data-active-view="templates"] .topbar__actions {
    grid-area: auto !important;
    position: absolute !important;
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    right: 10px !important;
  }
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  .panel-help::after {
    display: none !important;
  }
}

@media (max-width: 720px) {
  #view-workspace,
  #view-templates,
  #view-admin,
  #view-admin .admin-screen,
  #view-admin .admin-hero,
  #view-admin .admin-card,
  #view-admin .admin-overview__card,
  #view-admin .admin-quicklink-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #view-admin .admin-hero,
  body[data-theme="dark"] #view-admin .admin-hero {
    padding: 16px !important;
  }

  #view-admin .admin-hero h2 {
    max-width: 100% !important;
    font-size: clamp(24px, 6.6vw, 28px) !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere !important;
  }

  #view-admin .admin-hero p,
  #view-admin .admin-card__head p {
    font-size: 14px !important;
  }

  #view-admin .admin-card__head h3,
  #view-admin .admin-quicklink-card h3 {
    font-size: 20px !important;
    line-height: 1.15 !important;
  }

  #view-templates .orders-drawer,
  #view-templates .orders-route-drawer {
    position: fixed !important;
    inset: auto !important;
    top: calc(112px + env(safe-area-inset-top, 0px)) !important;
    right: 8px !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
    height: calc(100dvh - 120px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-height: none !important;
    border-radius: 18px !important;
    z-index: 140 !important;
  }

  #view-templates .orders-drawer-backdrop,
  #view-templates .orders-route-backdrop,
  #view-templates .orders-modal__backdrop {
    z-index: 130 !important;
  }

  #view-templates .orders-detail,
  #view-templates .orders-route-detail {
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #view-templates .orders-route-drawer__inner {
    min-height: 100% !important;
    padding: 14px !important;
    gap: 10px !important;
  }

  #view-templates .orders-route-drawer__header {
    gap: 8px !important;
    margin-bottom: 0 !important;
    padding-bottom: 10px !important;
  }

  #view-templates .orders-route-drawer__header h3,
  #view-templates .orders-modal__title {
    font-size: 22px !important;
    line-height: 1.12 !important;
  }

  #view-templates .orders-route-drawer__titlebar,
  #view-templates .orders-route-setup__row,
  #view-templates .orders-route-result {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  #view-templates .orders-route-drawer__actions,
  #view-templates .orders-modal__actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #view-templates .orders-route-drawer__actions .ghost-button,
  #view-templates .orders-modal__actions .ghost-button,
  #view-templates .orders-modal__actions .primary {
    width: 100% !important;
    min-height: 40px !important;
    justify-content: center !important;
  }

  #view-templates .orders-route-setup,
  #view-templates .orders-route-section,
  #view-templates .orders-route-result,
  #view-templates .orders-panel {
    padding: 12px !important;
    border-radius: 16px !important;
  }

  #view-templates .orders-route-setup__field input,
  #view-templates .orders-route-setup__field select,
  #view-templates .orders-route-setup__fixed {
    min-height: 42px !important;
    font-size: 14px !important;
  }

  #view-templates .orders-route-avail-grid,
  #view-templates .orders-route-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #view-templates .orders-route-avail,
  #view-templates .orders-route-item {
    min-width: 0 !important;
    padding: 10px !important;
  }

  #view-templates .orders-route-item__body,
  #view-templates .orders-route-avail__body {
    min-width: 0 !important;
  }

  #view-templates .orders-route-result__badge,
  #view-templates .orders-route-result__km {
    justify-self: start !important;
  }

  #view-templates .orders-route-result__map {
    width: 100% !important;
    min-height: 40px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  #view-templates .orders-route-drawer__footer {
    position: sticky !important;
    bottom: -14px !important;
    margin: auto -14px -14px !important;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0), #f8fbff 22%, #f8fbff 100%) !important;
    border-top: 1px solid rgba(169, 186, 207, 0.34) !important;
  }

  body[data-theme="dark"] #view-templates .orders-route-drawer__footer {
    background: linear-gradient(180deg, rgba(17, 28, 42, 0), #111c2a 22%, #111c2a 100%) !important;
    border-top-color: rgba(148, 163, 184, 0.22) !important;
  }

  #view-templates .orders-route-drawer__footer .primary {
    width: 100% !important;
    min-height: 44px !important;
  }

  #view-templates .orders-modal {
    padding: 8px !important;
  }

  #view-templates .orders-modal__card {
    width: 100% !important;
    max-width: none !important;
    padding: 16px !important;
    border-radius: 18px !important;
  }
}
.orders-panel--recognition {
  border-color: rgba(56, 132, 255, 0.24) !important;
}

.orders-recognition-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 10px !important;
}

.orders-recognition-grid > div {
  display: grid !important;
  gap: 4px !important;
  min-width: 0 !important;
  padding: 10px !important;
  border: 1px solid rgba(169, 186, 207, 0.28) !important;
  border-radius: 8px !important;
  background: rgba(248, 251, 255, 0.72) !important;
}

.orders-recognition-grid span,
.orders-recognition-grid small {
  color: #65758a !important;
  min-width: 0 !important;
}

.orders-recognition-grid strong,
.orders-recognition-grid small {
  overflow-wrap: anywhere !important;
}

/* Dynamic order table columns: keep V3 visual rules, but let JS own width. */
#view-templates .orders-table {
  min-width: var(--orders-table-content-width, 0px) !important;
}

#view-templates .orders-table__cell--wrap {
  white-space: normal !important;
}

#view-templates .orders-table__text--clamp-2,
#view-templates .orders-table__text--clamp-3 {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

#view-templates .orders-table__link-chip,
#view-templates .orders-table__bool-chip,
#view-templates .orders-table__chip,
#view-templates .orders-table__number {
  max-width: 100% !important;
}

body[data-active-view="workspace"] #view-workspace #stage:fullscreen,
body[data-active-view="workspace"] #view-workspace #stage.is-stage-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  padding: 18px !important;
  overflow: hidden !important;
  background: #e2e8f1 !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
}

body[data-active-view="workspace"] #view-workspace #stage:fullscreen .stage-fullscreen-exit,
body[data-active-view="workspace"] #view-workspace #stage.is-stage-fullscreen .stage-fullscreen-exit {
  display: grid !important;
}

/* Tetris Figma page alignment: keep planner logic untouched, match the shared title strips. */
@media (min-width: 1101px) {
  body[data-active-view="workspace"] #view-workspace .panel-header,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-header {
    margin: 0 !important;
    width: 100% !important;
    height: 67px !important;
    padding: 16px 14px 14px !important;
    box-sizing: border-box !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-header {
    height: 65px !important;
    width: calc(100% - clamp(180px, 10.6vw, 220px) - 12px) !important;
    padding-left: 10px !important;
    box-sizing: border-box !important;
  }

  body[data-active-view="workspace"] #view-workspace .workspace__panel,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .workspace__panel {
    align-self: start !important;
    height: min(100%, calc(100dvh - 124px)) !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-card--planner,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-card--planner {
    height: 100% !important;
  }

  body[data-active-view="workspace"] #view-workspace #stage,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace #stage {
    padding: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-board__footer,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-board__footer {
    grid-row: 1 !important;
    align-self: start !important;
    height: calc(100% - 32px) !important;
    margin-top: 31px !important;
    padding: 13px 13px 17px !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-card--planner .panel-scroll,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-card--planner .panel-scroll {
    position: relative !important;
    padding-bottom: 70px !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-actions--planner,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-actions--planner {
    position: absolute !important;
    left: 14px !important;
    top: 494px !important;
    display: grid !important;
    grid-template-columns: 177px !important;
    gap: 22px !important;
    width: 177px !important;
    margin-top: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-actions--planner #rotateBtn {
    order: 1 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-actions--planner #addBtn {
    order: 2 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-actions--planner #deleteSelectedBtn {
    display: none !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-actions--planner #addBtn,
  body[data-active-view="workspace"] #view-workspace .panel-actions--planner #rotateBtn,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-actions--planner #addBtn,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-actions--planner #rotateBtn {
    width: 177px !important;
    height: 38px !important;
    min-height: 38px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    border-radius: 10px !important;
    font-size: 17px !important;
    line-height: 1 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-zone-footer,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-zone-footer {
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-open-bulk,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .panel-open-bulk {
    position: absolute !important;
    right: 21px !important;
    bottom: 11px !important;
    left: 20px !important;
    width: auto !important;
    min-height: 38px !important;
    height: 38px !important;
    box-shadow:
      0 14px 28px -24px rgba(15, 23, 42, 0.45),
      0 1px 0 rgba(255, 255, 255, 0.78) inset !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-header__titleline,
  body[data-active-view="workspace"] #view-workspace .canvas-header__titleline {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 24px !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-header__titleline {
    margin-left: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-footer-actions,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-footer-actions {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    min-height: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-footer-actions .canvas-quickadd-btn {
    flex: 0 0 70px !important;
    margin-top: auto !important;
  }

  body[data-active-view="workspace"] #view-workspace .canvas-footer-actions .canvas-reset-btn,
  body[data-theme="dark"][data-active-view="workspace"] #view-workspace .canvas-footer-actions .canvas-reset-btn {
    flex: 0 0 38px !important;
    min-height: 38px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-header h2 {
    min-width: 0 !important;
    white-space: nowrap !important;
    font-size: 18.5px !important;
    line-height: 1.05 !important;
    letter-spacing: -0.025em !important;
  }

  body[data-active-view="workspace"] #view-workspace .panel-header .panel-help,
  body[data-active-view="workspace"] #view-workspace .canvas-header .panel-help {
    flex: 0 0 22px !important;
    display: grid !important;
    place-items: center !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    line-height: 1 !important;
  }
}
/* Orders table compact density + weekly controls */
#view-templates .orders-table-wrap {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%),
    repeating-linear-gradient(180deg, transparent 0, transparent 43px, rgba(217,226,236,0.68) 43px, rgba(217,226,236,0.68) 44px) !important;
}

#view-templates .orders-table {
  font-size: 12px !important;
}

#view-templates .orders-table__head {
  height: 30px !important;
  padding: 0 8px !important;
}

#view-templates .orders-table__cell {
  height: 32px !important;
  padding: 2px 8px !important;
  color: #243247 !important;
  vertical-align: middle !important;
}

#view-templates .orders-table__order-num,
#view-templates .orders-table__date,
#view-templates .orders-table__money,
#view-templates .orders-table__number {
  color: #13233a !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
}

#view-templates .orders-table__row-action {
  width: 24px !important;
  height: 24px !important;
  border-radius: 7px !important;
}

#view-templates .orders-table__head--control,
#view-templates .orders-table__cell--control {
  width: 42px !important;
  min-width: 42px !important;
  padding-inline: 6px !important;
}

#view-templates .orders-table__row .orders-table__cell,
#view-templates .orders-table__row .orders-table__cell .orders-table__text--ellipsis,
#view-templates .orders-table__row .orders-table__cell .orders-table__text--clamp-2,
#view-templates .orders-table__row .orders-table__cell .orders-table__text--clamp-3,
#view-templates .orders-table__row .orders-table__cell .orders-table__order-num,
#view-templates .orders-table__row .orders-table__cell .orders-table__date,
#view-templates .orders-table__row .orders-table__cell .orders-table__money,
#view-templates .orders-table__row .orders-table__cell .orders-table__number,
#view-templates .orders-table__row .orders-table__cell .orders-table__chip,
#view-templates .orders-table__row .orders-table__cell .orders-table__payment-term,
#view-templates .orders-table__row .orders-table__cell .orders-table__doc-chip,
#view-templates .orders-table__row .orders-table__cell .orders-table__truck-card,
#view-templates .orders-table__row .orders-table__cell .orders-table__link--map,
#view-templates .orders-table__row .orders-table__cell .orders-route-summary__place,
#view-templates .orders-table__row .orders-table__cell .orders-table__party-name,
#view-templates .orders-table__row .orders-table__cell .orders-table__location-place {
  font-size: 12px !important;
  line-height: 1.2 !important;
}

#view-templates .orders-table__row .orders-table__cell .orders-table__text--ellipsis,
#view-templates .orders-table__row .orders-table__cell .orders-table__text--clamp-2,
#view-templates .orders-table__row .orders-table__cell .orders-table__text--clamp-3,
#view-templates .orders-table__row .orders-table__cell .orders-table__order-num,
#view-templates .orders-table__row .orders-table__cell .orders-table__date,
#view-templates .orders-table__row .orders-table__cell .orders-table__money,
#view-templates .orders-table__row .orders-table__cell .orders-table__number,
#view-templates .orders-table__row .orders-table__cell .orders-route-summary__place,
#view-templates .orders-table__row .orders-table__cell .orders-table__party-name,
#view-templates .orders-table__row .orders-table__cell .orders-table__location-place {
  display: inline-block !important;
  width: 100% !important;
  vertical-align: middle !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  padding-right: 6px !important;
}

#view-templates .orders-table__cell--wrap,
#view-templates .orders-table__text--clamp-2,
#view-templates .orders-table__text--clamp-3 {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  -webkit-line-clamp: unset !important;
  line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

#view-templates .orders-table__order-sub,
#view-templates .orders-table__party-meta,
#view-templates .orders-table__date-sub,
#view-templates .orders-table__location-meta,
#view-templates .orders-route-summary__meta {
  display: none !important;
}

#view-templates .orders-table__order-cell,
#view-templates .orders-table__party,
#view-templates .orders-table__location,
#view-templates .orders-route-summary__point {
  display: inline-block !important;
  width: 100% !important;
  vertical-align: middle !important;
  min-width: 0 !important;
}

#view-templates .orders-route-summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 0 !important;
}

#view-templates .orders-table__payment-term,
#view-templates .orders-table__doc-chip,
#view-templates .orders-table__truck-card,
#view-templates .orders-table__link--map,
#view-templates .orders-table__chip,
#view-templates .orders-table__number {
  min-height: 18px !important;
  padding: 0 6px !important;
  border-radius: 6px !important;
}

#view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-bottom: 3px solid #2f4f7e !important;
  box-shadow: inset 0 -1px 0 #2f4f7e !important;
}

#view-templates .orders-table__row.has-route-group .orders-table__cell--control::before {
  display: none !important;
}

#view-templates .orders-week-expense-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
}


#view-templates .orders-week-expense-cell__input {
  width: 58px;
  height: 24px;
  border: 1px solid #cfd9e6;
  border-radius: 7px;
  padding: 0 7px;
  background: #ffffff;
  color: #0f2239;
  font: inherit;
  font-size: 12px;
  text-align: right;
}

#view-templates .orders-week-expense-cell__input:focus {
  outline: none;
  border-color: #86aee8;
  box-shadow: 0 0 0 2px rgba(67, 124, 212, 0.18);
}

#view-templates .orders-week-expense-cell__input[readonly],
#view-templates .orders-week-expense-cell__input:disabled {
  background: #f2f5fa;
  color: #5a6f89;
}


.orders-week-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 180px;
  padding: 6px;
  border: 1px solid rgba(21, 34, 56, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 26px -18px rgba(9, 20, 34, 0.55);
  backdrop-filter: blur(2px);
}

.orders-week-context-menu__button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: #eef4fe;
  color: #173861;
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

.orders-week-context-menu__button:hover {
  background: #dbe9fc;
}

body[data-theme="dark"] #view-templates .orders-week-expense-cell__input {
  border-color: rgba(148, 163, 184, 0.36);
  background: #101d2b;
  color: #eef4ff;
}

body[data-theme="dark"] #view-templates .orders-week-expense-cell__input[readonly],
body[data-theme="dark"] #view-templates .orders-week-expense-cell__input:disabled {
  background: #152739;
  color: #b9cee8;
}


body[data-theme="dark"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-bottom-color: #9fc3ff !important;
  box-shadow: inset 0 -1px 0 #9fc3ff !important;
}

body[data-theme="dark"] .orders-week-context-menu {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(16, 29, 44, 0.98);
}

body[data-theme="dark"] .orders-week-context-menu__button {
  background: rgba(63, 128, 224, 0.2);
  color: #eaf3ff;
}

/* Force compact single-line rows in active Orders view. */
body[data-active-view="templates"] #view-templates .orders-table__head {
  height: 28px !important;
  padding: 0 8px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row {
  height: 28px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  height: 28px !important;
  padding: 0 8px !important;
  line-height: 1 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell--left,
body[data-active-view="templates"] #view-templates .orders-table__cell--center,
body[data-active-view="templates"] #view-templates .orders-table__cell--right {
  vertical-align: middle !important;
}

body[data-active-view="templates"] #view-templates .orders-cell-content {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: 28px !important;
  min-height: 0 !important;
  gap: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-cell-content__value {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  flex: 1 1 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-cell-edit {
  position: absolute !important;
  top: 50% !important;
  right: -4px !important;
  transform: translateY(-50%) !important;
  width: 22px !important;
  height: 22px !important;
  z-index: 2 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__order-cell,
body[data-active-view="templates"] #view-templates .orders-table__party,
body[data-active-view="templates"] #view-templates .orders-table__location {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-table__location-place,
body[data-active-view="templates"] #view-templates .orders-table__row .orders-table__cell .orders-route-summary__place {
  font-size: 12px !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding-right: 7px !important;
}

/* Spreadsheet table authority: one grid, one line of text, no nested row illusion. */
#view-templates {
  --orders-grid-row-height: 28px;
  --orders-grid-head-height: 28px;
  --orders-grid-font-size: 12px;
  --orders-grid-line: #d9e2ee;
  --orders-grid-line-strong: #cbd7e8;
  --orders-grid-text: #18283c;
}

#view-templates .orders-table {
  width: var(--orders-table-content-width, max-content) !important;
  min-width: var(--orders-table-content-width, 0px) !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: var(--orders-grid-font-size) !important;
}

#view-templates .orders-table__head,
#view-templates .orders-table__cell {
  box-sizing: border-box !important;
  overflow: hidden !important;
  max-width: none;
  border-right: 1px solid var(--orders-grid-line) !important;
}

#view-templates .orders-table__head {
  position: sticky !important;
  top: 0 !important;
  height: var(--orders-grid-head-height) !important;
  padding: 0 18px 0 8px !important;
  background: #f3f6fa !important;
  border-bottom: 1px solid var(--orders-grid-line-strong) !important;
  color: #65758c !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  overflow: visible !important;
}

#view-templates .orders-table__head-label {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#view-templates .orders-table__head-label span {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#view-templates .orders-table__row {
  height: var(--orders-grid-row-height) !important;
  min-height: var(--orders-grid-row-height) !important;
}

#view-templates .orders-table__cell {
  position: relative !important;
  height: var(--orders-grid-row-height) !important;
  min-height: var(--orders-grid-row-height) !important;
  padding: 0 8px !important;
  color: var(--orders-grid-text) !important;
  line-height: 1 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  background-clip: padding-box !important;
}

#view-templates .orders-table__cell--left {
  text-align: left !important;
}

#view-templates .orders-table__cell--center {
  text-align: center !important;
}

#view-templates .orders-table__cell--right {
  text-align: right !important;
}

#view-templates .orders-table__cell.is-inline-editable {
  padding-right: 8px !important;
}

#view-templates .orders-table__cell > span,
#view-templates .orders-table__text,
#view-templates .orders-table__text--ellipsis,
#view-templates .orders-table__text--clamp-2,
#view-templates .orders-table__text--clamp-3,
#view-templates .orders-table__order-num,
#view-templates .orders-table__date,
#view-templates .orders-table__money,
#view-templates .orders-table__number,
#view-templates .orders-table__empty,
#view-templates .orders-table__route-code,
#view-templates .orders-table__party-name,
#view-templates .orders-table__location-place,
#view-templates .orders-route-summary__place {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--orders-grid-row-height) !important;
  margin: 0 !important;
  padding: 0 4px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
  font-size: var(--orders-grid-font-size) !important;
  font-weight: 620 !important;
  line-height: var(--orders-grid-row-height) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  box-sizing: border-box !important;
}

#view-templates .orders-table__cell--center > span,
#view-templates .orders-table__cell--center .orders-table__text,
#view-templates .orders-table__cell--center .orders-table__date,
#view-templates .orders-table__cell--center .orders-table__number,
#view-templates .orders-table__cell--center .orders-route-summary__place {
  text-align: center !important;
}

#view-templates .orders-table__cell--right > span,
#view-templates .orders-table__cell--right .orders-table__money,
#view-templates .orders-table__cell--right .orders-table__number,
#view-templates .orders-table__cell--right .orders-table__text {
  text-align: right !important;
}

#view-templates .orders-table__order-cell,
#view-templates .orders-table__party,
#view-templates .orders-table__location,
#view-templates .orders-table__route-cell,
#view-templates .orders-route-summary,
#view-templates .orders-route-summary__point {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--orders-grid-row-height) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

#view-templates .orders-table__order-sub,
#view-templates .orders-table__party-meta,
#view-templates .orders-table__location-meta,
#view-templates .orders-table__date-sub,
#view-templates .orders-route-summary__meta,
#view-templates .orders-table__route-rail {
  display: none !important;
}

#view-templates .orders-table__route-seq {
  flex: 0 0 auto !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  border-radius: 999px !important;
  line-height: 18px !important;
  font-size: 10px !important;
}

#view-templates .orders-table__badge,
#view-templates .orders-table__count,
#view-templates .orders-table__chip,
#view-templates .orders-table__bool-chip,
#view-templates .orders-table__truck-card,
#view-templates .orders-table__doc-chip,
#view-templates .orders-table__payment-term,
#view-templates .orders-table__link-chip,
#view-templates .orders-table__link--map {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  max-width: 100% !important;
  height: 20px !important;
  min-height: 0 !important;
  padding: 0 6px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

#view-templates .orders-cell-content,
#view-templates .orders-cell-content__value {
  display: contents !important;
}

#view-templates .orders-cell-edit {
  position: absolute !important;
  top: 50% !important;
  right: 4px !important;
  transform: translateY(-50%) !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  padding: 0 !important;
  border-radius: 6px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

#view-templates .orders-table__cell:hover .orders-cell-edit,
#view-templates .orders-cell-edit:focus-visible {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#view-templates .orders-inline-edit {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  gap: 4px !important;
}

#view-templates .orders-inline-edit__input {
  height: 22px !important;
  min-height: 0 !important;
  padding: 0 6px !important;
  font-size: var(--orders-grid-font-size) !important;
  line-height: 22px !important;
}

#view-templates .orders-week-expense-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  min-width: 0 !important;
  gap: 0 !important;
}


#view-templates .orders-week-expense-cell__input {
  flex: 0 1 58px !important;
  width: 58px !important;
  max-width: 58px !important;
  height: 22px !important;
  min-height: 0 !important;
  padding: 0 6px !important;
  font-size: var(--orders-grid-font-size) !important;
  line-height: 22px !important;
}


#view-templates .orders-table__resize-handle {
  position: absolute !important;
  top: 0 !important;
  right: -6px !important;
  width: 12px !important;
  height: 100% !important;
  padding: 0 !important;
  cursor: col-resize !important;
  z-index: 30 !important;
}

#view-templates .orders-table__resize-handle::before {
  top: 5px !important;
  bottom: 5px !important;
  left: 5px !important;
  width: 2px !important;
  background: rgba(73, 108, 160, 0.55) !important;
  opacity: 1 !important;
}

#view-templates .orders-table__head:hover .orders-table__resize-handle::before,
#view-templates .orders-table__resize-handle:focus-visible::before,
body.is-column-resizing #view-templates .orders-table__resize-handle::before {
  background: #2f64b5 !important;
}

/* Final grid guard: never let text wrap classes change the table-cell layout. */
body[data-active-view="templates"] #view-templates .orders-table__label-row > .orders-table__head,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell {
  display: table-cell !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell > span,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__text--clamp-2,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__text--clamp-3,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__empty,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__route-code,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__location-place,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-route-summary__place {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--orders-grid-row-height) !important;
  line-height: var(--orders-grid-row-height) !important;
  margin: 0 !important;
  padding: 0 4px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  box-sizing: border-box !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__badge,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__count,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__chip,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__bool-chip,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__truck-card,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__doc-chip,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__payment-term,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__link-chip,
body[data-active-view="templates"] #view-templates .orders-table__row > .orders-table__cell .orders-table__link--map {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  max-width: 100% !important;
  height: 20px !important;
  min-height: 0 !important;
  line-height: 1 !important;
}

/* Expenses column: compact manual numeric input. */
body[data-active-view="templates"] #view-templates .orders-week-expense-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  min-width: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
}


body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  width: 58px !important;
  max-width: 58px !important;
  height: 22px !important;
  min-height: 0 !important;
  padding: 0 6px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
  line-height: 22px !important;
  text-align: right !important;
}

/* Reference-style order card sheet. Scope is intentionally limited to the detail drawer. */
@media (min-width: 861px) {
  body[data-active-view="templates"] #view-templates .orders-drawer {
    position: fixed !important;
    inset: auto 0 0 clamp(390px, 31vw, 600px) !important;
    top: calc(62px + env(safe-area-inset-top, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    border: 0 !important;
    border-left: 1px solid #d8e0ea !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: -24px 0 46px -40px rgba(15, 23, 42, 0.38) !important;
    transform: translate3d(100%, 0, 0) !important;
    z-index: 160 !important;
    contain: layout paint style !important;
  }

  body[data-active-view="templates"] #view-templates .orders-crm.is-detail-open .orders-drawer {
    transform: translate3d(0, 0, 0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-crm.is-detail-open .orders-drawer-backdrop {
    opacity: 0 !important;
    pointer-events: none !important;
    backdrop-filter: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-crm.is-detail-open .orders-screen-preview {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail {
    height: 100% !important;
    overflow: hidden !important;
    background: #ffffff !important;
    color: #172033 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__inner {
    display: grid !important;
    grid-template-rows: auto minmax(0, auto) auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
    gap: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__inner::after {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 18px !important;
    min-height: 86px !important;
    padding: 18px 22px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #dde5ee !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: #172033 !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header-main {
    min-width: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header h2 {
    margin: 0 0 8px !important;
    color: #172033 !important;
    font-size: 22px !important;
    font-weight: 820 !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header h2 span {
    color: #087ea4 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header p {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 18px !important;
    margin: 0 !important;
    color: #29364a !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    min-width: 0 !important;
    max-width: 28ch !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-icon,
  body[data-active-view="templates"] #view-templates .orders-detail__status-icon,
  body[data-active-view="templates"] #view-templates .orders-detail__action-icon,
  body[data-active-view="templates"] #view-templates .orders-button-icon {
    flex: 0 0 auto !important;
    width: 15px !important;
    height: 15px !important;
    display: inline-block !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-icon {
    color: #64748b !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-value {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    color: #29364a !important;
    font-size: 12px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__headline-item::before,
  body[data-active-view="templates"] #view-templates .orders-detail__headline-value::before {
    display: none !important;
    content: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header-aside {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    min-width: max-content !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__statusbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__status-chip {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-height: 30px !important;
    padding: 0 11px !important;
    border: 1px solid #d6e1ee !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    color: #334155 !important;
    font-size: 12px !important;
    font-weight: 760 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__status-chip.is-blue {
    border-color: #d5e5ff !important;
    background: #eaf2ff !important;
    color: #1d5fbf !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__status-chip.is-green {
    border-color: #d7f0df !important;
    background: #e9f8ee !important;
    color: #177a3d !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__actions {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .orders-detail__icon-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border: 1px solid #d7e0eb !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-size: 17px !important;
    font-weight: 680 !important;
    line-height: 1 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .orders-detail__icon-button:hover {
    border-color: #b9c7d8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__action-icon {
    width: 16px !important;
    height: 16px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-icon-text-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-button-icon {
    width: 14px !important;
    height: 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__meta {
    min-height: 0 !important;
    padding: 0 22px !important;
    border: 0 !important;
    background: #ffffff !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__meta:empty {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs {
    display: flex !important;
    align-items: flex-end !important;
    gap: 26px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 22px !important;
    overflow-x: auto !important;
    border: 0 !important;
    border-bottom: 1px solid #dde5ee !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    scrollbar-width: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs::-webkit-scrollbar {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button {
    position: relative !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #29364a !important;
    font-size: 12px !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: transparent;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button:hover,
  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button.is-active {
    color: #087ea4 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button.is-active::after {
    background: #087ea4 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-tabs__button strong {
    min-width: 16px !important;
    height: 16px !important;
    margin-left: 5px !important;
    padding: 0 4px !important;
    border-radius: 999px !important;
    background: #eaf2ff !important;
    color: #087ea4 !important;
    font-size: 9px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section-stack {
    min-height: 0 !important;
    overflow: hidden !important;
    background: #f8fafc !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section {
    height: 100% !important;
    min-height: 0 !important;
    padding: 16px 20px !important;
    overflow: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section[data-detail-section-panel="billing"] {
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section[data-detail-section-panel="document"] {
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section__intro {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 14px !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness {
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    min-height: 104px !important;
    gap: 10px !important;
    padding: 14px !important;
    border: 1px solid #dce5ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 12px 26px -24px rgba(15, 23, 42, 0.28) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card-head {
    display: grid !important;
    grid-template-columns: 36px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: start !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border: 1px solid #cfdae7 !important;
    border-radius: 7px !important;
    color: #5d6b7c !important;
    background: #ffffff !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__svg {
    width: 17px !important;
    height: 17px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card-head span:not(.orders-document-readiness__icon) {
    display: block !important;
    margin-bottom: 3px !important;
    color: #5f6f82 !important;
    font-size: 11px !important;
    font-weight: 720 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card strong {
    display: block !important;
    overflow: hidden !important;
    color: #1f2937 !important;
    font-size: 13px !important;
    font-weight: 780 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card small {
    overflow: hidden !important;
    color: #607083 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card em {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    color: #188153 !important;
    font-size: 11px !important;
    font-style: normal !important;
    font-weight: 760 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card em::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 999px;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-ready em::before {
    border-color: currentColor !important;
    background: currentColor !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-ready .orders-document-readiness__icon {
    border-color: #cfebd8 !important;
    color: #188153 !important;
    background: #f0fbf3 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-pending em,
  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-muted em {
    color: #b66b05 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-danger em,
  body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-danger .orders-document-readiness__icon {
    color: #b42318 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(245px, 310px) !important;
    gap: 14px !important;
    height: 100% !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main,
  body[data-active-view="templates"] #view-templates .orders-documents-workspace__side,
  body[data-active-view="templates"] #view-templates .orders-panel--preview,
  body[data-active-view="templates"] #view-templates .orders-panel--documents {
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel--preview,
  body[data-active-view="templates"] #view-templates .orders-panel--documents {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    border: 1px solid #dce5ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__stage {
    min-height: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #f8fafc !important;
    overflow: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__info {
    padding: 12px 14px !important;
    border-top: 1px solid #e6edf5 !important;
    background: #ffffff !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__info p {
    margin: 0 !important;
    color: #607083 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents {
    min-height: 0 !important;
    overflow: auto !important;
    padding: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__group {
    padding: 12px 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__group + .orders-documents__group {
    border-top: 1px solid #edf2f7 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__group > strong {
    display: block !important;
    margin-bottom: 10px !important;
    color: #1f2937 !important;
    font-size: 12px !important;
    font-weight: 780 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__list {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__list--cards {
    display: grid !important;
    gap: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__thumb {
    width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border: 1px solid #d4e0ed !important;
    border-radius: 7px !important;
    background: #f8fafc !important;
    color: #087ea4 !important;
    font-size: 10px !important;
    font-weight: 850 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__body {
    min-width: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__title,
  body[data-active-view="templates"] #view-templates .orders-doc-card__title--static {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #0b5f98 !important;
    font-size: 12px !important;
    font-weight: 760 !important;
    line-height: 1.3 !important;
    text-align: left !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px 8px !important;
    margin-top: 4px !important;
    color: #607083 !important;
    font-size: 11px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 8px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card__actions button,
  body[data-active-view="templates"] #view-templates .orders-doc-card__actions a {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #087ea4 !important;
    font-size: 11px !important;
    font-weight: 760 !important;
    text-decoration: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-workspace {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
    gap: 14px !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__header {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    min-height: 106px !important;
    gap: 10px !important;
    padding: 14px !important;
    border: 1px solid #dce5ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 12px 26px -24px rgba(15, 23, 42, 0.28) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card-head {
    display: grid !important;
    grid-template-columns: 36px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: start !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border: 1px solid #cfdae7 !important;
    border-radius: 7px !important;
    color: #5d6b7c !important;
    font-size: 10px !important;
    font-weight: 850 !important;
    line-height: 1 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card > span,
  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card-head span:not(.orders-billing-readiness__icon) {
    display: block !important;
    margin-bottom: 3px !important;
    color: #5f6f82 !important;
    font-size: 11px !important;
    font-weight: 720 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card strong {
    display: block !important;
    color: #1f2937 !important;
    font-size: 13px !important;
    font-weight: 780 !important;
    line-height: 1.2 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card small {
    overflow: hidden !important;
    color: #607083 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card em {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    color: #188153 !important;
    font-size: 11px !important;
    font-style: normal !important;
    font-weight: 760 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card em::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 1.5px solid currentColor;
    border-radius: 999px;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card.is-ready em::before {
    border-color: currentColor !important;
    background: currentColor !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card.is-warning em,
  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card.is-pending em {
    color: #b66b05 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card.is-danger em {
    color: #b42318 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__card .orders-inline-action {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-workspace__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-workspace.is-building .orders-billing-workspace__grid {
    display: grid !important;
    grid-template-columns: minmax(232px, 270px) minmax(0, 1fr) !important;
    gap: 14px !important;
    min-height: 0 !important;
    height: 100% !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-doc-history,
  body[data-active-view="templates"] #view-templates .orders-billing-create,
  body[data-active-view="templates"] #view-templates .orders-billing-builder,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__card {
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-doc-history .orders-panel--billing,
  body[data-active-view="templates"] #view-templates .orders-billing-type-panel,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__card,
  body[data-active-view="templates"] #view-templates .orders-billing-preview-summary,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__section {
    border: 1px solid #dce5ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-doc-history .orders-panel--billing {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel__header {
    min-height: 42px !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid #e6edf5 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel__header h3,
  body[data-active-view="templates"] #view-templates .orders-billing-type-panel__header h3,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__header h3,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__section-head h4 {
    color: #1f2937 !important;
    font-size: 13px !important;
    font-weight: 780 !important;
    letter-spacing: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list {
    display: grid !important;
    align-content: start !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__item {
    display: grid !important;
    grid-template-columns: 26px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    align-items: start !important;
    margin: 0 !important;
    padding: 12px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid #edf2f7 !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    border: 1px solid #d3e2f1 !important;
    border-radius: 5px !important;
    color: #087ea4 !important;
    font-size: 8px !important;
    font-weight: 850 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__item strong {
    color: #0b5f98 !important;
    font-size: 12px !important;
    font-weight: 760 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__item span,
  body[data-active-view="templates"] #view-templates .orders-billing-list__amount span {
    color: #607083 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-actions {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__amount {
    align-items: end !important;
    gap: 4px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-list__amount strong {
    color: #1f2937 !important;
    font-size: 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-panel {
    align-content: start !important;
    height: 100% !important;
    padding: 14px !important;
    overflow: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__card {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    border: 0 !important;
    background: transparent !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__header,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__card > .orders-billing-alert {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__layout {
    grid-row: 1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px) !important;
    gap: 14px !important;
    min-height: 0 !important;
    height: 100% !important;
    padding: 0 !important;
    overflow: hidden !important;
    align-items: stretch !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__main,
  body[data-active-view="templates"] #view-templates .orders-billing-preview-summary {
    min-height: 0 !important;
    height: 100% !important;
    overflow: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(99, 116, 139, 0.32) transparent !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__main {
    display: grid !important;
    align-content: start !important;
    gap: 14px !important;
    padding-right: 2px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__section {
    display: grid !important;
    gap: 12px !important;
    padding: 14px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-document-type {
    gap: 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-document-type__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-type-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card {
    display: grid !important;
    justify-items: center !important;
    align-content: center !important;
    min-height: 88px !important;
    gap: 8px !important;
    padding: 12px !important;
    border: 1px solid #dce5ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 10px 20px -22px rgba(15, 23, 42, 0.34) !important;
    text-align: center !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card--compact {
    min-height: 76px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card i {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    border: 1px solid #cfe0ef !important;
    border-radius: 6px !important;
    color: #087ea4 !important;
    font-size: 9px !important;
    font-style: normal !important;
    font-weight: 850 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card strong {
    color: #1f2937 !important;
    font-size: 12px !important;
    font-weight: 760 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card small {
    color: #607083 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-type-card.is-selected {
    border-color: #0b87aa !important;
    box-shadow: inset 0 0 0 1px #0b87aa, 0 12px 24px -22px rgba(8, 126, 164, 0.9) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder .orders-billing-modal__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__wide,
  body[data-active-view="templates"] #view-templates .orders-billing-modal__wide {
    grid-column: 1 / -1 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder label {
    display: grid !important;
    gap: 5px !important;
    min-width: 0 !important;
    color: #526274 !important;
    font-size: 11px !important;
    font-weight: 720 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder .orders-form__input,
  body[data-active-view="templates"] #view-templates .orders-billing-builder select.orders-form__input {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 10px !important;
    border: 1px solid #d5dee9 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    font-size: 12px !important;
    font-weight: 560 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview-summary {
    display: grid !important;
    align-content: start !important;
    gap: 16px !important;
    padding: 16px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__section-head {
    display: grid !important;
    gap: 3px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__section-head--inline {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__section-head span {
    color: #69788a !important;
    font-size: 10px !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary div {
    display: grid !important;
    gap: 4px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary span {
    color: #69788a !important;
    font-size: 11px !important;
    font-weight: 650 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary strong {
    color: #182235 !important;
    font-size: 13px !important;
    font-weight: 760 !important;
    line-height: 1.25 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary div:nth-child(3) strong,
  body[data-active-view="templates"] #view-templates .orders-billing-preview__summary div:nth-child(4) strong {
    font-size: 20px !important;
    letter-spacing: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-alert {
    display: grid !important;
    gap: 4px !important;
    padding: 10px 12px !important;
    border: 1px solid #f4c26d !important;
    border-radius: 7px !important;
    background: #fff8e8 !important;
    color: #7a4b04 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-alert.is-danger {
    border-color: #f2b8b5 !important;
    background: #fff1f1 !important;
    color: #9b1c1c !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__footer {
    grid-row: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    min-height: 66px !important;
    padding: 12px 0 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__footer [data-billing-status="1"] {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .ghost-button,
  body[data-active-view="templates"] #view-templates .orders-detail .primary {
    min-height: 34px !important;
    padding: 0 14px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 760 !important;
    letter-spacing: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .primary {
    border-color: #087ea4 !important;
    background: #087ea4 !important;
    color: #ffffff !important;
    box-shadow: 0 12px 22px -18px rgba(8, 126, 164, 0.85) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-order-fields {
    display: none !important;
  }
}

@media (max-width: 1400px) and (min-width: 861px) {
  body[data-active-view="templates"] #view-templates .orders-drawer {
    left: clamp(300px, 24vw, 390px) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-document-readiness__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-workspace__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-workspace.is-building .orders-billing-workspace__grid {
    grid-template-columns: minmax(210px, 240px) minmax(0, 1fr) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__grid {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 260px) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-builder__layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 290px) !important;
  }
}

@media (max-width: 860px) {
  body[data-active-view="templates"] #view-templates .orders-detail__header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header h2 span {
    color: #087ea4 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__header-aside {
    display: grid !important;
    justify-items: end !important;
    gap: 8px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__statusbar {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail__actions {
    display: flex !important;
    align-items: start !important;
    gap: 8px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .orders-detail__danger {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail .orders-detail__icon-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-billing-readiness__grid,
  body[data-active-view="templates"] #view-templates .orders-document-readiness__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-workspace__grid,
  body[data-active-view="templates"] #view-templates .orders-documents-workspace__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__layout,
  body[data-active-view="templates"] #view-templates .orders-billing-builder .orders-billing-modal__grid,
  body[data-active-view="templates"] #view-templates .orders-billing-builder__grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-detail-section[data-detail-section-panel="document"],
  body[data-active-view="templates"] #view-templates .orders-documents-workspace,
  body[data-active-view="templates"] #view-templates .orders-document-readiness,
  body[data-active-view="templates"] #view-templates .orders-documents-workspace__grid,
  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main,
  body[data-active-view="templates"] #view-templates .orders-documents-workspace__side,
  body[data-active-view="templates"] #view-templates .orders-panel--preview,
  body[data-active-view="templates"] #view-templates .orders-panel--documents {
    height: auto !important;
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main {
    grid-template-rows: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox {
    min-height: 320px !important;
  }
}

body[data-active-view="templates"] #view-templates .orders-document-readiness__card.is-ready em::before,
body[data-active-view="templates"] #view-templates .orders-billing-readiness__card.is-ready em::before {
  border-color: currentColor !important;
  background: currentColor !important;
}

#view-templates .orders-detail__headline-icon,
#view-templates .orders-detail__status-icon,
#view-templates .orders-detail__action-icon,
#view-templates .orders-button-icon {
  display: inline-block !important;
  flex: 0 0 auto !important;
  width: 15px !important;
  height: 15px !important;
}

#view-templates .orders-detail__headline-icon {
  color: #64748b !important;
}

/* Document-focused CRM layout: large PDF viewer over the table + compact order card. */
@media (min-width: 861px) {
  body[data-active-view="templates"] #view-templates .orders-crm {
    --orders-large-preview-left: 14px;
    --orders-large-preview-width: clamp(560px, 39vw, 760px);
    --orders-large-preview-gap: 14px;
    --orders-large-preview-top: calc(62px + env(safe-area-inset-top, 0px) + 12px);
    --orders-large-preview-bottom: 14px;
  }

  body[data-active-view="templates"] #view-templates .orders-crm.is-detail-open .orders-drawer {
    position: fixed !important;
    top: var(--orders-large-preview-top) !important;
    right: 12px !important;
    bottom: var(--orders-large-preview-bottom) !important;
    left: calc(var(--orders-large-preview-left) + var(--orders-large-preview-width) + var(--orders-large-preview-gap)) !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    border: 1px solid #d8e0ea !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 18px 44px -32px rgba(15, 23, 42, 0.32) !important;
    transform: translate3d(0, 0, 0) !important;
    z-index: 160 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-crm.is-detail-open.has-document .orders-screen-preview {
    display: block !important;
    position: fixed !important;
    top: var(--orders-large-preview-top) !important;
    right: auto !important;
    bottom: var(--orders-large-preview-bottom) !important;
    left: var(--orders-large-preview-left) !important;
    width: var(--orders-large-preview-width) !important;
    height: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    z-index: 150 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__surface {
    display: grid !important;
    grid-template-rows: 50px minmax(0, 1fr) !important;
    gap: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid #d8e0ea !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 18px 42px -30px rgba(15, 23, 42, 0.42) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 50px !important;
    padding: 0 18px !important;
    border-bottom: 1px solid #dde5ee !important;
    background: #ffffff !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__header h3 {
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    color: #172033 !important;
    font-size: 14px !important;
    font-weight: 820 !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__header p,
  body[data-active-view="templates"] #view-templates .orders-screen-preview__status {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: #243246 !important;
    cursor: pointer !important;
    text-decoration: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__icon:hover {
    background: #eef4fb !important;
    color: #0f172a !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__icon-svg {
    width: 17px !important;
    height: 17px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding: 10px !important;
    overflow: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #f8fafc !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body > .orders-previewbox__summary,
  body[data-active-view="templates"] #view-templates .orders-screen-preview__body > .orders-previewtext {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewbox__pdf-shell {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    border: 1px solid #e1e7ef !important;
    border-radius: 4px !important;
    background: #ffffff !important;
    box-shadow: 0 8px 28px -24px rgba(15, 23, 42, 0.42) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewbox__pdf-frame {
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    background: #ffffff !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewbox__pages {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    width: 100% !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewpage {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewpage img {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 4px !important;
    box-shadow: 0 8px 28px -24px rgba(15, 23, 42, 0.42) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-screen-preview__body .orders-previewpage figcaption {
    display: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace {
    grid-template-rows: auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) !important;
    height: 100% !important;
    min-height: 0 !important;
    align-items: stretch !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    min-height: 0 !important;
    height: 100% !important;
    gap: 14px !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel--preview {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox--compact {
    display: grid !important;
    grid-template-rows: auto auto !important;
    gap: 12px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 14px !important;
    border: 1px solid #e1e7ef !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-card {
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 58px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border: 1px solid #d4e0ed !important;
    border-radius: 7px !important;
    background: #f8fafc !important;
    color: #506174 !important;
    font-size: 12px !important;
    font-weight: 850 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-body {
    min-width: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-body strong {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    color: #172033 !important;
    font-size: 13px !important;
    font-weight: 820 !important;
    line-height: 1.25 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-body span {
    display: block !important;
    margin-top: 4px !important;
    overflow: hidden !important;
    color: #637083 !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-body em {
    display: block !important;
    margin-top: 6px !important;
    color: #0c8a55 !important;
    font-size: 12px !important;
    font-style: normal !important;
    font-weight: 740 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox__compact-body em.is-danger {
    color: #b42318 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox--compact .orders-previewbox__buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  body[data-active-view="templates"] #view-templates .orders-previewbox--compact .orders-previewbox__buttons .ghost-button,
  body[data-active-view="templates"] #view-templates .orders-previewbox--compact .orders-previewbox__buttons a,
  body[data-active-view="templates"] #view-templates .orders-previewbox--compact .orders-previewbox__buttons button {
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 0 14px !important;
    border-radius: 7px !important;
    font-size: 12px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__main > .orders-panel:not(.orders-panel--preview) {
    min-height: 0 !important;
    height: 100% !important;
    overflow: auto !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents-workspace__side,
  body[data-active-view="templates"] #view-templates .orders-panel--documents {
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel--documents {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents {
    display: block !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
    content-visibility: visible !important;
    contain: none !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__group {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 14px !important;
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__group > strong {
    display: block !important;
    margin-bottom: 10px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__list--cards {
    display: grid !important;
    gap: 10px !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-documents__list li {
    overflow: visible !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card {
    height: auto !important;
    min-height: 104px !important;
  }

  body[data-active-view="templates"] #view-templates .orders-doc-card.is-active {
    border-color: #4c7cff !important;
    box-shadow: inset 3px 0 0 #4c7cff, 0 10px 26px -24px rgba(37, 99, 235, 0.7) !important;
  }

  body[data-active-view="templates"] #view-templates .orders-panel--documents,
  body[data-active-view="templates"] #view-templates .orders-panel--documents .orders-doc-card {
    content-visibility: visible !important;
    contain: none !important;
  }
}

/* Route board reference pass: focused table, clear route column, visible manual resizing. */
body[data-active-view="templates"] #view-templates {
  --orders-grid-row-height: 30px;
  --orders-grid-head-height: 30px;
  --orders-grid-font-size: 12px;
  --orders-grid-line: #d7e2ef;
  --orders-grid-line-strong: #b9cce2;
  --orders-grid-text: #14263b;
  --orders-route-ink: #123452;
  --orders-route-blue: #2f73bd;
  --orders-route-blue-soft: rgba(47, 115, 189, 0.1);
  --orders-week-line: #244f83;
}

body[data-active-view="templates"] #view-templates .orders-table-wrap {
  border-top: 1px solid #d7e2ef !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.98)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent calc(var(--orders-grid-row-height) - 1px),
      rgba(215, 226, 239, 0.64) calc(var(--orders-grid-row-height) - 1px),
      rgba(215, 226, 239, 0.64) var(--orders-grid-row-height)
    ) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
}

body[data-active-view="templates"] #view-templates .orders-table {
  color: var(--orders-grid-text) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  height: var(--orders-grid-head-height) !important;
  padding: 0 22px 0 10px !important;
  border-right: 1px solid var(--orders-grid-line-strong) !important;
  border-bottom: 1px solid var(--orders-grid-line-strong) !important;
  background: linear-gradient(180deg, #f7f9fc 0%, #edf3f9 100%) !important;
  color: #60738c !important;
  overflow: visible !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  height: var(--orders-grid-row-height) !important;
  min-height: var(--orders-grid-row-height) !important;
  padding: 0 10px !important;
  border-right: 1px solid var(--orders-grid-line) !important;
  border-bottom: 1px solid rgba(215, 226, 239, 0.78) !important;
  vertical-align: middle !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:nth-child(even) {
  background: #f6faff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:hover {
  background: #edf6ff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group {
  background: hsl(var(--route-hue, 152) 76% 97%) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-selected {
  background: #e5f1ff !important;
  box-shadow: inset 4px 0 0 var(--orders-route-blue) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-bottom: 4px solid var(--orders-week-line) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.72) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="routeSummary"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  text-align: center !important;
  border-left-color: #bfd2e8 !important;
  border-right-color: #bfd2e8 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="routeSummary"] {
  color: #466986 !important;
  background: linear-gradient(180deg, #f8fbff 0%, #eaf3fb 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  background:
    linear-gradient(90deg, rgba(47, 115, 189, 0.04), rgba(47, 115, 189, 0.1) 50%, rgba(47, 115, 189, 0.04)) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 7px !important;
  color: var(--orders-route-ink) !important;
  font-size: var(--orders-grid-font-size) !important;
  font-weight: 760 !important;
  line-height: var(--orders-grid-row-height) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  display: block !important;
  min-width: 0 !important;
  max-width: 46% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  flex: 0 0 auto !important;
  color: var(--orders-route-blue) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  flex: 0 0 6px !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 999px !important;
  background: var(--orders-route-blue) !important;
  box-shadow: 0 0 0 3px var(--orders-route-blue-soft) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot--end {
  background: #10a37f !important;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1) !important;
}



body[data-active-view="templates"] #view-templates .orders-table__cell > span,
body[data-active-view="templates"] #view-templates .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-2,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-3,
body[data-active-view="templates"] #view-templates .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__location-place {
  padding-right: 10px !important;
  color: inherit !important;
  font-size: var(--orders-grid-font-size) !important;
  line-height: var(--orders-grid-row-height) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle {
  position: absolute !important;
  top: 0 !important;
  right: -8px !important;
  width: 16px !important;
  height: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  cursor: col-resize !important;
  z-index: 80 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::before {
  content: "" !important;
  position: absolute !important;
  top: 4px !important;
  bottom: 4px !important;
  left: 7px !important;
  width: 2px !important;
  border-radius: 999px !important;
  background: rgba(47, 115, 189, 0.62) !important;
  opacity: 1 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::after {
  content: "" !important;
  position: absolute !important;
  top: 50% !important;
  right: 3px !important;
  width: 4px !important;
  height: 14px !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background:
    radial-gradient(circle, #2f73bd 1px, transparent 1.6px) 0 1px / 4px 4px repeat-y !important;
  opacity: 0.58 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:hover .orders-table__resize-handle::before,
body[data-active-view="templates"] #view-templates .orders-table__resize-handle:focus-visible::before,
body.is-column-resizing #view-templates .orders-table__resize-handle::before {
  width: 3px !important;
  background: #176ec7 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:hover .orders-table__resize-handle::after,
body.is-column-resizing #view-templates .orders-table__resize-handle::after {
  opacity: 1 !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell {
  justify-content: center !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  width: 56px !important;
  max-width: 56px !important;
  height: 22px !important;
  border-color: #c8d8ea !important;
  background: #fbfdff !important;
  color: #123452 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell--control,
body[data-active-view="templates"] #view-templates .orders-table__head--control {
  background: #f7f9fc !important;
}

/* Final route/resize correction: keep the route chip flex after generic cell text guards. */
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  min-width: 0 !important;
  max-width: 100% !important;
  gap: 8px !important;
  padding: 0 10px !important;
  color: var(--orders-route-ink) !important;
  font-size: var(--orders-grid-font-size) !important;
  font-weight: 760 !important;
  line-height: var(--orders-grid-row-height) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  flex: 0 1 auto !important;
  display: block !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow,
body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  flex: 0 0 auto !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  color: var(--orders-route-blue) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-bottom: 0 !important;
  box-shadow: inset 0 -4px 0 var(--orders-week-line) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary + .orders-table__row > .orders-table__cell {
  border-top: 0 !important;
}

/* Nordic Ledger chosen: premium calm table skin based on reference 1. */
body[data-active-view="templates"] #view-templates {
  --nordic-bg: #edf3f8;
  --nordic-card: #ffffff;
  --nordic-card-soft: #f8fbfe;
  --nordic-head: #f4f8fc;
  --nordic-line: #dce7f2;
  --nordic-line-strong: #c4d5e8;
  --nordic-ink: #142439;
  --nordic-muted: #6a7d93;
  --nordic-blue: #2f73bd;
  --nordic-blue-soft: #eaf4ff;
  --nordic-green-soft: #edf9f4;
  --nordic-shadow: 0 22px 60px -48px rgba(18, 42, 72, 0.46);
  --orders-grid-row-height: 30px;
  --orders-grid-head-height: 32px;
  --orders-grid-font-size: 12px;
  --orders-grid-text: var(--nordic-ink);
  --orders-grid-line: var(--nordic-line);
  --orders-grid-line-strong: var(--nordic-line-strong);
  --orders-route-blue: var(--nordic-blue);
  --orders-route-blue-soft: rgba(47, 115, 189, 0.1);
  --orders-week-line: #244f83;
}

body[data-active-view="templates"] #view-templates.orders-view {
  background:
    radial-gradient(circle at 12% 4%, rgba(95, 151, 211, 0.16), transparent 30%),
    linear-gradient(180deg, #eef4fa 0%, #f7fafc 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-crm {
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-board {
  border: 1px solid rgba(190, 207, 225, 0.72) !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%) !important;
  box-shadow: var(--nordic-shadow) !important;
  overflow: hidden !important;
}

body[data-active-view="templates"] #view-templates .orders-board__toolbar {
  min-height: 82px !important;
  padding: 20px 24px !important;
  border-bottom: 1px solid rgba(200, 216, 234, 0.18) !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 34%),
    linear-gradient(180deg, #294866 0%, #223d5a 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__title {
  color: #ffffff !important;
  font-size: 30px !important;
  letter-spacing: -0.045em !important;
}

body[data-active-view="templates"] #view-templates .orders-board__year-select {
  border-color: rgba(205, 225, 248, 0.34) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__subtitle {
  color: rgba(229, 241, 255, 0.9) !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search {
  width: min(100%, 430px) !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__input {
  min-height: 40px !important;
  border: 1px solid rgba(220, 233, 247, 0.88) !important;
  border-radius: 13px !important;
  background-color: rgba(255, 255, 255, 0.96) !important;
  color: #132235 !important;
  box-shadow: 0 12px 28px -24px rgba(10, 30, 52, 0.42) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button,
body[data-active-view="templates"] #view-templates .orders-board__actions .primary {
  min-height: 38px !important;
  border-radius: 12px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button {
  border-color: rgba(219, 233, 249, 0.28) !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs {
  padding: 14px 16px 12px !important;
  border-bottom: 1px solid var(--nordic-line) !important;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs__scroller {
  gap: 10px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card,
body[data-active-view="templates"] #view-templates .orders-machine-tab-action {
  min-height: 58px !important;
  border: 1px solid rgba(203, 216, 231, 0.94) !important;
  border-radius: 13px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 255, 0.98)) !important;
  box-shadow:
    0 10px 22px -20px rgba(15, 39, 67, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card.is-active {
  border-color: rgba(93, 150, 220, 0.56) !important;
  background:
    linear-gradient(180deg, #edf5ff 0%, #deebfb 100%) !important;
  box-shadow:
    0 12px 24px -20px rgba(47, 115, 189, 0.72),
    inset 0 0 0 1px rgba(47, 115, 189, 0.1) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__plate {
  color: #172940 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__status {
  color: #71849b !important;
}

body[data-active-view="templates"] #view-templates .orders-table-wrap {
  flex: 1 1 auto !important;
  margin: 10px 16px 16px !important;
  border: 1px solid var(--nordic-line) !important;
  border-radius: 16px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 255, 0.98)) !important;
  box-shadow:
    0 16px 36px -34px rgba(16, 42, 70, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-table {
  color: var(--nordic-ink) !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  height: var(--orders-grid-head-height) !important;
  padding: 0 22px 0 10px !important;
  border-right: 1px solid var(--nordic-line-strong) !important;
  border-bottom: 1px solid var(--nordic-line-strong) !important;
  background: linear-gradient(180deg, #f8fbfe 0%, #eef4fa 100%) !important;
  color: #657993 !important;
  font-size: 10px !important;
  letter-spacing: 0.12em !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  height: var(--orders-grid-row-height) !important;
  min-height: var(--orders-grid-row-height) !important;
  padding: 0 10px !important;
  border-right: 1px solid rgba(220, 231, 242, 0.92) !important;
  border-bottom: 1px solid rgba(228, 236, 245, 0.88) !important;
  color: var(--nordic-ink) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row {
  background: #ffffff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:nth-child(even) {
  background: #f8fbfe !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group {
  background: var(--nordic-green-soft) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group:nth-child(even) {
  background: #f3fbf8 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:hover {
  background: #edf6ff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-selected {
  background: #e7f2ff !important;
  box-shadow: inset 4px 0 0 var(--nordic-blue) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="routeSummary"] {
  background: linear-gradient(180deg, #f9fcff 0%, #edf6ff 100%) !important;
  color: #4f6f91 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  background:
    linear-gradient(90deg, rgba(47, 115, 189, 0.025), rgba(47, 115, 189, 0.075), rgba(47, 115, 189, 0.025)) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  width: fit-content !important;
  max-width: 100% !important;
  height: 22px !important;
  margin: 4px auto !important;
  padding: 0 10px !important;
  gap: 7px !important;
  border: 1px solid rgba(124, 171, 220, 0.46) !important;
  border-radius: 999px !important;
  background: rgba(234, 244, 255, 0.8) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78) !important;
  color: #16395d !important;
  font-weight: 780 !important;
  line-height: 22px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  max-width: 112px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  width: 6px !important;
  height: 6px !important;
  box-shadow: 0 0 0 3px rgba(47, 115, 189, 0.1) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  color: #2f73bd !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term,
body[data-active-view="templates"] #view-templates .orders-table__doc-chip,
body[data-active-view="templates"] #view-templates .orders-table__truck-card,
body[data-active-view="templates"] #view-templates .orders-table__link--map,
body[data-active-view="templates"] #view-templates .orders-table__chip,
body[data-active-view="templates"] #view-templates .orders-table__number {
  height: 20px !important;
  border-color: rgba(198, 213, 229, 0.96) !important;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #465d76 !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  width: 58px !important;
  height: 22px !important;
  border: 1px solid rgba(194, 211, 228, 0.96) !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  color: #18324d !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle {
  right: -7px !important;
  width: 14px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::before {
  left: 6px !important;
  width: 2px !important;
  background: rgba(80, 135, 193, 0.48) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::after {
  right: 3px !important;
  opacity: 0.38 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:hover .orders-table__resize-handle::before,
body.is-column-resizing #view-templates .orders-table__resize-handle::before {
  background: #2f73bd !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-bottom: 0 !important;
  box-shadow: inset 0 -4px 0 #254f80 !important;
}

/* Route pills: separate outline around each code, arrow between them. */
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  width: 100% !important;
  max-width: 100% !important;
  height: var(--orders-grid-row-height) !important;
  margin: 0 auto !important;
  padding: 0 8px !important;
  gap: 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  max-width: calc((100% - 28px) / 2) !important;
  height: 22px !important;
  padding: 0 8px !important;
  gap: 6px !important;
  border: 1px solid rgba(124, 171, 220, 0.56) !important;
  border-radius: 999px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 246, 255, 0.86)) !important;
  box-shadow:
    0 1px 2px rgba(30, 74, 116, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code--end {
  border-color: rgba(109, 184, 159, 0.5) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(237, 249, 244, 0.9)) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  flex: 1 1 auto !important;
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  color: #15375a !important;
  font-weight: 800 !important;
  line-height: 20px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  flex: 0 0 14px !important;
  width: 14px !important;
  color: #537ca8 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-align: center !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  flex: 0 0 6px !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 999px !important;
  background: #2f73bd !important;
  box-shadow: 0 0 0 3px rgba(47, 115, 189, 0.1) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot--end {
  background: #10a37f !important;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1) !important;
}

/* Week boundary mirrors the table direction: newest first draws above, oldest first draws below. */
body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-top: 0 !important;
  border-bottom: 0 !important;
  box-shadow: inset 0 4px 0 #254f80 !important;
}

body[data-active-view="templates"][data-orders-direction="asc"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  box-shadow: inset 0 -4px 0 #254f80 !important;
}

body[data-theme="dark"][data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  box-shadow: inset 0 4px 0 #9fc3ff !important;
}

body[data-theme="dark"][data-active-view="templates"][data-orders-direction="asc"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  box-shadow: inset 0 -4px 0 #9fc3ff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary + .orders-table__row > .orders-table__cell {
  border-top: 0 !important;
}

/* Reference skin 2026-06-04: light, soft table like the provided mockup. */
body[data-active-view="templates"] #view-templates {
  --orders-ref-bg: #eef4fb;
  --orders-ref-panel: rgba(255, 255, 255, 0.82);
  --orders-ref-card: #ffffff;
  --orders-ref-card-soft: #f9fbfe;
  --orders-ref-head: #fbfcff;
  --orders-ref-line: #e5edf6;
  --orders-ref-line-strong: #d4e0ee;
  --orders-ref-ink: #172033;
  --orders-ref-muted: #6e7f95;
  --orders-ref-blue: #2f80ed;
  --orders-ref-blue-deep: #1f66d1;
  --orders-ref-blue-soft: #edf6ff;
  --orders-ref-selected: #eef6ff;
  --orders-ref-week-line: #1f4f86;
  --orders-grid-row-height: 42px;
  --orders-grid-head-height: 42px;
  --orders-grid-font-size: 12px;
  --orders-week-line: var(--orders-ref-week-line);
  color: var(--orders-ref-ink);
}

body[data-active-view="templates"] #view-templates.orders-view {
  padding: 16px 18px 18px !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(92, 145, 214, 0.18), transparent 30%),
    radial-gradient(circle at 84% 2%, rgba(84, 132, 198, 0.13), transparent 26%),
    linear-gradient(180deg, #edf4fb 0%, #f8fbfe 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-crm {
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-board {
  gap: 16px !important;
  padding: 26px 28px 24px !important;
  border: 1px solid rgba(209, 222, 238, 0.9) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(248, 251, 255, 0.9)) !important;
  box-shadow:
    0 26px 70px -52px rgba(20, 45, 76, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  overflow: hidden !important;
}

body[data-active-view="templates"] #view-templates .orders-board__toolbar {
  display: grid !important;
  grid-template-columns: minmax(230px, max-content) minmax(300px, 520px) max-content !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  min-height: 48px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-board__titlewrap {
  gap: 6px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__titleline {
  align-items: center !important;
  gap: 12px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__title {
  color: #111827 !important;
  font-size: clamp(28px, 2.1vw, 34px) !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  letter-spacing: -0.055em !important;
}

body[data-active-view="templates"] #view-templates .orders-board__year-select {
  min-width: 86px !important;
  height: 38px !important;
  padding: 0 34px 0 14px !important;
  border: 1px solid rgba(218, 227, 239, 0.95) !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  color: #27374d !important;
  box-shadow:
    0 14px 26px -24px rgba(21, 45, 76, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.98) !important;
  font-size: 13px !important;
  font-weight: 760 !important;
}

body[data-active-view="templates"] #view-templates .panel-help {
  width: 28px !important;
  height: 28px !important;
  border-color: rgba(204, 218, 235, 0.9) !important;
  background: #f7fbff !important;
  color: #7a8ba1 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-board__subtitle {
  color: #718299 !important;
  font-size: 11px !important;
  font-weight: 780 !important;
  letter-spacing: 0.12em !important;
}

body[data-active-view="templates"] #view-templates .orders-board__subtitle::before {
  background: var(--orders-ref-blue) !important;
  box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__searchslot {
  justify-self: center !important;
  width: min(100%, 520px) !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  min-height: 44px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search::before {
  content: "" !important;
  position: absolute !important;
  left: 17px !important;
  top: 50% !important;
  z-index: 1 !important;
  width: 12px !important;
  height: 12px !important;
  border: 2px solid #91a3b8 !important;
  border-radius: 999px !important;
  transform: translateY(-58%) !important;
  pointer-events: none !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search::after {
  content: "" !important;
  position: absolute !important;
  left: 28px !important;
  top: calc(50% + 5px) !important;
  z-index: 1 !important;
  width: 7px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: #91a3b8 !important;
  transform: rotate(45deg) !important;
  pointer-events: none !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__label {
  display: none !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__input,
body[data-active-view="templates"] #view-templates .orders-filter--search .orders-filter__input {
  width: 100% !important;
  min-height: 44px !important;
  padding: 0 18px 0 48px !important;
  border: 1px solid rgba(218, 227, 239, 0.96) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #172033 !important;
  box-shadow:
    0 16px 34px -30px rgba(23, 45, 76, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  font-size: 13px !important;
  font-weight: 620 !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__input::placeholder {
  color: #9aa6b5 !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__input:focus {
  border-color: rgba(47, 128, 237, 0.46) !important;
  box-shadow:
    0 0 0 4px rgba(47, 128, 237, 0.1),
    0 16px 34px -30px rgba(23, 45, 76, 0.46) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions {
  gap: 10px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button,
body[data-active-view="templates"] #view-templates .orders-board__actions .primary {
  min-height: 42px !important;
  padding: 0 18px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  letter-spacing: -0.01em !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button {
  border: 1px solid rgba(213, 224, 238, 0.96) !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #405168 !important;
  box-shadow:
    0 12px 26px -24px rgba(15, 42, 72, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button:hover {
  border-color: rgba(47, 128, 237, 0.36) !important;
  background: #ffffff !important;
  color: #1d5fc0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table-settings-btn {
  width: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .primary {
  min-width: 136px !important;
  border: 1px solid rgba(31, 102, 209, 0.82) !important;
  background:
    linear-gradient(180deg, #3f92ff 0%, #1f75ea 100%) !important;
  color: #ffffff !important;
  box-shadow:
    0 16px 28px -20px rgba(31, 117, 234, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs {
  margin: 0 !important;
  padding: 8px 0 2px !important;
  border: 0 !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs__scroller {
  gap: 10px !important;
  padding: 0 0 4px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card,
body[data-active-view="templates"] #view-templates .orders-machine-tab-action {
  min-width: 118px !important;
  min-height: 66px !important;
  padding: 12px 14px !important;
  border: 1px solid rgba(218, 227, 239, 0.92) !important;
  border-radius: 13px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(249, 252, 255, 0.96) 100%) !important;
  box-shadow:
    0 18px 34px -30px rgba(22, 47, 78, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card:hover,
body[data-active-view="templates"] #view-templates .orders-machine-tab-action:hover {
  transform: translateY(-1px) !important;
  border-color: rgba(170, 194, 223, 0.95) !important;
  background: #ffffff !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card.is-active {
  border-color: rgba(77, 145, 230, 0.72) !important;
  background:
    linear-gradient(180deg, #f3f8ff 0%, #e8f2ff 100%) !important;
  box-shadow:
    0 20px 36px -30px rgba(47, 128, 237, 0.75),
    inset 0 0 0 1px rgba(47, 128, 237, 0.12) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__top {
  align-items: flex-start !important;
  margin-bottom: 8px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__plate {
  color: #1b2a3e !important;
  font-size: 13px !important;
  font-weight: 820 !important;
  letter-spacing: -0.015em !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__count {
  min-width: 20px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: #edf3fa !important;
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 800 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card.is-active .orders-machine-card__count {
  background: #dcecff !important;
  color: #1e64c8 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__status {
  color: #78879a !important;
  font-size: 10px !important;
  font-weight: 760 !important;
  letter-spacing: 0.045em !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card--create {
  min-width: 104px !important;
  justify-content: center !important;
  color: #405168 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tab-action--danger {
  color: #e35b65 !important;
  background:
    linear-gradient(180deg, rgba(255, 250, 250, 0.95), rgba(255, 245, 246, 0.95)) !important;
}

body[data-active-view="templates"] #view-templates .orders-table-wrap {
  flex: 1 1 auto !important;
  min-height: 420px !important;
  margin: 2px 0 0 !important;
  border: 1px solid rgba(218, 227, 239, 0.95) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 253, 255, 0.98) 100%) !important;
  box-shadow:
    0 24px 50px -46px rgba(22, 47, 78, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  overflow: auto !important;
}

body[data-active-view="templates"] #view-templates .orders-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  color: var(--orders-ref-ink) !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  height: var(--orders-grid-head-height) !important;
  padding: 0 22px 0 18px !important;
  border-right: 1px solid rgba(229, 237, 246, 0.86) !important;
  border-bottom: 1px solid var(--orders-ref-line) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 250, 254, 0.96) 100%) !important;
  color: #75859a !important;
  font-size: 11px !important;
  font-weight: 780 !important;
  letter-spacing: 0.04em !important;
  text-transform: none !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  height: var(--orders-grid-row-height) !important;
  min-height: var(--orders-grid-row-height) !important;
  padding: 0 18px !important;
  border-right: 1px solid rgba(229, 237, 246, 0.72) !important;
  border-bottom: 1px solid rgba(231, 238, 247, 0.88) !important;
  color: #172033 !important;
  font-size: var(--orders-grid-font-size) !important;
  font-weight: 620 !important;
  vertical-align: middle !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row {
  height: var(--orders-grid-row-height) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:nth-child(even) {
  background: rgba(252, 254, 255, 0.96) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group,
body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group:nth-child(even) {
  background: rgba(247, 252, 250, 0.92) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:hover {
  background: #f4f9ff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-selected {
  background: var(--orders-ref-selected) !important;
  box-shadow:
    inset 4px 0 0 var(--orders-ref-blue),
    inset 0 -1px 0 rgba(211, 228, 247, 0.88) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-route-selected {
  background: #f0f7ff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:first-child,
body[data-active-view="templates"] #view-templates .orders-table__cell:first-child {
  border-left: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:last-child,
body[data-active-view="templates"] #view-templates .orders-table__cell:last-child {
  border-right: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell > span,
body[data-active-view="templates"] #view-templates .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-2,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-3,
body[data-active-view="templates"] #view-templates .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__empty,
body[data-active-view="templates"] #view-templates .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__location-place {
  color: inherit !important;
  font-size: var(--orders-grid-font-size) !important;
  font-weight: 640 !important;
  line-height: var(--orders-grid-row-height) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__order-num {
  font-weight: 760 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="routeSummary"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 250, 254, 0.96) 100%) !important;
  color: #75859a !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  height: var(--orders-grid-row-height) !important;
  gap: 10px !important;
  padding: 0 8px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code {
  height: 24px !important;
  max-width: calc((100% - 34px) / 2) !important;
  padding: 0 10px !important;
  border: 1px solid rgba(218, 227, 239, 0.96) !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  box-shadow:
    0 8px 16px -14px rgba(22, 47, 78, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.98) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  color: #1a2f4a !important;
  font-size: 12px !important;
  font-weight: 820 !important;
  line-height: 22px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  flex: 0 0 16px !important;
  width: 16px !important;
  color: #9aa8b8 !important;
  font-size: 13px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  width: 6px !important;
  height: 6px !important;
  background: #2f80ed !important;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot--end {
  background: #21ad83 !important;
  box-shadow: 0 0 0 3px rgba(33, 173, 131, 0.12) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term {
  min-width: 48px !important;
  height: 24px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: #eaf4ff !important;
  color: #2667b5 !important;
  font-size: 11px !important;
  font-weight: 820 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__doc-chip,
body[data-active-view="templates"] #view-templates .orders-table__truck-card,
body[data-active-view="templates"] #view-templates .orders-table__link--map,
body[data-active-view="templates"] #view-templates .orders-table__chip,
body[data-active-view="templates"] #view-templates .orders-table__number {
  height: 24px !important;
  border: 1px solid rgba(218, 227, 239, 0.92) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #405168 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-table__link--map {
  padding-inline: 9px !important;
  color: #405168 !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell {
  justify-content: center !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  width: 74px !important;
  max-width: 74px !important;
  height: 26px !important;
  border: 1px solid rgba(226, 234, 244, 0.96) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #172033 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  font-size: 12px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell--control,
body[data-active-view="templates"] #view-templates .orders-table__head--control {
  width: 42px !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row-action {
  width: 24px !important;
  height: 24px !important;
  border: 1px solid rgba(218, 227, 239, 0.9) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #8998aa !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle {
  right: -8px !important;
  width: 16px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::before {
  left: 7px !important;
  width: 1px !important;
  top: 9px !important;
  bottom: 9px !important;
  background: rgba(108, 145, 188, 0.42) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::after {
  opacity: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head:hover .orders-table__resize-handle::before,
body[data-active-view="templates"] #view-templates .orders-table__resize-handle:focus-visible::before,
body.is-column-resizing #view-templates .orders-table__resize-handle::before {
  width: 2px !important;
  background: #2f80ed !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-top: 0 !important;
  border-bottom: 0 !important;
  box-shadow: inset 0 3px 0 var(--orders-ref-week-line) !important;
}

body[data-active-view="templates"][data-orders-direction="asc"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  box-shadow: inset 0 -3px 0 var(--orders-ref-week-line) !important;
}

body[data-active-view="templates"] #view-templates .orders-empty {
  border: 1px solid rgba(218, 227, 239, 0.95) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.78) !important;
}

@media (max-width: 1180px) {
  body[data-active-view="templates"] #view-templates .orders-board__toolbar {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  body[data-active-view="templates"] #view-templates .orders-board__searchslot {
    justify-self: stretch !important;
    width: 100% !important;
  }

  body[data-active-view="templates"] #view-templates .orders-board__actions {
    justify-content: flex-start !important;
  }
}

/* Reference photo v2: move away from the old Trucken visual language. */
body[data-active-view="templates"] {
  --orders-photo-font: "Manrope", "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  --orders-photo-bg: #f3f7fc;
  --orders-photo-surface: rgba(255, 255, 255, 0.84);
  --orders-photo-card: #ffffff;
  --orders-photo-card-2: #fbfdff;
  --orders-photo-line: #e8eef6;
  --orders-photo-line-strong: #d8e2ee;
  --orders-photo-ink: #141b2d;
  --orders-photo-muted: #7a8798;
  --orders-photo-faint: #a6b1bf;
  --orders-photo-blue: #2f80ed;
  --orders-photo-blue-deep: #1f6fe5;
  --orders-photo-blue-soft: #eaf4ff;
  --orders-photo-green: #22b07d;
  --orders-photo-yellow: #f2bf47;
  --orders-photo-red: #e96270;
  --orders-photo-shadow: 0 22px 55px -46px rgba(29, 55, 88, 0.58);
  font-family: var(--orders-photo-font) !important;
  background: #f3f7fc !important;
}

body[data-active-view="templates"] .app-main {
  background:
    radial-gradient(circle at 12% 0%, rgba(116, 164, 221, 0.22), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(141, 183, 231, 0.17), transparent 32%),
    linear-gradient(180deg, #edf4fb 0%, #f8fbfe 100%) !important;
}

body[data-active-view="templates"] .topbar {
  min-height: 62px !important;
  padding: 0 26px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(218, 227, 239, 0.82) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 250, 255, 0.72)) !important;
  box-shadow:
    0 18px 40px -36px rgba(28, 54, 86, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.94) !important;
  color: var(--orders-photo-ink) !important;
  font-family: var(--orders-photo-font) !important;
}

body[data-active-view="templates"] .topbar__brandblock {
  display: none !important;
}

body[data-active-view="templates"] .topbar__lead {
  gap: 12px !important;
}

body[data-active-view="templates"] .topbar__module-nav {
  gap: 4px !important;
  padding: 4px !important;
  border: 1px solid rgba(218, 227, 239, 0.82) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

body[data-active-view="templates"] .topbar-nav-button {
  min-height: 38px !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: #647184 !important;
  box-shadow: none !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 13px !important;
  font-weight: 730 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

body[data-active-view="templates"] .topbar-nav-button.is-active {
  background: #ffffff !important;
  color: #226ac7 !important;
  box-shadow:
    0 12px 24px -22px rgba(36, 84, 140, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

body[data-active-view="templates"] .topbar__actions {
  gap: 10px !important;
}

body[data-active-view="templates"] #topbarWorkspaceControls {
  display: none !important;
}

body[data-active-view="templates"] .topbar__theme,
body[data-active-view="templates"] .pill-button--avatar-only {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border: 1px solid rgba(218, 227, 239, 0.86) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.78) !important;
  color: #667487 !important;
  box-shadow: 0 12px 24px -22px rgba(36, 84, 140, 0.42) !important;
}

body[data-active-view="templates"] .pill-button--avatar-only .avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  background: #edf4ff !important;
  color: #2a5fa8 !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 11px !important;
  font-weight: 820 !important;
}

body[data-active-view="templates"] #view-templates.orders-view {
  padding: 28px 30px 30px !important;
  background: transparent !important;
  font-family: var(--orders-photo-font) !important;
}

body[data-active-view="templates"] #view-templates .orders-board {
  gap: 20px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body[data-active-view="templates"] #view-templates .orders-board__toolbar {
  display: grid !important;
  grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 560px) max-content !important;
  align-items: center !important;
  gap: 24px !important;
  min-height: 54px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-board__titlewrap {
  gap: 8px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__titleline {
  gap: 14px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__title {
  color: #111827 !important;
  font-family: var(--orders-photo-font) !important;
  font-size: clamp(28px, 2.25vw, 36px) !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  letter-spacing: -0.055em !important;
}

body[data-active-view="templates"] #view-templates .orders-board__year-select {
  height: 40px !important;
  min-width: 92px !important;
  padding: 0 36px 0 16px !important;
  border: 1px solid rgba(224, 232, 242, 0.95) !important;
  border-radius: 13px !important;
  background: #ffffff !important;
  color: #1f2937 !important;
  box-shadow: 0 14px 28px -24px rgba(28, 55, 86, 0.42) !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 13px !important;
  font-weight: 780 !important;
}

body[data-active-view="templates"] #view-templates .panel-help {
  width: 34px !important;
  height: 34px !important;
  border: 1px solid rgba(224, 232, 242, 0.95) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #8a97a8 !important;
  box-shadow: 0 14px 28px -24px rgba(28, 55, 86, 0.42) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__subtitle {
  display: none !important;
}

body[data-active-view="templates"] #view-templates .orders-board__searchslot {
  width: 100% !important;
  justify-self: center !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search {
  min-height: 50px !important;
}

body[data-active-view="templates"] #view-templates .orders-filter__input,
body[data-active-view="templates"] #view-templates .orders-filter--search .orders-filter__input {
  min-height: 50px !important;
  padding-left: 52px !important;
  border: 1px solid rgba(224, 232, 242, 0.98) !important;
  border-radius: 15px !important;
  background: rgba(255, 255, 255, 0.86) !important;
  color: #1f2937 !important;
  box-shadow:
    0 18px 34px -30px rgba(28, 55, 86, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 13px !important;
  font-weight: 620 !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search::before {
  left: 19px !important;
  border-color: #9aa8b8 !important;
}

body[data-active-view="templates"] #view-templates .orders-filter--search::after {
  left: 30px !important;
  background: #9aa8b8 !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions {
  gap: 10px !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button,
body[data-active-view="templates"] #view-templates .orders-board__actions .primary {
  min-height: 46px !important;
  border-radius: 14px !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 13px !important;
  font-weight: 780 !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .ghost-button {
  border: 1px solid rgba(224, 232, 242, 0.98) !important;
  background: rgba(255, 255, 255, 0.84) !important;
  color: #354154 !important;
  box-shadow: 0 15px 28px -25px rgba(28, 55, 86, 0.42) !important;
}

body[data-active-view="templates"] #view-templates .orders-board__actions .primary {
  min-width: 148px !important;
  border: 1px solid rgba(31, 111, 229, 0.78) !important;
  background: linear-gradient(180deg, #3c93ff 0%, #1f76ec 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 18px 32px -22px rgba(31, 118, 236, 0.78) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs {
  padding: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tabs__scroller {
  display: flex !important;
  gap: 10px !important;
  padding: 0 0 2px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card,
body[data-active-view="templates"] #view-templates .orders-machine-tab-action {
  min-width: 118px !important;
  min-height: 72px !important;
  padding: 14px 16px !important;
  border: 1px solid rgba(224, 232, 242, 0.96) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    0 20px 38px -32px rgba(28, 55, 86, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  font-family: var(--orders-photo-font) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card--all {
  min-width: 142px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card.is-active {
  border-color: rgba(47, 128, 237, 0.3) !important;
  background: #ffffff !important;
  box-shadow:
    0 22px 40px -30px rgba(47, 128, 237, 0.34),
    inset 0 -2px 0 rgba(47, 128, 237, 0.18) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  gap: 12px !important;
  margin-bottom: 10px !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__plate {
  color: #1c2535 !important;
  font-size: 13px !important;
  font-weight: 820 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.02em !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__flag {
  margin-right: 5px !important;
  filter: saturate(1.08) !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__count {
  min-width: 22px !important;
  height: 22px !important;
  padding: 0 7px !important;
  border-radius: 999px !important;
  background: #eff4f9 !important;
  color: #6d7b8c !important;
  font-size: 11px !important;
  font-weight: 820 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__status {
  color: #788596 !important;
  font-size: 11px !important;
  font-weight: 680 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__status--route {
  color: #2c69ba !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card__status--loading {
  color: #256f58 !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-card--create,
body[data-active-view="templates"] #view-templates .orders-machine-tab-action--danger {
  justify-content: center !important;
}

body[data-active-view="templates"] #view-templates .orders-machine-tab-action--danger {
  min-width: 104px !important;
  color: #d85b67 !important;
}

body[data-active-view="templates"] #view-templates .orders-table-wrap {
  min-height: 520px !important;
  margin: 0 !important;
  border: 1px solid rgba(224, 232, 242, 0.98) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.84) !important;
  box-shadow:
    0 22px 52px -42px rgba(28, 55, 86, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  overflow: auto !important;
}

body[data-active-view="templates"] #view-templates .orders-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-family: var(--orders-photo-font) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  height: 46px !important;
  padding: 0 20px !important;
  border-right: 1px solid rgba(232, 238, 246, 0.74) !important;
  border-bottom: 1px solid rgba(232, 238, 246, 0.95) !important;
  background: rgba(251, 253, 255, 0.96) !important;
  color: #7b8797 !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 11px !important;
  font-weight: 720 !important;
  letter-spacing: -0.005em !important;
  text-transform: none !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head-label {
  gap: 7px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head-label span:first-child::after {
  content: "↕" !important;
  margin-left: 7px !important;
  color: #c1c9d4 !important;
  font-size: 10px !important;
  font-weight: 800 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head--control .orders-table__head-label span:first-child::after {
  content: "" !important;
  margin: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 20px !important;
  border-right: 1px solid rgba(232, 238, 246, 0.64) !important;
  border-bottom: 1px solid rgba(232, 238, 246, 0.8) !important;
  color: #172033 !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 12px !important;
  font-weight: 620 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row {
  height: 42px !important;
  background: rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:nth-child(even) {
  background: rgba(253, 254, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group,
body[data-active-view="templates"] #view-templates .orders-table__row.has-route-group:nth-child(even) {
  background: rgba(255, 255, 255, 0.95) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:hover {
  background: #f7fbff !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-selected {
  background: #eef6ff !important;
  box-shadow: inset 3px 0 0 var(--orders-photo-blue) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell > span,
body[data-active-view="templates"] #view-templates .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-2,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-3,
body[data-active-view="templates"] #view-templates .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__location-place {
  color: inherit !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 12px !important;
  font-weight: 640 !important;
  line-height: 42px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money {
  font-variant-numeric: tabular-nums !important;
  font-weight: 720 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  justify-content: flex-start !important;
  height: 42px !important;
  padding: 0 !important;
  gap: 10px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code {
  height: 26px !important;
  max-width: calc((100% - 36px) / 2) !important;
  padding: 0 10px !important;
  gap: 7px !important;
  border: 1px solid rgba(232, 238, 246, 0.96) !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 16px -14px rgba(28, 55, 86, 0.36) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  background: #f8fafc !important;
  font-size: 12px !important;
  line-height: 1 !important;
  box-shadow: 0 0 0 1px rgba(214, 222, 232, 0.8) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  display: none !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  color: #152033 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 24px !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  flex: 0 0 16px !important;
  width: 16px !important;
  color: #a4afbd !important;
  font-size: 12px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term {
  height: 26px !important;
  min-width: 52px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: #eaf4ff !important;
  color: #216ec9 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 26px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__doc-chip,
body[data-active-view="templates"] #view-templates .orders-table__truck-card,
body[data-active-view="templates"] #view-templates .orders-table__link--map,
body[data-active-view="templates"] #view-templates .orders-table__chip,
body[data-active-view="templates"] #view-templates .orders-table__number {
  height: 26px !important;
  border: 1px solid rgba(232, 238, 246, 0.95) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #526171 !important;
  font-size: 11px !important;
  line-height: 24px !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  width: 78px !important;
  max-width: 78px !important;
  height: 28px !important;
  border: 1px solid rgba(232, 238, 246, 0.96) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #172033 !important;
  font-family: var(--orders-photo-font) !important;
  font-size: 12px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row-action {
  width: 26px !important;
  height: 26px !important;
  border: 1px solid rgba(232, 238, 246, 0.96) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #93a0af !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::before {
  top: 11px !important;
  bottom: 11px !important;
  left: 7px !important;
  width: 1px !important;
  background: rgba(188, 200, 214, 0.9) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__resize-handle::after {
  opacity: 0 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  border-top: 0 !important;
  border-bottom: 0 !important;
  box-shadow: inset 0 3px 0 #1f5f9f !important;
}

body[data-active-view="templates"][data-orders-direction="asc"] #view-templates .orders-table__row.is-week-boundary > .orders-table__cell {
  box-shadow: inset 0 -3px 0 #1f5f9f !important;
}

/* Route column exact pass: match the reference crop with two clean chips and a soft arrow. */
body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="routeSummary"] {
  padding-left: 18px !important;
  padding-right: 18px !important;
  color: #7e8794 !important;
  font-size: 11px !important;
  font-weight: 720 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] {
  padding: 0 16px !important;
  background: transparent !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="routeSummary"] > .orders-route-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 10px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code {
  flex: 0 1 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 92px !important;
  max-width: calc((100% - 34px) / 2) !important;
  height: 23px !important;
  padding: 0 9px !important;
  gap: 6px !important;
  border: 1px solid #e7edf5 !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  box-shadow:
    0 1px 2px rgba(20, 35, 55, 0.035),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code--end {
  border-color: #e7edf5 !important;
  background: #ffffff !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag {
  flex: 0 0 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 14px !important;
  height: 14px !important;
  margin: 0 !important;
  border: 1px solid rgba(218, 226, 237, 0.92) !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.62) !important;
  overflow: hidden !important;
  font-size: 0 !important;
  line-height: 1 !important;
  filter: saturate(1.04) contrast(1.02) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="FR"] {
  background: linear-gradient(90deg, #284fae 0 33.33%, #ffffff 33.33% 66.66%, #d94352 66.66% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="DE"] {
  background: linear-gradient(180deg, #1f2024 0 33.33%, #d13d49 33.33% 66.66%, #f0c84a 66.66% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="PL"] {
  background: linear-gradient(180deg, #ffffff 0 50%, #d94352 50% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="NL"] {
  background: linear-gradient(180deg, #c83d49 0 33.33%, #ffffff 33.33% 66.66%, #315fbd 66.66% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="BE"] {
  background: linear-gradient(90deg, #1f2024 0 33.33%, #f0c84a 33.33% 66.66%, #d94352 66.66% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="ES"] {
  background: linear-gradient(180deg, #c83d49 0 24%, #f0c84a 24% 76%, #c83d49 76% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag[data-country="IT"] {
  background: linear-gradient(90deg, #25945f 0 33.33%, #ffffff 33.33% 66.66%, #d94352 66.66% 100%) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__dot {
  display: none !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: 74px !important;
  color: #151f31 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
  line-height: 21px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  flex: 0 0 14px !important;
  width: 14px !important;
  color: #b2bbc7 !important;
  font-size: 12px !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  text-align: center !important;
  transform: translateY(-1px) !important;
}

/* Typography contrast pass: sharper table text, less washed-out controls. */
body[data-active-view="templates"] #view-templates {
  --orders-type-ink: #0f172a;
  --orders-type-muted: #5f6f83;
  --orders-type-head: #68788d;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  color: var(--orders-type-head) !important;
  font-size: 11px !important;
  font-weight: 820 !important;
  letter-spacing: 0.035em !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head-label span:first-child::after {
  color: #a7b3c2 !important;
  font-weight: 900 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  color: var(--orders-type-ink) !important;
  font-size: 12.5px !important;
  font-weight: 680 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell > span,
body[data-active-view="templates"] #view-templates .orders-table__text,
body[data-active-view="templates"] #view-templates .orders-table__text--ellipsis,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-2,
body[data-active-view="templates"] #view-templates .orders-table__text--clamp-3,
body[data-active-view="templates"] #view-templates .orders-table__order-num,
body[data-active-view="templates"] #view-templates .orders-table__date,
body[data-active-view="templates"] #view-templates .orders-table__money,
body[data-active-view="templates"] #view-templates .orders-table__number,
body[data-active-view="templates"] #view-templates .orders-table__party-name,
body[data-active-view="templates"] #view-templates .orders-table__location-place {
  color: var(--orders-type-ink) !important;
  font-size: 12.5px !important;
  font-weight: 680 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="loadDate"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="unloadDate"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="freightRate"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="kilometers"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="paymentTermDays"] {
  font-variant-numeric: tabular-nums !important;
  font-weight: 760 !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__code {
  border-color: #dbe5f0 !important;
  background: #ffffff !important;
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.82) !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__endpoint {
  color: #0f172a !important;
  font-size: 11.5px !important;
  font-weight: 860 !important;
  letter-spacing: -0.015em !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__arrow {
  color: #8796a8 !important;
  font-weight: 820 !important;
}

body[data-active-view="templates"] #view-templates .orders-route-compact__flag {
  border-color: rgba(194, 205, 220, 0.96) !important;
  filter: saturate(1.16) contrast(1.08) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term {
  color: #1359ad !important;
  background: #e5f1ff !important;
  font-weight: 860 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__doc-chip,
body[data-active-view="templates"] #view-templates .orders-table__truck-card,
body[data-active-view="templates"] #view-templates .orders-table__link--map,
body[data-active-view="templates"] #view-templates .orders-table__chip,
body[data-active-view="templates"] #view-templates .orders-table__number {
  border-color: #dbe5f0 !important;
  color: #26364a !important;
  font-weight: 760 !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  border-color: #d5e0ec !important;
  color: #0f172a !important;
  font-weight: 760 !important;
  box-shadow: none !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input:focus {
  border-color: #2f80ed !important;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.13) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row-action {
  border-color: #dbe5f0 !important;
  color: #596b80 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row:hover .orders-table__cell {
  color: #0b1324 !important;
}

/* Reference lines/payment/expenses pass: crisp thin black separators and clearer inputs. */
body[data-active-view="templates"] #view-templates {
  --orders-line-black: rgba(15, 23, 42, 0.22);
  --orders-line-black-soft: rgba(15, 23, 42, 0.16);
}

body[data-active-view="templates"] #view-templates .orders-table-wrap {
  border-color: rgba(15, 23, 42, 0.18) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head {
  border-right: 1px solid var(--orders-line-black) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.28) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__cell {
  border-right: 1px solid var(--orders-line-black-soft) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.14) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__row + .orders-table__row > .orders-table__cell {
  border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__head[data-column-key="weeklyExpense"],
body[data-active-view="templates"] #view-templates .orders-table__cell[data-column-key="weeklyExpense"] {
  border-left: 1px solid rgba(15, 23, 42, 0.2) !important;
  border-right: 1px solid rgba(15, 23, 42, 0.2) !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term {
  min-width: 54px !important;
  height: 24px !important;
  padding: 0 9px !important;
  border: 1px solid rgba(207, 226, 249, 0.82) !important;
  border-radius: 7px !important;
  background: #eef7ff !important;
  color: #1f6fc3 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  font-size: 11px !important;
  font-weight: 840 !important;
  line-height: 22px !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term[title*="45"],
body[data-active-view="templates"] #view-templates .orders-table__payment-term:has(span[title*="45"]) {
  background: #f6edff !important;
  border-color: rgba(222, 203, 249, 0.86) !important;
  color: #7c4ac5 !important;
}

body[data-active-view="templates"] #view-templates .orders-table__payment-term[title*="60"],
body[data-active-view="templates"] #view-templates .orders-table__payment-term:has(span[title*="60"]) {
  background: #ecfbf4 !important;
  border-color: rgba(190, 235, 215, 0.9) !important;
  color: #1f8b61 !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell {
  justify-content: center !important;
  padding: 0 8px !important;
  overflow: visible !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input {
  display: block !important;
  box-sizing: border-box !important;
  width: 76px !important;
  max-width: 76px !important;
  height: 25px !important;
  border: 1px solid rgba(15, 23, 42, 0.22) !important;
  border-radius: 7px !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  color: #0f172a !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 1px rgba(15, 23, 42, 0.035) !important;
  background-clip: padding-box !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input:hover {
  border-color: rgba(15, 23, 42, 0.34) !important;
}

body[data-active-view="templates"] #view-templates .orders-week-expense-cell__input:focus {
  border-color: #1f6fe5 !important;
  box-shadow:
    0 0 0 3px rgba(31, 111, 229, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

@media (max-width: 1180px) {
  body[data-active-view="templates"] #view-templates .orders-board__toolbar {
    grid-template-columns: 1fr !important;
  }

  body[data-active-view="templates"] #view-templates .orders-board__actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}

@media (min-width: 721px) {
  body[data-active-view="workspace"] .topbar,
  body[data-active-view="templates"] .topbar,
  body[data-active-view="workspace"][data-theme="dark"] .topbar,
  body[data-active-view="templates"][data-theme="dark"] .topbar {
    height: 52px !important;
    min-height: 52px !important;
    padding: 8px 14px !important;
    gap: 16px !important;
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
    background: linear-gradient(180deg, #111a24 0%, #0d141c 100%) !important;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: none !important;
  }

  body[data-active-view="workspace"] .topbar__module-nav,
  body[data-active-view="templates"] .topbar__module-nav,
  body[data-active-view="workspace"][data-theme="dark"] .topbar__module-nav,
  body[data-active-view="templates"][data-theme="dark"] .topbar__module-nav {
    height: 38px !important;
    min-height: 38px !important;
    gap: 4px !important;
    padding: 3px !important;
    border-radius: 11px !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    box-shadow: none !important;
  }

  body[data-active-view="workspace"] .topbar-nav-button,
  body[data-active-view="templates"] .topbar-nav-button,
  body[data-active-view="workspace"][data-theme="dark"] .topbar-nav-button,
  body[data-active-view="templates"][data-theme="dark"] .topbar-nav-button {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 14px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body[data-active-view="templates"] #topbarWorkspaceControls[hidden],
  body[data-active-view="templates"][data-theme="dark"] #topbarWorkspaceControls[hidden] {
    display: inline-flex !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* Keep the shared production header identical between Tetris and Orders. */
body[data-active-view="templates"] .topbar__brandblock,
body[data-active-view="templates"][data-theme="dark"] .topbar__brandblock {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 2px !important;
  transform: translateY(-4px) !important;
}

body[data-active-view="templates"] .topbar__lead,
body[data-active-view="templates"][data-theme="dark"] .topbar__lead {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  min-width: 0 !important;
}

body[data-active-view="templates"] .topbar__brand,
body[data-active-view="templates"][data-theme="dark"] .topbar__brand {
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 0.95 !important;
  letter-spacing: 0.09em !important;
  color: #f8fafc !important;
}

body[data-active-view="templates"] .topbar__brand-subtitle,
body[data-active-view="templates"][data-theme="dark"] .topbar__brand-subtitle {
  font-size: 7px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: 0.16em !important;
  text-transform: lowercase !important;
  color: rgba(226, 232, 240, 0.62) !important;
}

@media (min-width: 721px) {
  body[data-active-view="workspace"] .topbar,
  body[data-active-view="templates"] .topbar,
  body[data-active-view="workspace"][data-theme="dark"] .topbar,
  body[data-active-view="templates"][data-theme="dark"] .topbar {
    height: 52px !important;
    min-height: 52px !important;
    padding: 8px 14px !important;
    gap: 16px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: linear-gradient(180deg, #111a24 0%, #0d141c 100%) !important;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04) !important;
    color: #f8fafc !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  }

  body[data-active-view="workspace"] .topbar__module-nav,
  body[data-active-view="templates"] .topbar__module-nav,
  body[data-active-view="workspace"][data-theme="dark"] .topbar__module-nav,
  body[data-active-view="templates"][data-theme="dark"] .topbar__module-nav {
    height: 38px !important;
    min-height: 38px !important;
    gap: 4px !important;
    padding: 3px !important;
    border-radius: 11px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    box-shadow: none !important;
  }

  body[data-active-view="workspace"] .topbar-nav-button,
  body[data-active-view="templates"] .topbar-nav-button,
  body[data-active-view="workspace"][data-theme="dark"] .topbar-nav-button,
  body[data-active-view="templates"][data-theme="dark"] .topbar-nav-button {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 14px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
  }
}
