/* ============================================================
   Manager Evaluation App — custom.css
   Fonts: Oswald (headers/titles/tables) + Inter (body/fields)
   Theming: CSS custom properties; dark mode via body.dark-mode
   Primary accent: #00AEEF (MNUFC teal)
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ── Design Tokens: Light Mode ────────────────────────────── */
:root {
  /* Surfaces */
  --bg:            #f4f5f7;
  --bg-panel:      #ffffff;
  --bg-input:      #ffffff;
  --bg-sidebar:    #1a1f2e;
  --bg-header:     #0e1520;

  /* Borders */
  --border:        #dde1e7;
  --border-subtle: #ebedf0;

  /* Text */
  --text:          #1a1d23;
  --text-muted:    #6b7280;
  --text-inverse:  #ffffff;
  --text-link:     #007dbf;

  /* Brand / Accent */
  --accent:        #00AEEF;
  --accent-dark:   #007dbf;
  --accent-glow:   rgba(0, 174, 239, 0.18);

  /* Tier badge colors */
  --tier-pool:      #6b7280;
  --tier-longlist:  #3b82f6;
  --tier-shortlist: #8b5cf6;
  --tier-preferred: #00AEEF;

  /* Table */
  --row-hover:     rgba(0, 174, 239, 0.07);
  --row-stripe:    rgba(0, 0, 0, 0.025);
  --cell-best:     rgba(46, 248, 160, 0.15);
  --cell-worst:    rgba(255, 106, 98, 0.15);
  --cell-empty:    #f9fafb;

  /* KPI stat boxes */
  --kpi-bg:        #f0f9ff;
  --kpi-border:    rgba(0, 174, 239, 0.25);

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);

  /* Radii */
  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
  --radius-pill:   999px;

  /* Typography */
  --font-header:   'Oswald', sans-serif;
  --font-body:     'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition:    0.18s ease;
}

/* ── Design Tokens: Dark Mode ─────────────────────────────── */
body.dark-mode {
  --bg:            #0e1117;
  --bg-panel:      #151822;
  --bg-input:      #1c2130;
  --bg-sidebar:    #0a0e17;
  --bg-header:     #080c14;

  --border:        #2a3042;
  --border-subtle: #1e2436;

  --text:          #e8eaf0;
  --text-muted:    #8892a4;
  --text-inverse:  #ffffff;
  --text-link:     #5bb8f5;

  --accent:        #00AEEF;
  --accent-dark:   #0096d1;
  --accent-glow:   rgba(0, 174, 239, 0.22);

  --row-hover:     rgba(0, 174, 239, 0.09);
  --row-stripe:    rgba(255, 255, 255, 0.03);
  --cell-best:     rgba(46, 248, 160, 0.12);
  --cell-worst:    rgba(255, 106, 98, 0.12);
  --cell-empty:    #1a1f2e;

  --kpi-bg:        rgba(0, 174, 239, 0.08);
  --kpi-border:    rgba(0, 174, 239, 0.30);

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.35);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg:     0 10px 30px rgba(0,0,0,0.55);
}

/* ── Base Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color var(--transition), color var(--transition);
  margin: 0;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-header);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.2;
}

p, label, .form-label { font-family: var(--font-body); }

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── App Layout ───────────────────────────────────────────── */
.wrapper, .main-sidebar, .main-header { background: transparent; }

/* bslib page_sidebar / page_navbar shell */
.bslib-page-sidebar {
  background: var(--bg);
  min-height: 100vh;
}

/* ── App Header ───────────────────────────────────────────── */
.app-header {
  background: var(--bg-header);
  border-bottom: 2px solid var(--accent);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.app-header .app-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.app-header .app-title {
  font-family: var(--font-header);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  flex: 1;
}

.app-header .app-title span.accent {
  color: var(--accent);
}

.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Dark-mode toggle button in header */
.btn-mode-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.btn-mode-toggle:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.28);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.app-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 1rem 0.75rem;
  min-height: 100vh;
}

.app-sidebar .sidebar-section-label {
  font-family: var(--font-header);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.75rem 0.5rem 0.25rem;
  margin-bottom: 0.1rem;
}

/* Sidebar nav items */
.app-sidebar .nav-link {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(255,255,255,0.72);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.app-sidebar .nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-decoration: none;
}
.app-sidebar .nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
}
.app-sidebar .nav-link i {
  font-size: 0.95rem;
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
}

/* Sidebar inputs */
.app-sidebar label,
.app-sidebar .control-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  margin-bottom: 0.25rem;
}

.app-sidebar .selectize-control .selectize-input,
.app-sidebar .form-control,
.app-sidebar .form-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.app-sidebar hr {
  border-color: rgba(255,255,255,0.08);
  margin: 0.75rem 0;
}

