:root {
  /* Color tokens */
  --primary: 243 75% 59%;
  --primary-hover: 243 75% 52%;
  --primary-muted: 243 75% 95%;
  --primary-foreground: 0 0% 100%;
  --accent: 186 91% 45%;
  --accent-hover: 186 91% 40%;
  --accent-muted: 186 91% 95%;
  --accent-foreground: 0 0% 100%;
  --background: 0 0% 100%;
  --foreground: 224 71% 4%;
  --card: 0 0% 100%;
  --card-foreground: 224 71% 4%;
  --card-elevated: 0 0% 100%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 9% 46%;
  --border: 220 13% 91%;
  --border-subtle: 220 13% 95%;
  --success: 142 71% 45%;
  --success-foreground: 0 0% 100%;
  --success-muted: 142 71% 95%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --warning-muted: 38 92% 95%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --destructive-muted: 0 84% 95%;
  --info: 199 89% 48%;
  --info-foreground: 0 0% 100%;
  --info-muted: 199 89% 95%;
  /* Elevation */
  --shadow-xs: 0 1px 2px 0 hsl(0 0% 0% / 0.05);
  --shadow-sm: 0 1px 3px 0 hsl(0 0% 0% / 0.1), 0 1px 2px -1px hsl(0 0% 0% / 0.1);
  --shadow-md: 0 4px 6px -1px hsl(0 0% 0% / 0.1), 0 2px 4px -2px hsl(0 0% 0% / 0.1);
  --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.1), 0 4px 6px -4px hsl(0 0% 0% / 0.1);
  --shadow-xl: 0 20px 25px -5px hsl(0 0% 0% / 0.1), 0 8px 10px -6px hsl(0 0% 0% / 0.1);
  --shadow-elevated: 0 0 0 1px hsl(0 0% 0% / 0.03), 0 2px 4px hsl(0 0% 0% / 0.05), 0 12px 24px hsl(0 0% 0% / 0.09);
  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.625rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  /* Motion */
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { scroll-behavior: smooth; }
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Inter', sans-serif; font-weight: 500; letter-spacing: -0.01em; color: hsl(var(--foreground)); }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.4; }
h4 { font-size: 0.875rem; line-height: 1.4; font-weight: 500; }
h5 { font-size: 0.8125rem; font-weight: 600; }
h6 { font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); }

/* Navbar */
.navbar { border-bottom: 1px solid hsl(var(--primary)); background: hsl(var(--primary)); padding: 1rem 0; box-shadow: var(--shadow-xs); }
.navbar-brand { font-size: 1rem; font-weight: 600; color: white; letter-spacing: -0.01em; }
.navbar .text-muted { color: rgba(255, 255, 255, 0.8) !important; font-size: 0.75rem; }

/* Cards */
.card { background: hsl(var(--card)); border: 1px solid hsl(var(--border) / 0.5); border-radius: var(--radius-xl); box-shadow: var(--shadow-elevated); transition: box-shadow var(--duration-normal) var(--ease-default), border-color var(--duration-normal) var(--ease-default); }
.card:hover { box-shadow: var(--shadow-lg); }
.card-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: hsl(var(--foreground)); margin-bottom: 0.25rem; }
.card-body { padding: 1.5rem; }
.kpi-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border) / 0.5); box-shadow: var(--shadow-elevated); transition: all var(--duration-normal) var(--ease-default); }
.kpi-card:hover { box-shadow: var(--shadow-xl); transform: translateY(-2px); }
.kpi-title { font-size: 0.75rem; font-weight: 500; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: hsl(var(--foreground)); }

/* Badges */
.badge { font-size: 0.6875rem; font-weight: 500; padding: 0.25rem 0.625rem; border-radius: var(--radius-sm); color: black; }
.badge-soft { background: hsl(var(--primary-muted)); color: hsl(var(--primary)); border: 1px solid hsl(var(--primary) / 0.2); }
.bg-success-subtle { background: hsl(var(--success-muted)) !important; color: hsl(var(--success)) !important; border-color: hsl(var(--success) / 0.2) !important; }
.bg-info-subtle { background: hsl(var(--info-muted)) !important; color: hsl(var(--info)) !important; border-color: hsl(var(--info) / 0.2) !important; }
.bg-warning-subtle { background: hsl(var(--warning-muted)) !important; color: hsl(var(--warning)) !important; border-color: hsl(var(--warning) / 0.2) !important; }
.bg-danger-subtle { background: hsl(var(--destructive-muted)) !important; color: hsl(var(--destructive)) !important; border-color: hsl(var(--destructive) / 0.2) !important; }
.bg-secondary-subtle { background: hsl(var(--muted)) !important; color: hsl(var(--muted-foreground)) !important; border-color: hsl(var(--border)) !important; }
.border-danger { border-color: hsl(var(--destructive)) !important; }
.border-success { border-color: hsl(var(--success)) !important; }
.border-warning { border-color: hsl(var(--warning)) !important; }
.border-secondary { border-color: hsl(var(--border)) !important; }
.text-danger { color: hsl(var(--destructive)) !important; }
.text-success { color: hsl(var(--success)) !important; }
.text-warning { color: hsl(var(--warning)) !important; }
.text-secondary { color: hsl(var(--muted-foreground)) !important; }

