/* CapitalPay Finance ERP look for every desk: dark shell, Times New Roman, orange accents.
   Navy (#102347) stays as the card/table base so Operations and Customer Service keep their TCAMS feel. */

html, body, .dash-app, #tofs-root,
input, select, textarea, button, h1, h2, h3, h4, summary,
.tofs-link-btn, .tofs-btn, .tofs-signout,
.Select-control, .Select-menu-outer, .VirtualizedSelectOption,
.dash-spreadsheet-menu, .dash-spreadsheet-menu button, .export, .dash-table-container .export,
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td,
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
  font-family: "Times New Roman", Times, serif !important;
}

html:has(.tofs-theme-navy),
body:has(.tofs-theme-navy),
.tofs-theme-navy {
  --erp-orange: #E86B40;
  --erp-orange-d: #D45E33;
  --erp-navy: #102347;
  --erp-navy-l: #7D93C9;
  --erp-teal: #50B998;
  --bg-page: #141414;
  --bg-section: #191919;
  --bg-card: #102347;
  --bg-card-hover: #17305d;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #F5F5F7;
  --text-secondary: #C9CFDC;
  --text-muted: #9AA6C2;
  --accent-primary: #E86B40;
  --accent-primary-muted: rgba(232, 107, 64, 0.2);
  --accent-primary-light: rgba(232, 107, 64, 0.12);
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 12px;
}

.tofs-theme-light {
  --accent-primary: #E86B40;
  --accent-primary-light: rgba(232, 107, 64, 0.10);
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 12px;
}

.tofs-shell.tofs-theme-navy {
  background: #141414;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.tofs-theme-navy .tofs-header {
  background: rgba(25, 25, 25, 0.94);
  border-bottom: 1px solid #2A2A2A;
}

.tofs-theme-navy .tofs-brand-copy strong,
.tofs-theme-navy .tofs-brand-copy b {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tofs-desk-body h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 22px 0 4px;
}

.tofs-card h3, .tofs-report h2 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tofs-theme-navy .tofs-card {
  background: var(--bg-card);
  border-color: rgba(125, 147, 201, 0.18);
}

.tofs-theme-navy .tofs-card:hover {
  border-color: rgba(232, 107, 64, 0.35);
}

.tofs-kpi {
  border-radius: 12px;
}

.tofs-theme-navy .tofs-kpi {
  background: var(--bg-card);
  border-color: rgba(125, 147, 201, 0.18);
  border-top: 3px solid var(--erp-orange);
}

.tofs-kpi:hover {
  border-color: rgba(232, 107, 64, 0.5);
}

.tofs-kpi .label {
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 500;
  font-size: 12px;
}

.tofs-kpi .value {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tofs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  background: var(--erp-orange, #E86B40);
  color: #fff;
  transition: filter 0.15s ease;
}

.tofs-btn::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.8px solid currentColor;
  border-top: 1.8px solid currentColor;
  transform: rotate(45deg);
  margin-left: -2px;
}

.tofs-btn:hover { filter: brightness(0.95); }

.tofs-link-btn {
  border-radius: 99px;
  font-weight: 600;
  font-size: 12.5px;
}

.tofs-theme-navy .tofs-link-btn:hover {
  border-color: var(--erp-orange);
  color: #fff;
}

.tofs-signout {
  border-radius: 99px;
  font-weight: 600;
}

.tofs-theme-navy .tofs-signout {
  background: #202020;
  border-color: #333;
}

.tofs-theme-navy .tofs-signout:hover {
  background: var(--erp-orange);
  border-color: var(--erp-orange);
}

.tofs-theme-navy .tofs-livebar {
  background: #191919;
  border-color: #2A2A2A;
  border-radius: 99px;
}

.tofs-theme-navy .tofs-live-meta {
  background: #202020;
  border-color: #333;
}

.tofs-theme-navy .tofs-popover-btn {
  background: #202020;
  border-color: #333;
}

.tofs-theme-navy .tofs-theme-bar {
  background: #191919;
  border-color: #2A2A2A;
}

.tofs-theme-navy .tofs-forecast-note {
  background: rgba(232, 107, 64, 0.08);
  border-color: rgba(232, 107, 64, 0.2);
}

.tofs-theme-navy .tofs-alert.is-info {
  border-color: var(--erp-orange);
}

.tofs-theme-navy .tofs-table-tools {
  background: rgba(0, 0, 0, 0.18);
}

.dash-spreadsheet-inner table {
  --accent: #E86B40 !important;
}

/* Finance desk: the ERP runs in a full-height frame */
.tofs-main:has(.tofs-finance-erp) {
  max-width: none;
  padding: 0 18px 28px;
}