/* ── Main Content Area ────────────────────────────────────── */
.app-main {
  padding: 1.25rem 1.5rem;
  max-width: 1600px;
}

/* ── Cards / Panels ───────────────────────────────────────── */
.card, .panel, .bslib-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header, .panel-heading, .bslib-card > .card-header {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1rem;
}

.card-body { padding: 1rem; }

/* ── KPI Stat Boxes ───────────────────────────────────────── */
.stat-box {
  background: var(--kpi-bg);
  border: 1px solid var(--kpi-border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-box .stat-value {
  font-family: var(--font-header);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.stat-box .stat-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-box .stat-delta {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.3rem;
}
.stat-box .stat-delta.positive { color: #2ef8a0; }
.stat-box .stat-delta.negative { color: #ff6a62; }

/* Starred metrics get a subtle accent left border */
.stat-box.starred {
  border-left: 3px solid var(--accent);
}

/* ── Tier Badges ──────────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-header);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}

.tier-badge.pool {
  background: rgba(107, 114, 128, 0.15);
  color: var(--tier-pool);
  border-color: rgba(107, 114, 128, 0.3);
}
.tier-badge.long-list {
  background: rgba(59, 130, 246, 0.12);
  color: var(--tier-longlist);
  border-color: rgba(59, 130, 246, 0.3);
}
.tier-badge.short-list {
  background: rgba(139, 92, 246, 0.12);
  color: var(--tier-shortlist);
  border-color: rgba(139, 92, 246, 0.3);
}
.tier-badge.preferred {
  background: rgba(0, 174, 239, 0.12);
  color: var(--tier-preferred);
  border-color: rgba(0, 174, 239, 0.35);
}

/* ── Manager Profile Header ───────────────────────────────── */
.manager-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.manager-headshot {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  background: var(--border);
}

.manager-info .manager-name {
  font-family: var(--font-header);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
  margin: 0 0 0.15rem;
  line-height: 1.1;
}
.manager-info .manager-meta {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.manager-info .manager-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

/* ── Manager Pool / Rankings Table ───────────────────────── */
.pool-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* reactable overrides */
.reactable {
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: var(--bg-panel);
  color: var(--text);
}

.reactable .rt-thead {
  background: var(--bg-panel);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.reactable .rt-th {
  font-family: var(--font-header);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
  border-right: 1px solid var(--border-subtle);
  cursor: default;
}

.reactable .rt-th[aria-sort] { cursor: pointer; }
.reactable .rt-th[aria-sort]:hover { color: var(--accent); }

.reactable .rt-tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}
.reactable .rt-tr:hover { background: var(--row-hover); }
.reactable .rt-tr:nth-child(even) { background: var(--row-stripe); }
.reactable .rt-tr:nth-child(even):hover { background: var(--row-hover); }

.reactable .rt-td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
  border-right: 1px solid var(--border-subtle);
}

/* Cell highlighting for comparison view */
.cell-best  { background: var(--cell-best)  !important; }
.cell-worst { background: var(--cell-worst) !important; }
.cell-nr    { color: var(--text-muted); font-style: italic; }

/* Numeric cells in Oswald for compactness */
.reactable .rt-td.numeric {
  font-family: var(--font-header);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: right;
}

/* Rank column */
.rank-number {
  font-family: var(--font-header);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

/* Manager name cell with headshot thumbnail */
.manager-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.manager-cell .thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--border);
}
.manager-cell .cell-name {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.manager-cell .cell-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Team logo in table */
.team-logo-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.team-logo-cell img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}
.team-logo-cell span {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── Career Timeline ──────────────────────────────────────── */
.career-timeline {
  padding: 0.5rem 0;
}
.timeline-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.timeline-row:last-child { border-bottom: none; }

.timeline-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.timeline-bar-wrap {
  flex: 1;
  background: var(--border);
  border-radius: var(--radius-pill);
  height: 8px;
  overflow: hidden;
}
.timeline-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);  /* overridden inline with team primary_color */
  transition: width 0.4s ease;
}
.timeline-label {
  font-family: var(--font-header);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 55px;
  text-align: right;
}

/* ── Comparison Table ─────────────────────────────────────── */
.comparison-wrapper {
  overflow-x: auto;
}
.comparison-table {
  font-family: var(--font-body);
  font-size: 0.875rem;
  border-collapse: collapse;
  width: 100%;
}
.comparison-table thead tr {
  border-bottom: 2px solid var(--border);
}
.comparison-table th {
  font-family: var(--font-header);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.8rem;
  text-align: right;
  white-space: nowrap;
}
.comparison-table th:first-child { text-align: left; }
.comparison-table td {
  padding: 0.45rem 0.8rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-header);
  font-weight: 500;
}
.comparison-table td:first-child {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.comparison-table .row-starred td:first-child {
  color: var(--text);
  font-weight: 500;
}
.comparison-table .row-starred td:first-child::before {
  content: '★ ';
  color: var(--accent);
  font-size: 0.75rem;
}
.comparison-table tbody tr:hover { background: var(--row-hover); }

/* ── Metric Group Tabs ────────────────────────────────────── */
.metric-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}
.metric-group-tab {
  font-family: var(--font-header);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-panel);
  cursor: pointer;
  transition: all var(--transition);
}
.metric-group-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.metric-group-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Ranking Mode Selector ────────────────────────────────── */
.ranking-mode-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.ranking-mode-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-panel);
  cursor: pointer;
  transition: all var(--transition);
}
.ranking-mode-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ranking-mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--text);
}