/* Tables */
.table { font-size: 0.875rem; color: hsl(var(--foreground)); width: 100%; border-collapse: separate; border-spacing: 0; background: hsl(var(--card)); }
.table thead th { background: linear-gradient(to bottom, hsl(var(--muted)), hsl(var(--muted) / 0.8)); border-bottom: 2px solid hsl(var(--primary) / 0.2); position: sticky; top: 0; z-index: 10; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--foreground)); padding: 1rem 0.875rem; box-shadow: 0 2px 4px hsl(0 0% 0% / 0.05); }
.table td, .table th { vertical-align: middle; white-space: nowrap !important; padding: 0.875rem; border-color: hsl(var(--border) / 0.5); overflow: visible; }
.table-summary td, .table-summary th { white-space: nowrap !important; }
.table-summary { table-layout: auto; font-size: 0.875rem; width: 100%; min-width: 1200px; border-radius: var(--radius-lg); overflow: visible; }
.table-summary td, .table-summary th { padding: 1rem 0.875rem; }
.table-summary td.num, .table-summary th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.table-summary tbody tr { transition: all var(--duration-fast) var(--ease-default); border-bottom: 1px solid hsl(var(--border) / 0.3); }
.table-summary tbody tr:last-child { border-bottom: none; }
.table-summary tbody tr:hover { background: hsl(var(--primary-muted) / 0.4); transform: scale(1.001); box-shadow: 0 2px 8px hsl(var(--primary) / 0.1); }
.table-summary tbody tr.clickable-row { cursor: pointer; }
.table-summary tbody tr.clickable-row:hover { background: hsl(var(--primary-muted) / 0.5); }
.table-summary .sortable { cursor: pointer; user-select: none; transition: all var(--duration-fast) var(--ease-default); position: relative; }
.table-summary .sortable:hover { color: hsl(var(--primary)); transform: translateY(-1px); }
.table-summary .sort-indicator { margin-left: 0.5rem; opacity: 0.4; font-size: 0.625rem; transition: opacity var(--duration-fast) var(--ease-default); }
.table-summary .sortable:hover .sort-indicator { opacity: 0.8; }
.table-summary td.wrap, .table-summary th.wrap { white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.table-striped > tbody > tr:nth-of-type(even) { background-color: hsl(var(--muted) / 0.15); }
.table-striped > tbody > tr:nth-of-type(odd) { background-color: hsl(var(--card)); }
.table-striped > tbody > tr:hover { background-color: hsl(var(--primary-muted) / 0.5) !important; }
.table-bordered { border: 1px solid hsl(var(--border)); border-radius: var(--radius-lg); }
.table-hover > tbody > tr:hover > * { background-color: transparent; }
.table-responsive { display: block; width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; position: relative; border-radius: var(--radius-lg); }
.table-summary thead th:first-child { border-top-left-radius: var(--radius-lg); }
.table-summary thead th:last-child { border-top-right-radius: var(--radius-lg); }
.table-summary tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.table-summary tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }


/* Charts */
.chart-container { position: relative; height: 260px; width: 100%; }

