/**
 * Visual Recovery Batch 2 — Products, LED Calculator, Reports, Automation.
 * Visual contract = approved V2 (Pilot + Batch 1). No business/API/DB changes.
 * Loaded after visual-recovery-batch1.css.
 */

/* ========== A. Products ========== */
#productsView.products-list-modern {
  --pl-surface: var(--v2-surface);
  --pl-line: var(--v2-border);
  --pl-ink: var(--v2-text);
  --pl-muted: var(--v2-text-muted);
}

#productsView.products-list-modern .pl-page-header {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--v2-border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

#productsView.products-list-modern .pl-page-title {
  margin: 0;
  font-size: var(--v2-type-page);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
}

#productsView.products-list-modern .pl-page-sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--v2-text-muted);
}

#productsView.products-list-modern .pl-new-product,
#productsView.products-list-modern #openProductFormButton {
  background: var(--v2-brand-strong);
  border-color: var(--v2-brand-strong);
  color: var(--v2-text-inverse);
  border-radius: var(--v2-radius-sm);
  min-height: var(--v2-control-h);
  box-shadow: none;
}

#productsView.products-list-modern .pl-tabs.offer-tabs,
#productsView.products-list-modern .product-tabs.pl-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 3px;
  border: 0;
  border-bottom: 0;
  background: var(--v2-surface-sunken);
  border-radius: var(--v2-radius-md);
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

#productsView.products-list-modern .pl-tabs.offer-tabs .offer-tab,
#productsView.products-list-modern .pl-tabs .offer-tab {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 0;
  border-radius: var(--v2-radius-sm);
  background: transparent;
  color: var(--v2-text-secondary);
  min-height: 32px;
  padding: 6px 12px;
  font-weight: 550;
  box-shadow: none;
}

#productsView.products-list-modern .pl-tabs.offer-tabs .offer-tab.active,
#productsView.products-list-modern .pl-tabs .offer-tab.active,
#productsView.products-list-modern .pl-tabs .offer-tab[aria-selected="true"] {
  background: var(--v2-surface);
  color: var(--v2-text);
  border-bottom-color: transparent;
  box-shadow: var(--v2-shadow-xs);
}

#productsView.products-list-modern .pl-list-toolbar,
#productsView.products-list-modern .product-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#productsView.products-list-modern .pl-list-toolbar .search,
#productsView.products-list-modern .pl-list-toolbar input[type="search"],
#productsView.products-list-modern .pl-list-toolbar select {
  min-height: var(--v2-control-h);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-sm);
  background: var(--v2-surface);
  box-shadow: none;
}

#productsView.products-list-modern #productListCount {
  margin: 0 0 10px;
  font-size: var(--v2-type-meta);
  font-weight: 650;
  color: var(--v2-text-secondary);
}

#productsView.products-list-modern .pl-table-wrap,
#productsView.products-list-modern .product-table-wrap {
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  /* overflow:hidden son satır ⋯ butonunu kesiyordu */
  overflow-x: auto;
  overflow-y: visible;
}

#productsView.products-list-modern .pl-table,
#productsView.products-list-modern .product-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#productsView.products-list-modern .pl-table thead th,
#productsView.products-list-modern .product-table thead th {
  background: var(--v2-surface-muted);
  color: var(--v2-text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--v2-border);
  padding: 10px 14px;
}

#productsView.products-list-modern .pl-table thead th:first-child,
#productsView.products-list-modern .product-table thead th:first-child {
  border-top-left-radius: calc(var(--v2-radius-xl) - 1px);
}

#productsView.products-list-modern .pl-table thead th:last-child,
#productsView.products-list-modern .product-table thead th:last-child {
  border-top-right-radius: calc(var(--v2-radius-xl) - 1px);
}

#productsView.products-list-modern .pl-table tbody td,
#productsView.products-list-modern .product-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--v2-border);
  vertical-align: middle;
  font-size: var(--v2-type-body);
}

