/**
 * Trade Capital Finance — staff and client portal
 * --------------------------------------------------------------
 * Everything that makes the portal look like Trade Capital Finance lives here and only here.
 * Colours come from tokens.css (same folder); this file only holds TCF-specific
 * rules the shared tokens cannot express (mockups: Thrive Branding/).
 * Loaded by components/_brand_stylesheet.html when BRAND_KEY=tcf, right after
 * the shared stylesheet it overrides. Shared files must not contain brand
 * selectors (branding.tests guards this).
 *
 * Rules wrapped in :where(html[data-brand="tcf"]) add no specificity, so they
 * replace the shared default but never beat a component's own state colours.
 */

/* ---- Top bar: gold rule under the black bar ---- */
html[data-brand="tcf"] .platform-ui #header.header.fixed-top {
  border-bottom: 2px solid var(--brand-accent);
}

html[data-brand="tcf"] .platform-ui .header .logo {
  gap: 10px;
  width: auto;
}
html[data-brand="tcf"] .platform-ui .logo img,
html[data-brand="tcf"] .platform-ui .header .logo img {
  max-height: 30px;
  width: auto;
  margin-right: 0;
}
html[data-brand="tcf"] .header .logo .logo-platform-name {
  color: var(--brand-accent-soft);
  font-family: Cinzel, "Times New Roman", serif;
  font-size: var(--lm-text-page-title);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
}
@media (max-width: 991.98px) {
  html[data-brand="tcf"] .platform-ui .logo img,
  html[data-brand="tcf"] .platform-ui .header .logo img {
    max-height: 30px;
  }
}

/* Mobile menu button sits on the black bar. */
html[data-brand="tcf"] .header .toggle-sidebar-btn {
  border: 1px solid rgba(var(--brand-highlight-rgb), 0.45);
  box-shadow: none;
}
html[data-brand="tcf"] .header .toggle-sidebar-btn:hover {
  color: var(--brand-accent-soft);
}
html[data-brand="tcf"] .header .toggle-sidebar-btn:focus-visible,
html[data-brand="tcf"] .header-nav .header-action:focus-visible,
html[data-brand="tcf"] .header-nav .header-profile-action:focus-visible {
  outline: 2px solid var(--brand-accent-soft);
  outline-offset: 2px;
}

/* ---- Side menu: gold outline marks where you are ---- */
html[data-brand="tcf"] .sidebardashboard-nav .nav-link.active {
  border: 1px solid var(--brand-accent);
  background: rgba(var(--brand-highlight-rgb), 0.10);
}
html[data-brand="tcf"] .sidebardashboard-nav .nav-link.active span,
html[data-brand="tcf"] .sidebardashboard-nav .nav-link.active > .lm-icon {
  color: var(--brand-accent-soft);
}
/* Open groups get a faint gold edge on hover instead of a white one. */
html[data-brand="tcf"] .sidebardashboard-nav:hover .nav-link:not(.active):not(.collapsed) {
  border-color: rgba(var(--brand-highlight-rgb), 0.35);
}
html[data-brand="tcf"] .sidebardashboard-nav .nav-link:focus-visible {
  outline: 2px solid var(--brand-accent-soft);
  outline-offset: 1px;
}
html[data-brand="tcf"] .sidebardashboard-nav .nav-link:hover > .nav-step-num,
html[data-brand="tcf"] .sidebardashboard-nav .nav-link:focus-visible > .nav-step-num {
  border-color: rgba(var(--brand-highlight-rgb), 0.55);
  background: rgba(var(--brand-highlight-rgb), 0.12);
}
/* Section dividers (the staff menu sets an inline colour on its <hr>). */
html[data-brand="tcf"] .sidebardashboard-nav .nav-heading hr {
  color: var(--brand-sidebar-heading) !important;
  opacity: 0.35;
}
html[data-brand="tcf"] .crm-portal #crmSidebar .nav-heading.nav-divider hr {
  border-top-color: rgba(var(--brand-highlight-rgb), 0.30);
}

/* ---- Page headers (dark hero panels) ---- */
:where(html[data-brand="tcf"]) :is(.hero, .admin-hero, .crm-hero, .fin-hero, .risk-hero, .fintech-hero, .kpi-hero, .hero-card) {
  /* Two-stop warm black; no colour behind figures. */
  background: linear-gradient(135deg, var(--navy) 0%, var(--lm-navy-deep) 100%);
}
/* Thin gold edge; outline, because several heroes switch the border off. */
html[data-brand="tcf"] .platform-ui :is(.hero, .admin-hero, .crm-hero, .fin-hero, .risk-hero, .fintech-hero, .kpi-hero, .hero-card) {
  outline: 1px solid rgba(var(--brand-highlight-rgb), 0.55);
  outline-offset: -1px;
}
/* Headline figures in the hero: gold edge and gold labels (8:1 or better). */
html[data-brand="tcf"] .kpi-strip .kpi {
  border-color: rgba(var(--brand-highlight-rgb), 0.45);
  background: rgba(255, 255, 255, 0.04);
}
html[data-brand="tcf"] .kpi-strip .kpi-k {
  color: var(--brand-highlight);
  font-weight: 500;
}