/* Skill cards & accordions */
.skill-card { border-radius: var(--radius-xl); border: 1px solid hsl(var(--border)); margin-bottom: 0.75rem; box-shadow: var(--shadow-sm); transition: all var(--duration-normal) var(--ease-default); }
.skill-card:hover { box-shadow: var(--shadow-md); }
.accordion-button { border-radius: var(--radius-xl) !important; font-weight: 500; font-size: 0.875rem; padding: 1rem 1.25rem; background: hsl(var(--card)); color: hsl(var(--foreground)); border: none; transition: background-color var(--duration-normal) var(--ease-default); }
.accordion-button:not(.collapsed) { background: hsl(var(--primary-muted)); color: hsl(var(--primary)); box-shadow: none; }
.accordion-button:focus { box-shadow: 0 0 0 0.125rem hsl(var(--primary) / 0.25); border-color: hsl(var(--primary)); }
.accordion-body { padding: 1rem 1.25rem; font-size: 0.8125rem; }
.skill-title { font-weight: 600; color: hsl(var(--foreground)); font-size: 0.875rem; }
.metric-label { color: hsl(var(--muted-foreground)); font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 1.125rem; font-weight: 700; color: hsl(var(--foreground)); letter-spacing: -0.01em; }

/* Tabs */
.nav-tabs { border-bottom: 1px solid hsl(var(--border)); gap: 0.25rem; }
.nav-tabs .nav-link { border: 0; color: hsl(var(--muted-foreground)); font-weight: 600; font-size: 0.875rem; padding: 0.75rem 1.25rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; transition: all var(--duration-fast) var(--ease-default); letter-spacing: -0.01em; }
.nav-tabs .nav-link:hover { color: hsl(var(--foreground)); background: hsl(var(--muted) / 0.5); border-color: transparent; }
.nav-tabs .nav-link.active { color: hsl(var(--primary)); background: linear-gradient(180deg, hsl(var(--primary-muted)) 0%, hsl(var(--card)) 100%); border: 1px solid hsl(var(--border)); border-bottom-color: hsl(var(--card)); position: relative; margin-bottom: -1px; }
/* Model buttons in skill evals tab - match View Details button styling */
.model-tab-btn { font-weight: 500; border-radius: var(--radius-md); transition: all var(--duration-fast) var(--ease-default); margin: 0.125rem; }
.model-tab-btn.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); }
.model-tab-btn:not(.active) { background: transparent; color: hsl(var(--primary)); border-color: hsl(var(--primary)); }
.model-tab-btn:not(.active):hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.model-tab-btn:not(.active):focus { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); }

/* Utility */
.small-muted { color: hsl(var(--muted-foreground)); font-size: 0.8125rem; }
.text-primary { color: hsl(var(--primary)) !important; }
.text-success { color: hsl(var(--success)) !important; }
.text-info { color: hsl(var(--info)) !important; }
.text-warning { color: hsl(var(--warning)) !important; }
.text-muted { color: hsl(var(--muted-foreground)) !important; }
.fw-semibold { font-weight: 600; }
.search-input { max-width: 420px; }
.footer-note { color: hsl(var(--muted-foreground)); font-size: 0.75rem; margin-top: 1.5rem; }

/* Read-more clamp */
.readmore-clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; color: hsl(var(--foreground)); }
.readmore-clamp.expanded { -webkit-line-clamp: initial; max-height: none; }
.readmore-toggle { color: hsl(var(--primary)); text-decoration: none; font-weight: 600; font-size: 0.8125rem; transition: color var(--duration-fast) var(--ease-default); }
.readmore-toggle:hover { color: hsl(var(--primary-hover)); text-decoration: underline; }

/* Additional metrics collapse */
[data-bs-toggle="collapse"][data-bs-target^="#additional-metrics"] .bi-chevron-down { transition: transform var(--duration-normal) var(--ease-default); }
[data-bs-toggle="collapse"][data-bs-target^="#additional-metrics"][aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

/* Buttons */
.btn { font-size: 0.8125rem; font-weight: 500; padding: 0.5rem 1rem; border-radius: var(--radius-md); transition: all var(--duration-fast) var(--ease-default); letter-spacing: -0.01em; border: 1px solid transparent; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
.btn-primary:hover { background: hsl(var(--primary-hover)); border-color: hsl(var(--primary-hover)); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-link { color: hsl(var(--primary)); text-decoration: none; }
.btn-link:hover { color: hsl(var(--primary-hover)); text-decoration: underline; }
.btn-outline-primary { color: hsl(var(--primary)); border-color: hsl(var(--primary)); background: transparent; opacity: 1 !important; visibility: visible !important; display: inline-block !important; border-width: 1px; border-style: solid; font-weight: 500; }
.btn-outline-primary:hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline-primary:focus { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); }
.btn-outline-primary.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); }
.btn-sm { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
.table-dataset .view-details,
.table-dataset td .view-details,
.table-dataset tr .view-details { opacity: 1 !important; visibility: visible !important; display: inline-block !important; }
.view-details:hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)) !important; border-color: hsl(var(--primary)); }

