:root {
  --bg: #f5f7f8;
  --ink: #111827;
  --muted: #667085;
  --line: #cfd8dc;
  --header: #49c5d3;
  --row-blue: #e4f6f8;
  --metric-green: #e8f7e8;
  --fast-payout-blue: #b9d9e7;
  --unreceived-orange: #ffe7c2;
  --terminated-red: #f8d7da;
  --terminated-done-red: #eeb3ba;
  --white: #ffffff;
  --focus: #1c6dd0;
  --col-select-width: 38px;
  --col-label-width: 66px;
  --col-seller-width: 96px;
  --col-seller-stt-width: 70px;
  --col-email-width: 220px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid #aebbc2;
  background: var(--white);
  color: var(--ink);
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: #eef3f5;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.primary {
  border-color: #0c7f8c;
  background: #0c7f8c;
  color: white;
}

button.active {
  border-color: #49c5d3;
  background: #e4f6f8;
  color: #075766;
}

button.danger {
  border-color: #d04f4f;
  color: #a92f2f;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #b7c3ca;
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 36px;
  padding: 0 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
  font-family: Consolas, "Courier New", monospace;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(28, 109, 208, 0.14);
}

.accounting-date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  position: relative;
  width: 100%;
}

.accounting-date-native {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.accounting-date-display.invalid {
  border-color: #d04f4f;
  box-shadow: 0 0 0 2px rgba(208, 79, 79, 0.14);
}

.accounting-date-picker-button {
  min-height: 32px;
  height: 32px;
  padding: 0 8px;
  border-color: #b7c3ca;
  font-size: 12px;
  white-space: nowrap;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 24px;
  background: #102a43;
  color: white;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.app-header p {
  margin: 4px 0 0;
  color: #d7e3ea;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

main {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  padding: 16px 24px 28px;
}

.panel,
.table-section {
  background: var(--white);
  border: 1px solid #dae1e5;
  border-radius: 8px;
}

.panel {
  padding: 14px;
}

.hidden {
  display: none !important;
}

.import-panel,
.google-panel,
.store-panel,
.table-section {
  grid-column: 1 / -1;
}

.panel-title,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-title h2,
.table-toolbar h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.panel-title span,
.table-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.tools-panel .form-row {
  grid-template-columns: minmax(220px, 1fr) 160px 160px 140px auto;
}

.tools-panel {
  grid-column: 1 / -1;
}

.store-editor-panel {
  display: grid;
  gap: 12px;
}

.store-editor-details {
  padding: 10px;
  border: 1px solid #dde5e9;
  border-radius: 8px;
  background: #fbfdfe;
}

.compact-title {
  margin-bottom: 8px;
}

.google-form {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(160px, 0.4fr) minmax(280px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.google-service-account {
  grid-column: 1 / 4;
}

.google-service-account textarea {
  min-height: 74px;
}

.google-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.google-actions button {
  white-space: nowrap;
}

.monitor-panel {
  grid-column: 1 / -1;
}

.accounting-panel {
  grid-column: 1 / -1;
}

.accounting-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.accounting-actions select {
  width: 190px;
}

.accounting-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  overflow: hidden;
}

.accounting-dashboard-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.7fr) minmax(180px, 0.9fr) minmax(140px, 0.6fr) minmax(140px, 0.6fr);
  gap: 10px;
  margin-top: 12px;
}

.accounting-dashboard-controls label {
  min-width: 0;
}

.accounting-seller-dashboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.seller-dashboard-metric {
  display: grid;
  gap: 3px;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #f7fbfc;
}

.seller-dashboard-metric strong {
  color: #102a43;
  font-size: 18px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.seller-dashboard-metric span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.seller-dashboard-metric small {
  color: var(--muted);
  font-size: 11px;
}

.team-business-report {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cfe0d5;
  border-radius: 6px;
  background: #fbfefb;
}

.accounting-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  padding-top: 10px;
  border-top: 1px solid #e2eaee;
}

.accounting-section-heading h3 {
  margin: 0;
  color: #102a43;
  font-size: 15px;
}

.accounting-section-heading span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.accounting-section-heading button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 12px;
}

.accounting-summary-tables {
  display: none !important;
}

.accounting-grid {
  grid-template-columns: minmax(420px, 1fr);
}

.accounting-grid > div:first-child {
  display: none;
}

.accounting-ledger-section-heading {
  margin-top: 18px;
}

.business-report-title {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.business-report-title h3,
.business-report-card h4 {
  margin: 0;
  color: #102a43;
}

.business-report-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.business-health {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.business-health.good {
  color: #0f5132;
  background: #d8f3dc;
}

.business-health.warn {
  color: #8a5a00;
  background: #fff0c2;
}

.business-health.bad {
  color: #842029;
  background: #f8d7da;
}

.business-report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.business-report-metric {
  display: grid;
  gap: 3px;
  min-height: 78px;
  padding: 10px;
  border: 1px solid #d9e4e8;
  border-left: 5px solid #8fb3bd;
  border-radius: 6px;
  background: white;
}

.business-report-metric strong {
  color: #102a43;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.business-report-metric span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.business-report-metric small {
  color: var(--muted);
  font-size: 11px;
}

.business-report-metric.clickable {
  cursor: pointer;
}

.business-report-metric.clickable:hover,
.business-report-metric.clickable:focus-visible {
  filter: brightness(0.97) saturate(1.2);
}

.business-report-metric.clickable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.business-report-metric.revenue {
  border-left-color: #0077b6;
}

.business-report-metric.expense {
  border-left-color: #d62828;
}

.business-report-metric.profit {
  border-left-color: #2a9d8f;
}

.business-report-metric.payable {
  border-left-color: #f4a261;
}

.business-report-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.business-report-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: white;
}

.business-bar-row {
  display: grid;
  gap: 4px;
}

.business-bar-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.business-bar-top strong {
  font-variant-numeric: tabular-nums;
}

.business-bar-amount {
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 120px;
  text-align: right;
}

.business-bar-amount small {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.business-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f5;
}

.business-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: #8fb3bd;
}

.business-bar-fill.revenue {
  background: #0077b6;
}

.business-bar-fill.expense {
  background: #d62828;
}

.business-bar-fill.profit {
  background: #2a9d8f;
}

.business-bar-fill.seller {
  background: #0f766e;
}

.business-bar-fill.payable,
.business-bar-fill.other {
  background: #f4a261;
}

.business-bar-fill.fulfill {
  background: #2b8a3e;
}

.business-bar-fill.staff {
  background: #6f42c1;
}

.business-report-table {
  width: 100%;
  table-layout: fixed;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: white;
  overflow: hidden;
}

.business-report-table td {
  height: 32px;
  padding: 6px 8px;
  border-bottom: 1px solid #edf2f4;
  font-size: 12px;
}

.business-report-table tr:last-child td {
  border-bottom: 0;
  background: #e8f7ed;
  font-weight: 800;
}

/* Seller business overview tab */
.business-range-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
}

