/* TOFS Console layout on top of the TCAMS landing tokens. */
html, body, .dash-app, #tofs-root {
  font-family: "Times New Roman", Times, serif !important;
}

.tofs-shell {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 8% -10%, rgba(15, 90, 166, 0.22), transparent 55%),
    radial-gradient(900px 420px at 92% 0%, rgba(15, 118, 110, 0.14), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 240px),
    var(--bg-page);
  color: var(--text-primary);
  background-attachment: fixed;
}

@keyframes tofs-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tofs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.tofs-animate {
  animation: tofs-fade-up 0.55s ease both;
}

.tofs-kpis .tofs-kpi:nth-child(2) { animation-delay: 0.04s; }
.tofs-kpis .tofs-kpi:nth-child(3) { animation-delay: 0.08s; }
.tofs-kpis .tofs-kpi:nth-child(4) { animation-delay: 0.12s; }
.tofs-kpis .tofs-kpi:nth-child(5) { animation-delay: 0.16s; }
.tofs-kpis .tofs-kpi:nth-child(6) { animation-delay: 0.2s; }
.tofs-kpis .tofs-kpi:nth-child(7) { animation-delay: 0.24s; }
.tofs-kpis .tofs-kpi:nth-child(8) { animation-delay: 0.28s; }

.tofs-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.tofs-brand-copy small {
  display: block;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.tofs-login {
  max-width: 520px;
  margin: 72px auto;
  padding: 32px;
}

.tofs-desk-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.tofs-desk {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  font-size: 0.9rem;
}

.tofs-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 18px 0 24px;
}

.tofs-kpi {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tofs-kpi:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 90, 166, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.tofs-kpi .label {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tofs-kpi .value {
  font-size: 1.55rem;
  font-weight: 700;
  margin-top: 6px;
}

.tofs-kpi .hint {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 4px;
}

.tofs-link-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: "Times New Roman", Times, serif;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

a.tofs-link-btn,
a.tofs-btn {
  text-decoration: none;
  color: inherit;
}

a.tofs-btn {
  color: #fff;
}

.tofs-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.tofs-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tofs-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.tofs-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 20px;
}

.tofs-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.tofs-modal-head h3 {
  margin: 0;
}

.tofs-company-summary-panel {
  width: min(1080px, 96vw);
}

.tofs-company-summary-body {
  overflow: auto;
  max-height: 70vh;
  display: grid;
  gap: 18px;
  padding-right: 4px;
}

.tofs-summary-section h4 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.tofs-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 14px;
}

.tofs-summary-kv {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.tofs-theme-cream .tofs-summary-kv {
  background: rgba(28, 25, 23, 0.03);
}

.tofs-summary-k {
  font-size: 12px;
  opacity: 0.72;
}

.tofs-summary-v {
  font-size: 13px;
  word-break: break-word;
}

.tofs-alerts {
  display: grid;
  gap: 10px;
  margin: 8px 0 22px;
}

.tofs-alert {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
}

.tofs-alert.is-high {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.tofs-alert.is-medium {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.tofs-alert.is-info {
  border-color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.tofs-section {
  margin: 28px 0;
}

.tofs-section-block {
  margin: 0 0 22px;
}

.tofs-desk-body > .tofs-card,
.tofs-desk-body > .tofs-split,
.tofs-desk-body > .tofs-kpis,
.tofs-desk-body > .tofs-report,
.tofs-desk-body > .tofs-alerts {
  margin-bottom: 22px;
}

.tofs-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.tofs-split > .tofs-card {
  margin-bottom: 0;
}

.tofs-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 40%), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 22px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tofs-card:hover {
  border-color: rgba(127, 179, 255, 0.28);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);
}

.tofs-livebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 18px;
  margin: 18px 0 8px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(127, 179, 255, 0.22);
  background: linear-gradient(90deg, rgba(15, 90, 166, 0.18), rgba(15, 118, 110, 0.10));
  backdrop-filter: blur(8px);
  text-align: center;
}

.tofs-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.tofs-live-dot.is-live {
  background: #22c55e;
  animation: tofs-pulse 1.8s ease-out infinite;
}

.tofs-live-dot.is-stale {
  background: #fbbf24;
}

.tofs-live-dot.is-refresh {
  background: #38bdf8;
  animation: tofs-pulse 1.1s ease-out infinite;
}

.tofs-live-status {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.tofs-livebar-copy {
  display: grid;
  gap: 2px;
  text-align: center;
  justify-items: center;
}

.tofs-livebar-copy strong {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tofs-live-stamp {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tofs-live-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.12);
}

.tofs-forecast-panel {
  overflow: hidden;
}

.tofs-forecast-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.tofs-forecast-note {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 90, 166, 0.08);
}

.tofs-forecast-note h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.tofs-forecast-note p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.35;
}