#productsView.products-list-modern .pl-table tbody tr:last-child td,
#productsView.products-list-modern .product-table tbody tr:last-child td {
  border-bottom: 0;
  padding-bottom: 18px;
}

#productsView.products-list-modern .pl-table tbody tr:last-child td:first-child,
#productsView.products-list-modern .product-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: calc(var(--v2-radius-xl) - 1px);
}

#productsView.products-list-modern .pl-table tbody tr:last-child td:last-child,
#productsView.products-list-modern .product-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: calc(var(--v2-radius-xl) - 1px);
  overflow: visible;
}

#productsView.products-list-modern .pl-table tbody tr:hover td,
#productsView.products-list-modern .product-table tbody tr:hover td {
  background: color-mix(in srgb, var(--v2-brand-soft) 24%, var(--v2-surface));
}

#productsView.products-list-modern .product-cell-copy strong,
#productsView.products-list-modern .v2-identity__primary {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--v2-text);
}

#productsView.products-list-modern .product-cell-copy .v2-identity__secondary {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--v2-text-muted);
  font-weight: 500;
}

#productsView.products-list-modern .money-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--v2-text);
}

#productsView.products-list-modern .pl-status.is-active,
#productsView.products-list-modern .badge.won {
  background: var(--v2-brand-soft);
  color: var(--v2-brand-ink);
  border: 1px solid color-mix(in srgb, var(--v2-brand) 28%, var(--v2-border));
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 650;
  padding: 3px 8px;
}

#productsView.products-list-modern .pl-status.is-archived,
#productsView.products-list-modern .badge.lost {
  background: var(--v2-surface-muted);
  color: var(--v2-text-muted);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 650;
  padding: 3px 8px;
}

#productsView.products-list-modern .product-actions.pl-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

#productsView.products-list-modern .product-actions > .ghost-button {
  display: none;
}

#productsView.products-list-modern .product-actions details.pl-overflow {
  display: inline-flex;
  position: relative;
}

#productsView.products-list-modern .pl-overflow summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--v2-radius-sm);
  border: 1px solid transparent;
  color: var(--v2-text-muted);
  cursor: pointer;
}

#productsView.products-list-modern .pl-overflow summary::-webkit-details-marker {
  display: none;
}

#productsView.products-list-modern .pl-overflow summary:hover {
  background: var(--v2-surface-muted);
  border-color: var(--v2-border);
  color: var(--v2-text);
}

#productsView.products-list-modern .pl-overflow__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 2px;
  min-width: 168px;
  padding: 6px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-md);
  box-shadow: var(--v2-shadow-md);
}

/* Fixed escape from table overflow (tek satır / üst-alt kesilme) */
#productsView.products-list-modern .pl-overflow__menu.is-fixed-open,
body > .pl-overflow__menu.is-fixed-open {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 2px;
  min-width: 168px;
  padding: 6px;
  background: var(--v2-surface, #fff);
  border: 1px solid var(--v2-border, #e8ecef);
  border-radius: var(--v2-radius-md, 10px);
  box-shadow: var(--v2-shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
}

body > .pl-overflow__menu.is-fixed-open .ghost-button {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

#productsView.products-list-modern .pl-table-wrap.has-open-pl-menu,
#productsView.products-list-modern .product-table-wrap.has-open-pl-menu {
  overflow: visible;
}

#productsView.products-list-modern .pl-overflow__menu .ghost-button {
  display: flex !important;
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#productFormSection.products-form-modern,
#productsView .products-form-modern {
  --pf-surface: var(--v2-surface);
}

#productsView .products-form-modern .pf-card,
#productFormSection.products-form-modern .pf-card {
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-xs);
  padding: 14px 16px;
  margin-bottom: 12px;
}