.business-range-presets {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.business-range-presets button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.business-range-presets button.active {
  border-color: #0c7f8c;
  background: #0c7f8c;
  color: white;
}

.business-metric-toggle {
  padding-right: 10px;
  border-right: 1px solid #d9e4e8;
}

.business-metric-toggle button.active {
  border-color: #6f42c1;
  background: #6f42c1;
}

.business-metric-note {
  margin: -4px 0 12px;
  padding: 8px 12px;
  border-left: 3px solid #6f42c1;
  border-radius: 4px;
  background: #f5f0fb;
  color: #4b3a6b;
  font-size: 12px;
  line-height: 1.5;
}

.business-metric-note.error {
  border-left-color: #d62828;
  background: #fdeeee;
  color: #a31d1d;
}

.business-range-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.business-range-custom input {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid #aebbc2;
  border-radius: 6px;
}

.business-range-custom button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.business-range-summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.business-overview-card.seller-detail-card {
  border-color: #d62828;
  border-width: 2px;
  margin-bottom: 10px;
}

.seller-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seller-detail-card .seller-detail-header h3 {
  margin: 0;
  font-size: 14px;
  color: #d62828;
}

.seller-detail-close {
  min-height: 42px;
  padding: 0 15px;
  font-size: 18px;
  font-weight: 700;
  color: #d62828;
  border-color: #d62828;
}

.seller-detail-close:hover {
  background: #fdeceb;
}

.seller-detail-card h3 {
  margin: 0;
  font-size: 13px;
}

.seller-legend-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.seller-legend-btn:hover {
  text-decoration: underline;
  color: #0c7f8c;
}

.revenue-donut-legend-row.selected .name,
.revenue-rank-row.selected .rank-top button {
  color: #0c7f8c;
  text-decoration: underline;
}

.revenue-rank-row.selected {
  background: #eef6fb;
  border-radius: 8px;
  margin: -4px -6px;
  padding: 4px 6px;
}

.revenue-rank-row.store-rank-row {
  grid-template-columns: 20px minmax(0, 1fr);
}

.revenue-rank-row.store-rank-row .rank-top .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  color: #102a43;
}

.business-overview-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.business-overview-kpis .business-report-metric:first-child {
  border-left-width: 6px;
}

.business-report-metric.neutral {
  border-left-color: #8fb3bd;
}

.business-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.business-overview-card {
  padding: 12px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: white;
  display: grid;
  gap: 10px;
  align-content: start;
}

.business-overview-card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
}

.business-overview-card h3 small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.revenue-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding-top: 8px;
  border-bottom: 1px solid #edf2f4;
}

.revenue-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  min-width: 0;
}

.revenue-trend-value {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.revenue-trend-bar {
  width: 100%;
  max-width: 34px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: #8fb3bd;
}

.revenue-trend-col.current .revenue-trend-bar {
  background: #0077b6;
}

.revenue-trend-col.current .revenue-trend-value {
  color: #102a43;
  font-weight: 800;
}

.revenue-trend-labels {
  display: flex;
  gap: 6px;
}

.revenue-trend-labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}