.tofs-horizon {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tofs-horizon-radio label {
  margin-right: 10px !important;
  color: var(--text-primary) !important;
  font-size: 0.9rem !important;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.tofs-detail {
  min-height: 180px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.tofs-detail dt {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tofs-detail dd {
  margin: 0 0 10px;
  color: var(--text-primary);
}

.tofs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 16px;
}

.tofs-login input,
.tofs-toolbar input,
.tofs-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
}

.Select-control, .Select-menu-outer, .VirtualizedSelectOption {
  font-family: "Times New Roman", Times, serif !important;
}

.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;
}

/* Keep filter/export text readable on navy and cream desks */
.dash-spreadsheet-container .dash-spreadsheet-inner input.dash-filter--case,
.dash-spreadsheet-container .dash-spreadsheet-inner .dash-filter input,
.dash-table-container .dash-spreadsheet .dash-filter input,
.tofs-table-card .dash-filter input,
.tofs-modal .dash-filter input {
  color: #f5f7fb !important;
  background-color: #0b1220 !important;
  caret-color: #f5f7fb !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 4px !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #f5f7fb !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner .dash-filter input::placeholder,
.tofs-table-card .dash-filter input::placeholder,
.tofs-modal .dash-filter input::placeholder {
  color: rgba(245, 247, 251, 0.6) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: rgba(245, 247, 251, 0.6) !important;
}

.tofs-theme-cream .dash-spreadsheet-container .dash-spreadsheet-inner .dash-filter input,
.tofs-theme-cream .tofs-table-card .dash-filter input,
.tofs-theme-cream .tofs-modal .dash-filter input {
  color: #1c1917 !important;
  background-color: #fffdf8 !important;
  caret-color: #1c1917 !important;
  border: 1px solid rgba(28, 25, 23, 0.16) !important;
  -webkit-text-fill-color: #1c1917 !important;
}

.tofs-theme-cream .dash-spreadsheet-container .dash-spreadsheet-inner .dash-filter input::placeholder,
.tofs-theme-cream .tofs-table-card .dash-filter input::placeholder {
  color: rgba(28, 25, 23, 0.45) !important;
  -webkit-text-fill-color: rgba(28, 25, 23, 0.45) !important;
}

.dash-spreadsheet-menu,
.dash-spreadsheet-menu button,
.export,
.dash-table-container .export {
  color: var(--text-primary) !important;
  font-family: "Times New Roman", Times, serif !important;
}

.tofs-table-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.tofs-table-count {
  color: var(--text-muted);
  white-space: nowrap;
}

/* Selection / focus must keep readable contrast (Dash defaults to light pink/white). */
.dash-spreadsheet-inner table {
  --selected-background: #1e3a5f !important;
  --selected-color: #f8fafc !important;
  --accent: #3b82f6 !important;
  --text-color: #f5f7fb !important;
  --hover: #243556 !important;
}

.tofs-theme-cream .dash-spreadsheet-inner table {
  --selected-background: #dbeafe !important;
  --selected-color: #0f172a !important;
  --text-color: #1c1917 !important;
  --hover: #e8f0fe !important;
}

.dash-table-container .dash-spreadsheet-inner td.cell--selected,
.dash-table-container .dash-spreadsheet-inner td.focused,
.dash-table-container .dash-spreadsheet-inner tr:has(input[type="checkbox"]:checked) td {
  background-color: #1e3a5f !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
}

.dash-table-container .dash-spreadsheet-inner td.cell--selected *,
.dash-table-container .dash-spreadsheet-inner td.focused *,
.dash-table-container .dash-spreadsheet-inner tr:has(input[type="checkbox"]:checked) td * {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
}

.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner td.cell--selected,
.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner td.focused,
.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner tr:has(input[type="checkbox"]:checked) td {
  background-color: #dbeafe !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}

.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner td.cell--selected *,
.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner td.focused *,
.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner tr:has(input[type="checkbox"]:checked) td * {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}

.dash-table-container .dash-spreadsheet-inner td input.dash-cell-value {
  background-color: #0b1220 !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc !important;
}

.tofs-theme-cream .dash-table-container .dash-spreadsheet-inner td input.dash-cell-value {
  background-color: #ffffff !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  caret-color: #0f172a !important;
}

.dash-table-container .dash-spreadsheet-inner tr:hover td {
  outline: 1px solid rgba(127, 179, 255, 0.28);
  outline-offset: -1px;
}

.dash-table-container .dash-spreadsheet-inner .dash-cell-value::selection,
.dash-table-container .dash-spreadsheet-inner td::selection {
  background: #2563eb !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.tofs-crumb {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 8px 0 4px;
}

.tofs-card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.tofs-card th, .tofs-card td {
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  padding: 0.4rem 0.55rem;
  vertical-align: top;
}
.tofs-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tofs-report { margin: 28px 0 36px; }
.tofs-report h2 { margin: 0 0 6px; font-size: 1.25rem; }

.tofs-btn {
  display: inline-block;
  margin: 8px 0;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #fff;
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  cursor: pointer;
}

.tofs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 12px 22px 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent), var(--bg-card);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.tofs-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  padding-right: 4px;
}

.tofs-header-actions .tofs-crumb {
  margin: 0;
}

.tofs-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  margin: 0 4px 0 8px;
  padding: 8px 16px;
  border: 1px solid rgba(127, 179, 255, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(15, 90, 166, 0.22);
  color: #f5f7fb !important;
  font-family: "Times New Roman", Times, serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none !important;
  letter-spacing: 0.02em;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.tofs-signout:hover {
  background: rgba(15, 90, 166, 0.4);
  border-color: rgba(127, 179, 255, 0.65);
  transform: translateY(-1px);
}

.tofs-theme-cream .tofs-signout {
  background: rgba(15, 90, 166, 0.12);
  border-color: rgba(15, 90, 166, 0.35);
  color: #1c1917 !important;
}

.tofs-brand-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tofs-login input,
.tofs-toolbar input,
.tofs-card input {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-section);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
}

.tofs-popover { position: relative; }
.tofs-popover-btn {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--accent-primary-light);
  color: var(--text-primary);
}
.tofs-popover-btn::-webkit-details-marker { display: none; }
.tofs-popover-panel {
  position: absolute;
  right: 0;
  top: 110%;
  z-index: 20;
  width: 320px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  color: var(--text-secondary);
}