/* ---- Cards: neutral warm border; gold is kept for active and hover states ---- */
:where(html[data-brand="tcf"]) :is(.fin-card, .fintech-card, .card, .cta-outline, .metric) {
  border-color: var(--border);
}

/* Navigation (hub) cards: solid gold top rule, gold edge on hover, dark link with gold arrow. */
html[data-brand="tcf"] .admin-action-card::before {
  background: var(--brand-accent);
}
html[data-brand="tcf"] .admin-action-card:hover,
html[data-brand="tcf"] .admin-action-card:focus-visible {
  border-color: var(--brand-accent);
}
html[data-brand="tcf"] .admin-action-card .admin-link {
  color: var(--ink);
  font-weight: 600;
}
html[data-brand="tcf"] .admin-action-card .admin-link .lm-icon {
  color: var(--brand-accent);
}

/* ---- Page frame details ---- */
html[data-brand="tcf"] #footer {
  border-top-color: var(--border);
}
html[data-brand="tcf"] .platform-shell--verify {
  background: var(--brand-page-bg);
}
html[data-brand="tcf"] .it-support-fab button {
  background: var(--navy);
  box-shadow: 0 0 0 1px rgba(var(--brand-highlight-rgb), 0.45), var(--lm-shadow-md);
}

/* ---- Sign-in and registration pages ---- */
html[data-brand="tcf"] .auth-form-panel {
  background:
    radial-gradient(circle at 12% 8%, rgba(var(--brand-highlight-rgb), 0.12), transparent 30%),
    linear-gradient(180deg, var(--lm-slate-50) 0%, var(--brand-page-bg) 55%, var(--lm-slate-50) 100%);
}

html[data-brand="tcf"] .auth-brand img {
  width: auto;
  max-width: 220px;
  max-height: 96px;
  object-fit: contain;
}

html[data-brand="tcf"] .auth-brand-mark-rule {
  background: var(--brand-accent);
}

html[data-brand="tcf"] .auth-brand-mark-logo {
  width: auto;
  max-width: 280px;
  max-height: 140px;
  height: auto;
  object-fit: contain;
  margin-bottom: 4px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

/* ---- Pop-ups (modals) ----
   Dark headers take their gradient from --brand-dark-panel-* in tokens.css. */
/* Global Loan Search: gold-tint Search button (the template falls back to the shared teal). */
html[data-brand="tcf"] .global-search-submit {
  --gs-submit-bg: rgba(var(--brand-highlight-rgb), 0.28);
}
/* Page Guide: current step and outcome note in a gold wash instead of teal. */
html[data-brand="tcf"] #context-help-modal .context-help-flow [aria-current],
html[data-brand="tcf"] #context-help-modal .context-help-outcome {
  background: rgba(var(--brand-highlight-rgb), 0.14);
}
/* Page Guide panels: warm neutrals instead of the cool grey-teal fills. */
html[data-brand="tcf"] #context-help-modal .context-help-current,
html[data-brand="tcf"] #context-help-modal .context-help-topic[open] > summary {
  background: var(--lm-slate-50);
}
/* Portfolio page: header fade on its cards and pop-ups (the template falls back to a blue tint). */
html[data-brand="tcf"] {
  --portfolio-header-tint: rgba(var(--brand-highlight-rgb), 0.18);
}
/* View Loans "Loan Report" pop-up (section headers, field search) and the Global Loan Search box:
   gold focus instead of the page's own blue/teal. */
html[data-brand="tcf"] #loanDetailModal .accordion-button {
  color: var(--ink);
}
html[data-brand="tcf"] #loanDetailModal .accordion-button:not(.collapsed) {
  background-color: rgba(var(--brand-highlight-rgb), 0.12);
  color: var(--brand-accent-strong);
}
html[data-brand="tcf"] #loanDetailModal .accordion-button:focus,
html[data-brand="tcf"] #loanDetailModal .form-control:focus,
html[data-brand="tcf"] .global-search-input:focus {
  border-color: rgba(var(--brand-accent-rgb), 0.55);
  box-shadow: 0 0 0 0.25rem rgba(var(--brand-highlight-rgb), 0.28);
}

