@import url("./trade_ops_admin.css");

:root {
  --lte-sidebar-width: 240px;
  --to-admin-navy: #0b3a5b;
  --to-admin-navy-deep: #082f49;
  --to-admin-navy-active: #ffffff;
  --to-admin-blue: #2563eb;
  --to-admin-sidebar-active: #0f4c81;
  --to-admin-sidebar-text: #d7e9f7;
  --to-admin-sidebar-muted: #9fc2da;
  --to-admin-sidebar-icon: #b9d7ea;
  --to-admin-title: #0f172a;
  --to-admin-text: #475569;
  --to-admin-muted: #94a3b8;
  --to-admin-border: #e2e8f0;
  --to-admin-bg: #f4f7fb;
  --to-admin-card: #ffffff;
  --to-admin-success: #16a34a;
  --to-admin-warning: #d97706;
  --to-admin-danger: #dc2626;
  --to-admin-purple: #7c3aed;
  /* Django autocomplete.css expects these variables, while Jazzmin does not define them. */
  --body-bg: #ffffff;
  --body-fg: #1f2937;
  --body-quiet-color: #6b7280;
  --border-color: #ced4da;
  --darkened-bg: #f1f5f9;
}

body,
button,
input,
select,
textarea {
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

body.bg-body-tertiary,
.app-main,
.app-content {
  background: var(--to-admin-bg) !important;
}

/* Keep Django's admin-autocomplete Select2 controls visible inside Jazzmin forms. */
.change-form .select2-container--admin-autocomplete .select2-selection--single,
.change-form .select2-container--admin-autocomplete .select2-selection--multiple {
  min-height: 38px !important;
  color: var(--body-fg) !important;
  background-color: var(--body-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
}

.change-form .select2-container--admin-autocomplete .select2-selection--single .select2-selection__rendered {
  height: 36px !important;
  padding: 0 2.25rem 0 0.75rem !important;
  color: var(--body-fg) !important;
  line-height: 36px !important;
}

.change-form .select2-container--admin-autocomplete .select2-selection--single .select2-selection__placeholder {
  color: #94a3b8 !important;
}

.change-form .select2-container--admin-autocomplete .select2-selection--single .select2-selection__arrow {
  top: 0 !important;
  right: 0.45rem !important;
  height: 36px !important;
}

.change-form .select2-container--admin-autocomplete.select2-container--focus .select2-selection,
.change-form .select2-container--admin-autocomplete.select2-container--open .select2-selection {
  border-color: #80bdff !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.2);
  outline: 0;
}

.change-form .select2-container--admin-autocomplete.select2-container--disabled .select2-selection {
  color: #64748b !important;
  background-color: var(--darkened-bg) !important;
}

.app-sidebar,
.main-sidebar {
  width: 240px !important;
  background: var(--to-admin-navy) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 8px 0 24px rgba(8, 47, 73, 0.14) !important;
}

.app-sidebar .sidebar-brand,
.main-sidebar .brand-link {
  min-height: 88px;
  background: var(--to-admin-navy-deep) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.app-sidebar .brand-link,
.main-sidebar .brand-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem 1.05rem;
  color: #ffffff !important;
  text-decoration: none;
}

.tradeops-sidebar-logo {
  width: 44px;
  height: 44px;
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-sidebar-active);
  background: #ffffff;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(2, 20, 34, 0.18);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.tradeops-sidebar-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.tradeops-sidebar-brand-copy strong {
  color: #ffffff;
  font-size: 1.18rem;
  font-weight: 750;
  white-space: nowrap;
}

.tradeops-sidebar-brand-copy small {
  margin-top: 0.2rem;
  color: var(--to-admin-sidebar-muted);
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-sidebar .tradeops-sidebar-layout {
  height: calc(100vh - 88px) !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.55rem 0 0;
}

.tradeops-sidebar-nav {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.15rem 0 0.65rem;
  scrollbar-color: rgba(185, 215, 234, 0.42) transparent;
  scrollbar-width: thin;
}

.tradeops-sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.tradeops-sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.tradeops-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(185, 215, 234, 0.38);
  border-radius: 999px;
}

.app-sidebar .nav-header,
.main-sidebar .nav-header {
  display: none !important;
}

.app-sidebar .sidebar-menu > .nav-item,
.main-sidebar .nav-sidebar > .nav-item {
  margin: 0.3rem 0.875rem;
}

.app-sidebar .sidebar-menu .nav-link,
.main-sidebar .nav-sidebar .nav-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0.72rem 1rem;
  color: var(--to-admin-sidebar-text) !important;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-sidebar .sidebar-menu .nav-link p,
.main-sidebar .nav-sidebar .nav-link p {
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.app-sidebar .sidebar-menu .nav-icon,
.main-sidebar .nav-sidebar .nav-icon {
  width: 1.4rem;
  flex: 0 0 1.4rem;
  margin-right: 0.75rem;
  color: var(--to-admin-sidebar-icon);
  font-size: 1.02rem;
  text-align: center;
}

.app-sidebar .sidebar-menu .nav-link:hover,
.app-sidebar .sidebar-menu .nav-link:focus-visible,
.main-sidebar .nav-sidebar .nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.1);
}