.tofs-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 18px 48px;
}

.tofs-theme-bar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

html:has(.tofs-theme-cream),
body:has(.tofs-theme-cream),
.tofs-theme-cream {
  --bg-page: #f4ead6;
  --bg-section: #efe3c8;
  --bg-card: #fffdf7;
  --bg-card-hover: #fff6e4;
  --border-subtle: rgba(60, 45, 20, 0.10);
  --border-strong: rgba(60, 45, 20, 0.18);
  --text-primary: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;
  --shadow-sm: 0 2px 8px rgba(80, 60, 20, 0.08);
  --shadow-md: 0 8px 24px rgba(80, 60, 20, 0.10);
  --shadow-lg: 0 20px 60px rgba(80, 60, 20, 0.12);
  background:
    radial-gradient(1000px 420px at 10% -8%, rgba(15, 90, 166, 0.10), transparent 55%),
    radial-gradient(800px 360px at 90% 0%, rgba(15, 118, 110, 0.08), transparent 50%),
    #f4ead6 !important;
  color: #1c1917;
}

.tofs-theme-cream .tofs-livebar {
  background: linear-gradient(90deg, rgba(15, 90, 166, 0.10), rgba(180, 140, 70, 0.12));
}

.tofs-theme-cream .tofs-forecast-note {
  background: rgba(15, 90, 166, 0.06);
}

.tofs-theme-cream .tofs-live-meta {
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 900px) {
  .tofs-split { grid-template-columns: 1fr; }
  .tofs-login { margin: 32px 16px; }
}