.revenue-donut-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.revenue-donut {
  flex: none;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.revenue-donut span {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: white;
  font-size: 11px;
  font-weight: 800;
  color: #102a43;
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}

.revenue-donut-legend {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.revenue-donut-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.revenue-donut-legend-row .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.revenue-donut-legend-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revenue-donut-legend-row .pct {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.business-overview-ranking {
  display: grid;
  gap: 8px;
}

.revenue-rank-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.revenue-rank-row .rank-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.revenue-rank-row .rank-body {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.revenue-rank-row .rank-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.revenue-rank-row .rank-top button {
  min-height: auto;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0c7f8c;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revenue-rank-row .rank-top button:hover {
  text-decoration: underline;
}

.revenue-rank-row .rank-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.revenue-rank-row .rank-growth {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.revenue-rank-row .rank-growth.up {
  color: #2a9d8f;
}

.revenue-rank-row .rank-growth.down {
  color: #d62828;
}

@media (max-width: 900px) {
  .business-overview-grid {
    grid-template-columns: 1fr;
  }
}

.payout-email-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #d8e3cb;
  border-radius: 6px;
  background: #fffdf7;
}

.payout-email-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.payout-email-header h4 {
  margin: 0;
  color: #102a43;
}

.payout-email-header span,
.payout-email-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.payout-email-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  align-items: end;
  gap: 8px;
}

.payout-email-date {
  display: grid;
  gap: 3px;
  min-width: 130px;
  color: #38576b;
  font-size: 11px;
  font-weight: 700;
}

.payout-email-date select {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  font: inherit;
}

.payout-email-draft {
  display: grid;
  gap: 8px;
}

.payout-email-draft input,
.payout-email-draft textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  background: #ffffff;
}

.payout-email-draft textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.45;
}

.settlement-close-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e3cb;
  border-radius: 6px;
  background: #fffdf7;
}

.settlement-close-card.is-collapsed {
  background: #fbfdfe;
}

.settlement-close-card.is-collapsed .settlement-close-body {
  display: none;
}

.settlement-close-title {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.settlement-close-title h4 {
  margin: 0;
  color: #102a43;
}

.settlement-close-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.settlement-title-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.settlement-toggle {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.settlement-close-body {
  display: grid;
  gap: 10px;
}

.settlement-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #d6dce1;
  border-radius: 999px;
  background: #eef3f5;
  color: #344054;
  font-size: 12px;
}

.settlement-status.finalized {
  border-color: #f0c36d;
  background: #fff2cc;
  color: #7a4a00;
}

.settlement-status.paid {
  border-color: #badbcc;
  background: #e8f7e8;
  color: #166534;
}

.settlement-control-grid,
.settlement-preview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
}

.settlement-control-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settlement-control-grid span {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.settlement-input-unit {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #bccbd3;
  border-radius: 5px;
  background: white;
}

.settlement-input-unit strong {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0 8px;
  border-left: 1px solid #d9e4e8;
  background: #f3f7f9;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.settlement-control-grid input,
.settlement-control-grid select,
.settlement-close-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #bccbd3;
  border-radius: 5px;
  background: white;
  font-size: 13px;
}

.settlement-control-grid input,
.settlement-control-grid select {
  height: 32px;
  padding: 0 8px;
}

.settlement-input-unit input {
  border: 0;
  border-radius: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.settlement-close-card textarea {
  min-height: 58px;
  padding: 8px;
  resize: vertical;
}

.settlement-preview-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.settlement-preview-item {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 10px;
  border: 1px solid #d9e4e8;
  border-left: 5px solid #8fb3bd;
  border-radius: 6px;
  background: white;
}

.settlement-preview-item strong {
  color: #102a43;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.settlement-preview-item span {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.settlement-preview-item.due {
  border-left-color: #d97706;
}

.settlement-preview-item.seller-capital {
  border-left-color: #047857;
}

.settlement-preview-item.company-capital {
  border-left-color: #0b5cad;
}

.settlement-warning {
  min-height: 20px;
  color: #6b4f00;
  font-size: 12px;
}

.settlement-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.settlement-actions button {
  min-height: 32px;
  padding: 0 12px;
}

.accounting-summary-tables {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.accounting-summary-tables > div {
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
  overflow: hidden;
}

.accounting-summary-tables h3 {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid #d9e4e8;
  background: #e8f1f4;
  font-size: 13px;
}

.accounting-mini-table {
  width: 100%;
  table-layout: fixed;
}

.accounting-mini-table td {
  height: 31px;
  padding: 5px 8px;
  border-bottom: 1px solid #edf2f4;
  font-size: 12px;
}

.accounting-mini-table tr:last-child td {
  border-bottom: 0;
}

.accounting-stat {
  display: grid;
  gap: 3px;
  min-height: 86px;
  padding: 12px 14px;
  border-right: 1px solid #d9e4e8;
  background: #fbfdfe;
}

.accounting-stat:last-child {
  border-right: 0;
}

.accounting-stat strong {
  color: #102a43;
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.accounting-stat span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.accounting-stat small,
.accounting-card small {
  color: var(--muted);
  font-size: 12px;
}

.accounting-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  margin-top: 14px;
}

.accounting-card-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  padding: 8px;
}

.accounting-card {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
}

.accounting-card span {
  font-size: 12px;
}

.team-rule-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  align-items: end;
}

.team-rule-inputs input,
.team-rule-inputs select {
  height: 30px;
  min-width: 80px;
}

.team-rule-inputs .seller-email-input {
  min-width: 180px;
}

.store-table .seller-email-input {
  min-width: 0;
}

.store-table .store-name-input {
  min-width: 0;
}

.store-link-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.store-link-field a {
  color: #0068b5;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.store-link-field .disabled-link {
  color: var(--muted);
  pointer-events: none;
}

.store-table .store-url-input {
  min-width: 0;
}

.team-rule-inputs button {
  min-height: 30px;
  padding: 0 10px;
}

.accounting-ledger-title {
  margin-top: 14px;
}

.accounting-transaction-form {
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
}

.accounting-transaction-form h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.accounting-audit-log {
  display: grid;
  gap: 5px;
  margin: -4px 0 12px;
  padding: 8px 10px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
  font-size: 12px;
}

.accounting-audit-log:empty {
  display: none;
}

.accounting-audit-log > strong {
  font-size: 13px;
}

.accounting-audit-log > span {
  color: var(--muted);
}

.audit-log-list {
  display: grid;
  gap: 3px;
  max-height: 120px;
  overflow: auto;
}

.audit-log-row {
  overflow: hidden;
  color: #344054;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transaction-form-grid {
  display: grid;
  grid-template-columns: 130px minmax(190px, 1fr) 150px 180px 130px 90px 150px 150px minmax(220px, 1.2fr);
  gap: 8px;
  align-items: end;
}

.transaction-form-grid label {
  min-width: 0;
}

.transaction-form-grid input,
.transaction-form-grid select {
  min-width: 0;
  width: 100%;
  height: 32px;
}

.transaction-checks,
.transaction-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.transaction-checks {
  grid-column: 1 / 8;
}

.transaction-actions {
  grid-column: 8 / -1;
  justify-content: flex-end;
}

.period-rate-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 5px;
}

.period-rate-row input {
  height: 30px;
}

.period-rate-row button {
  min-height: 30px;
  padding: 0 10px;
}

.transaction-actions button,
.ledger-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

button.secondary {
  background: white;
  color: var(--ink);
  border-color: #b8c7cf;
}

button.danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
}