#productsView .products-form-modern .pf-card__title,
#productFormSection.products-form-modern .pf-card__title {
  margin: 0 0 12px;
  font-size: var(--v2-type-section);
  font-weight: 650;
  color: var(--v2-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--v2-border);
}

#productsView .products-form-modern .pf-toolbar,
#productFormSection.products-form-modern .pf-toolbar {
  background: var(--v2-surface-muted);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: none;
}

#productsView.products-list-modern .pl-mobile-list {
  display: grid;
  gap: 10px;
}

#productsView.products-list-modern .pl-mobile-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-lg);
  box-shadow: var(--v2-shadow-xs);
}

#productsView.products-list-modern .pl-mobile-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--v2-text);
}

#productsView.products-list-modern .pl-mobile-card__price strong {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--v2-text);
}

#productsView.products-list-modern .pl-mobile-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

#productsView.products-list-modern .pl-mobile-card__actions {
  display: none;
}

#productsView.products-list-modern .pl-mobile-card .pl-overflow {
  position: relative;
  flex-shrink: 0;
}

#productsView.products-list-modern .pl-mobile-card .pl-overflow__menu {
  position: absolute;
  right: 0;
  z-index: 80;
  min-width: 160px;
  padding: 6px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-md);
  box-shadow: var(--v2-shadow-md);
}

#productsView.products-list-modern .pl-mobile-card .pl-overflow__menu.is-fixed-open {
  position: fixed;
  z-index: 120;
}

/* ========== B. LED Calculator ========== */
#ledCalculatorView.led-calculator-modern {
  --lcd-surface: var(--v2-surface);
  --lcd-line: var(--v2-border);
}

#ledCalculatorView.led-calculator-modern .led-page-header {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--v2-border);
  align-items: flex-end;
}

#ledCalculatorView.led-calculator-modern .led-page-title,
#ledCalculatorView.led-calculator-modern .ds-page-header__title {
  margin: 0;
  font-size: var(--v2-type-page);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
}

#ledCalculatorView.led-calculator-modern .led-page-intro .muted-text {
  margin: 2px 0 0;
  font-size: 0.8125rem;
}

#ledCalculatorView.led-calculator-modern .lcd-workspace,
#ledCalculatorView.led-calculator-modern .led-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: start;
}

#ledCalculatorView.led-calculator-modern .led-card:not(.led-breakdown-card),
#ledCalculatorView.led-calculator-modern .lcd-section:not(.led-breakdown-card) {
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-xs);
  padding: 14px;
}

#ledCalculatorView.led-calculator-modern .led-section-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--v2-text-muted);
}

#ledCalculatorView.led-calculator-modern .led-control,
#ledCalculatorView.led-calculator-modern .searchable-select__input,
#ledCalculatorView.led-calculator-modern input,
#ledCalculatorView.led-calculator-modern select {
  min-height: var(--v2-control-h);
  border-radius: var(--v2-radius-sm);
  border-color: var(--v2-border);
}

#ledCalculatorView.led-calculator-modern .lcd-inferred {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  background: var(--v2-surface-muted);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-md);
}

#ledCalculatorView.led-calculator-modern .lcd-inferred-label {
  display: block;
  font-size: var(--v2-type-meta);
  color: var(--v2-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 650;
}

#ledCalculatorView.led-calculator-modern .lcd-inferred-value {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--v2-text);
  font-variant-numeric: tabular-nums;
}

#ledCalculatorView.led-calculator-modern #ledKpiStrip,
#ledCalculatorView.led-calculator-modern .led-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0;
  padding: 2px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
  margin-bottom: 12px;
}

#ledCalculatorView.led-calculator-modern #ledKpiStrip > *,
#ledCalculatorView.led-calculator-modern .led-kpi-strip > * {
  border-right: 1px solid var(--v2-border);
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0;
  padding: 12px;
}

#ledCalculatorView.led-calculator-modern #ledKpiStrip > *:last-child,
#ledCalculatorView.led-calculator-modern .led-kpi-strip > *:last-child {
  border-right: 0;
}