/* Forms */
.form-control { font-size: 0.8125rem; padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--card)); color: hsl(var(--foreground)); transition: all var(--duration-fast) var(--ease-default); }
.form-control:focus { border-color: hsl(var(--primary)); box-shadow: 0 0 0 0.125rem hsl(var(--primary) / 0.25); outline: none; }

/* Animations */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fade-in var(--duration-normal) var(--ease-out); }

/* Bootstrap overrides */
.container { max-width: 1400px; }
hr { border-color: hsl(var(--border)); opacity: 1; margin: 1.5rem 0; }  /* fixed from 'r' to 'hr' */
.tooltip { font-size: 0.75rem; }
.bi { vertical-align: -0.125em; }
.border-subtle { border-color: hsl(var(--border-subtle)) !important; }

/* Responsive */
@media (max-width: 992px) {
  .table-summary { font-size: 0.8125rem; }
  .table-summary td, .table-summary th { padding: 0.75rem 0.625rem; }
  .table thead th { padding: 0.875rem 0.625rem; font-size: 0.6875rem; }
}

@media (max-width: 768px) {
  body { font-size: 0.75rem; }
  .kpi-value { font-size: 1.5rem; }
  .card-body { padding: 1rem; }
  .table-summary td, .table-summary th { padding: 0.625rem 0.5rem; font-size: 0.75rem; white-space: nowrap; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; display: block; width: 100%; margin: 0 -1rem; padding: 0 1rem; }
  .table-summary { font-size: 0.75rem; min-width: 1100px; width: 100%; }
  .table-summary td.wrap, .table-summary th.wrap { white-space: nowrap !important; max-width: none; }
  .table thead th { padding: 0.75rem 0.5rem; font-size: 0.625rem; letter-spacing: 0.05em; }
  .table td, .table th { white-space: nowrap; padding: 0.625rem 0.5rem; }
  .table-summary td.num, .table-summary th.num { font-size: 0.75rem; }
  .navbar { padding: 0.75rem 0; }
  .navbar-brand { font-size: 0.875rem; }
  .navbar .text-muted { font-size: 0.6875rem !important; }
  .container { padding-left: 1rem; padding-right: 1rem; max-width: 100%; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.125rem; }
  h3 { font-size: 1rem; }
  .card-title { font-size: 0.875rem; }
  .chart-container { height: 200px; }
  .table-dataset { min-width: 800px; }
}

@media (max-width: 576px) {
  .table-summary { font-size: 0.6875rem; min-width: 1000px; }
  .table-summary td, .table-summary th { padding: 0.5rem 0.375rem; white-space: nowrap !important; font-size: 0.6875rem; }
  .table-summary td.wrap, .table-summary th.wrap { white-space: nowrap !important; max-width: none; }
  .table-summary td.num, .table-summary th.num { font-size: 0.6875rem; }
  .table thead th { padding: 0.625rem 0.375rem; font-size: 0.5625rem; }
  .kpi-value { font-size: 1.25rem; }
  .card-body { padding: 0.75rem; }
  .table-responsive { margin-left: -0.75rem; margin-right: -0.75rem; padding: 0 0.75rem; }
  .table td, .table th { white-space: nowrap; padding: 0.5rem 0.375rem; }
  .card-title { font-size: 0.8125rem; }
  .badge { font-size: 0.625rem; padding: 0.2rem 0.5rem; }
  .chart-container { height: 180px; }
  .col-lg-7, .col-lg-5, .col-lg-6 { margin-bottom: 1rem; }
  .d-flex.flex-wrap.gap-2 { gap: 0.5rem !important; }
  .badge i { font-size: 0.75rem; }
  .table-dataset { min-width: 700px; }
}

@media (max-width: 480px) {
  .table-summary { font-size: 0.625rem; min-width: 950px; }
  .table-summary td, .table-summary th { padding: 0.4375rem 0.3125rem; white-space: nowrap !important; }
  .table thead th { padding: 0.5625rem 0.3125rem; font-size: 0.5rem; }
  .table-summary td.num, .table-summary th.num { font-size: 0.625rem; }
  .table-summary td.wrap, .table-summary th.wrap { white-space: nowrap !important; max-width: none; }
  .table-responsive { margin-left: -0.5rem; margin-right: -0.5rem; padding: 0 0.5rem; }
}

</style>