.accounting-ledger-toolbar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.accounting-ledger-toolbar select {
  width: 170px;
}

.accounting-ledger-toolbar input {
  max-width: 280px;
}

.accounting-table-wrap {
  overflow: auto;
  max-height: 48vh;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
}

.accounting-table {
  min-width: 1480px;
  table-layout: fixed;
}

.accounting-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  background: #e8f1f4;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.accounting-table td {
  height: 34px;
  background: var(--white) !important;
  font-size: 12px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accounting-table td small {
  color: var(--muted);
  font-size: 11px;
}

.ledger-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.accounting-table tbody tr:nth-child(odd) td {
  background: #f7fbfc !important;
}

.accounting-table tr.internal-row td {
  background: #fff8e6 !important;
}

.accounting-table tr.not-seller-visible td {
  color: #667085;
}

.accounting-table tr.ledger-total-row td {
  position: sticky;
  top: 34px;
  z-index: 1;
  height: 32px;
  background: #f2f8ee !important;
  font-weight: 700;
}

.accounting-table tr.ledger-edit-row td {
  background: #fffef5 !important;
  overflow: visible;
  white-space: normal;
}

.accounting-table tr.ledger-edit-row input,
.accounting-table tr.ledger-edit-row select {
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}

.accounting-table tr.ledger-edit-row .ledger-description-input {
  min-width: 280px;
}

.party-edit-wrap {
  display: grid;
  gap: 4px;
}

.role-hidden {
  display: none !important;
}

.accounting-empty {
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.monitor-tabs {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.monitor-tabs button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 700;
}

.monitor-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  overflow: hidden;
}

.monitor-stat {
  display: grid;
  gap: 2px;
  min-height: 82px;
  padding: 12px 14px;
  border-right: 1px solid #d9e4e8;
  background: #fbfdfe;
}

.monitor-stat:last-child {
  border-right: 0;
}

.monitor-stat strong {
  color: #102a43;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.monitor-stat span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.monitor-stat small {
  color: var(--muted);
  font-size: 12px;
}

.monitor-stat.danger {
  background: var(--terminated-red);
}

.monitor-stat.danger strong {
  color: #842029;
}

.monitor-stat.warning {
  background: #fff0c2;
}

.monitor-stat.warning strong {
  color: #8a5a00;
}

.monitor-stat.success {
  background: var(--metric-green);
}

.monitor-stat.success strong {
  color: #1b5e20;
}

.monitor-stat.accent {
  background: #ead9f7;
}

.monitor-stat.accent strong {
  color: #5b2a86;
}

.monitor-stat.clickable {
  cursor: pointer;
}

.monitor-stat.clickable:hover,
.monitor-stat.clickable:focus-visible {
  filter: brightness(0.96) saturate(1.3);
}

.monitor-stat.clickable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.monitor-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin: 12px 0 10px;
}

.monitor-toolbar input {
  max-width: 340px;
}

.monitor-toolbar select {
  width: 180px;
}

.monitor-table-wrap {
  overflow: auto;
  max-height: 44vh;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
}

.monitor-table {
  min-width: 980px;
  table-layout: auto;
}

.monitor-table.issue-table {
  min-width: 980px;
}

.monitor-table.seller-rank-table,
.monitor-table.store-rank-table {
  min-width: 1420px;
}

.monitor-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  background: #e8f1f4;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.monitor-table th.monitor-sortable {
  cursor: pointer;
  user-select: none;
}