/* ── Form Controls ────────────────────────────────────────── */
.form-control,
.form-select,
.selectize-input {
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  padding: 0.4rem 0.7rem;
}
.form-control:focus,
.form-select:focus,
.selectize-input.focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.form-label,
.control-label,
label {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* Selectize dropdown */
.selectize-dropdown {
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.selectize-dropdown .option { padding: 0.4rem 0.7rem; }
.selectize-dropdown .option:hover,
.selectize-dropdown .option.selected {
  background: var(--accent-glow);
  color: var(--text);
}
.selectize-dropdown .option.active {
  background: var(--row-hover);
}

/* Sliders */
.irs--shiny .irs-line { background: var(--border); }
.irs--shiny .irs-bar { background: var(--accent); }
.irs--shiny .irs-handle { background: var(--accent); border-color: var(--accent); }
.irs--shiny .irs-single { background: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.btn-primary,
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover,
.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline-primary:hover {
  background: var(--accent-glow);
}

/* Red outline button (e.g. "-> Unavailable"): same shape as the other outline buttons, with a visible border */
.btn-outline-danger {
  background: transparent;
  border: 1px solid #dc2626;
  color: #dc2626;
}
.btn-outline-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: #dc2626;
  color: #dc2626;
}

/* Orange outline button ("-> Not interested"): same shape as the red one. In the Move Availability column the two stack. */
.btn-outline-orange {
  background: transparent;
  border: 1px solid #ea580c;
  color: #ea580c;
}
.btn-outline-orange:hover {
  background: rgba(249, 115, 22, 0.14);
  border-color: #ea580c;
  color: #ea580c;
}
.row-actions.avail-stack { flex-direction: column; align-items: flex-start; gap: .25rem; }
.btn-danger {
  background: #dc2626;
  border: 1px solid #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-secondary {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--text-muted);
}

/* Download / export button */
.btn-export {
  font-family: var(--font-header);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); }

/* ── Alerts / Banners ─────────────────────────────────────── */
.alert {
  font-family: var(--font-body);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  border-left-width: 3px;
  padding: 0.6rem 0.9rem;
}
.alert-info {
  background: rgba(0, 174, 239, 0.08);
  border-color: var(--accent);
  color: var(--text);
}
.alert-warning {
  background: rgba(248, 150, 30, 0.08);
  border-color: #f8961e;
  color: var(--text);
}

/* ── Loading Spinner ──────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  gap: 0.6rem;
}
.spinner-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page-level "Loading…" card: Shiny puts .shiny-busy on the page while the server is working. It fades in only after
   0.5 s, so quick updates never flash it, and it ignores clicks. */
#app-loading {
  display: none;
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 9000; pointer-events: none;
  align-items: center; gap: 0.7rem;
  padding: 0.8rem 1.2rem;
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-family: var(--font-body); font-size: 0.9rem;
}
.shiny-busy #app-loading { display: flex; animation: app-loading-in 0.2s ease 0.5s both; }
@keyframes app-loading-in { from { opacity: 0; } to { opacity: 1; } }

/* ── MLS Only Badge ───────────────────────────────────────── */
.mls-badge {
  font-family: var(--font-header);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 174, 239, 0.1);
  border: 1px solid rgba(0, 174, 239, 0.25);
  color: var(--accent);
  white-space: nowrap;
}

/* ── Percentile Bar (inline in cells) ────────────────────── */
.pct-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pct-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.pct-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
}
.pct-bar-val {
  font-family: var(--font-header);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}

/* ── Tabs (bslib / Bootstrap) ────────────────────────────── */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 0.1rem;
}
.nav-tabs .nav-link {
  font-family: var(--font-header);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.85rem;
  margin-bottom: -2px;
  background: transparent;
  transition: color var(--transition), border-color var(--transition);
}
.nav-tabs .nav-link:hover { color: var(--text); }
.nav-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}
.tab-content { padding-top: 1rem; }

