.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.view > * {
  min-width: 0;
}

.admin-tabs {
  display: none;
}

.admin-tab-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-tab-group > span {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-tabs .small-button {
  background: var(--panel);
}

.admin-tabs .small-button.active {
  border-color: rgba(15, 159, 143, 0.42);
  background: rgba(15, 159, 143, 0.12);
  color: var(--green);
}

.inner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.inner-tabs .small-button.active {
  border-color: rgba(15, 159, 143, 0.42);
  background: rgba(15, 159, 143, 0.12);
  color: var(--green);
}

.onboarding-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.onboarding-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(186, 211, 222, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfc 100%);
  box-shadow: 0 16px 34px rgba(31, 58, 74, 0.06);
}

.onboarding-card h3,
.onboarding-card p {
  margin: 0;
}

.onboarding-card p {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .onboarding-split {
    grid-template-columns: 1fr;
  }
}

.seo-pane,
.inner-pane {
  display: none;
}

.seo-pane.active,
.inner-pane.active {
  display: grid;
  gap: 12px;
}

.admin-section {
  display: none !important;
}

.admin-section.active {
  display: block !important;
}

.grid.admin-section.active {
  display: grid !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

#adminView > .metrics {
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid rgba(26, 55, 88, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(20, 184, 166, 0.13), rgba(37, 99, 235, 0.1)),
    #142a45;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

#adminView > .metrics .metric {
  min-height: 58px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
}

#adminView > .metrics .metric::before {
  width: 2px;
  opacity: 0.95;
}

#adminView > .metrics .metric strong {
  color: #f8fafc;
  font-size: 20px;
}

#adminView > .metrics .metric span {
  color: #9bc4d6;
  font-size: 12px;
}

.metric {
  position: relative;
  min-height: 76px;
  padding: 13px 14px 12px;
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbfd);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.metric.has-popover {
  overflow: visible;
  cursor: default;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
  opacity: 0.78;
}

.metric strong {
  display: block;
  color: #0f172a;
  font-size: 24px;
  line-height: 1.15;
}

.metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.metric-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 8px;
  z-index: 25;
  width: min(260px, calc(100vw - 40px));
  max-height: 420px;
  display: none;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(15, 143, 126, 0.2);
  border-radius: 8px;
  background: #102033;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.22);
}

.metric.has-popover:hover .metric-popover {
  display: grid;
}

.metric-popover-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 26px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #dbeafe;
  font-size: 12px;
}

.metric-popover-row:nth-child(2n) {
  background: rgba(255, 255, 255, 0.055);
}

.metric-popover-row span {
  margin: 0;
  color: #93a4bc;
  font-size: 12px;
}

.metric-popover-row strong {
  color: #f8fafc;
  font-size: 13px;
  white-space: nowrap;
}

.metric-popover-row.good strong {
  color: #35d07f;
}

.metric-popover-row.bad strong {
  color: #ff6b6b;
}

.admin-command-center {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(360px, 1.15fr) auto;
  gap: 10px;
  align-items: stretch;
}

.command-main,
.command-metrics,
.command-actions {
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.command-main {
  display: grid;
  gap: 4px;
  padding: 16px 17px;
  border-left: 5px solid var(--brand);
  background:
    linear-gradient(90deg, rgba(15, 143, 126, 0.1), rgba(255, 255, 255, 0.96) 58%),
    #fff;
}

.command-main.warn {
  border-left-color: var(--amber);
}

.command-main.bad {
  border-left-color: var(--red);
}

.command-main span,
.command-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.command-main strong {
  color: #0f172a;
  font-size: 21px;
}

.command-main.good strong {
  color: var(--green);
}

.command-main.bad strong {
  color: var(--red);
}

.command-main small {
  color: var(--muted);
}

.command-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  overflow: hidden;
}

.command-metrics div {
  display: grid;
  gap: 3px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f9fbfd);
}

.command-metrics div:last-child {
  border-right: 0;
}

.command-metrics strong {
  color: #0f172a;
  font-size: 18px;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--panel-soft);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.workspace-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 252, 0.96));
  text-align: left;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
  overflow: hidden;
}

.workspace-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
  opacity: 0.74;
}