.monitor-table th.monitor-sortable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.monitor-table td {
  height: 46px;
  background: var(--white) !important;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-table tbody tr:nth-child(odd) td {
  background: #f7fbfc !important;
}

.monitor-table tbody tr.risk-row td {
  background: #fff5f5 !important;
}

.monitor-primary {
  color: #102a43;
  font-weight: 800;
}

.seller-filter-link {
  min-height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #102a43;
  font-weight: 800;
  text-align: left;
}

.seller-filter-link:hover {
  background: transparent;
  color: #0b5cad;
  text-decoration: underline;
}

.table-seller-filter-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #102a43;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-cell {
  color: #102a43;
  font-size: 18px;
  font-weight: 800;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.amount-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.metric-percent {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.metric-percent.metric-ok {
  color: #166534;
  font-weight: 800;
}

.metric-percent.metric-risk {
  color: #b42318;
  font-weight: 800;
}

.monitor-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 5px 3px 0;
  padding: 2px 7px;
  border: 1px solid #cfd8dc;
  border-radius: 999px;
  background: #eef3f5;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.monitor-badge.ok {
  border-color: #badbcc;
  background: #e8f7e8;
  color: #166534;
}

.monitor-badge.warning {
  border-color: #f6c66a;
  background: #fff0c2;
  color: #7a4a00;
}

.monitor-badge.danger {
  border-color: #f1aeb5;
  background: #f8d7da;
  color: #842029;
}

.issue-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  min-width: 190px;
}

.monitor-table input,
.monitor-table select {
  min-width: 118px;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.manual-editor {
  margin-top: 0;
  padding: 10px;
  border: 1px solid #dde5e9;
  border-radius: 8px;
  background: #fbfdfe;
}

.manual-editor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.manual-editor-header strong {
  color: var(--ink);
  font-size: 13px;
}

.manual-payment-wrap {
  overflow: visible;
  border: 1px solid #dde5e9;
  border-radius: 6px;
  background: white;
}

.manual-payment-table {
  display: block;
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

.manual-payment-table thead {
  display: none;
}

.manual-payment-table tbody {
  display: block;
}

.manual-payment-table tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 7px;
  padding: 8px;
  background: #f7fbfc;
}

.manual-payment-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 34px;
  background: var(--header);
  color: #000;
  font-size: 16px;
  font-weight: 800;
  text-align: left;
}

.manual-payment-table td {
  height: auto;
  min-height: 136px;
  border: 1px solid #cfdde2;
  border-radius: 6px;
  background: var(--row-blue) !important;
  text-align: left;
  white-space: normal;
  overflow: visible;
  text-overflow: ellipsis;
}

.manual-payment-table td::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 5px;
  color: #102a43;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
}

.manual-col-label {
  width: auto;
}

.manual-col-seller {
  width: auto;
}

.manual-col-email {
  width: auto;
}

.manual-date-col,
.manual-date-cell,
.manual-balance-col,
.manual-balance-cell {
  width: auto;
  min-width: 0;
  max-width: none;
}

.manual-sticky {
  position: static;
  left: auto;
  z-index: 4;
}

.manual-sticky.manual-seller {
  left: auto;
}

.manual-sticky.manual-email {
  left: auto;
}

.manual-payment-table th.manual-sticky {
  z-index: 5;
  background: var(--header);
}

.manual-payment-table td.manual-sticky {
  z-index: 4;
  background: var(--row-blue) !important;
}

.manual-payment-table td.label,
.manual-payment-table td.seller,
.manual-payment-table td.email {
  min-height: 62px;
}

.manual-date-cell {
  padding: 5px;
  vertical-align: top;
}

.manual-payment-table .metric-column {
  background: var(--metric-green) !important;
}

.manual-payment-table td.unreceived-payment {
  background: var(--unreceived-orange) !important;
}

.manual-payment-table td.seller-received-payment,
#paymentTable tbody td.seller-received-payment {
  background: #00ff00 !important;
}

.manual-payment-table td.seller-override-payment,
#paymentTable tbody td.seller-override-payment {
  background: #fff2a8 !important;
}

.manual-balance-cell {
  padding: 5px;
  vertical-align: top;
}

.manual-date-cell input,
.manual-balance-cell input,
.manual-date-cell select {
  width: 100%;
  height: 28px;
  padding: 0 6px;
}

.manual-date-cell input,
.manual-balance-cell input {
  text-align: right;
}

.manual-received-field {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}

.manual-seller-field {
  grid-template-columns: 34px minmax(0, 1fr);
}

.manual-received-field span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.manual-date-cell .manual-received-select {
  font-size: 11px;
  text-align: left;
}

.manual-cell-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 4px;
}

.manual-cell-actions button {
  flex: 1;
  min-height: 26px;
  padding: 0 6px;
  font-size: 12px;
}

.manual-date-cell small {
  display: block;
  height: 14px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.manual-balance-cell small {
  display: block;
  height: 14px;
  margin-top: 3px;
  color: #166534;
  font-size: 11px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.manual-empty {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.message {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: #b42318;
}

.table-section {
  min-width: 0;
}

.table-toolbar {
  padding: 14px 14px 0;
}

.table-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.bulk-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.bulk-actions span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.bulk-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.bulk-actions #bulkPayoutDateInput {
  width: 118px;
  min-height: 32px;
}

.bulk-actions #emailSelectedPayoutBtn {
  min-width: 104px;
}

#toggleSellerEmailColumnBtn {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.badge-filter-chip {
  min-height: 30px;
  border-color: #72b7c6;
  background: #d9f3f7;
  color: #075766;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-filters select {
  width: 160px;
}

.table-filters .bulk-actions select {
  width: 190px;
  min-height: 32px;
}

.table-filters input {
  max-width: 280px;
}

.grid-wrap {
  overflow: auto;
  max-height: 62vh;
  border-top: 1px solid var(--line);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  table-layout: fixed;
}

#paymentTable {
  width: max-content;
  min-width: 100%;
}