#ledCalculatorView.led-calculator-modern .lcd-section--price {
  border-color: color-mix(in srgb, var(--v2-brand) 28%, var(--v2-border));
  box-shadow: var(--v2-shadow-sm);
}

#ledCalculatorView.led-calculator-modern .lcd-price-inputs {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px dashed var(--v2-border);
}

#ledCalculatorView.led-calculator-modern .led-auto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-md);
  overflow: hidden;
  background: var(--v2-surface-muted);
}

#ledCalculatorView.led-calculator-modern .led-auto-card {
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--v2-border);
  border-bottom: 1px solid var(--v2-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

#ledCalculatorView.led-calculator-modern .led-auto-card-wide {
  grid-column: 1 / -1;
  border-right: 0;
  border-bottom: 0;
}

#ledCalculatorView.led-calculator-modern .led-auto-card-label {
  display: block;
  font-size: var(--v2-type-meta);
  color: var(--v2-text-muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#ledCalculatorView.led-calculator-modern .led-auto-card-value {
  display: block;
  margin-top: 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--v2-text);
  font-variant-numeric: tabular-nums;
}

#ledCalculatorView.led-calculator-modern .led-breakdown-card {
  margin-top: 16px;
}

#ledCalculatorView.led-calculator-modern .lcd-actions-primary .primary-button {
  background: var(--v2-brand-strong);
  border-color: var(--v2-brand-strong);
  border-radius: var(--v2-radius-sm);
  box-shadow: none;
}

#ledCalculatorView.led-calculator-modern .lcd-actions-secondary .ghost-button {
  min-height: 32px;
  border-radius: var(--v2-radius-sm);
  color: var(--v2-text-secondary);
}

#ledCalculatorView.led-calculator-modern table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

#ledCalculatorView.led-calculator-modern table th {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--v2-text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--v2-border);
  padding: 8px 10px;
  background: var(--v2-surface-muted);
}

#ledCalculatorView.led-calculator-modern table td {
  padding: 10px;
  border-bottom: 1px solid var(--v2-border);
  font-size: var(--v2-type-body);
}

@media (max-width: 1100px) {
  #ledCalculatorView.led-calculator-modern .lcd-workspace,
  #ledCalculatorView.led-calculator-modern .led-layout {
    grid-template-columns: 1fr;
  }
}

/* ========== C. Reports ========== */
#reportsView.reports-modern {
  --reports-surface: var(--v2-surface);
  --reports-line: var(--v2-border);
}

#reportsView.reports-modern .reports-page-header {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--v2-border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

#reportsView.reports-modern .reports-page-header__title {
  margin: 0;
  font-size: var(--v2-type-page);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
}

#reportsView.reports-modern .reports-page-header__sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
}

#reportsView.reports-modern .reports-filters,
#reportsView.reports-modern .report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 10px;
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#reportsView.reports-modern .report-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--v2-type-meta);
  font-weight: 650;
  color: var(--v2-text-muted);
}

#reportsView.reports-modern .report-toolbar select,
#reportsView.reports-modern .report-toolbar input {
  min-height: var(--v2-control-h);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-sm);
  background: var(--v2-surface);
  box-shadow: none;
  color: var(--v2-text);
  font-weight: 500;
}

#reportsView.reports-modern .reports-filters__search {
  flex: 1 1 220px;
  min-width: 0;
}

#reportsView.reports-modern .report-kpis,
#reportsView.reports-modern #reportKpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 2px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
  margin: 0 0 14px;
}

#reportsView.reports-modern .report-kpi {
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-right: 1px solid var(--v2-border);
  min-height: 88px;
}

#reportsView.reports-modern .report-kpi::before {
  content: none !important;
  display: none !important;
}

#reportsView.reports-modern .report-kpi:last-child {
  border-right: 0;
}