/* ---- Bootstrap "info" (alerts, outline buttons): TCF info blue instead of cyan ---- */
html[data-brand="tcf"] {
  --bs-info: var(--status-info);
  --bs-info-text-emphasis: var(--status-info);
  --bs-info-bg-subtle: color-mix(in srgb, var(--status-info) 9%, #FFFFFF);
  --bs-info-border-subtle: color-mix(in srgb, var(--status-info) 28%, #FFFFFF);
}
:where(html[data-brand="tcf"]) .btn-outline-info {
  --bs-btn-color: var(--status-info);
  --bs-btn-border-color: var(--status-info);
  --bs-btn-hover-color: #FFFFFF;
  --bs-btn-hover-bg: var(--status-info);
  --bs-btn-hover-border-color: var(--status-info);
  --bs-btn-active-color: #FFFFFF;
  --bs-btn-active-bg: var(--status-info);
  --bs-btn-active-border-color: var(--status-info);
  --bs-btn-disabled-color: var(--status-info);
  --bs-btn-disabled-border-color: var(--status-info);
}

/* ---- Form controls and Bootstrap primary: gold instead of Bootstrap blue ----
   Same specificity as Bootstrap, so error/valid states keep their own colours. */
html[data-brand="tcf"] {
  --bs-primary: var(--teal);
  --bs-primary-rgb: var(--brand-accent-rgb);
}
:where(html[data-brand="tcf"]) .form-control:focus,
:where(html[data-brand="tcf"]) .form-select:focus,
:where(html[data-brand="tcf"]) .form-check-input:focus {
  border-color: rgba(var(--brand-accent-rgb), 0.55);
  box-shadow: 0 0 0 0.25rem rgba(var(--brand-highlight-rgb), 0.28);
}
:where(html[data-brand="tcf"]) .form-check-input:checked,
:where(html[data-brand="tcf"]) .form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--teal);
  border-color: var(--teal);
}
:where(html[data-brand="tcf"]) .btn-primary {
  --bs-btn-bg: var(--teal);
  --bs-btn-border-color: var(--teal);
  --bs-btn-hover-bg: var(--brand-accent-strong);
  --bs-btn-hover-border-color: var(--brand-accent-strong);
  --bs-btn-active-bg: var(--brand-accent-strong);
  --bs-btn-active-border-color: var(--brand-accent-strong);
  --bs-btn-disabled-bg: var(--teal);
  --bs-btn-disabled-border-color: var(--teal);
  --bs-btn-focus-shadow-rgb: var(--brand-highlight-rgb);
}
:where(html[data-brand="tcf"]) .btn-outline-primary {
  --bs-btn-color: var(--teal);
  --bs-btn-border-color: var(--teal);
  --bs-btn-hover-bg: var(--teal);
  --bs-btn-hover-border-color: var(--teal);
  --bs-btn-active-bg: var(--brand-accent-strong);
  --bs-btn-active-border-color: var(--brand-accent-strong);
  --bs-btn-disabled-color: var(--teal);
  --bs-btn-disabled-border-color: var(--teal);
  --bs-btn-focus-shadow-rgb: var(--brand-highlight-rgb);
}

/* ---- Notification panel ---- */
html[data-brand="tcf"] .nc-backdrop {
  background: rgba(0, 0, 0, 0.38);
}
html[data-brand="tcf"] .nc-panel {
  --nc-ink: var(--ink);
  --nc-surface: var(--lm-slate-50);
  --nc-line: var(--border);
}
html[data-brand="tcf"] .nc-header {
  background: linear-gradient(135deg, var(--brand-dark-panel-from) 0%, var(--brand-dark-panel-via) 56%, var(--teal) 100%);
  border-bottom: 2px solid var(--brand-accent);
}
html[data-brand="tcf"] .nc-header-glow {
  background: radial-gradient(circle, rgba(var(--brand-highlight-rgb), 0.2) 0%, rgba(var(--brand-highlight-rgb), 0) 68%);
}
html[data-brand="tcf"] .nc-filters,
html[data-brand="tcf"] .nc-item.is-unread {
  background: var(--lm-slate-50);
}
html[data-brand="tcf"] .nc-item-icon {
  border-color: var(--border);
  background: var(--lm-slate-50);
  color: var(--muted);
}
html[data-brand="tcf"] .nc-item[data-notif-type="ACTION"] .nc-item-icon,
html[data-brand="tcf"] .nc-item[data-notif-type="TASK"] .nc-item-icon {
  border-color: rgba(var(--brand-highlight-rgb), 0.45);
  background: rgba(var(--brand-highlight-rgb), 0.12);
  color: var(--teal);
}
html[data-brand="tcf"] .nc-btn-primary:hover,
html[data-brand="tcf"] .nc-btn-icon-quiet:hover {
  background: rgba(var(--brand-highlight-rgb), 0.14);
  color: var(--brand-accent-strong);
}
html[data-brand="tcf"] .nc-list {
  scrollbar-color: var(--lm-slate-300) transparent;
}
html[data-brand="tcf"] .nc-list::-webkit-scrollbar-thumb {
  background: var(--lm-slate-300);
}