th,
td {
  height: 34px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--header);
  color: #000;
  font-weight: 800;
  font-size: 20px;
}

thead tr:nth-child(2) th {
  top: 34px;
  background: #f7fbfc;
  font-size: 18px;
  height: 46px;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 4;
  text-align: left;
}

.sticky-col.col-label {
  left: var(--col-select-width);
}

.sticky-col.seller {
  left: calc(var(--col-select-width) + var(--col-label-width));
}

.sticky-col.seller-stt {
  left: calc(var(--col-select-width) + var(--col-label-width) + var(--col-seller-width));
}

.sticky-col.seller-email {
  left: calc(
    var(--col-select-width) + var(--col-label-width) + var(--col-seller-width) + var(--col-seller-stt-width)
  );
}

.sticky-col.email {
  left: calc(
    var(--col-select-width) + var(--col-label-width) + var(--col-seller-width) + var(--col-seller-stt-width) +
      var(--col-seller-email-width)
  );
}

th.sticky-col {
  background: var(--header);
  z-index: 5;
}

thead tr:nth-child(2) th.sticky-col {
  background: #f7fbfc;
}

.col-select {
  width: var(--col-select-width);
  min-width: var(--col-select-width);
  max-width: var(--col-select-width);
  text-align: center;
}

.select-col {
  padding: 4px;
}

.bulk-select-input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  vertical-align: middle;
}

.col-label {
  width: var(--col-label-width);
  min-width: var(--col-label-width);
  max-width: var(--col-label-width);
}

.col-seller {
  width: var(--col-seller-width);
  min-width: var(--col-seller-width);
  max-width: var(--col-seller-width);
}

.col-seller-stt {
  width: var(--col-seller-stt-width);
  min-width: var(--col-seller-stt-width);
  max-width: var(--col-seller-stt-width);
}

.seller-stt-cell {
  text-align: center;
}

.col-seller-email {
  width: var(--col-seller-email-width);
  min-width: var(--col-seller-email-width);
  max-width: var(--col-seller-email-width);
}

.col-email {
  width: var(--col-email-width);
  min-width: var(--col-email-width);
  max-width: var(--col-email-width);
}

.col-state {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  text-align: left;
}

.col-bank {
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-bank.bank-cell {
  cursor: pointer;
}

.col-bank.bank-cell.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.col-date {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  font-size: 18px;
}

.col-profile {
  text-align: left;
  font-size: 13px;
}

.profile-link-cell a {
  color: #0068b5;
  font-weight: 700;
  text-decoration: none;
}

.profile-link-cell a:hover {
  text-decoration: underline;
}

.col-proxy {
  text-align: left;
}

.proxy-cell {
  padding: 3px 4px;
}

.proxy-quick-wrap {
  display: grid;
  grid-template-columns: 78px minmax(94px, 1fr) 68px;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.proxy-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.proxy-badge.proxy-ok {
  border-color: #86efac;
  background: #bbf7d0;
  color: #166534;
}

.proxy-badge.proxy-idle {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.proxy-badge.proxy-timeout {
  border-color: #fbbf24;
  background: #fef3c7;
  color: #92400e;
}

.proxy-badge.proxy-rejected {
  border-color: #fdba74;
  background: #ffedd5;
  color: #9a3412;
}

.proxy-badge.proxy-error {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.proxy-badge.proxy-direct {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.proxy-quick-input {
  width: 100%;
  min-width: 0;
  height: 24px;
  padding: 0 5px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.proxy-quick-controls {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  min-width: 0;
}

.proxy-mini-action {
  min-height: 24px;
  padding: 0 5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.proxy-mini-action.primary {
  border-color: #0e8a96;
  background: #0e8a96;
  color: white;
}

.proxy-mini-action.danger {
  border-color: #ef4444;
  color: #b91c1c;
}

.proxy-cell.proxy-ok {
  background: #ecfdf3 !important;
}

.proxy-cell.proxy-idle {
  background: #eff6ff !important;
}

.proxy-cell.proxy-timeout {
  background: #fffbeb !important;
}

.proxy-cell.proxy-rejected {
  background: #fff7ed !important;
}

.proxy-cell.proxy-error {
  background: #fef2f2 !important;
}

.proxy-cell.proxy-direct {
  background: #f8fafc !important;
}

thead tr:nth-child(2) th.col-date {
  font-size: 18px;
}

thead tr:nth-child(2) th.total-amount {
  padding: 4px 3px;
  font-size: 14px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-overflow: clip;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.column-resizable {
  padding-right: 12px;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 20;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.col-resizer::after {
  position: absolute;
  top: 7px;
  right: 3px;
  bottom: 7px;
  width: 2px;
  background: transparent;
  content: "";
}

.col-resizer:hover::after,
.resizing-column .col-resizer::after {
  background: rgba(16, 42, 67, 0.42);
}

.resizing-column,
.resizing-column * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sortable:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.sort-mark {
  font-size: 12px;
  font-weight: 700;
}

td.col-date,
td.amount {
  font-size: 12px;
}

tbody tr:nth-child(odd) td {
  background: var(--row-blue);
}

tbody tr:nth-child(even) td {
  background: var(--white);
}

#paymentTable .metric-column {
  background: var(--metric-green) !important;
}

#paymentTable tbody tr.fast-payout-row:not(.terminated-row) td.col-label,
#paymentTable tbody tr.fast-payout-row:not(.terminated-row) td.col-seller,
#paymentTable tbody tr.fast-payout-row:not(.terminated-row) td.col-seller-stt,
#paymentTable tbody tr.fast-payout-row:not(.terminated-row) td.col-email {
  background: var(--fast-payout-blue) !important;
}

#paymentTable tbody td.unreceived-payment {
  background: var(--unreceived-orange) !important;
}

#paymentTable tbody tr.terminated-row td {
  background: var(--terminated-red) !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-ok {
  background: #ecfdf3 !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-idle {
  background: #eff6ff !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-timeout {
  background: #fffbeb !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-rejected {
  background: #fff7ed !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-error {
  background: #fef2f2 !important;
}

#paymentTable tbody tr.terminated-row td.proxy-cell.proxy-direct {
  background: #f8fafc !important;
}

#paymentTable tbody tr.terminated-row td.seller-received-payment {
  background: #00ff00 !important;
}

#paymentTable tbody tr.terminated-row td.seller-override-payment {
  background: #fff2a8 !important;
}

/* Terminated stores that already paid everything out: no balance left to chase, so give the row a deeper
   red than the "needs attention" terminated state, staying in the same red family but visibly distinct. */
#paymentTable tbody tr.terminated-done-row td {
  background: var(--terminated-done-red) !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-ok {
  background: #ecfdf3 !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-idle {
  background: #eff6ff !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-timeout {
  background: #fffbeb !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-rejected {
  background: #fff7ed !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-error {
  background: #fef2f2 !important;
}

#paymentTable tbody tr.terminated-done-row td.proxy-cell.proxy-direct {
  background: #f8fafc !important;
}

#paymentTable tbody tr.terminated-done-row td.seller-received-payment {
  background: #00ff00 !important;
}

#paymentTable tbody tr.terminated-done-row td.seller-override-payment {
  background: #fff2a8 !important;
}

