#view-commercial-dashboard {
  min-height: 0;
  color: var(--shell-text);
  background:
    radial-gradient(circle at 86% 4%, color-mix(in srgb, var(--shell-accent) 12%, transparent), transparent 28%),
    var(--shell-canvas);
}

#view-commercial-dashboard [hidden] {
  display: none !important;
}

.commercial-dashboard-shell {
  height: 100vh;
  overflow: auto;
  padding: 30px clamp(20px, 3vw, 44px) 54px;
}

.commercial-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto 28px;
  max-width: 1540px;
}

.commercial-dashboard-eyebrow,
.dashboard-section-heading span,
.dashboard-panel-heading span {
  color: var(--shell-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .15em;
}

.commercial-dashboard-header h1 {
  margin: 6px 0 5px;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -.045em;
}

.commercial-dashboard-header p,
.dashboard-section-heading small {
  margin: 0;
  color: var(--shell-text-secondary);
  font-size: 13px;
}

.commercial-dashboard-toolbar,
.dashboard-range-tabs,
.dashboard-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.commercial-dashboard-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-range-tabs {
  padding: 4px;
  border: 1px solid var(--shell-border);
  border-radius: 13px;
  background: var(--shell-panel);
}

.dashboard-range-tabs button,
.dashboard-custom-range button,
.dashboard-refresh {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  color: var(--shell-text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-range-tabs button:hover,
.dashboard-range-tabs button.active {
  color: #fff;
  background: var(--shell-accent);
}

.dashboard-custom-range {
  padding: 7px 9px;
  border: 1px solid var(--shell-border);
  border-radius: 13px;
  background: var(--shell-panel-solid);
}

.dashboard-custom-range label,
.dashboard-currency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--shell-text-secondary);
  font-size: 11px;
  font-weight: 800;
}

.dashboard-custom-range input,
.dashboard-currency select {
  height: 34px;
  border: 1px solid var(--shell-border-strong);
  border-radius: 9px;
  padding: 0 9px;
  color: var(--shell-text);
  background: var(--shell-elevated);
}

.dashboard-custom-range button,
.dashboard-refresh {
  color: #fff;
  background: var(--shell-accent);
}

.dashboard-currency {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--shell-border);
  border-radius: 13px;
  background: var(--shell-panel);
}

.dashboard-refresh {
  min-height: 44px;
  box-shadow: var(--shell-glow);
}

.dashboard-refresh:disabled {
  cursor: wait;
  opacity: .58;
}

.commercial-dashboard-content,
.dashboard-access-state {
  max-width: 1540px;
  margin: 0 auto;
}

.dashboard-global-state,
.dashboard-access-state,
.dashboard-empty-state {
  border: 1px dashed var(--shell-border-strong);
  border-radius: 16px;
  color: var(--shell-text-secondary);
  background: var(--shell-panel);
  text-align: center;
}

.dashboard-global-state {
  margin-bottom: 18px;
  padding: 14px 18px;
}

.dashboard-global-state[data-state="error"] {
  border-color: rgb(220 38 38 / 30%);
  color: #dc2626;
  background: rgb(220 38 38 / 7%);
}

.dashboard-access-state {
  display: grid;
  min-height: 330px;
  place-content: center;
  padding: 40px;
}

.dashboard-access-state > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto;
  border-radius: 15px;
  color: #fff;
  background: #dc2626;
  font-weight: 900;
}

.dashboard-access-state h2 {
  margin: 16px 0 6px;
}

.dashboard-access-state p {
  margin: 0;
}

.dashboard-section-heading,
.dashboard-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-section-heading {
  margin-bottom: 14px;
}

.dashboard-section-heading h2,
.dashboard-panel-heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-metric-card,
.dashboard-panel {
  border: 1px solid var(--shell-border);
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--metric-color, var(--shell-accent)) 8%, transparent), transparent 46%),
    var(--shell-panel);
  box-shadow: 0 15px 42px rgb(20 25 40 / 7%);
  backdrop-filter: blur(20px);
}

.dashboard-metric-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  border-radius: 17px;
  padding: 19px;
}

.dashboard-metric-card::after {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--metric-color, var(--shell-accent));
  box-shadow: 0 0 16px var(--metric-color, var(--shell-accent));
  content: "";
}