/* ── Plotly chart containers ──────────────────────────────── */
.plotly-container {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
}

/* Ensure Plotly modebar matches theme */
.modebar { background: transparent !important; }
.modebar-btn path { fill: var(--text-muted) !important; }

/* ── Shiny-specific overrides ────────────────────────────── */

/* Remove default Shiny body padding */
body.shiny-busy { cursor: wait; }

/* Shiny notification */
#shiny-notification-panel {
  z-index: 100000 !important;   /* above the profile drawer and modals, or messages are hidden behind them */
  font-family: var(--font-body);
  font-size: 0.875rem;
}

/* Value boxes (bslib) */
.bslib-value-box {
  border-radius: var(--radius-md);
  border: 1px solid var(--kpi-border);
  background: var(--kpi-bg);
}
.bslib-value-box .value-box-value {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--accent);
}
.bslib-value-box .value-box-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* bslib card full-screen button */
.bslib-card .bslib-full-screen-enter {
  color: var(--text-muted);
}

/* ── Login Page ───────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.login-card .login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-card .login-logo img { height: 48px; }
.login-card h2 {
  font-family: var(--font-header);
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

/* ── Utility Classes ──────────────────────────────────────── */
.text-accent  { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-oswald  { font-family: var(--font-header) !important; }
.font-mono    { font-family: var(--font-mono) !important; }
.border-accent { border-color: var(--accent) !important; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.scrollable-y {
  overflow-y: auto;
  max-height: 70vh;
}
.scrollable-x { overflow-x: auto; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-main { padding: 0.75rem; }
  .stat-box .stat-value { font-size: 1.4rem; }
  .manager-profile-header { flex-direction: column; }
  .manager-headshot { width: 72px; height: 72px; }
  .metric-group-tabs { gap: 0.2rem; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .app-header .app-title { font-size: 1.1rem; }
  .ranking-mode-selector { gap: 0.3rem; }
}

/* ── Print / PDF Export ───────────────────────────────────── */
@media print {
  :root {
    --bg: #ffffff;
    --bg-panel: #ffffff;
    --text: #000000;
    --border: #cccccc;
  }
  .app-sidebar, .app-header { display: none; }
  .card { box-shadow: none; border: 1px solid #cccccc; }
}

/* Admin */
.admin-pane { padding-top: 1rem; }
.admin-table td, .admin-table th { vertical-align: middle; }

/* Admin > Maintenance (rendered from docs/maintenance.md) */
.maintenance-doc { max-width: 980px; line-height: 1.55; }
.maintenance-doc h2 { font-family: var(--font-header); margin: 0 0 .5rem; }
.maintenance-doc h3 { font-family: var(--font-header); margin: 1.8rem 0 .6rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border); }
.maintenance-doc h4 { margin: 1.3rem 0 .4rem; font-size: 1rem; }
.maintenance-doc code { background: var(--bg); padding: .1rem .3rem; border-radius: 4px; font-size: .85em; }
.maintenance-doc pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .7rem .9rem; overflow-x: auto; }
.maintenance-doc pre code { background: none; padding: 0; font-size: .82rem; }
.maintenance-doc table { border-collapse: collapse; width: 100%; margin: .6rem 0 1rem; font-size: .88rem; }
.maintenance-doc th, .maintenance-doc td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.maintenance-doc th { background: var(--bg-panel); }
.admin-table .row-actions, .row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
#admin-weights-total.ok { color: #1a7f37; }
#admin-weights-total.bad { color: #c62828; }

/* "Update from TM" beside the Transfermarkt link in the profile header */
.btn-xs { padding: 0 .45rem; font-size: .72rem; line-height: 1.5; }
.manager-meta .tm-update { margin-left: .4rem; vertical-align: baseline; }
.tm-cookie-status { margin: .5rem 0; font-size: .85rem; }

.evidence-chip { display: inline-block; margin-top: .15rem; padding: 0 .45rem; border-radius: 999px; font-size: .68rem; font-weight: 600;
  letter-spacing: .02em; background: rgba(136,146,164,.18); color: var(--text-muted); }

.score-range { margin-left: .35rem; font-size: .68rem; color: var(--text-muted); white-space: nowrap; }

.pct-bar.pct-bar-short { flex: 0 0 26px; width: 26px; min-width: 26px; }
.perf-pctl .pct-bar-val { min-width: 1.5rem; }
.perf-pctl { white-space: nowrap; width: 1%; }
.adj-range { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }
.corr-val { font-size: .8rem; font-variant-numeric: tabular-nums; }
.corr-good { color: #1f9d55; }
.corr-bad { color: #d64545; }
.corr-weak { color: var(--text-muted); }

.grp-neutral { color: var(--text-muted); font-style: italic; }