/* Payout not yet confirmed as actually arrived at PingPong: flag it regardless of any other cell state. */
#paymentTable tbody td.payout-unchecked,
#paymentTable tbody tr.terminated-row td.payout-unchecked,
#paymentTable tbody tr.terminated-done-row td.payout-unchecked {
  background: #fd853e !important;
}

td.amount.zero {
  color: #6b7280;
}

td.email,
td.label,
td.seller,
td.col-state {
  text-align: left;
}

.wal-link {
  min-height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #0b5cad;
  font-weight: 700;
  text-align: left;
}

.wal-link:hover {
  background: transparent;
  color: #063b70;
  text-decoration: underline;
}

.api-error-label .wal-link {
  color: #b42318;
  font-weight: 800;
}

.empty {
  height: 90px;
  text-align: center;
  color: var(--muted);
  background: white;
}

.store-table-wrap {
  overflow: visible;
  border: 1px solid #dde5e9;
  border-radius: 6px;
  background: #f7fbfc;
}

.store-table {
  display: block;
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.store-table thead {
  display: none;
}

.store-table tbody {
  display: block;
}

.store-table tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
  padding: 10px;
}

.store-table th {
  position: static;
  height: 32px;
  background: #eef3f5;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.store-table td {
  display: grid;
  gap: 5px;
  align-content: start;
  height: auto;
  min-height: 58px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: var(--white) !important;
  text-align: left;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.store-table td::before {
  content: attr(data-label);
  color: #526170;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.store-table tr.dirty td {
  background: #fff8e6 !important;
}

.store-table td.metric-column {
  background: var(--metric-green) !important;
}

.store-table td.health-cell {
  min-width: 0;
  max-width: none;
  grid-column: span 2;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 4px 4px 0;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #badbcc;
  background: #e8f7e8;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

button.health-badge {
  min-height: 22px;
  padding: 2px 7px;
  cursor: pointer;
}

.health-badge.filterable-badge:hover,
.health-badge.active-filter {
  box-shadow: 0 0 0 2px rgba(12, 127, 140, 0.18);
  filter: saturate(1.08);
}

.health-badge.warning {
  border-color: #f6c66a;
  background: #fff0c2;
  color: #7a4a00;
}

.health-badge.fast {
  border-color: #72b7c6;
  background: #d9f3f7;
  color: #075766;
}

.health-badge.danger {
  border-color: #f1aeb5;
  background: #f8d7da;
  color: #842029;
}

.store-table tr.terminated-row td {
  background: var(--terminated-red) !important;
}

.store-table tr.terminated-done-row td {
  background: var(--terminated-done-red) !important;
}

.store-table tr.busy {
  opacity: 0.68;
}

.store-table input,
.store-table select {
  width: 100%;
  min-width: 0;
  height: 32px;
}

.store-table .short-input {
  min-width: 0;
}

.store-table .seller-input {
  min-width: 0;
}

.store-table .seller-note-input {
  min-width: 0;
}

.store-table .store-payout-receiver-select {
  min-width: 0;
}

.store-table .date-input {
  min-width: 0;
}

.store-table .mono-input {
  font-family: Consolas, "Courier New", monospace;
}

.store-table .proxy-input {
  min-width: 0;
}

.store-table small {
  display: block;
  max-width: 240px;
  margin-top: 6px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-table small.proxy-status {
  max-width: none;
}

.store-table small.proxy-status.error {
  color: #b42318;
  font-weight: 800;
  white-space: normal;
}

.store-table small.proxy-status.timeout {
  color: #a15c00;
  font-weight: 800;
  white-space: normal;
}

.store-table small.proxy-status.rejected {
  color: #9a3412;
  font-weight: 800;
  white-space: normal;
}

.store-table small.proxy-status.ok {
  color: #166534;
  font-weight: 800;
}

.terminated-state-text {
  color: #7f1d1d;
  font-weight: 700;
  white-space: nowrap;
}

.terminated-done-state-text {
  color: #7f1d1d;
}

.store-table .metric-cell {
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

.fast-toggle-cell {
  min-width: 0;
}

.inline-check {
  display: inline-flex;
  grid-template-columns: none;
  gap: 7px;
  align-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.inline-check input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

.store-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 6px;
  align-items: center;
  min-width: 0;
  grid-column: span 2;
}

.store-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.store-actions::before {
  grid-column: 1 / -1;
}

.status {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf1f3;
  color: #475467;
  font-size: 12px;
}

.status.ok {
  background: #dcfce7;
  color: #166534;
}

.status.error {
  background: #fee2e2;
  color: #991b1b;
}

.accounting-panel .accounting-summary-tables {
  display: none !important;
}

.accounting-panel .accounting-grid {
  grid-template-columns: minmax(420px, 1fr);
}

.accounting-panel .accounting-grid > div:first-child {
  display: none;
}

@media (max-width: 900px) {
  .app-header,
  .panel-title,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .form-row,
  .tools-panel .form-row,
  .google-form {
    grid-template-columns: 1fr;
  }

  .table-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .monitor-tabs,
  .accounting-actions,
  .accounting-ledger-toolbar,
  .monitor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .monitor-summary {
    grid-template-columns: 1fr;
  }

  .accounting-summary,
  .accounting-grid,
  .accounting-dashboard-controls,
  .accounting-seller-dashboard,
  .business-report-metrics,
  .business-report-body,
  .settlement-control-grid,
  .settlement-preview-grid,
  .accounting-summary-tables,
  .transaction-form-grid,
  .period-rate-row {
    grid-template-columns: 1fr;
  }

  .transaction-checks,
  .transaction-actions {
    grid-column: auto;
  }

  .monitor-stat {
    border-right: 0;
    border-bottom: 1px solid #d9e4e8;
  }

  .monitor-stat:last-child {
    border-bottom: 0;
  }

  .table-filters input,
  .table-filters select,
  .accounting-actions select,
  .accounting-ledger-toolbar input,
  .accounting-ledger-toolbar select,
  .monitor-toolbar input,
  .monitor-toolbar select {
    max-width: none;
    width: 100%;
  }
}

/* Authentication & user management */
#loginScreen.hidden,
#appShell.hidden {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 1000;
}

.login-card {
  display: grid;
  gap: 10px;
  width: min(340px, 90vw);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.08);
}

.login-card h1 {
  margin: 0;
  font-size: 18px;
}

.login-card > p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.login-card input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #aebbc2;
  border-radius: 6px;
  font-size: 14px;
}

.login-card button {
  min-height: 40px;
  margin-top: 6px;
}

.login-error {
  min-height: 16px;
  color: #d62828;
  font-size: 12px;
  font-weight: 700;
}

.current-user-label {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.current-role-label {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  min-height: 36px;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
  background: #fbfdfe;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  text-transform: uppercase;
}

.users-panel {
  grid-column: 1 / -1;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.user-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.user-form .hint {
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
}

.user-form-actions {
  display: flex;
  gap: 8px;
}

.users-table-wrap {
  overflow: auto;
  border: 1px solid #d9e4e8;
  border-radius: 6px;
}

.users-table {
  width: 100%;
  min-width: 760px;
}

.users-table th {
  position: sticky;
  top: 0;
  height: 34px;
  background: #e8f1f4;
  text-align: left;
  font-size: 12px;
}

.users-table td {
  height: 42px;
  padding: 0 10px;
  background: var(--white);
  border-bottom: 1px solid #edf2f4;
  font-size: 13px;
}

.users-table td.actions-cell {
  display: flex;
  gap: 6px;
}

.users-table td.actions-cell button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.daily-chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 6px;
}

.daily-chart-stats span {
  display: inline-flex;
  flex-direction: column;
  font-size: 12px;
}

.daily-chart-stats small {
  color: var(--muted);
  font-size: 11px;
}

.daily-chart-stats b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.daily-chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.daily-chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 2px;
}

.daily-chart-legend i.gmv {
  background: #0c7f8c;
}

.daily-chart-legend i.orders {
  background: #6f42c1;
}

.daily-chart-svg {
  display: block;
  width: 100%;
  height: 260px;
}

.daily-axis {
  fill: #6b7c85;
  font-size: 11px;
}

.daily-axis.orders {
  fill: #6f42c1;
}

.payout-check-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.payout-check-modal.hidden {
  display: none;
}

.payout-check-card {
  background: var(--white);
  border-radius: 10px;
  padding: 22px 24px;
  width: min(360px, 90vw);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.payout-check-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.payout-check-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.payout-check-status {
  margin: 0 0 16px;
  font-weight: 600;
  font-size: 14px;
}

.payout-check-status-checked {
  color: #1a7f37;
}

.payout-check-status-unchecked {
  color: #c2410c;
}

.payout-check-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payout-check-actions button {
  width: 100%;
  padding: 9px 12px;
}

.payout-check-close {
  margin-top: 14px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
}