/* ---- Deal workspaces (Deal Memo, Pre-structuring, Structuring) ---- */
html[data-brand="tcf"] .dm-page .dm-cover {
  background: linear-gradient(135deg, var(--navy) 0%, var(--lm-navy-deep) 100%);
}
html[data-brand="tcf"] .dm-page .dm-workflow__step.is-current,
html[data-brand="tcf"] .dm-page .dm-summary-step.is-current,
html[data-brand="tcf"] .dm-page a.dm-workflow__step:hover,
html[data-brand="tcf"] .dm-page a.dm-workflow__step:focus-visible,
html[data-brand="tcf"] .dm-page .dm-mitigant-option:has(input:checked) {
  background: rgba(var(--brand-highlight-rgb), 0.12);
}
html[data-brand="tcf"] .dm-page .dm-source-reference,
html[data-brand="tcf"] .dm-page .dm-signoff-permission {
  background: rgba(var(--brand-highlight-rgb), 0.10);
  color: var(--ink);
}
html[data-brand="tcf"] .dm-page .ps-summary-grid {
  background: var(--lm-slate-100);
}
html[data-brand="tcf"] .dm-page .ps-summary-card__number {
  background: rgba(var(--brand-highlight-rgb), 0.18);
}

/* ---- Credit & Risk: Contract value tab ---- */
html[data-brand="tcf"] .pv-workspace {
  --pv-line: var(--border);
}
html[data-brand="tcf"] .pv-workspace .pv-overview > .pv-heading {
  background: linear-gradient(110deg, var(--brand-dark-panel-from) 0%, var(--brand-dark-panel-via) 100%);
  border-bottom-color: var(--brand-accent);
}
html[data-brand="tcf"] .pv-workspace .pv-overview > .pv-heading .pv-eyebrow {
  color: var(--brand-highlight);
}
html[data-brand="tcf"] .pv-workspace .pv-overview > .pv-heading .text-muted {
  color: rgba(255, 255, 255, 0.72) !important;
}
html[data-brand="tcf"] .pv-workspace .pv-overview > .pv-heading .pv-status {
  color: var(--brand-sidebar-fg);
}
html[data-brand="tcf"] .pv-workspace .pv-status,
html[data-brand="tcf"] .pv-workspace .pv-evidence-empty {
  background: var(--lm-slate-50);
}
html[data-brand="tcf"] .pv-workspace .pv-summary .pv-summary-value {
  background: linear-gradient(115deg, var(--teal), var(--brand-accent-strong));
  box-shadow: inset 0 3px 0 var(--brand-highlight);
}
html[data-brand="tcf"] .pv-workspace .pv-summary-value span {
  color: var(--brand-sidebar-fg);
}
html[data-brand="tcf"] .pv-workspace [data-contract-pv],
html[data-brand="tcf"] .pv-workspace .pv-value-row td {
  background: rgba(var(--brand-highlight-rgb), 0.16);
  color: var(--brand-accent-strong);
}
html[data-brand="tcf"] .pv-workspace .pv-factor-row td {
  background: var(--lm-slate-100);
}
html[data-brand="tcf"] .pv-workspace .pv-action-menu button:hover,
html[data-brand="tcf"] .pv-workspace .pv-action-menu button:focus-visible {
  background: var(--lm-slate-50);
}
html[data-brand="tcf"] .pv-workspace .pv-publication {
  border-color: var(--border);
  background: rgba(var(--brand-highlight-rgb), 0.08);
}
html[data-brand="tcf"] .pv-workspace .pv-footer {
  border-top-color: var(--border);
}
html[data-brand="tcf"] .pv-workspace .pv-evidence-current {
  border-color: var(--border);
  border-left-color: var(--pv-teal);
}
html[data-brand="tcf"] .pv-workspace .pv-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* ---- Print: no black blocks on paper ---- */
@media print {
  html[data-brand="tcf"] :is(.hero, .admin-hero, .crm-hero, .fin-hero, .risk-hero, .fintech-hero, .kpi-hero, .hero-card) {
    background: #FFFFFF !important;
    color: var(--ink) !important;
    outline: 0;
    border: 1px solid var(--brand-accent) !important;
    box-shadow: none !important;
  }
  html[data-brand="tcf"] :is(.hero, .admin-hero, .crm-hero, .fin-hero, .risk-hero, .fintech-hero, .kpi-hero, .hero-card) * {
    color: var(--ink) !important;
  }
  html[data-brand="tcf"] :is(.hero, .admin-hero, .crm-hero, .fin-hero, .risk-hero, .fintech-hero, .hero-card)::before {
    display: none;
  }
}