.tofs-erp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tofs-erp-head p { margin: 4px 0 0; max-width: 80ch; }
.tofs-erp-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tofs-erp-frame-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2A2A2A;
  background: #141414;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  margin-bottom: 22px;
}

.tofs-erp-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 720px;
  border: 0;
  background: #141414;
}

.tofs-shell:has(.tofs-finance-erp) .tofs-theme-bar {
  right: 96px;
}

.tofs-erp-analytics > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tofs-erp-analytics > summary::-webkit-details-marker { display: none; }

.tofs-erp-analytics > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--accent-primary);
  border-top: 2px solid var(--accent-primary);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.tofs-erp-analytics[open] > summary::before { transform: rotate(135deg); }

.tofs-erp-analytics[open] > summary { margin-bottom: 16px; }

/* Operations: Tools for Incident Resolution */
.tofs-incident {
  scroll-margin-top: 90px;
  padding-top: 10px;
  border-top: 2px solid var(--accent-primary);
}

.tofs-incident > h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 18px 0 4px;
}

.tofs-incident-tool { margin: 16px 0; }

.tofs-incident-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.tofs-incident-head h3 { margin: 0 0 4px; }
.tofs-incident-head p { margin: 0; max-width: 90ch; }

.tofs-incident-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--accent-primary);
  color: #fff;
}

.tofs-incident-tool.is-extra .tofs-incident-num {
  background: transparent;
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
}

.tofs-incident-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
}

.tofs-incident-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px 44px;
}

.tofs-card .tofs-incident-controls input {
  width: auto;
  flex: 1 1 260px;
  max-width: 420px;
  margin: 0;
}

.tofs-incident-controls .tofs-btn { margin: 0; }

.tofs-incident-select { width: 200px; color: #111; }

.tofs-incident-check label { cursor: pointer; font-size: 13px; }

.tofs-incident-out:not(:empty) { margin-top: 14px; }

.tofs-incident-result { margin: 12px 0 16px; }

.tofs-incident-rhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.tofs-incident-rhead h4 { margin: 0 0 6px; font-size: 0.98rem; }

.tofs-incident-raw summary { cursor: pointer; font-weight: 600; }

.tofs-incident-raw pre {
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 12px;
}

@media (max-width: 700px) {
  .tofs-incident-controls { margin-left: 0; }
}

/* Company summary loader */
.tofs-loader {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
  text-align: center;
}

.tofs-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(232, 107, 64, 0.2);
  border-top-color: var(--erp-orange, #E86B40);
  animation: tofs-spin 0.8s linear infinite;
}

@keyframes tofs-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .tofs-spinner { animation-duration: 2.4s; }
}

/* Light mode: white surfaces, navy text, same orange accents */
html:has(.tofs-theme-light),
body:has(.tofs-theme-light),
.tofs-theme-light {
  --erp-orange: #E86B40;
  --accent-primary-muted: rgba(232, 107, 64, 0.16);
  color-scheme: light;
}

.tofs-theme-light .tofs-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e3e6eb;
}

.tofs-theme-light .tofs-card,
.tofs-theme-light .tofs-kpi {
  background: #ffffff;
  border-color: #e3e6eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.tofs-theme-light .tofs-kpi { border-top: 3px solid var(--erp-orange); }
.tofs-theme-light .tofs-kpi .value,
.tofs-theme-light .tofs-desk-body h1,
.tofs-theme-light .tofs-incident > h2,
.tofs-theme-light .tofs-card h3 { color: #102347; }

.tofs-theme-light .tofs-card:hover,
.tofs-theme-light .tofs-kpi:hover { border-color: rgba(232, 107, 64, 0.45); }

.tofs-theme-light .tofs-link-btn {
  background: #ffffff;
  border-color: #d9dce1;
  color: #102347;
}

.tofs-theme-light .tofs-link-btn:hover { border-color: var(--erp-orange); }

.tofs-theme-light .tofs-livebar,
.tofs-theme-light .tofs-live-meta,
.tofs-theme-light .tofs-popover-btn,
.tofs-theme-light .tofs-theme-bar {
  background: #ffffff;
  border-color: #e3e6eb;
  color: #102347;
}

.tofs-theme-light .tofs-table-tools { background: #f7f8fa; }

.tofs-theme-light .tofs-forecast-note {
  background: rgba(232, 107, 64, 0.06);
  border-color: rgba(232, 107, 64, 0.2);
}

.tofs-theme-light .tofs-erp-frame-wrap,
.tofs-theme-light .tofs-erp-frame {
  background: #f5f6f8;
  border-color: #e3e6eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.tofs-theme-light .tofs-incident-raw pre { background: #f1f3f6; color: #1f2937; }

.tofs-theme-light .tofs-modal-panel {
  background: #ffffff;
  color: #1f2937;
  border-color: #e3e6eb;
}
