/* CATS GLOBAL THEME LAYER v2
   Loaded after each authenticated module's own styles.
   Light mode intentionally inverts the original dark/light surfaces per user request. */
:root{
  --cats-accent:#d2ad68;
  --cats-accent-light:#f0dcae;
  --cats-accent-rgb:210,173,104;
  --cats-theme-bg:#071426;
  --cats-theme-surface:#102b45;
  --cats-theme-surface-2:#0b2035;
  --cats-theme-text:#e7eef6;
  --cats-theme-muted:#b9c8d6;
  --cats-theme-border:#294762;
}
body{--gold:var(--cats-accent);--gold2:var(--cats-accent-light);--gold-light:var(--cats-accent-light);}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--cats-accent)!important;outline-offset:2px}
button.primary,.btn.primary,.save,.primary-button{border-color:var(--cats-accent)!important}
header,.header{border-bottom-color:var(--cats-accent)!important}
h2:after,.section-title:after{background:var(--cats-accent)!important}
th{border-bottom-color:var(--cats-accent)!important}

/* DARK THEME: all modules use a consistent dark canvas and dark data cards. */
body.cats-theme-dark{
  background:#071426!important;color:#e7eef6!important;color-scheme:dark;
  --navy:#0a1b30;--navy2:#102b49;--blue:#1d4d78;--ink:#e7eef6;--muted:#b9c8d6;
  --paper:#071426;--white:#102b45;--line:#294762;
}
body.cats-theme-dark main,body.cats-theme-dark .container,body.cats-theme-dark .content,body.cats-theme-dark .wrap{color:#e7eef6!important}
body.cats-theme-dark .topbar,body.cats-theme-dark .menu-toggle{background:#0b2035!important;color:#edf3fa!important;border-color:#294762!important}
body.cats-theme-dark .sidebar,body.cats-theme-dark header,body.cats-theme-dark .header,body.cats-theme-dark .hero,body.cats-theme-dark .gps-panel{background:linear-gradient(145deg,#0a1b30,#102b45)!important;color:#e7eef6!important;border-color:#294762!important}
body.cats-theme-dark .nav a,body.cats-theme-dark .nav-group-toggle,body.cats-theme-dark .brand-sub,body.cats-theme-dark .sidebar-foot{color:#d9e4ee!important}
body.cats-theme-dark .card,body.cats-theme-dark .panel,body.cats-theme-dark .toolbar,body.cats-theme-dark .metric,body.cats-theme-dark .form-panel,body.cats-theme-dark .section-card,body.cats-theme-dark .table-card,body.cats-theme-dark .box:not(.preview),body.cats-theme-dark .filter-box,body.cats-theme-dark .summary-card,body.cats-theme-dark .stat,body.cats-theme-dark .module,body.cats-theme-dark .status-panel,body.cats-theme-dark .trend-card{
  background:linear-gradient(145deg,#102b45,#0b2035)!important;color:#e7eef6!important;border-color:#294762!important;box-shadow:0 10px 26px rgba(0,0,0,.22)!important
}
body.cats-theme-dark h1,body.cats-theme-dark h2,body.cats-theme-dark h3,body.cats-theme-dark h4,body.cats-theme-dark label,body.cats-theme-dark .title,body.cats-theme-dark .metric strong,body.cats-theme-dark .stat-value,body.cats-theme-dark .module h3{color:#f0dfbd!important}
body.cats-theme-dark p,body.cats-theme-dark small,body.cats-theme-dark .muted,body.cats-theme-dark .hint,body.cats-theme-dark .small,body.cats-theme-dark .stat-top,body.cats-theme-dark .module p{color:#b9c8d6!important}
body.cats-theme-dark td,body.cats-theme-dark th{border-color:#29445e!important}
body.cats-theme-dark td{background:#0d2339!important;color:#e2ebf3!important}
body.cats-theme-dark tbody tr:nth-child(even) td{background:#102a43!important}
body.cats-theme-dark th{background:linear-gradient(110deg,#173b5e,#234f72)!important;color:#f4f7fb!important}
body.cats-theme-dark input:not([type=checkbox]):not([type=radio]),body.cats-theme-dark select,body.cats-theme-dark textarea{background:#0b2035!important;color:#edf3fa!important;border-color:#3b5872!important}
body.cats-theme-dark input::placeholder,body.cats-theme-dark textarea::placeholder{color:#91a4b7!important}
body.cats-theme-dark .pill,body.cats-theme-dark .chip{background:#1d3c58!important;color:#e4edf5!important;border-color:#3c5b75!important}
body.cats-theme-dark .empty,body.cats-theme-dark .notice,body.cats-theme-dark .hint{background:#15324b!important;color:#d8e3ed!important;border-color:#35536e!important}
body.cats-theme-dark .stat-icon,body.cats-theme-dark .module-icon{background:linear-gradient(145deg,#1b3853,#10283e)!important;border-color:var(--cats-accent)!important;color:#f0d9a5!important}
body.cats-theme-dark .mobile-dock{background:linear-gradient(180deg,rgba(10,31,51,.97),rgba(5,17,31,.99))!important}


/* CATS THREE-STYLE THEMES v5 — genuine palettes, no page-wide inversion. */
body.cats-theme-light{background:#edf2f7!important;color:#203247!important;color-scheme:light!important;--navy:#243e5a;--navy2:#315675;--blue:#dce8f3;--ink:#203247;--muted:#64788d;--paper:#edf2f7;--white:#fff;--line:#d5dee8}
body.cats-theme-light main,body.cats-theme-light .container,body.cats-theme-light .content,body.cats-theme-light .wrap{color:#203247!important}
body.cats-theme-light .topbar,body.cats-theme-light .menu-toggle{background:#243e5a!important;color:#fff!important;border-color:#c9d5e1!important}
body.cats-theme-light .sidebar,body.cats-theme-light header,body.cats-theme-light .header,body.cats-theme-light .hero,body.cats-theme-light .gps-panel{background:linear-gradient(145deg,#243e5a,#315675)!important;color:#fff!important;border-color:#d5dee8!important}
body.cats-theme-light .nav a,body.cats-theme-light .nav-group-toggle,body.cats-theme-light .brand-sub,body.cats-theme-light .sidebar-foot{color:#edf3fa!important}
body.cats-theme-light .card,body.cats-theme-light .panel,body.cats-theme-light .toolbar,body.cats-theme-light .metric,body.cats-theme-light .form-panel,body.cats-theme-light .section-card,body.cats-theme-light .table-card,body.cats-theme-light .box:not(.preview),body.cats-theme-light .filter-box,body.cats-theme-light .summary-card,body.cats-theme-light .stat,body.cats-theme-light .module,body.cats-theme-light .status-panel,body.cats-theme-light .trend-card{background:#fff!important;color:#203247!important;border-color:#d5dee8!important;box-shadow:0 7px 20px rgba(28,51,75,.07)!important}
body.cats-theme-light h1,body.cats-theme-light h2,body.cats-theme-light h3,body.cats-theme-light h4,body.cats-theme-light label,body.cats-theme-light .title,body.cats-theme-light .metric strong,body.cats-theme-light .stat-value,body.cats-theme-light .module h3{color:#203b55!important}
body.cats-theme-light p,body.cats-theme-light small,body.cats-theme-light .muted,body.cats-theme-light .hint,body.cats-theme-light .small,body.cats-theme-light .stat-top,body.cats-theme-light .module p{color:#64788d}
body.cats-theme-light td{background:#fff!important;color:#263b50!important;border-color:#dce4ec!important}body.cats-theme-light tbody tr:nth-child(even) td{background:#f3f6f9!important}body.cats-theme-light th{background:#243e5a!important;color:#fff!important;border-color:var(--cats-accent)!important}
body.cats-theme-light input:not([type=checkbox]):not([type=radio]),body.cats-theme-light select,body.cats-theme-light textarea{background:#fff!important;color:#203247!important;border-color:#c5d1dd!important}
body.cats-theme-light .pill,body.cats-theme-light .chip{background:#e8eef4!important;color:#29435d!important;border-color:#ccd8e3!important}body.cats-theme-light .empty,body.cats-theme-light .notice{background:#f0f5f9!important;color:#405a72!important;border-color:#d5e0e9!important}
body.cats-theme-light .stat-icon,body.cats-theme-light .module-icon{background:#edf3f8!important;border-color:var(--cats-accent)!important;color:#29435d!important}body.cats-theme-light .mobile-dock{background:#fff!important;border-top:1px solid #d5dee8!important}
body.cats-theme-light .cats-theme-settings-link{color:#f0d9a5!important;border:1px solid #49647e;background:#315675}

body.cats-theme-balanced{background:#dce5ef!important;color:#203b55!important;color-scheme:light;--navy:#243e5a;--navy2:#315675;--blue:#d5e5f3;--ink:#203b55;--muted:#526b83;--paper:#dce5ef;--white:#eaf2f9;--line:#bdcddd}
body.cats-theme-balanced main,body.cats-theme-balanced .container,body.cats-theme-balanced .content,body.cats-theme-balanced .wrap{color:#203b55!important}
body.cats-theme-balanced .topbar,body.cats-theme-balanced .menu-toggle{background:#243e5a!important;color:#fff!important;border-color:#476783!important}
body.cats-theme-balanced .sidebar,body.cats-theme-balanced header,body.cats-theme-balanced .header,body.cats-theme-balanced .hero,body.cats-theme-balanced .gps-panel{background:linear-gradient(145deg,#243e5a,#315675)!important;color:#fff!important;border-color:#476783!important}
body.cats-theme-balanced .nav a,body.cats-theme-balanced .nav-group-toggle,body.cats-theme-balanced .brand-sub,body.cats-theme-balanced .sidebar-foot{color:#edf3fa!important}
body.cats-theme-balanced .card,body.cats-theme-balanced .panel,body.cats-theme-balanced .toolbar,body.cats-theme-balanced .metric,body.cats-theme-balanced .form-panel,body.cats-theme-balanced .section-card,body.cats-theme-balanced .table-card,body.cats-theme-balanced .box:not(.preview),body.cats-theme-balanced .filter-box,body.cats-theme-balanced .summary-card,body.cats-theme-balanced .stat,body.cats-theme-balanced .module,body.cats-theme-balanced .status-panel,body.cats-theme-balanced .trend-card{background:linear-gradient(145deg,#edf4fa,#dce8f3)!important;color:#203b55!important;border-color:#bdcddd!important;box-shadow:0 8px 22px rgba(28,51,75,.09)!important}
body.cats-theme-balanced h1,body.cats-theme-balanced h2,body.cats-theme-balanced h3,body.cats-theme-balanced h4,body.cats-theme-balanced label,body.cats-theme-balanced .title,body.cats-theme-balanced .metric strong,body.cats-theme-balanced .stat-value,body.cats-theme-balanced .module h3{color:#203b55!important}
body.cats-theme-balanced p,body.cats-theme-balanced small,body.cats-theme-balanced .muted,body.cats-theme-balanced .hint,body.cats-theme-balanced .small,body.cats-theme-balanced .stat-top,body.cats-theme-balanced .module p{color:#526b83}
body.cats-theme-balanced td{background:#edf4fa!important;color:#203b55!important;border-color:#c5d4e1!important}body.cats-theme-balanced tbody tr:nth-child(even) td{background:#dfeaf3!important}body.cats-theme-balanced th{background:#315675!important;color:#fff!important;border-color:var(--cats-accent)!important}
body.cats-theme-balanced input:not([type=checkbox]):not([type=radio]),body.cats-theme-balanced select,body.cats-theme-balanced textarea{background:#f8fbfd!important;color:#203b55!important;border-color:#b8cbdc!important}
body.cats-theme-balanced .pill,body.cats-theme-balanced .chip{background:#d5e5f3!important;color:#29435d!important;border-color:#b8cbdc!important}body.cats-theme-balanced .mobile-dock{background:#eaf2f9!important;border-top:1px solid #bdcddd!important}
body.cats-theme-balanced .cats-theme-settings-link{color:#f0d9a5!important;border:1px solid #476783;background:#315675}
:root[data-cats-accent="gold_silver"]{--cats-accent:#c5ad83;--cats-accent-light:#e4d8c2;--cats-accent-rgb:197,173,131}

/* CATS MOBILE SIDEBAR FIX v4
   Matches the live panel DOM: .sidebar > .brand, .sidebar > .nav,
   .sidebar > .sidebar-foot, followed by the fixed .mobile-dock. */
@media (max-width: 850px) {
  .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
    height: auto !important;
    max-height: none !important;
    width: min(290px, 86vw) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 45 !important;
  }
  body.menu-open .sidebar { transform: translateX(0) !important; }
  .sidebar > .brand { flex: 0 0 auto !important; }
  .sidebar > .nav {
    display: block !important;
    flex: 1 1 0% !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: 0 9px 18px !important;
    scrollbar-width: thin;
    scroll-padding-bottom: 18px;
  }
  .sidebar > .sidebar-foot {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    min-height: 43px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 9px 12px 10px !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.35 !important;
    font-size: 10px !important;
    text-align: left !important;
    z-index: 2 !important;
  }
  .mobile-dock {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 60 !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.menu-open .sidebar .nav a,
  body.menu-open .sidebar .nav .nav-group-toggle {
    min-height: 42px;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}
.sidebar-foot, .footer { white-space: normal !important; }