.app-sidebar .sidebar-menu .nav-link:hover .nav-icon,
.app-sidebar .sidebar-menu .nav-link:focus-visible .nav-icon,
.main-sidebar .nav-sidebar .nav-link:hover .nav-icon {
  color: #ffffff;
}

.app-sidebar .sidebar-menu .nav-link.active,
.main-sidebar .nav-sidebar .nav-link.active {
  color: var(--to-admin-sidebar-active) !important;
  background: var(--to-admin-navy-active) !important;
  border-color: rgba(255, 255, 255, 0.84);
  box-shadow: 0 5px 14px rgba(2, 24, 43, 0.16);
}

.app-sidebar .sidebar-menu .nav-link.active .nav-icon,
.main-sidebar .nav-sidebar .nav-link.active .nav-icon {
  color: var(--to-admin-sidebar-active);
}

.tradeops-sidebar-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.85rem 0.9rem;
  background: var(--to-admin-navy-deep);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tradeops-sidebar-user-link {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #ffffff !important;
  text-decoration: none !important;
}

.tradeops-sidebar-avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-sidebar-active);
  background: #ffffff;
  border-radius: 50%;
  font-size: 0.86rem;
  font-weight: 800;
}

.tradeops-sidebar-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.tradeops-sidebar-user-meta strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tradeops-sidebar-user-meta small {
  margin-top: 0.12rem;
  color: var(--to-admin-sidebar-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.tradeops-sidebar-logout-form {
  margin: 0;
}

.tradeops-sidebar-logout {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-sidebar-icon);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
}

.tradeops-sidebar-logout:hover,
.tradeops-sidebar-logout:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
}

#jazzy-navbar,
.main-header.navbar {
  min-height: 64px;
  margin: 0 !important;
  padding: 0.5rem 1rem;
  background: #ffffff !important;
  border: 0 !important;
  border-bottom: 1px solid var(--to-admin-border) !important;
  border-radius: 0 !important;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04) !important;
}

#jazzy-navbar .nav-link,
.main-header .nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 0.78rem;
  color: #334155 !important;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.96rem;
  font-weight: 600;
}

#jazzy-navbar .nav-link:hover,
#jazzy-navbar .nav-link:focus-visible,
.main-header .nav-link:hover {
  color: var(--to-admin-blue) !important;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.tradeops-admin-v2 .app-content-header,
.tradeops-admin-v2 .content-header {
  display: none;
}

.tradeops-admin-v2 .app-content {
  padding: 0;
}

.tradeops-admin-v2 .app-content > .container-fluid {
  max-width: 1680px;
  padding: 1.5rem;
}

.tradeops-admin-v2 .app-content > .container-fluid > .row {
  margin: 0;
}

.to-admin-dashboard {
  width: 100%;
  color: var(--to-admin-text);
}

.to-admin-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
}

.to-admin-eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--to-admin-blue);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.to-admin-page-header h1 {
  margin: 0;
  color: var(--to-admin-title);
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.25;
}

.to-admin-page-header p,
.to-section-heading p,
.to-admin-panel__header p,
.to-module-card__header p {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.55;
}

.to-admin-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.to-admin-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.58rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.to-admin-btn--primary {
  color: #ffffff;
  background: var(--to-admin-blue);
  border-color: var(--to-admin-blue);
}

.to-admin-btn--primary:hover,
.to-admin-btn--primary:focus-visible {
  color: #ffffff;
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.to-admin-btn--secondary {
  color: #334155;
  background: #ffffff;
  border-color: #cbd5e1;
}

.to-admin-btn--secondary:hover,
.to-admin-btn--secondary:focus-visible {
  color: var(--to-admin-blue);
  background: #eff6ff;
  border-color: #93c5fd;
}

.to-system-summary {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.2rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}

.to-system-summary__icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-blue);
  background: #dbeafe;
  border-radius: 50%;
}

.to-system-summary strong,
.to-system-summary span {
  display: block;
}

.to-system-summary strong {
  color: var(--to-admin-title);
  font-size: 0.98rem;
}

.to-system-summary div > span,
.to-system-summary time {
  color: #64748b;
  font-size: 0.82rem;
}

.to-system-summary--danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.to-system-summary--danger .to-system-summary__icon {
  color: var(--to-admin-danger);
  background: #fee2e2;
}

