/* FXTE OS — Institutional Theme System
   Palette: Platinum / Obsidian
   Breakpoints: mobile <=767, tablet 768–1199, desktop >=1200
*/

:root {
  color-scheme: dark;

  --fxte-platinum: #E5E4E2;
  --fxte-obsidian: #050505;
  --fxte-platinum-dim: #787876;
  --fxte-platinum-ghost: #2D2D2C;

  --fxte-green: #22C55E;
  --fxte-red: #EF4444;

  --bg: #050505;
  --bg-base: #050505;
  --bg-1: #090909;
  --bg-surface: #090909;
  --bg-2: #0F0F0F;
  --bg-card: #0F0F0F;
  --bg-3: #171717;
  --bg-highlight: #171717;

  --p1: #E5E4E2;
  --p2: #BCBBB8;
  --p3: #787876;
  --p4: #4A4A48;

  --t1: #E5E4E2;
  --t2: #BCBBB8;
  --t3: #787876;
  --t4: #4A4A48;

  --text-primary: #E5E4E2;
  --text-secondary: #BCBBB8;
  --text-muted: #787876;

  --platinum-1: #E5E4E2;
  --platinum-2: #BCBBB8;
  --platinum-3: #92918E;

  --border: rgba(229, 228, 226, 0.08);
  --border-2: rgba(229, 228, 226, 0.14);
  --border-active: rgba(229, 228, 226, 0.24);

  /* Legacy aliases neutralized: no gold or amber branding */
  --gold: #E5E4E2;
  --gold-d: rgba(229, 228, 226, 0.08);
  --gold-dim: rgba(229, 228, 226, 0.08);
  --gold-b: rgba(229, 228, 226, 0.18);
  --gold-border: rgba(229, 228, 226, 0.18);

  --amber: #92918E;
  --amber-d: rgba(146, 145, 142, 0.10);

  --blue: #A4A3A0;
  --blue-d: rgba(164, 163, 160, 0.10);

  --green: #22C55E;
  --green-d: rgba(34, 197, 94, 0.10);
  --red: #EF4444;
  --red-d: rgba(239, 68, 68, 0.10);

  --display: "Syne", sans-serif;
  --body: "DM Sans", sans-serif;

  --fxte-radius-xs: 4px;
  --fxte-radius-sm: 8px;
  --fxte-radius-md: 12px;
  --fxte-shadow:
    0 18px 48px rgba(0, 0, 0, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.025) inset;

  --fxte-transition: 160ms ease;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #F3F3F1;
  --bg-base: #F3F3F1;
  --bg-1: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-2: #ECECEA;
  --bg-card: #FFFFFF;
  --bg-3: #E3E3E0;
  --bg-highlight: #E7E7E4;

  --p1: #090909;
  --p2: #333331;
  --p3: #686865;
  --p4: #969692;

  --t1: #090909;
  --t2: #333331;
  --t3: #686865;
  --t4: #969692;

  --text-primary: #090909;
  --text-secondary: #333331;
  --text-muted: #686865;

  --platinum-1: #090909;
  --platinum-2: #333331;
  --platinum-3: #686865;

  --border: rgba(5, 5, 5, 0.09);
  --border-2: rgba(5, 5, 5, 0.16);
  --border-active: rgba(5, 5, 5, 0.28);

  --gold: #141414;
  --gold-d: rgba(5, 5, 5, 0.06);
  --gold-dim: rgba(5, 5, 5, 0.06);
  --gold-b: rgba(5, 5, 5, 0.16);
  --gold-border: rgba(5, 5, 5, 0.16);

  --amber: #686865;
  --amber-d: rgba(104, 104, 101, 0.10);

  --blue: #555552;
  --blue-d: rgba(85, 85, 82, 0.09);

  --fxte-shadow:
    0 18px 48px rgba(5, 5, 5, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

html {
  background: var(--bg);
  font-family: var(--body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--p1);
  transition:
    background-color var(--fxte-transition),
    color var(--fxte-transition);
}

::selection {
  background: rgba(229, 228, 226, 0.18);
  color: var(--p1);
}

:root[data-theme="light"] ::selection {
  background: rgba(5, 5, 5, 0.14);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

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

button,
[role="button"],
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--p2);
  outline-offset: 2px;
}

.panel,
.kpi,
.mc,
.ring-card,
.level-card,
.score-block,
.mentor-banner,
.alert-card,
.cap-item,
.cap-i,
.ms-item,
.floor-card,
.eq-card,
.pos-card,
.alerts-card,
.session-card {
  border-radius: var(--fxte-radius-sm) !important;
  box-shadow: var(--fxte-shadow);
}

.ph,
.panel-hdr,
.connect-banner,
.hdr,
.main-header,
.header,
.topbar {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.btn,
.btn-gold,
.top-btn,
.nav-btn,
.tab-btn,
.module-tab,
.sn-item,
.mobile-menu-btn,
.alert-dismiss {
  transition:
    background-color var(--fxte-transition),
    border-color var(--fxte-transition),
    color var(--fxte-transition),
    transform var(--fxte-transition);
}

.btn:active,
.btn-gold:active,
.top-btn:active,
.nav-btn:active,
.tab-btn:active,
.module-tab:active,
.mobile-menu-btn:active {
  transform: translateY(1px);
}

.btn-gold,
.modal-upload,
.modal-ul {
  background: var(--gold-d) !important;
  border-color: var(--gold-b) !important;
  color: var(--gold) !important;
}

.nav-btn.active,
.tab-btn.active,
.module-tab.active,
.sn-item.active {
  color: var(--p1) !important;
  border-color: var(--border-active) !important;
}

.sp-warn,
.tag-a,
.check-active,
.prog-node.current .prog-node-circle,
.current-badge,
.badge-gold {
  background: var(--amber-d) !important;
  color: var(--amber) !important;
  border-color: var(--border-2) !important;
}

img {
  max-width: 100%;
}

iframe {
  color-scheme: inherit;
}

/* Mobile: layouts must behave as native mobile surfaces */
@media (max-width: 767px) {
  html,
  body {
    min-width: 320px;
    overflow-x: hidden;
  }

  button,
  [role="button"],
  .btn,
  .btn-gold,
  .top-btn,
  .nav-btn,
  .tab-btn,
  .module-tab,
  .sn-item,
  .mobile-menu-btn,
  select,
  input:not([type="checkbox"]):not([type="radio"]) {
    min-height: 44px;
  }

  .panel,
  .kpi,
  .mc,
  .ring-card,
  .level-card,
  .score-block,
  .mentor-banner,
  .alert-card {
    border-radius: var(--fxte-radius-md) !important;
  }

  .content,
  .main-content,
  .page-content,
  .workspace {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .mobile-col-grid,
  .kpi-grid,
  .metrics-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  table {
    font-size: 11px;
  }

  .ph,
  .panel-hdr {
    min-height: 48px;
  }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1199px) {
  .content,
  .main-content,
  .page-content,
  .workspace {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .kpi-grid,
  .metrics-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .content,
  .main-content,
  .page-content,
  .workspace {
    max-width: 1680px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Wide screens / TV */
@media (min-width: 1600px) {
  body {
    font-size: 14px;
  }

  .content,
  .main-content,
  .page-content,
  .workspace {
    max-width: 1880px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Theme control */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 76px;
  white-space: nowrap;
}

.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  font-size: 14px;
  line-height: 1;
}

.theme-text {
  font-size: inherit;
}

.logo-mark {
  color: var(--p1, var(--text-primary));
}

@media (max-width: 767px) {
  .theme-toggle {
    width: 44px;
    min-width: 44px;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .theme-toggle .theme-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .theme-icon {
    font-size: 16px;
  }
}