#reportsView.reports-modern .report-kpi__label {
  display: block;
  font-size: var(--v2-type-meta);
  color: var(--v2-text-muted);
  font-weight: 650;
}

#reportsView.reports-modern .report-kpi__value {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--v2-text);
  font-variant-numeric: tabular-nums;
}

#reportsView.reports-modern .report-kpi__hint {
  display: block;
  margin-top: 4px;
  color: var(--v2-text-faint);
  font-size: 0.75rem;
}

#reportsView.reports-modern .reports-card,
#reportsView.reports-modern .report-chart,
#reportsView.reports-modern .report-mini-list,
#reportsView.reports-modern .report-table-wrap {
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-xs);
}

#reportsView.reports-modern .reports-card__heading,
#reportsView.reports-modern .panel-heading {
  background: var(--v2-surface-muted);
  border-bottom: 1px solid var(--v2-border);
  padding: 10px 14px;
}

#reportsView.reports-modern .primary-button {
  background: var(--v2-brand-strong);
  border-color: var(--v2-brand-strong);
  border-radius: var(--v2-radius-sm);
  box-shadow: none;
}

#reportsView.reports-modern .report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
  gap: 14px;
  align-items: start;
}

#reportsView.reports-modern .report-table-wrap {
  overflow: auto;
  padding: 0;
}

#reportsView.reports-modern .report-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

#reportsView.reports-modern .report-table-wrap th,
#reportsView.reports-modern .report-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--v2-border);
  text-align: left;
  font-size: var(--v2-type-body);
}

#reportsView.reports-modern .report-table-wrap th {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--v2-text-muted);
  font-weight: 700;
  background: var(--v2-surface-muted);
}

@media (max-width: 900px) {
  #reportsView.reports-modern .report-layout {
    grid-template-columns: 1fr;
  }
  #reportsView.reports-modern .report-kpis,
  #reportsView.reports-modern #reportKpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #reportsView.reports-modern .report-kpi:nth-child(2n) {
    border-right: 0;
  }
  #reportsView.reports-modern .report-kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--v2-border);
  }
}

/* ========== D. Automation ========== */
#automationView.automation-rules-modern {
  --auto-surface: var(--v2-surface);
  --auto-line: var(--v2-border);
}

#automationView.automation-rules-modern .automation-page-header {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--v2-border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

#automationView.automation-rules-modern .automation-page-header__eyebrow {
  margin: 0 0 4px;
  color: var(--v2-brand-ink);
  font-size: var(--v2-type-meta);
  letter-spacing: 0.06em;
  font-weight: 650;
}

#automationView.automation-rules-modern .automation-page-header__title {
  margin: 0;
  font-size: var(--v2-type-page);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v2-text);
}

#automationView.automation-rules-modern .automation-page-header__sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  max-width: 42rem;
}

#automationView.automation-rules-modern #runAutomationButton {
  background: var(--v2-brand-strong);
  border-color: var(--v2-brand-strong);
  border-radius: var(--v2-radius-sm);
  box-shadow: none;
  min-height: var(--v2-control-h);
}

#automationView.automation-rules-modern .automation-summary__grid,
#automationView.automation-rules-modern #automationSummary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 2px;
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
  margin: 0 0 14px;
}

#automationView.automation-rules-modern .automation-summary__tile,
#automationView.automation-rules-modern .automation-summary__grid > *,
#automationView.automation-rules-modern #automationSummary > * {
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  border-right: 1px solid var(--v2-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#automationView.automation-rules-modern .automation-summary__grid > *:last-child,
#automationView.automation-rules-modern #automationSummary > *:last-child {
  border-right: 0;
}

#automationView.automation-rules-modern .automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  align-items: start;
}

#automationView.automation-rules-modern .automation-panel {
  background: var(--v2-surface);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-xl);
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
}

#automationView.automation-rules-modern .automation-panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  background: var(--v2-surface-muted);
  border-bottom: 1px solid var(--v2-border);
}