.to-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.to-stat-card,
.to-admin-panel,
.to-module-card {
  min-width: 0;
  background: var(--to-admin-card);
  border: 1px solid var(--to-admin-border);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(13, 20, 36, 0.04);
}

.to-stat-card {
  padding: 1.1rem;
  border-top: 3px solid #93c5fd;
}

.to-stat-card--orange { border-top-color: #fbbf24; }
.to-stat-card--red { border-top-color: #f87171; }
.to-stat-card--green { border-top-color: #4ade80; }
.to-stat-card--gray { border-top-color: #cbd5e1; }

.to-stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.to-stat-card__label {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 700;
}

.to-stat-card__icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-blue);
  background: #eff6ff;
  border-radius: 9px;
}

.to-stat-card--orange .to-stat-card__icon { color: var(--to-admin-warning); background: #fff7ed; }
.to-stat-card--red .to-stat-card__icon { color: var(--to-admin-danger); background: #fef2f2; }
.to-stat-card--green .to-stat-card__icon { color: var(--to-admin-success); background: #f0fdf4; }
.to-stat-card--gray .to-stat-card__icon { color: #64748b; background: #f1f5f9; }

.to-stat-card__value {
  margin: 0.7rem 0 0.65rem;
  color: var(--to-admin-title);
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.1;
}

.to-stat-card__details {
  display: grid;
  gap: 0.28rem;
  padding-top: 0.65rem;
  border-top: 1px solid #f1f5f9;
}

.to-stat-card__details > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: #64748b;
  font-size: 0.78rem;
}

.to-stat-card__details strong {
  color: #334155;
  font-weight: 700;
}

.to-stat-card__empty {
  padding-top: 0.65rem;
  color: var(--to-admin-muted);
  border-top: 1px solid #f1f5f9;
  font-size: 0.78rem;
}

.to-admin-panel {
  margin-bottom: 1.2rem;
  padding: 1.1rem;
}

.to-admin-panel__header,
.to-section-heading,
.to-module-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.to-admin-panel__header {
  margin-bottom: 0.9rem;
}

.to-admin-panel__header h2,
.to-section-heading h2,
.to-module-card__header h3 {
  margin: 0;
  color: var(--to-admin-title);
  font-size: 1.08rem;
  font-weight: 750;
}

.to-admin-panel__count {
  flex: 0 0 auto;
  padding: 0.32rem 0.55rem;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.to-quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.to-quick-action {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem;
  color: #334155 !important;
  background: #f8fafc;
  border: 1px solid var(--to-admin-border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none !important;
}

.to-quick-action:hover,
.to-quick-action:focus-visible {
  color: var(--to-admin-blue) !important;
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.to-quick-action__icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-blue);
  background: #dbeafe;
  border-radius: 9px;
}

.to-quick-action--green .to-quick-action__icon { color: var(--to-admin-success); background: #dcfce7; }
.to-quick-action--purple .to-quick-action__icon { color: var(--to-admin-purple); background: #ede9fe; }
.to-quick-action--orange .to-quick-action__icon { color: var(--to-admin-warning); background: #ffedd5; }
.to-quick-action--cyan .to-quick-action__icon { color: #0891b2; background: #cffafe; }
.to-quick-action__arrow { color: #94a3b8; font-size: 0.7rem; }

.to-section-heading {
  margin: 0 0 0.85rem;
}

.to-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.to-module-card {
  overflow: hidden;
}

.to-module-card__header {
  padding: 1.05rem 1.1rem 0.9rem;
  border-bottom: 1px solid var(--to-admin-border);
}

.to-module-card__mark {
  width: 9px;
  height: 9px;
  margin-top: 0.35rem;
  background: var(--to-admin-blue);
  border-radius: 50%;
  box-shadow: 0 0 0 5px #dbeafe;
}

.to-module-card--green .to-module-card__mark { background: var(--to-admin-success); box-shadow: 0 0 0 5px #dcfce7; }
.to-module-card--purple .to-module-card__mark { background: var(--to-admin-purple); box-shadow: 0 0 0 5px #ede9fe; }

.to-module-card__list {
  padding: 0.35rem 0;
}

.to-module-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 62px;
  margin: 0 0.45rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 8px;
}

.to-module-row:last-child { border-bottom-color: transparent; }
.to-module-row:hover { background: #f8fafc; }

.to-module-row__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--to-admin-blue);
  background: #eff6ff;
  border-radius: 9px;
}

.to-module-card--green .to-module-row__icon { color: var(--to-admin-success); background: #f0fdf4; }
.to-module-card--purple .to-module-row__icon { color: var(--to-admin-purple); background: #f5f3ff; }

.to-module-row__body a {
  display: block;
  color: #1e293b !important;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none !important;
}

.to-module-row__body a:hover { color: var(--to-admin-blue) !important; }

.to-module-row__body span {
  display: block;
  margin-top: 0.18rem;
  color: #94a3b8;
  font-size: 0.72rem;
}

.to-module-row__actions {
  display: flex;
  gap: 0.3rem;
}

.to-module-row__actions a {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b !important;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  text-decoration: none !important;
}

.to-module-row__actions a:hover,
.to-module-row__actions a:focus-visible {
  color: var(--to-admin-blue) !important;
  background: #eff6ff;
  border-color: #93c5fd;
}

.to-admin-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 1rem;
}

.to-admin-bottom-grid > .to-admin-panel { margin-bottom: 0; }

.to-admin-recent .table-responsive {
  border: 1px solid var(--to-admin-border);
  border-radius: 10px;
}

.to-admin-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.to-admin-table th,
.to-admin-table td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.78rem;
}

.to-admin-table th {
  color: #64748b;
  background: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}

.to-admin-table td { color: #475569; }
.to-admin-table tbody tr:last-child td { border-bottom: 0; }
.to-admin-table a { color: #1d4ed8 !important; font-weight: 600; text-decoration: none !important; }

.to-action-badge {
  display: inline-flex;
  padding: 0.24rem 0.45rem;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.to-action-badge--green { color: #15803d; background: #dcfce7; }
.to-action-badge--red { color: #b91c1c; background: #fee2e2; }

.to-health-list {
  display: grid;
  gap: 0.55rem;
}

.to-health-item {
  display: grid;
  grid-template-columns: auto minmax(72px, auto) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 9px;
}

.to-health-item__dot {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
}

.to-health-item--success .to-health-item__dot { background: var(--to-admin-success); }
.to-health-item--warning .to-health-item__dot { background: var(--to-admin-warning); }
.to-health-item--danger .to-health-item__dot { background: var(--to-admin-danger); }

.to-health-item__label {
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
}

.to-health-item strong {
  justify-self: end;
  color: #334155;
  font-size: 0.75rem;
}

.to-health-item__detail {
  grid-column: 2 / -1;
  color: #94a3b8;
  font-size: 0.68rem;
}

.to-runtime-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.8rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid #e5e7eb;
}

.to-runtime-info > div {
  min-width: 0;
  padding: 0.58rem 0.65rem;
  background: #f8fafc;
  border-radius: 8px;
}

.to-runtime-info dt {
  margin-bottom: 0.18rem;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
}

.to-runtime-info dd {
  margin: 0;
  overflow: hidden;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.to-runtime-info code {
  color: #0f4c81;
  font-size: 0.74rem;
}

.to-admin-empty {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: #94a3b8;
  text-align: center;
}

.to-admin-empty__icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 50%;
}

.to-admin-empty p { margin: 0; font-size: 0.82rem; }

.to-admin-dashboard a:focus-visible,
.to-admin-dashboard button:focus-visible,
#jazzy-navbar a:focus-visible,
.app-sidebar a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35) !important;
  outline-offset: 2px;
}

.tradeops-admin-sidebar .nav-treeview {
  padding-left: 0.35rem;
}

.tradeops-admin-sidebar .nav-treeview .nav-link {
  min-height: 44px;
}

@media (min-width: 992px) {
  body.sidebar-collapse .app-sidebar {
    min-width: 4.6rem !important;
    width: 4.6rem !important;
    max-width: 4.6rem !important;
    margin-left: 0 !important;
  }

  body.sidebar-collapse .app-sidebar:hover {
    min-width: 240px !important;
    width: 240px !important;
    max-width: 240px !important;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .brand-link {
    justify-content: center;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .tradeops-sidebar-brand-copy,
  body.sidebar-collapse .app-sidebar:not(:hover) .tradeops-sidebar-user-meta,
  body.sidebar-collapse .app-sidebar:not(:hover) .tradeops-sidebar-logout-form,
  body.sidebar-collapse .app-sidebar:not(:hover) .sidebar-menu .nav-link p,
  body.sidebar-collapse .app-sidebar:not(:hover) .sidebar-menu .nav-arrow {
    display: none;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .sidebar-menu > .nav-item {
    margin-right: 0.55rem;
    margin-left: 0.55rem;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .sidebar-menu .nav-link {
    width: 3.5rem;
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .sidebar-menu .nav-icon {
    margin-right: 0;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .tradeops-sidebar-user {
    display: flex;
    justify-content: center;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
  }

  body.sidebar-collapse .app-sidebar:not(:hover) .tradeops-sidebar-user-link {
    justify-content: center;
  }
}

@media (max-width: 1199.98px) {
  .to-quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .to-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .to-module-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 991.98px) {
  .app-sidebar,
  .main-sidebar {
    width: 240px !important;
  }

  .app-sidebar .tradeops-sidebar-layout {
    height: calc(100vh - 88px) !important;
  }

  .app-sidebar .sidebar-menu .nav-link,
  .main-sidebar .nav-sidebar .nav-link {
    min-height: 46px;
  }

  .tradeops-admin-v2 .app-content > .container-fluid { padding: 1rem; }
  .to-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .to-module-grid { grid-template-columns: 1fr; }
  .to-module-card:last-child { grid-column: auto; }
  .to-admin-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
  .to-admin-page-header { align-items: stretch; flex-direction: column; }
  .to-admin-page-actions { justify-content: stretch; }
  .to-admin-page-actions > * { flex: 1 1 auto; }
  .to-admin-page-actions .to-admin-btn { width: 100%; justify-content: center; }
  .to-admin-page-header h1 { font-size: 1.65rem; }
  .to-system-summary { grid-template-columns: auto minmax(0, 1fr); }
  .to-system-summary time { grid-column: 2; }
  .to-stat-grid,
  .to-quick-grid { grid-template-columns: 1fr; }
  .to-admin-panel,
  .to-stat-card { padding: 0.9rem; }
  .to-health-item { grid-template-columns: auto minmax(64px, auto) auto; }
  .to-runtime-info { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .to-quick-action { transition: none; }
  .to-quick-action:hover { transform: none; }
}

/* Sales order item cards: scoped so quotation and purchasing admin stay unchanged. */
.app-orders.model-order.change-form .app-content,
.app-orders.model-order.change-form #content-main,
.app-orders.model-order.change-form #order_form {
  min-width: 0;
  overflow-x: clip;
}

.app-orders.model-order.change-form .tradeops-order-items {
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
}

.app-orders.model-order.change-form .tradeops-order-items > fieldset {
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-orders.model-order.change-form .tradeops-order-items__heading {
  padding: 0 0 0.75rem;
  background: transparent;
  border: 0;
}

.app-orders.model-order.change-form .tradeops-order-items__heading h2 {
  margin: 0;
  color: var(--to-admin-title);
  font-size: 1.05rem;
  font-weight: 700;
}

.app-orders.model-order.change-form .tradeops-order-items__heading p {
  margin: 0.25rem 0 0;
  color: var(--to-admin-text);
  font-size: 0.78rem;
}

.app-orders.model-order.change-form .tradeops-order-items__body {
  padding: 0;
}

.app-orders.model-order.change-form .tradeops-order-item-card {
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  overflow: visible;
  background: var(--to-admin-card);
  border: 1px solid var(--to-admin-border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 76, 129, 0.07);
}

.app-orders.model-order.change-form .tradeops-order-item-card__header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--to-admin-border);
  border-radius: 10px 10px 0 0;
}

.app-orders.model-order.change-form .tradeops-order-item-card__header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.app-orders.model-order.change-form .tradeops-order-item-card__index {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--to-admin-sidebar-active);
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
}

.app-orders.model-order.change-form .tradeops-order-item-card__product {
  overflow: hidden;
  color: var(--to-admin-text);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-orders.model-order.change-form .tradeops-order-item-grid {
  min-width: 0;
  display: grid;
  gap: 0.8rem;
  padding: 0.85rem;
}

.app-orders.model-order.change-form .tradeops-order-item-grid--primary {
  grid-template-columns: minmax(220px, 2fr) 90px 100px minmax(145px, 160px) 120px 120px;
}

.app-orders.model-order.change-form .tradeops-order-item-grid--summary {
  grid-template-columns: minmax(260px, 1fr) 120px 120px 120px;
  padding-top: 0;
}

.app-orders.model-order.change-form .tradeops-order-item-field {
  min-width: 0;
}

.app-orders.model-order.change-form .tradeops-order-item-field > label,
.app-orders.model-order.change-form .tradeops-order-item-metric > span {
  display: block;
  margin: 0 0 0.35rem;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
}

.app-orders.model-order.change-form .tradeops-order-item-field input,
.app-orders.model-order.change-form .tradeops-order-item-field select:not(.select2-hidden-accessible),
.app-orders.model-order.change-form .tradeops-order-item-field textarea,
.app-orders.model-order.change-form .tradeops-order-item-field .select2-container,
.app-orders.model-order.change-form .tradeops-order-item-field .related-widget-wrapper {
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
}

.app-orders.model-order.change-form .tradeops-order-item-field select.select2-hidden-accessible {
  width: 1px !important;
  max-width: 1px !important;
  inline-size: 1px !important;
  max-inline-size: 1px !important;
}

.app-orders.model-order.change-form .tradeops-order-item-field textarea {
  min-height: 70px;
  height: 70px;
  resize: vertical;
}

.app-orders.model-order.change-form .tradeops-order-item-field .errorlist {
  margin: 0.3rem 0 0;
  padding: 0;
  color: var(--to-admin-danger);
  font-size: 0.72rem;
  list-style: none;
}

.app-orders.model-order.change-form .tradeops-order-item-metric {
  min-width: 0;
  min-height: 70px;
  padding: 0.7rem;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 8px;
}

.app-orders.model-order.change-form .tradeops-order-item-metric strong {
  display: block;
  overflow: hidden;
  color: #1e293b;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-orders.model-order.change-form .tradeops-loss-badge {
  display: none;
  width: fit-content;
  margin-top: 0.3rem;
  padding: 0.15rem 0.4rem;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

.app-orders.model-order.change-form .tradeops-order-item-metric.is-loss strong {
  color: var(--to-admin-danger);
}

.app-orders.model-order.change-form .tradeops-order-item-metric.is-loss .tradeops-loss-badge {
  display: inline-flex;
}

.app-orders.model-order.change-form .tradeops-order-item-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.app-orders.model-order.change-form .tradeops-order-item-delete input {
  width: 16px !important;
  height: 16px;
  margin: 0;
}

.app-orders.model-order.change-form .tradeops-order-items .delete-related {
  display: none !important;
}

.app-orders.model-order.change-form .tradeops-order-items .related-widget-wrapper-link {
  width: 32px;
  height: 32px;
  margin: 0;
  border: 1px solid #dbe3ec;
  border-radius: 7px;
}

.app-orders.model-order.change-form .tradeops-order-items .related-widget-wrapper-link + .related-widget-wrapper-link {
  margin-left: 0.2rem;
}

.app-orders.model-order.change-form .tradeops-order-items .add-row {
  width: 100%;
  margin: 0;
}

.app-orders.model-order.change-form .tradeops-order-items .add-row a {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  float: none !important;
  color: var(--to-admin-sidebar-active) !important;
  background: #ffffff;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  font-size: 0 !important;
  font-weight: 700;
}

.app-orders.model-order.change-form .tradeops-order-items .add-row a::before {
  content: "+ 添加订单明细";
  font-size: 0.85rem;
}

.app-orders.model-order.change-form .tradeops-order-items .add-row a:hover,
.app-orders.model-order.change-form .tradeops-order-items .add-row a:focus-visible {
  color: #ffffff !important;
  background: var(--to-admin-sidebar-active);
  border-color: var(--to-admin-sidebar-active);
}

.app-orders.model-order.change-form .tradeops-order-items .inline-deletelink {
  color: var(--to-admin-danger) !important;
  font-size: 0.72rem;
  font-weight: 700;
}

@media (min-width: 992px) {
  .app-orders.model-order.change-form .col-lg-9 {
    flex: 0 0 calc(100% - 240px);
    max-width: calc(100% - 240px);
  }

  .app-orders.model-order.change-form .col-lg-3 {
    flex: 0 0 220px;
    max-width: 220px;
  }
}

@media (max-width: 1499.98px) and (min-width: 1200px) {
  .app-orders.model-order.change-form .tradeops-order-item-grid--primary {
    grid-template-columns: minmax(240px, 2fr) minmax(110px, 1fr) minmax(150px, 1fr);
  }
}

@media (max-width: 1199.98px) {
  .app-orders.model-order.change-form .tradeops-order-item-grid--primary,
  .app-orders.model-order.change-form .tradeops-order-item-grid--summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-orders.model-order.change-form .tradeops-order-item-field--product,
  .app-orders.model-order.change-form .tradeops-order-item-field--notes {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767.98px) {
  .app-orders.model-order.change-form .tradeops-order-item-card__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-orders.model-order.change-form .tradeops-order-item-grid--primary,
  .app-orders.model-order.change-form .tradeops-order-item-grid--summary {
    grid-template-columns: 1fr;
  }

  .app-orders.model-order.change-form .tradeops-order-item-field--product,
  .app-orders.model-order.change-form .tradeops-order-item-field--notes {
    grid-column: auto;
  }

  .app-orders.model-order.change-form .tradeops-order-item-grid {
    padding: 0.75rem;
  }
}

/* Purchase order item cards, isolated from every other Admin inline. */
.app-purchasing.model-purchaseorder.change-form .app-content,
.app-purchasing.model-purchaseorder.change-form #content-main,
.app-purchasing.model-purchaseorder.change-form #purchaseorder_form {
  min-width: 0;
  overflow-x: clip;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items {
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items > fieldset {
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items__heading {
  padding: 0 0 .75rem;
  background: transparent;
  border: 0;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items__heading h2 {
  margin: 0;
  color: var(--to-admin-title);
  font-size: 1.05rem;
  font-weight: 700;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items__heading p {
  margin: .25rem 0 0;
  color: var(--to-admin-text);
  font-size: .78rem;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items__body { padding: 0; }

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-empty {
  margin-bottom: 14px;
  padding: 1.5rem;
  color: #64748b;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  text-align: center;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card {
  min-width: 0;
  margin: 0 0 15px;
  overflow: visible;
  background: var(--to-admin-card);
  border: 1px solid var(--to-admin-border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 76, 129, .07);
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card__header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--to-admin-border);
  border-radius: 10px 10px 0 0;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card__header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card__index {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--to-admin-sidebar-active);
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 700;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card__product {
  overflow: hidden;
  color: var(--to-admin-text);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid {
  min-width: 0;
  display: grid;
  gap: .8rem;
  padding: .85rem;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--primary {
  grid-template-columns: minmax(240px, 1.8fr) minmax(260px, 2fr) minmax(90px, 100px) minmax(90px, 100px);
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--secondary {
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 140px) minmax(150px, 180px) minmax(110px, 130px);
  padding-top: 0;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-notes { min-width: 0; }

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field > label,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-notes > label,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-metric > span {
  display: block;
  margin: 0 0 .35rem;
  color: #475569;
  font-size: .75rem;
  font-weight: 700;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field input,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field select:not(.select2-hidden-accessible),
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field .select2-container,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field .related-widget-wrapper,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-notes textarea {
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field select.select2-hidden-accessible {
  width: 1px !important;
  max-width: 1px !important;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-notes {
  padding: 0 .85rem .85rem;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-notes textarea {
  min-height: 64px;
  height: 64px;
  resize: vertical;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-metric {
  min-width: 0;
  min-height: 70px;
  padding: .7rem;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 8px;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-metric strong {
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-delete {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
  color: #64748b;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-delete input { width: 16px !important; height: 16px; margin: 0; }
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .delete-related { display: none !important; }

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .related-widget-wrapper-link {
  width: 32px;
  height: 32px;
  margin: 0;
  border: 1px solid #dbe3ec;
  border-radius: 7px;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .related-widget-wrapper-link + .related-widget-wrapper-link { margin-left: .2rem; }
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .add-row { width: 100%; margin: 0; }

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .add-row a {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  float: none !important;
  color: var(--to-admin-sidebar-active) !important;
  background: #fff;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  font-size: 0 !important;
  font-weight: 700;
}

.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .add-row a::before { content: "+ 添加采购明细"; font-size: .85rem; }
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .add-row a:hover,
.app-purchasing.model-purchaseorder.change-form .tradeops-purchase-items .add-row a:focus-visible { color: #fff !important; background: var(--to-admin-sidebar-active); border-color: var(--to-admin-sidebar-active); }

@media (min-width: 992px) {
  .app-purchasing.model-purchaseorder.change-form .col-lg-9 { flex: 0 0 calc(100% - 240px); max-width: calc(100% - 240px); }
  .app-purchasing.model-purchaseorder.change-form .col-lg-3 { flex: 0 0 220px; max-width: 220px; }
}

@media (max-width: 1199.98px) {
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--primary,
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field--product,
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field--source { grid-column: 1 / -1; }
}

@media (max-width: 767.98px) {
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-card__header { align-items: flex-start; flex-direction: column; }
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--primary,
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-grid--secondary { grid-template-columns: 1fr; }
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field--product,
  .app-purchasing.model-purchaseorder.change-form .tradeops-purchase-item-field--source { grid-column: auto; }
}

/* Shared card-inline shell. Each business module owns only its field grid. */
.tradeops-card-inline {
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
}

.tradeops-card-inline > fieldset {
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.tradeops-card-inline__heading {
  padding: 0 0 .75rem;
  background: transparent;
  border: 0;
}

.tradeops-card-inline__heading h2 {
  margin: 0;
  color: var(--to-admin-title);
  font-size: 1.05rem;
  font-weight: 700;
}

.tradeops-card-inline__heading p {
  margin: .25rem 0 0;
  color: var(--to-admin-text);
  font-size: .78rem;
}

.tradeops-card-inline__body { padding: 0; }

.tradeops-card-inline__empty {
  margin-bottom: 15px;
  padding: 1.5rem;
  color: #64748b;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  text-align: center;
}

.tradeops-inline-card {
  min-width: 0;
  margin: 0 0 15px;
  overflow: visible;
  background: var(--to-admin-card);
  border: 1px solid var(--to-admin-border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 76, 129, .07);
}

.tradeops-inline-card__header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--to-admin-border);
  border-radius: 10px 10px 0 0;
}

.tradeops-inline-card__header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.tradeops-inline-card__index {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--to-admin-sidebar-active);
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 700;
}

.tradeops-inline-card__subject {
  overflow: hidden;
  color: var(--to-admin-text);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tradeops-inline-card__delete {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
  color: #b91c1c;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}

.tradeops-inline-card__delete input {
  width: 16px !important;
  height: 16px;
  margin: 0;
}

/* Quotation item cards, strictly scoped to the quotation change form. */
.app-quotations.model-quotation.change-form .app-content,
.app-quotations.model-quotation.change-form #content-main,
.app-quotations.model-quotation.change-form #quotation_form {
  min-width: 0;
  overflow-x: clip;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-grid {
  min-width: 0;
  display: grid;
  gap: .8rem;
  padding: .85rem;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--primary {
  grid-template-columns: minmax(220px, 2fr) 90px 100px minmax(145px, 160px) 120px 120px;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--summary {
  grid-template-columns: minmax(280px, 2fr) 130px 130px 130px;
  padding-top: 0;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field { min-width: 0; }

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field > label,
.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric > span {
  display: block;
  margin: 0 0 .35rem;
  color: #475569;
  font-size: .75rem;
  font-weight: 700;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field input,
.app-quotations.model-quotation.change-form .tradeops-quotation-item-field select:not(.select2-hidden-accessible),
.app-quotations.model-quotation.change-form .tradeops-quotation-item-field textarea,
.app-quotations.model-quotation.change-form .tradeops-quotation-item-field .select2-container,
.app-quotations.model-quotation.change-form .tradeops-quotation-item-field .related-widget-wrapper {
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field select.select2-hidden-accessible {
  width: 1px !important;
  max-width: 1px !important;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field textarea {
  min-height: 72px;
  height: 78px;
  max-height: 220px;
  resize: vertical;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-field .errorlist {
  margin: .3rem 0 0;
  padding: 0;
  color: var(--to-admin-danger);
  font-size: .72rem;
  list-style: none;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric {
  min-width: 0;
  min-height: 72px;
  padding: .7rem;
  background: #f8fafc;
  border: 1px solid #e8eef5;
  border-radius: 8px;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric strong {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  overflow: hidden;
  color: #1e293b;
  font-size: .98rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric strong small {
  color: #64748b;
  font-size: .68rem;
  line-height: 1.5rem;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric strong b { font-weight: 750; }
.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric.is-loss strong { color: var(--to-admin-danger); }
.app-quotations.model-quotation.change-form .tradeops-quotation-item-metric.is-loss .tradeops-loss-badge { display: inline-flex; }

.app-quotations.model-quotation.change-form .tradeops-quotation-items .delete-related { display: none !important; }

.app-quotations.model-quotation.change-form .tradeops-quotation-items .related-widget-wrapper-link {
  width: 32px;
  height: 32px;
  margin: 0;
  border: 1px solid #dbe3ec;
  border-radius: 7px;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-items .related-widget-wrapper-link + .related-widget-wrapper-link { margin-left: .2rem; }
.app-quotations.model-quotation.change-form .tradeops-quotation-items .add-row { width: 100%; margin: 0 0 1.25rem; }

.app-quotations.model-quotation.change-form .tradeops-quotation-items .add-row a {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  float: none !important;
  color: var(--to-admin-sidebar-active) !important;
  background: #fff;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  font-size: 0 !important;
  font-weight: 700;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-items .add-row a::before {
  content: "+ 添加报价明细";
  font-size: .85rem;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-items .add-row a:hover,
.app-quotations.model-quotation.change-form .tradeops-quotation-items .add-row a:focus-visible {
  color: #fff !important;
  background: var(--to-admin-sidebar-active);
  border-color: var(--to-admin-sidebar-active);
}

.app-quotations.model-quotation.change-form .tradeops-quotation-items .inline-deletelink {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: .35rem .6rem;
  color: #b91c1c !important;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 7px;
  font-size: 0 !important;
  font-weight: 700;
}

.app-quotations.model-quotation.change-form .tradeops-quotation-items .inline-deletelink::before {
  content: "移除明细";
  font-size: .72rem;
}

@media (min-width: 992px) {
  .app-quotations.model-quotation.change-form .col-lg-9 { flex: 0 0 calc(100% - 240px); max-width: calc(100% - 240px); }
  .app-quotations.model-quotation.change-form .col-lg-3 { flex: 0 0 220px; max-width: 220px; }
}

@media (max-width: 1499.98px) and (min-width: 1200px) {
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--primary { grid-template-columns: minmax(240px, 2fr) minmax(110px, 1fr) minmax(150px, 1fr); }
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--summary { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(110px, 1fr)); }
}

@media (max-width: 1199.98px) {
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--primary,
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-field--product,
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-field--notes { grid-column: 1 / -1; }
}

@media (max-width: 767.98px) {
  .tradeops-inline-card__header { align-items: flex-start; flex-direction: column; }
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--primary,
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid--summary { grid-template-columns: 1fr; }
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-field--product,
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-field--notes { grid-column: auto; }
  .app-quotations.model-quotation.change-form .tradeops-quotation-item-grid { padding: .75rem; }
  .app-quotations.model-quotation.change-form .tradeops-quotation-items .inline-deletelink { width: 100%; justify-content: center; }
}