.workspace-card:hover {
  border-color: rgba(15, 143, 126, 0.34);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.workspace-card strong {
  padding-left: 2px;
  font-size: 15px;
}

.workspace-card span {
  color: var(--muted);
  font-size: 13px;
}

.workspace-card small {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 650;
}

.workspace-card .workspace-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workspace-card .workspace-card-metrics b {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

[data-admin-section="leads"].panel {
  padding: 16px;
}

[data-admin-section="leads"] .panel-head {
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

[data-admin-section="leads"] .filters {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 26px rgba(22, 32, 51, 0.06);
}

.filters > input,
.filters > select,
.filters > .filter-field {
  min-width: 170px;
  flex: 1 1 170px;
}

.filter-field {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.filter-field input {
  width: 100%;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.quick-filters .small-button {
  background: var(--panel-soft);
}

.quick-filters .small-button.active {
  border-color: rgba(15, 159, 143, 0.42);
  background: rgba(15, 159, 143, 0.12);
  color: var(--green);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.lead-live-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.live-metric {
  display: grid;
  gap: 5px;
  min-height: 82px;
  border: 1px solid rgba(15, 143, 126, 0.16);
  border-radius: 8px;
  padding: 12px 13px;
  background:
    linear-gradient(180deg, rgba(15, 143, 126, 0.045), rgba(255, 255, 255, 0) 70%),
    #fff;
  box-shadow: var(--shadow-soft);
}

.live-metric strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.live-metric span {
  color: var(--muted);
  font-size: 12px;
}

.live-metric small {
  line-height: 1.25;
}

.fold-panel {
  margin: 0 0 10px;
  border: 1px solid rgba(216, 225, 236, 0.74);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(246, 249, 252, 0.92), rgba(255, 255, 255, 0.96)),
    #fff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.035);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.fold-panel:hover {
  border-color: rgba(15, 143, 126, 0.28);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055);
}

.fold-panel summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.fold-panel summary::-webkit-details-marker {
  display: none;
}

.fold-panel summary::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 6px;
  border: 1px solid rgba(15, 143, 126, 0.24);
  background:
    linear-gradient(135deg, rgba(15, 143, 126, 0.14), rgba(255, 255, 255, 0.95));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.fold-panel summary::after {
  content: "Раскрыть";
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid rgba(216, 225, 236, 0.95);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.fold-panel[open] summary {
  border-bottom: 1px solid var(--line);
  background: rgba(237, 248, 246, 0.72);
}

.fold-panel[open] summary::after {
  content: "Свернуть";
  color: var(--brand-dark);
  border-color: rgba(15, 143, 126, 0.24);
  background: rgba(15, 143, 126, 0.08);
}

.fold-panel > form,
.fold-panel > .lead-insight-grid,
.lead-control-fold > .filters,
.lead-control-fold > .quick-filters,
.lead-control-fold > .summary-strip,
.lead-control-fold > .daily-breakdown {
  padding: 12px;
}

.lead-control-fold > .filters {
  position: static;
  margin: 12px;
  padding: 10px;
  box-shadow: none;
}

.lead-control-fold > .quick-filters,
.lead-control-fold > .summary-strip,
.lead-control-fold > .daily-breakdown {
  padding-top: 0;
}

.leads-workbench {
  background: #fff;
  border-color: rgba(15, 143, 126, 0.18);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
}

.leads-workbench .panel-head {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(216, 225, 236, 0.9);
}

.lead-status-toolbar {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(15, 143, 126, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(238, 250, 248, 0.86), rgba(255, 255, 255, 0.96)),
    #fff;
}

.lead-status-toolbar .small-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border-color: rgba(179, 199, 214, 0.74);
  background: #fff;
  color: #26364a;
  font-weight: 750;
}

.lead-status-toolbar .small-button strong,
.lead-status-toolbar .small-button span {
  display: block;
}

.lead-status-toolbar .small-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-status-toolbar .small-button span {
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #52627a;
  text-align: center;
  font-size: 12px;
}

.lead-status-toolbar .small-button.active {
  border-color: rgba(15, 143, 126, 0.42);
  background: rgba(15, 143, 126, 0.12);
  color: var(--brand-dark);
}

.lead-status-toolbar .small-button.new {
  border-color: rgba(6, 182, 212, 0.35);
}

.lead-status-toolbar .small-button.work {
  border-color: rgba(245, 158, 11, 0.4);
}

.lead-status-toolbar .small-button.bad {
  border-color: rgba(239, 68, 68, 0.38);
}

.lead-status-toolbar .small-button.sent,
.lead-status-toolbar .small-button.sold {
  border-color: rgba(22, 163, 74, 0.36);
}

.leads-workbench .lead-control-fold {
  margin-bottom: 12px;
  border-color: rgba(15, 143, 126, 0.18);
  background: #fff;
}

.leads-workbench .lead-control-fold > .filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px;
  border-color: rgba(216, 225, 236, 0.9);
  background: rgba(248, 251, 253, 0.7);
}

.leads-workbench .lead-control-fold > .filters > input,
.leads-workbench .lead-control-fold > .filters > select {
  min-width: 0;
  width: 100%;
}

.lead-filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(15, 143, 126, 0.14);
  border-radius: 8px;
  background: rgba(238, 250, 248, 0.58);
}

.lead-filter-summary strong {
  color: #0f172a;
  font-size: 14px;
}

.lead-filter-summary span {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.lead-filter-summary b {
  padding: 4px 8px;
  border: 1px solid rgba(15, 143, 126, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 12px;
}

#leadClearFiltersBtn {
  justify-content: center;
  min-height: 40px;
  border-color: rgba(239, 68, 68, 0.22);
  color: #b42318;
}

.leads-workbench .table-wrap {
  border: 0;
  background: #fff;
  overflow: visible;
}

.leads-workbench table,
.leads-workbench tbody {
  display: block;
  width: 100%;
}

.leads-workbench thead {
  display: none;
}

.leads-workbench tbody {
  display: grid;
  gap: 12px;
}

.leads-workbench .lead-main-row {
  display: grid;
  grid-template-columns:
    92px
    minmax(190px, 1.05fr)
    minmax(280px, 2.15fr)
    minmax(190px, 1.05fr)
    minmax(170px, 0.95fr)
    minmax(170px, 0.95fr)
    128px;
  grid-template-areas:
    "id contact question region status money actions"
    "id route question buyer status money actions";
  align-items: stretch;
  border: 1px solid rgba(216, 225, 236, 0.95);
  border-left: 3px solid rgba(15, 143, 126, 0.58);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.leads-workbench .lead-main-row td {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 13px 12px;
  border-bottom: 0;
  background: #fff;
}

.leads-workbench .lead-main-row td + td {
  border-left: 1px solid rgba(226, 234, 243, 0.8);
}

.leads-workbench .lead-main-row:hover td {
  background: #f6fcfb;
}

.leads-workbench .lead-id-cell {
  grid-area: id;
}

.leads-workbench .lead-contact-cell {
  grid-area: contact;
}

.leads-workbench .lead-region-cell {
  grid-area: region;
}

.leads-workbench .lead-question-cell {
  grid-area: question;
}

.leads-workbench .lead-route-cell:nth-child(5) {
  grid-area: route;
}

.leads-workbench .lead-route-cell:nth-child(6) {
  grid-area: buyer;
}

.leads-workbench .lead-money-cell {
  grid-area: money;
}

.leads-workbench .lead-status-cell {
  grid-area: status;
}

.leads-workbench .row-actions {
  grid-area: actions;
}

.leads-workbench .lead-question-cell {
  max-width: none;
  color: #162235;
  font-size: 15px;
  line-height: 1.45;
}

.leads-workbench .lead-id-cell strong,
.leads-workbench .lead-contact-cell strong,
.leads-workbench .lead-region-cell strong,
.leads-workbench .lead-route-cell strong,
.leads-workbench .lead-money-cell strong {
  color: #0f172a;
}

.leads-workbench .lead-id-cell strong {
  font-size: 16px;
}

.leads-workbench .lead-contact-cell strong {
  color: #6d5dfc;
  font-size: 16px;
}

.leads-workbench .lead-money-cell strong {
  color: #00875f;
}

.leads-workbench .lead-status-actions {
  margin-top: 7px;
}

.leads-workbench .row-actions {
  align-content: center;
  justify-items: stretch;
}

.leads-workbench .row-actions .small-button {
  justify-content: center;
}

.leads-workbench .lead-detail-row {
  display: block;
  margin-top: -12px;
}

.leads-workbench .lead-detail-row td {
  display: block;
  padding: 0 0 12px;
  background: transparent;
}

.leads-workbench .lead-detail-head,
.leads-workbench .lead-detail-grid {
  margin-left: 3px;
  border-color: rgba(216, 225, 236, 0.95);
}

@media (max-width: 1400px) {
  .lead-status-toolbar {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .leads-workbench .lead-main-row {
    grid-template-columns: 86px minmax(180px, 1fr) minmax(260px, 1.6fr) minmax(170px, 1fr) 120px;
    grid-template-areas:
      "id contact question status actions"
      "id region question money actions"
      "id route buyer money actions";
  }
}

@media (max-width: 980px) {
  .lead-status-toolbar,
  .leads-workbench .lead-control-fold > .filters {
    grid-template-columns: 1fr 1fr;
  }

  .leads-workbench .lead-main-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "id"
      "contact"
      "question"
      "region"
      "route"
      "buyer"
      "money"
      "status"
      "actions";
  }

  .leads-workbench .lead-main-row td + td {
    border-left: 0;
    border-top: 1px solid rgba(226, 234, 243, 0.8);
  }
}

.partner-filter-fold > .directory-toolbar {
  padding: 12px;
}

.partner-card-fold {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.partner-card-fold summary {
  min-height: 36px;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.partner-card-fold[open] summary {
  border-bottom: 1px solid var(--line);
}

.partner-card-fold .partner-route-list {
  padding: 10px;
}

.finance-fold {
  margin-top: 12px;
}

.finance-fold > .summary-strip,
.finance-fold > .cluster-grid,
.finance-fold > .compact-list {
  padding: 12px;
}

.finance-fold > .summary-strip,
.finance-fold > .cluster-grid {
  padding-bottom: 0;
}

.launch-fold {
  margin-top: 12px;
}

.launch-fold > .summary-strip,
.launch-fold > .cluster-grid,
.launch-fold > .compact-list,
.launch-fold > .split-grid,
.launch-fold > .subhead {
  padding: 12px;
}

.launch-fold > h3 {
  margin: 12px 12px 8px;
}

.launch-fold > .summary-strip,
.launch-fold > .cluster-grid,
.launch-fold > .compact-list,
.launch-fold > .split-grid {
  padding-top: 0;
}

.portal-view {
  gap: 14px;
}

.portal-view > *,
.portal-section > * {
  min-width: 0;
}

.portal-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(22, 32, 51, 0.06);
  backdrop-filter: blur(8px);
}

.portal-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-nav-links a {
  display: grid;
  gap: 2px;
  min-width: 118px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
}

.portal-nav-links a:hover {
  border-color: rgba(15, 143, 126, 0.35);
  background: #eefbf8;
}

.portal-nav-links span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.portal-nav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.portal-section {
  scroll-margin-top: 86px;
}

.portal-brief {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 159, 143, 0.22);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(15, 159, 143, 0.10), rgba(255, 255, 255, 0.92));
}

.portal-brief strong {
  min-width: 230px;
  font-size: 15px;
}

.portal-brief span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.portal-brief-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.portal-card {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.portal-card strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.portal-card b {
  color: var(--ink);
  font-size: 18px;
}

.portal-card span {
  color: var(--muted);
  font-size: 13px;
}

body[data-role="buyer"],
body[data-role="webmaster"] {
  grid-template-columns: 1fr;
}

body[data-role="buyer"] .sidebar,
body[data-role="webmaster"] .sidebar {
  display: none;
}

body[data-role="buyer"] .app,
body[data-role="webmaster"] .app {
  width: min(1600px, 100%);
  margin: 0 auto;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .sidebar nav,
  .side-section {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .app {
    padding: 14px;
  }

  .topbar,
  .portal-nav,
  .portal-brief {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-nav-actions,
  .topbar-actions {
    justify-content: flex-start;
  }
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.portal-profile-form {
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.portal-profile-form .primary-button {
  min-width: 170px;
}

.portal-date-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-left: auto;
}

.portal-date-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.portal-date-filter input {
  height: 34px;
  min-width: 132px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.portal-table-wrap {
  width: 100%;
  margin: 14px 0;
  overflow-x: auto;
}

.portal-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.portal-table th,
.portal-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.portal-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.portal-table tr:last-child td {
  border-bottom: 0;
}

.portal-table small {
  color: var(--muted);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.portal-note {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(20, 122, 61, 0.22);
  border-radius: 8px;
  background: rgba(20, 122, 61, 0.06);
}

.portal-note strong {
  color: var(--ink);
}

.portal-note span {
  color: var(--muted);
}

.cabinet-dialog {
  width: min(1320px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.cabinet-dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.cabinet-dialog form {
  display: grid;
  max-height: calc(100vh - 32px);
}

.cabinet-dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.cabinet-dialog-head h2 {
  margin: 0;
}

.cabinet-dialog-body {
  display: grid;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.cabinet-dialog-body .metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.partner-admin-layout {
  display: grid;
  gap: 14px;
}

.partner-admin-hero,
.partner-admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.partner-admin-headline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.partner-admin-headline h3 {
  font-size: 20px;
}

.partner-admin-headline p {
  max-width: 860px;
}

.sub-panel-headline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sub-panel-headline h3 {
  margin-bottom: 4px;
}

.sub-panel-headline p {
  color: var(--muted);
  font-size: 13px;
}

.sub-panel-headline strong {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
}

.partner-edit-stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.partner-route-form,
.partner-flow-form,
.partner-integration-form,
.partner-payout-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.partner-route-form.add-form,
.partner-flow-form.add-form,
.partner-integration-form.add-form {
  border-style: dashed;
  background: rgba(15, 143, 126, 0.06);
}

.integration-editor {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-color: #cfe1df;
  box-shadow: 0 8px 24px rgba(19, 83, 78, 0.06);
}

.integration-editor-head,
.integration-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.integration-editor-head > div {
  display: grid;
  gap: 3px;
}

.integration-editor-head strong {
  font-size: 16px;
}

.integration-editor-head span:not(.integration-state) {
  color: var(--muted);
  font-size: 12px;
}

.integration-state {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f7f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.integration-state.success {
  border-color: #a9dfce;
  background: #eaf8f3;
  color: #08775f;
}

.integration-state.warning {
  border-color: #f1d39a;
  background: #fff8e8;
  color: #8a5a00;
}

.integration-state.danger {
  border-color: #f0b8b8;
  background: #fff1f1;
  color: #b42318;
}

.integration-base-fields,
.integration-channel-fields,
.integration-advanced > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.integration-channel-fields {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.integration-editor [hidden] {
  display: none !important;
}

.integration-editor label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.integration-editor label > span,
.integration-advanced summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.integration-editor .wide {
  grid-column: 1 / -1;
}

.integration-live-switch {
  display: flex !important;
  align-items: center;
  gap: 9px !important;
  width: fit-content;
  padding: 9px 11px;
  border: 1px solid #c5ddd9;
  border-radius: 6px;
  background: #f3faf8;
}

.integration-live-switch input {
  width: 16px;
  height: 16px;
}

.integration-live-switch span {
  color: #164f48 !important;
}

.integration-advanced {
  padding: 8px 0 0;
}

.integration-advanced summary {
  cursor: pointer;
}

.integration-advanced > div {
  margin-top: 10px;
}

.integration-editor-actions {
  justify-content: flex-start;
}

.delivery-journal {
  display: grid;
  gap: 12px;
}

.delivery-journal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.delivery-journal-head > div {
  display: grid;
  gap: 3px;
}

.delivery-journal-head p {
  color: var(--muted);
  font-size: 13px;
}

.delivery-journal-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid #c5ddd9;
  border-radius: 6px;
  background: #f3faf8;
  color: #14685d;
  font-size: 12px;
  font-weight: 700;
}

.portal-table-wrap {
  overflow-x: auto;
}

.delivery-journal .portal-table {
  min-width: 820px;
}

.delivery-journal .portal-table td {
  vertical-align: middle;
}

@media (max-width: 860px) {
  .integration-base-fields,
  .integration-channel-fields,
  .integration-advanced > div {
    grid-template-columns: 1fr;
  }

  .integration-editor .wide {
    grid-column: auto;
  }
}

.compact-summary {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.lead-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.lead-card-meta span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.user-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(240px, 360px);
  gap: 10px;
  align-items: stretch;
  margin: 0 0 14px;
}

.directory-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 210px);
  gap: 10px;
  align-items: stretch;
  margin: 0 0 12px;
}

.lead-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.lead-insight-grid .sub-panel {
  padding: 12px;
}

.lead-insight-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 8px;
}

.role-tab {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.role-tab strong,
.role-tab span {
  display: block;
}

.role-tab strong {
  font-size: 18px;
}

.role-tab span {
  color: var(--muted);
  font-size: 12px;
}

.role-tab.active {
  border-color: rgba(15, 159, 143, 0.45);
  background: rgba(15, 159, 143, 0.1);
}

.subhead {
  margin: 18px 0 12px;
}

.sub-panel .subhead {
  margin-top: 0;
}

.onboarding-result {
  min-height: 72px;
  max-height: 220px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: pre-wrap;
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 12px 0;
}

.summary-item {
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.035);
}

.summary-item strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.2;
}

.summary-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.summary-item.good strong {
  color: var(--green);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager-actions strong {
  min-width: 62px;
  text-align: center;
  color: var(--text);
}

.summary-item.bad strong {
  color: var(--red);
}

.summary-item.money strong {
  color: var(--brand-dark);
}

.summary-item.good {
  border-color: rgba(15, 143, 85, 0.24);
  background: rgba(15, 143, 85, 0.055);
}

.summary-item.bad {
  border-color: rgba(209, 67, 67, 0.24);
  background: rgba(209, 67, 67, 0.055);
}

.summary-item.money {
  border-color: rgba(15, 143, 126, 0.24);
  background: rgba(15, 143, 126, 0.055);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.settings-grid .wide {
  grid-column: 1 / -1;
}

.settings-grid.simple-register {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.check-row {
  min-height: 38px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

input,
select,
textarea {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(15, 143, 126, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  min-width: 1050px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid #e5edf6;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf8f6;
  color: #315f59;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover td {
  background: #f5fbfa;
}

.lead-main-row td:first-child {
  border-left: 3px solid rgba(15, 143, 126, 0.7);
}

.lead-main-row:nth-child(4n + 1) td {
  background: rgba(248, 251, 253, 0.55);
}

.lead-main-row td {
  background: #fff;
}

.lead-main-row:hover td {
  background: #f2fbfa;
}

tr:last-child td {
  border-bottom: 0;
}

.lead-question-cell {
  max-width: 360px;
  line-height: 1.35;
  color: #122033;
}

.lead-id-cell {
  min-width: 92px;
}

.lead-id-cell strong,
.lead-id-cell small,
.lead-contact-cell strong,
.lead-contact-cell span,
.lead-region-cell strong,
.lead-region-cell span,
.lead-route-cell strong,
.lead-route-cell span,
.lead-money-cell strong,
.lead-money-cell span,
.lead-status-cell small {
  display: block;
}

.lead-id-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  word-break: break-word;
}

.lead-contact-cell,
.lead-region-cell,
.lead-route-cell,
.lead-money-cell,
.lead-status-cell {
  min-width: 128px;
}

.lead-contact-cell strong {
  color: #0f172a;
  font-size: 15px;
}

.lead-contact-cell span,
.lead-region-cell span,
.lead-route-cell span,
.lead-money-cell span,
.lead-status-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.lead-region-cell strong,
.lead-route-cell strong {
  color: #162235;
  font-size: 13px;
}

.lead-money-cell strong {
  color: #026c50;
  font-size: 15px;
}

.lead-status-cell {
  min-width: 150px;
}

.lead-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.lead-status-action {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}

.lead-status-action.in_work {
  border-color: rgba(245, 158, 11, 0.35);
  color: #9a5d00;
}

.lead-status-action.sold {
  border-color: rgba(15, 143, 85, 0.35);
  color: #087044;
}

.lead-status-action.defective,
.lead-status-action.rejected {
  border-color: rgba(209, 67, 67, 0.28);
  color: #b42318;
}

.row-actions {
  min-width: 116px;
}

.lead-detail-row td {
  background: #f8fbfd;
  padding: 0 12px 14px;
}

.lead-detail-head {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 12px 12px 10px;
  border: 1px solid rgba(15, 143, 126, 0.16);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(90deg, rgba(15, 143, 126, 0.09), rgba(255, 255, 255, 0.72)),
    #fff;
}

.lead-detail-head strong {
  color: #0f172a;
  font-size: 14px;
}

.lead-detail-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  padding: 0;
}

.lead-detail-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid #dce7f2;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.lead-detail-grid strong,
.lead-detail-grid span {
  display: block;
}

.lead-detail-grid strong {
  color: #52627a;
  font-size: 11px;
  text-transform: uppercase;
}

.lead-detail-grid span {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.25;
}

.lead-detail-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.lead-detail-wide {
  grid-column: span 2;
}

.daily-breakdown {
  display: grid;
  gap: 0;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.daily-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(5, minmax(88px, 1fr));
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.daily-row:last-child {
  border-bottom: 0;
}

.daily-row:not(.daily-head) {
  cursor: pointer;
}

.daily-row:not(.daily-head):hover,
.daily-row.active {
  background: #eefbf8;
}

.daily-head {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stack,
.compact-list,
.lead-cards {
  display: grid;
  gap: 10px;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.entity-card,
.compact-item,
.lead-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.entity-card {
  display: grid;
  gap: 10px;
}

.entity-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.compact-item {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.compact-item span,
.lead-card span {
  color: var(--muted);
  font-size: 13px;
}

.lead-card {
  display: grid;
  gap: 8px;
}

.lead-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.integration-card {
  display: grid;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.integration-card h3 {
  font-size: 15px;
}

.integration-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.integration-card label {
  color: var(--muted);
}

pre {
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.5;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(22, 32, 51, 0.2);
}

#leadDetailsDialog {
  width: min(920px, calc(100vw - 28px));
}

#buyerSettingsDialog,
#webmasterSettingsDialog {
  width: min(880px, calc(100vw - 28px));
}

.details-dialog {
  display: grid;
  gap: 14px;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
}

.details-section {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.details-section h3 {
  margin-bottom: 8px;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 7px 10px;
  font-size: 14px;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.event-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.event-item {
  padding: 9px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
}

dialog::backdrop {
  background: rgba(18, 27, 43, 0.45);
}

dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(22, 32, 51, 0.22);
}

dialog form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.sell-demand-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.demand-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}

.demand-option:not(.disabled):hover {
  border-color: var(--brand);
}

.demand-option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.demand-option span {
  color: var(--muted);
  font-size: 13px;
}

.sell-economy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sell-economy div {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sell-economy strong,
.sell-economy span {
  display: block;
}

.sell-economy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.item-card {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.035);
}

.item-card strong {
  font-size: 15px;
}

.item-card span,
.compact-row span,
.lead-card p,
small {
  color: var(--muted);
  font-size: 13px;
}
.money-desk-summary {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(145px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.money-desk-summary.compact {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
}

.money-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 620px;
}

.money-top-actions .primary-button,
.money-top-actions .small-button {
  min-height: 36px;
  white-space: nowrap;
}

.money-secondary-strip {
  display: none;
}

.money-desk-card {
  display: grid;
  align-content: space-between;
  gap: 6px;
  min-height: 92px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.money-desk-card.hero {
  background:
    linear-gradient(135deg, rgba(15, 143, 126, 0.12), rgba(255, 255, 255, 0.96));
}

.money-desk-card span,
.money-risk-card span {
  color: var(--muted);
  font-size: 12px;
}

.money-desk-card strong {
  color: #0f172a;
  font-size: 24px;
  line-height: 1.1;
}

.money-desk-card small,
.money-risk-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.money-desk-card.good,
.money-risk-card.good {
  border-color: rgba(15, 143, 85, 0.24);
  background: rgba(15, 143, 85, 0.055);
}

.money-desk-card.good strong,
.money-risk-card.good strong {
  color: var(--green);
}

.money-desk-card.bad,
.money-risk-card.bad {
  border-color: rgba(209, 67, 67, 0.24);
  background: rgba(209, 67, 67, 0.055);
}

.money-desk-card.bad strong,
.money-risk-card.bad strong {
  color: var(--red);
}

.money-desk-card.money {
  border-color: rgba(15, 143, 126, 0.24);
  background: rgba(15, 143, 126, 0.055);
}

.money-desk-card.money strong {
  color: var(--brand-dark);
}

.money-risk-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.money-risk-card {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.money-risk-card strong {
  color: #0f172a;
  font-size: 20px;
  line-height: 1.1;
}

.partner-route-list {
  display: grid;
  gap: 8px;
}

.partner-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.partner-route > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.partner-route strong {
  font-size: 13px;
}

.partner-route span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.partner-route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.onboarding-checklist {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(15, 143, 126, 0.22);
  border-radius: 8px;
  background: rgba(15, 143, 126, 0.06);
}

.buyer-notifications {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.buyer-notifications-head,
.buyer-notifications-clear {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.buyer-notifications-head span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.buyer-notifications-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.buyer-notice {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.buyer-notice:hover {
  border-color: rgba(15, 143, 126, 0.52);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.buyer-notice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.buyer-notice.attention .buyer-notice-dot { background: #d97706; }
.buyer-notice.danger .buyer-notice-dot { background: #dc2626; }

.buyer-notice > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.buyer-notice small,
.buyer-notifications-clear span {
  color: var(--muted);
  font-size: 12px;
}

.buyer-notice > b {
  color: var(--green);
  font-size: 12px;
}

.buyer-notifications-clear {
  padding: 12px 14px;
  border: 1px solid rgba(15, 143, 126, 0.22);
  border-radius: 8px;
  background: rgba(15, 143, 126, 0.05);
}

.buyer-status-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.buyer-status-dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

.buyer-status-dialog form,
.buyer-status-dialog label {
  display: grid;
  gap: 10px;
}

.buyer-status-dialog textarea {
  width: 100%;
  resize: vertical;
}

.buyer-dispute-response-dialog {
  width: min(620px, calc(100vw - 32px));
}

.buyer-dispute-request {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #f2cf9b;
  border-radius: 7px;
  background: #fff9ed;
}

.buyer-dispute-request span,
.buyer-dispute-request small {
  color: #8a5a18;
  font-size: 12px;
}

.buyer-dispute-request strong {
  color: #653d0c;
  line-height: 1.45;
}

.buyer-dispute-file-field input {
  width: 100%;
  padding: 10px;
  border: 1px dashed #b8cbc8;
  border-radius: 7px;
  background: #f8fbfb;
}

.buyer-dispute-file-field small {
  color: #64748b;
  font-weight: 500;
}

.dispute-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dispute-attachment-list:empty {
  display: none;
}

.dispute-attachment-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid #c9dfe8;
  border-radius: 7px;
  background: #f3f9fc;
  color: #225b72;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.dispute-timeline {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.dispute-timeline-event {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.dispute-timeline-event i {
  position: relative;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border: 2px solid #0f9789;
  border-radius: 50%;
  background: #fff;
}

.dispute-timeline-event:not(:last-child) i::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 2px;
  width: 1px;
  height: calc(100% + 22px);
  background: #cfe3e1;
}

.dispute-timeline-event > div {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  min-width: 0;
}

.dispute-timeline-event strong,
.dispute-timeline-event span,
.dispute-timeline-event small {
  overflow-wrap: anywhere;
}

.dispute-timeline-event span,
.dispute-timeline-event small {
  color: #65758c;
  font-size: 12px;
}

.buyer-dispute-deadline,
.control-deadline {
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.buyer-dispute-deadline.good,
.control-deadline.good {
  background: #ecf9f5;
  color: #08705c;
}

.buyer-dispute-deadline.attention,
.control-deadline.attention {
  background: #fff7e8;
  color: #975212;
}

.buyer-dispute-deadline.danger,
.control-deadline.danger {
  background: #fff1f2;
  color: #be123c;
}

.control-dispute-note {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.4;
}

.control-dispute-note.request {
  background: #fff7e8;
  color: #975212;
}

.control-dispute-note.response {
  background: #ecf9f5;
  color: #08705c;
}

.control-dispute-note.evidence {
  background: #eef6ff;
  color: #225b91;
}

.buyer-lead-detail-row td {
  padding: 0 12px 14px;
  background: rgba(15, 143, 126, 0.035);
}

.buyer-lead-detail {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(300px, 0.9fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid rgba(15, 143, 126, 0.2);
  border-radius: 8px;
  background: #fff;
}

.buyer-lead-request,
.buyer-lead-timeline {
  display: grid;
  align-content: start;
  gap: 8px;
}

.buyer-lead-request > span,
.buyer-lead-timeline > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.buyer-lead-request > strong {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
}

.buyer-lead-request small,
.buyer-lead-timeline small {
  color: var(--muted);
}

.buyer-timeline-event {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.buyer-timeline-event i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.buyer-timeline-event > div {
  display: grid;
  gap: 2px;
}

.buyer-timeline-event strong {
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 720px) {
  .buyer-notifications-list { grid-template-columns: 1fr; }
  .buyer-notice { grid-template-columns: 8px minmax(0, 1fr); }
  .buyer-notice > b { grid-column: 2; }
  .buyer-lead-detail { grid-template-columns: 1fr; }
}

.onboarding-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-head > div {
  display: grid;
  gap: 3px;
}

.onboarding-head span,
.onboarding-step span {
  color: var(--muted);
  font-size: 13px;
}

.onboarding-head b {
  color: var(--green);
  font-size: 20px;
}

.onboarding-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
}

.onboarding-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
}

.onboarding-step {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.onboarding-step.done {
  border-color: rgba(20, 122, 61, 0.25);
  background: rgba(20, 122, 61, 0.06);
}

.onboarding-step.done strong {
  color: var(--green);
}

.compact-row {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.032);
}

.compact-row:last-child {
  border-bottom: 1px solid var(--line);
}

.compact-list {
  display: grid;
  gap: 8px;
}

.dispute-review-row {
  gap: 8px;
}

.dispute-review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.dispute-review-grid div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  min-width: 0;
}

.dispute-review-grid b {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.dispute-review-grid span,
.dispute-question,
.dispute-review-list span {
  overflow-wrap: anywhere;
}

.dispute-question {
  padding: 8px;
  border-left: 3px solid var(--teal);
  background: rgba(20, 184, 166, 0.06);
}

.dispute-review-list {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.finance-ledger-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.user-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.user-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.row-actions {
  display: grid;
  gap: 6px;
  min-width: 110px;
}

code,
pre {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1050px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics,
  .admin-command-center,
  .partner-desk-summary,
  .money-desk-summary,
  .money-desk-summary.compact,
  .money-risk-board,
  .workspace-grid,
  .dispute-review-grid,
  .finance-ledger-grid,
  .grid.two,
  .lead-live-grid,
  .lead-insight-grid,
  .integration-grid,
  .portal-grid,
  .cluster-grid,
  .split-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .user-directory-toolbar,
  .directory-toolbar,
  .user-row {
    grid-template-columns: 1fr;
  }

  .portal-brief {
    display: grid;
  }

  .portal-brief strong {
    min-width: 0;
  }

  .role-tabs {
    grid-template-columns: repeat(3, minmax(96px, 1fr));
  }

  .onboarding-steps {
    grid-template-columns: 1fr;
  }

  .command-actions {
    justify-content: flex-start;
  }

  .partner-route {
    grid-template-columns: 1fr;
  }

  .money-top-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .partner-route-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 16px;
  }

  nav,
  .metrics,
  .admin-command-center,
  .command-metrics,
  .partner-desk-summary,
  .dispute-review-grid,
  .finance-ledger-grid,
  .workspace-grid,
  .grid.two,
  .lead-live-grid,
  .lead-insight-grid,
  .integration-grid,
  .portal-grid,
  .cluster-grid,
  .split-grid,
  .summary-strip,
  .role-tabs,
  .filters {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .panel-head,
  .command-actions,
  .entity-top,
  .inline-form,
  .settings-grid,
  .details-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}


#adminView > .metrics {
  position: relative;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid rgba(14, 165, 150, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #073733 0%, #0d4f56 46%, #183661 100%);
  box-shadow: 0 24px 56px rgba(8, 47, 73, 0.18);
  overflow: hidden;
}

#adminView > .metrics::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 184, 166, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 58%);
  pointer-events: none;
}

#adminView > .metrics .metric {
  min-height: 78px;
  padding: 15px 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

#adminView > .metrics .metric::before {
  width: 3px;
  background: linear-gradient(180deg, #2dd4bf, #0f8f7e);
  opacity: 1;
}

#adminView > .metrics .metric strong {
  color: #f8fafc;
  font-size: 24px;
  font-weight: 900;
}

#adminView > .metrics .metric span {
  margin-top: 7px;
  color: #b8d7df;
  font-size: 12px;
}

#adminView > .metrics .metric:hover {
  border-color: rgba(45, 212, 191, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.075));
}

.admin-dashboard-insights {
  display: grid;
  grid-template-columns: minmax(520px, 1.45fr) minmax(320px, 0.9fr);
  gap: 12px;
  margin-bottom: 18px;
}

.dashboard-card {
  border: 1px solid rgba(15, 143, 126, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 253, 0.96));
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.dashboard-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid rgba(216, 225, 236, 0.74);
}

.dashboard-card-head h2,
.dashboard-top-grid h3 {
  margin: 0;
  color: #0f172a;
  letter-spacing: 0;
}

.dashboard-card-head h2 {
  font-size: 18px;
}

.dashboard-card-head p {
  margin: 5px 0 0;
  color: #5f7189;
  font-size: 13px;
}

.dashboard-chart-card {
  grid-row: span 2;
}

.dashboard-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  max-width: 360px;
}

.dashboard-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: 8px;
  color: #53657d;
  font-size: 12px;
  font-weight: 800;
  background: #fff;
}

.dashboard-legend span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #0f8f7e;
}

.dashboard-legend .sold::before {
  background: #38bdf8;
}

.dashboard-legend .revenue::before {
  background: #1d4ed8;
}

.dashboard-legend .margin::before {
  background: #16a34a;
}

.dashboard-chart {
  display: block;
  width: 100%;
  min-height: 285px;
  padding: 8px 12px 14px;
}

.chart-grid line {
  stroke: rgba(148, 163, 184, 0.24);
  stroke-width: 1;
}

.chart-bars rect {
  fill: rgba(29, 78, 216, 0.18);
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-line.arrived {
  stroke: #0f8f7e;
}

.chart-line.sold {
  stroke: #38bdf8;
}

.chart-line.margin {
  stroke: #16a34a;
  stroke-width: 3;
  opacity: 0.84;
}

.chart-labels text {
  fill: #718198;
  font-size: 10px;
  font-weight: 700;
}

.dashboard-funnel {
  display: grid;
  gap: 8px;
  padding: 14px 18px 18px;
}

.funnel-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(216, 225, 236, 0.78);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.funnel-row span,
.funnel-row strong {
  position: relative;
  z-index: 1;
}

.funnel-row span {
  color: #43546c;
  font-size: 13px;
  font-weight: 800;
}

.funnel-row strong {
  color: #0f172a;
  font-size: 18px;
}

.funnel-row i {
  position: absolute;
  inset: auto 0 0;
  width: var(--w);
  height: 4px;
  background: #0f8f7e;
}

.funnel-row.work i {
  background: #f59e0b;
}

.funnel-row.sent i {
  background: #38bdf8;
}

.funnel-row.sold i {
  background: #16a34a;
}

.funnel-row.bad i {
  background: #ef4444;
}

.dashboard-problems {
  display: grid;
  gap: 8px;
  padding: 14px 18px 18px;
}

.problem-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-areas:
    "value title"
    "value text";
  gap: 2px 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid rgba(216, 225, 236, 0.78);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.problem-row strong {
  grid-area: value;
  color: #0f8f7e;
  font-size: 24px;
  line-height: 1;
}

.problem-row span {
  grid-area: title;
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.problem-row small {
  grid-area: text;
  color: #64748b;
  font-size: 12px;
}

.problem-row.warn strong {
  color: #f59e0b;
}

.problem-row.bad strong {
  color: #ef4444;
}

.problem-row.good strong {
  color: #16a34a;
}

.problem-row:hover {
  border-color: rgba(15, 143, 126, 0.35);
  background: #f6fcfb;
}

.dashboard-top-card {
  grid-column: 1 / -1;
}

.dashboard-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px 18px 18px;
}

.dashboard-top-grid h3 {
  margin-bottom: 9px;
  font-size: 14px;
}

.top-row {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid rgba(216, 225, 236, 0.76);
  border-radius: 8px;
  background: #fff;
}

.top-row + .top-row {
  margin-top: 7px;
}

.top-row strong {
  color: #0f172a;
  font-size: 13px;
}

.top-row span {
  color: #5f7189;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .admin-dashboard-insights,
  .dashboard-top-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-card,
  .dashboard-top-card {
    grid-column: auto;
    grid-row: auto;
  }
}