#automationView.automation-rules-modern .automation-panel__heading h2 {
  margin: 0;
  font-size: var(--v2-type-section);
  font-weight: 650;
  color: var(--v2-text);
}

#automationView.automation-rules-modern .automation-list,
#automationView.automation-rules-modern .trigger-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

#automationView.automation-rules-modern .rule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--v2-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#automationView.automation-rules-modern .rule-item:last-child {
  border-bottom: 0;
}

#automationView.automation-rules-modern .rule-item.is-enabled {
  background: color-mix(in srgb, var(--v2-brand-soft) 22%, var(--v2-surface));
}

#automationView.automation-rules-modern .rule-item__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--v2-text);
}

#automationView.automation-rules-modern .rule-item__status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 650;
  background: var(--v2-surface-muted);
  color: var(--v2-text-secondary);
  border: 1px solid var(--v2-border);
}

#automationView.automation-rules-modern .rule-item.is-enabled .rule-item__status {
  background: var(--v2-brand-soft);
  color: var(--v2-brand-ink);
  border-color: color-mix(in srgb, var(--v2-brand) 28%, var(--v2-border));
}

#automationView.automation-rules-modern .rule-item__desc {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--v2-text-secondary);
}

#automationView.automation-rules-modern .rule-item__meta {
  margin: 4px 0 0;
  font-size: var(--v2-type-meta);
}

#automationView.automation-rules-modern .rule-item__trigger-label {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--v2-border);
  background: var(--v2-surface-muted);
  color: var(--v2-text-secondary);
  font-weight: 650;
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#automationView.automation-rules-modern .rule-item__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#automationView.automation-rules-modern .trigger-item {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--v2-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#automationView.automation-rules-modern .trigger-item:last-child {
  border-bottom: 0;
}

#automationView.automation-rules-modern .trigger-item__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--v2-text);
}

#automationView.automation-rules-modern .trigger-item__meta {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--v2-text-muted);
}

#automationView.automation-rules-modern .automation-summary__label {
  display: block;
  font-size: var(--v2-type-meta);
  color: var(--v2-text-muted);
  font-weight: 650;
}

#automationView.automation-rules-modern .automation-summary__label-short {
  display: none;
}

#automationView.automation-rules-modern .automation-summary__value {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--v2-text);
  font-variant-numeric: tabular-nums;
}

#automationView.automation-rules-modern .automation-summary__hint {
  display: block;
  margin-top: 4px;
  color: var(--v2-text-faint);
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  #automationView.automation-rules-modern .automation-layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile-only: compact horizontal KPI band (desktop ≥901px unchanged) */
@media (max-width: 900px) {
  #automationView.automation-rules-modern .automation-summary__grid,
  #automationView.automation-rules-modern #automationSummary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0 0 10px;
  }

  #automationView.automation-rules-modern .automation-summary__tile,
  #automationView.automation-rules-modern .automation-summary__grid > *,
  #automationView.automation-rules-modern #automationSummary > * {
    padding: 10px 8px;
    border-right: 1px solid var(--v2-border);
    border-bottom: 0;
    align-items: center;
    text-align: center;
    gap: 2px;
  }

  #automationView.automation-rules-modern #automationSummary > *:last-child,
  #automationView.automation-rules-modern .automation-summary__grid > *:last-child {
    border-right: 0;
    border-bottom: 0;
  }

  #automationView.automation-rules-modern .automation-summary__label {
    font-size: 0.625rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
  }

  #automationView.automation-rules-modern .automation-summary__label-full {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  #automationView.automation-rules-modern .automation-summary__label-short {
    display: inline;
  }

  #automationView.automation-rules-modern .automation-summary__value {
    margin-top: 2px;
    font-size: 1.125rem;
    line-height: 1.15;
  }

  #automationView.automation-rules-modern .automation-summary__hint {
    display: none;
  }
}