.dashboard-metric-card > span,
.dashboard-metric-card > small {
  display: block;
  color: var(--shell-text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-metric-card strong {
  display: block;
  min-height: 34px;
  margin: 14px 0 7px;
  font-size: clamp(21px, 2.2vw, 30px);
  letter-spacing: -.04em;
}

.tone-revenue { --metric-color: #16a085; }
.tone-cost { --metric-color: #e59a20; }
.tone-profit { --metric-color: #7c5cff; }
.tone-operation { --metric-color: #2f80ed; }

.commercial-dashboard-content.is-loading .dashboard-metric-card strong,
.commercial-dashboard-content.is-loading .dashboard-panel-heading > strong,
.commercial-dashboard-content.is-loading .dashboard-summary-list dd {
  overflow: hidden;
  border-radius: 7px;
  color: transparent;
  background: linear-gradient(90deg, var(--shell-hover), var(--shell-active), var(--shell-hover));
  background-size: 200% 100%;
  animation: dashboard-shimmer 1.15s linear infinite;
}

@keyframes dashboard-shimmer {
  to { background-position: -200% 0; }
}

.dashboard-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.dashboard-panel {
  min-height: 330px;
  border-radius: 19px;
  padding: 20px;
}

.dashboard-panel-wide {
  grid-column: 1 / -1;
  min-height: 300px;
}

.dashboard-panel-heading {
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--shell-border);
}

.dashboard-panel-heading > strong {
  font-size: 20px;
}

.dashboard-summary-list,
.dashboard-worker-detail {
  display: grid;
  gap: 0;
  margin: 14px 0;
}

.dashboard-summary-list div,
.dashboard-worker-detail div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 39px;
  border-bottom: 1px solid var(--shell-border);
}

.dashboard-summary-list dt,
.dashboard-worker-detail dt {
  color: var(--shell-text-secondary);
  font-size: 12px;
}

.dashboard-summary-list dd,
.dashboard-worker-detail dd {
  margin: 0;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-trend,
.dashboard-table-region {
  margin-top: 16px;
}

.dashboard-trend-row,
.dashboard-table-row {
  display: grid;
  grid-template-columns: minmax(110px, .8fr) repeat(2, minmax(120px, 1fr));
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--shell-border);
  font-size: 12px;
}

.dashboard-table-row {
  grid-template-columns: repeat(5, minmax(80px, 1fr));
}

.dashboard-trend-row.is-heading,
.dashboard-table-row.is-heading {
  min-height: 36px;
  color: var(--shell-text-tertiary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
}

.dashboard-empty-state {
  display: grid;
  min-height: 150px;
  place-content: center;
  padding: 24px;
  font-size: 12px;
}

.dashboard-inline-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 15px;
}

.dashboard-inline-stats span,
.dashboard-subscription-grid article,
.dashboard-reconciliation-summary article {
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  padding: 12px;
  color: var(--shell-text-secondary);
  background: var(--shell-elevated);
  font-size: 11px;
}

.dashboard-inline-stats strong,
.dashboard-subscription-grid strong,
.dashboard-reconciliation-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--shell-text);
  font-size: 20px;
}

.dashboard-subscription-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.dashboard-reconciliation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.dashboard-reconciliation-summary .severity-p0 strong { color: #dc2626; }
.dashboard-reconciliation-summary .severity-p1 strong { color: #e59a20; }

.dashboard-worker-status {
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--shell-text-secondary);
  background: var(--shell-elevated);
  font-size: 10px;
  font-weight: 850;
}

@media (max-width: 1180px) {
  .commercial-dashboard-header { flex-direction: column; }
  .commercial-dashboard-toolbar { justify-content: flex-start; }
  .dashboard-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .commercial-dashboard-shell { padding: 22px 14px 42px; }
  .commercial-dashboard-toolbar,
  .dashboard-custom-range { align-items: stretch; }
  .dashboard-range-tabs { width: 100%; overflow-x: auto; }
  .dashboard-range-tabs button { flex: 1 0 auto; }
  .dashboard-custom-range { width: 100%; flex-wrap: wrap; }
  .dashboard-metric-grid,
  .dashboard-analysis-grid { grid-template-columns: 1fr; }
  .dashboard-panel-wide { grid-column: auto; }
  .dashboard-table-region { overflow-x: auto; }
  .dashboard-table-row { min-width: 640px; }
}

@media (max-width: 560px) {
  .dashboard-metric-grid,
  .dashboard-subscription-grid,
  .dashboard-reconciliation-summary { grid-template-columns: 1fr; }
  .dashboard-inline-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .commercial-dashboard-content.is-loading * { animation: none !important; }
}
