/* Flat operations surface for dense admin workflows. */
:root {
  --lxm-surface: #ffffff !important;
  --lxm-bg: #faf7f3 !important;
  --lxm-line: #efe6dd !important;
  --lxm-line-strong: #e2d5c8 !important;
  --el-bg-color: #ffffff !important;
  --el-fill-color-blank: #ffffff !important;
  --el-fill-color: #fdfbf8 !important;
  --el-fill-color-light: #faf7f3 !important;
}

html,
body {
  background: var(--lxm-bg) !important;
  background-image: none !important;
}

body::before,
body::after {
  display: none !important;
}

.admin-shell,
.lxm-main,
.lxm-content {
  background: transparent !important;
}

/* Desktop navigation and workspace scroll independently. This keeps a long
 * sidebar usable without moving the active page away from its current work. */
@media (min-width: 761px) {
  .admin-shell {
    position: fixed;
    inset: 0;
    min-height: 0 !important;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .lxm-sidebar {
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .lxm-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .lxm-topbar {
    flex: 0 0 auto;
  }

  .lxm-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 760px) {
  .admin-shell {
    min-height: 0 !important;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .lxm-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .lxm-topbar {
    flex: 0 0 auto;
  }

  .lxm-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .lxm-sidebar {
    overscroll-behavior: contain;
  }
}

/* The desktop collapse handle stays on the sidebar edge instead of competing
 * with the brand area or the active page header. */
@media (min-width: 761px) {
  .admin-shell .lxm-sidebar.collapsed {
    width: 76px !important;
    flex-basis: 76px !important;
  }

  .admin-shell .sidebar-toggle {
    position: fixed;
    left: 248px;
    top: 50%;
    z-index: 1200;
    display: grid;
    place-items: center;
    width: 28px;
    height: 64px;
    padding: 0;
    border: 1px solid var(--lxm-line-strong, #e2d5c8) !important;
    border-left: 0 !important;
    border-radius: 0 8px 8px 0;
    background: var(--lxm-surface, #fff) !important;
    color: var(--lxm-brand-strong, #ee2c2c) !important;
    box-shadow: 4px 5px 16px rgba(42, 33, 27, .14);
    cursor: pointer;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    transform: translateY(-50%);
    transition: left .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
  }

  .admin-shell .sidebar-toggle:hover {
    border-color: var(--lxm-brand-strong, #ee2c2c) !important;
    background: var(--lxm-brand-strong, #ee2c2c) !important;
    color: #fff !important;
    box-shadow: 5px 7px 20px rgba(238, 44, 44, .24);
  }

  .admin-shell .sidebar-toggle:focus-visible {
    outline-offset: 3px;
  }

  .admin-shell .lxm-sidebar.collapsed .sidebar-toggle {
    left: 62px;
    top: 50%;
    width: 28px;
    height: 64px;
    transform: translateY(-50%);
  }

  .admin-shell .lxm-sidebar.collapsed .menu-group {
    display: grid;
    min-height: 18px;
    padding: 8px 0 4px;
    place-items: center;
  }

  .admin-shell .lxm-sidebar.collapsed .menu-group strong {
    display: none;
  }

  .admin-shell .lxm-sidebar.collapsed .menu-group::before {
    width: 22px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    content: "";
  }
}

@media (max-width: 760px) {
  .admin-shell .sidebar-toggle {
    display: none !important;
  }
}

.lxm-sidebar {
  background: var(--lxm-ink) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-right: 1px solid rgba(255, 255, 255, .12) !important;
  box-shadow: 2px 0 18px rgba(42, 33, 27, .16) !important;
}

.lxm-brand {
  background: var(--lxm-ink) !important;
  border-bottom-color: rgba(255, 255, 255, .12) !important;
}

.lxm-topbar {
  background: var(--lxm-surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--lxm-line) !important;
}

.lxm-topbar--account-only {
  min-height: 60px;
  justify-content: flex-end;
}

/* Keep the signed-in account in the expected upper-right anchor on wide
 * admin screens, independently of the filters and system indicators. */
@media (min-width: 1100px) {
  .lxm-topbar {
    padding-right: 176px;
  }

  .lxm-topbar--account-only {
    padding-right: 18px;
  }

  .lxm-topbar .user-menu {
    position: absolute;
    top: 12px;
    right: 18px;
    z-index: 2;
    margin-left: 0;
  }
}

@media (max-width: 1099px) {
  .lxm-topbar--account-only {
    justify-content: space-between;
  }

  .lxm-topbar .user-menu {
    position: static;
    margin-left: 6px;
    transform: none;
  }
}

@media (max-width: 760px) {
  .lxm-topbar--account-only {
    align-items: center !important;
    min-height: 60px !important;
    padding: 10px 12px !important;
  }

  .lxm-topbar--account-only .mobile-menu-toggle {
    display: inline-flex;
    grid-column: auto;
    grid-row: auto;
  }

  .lxm-topbar--account-only > .user-menu {
    display: inline-flex;
    width: auto !important;
    min-width: 0;
    margin-left: auto;
  }
}

.table-card,
.panel,
.stat-card,
.filter-card,
.order-summary > div,
.kpi-card,
.tenant-scope-bar,
.table-pager,
.lxm-page-head,
.lxm-toolbar,
.lxm-panel,
.lxm-card,
.config-page-head,
.config-metric-grid > div {
  background: var(--lxm-surface) !important;
  border-color: var(--lxm-line) !important;
  border-radius: 8px !important;
  box-shadow: var(--lxm-shadow-sm) !important;
}

.filter-card {
  border-left: 4px solid var(--lxm-brand) !important;
}

/* Button visuals, including teleported dialogs, are centralized in buttons.css. */

.el-input__wrapper,
.el-textarea__inner,
.el-select__wrapper,
.el-date-editor.el-input__wrapper {
  background: #ffffff !important;
  box-shadow: 0 0 0 1px var(--lxm-line-strong) inset !important;
}

/* Keep the spot editor's fields and number controls on the same grid. */
.spot-edit-dialog .content-form-section-head {
  position: static;
  align-items: center;
}

.spot-edit-dialog .content-form-section-head > span {
  max-width: 72%;
  line-height: 1.6;
  text-align: right;
}

.spot-edit-dialog .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.spot-edit-dialog .spot-location-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.spot-edit-dialog .spot-settings-grid {
  margin-top: 16px;
}

.spot-edit-dialog .form-grid > label {
  min-width: 0;
  align-content: start;
  grid-template-rows: minmax(24px, auto) auto;
}

.spot-edit-dialog .form-grid > label > span:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 24px;
  line-height: 1.5;
}

.spot-edit-dialog .el-input-number {
  display: flex;
  width: 100%;
  min-width: 0;
}

.spot-edit-dialog .el-input-number > .el-input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.spot-edit-dialog .el-input-number .el-input__wrapper {
  width: 100%;
}

.spot-edit-dialog .el-input-number .el-input__inner {
  text-align: left;
}

@media (max-width: 980px) {
  .spot-edit-dialog .spot-location-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .spot-edit-dialog .upload-block {
    flex-direction: column;
  }

  .spot-edit-dialog .upload-actions {
    width: 100%;
    min-width: 0;
  }

  .spot-edit-dialog .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .spot-edit-dialog .content-form-section-head > span {
    max-width: none;
    text-align: left;
  }
}

.el-table {
  --el-table-header-bg-color: var(--lxm-cream);
  --el-table-border-color: var(--lxm-line);
  background: var(--lxm-surface) !important;
}

.el-table th.el-table__cell {
  background: var(--lxm-cream) !important;
}

.el-table__body tr:hover > td.el-table__cell {
  background: var(--lxm-brand-soft) !important;
}

:is(
  .page-route-order-list,
  .page-route-task,
  .page-route-after-sale,
  .page-route-dispatch,
  .page-route-receive
) .table-link {
  display: flex;
  width: fit-content;
  align-items: center;
}

.order-drawer .service-workbench .step-node:disabled:not(.done):not(.active) {
  opacity: 1;
}

.order-drawer .service-workbench .step-node:disabled:not(.done):not(.active) .step-dot {
  background: #e6d8cb;
  color: #493c33;
  box-shadow: 0 0 0 2px #e6d8cb;
}

.order-drawer .service-workbench .step-node:disabled:not(.done):not(.active) .step-label {
  color: #65584e;
  font-weight: 700;
}

.page-route-order-list .order-alerts button.active {
  border-color: #c76743 !important;
  background: #fbe6d8 !important;
  color: #7a271a !important;
}

.page-route-order-list .order-alerts button.active strong {
  color: #7a271a !important;
}

.order-flow-dialog .timeline-filter-tabs button {
  border-color: #b9a797;
  background: #fffdfb;
  color: #5b3525;
}

.order-flow-dialog .timeline-filter-tabs button.active {
  border-color: #c76743;
  background: #fbe6d8;
  color: #7a271a;
}

.page-route-login .login-hero {
  background: var(--lxm-brand-strong) !important;
}

.page-route-login .login-panel {
  background: var(--lxm-surface) !important;
}

@media (max-width: 760px) {
  .lxm-content {
    background: var(--lxm-bg) !important;
  }
}
/* Independent delivery and follow-up facts stay readable after payment completion. */
.order-drawer .delivery-record-row,
.order-drawer .followup-record-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--lxm-border, #e7e2df);
}
.order-drawer .delivery-record-row small,
.order-drawer .followup-record-row small {
  display: block;
  color: var(--lxm-text-muted, #766459);
}
.order-drawer .followup-record-row > div {
  flex: 1;
  min-width: 180px;
}
.delivery-record-dialog.el-dialog {
  max-width: calc(100vw - 32px);
  background: #fff !important;
}
.delivery-record-dialog .el-dialog__body,
.delivery-record-dialog .el-dialog__footer {
  background: #fff;
}
.delivery-record-dialog .form-grid label.full-width {
  grid-column: 1 / -1;
}
