/*
 * ============================================================
 * Techsperience Portal — Drop-in Stylesheet
 * Version 1.0 — May 2026
 * ============================================================
 * Requires tokens.css to be loaded first.
 * Covers all Bootstrap 5 components used by the portal PLUS
 * the custom chrome classes from MainLayout / NavMenu /
 * AppSideNav.
 *
 * Load order in index.html:
 *   1. tokens.css           (design tokens + BS overrides)
 *   2. bootstrap.min.css    (Bootstrap 5 base)
 *   3. techsperience-portal.css  (this file)
 * ============================================================
 */

/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--tp-font-sans);
  font-size: var(--tp-fs-14);
  color: var(--tp-fg);
  background: var(--tp-bg-subtle);
  line-height: var(--tp-lh-body);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--tp-font-sans);
  font-weight: var(--tp-fw-semibold);
  color: var(--tp-fg-1);
  letter-spacing: var(--tp-tracking-tight);
  line-height: var(--tp-lh-snug);
}

a {
  color: var(--tp-accent);
  text-decoration: none;
  transition: color var(--tp-dur-fast) var(--tp-ease-standard);
}
a:hover {
  color: var(--tp-accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

code, kbd, samp, pre {
  font-family: var(--tp-font-mono);
}

/* ============================================================
   APP CHROME — MainLayout
   .app-shell / .app-body / .app-content
   ============================================================ */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
  padding-top: var(--tp-topbar-height);
  /* topbar is fixed, so body content starts below it */
}

.app-content {
  flex: 1;
  min-width: 0;
  background: var(--tp-bg-subtle);
  /* sidebar pushes content right via margin (see sidebar width) */
  margin-left: var(--tp-sidebar-width);
  transition: margin-left var(--tp-dur-slow) var(--tp-ease-standard);
}

/* When no sidebar is active (root / home) */
.app-content:only-child {
  margin-left: 0;
}

.app-content .content {
  padding: var(--tp-space-6) var(--tp-space-6);
  max-width: var(--tp-content-max);
}

/* ============================================================
   TOP BAR — NavMenu (.app-topbar)
   ============================================================ */

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tp-topbar-height);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tp-border);
  box-shadow: var(--tp-shadow-xs);
}

/* 3px spectrum gradient accent under the topbar border */
.app-topbar::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ts-gradient-spectrum);
  opacity: 0.7;
  pointer-events: none;
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--tp-space-5);
  gap: var(--tp-space-5);
  max-width: 100%;
}

/* ── Brand mark ── */
.app-brand {
  display: flex;
  align-items: center;
  gap: var(--tp-space-2);
  text-decoration: none;
  flex-shrink: 0;
  /* Logo image handled via background or <img> tag.
     See implementation-notes.md for the img swap. */
  font-family: var(--tp-font-display);
  font-size: var(--tp-fs-13);
  letter-spacing: var(--tp-tracking-display);
  text-transform: uppercase;
  color: var(--tp-fg-1);
  font-weight: 400;
}
.app-brand:hover {
  text-decoration: none;
  color: var(--tp-fg-1);
}

/* If the engineer wraps the brand text in an <img>, hide the
   text node — the logo itself carries the wordmark. */
.app-brand img {
  height: 28px;
  width: auto;
}

/* ── App tab bar ── */
.app-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar { display: none; }

.app-tab {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--tp-space-4);
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition:
    color var(--tp-dur-fast) var(--tp-ease-standard),
    border-color var(--tp-dur-fast) var(--tp-ease-standard);
  white-space: nowrap;
  cursor: pointer;
}
.app-tab:hover {
  color: var(--tp-fg-1);
  text-decoration: none;
  border-bottom-color: var(--ts-gray-300);
}
.app-tab.active,
.app-tab[aria-current] {
  color: var(--tp-accent);
  border-bottom-color: var(--tp-accent);
  font-weight: var(--tp-fw-semibold);
}

/* ── User area ── */
.app-user {
  display: flex;
  align-items: center;
  gap: var(--tp-space-2);
  font-size: var(--tp-fs-13);
  color: var(--tp-fg-2);
  flex-shrink: 0;
  margin-left: auto;
}

/* Avatar initials chip */
.app-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--tp-radius-pill);
  background: var(--ts-gradient-cool);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--tp-fs-12);
  font-weight: var(--tp-fw-semibold);
  flex-shrink: 0;
}

/* ============================================================
   SIDE NAV — AppSideNav (.app-sidenav)
   ============================================================ */

.app-sidenav {
  position: fixed;
  top: var(--tp-topbar-height);
  left: 0;
  bottom: 0;
  width: var(--tp-sidebar-width);
  background: var(--ts-white);
  border-right: 1px solid var(--tp-border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ts-gray-300) transparent;
}

/* Section heading inside sidebar */
.app-sidenav-title {
  padding: var(--tp-space-5) var(--tp-space-4) var(--tp-space-2);
  font-size: var(--tp-fs-11);
  font-weight: var(--tp-fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tp-tracking-display);
  color: var(--tp-fg-muted);
}

.app-sidenav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--tp-space-2) var(--tp-space-4);
}

/* Individual nav link */
.app-sidenav-link {
  display: flex;
  align-items: center;
  gap: var(--tp-space-2);
  padding: 8px var(--tp-space-3);
  border-radius: var(--tp-radius-sm);
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-2);
  text-decoration: none;
  transition:
    background var(--tp-dur-fast) var(--tp-ease-standard),
    color var(--tp-dur-fast) var(--tp-ease-standard);
  cursor: pointer;
}
.app-sidenav-link:hover {
  background: var(--tp-bg-muted);
  color: var(--tp-fg-1);
  text-decoration: none;
}

/* Bootstrap NavLink adds .active when matched */
.app-sidenav-link.active,
.app-sidenav-link[aria-current="page"] {
  background: var(--tp-accent-soft);
  color: var(--tp-accent);
  font-weight: var(--tp-fw-semibold);
}

/* External link indicator — the razor appends " ↗" as text; we nudge opacity */
.app-sidenav-link[target="_blank"] {
  color: var(--tp-fg-3);
}
.app-sidenav-link[target="_blank"]:hover {
  color: var(--tp-fg-2);
}

/* ============================================================
   PAGE HEADER (common inside .content article)
   ============================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tp-space-4);
  margin-bottom: var(--tp-space-5);
}

.page-title {
  font-size: var(--tp-fs-20);
  font-weight: var(--tp-fw-semibold);
  color: var(--tp-fg-1);
  letter-spacing: var(--tp-tracking-tight);
  margin: 0;
}

.page-subtitle {
  font-size: var(--tp-fs-13);
  color: var(--tp-fg-3);
  margin: 2px 0 0;
}

/* ============================================================
   BOOTSTRAP COMPONENT OVERRIDES
   ============================================================ */

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  font-family: var(--tp-font-sans);
  font-weight: var(--tp-fw-medium);
  border-radius: var(--tp-radius-sm);
  transition:
    background-color var(--tp-dur-fast) var(--tp-ease-standard),
    box-shadow var(--tp-dur-fast) var(--tp-ease-standard),
    transform var(--tp-dur-fast) var(--tp-ease-standard),
    border-color var(--tp-dur-fast) var(--tp-ease-standard);
  letter-spacing: 0;
}

.btn:focus-visible {
  box-shadow: var(--tp-shadow-focus);
  outline: none;
}

.btn-primary {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--tp-accent-hover);
  border-color: var(--tp-accent-hover);
  color: #fff;
}
.btn-primary:active {
  background: var(--tp-accent-pressed) !important;
  border-color: var(--tp-accent-pressed) !important;
  transform: scale(0.98);
  color: #fff;
}

.btn-secondary {
  background: var(--ts-white);
  border-color: var(--tp-border-strong);
  color: var(--tp-fg-1);
}
.btn-secondary:hover {
  background: var(--tp-bg-muted);
  border-color: var(--tp-border-strong);
  color: var(--tp-fg-1);
}

.btn-outline-primary {
  color: var(--tp-accent);
  border-color: var(--tp-accent);
}
.btn-outline-primary:hover {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
  color: #fff;
}

.btn-danger {
  background: var(--tp-danger);
  border-color: var(--tp-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #d42400;
  border-color: #d42400;
  color: #fff;
}

.btn-success {
  background: var(--tp-success);
  border-color: var(--tp-success);
  color: #fff;
}

.btn-sm {
  font-size: var(--tp-fs-12);
  padding: 5px 10px;
  border-radius: var(--tp-radius-xs);
}

.btn-lg {
  font-size: var(--tp-fs-16);
  padding: 11px 22px;
  border-radius: var(--tp-radius-md);
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  font-family: var(--tp-font-sans);
  font-weight: var(--tp-fw-semibold);
  font-size: var(--tp-fs-11);
  letter-spacing: 0.02em;
  border-radius: var(--tp-radius-pill);
  padding: 3px 8px;
  text-transform: none;
}

/* Status badges — matches DTO status values */
.badge-approved,
.badge.bg-success       { background: var(--tp-success-bg) !important; color: #3d6b06 !important; }
.badge-pending,
.badge.bg-warning       { background: var(--tp-warning-bg) !important; color: #7a5500 !important; }
.badge-rejected,
.badge.bg-danger        { background: var(--tp-danger-bg)  !important; color: #9a1500 !important; }
.badge-current          { background: var(--ts-indigo-50)  !important; color: #2b2a7a !important; }
.badge-due-soon         { background: var(--ts-orange-50)  !important; color: #8c3a00 !important; }
.badge-expired          { background: var(--ts-gray-100)   !important; color: var(--ts-gray-600)  !important; }
.badge-green            { background: var(--tp-success-bg) !important; color: #3d6b06 !important; }
.badge-amber            { background: var(--tp-warning-bg) !important; color: #7a5500 !important; }
.badge-red              { background: var(--tp-danger-bg)  !important; color: #9a1500 !important; }
.badge-grey,
.badge.bg-secondary     { background: var(--ts-gray-100)   !important; color: var(--ts-gray-600)  !important; }
.badge-info,
.badge.bg-info          { background: var(--ts-indigo-50)  !important; color: #2b2a7a !important; }
.badge-primary,
.badge.bg-primary       { background: var(--ts-purple-50)  !important; color: var(--ts-purple)    !important; }

/* ── Alerts ──────────────────────────────────────────────── */

.alert {
  border: none;
  border-radius: var(--tp-radius-md);
  font-size: var(--tp-fs-14);
}

.alert-success  { background: var(--tp-success-bg); color: #2e5204; border-left: 3px solid var(--tp-success); }
.alert-warning  { background: var(--tp-warning-bg); color: #6b4900; border-left: 3px solid var(--tp-warning); }
.alert-danger   { background: var(--tp-danger-bg);  color: #7e1200; border-left: 3px solid var(--tp-danger);  }
.alert-info     { background: var(--ts-indigo-50);  color: #252470; border-left: 3px solid var(--ts-indigo);  }
.alert-primary  { background: var(--ts-purple-50);  color: #3e178a; border-left: 3px solid var(--ts-purple);  }
.alert-secondary { background: var(--ts-gray-100); color: var(--ts-gray-700); border-left: 3px solid var(--ts-gray-400); }

/* ── Cards ───────────────────────────────────────────────── */

.card {
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  box-shadow: var(--tp-shadow-sm);
  background: var(--ts-white);
  transition:
    transform var(--tp-dur-base) var(--tp-ease-standard),
    box-shadow var(--tp-dur-base) var(--tp-ease-standard);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--tp-shadow-md);
}

/* Suppress hover lift on static/data cards if not interactive */
.card-static:hover {
  transform: none;
  box-shadow: var(--tp-shadow-sm);
}

.card-header {
  background: var(--ts-gray-50);
  border-bottom: 1px solid var(--tp-border);
  padding: var(--tp-space-3) var(--tp-space-5);
  font-weight: var(--tp-fw-semibold);
  font-size: var(--tp-fs-14);
}

.card-footer {
  background: var(--ts-gray-50);
  border-top: 1px solid var(--tp-border);
  padding: var(--tp-space-3) var(--tp-space-5);
}

/* ── Tables ──────────────────────────────────────────────── */

.table {
  font-size: var(--tp-fs-13);
  color: var(--tp-fg);
  border-color: var(--tp-border);
}

.table thead th {
  font-size: var(--tp-fs-11);
  font-weight: var(--tp-fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tp-fg-muted);
  background: var(--ts-gray-50);
  border-bottom: 1px solid var(--tp-border-strong);
  padding: var(--tp-space-2) var(--tp-space-3);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--tp-space-2) var(--tp-space-3);
  vertical-align: middle;
  border-color: var(--tp-border);
}

.table-hover tbody tr:hover td {
  background: rgba(103, 41, 194, 0.04);
}

/* Clickable table rows */
.table tbody tr[role="button"],
.table tbody tr.clickable {
  cursor: pointer;
}

/* Striped */
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background: rgba(103, 41, 194, 0.025);
}

/* Empty state (see implementation-notes.md) */
.table-empty-row td {
  text-align: center;
  color: var(--tp-fg-muted);
  padding: var(--tp-space-7) var(--tp-space-5);
  font-size: var(--tp-fs-14);
}

/* ── Forms ───────────────────────────────────────────────── */

.form-label {
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-2);
  margin-bottom: 4px;
}

.form-control,
.form-select {
  font-family: var(--tp-font-sans);
  font-size: var(--tp-fs-14);
  border-radius: var(--tp-radius-xs);
  border: 1px solid var(--ts-gray-300);
  color: var(--tp-fg-1);
  background: var(--ts-white);
  transition:
    border-color var(--tp-dur-fast) var(--tp-ease-standard),
    box-shadow var(--tp-dur-fast) var(--tp-ease-standard);
  padding: 8px 12px;
}

.form-control::placeholder { color: var(--ts-gray-400); }

.form-control:focus,
.form-select:focus {
  border-color: var(--tp-border-focus);
  box-shadow: var(--tp-shadow-focus);
  outline: none;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--tp-danger);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(238, 42, 2, 0.2);
}

.invalid-feedback { font-size: var(--tp-fs-12); color: var(--tp-danger); }
.valid-feedback   { font-size: var(--tp-fs-12); color: var(--tp-success); }

.form-text {
  font-size: var(--tp-fs-12);
  color: var(--tp-fg-muted);
}

.form-check-input:checked {
  background-color: var(--tp-accent);
  border-color: var(--tp-accent);
}
.form-check-input:focus {
  box-shadow: var(--tp-shadow-focus);
}

/* ── Tabs (Bootstrap nav-tabs) ───────────────────────────── */

.nav-tabs {
  border-bottom: 1px solid var(--tp-border);
  gap: 0;
}

.nav-tabs .nav-link {
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-3);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  transition:
    color var(--tp-dur-fast) var(--tp-ease-standard),
    border-color var(--tp-dur-fast) var(--tp-ease-standard);
}

.nav-tabs .nav-link:hover {
  color: var(--tp-fg-1);
  border-color: transparent;
  border-bottom-color: var(--ts-gray-300);
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--tp-accent);
  border-bottom-color: var(--tp-accent);
  font-weight: var(--tp-fw-semibold);
  background: transparent;
}

/* ── Nav pills ───────────────────────────────────────────── */

.nav-pills .nav-link {
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-2);
  border-radius: var(--tp-radius-sm);
  padding: 7px 14px;
  transition: background var(--tp-dur-fast), color var(--tp-dur-fast);
}

.nav-pills .nav-link:hover { background: var(--tp-bg-muted); color: var(--tp-fg-1); }
.nav-pills .nav-link.active { background: var(--tp-accent); color: #fff; }

/* ── Dropdown ────────────────────────────────────────────── */

.dropdown-menu {
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  box-shadow: var(--tp-shadow-md);
  padding: 4px;
  font-size: var(--tp-fs-13);
}

.dropdown-item {
  border-radius: var(--tp-radius-xs);
  padding: 7px var(--tp-space-3);
  color: var(--tp-fg-2);
  font-size: var(--tp-fs-13);
  transition: background var(--tp-dur-fast);
}

.dropdown-item:hover { background: var(--ts-gray-50); color: var(--tp-fg-1); }
.dropdown-item:active { background: var(--ts-purple-50); color: var(--ts-purple); }

.dropdown-divider { border-color: var(--tp-border); margin: 4px 0; }
.dropdown-header {
  font-size: var(--tp-fs-11);
  font-weight: var(--tp-fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tp-fg-muted);
  padding: 6px var(--tp-space-3) 4px;
}

/* ── List group ──────────────────────────────────────────── */

.list-group-item {
  font-size: var(--tp-fs-14);
  border-color: var(--tp-border);
  padding: var(--tp-space-3) var(--tp-space-4);
  transition: background var(--tp-dur-fast);
}

.list-group-item-action:hover { background: var(--ts-gray-50); }
.list-group-item-action:active { background: var(--ts-gray-100); }
.list-group-item.active {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
}

/* ── Modal ───────────────────────────────────────────────── */

.modal-content {
  border: none;
  border-radius: var(--tp-radius-lg);
  box-shadow: var(--tp-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--tp-border);
  padding: var(--tp-space-4) var(--tp-space-5);
}

.modal-header .modal-title {
  font-size: var(--tp-fs-16);
  font-weight: var(--tp-fw-semibold);
}

.modal-body { padding: var(--tp-space-5); }
.modal-footer {
  border-top: 1px solid var(--tp-border);
  padding: var(--tp-space-3) var(--tp-space-5);
  gap: var(--tp-space-2);
}

.modal-backdrop { background: rgba(14, 16, 18, 0.5); }

/* ── Breadcrumb ──────────────────────────────────────────── */

.breadcrumb {
  font-size: var(--tp-fs-12);
  margin-bottom: var(--tp-space-4);
  padding: 0;
  background: none;
}

.breadcrumb-item a { color: var(--tp-fg-muted); }
.breadcrumb-item a:hover { color: var(--tp-accent); text-decoration: none; }
.breadcrumb-item.active { color: var(--tp-fg-2); }
.breadcrumb-item + .breadcrumb-item::before {
  color: var(--ts-gray-400);
  content: "/";
}

/* ── Pagination ──────────────────────────────────────────── */

.page-item .page-link {
  color: var(--tp-accent);
  border-color: var(--tp-border);
  font-size: var(--tp-fs-13);
  border-radius: var(--tp-radius-xs) !important;
  transition: background var(--tp-dur-fast), color var(--tp-dur-fast);
}
.page-item .page-link:hover { background: var(--ts-purple-50); border-color: var(--tp-border); }
.page-item.active .page-link {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
  color: #fff;
}
.page-item.disabled .page-link { color: var(--tp-fg-muted); }

/* ── Accordion ───────────────────────────────────────────── */

.accordion-button {
  font-size: var(--tp-fs-14);
  font-weight: var(--tp-fw-medium);
  color: var(--tp-fg-1);
  background: var(--ts-white);
}
.accordion-button:not(.collapsed) {
  color: var(--tp-accent);
  background: var(--ts-purple-50);
  box-shadow: none;
}
.accordion-button::after {
  filter: none;
}
.accordion-button:focus {
  box-shadow: var(--tp-shadow-focus);
  border-color: var(--tp-border-focus);
}
.accordion-item {
  border-color: var(--tp-border);
}

/* ── Progress ────────────────────────────────────────────── */

.progress {
  height: 6px;
  border-radius: var(--tp-radius-pill);
  background: var(--ts-gray-100);
}

.progress-bar {
  background: var(--ts-gradient-cool);
  border-radius: var(--tp-radius-pill);
}

.progress-bar-success { background: var(--tp-success); }
.progress-bar-warning { background: var(--tp-warning); }
.progress-bar-danger  { background: var(--tp-danger);  }

/* ── Spinners ────────────────────────────────────────────── */

.spinner-border { color: var(--tp-accent); }
.spinner-grow   { color: var(--tp-accent); }

/* ── Toasts ──────────────────────────────────────────────── */

.toast {
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  box-shadow: var(--tp-shadow-md);
  font-size: var(--tp-fs-13);
}
.toast-header {
  font-weight: var(--tp-fw-semibold);
  border-bottom-color: var(--tp-border);
}

/* ── Popover / Tooltip ───────────────────────────────────── */

.popover {
  border-radius: var(--tp-radius-md);
  border-color: var(--tp-border);
  box-shadow: var(--tp-shadow-md);
  font-size: var(--tp-fs-13);
}
.tooltip-inner {
  background: var(--ts-gray-900);
  font-size: var(--tp-fs-12);
  border-radius: var(--tp-radius-xs);
}

/* ── Input groups ────────────────────────────────────────── */

.input-group-text {
  background: var(--ts-gray-50);
  border-color: var(--ts-gray-300);
  font-size: var(--tp-fs-13);
  color: var(--tp-fg-3);
}

/* ============================================================
   BLAZOR ERROR UI
   ============================================================ */

#blazor-error-ui {
  position: fixed;
  bottom: var(--tp-space-4);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tp-danger-bg);
  border: 1px solid var(--tp-danger);
  border-radius: var(--tp-radius-md);
  color: #7e1200;
  padding: var(--tp-space-3) var(--tp-space-5);
  font-size: var(--tp-fs-13);
  box-shadow: var(--tp-shadow-md);
  z-index: 9999;
  display: none; /* shown by Blazor via JS when needed */
  gap: var(--tp-space-3);
  align-items: center;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
  color: var(--tp-danger);
  font-weight: var(--tp-fw-semibold);
  text-decoration: underline;
  cursor: pointer;
}

/* ============================================================
   COMPLIANCE DASHBOARD — progressive disclosure cards
   (Card-per-level with breadcrumb trail pattern)
   See implementation-notes.md for full state machine.
   ============================================================ */

/* Compliance level cards */
.compliance-level-card {
  background: var(--ts-white);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  box-shadow: var(--tp-shadow-sm);
  padding: var(--tp-space-4) var(--tp-space-5);
  cursor: pointer;
  transition:
    transform var(--tp-dur-base) var(--tp-ease-standard),
    box-shadow var(--tp-dur-base) var(--tp-ease-standard),
    border-color var(--tp-dur-base) var(--tp-ease-standard);
  position: relative;
}
.compliance-level-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--tp-shadow-md);
  border-color: var(--tp-border-strong);
}
.compliance-level-card.selected {
  border-color: var(--tp-accent);
  box-shadow: 0 0 0 2px rgba(103,41,194,0.15), var(--tp-shadow-sm);
}

/* Score ring / pill inside compliance cards */
.compliance-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--tp-fs-13);
  font-weight: var(--tp-fw-semibold);
  padding: 3px 10px;
  border-radius: var(--tp-radius-pill);
}
.compliance-score-green  { background: var(--ts-green-50);  color: #2e5204; }
.compliance-score-amber  { background: var(--ts-amber-50);  color: #6b4900; }
.compliance-score-red    { background: var(--ts-red-50);    color: #7e1200; }
.compliance-score-grey   { background: var(--ts-gray-100);  color: var(--ts-gray-600); }

/* ============================================================
   UTILITY HELPERS
   ============================================================ */

/* Spectrum divider line — use as <hr class="ts-spectrum-bar"> */
.ts-spectrum-bar {
  height: 3px;
  border: none;
  background: var(--ts-gradient-spectrum);
  border-radius: var(--tp-radius-pill);
  margin: 0;
  opacity: 0.8;
}

/* Eyebrow label */
.ts-eyebrow {
  font-size: var(--tp-fs-11);
  font-weight: var(--tp-fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tp-tracking-display);
  color: var(--tp-accent);
}

/* Empty state container */
.ts-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--tp-space-3);
  padding: var(--tp-space-7) var(--tp-space-5);
  color: var(--tp-fg-muted);
  text-align: center;
}
.ts-empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--tp-radius-md);
  background: var(--tp-bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ts-gray-400);
}
.ts-empty-state-title {
  font-size: var(--tp-fs-14);
  font-weight: var(--tp-fw-semibold);
  color: var(--tp-fg-2);
  margin: 0;
}
.ts-empty-state-body {
  font-size: var(--tp-fs-13);
  color: var(--tp-fg-muted);
  max-width: 320px;
  margin: 0;
  text-wrap: pretty;
}

/* Loading shimmer */
.ts-skeleton {
  background: linear-gradient(90deg, var(--ts-gray-100) 0%, var(--ts-gray-50) 50%, var(--ts-gray-100) 100%);
  background-size: 200% 100%;
  animation: ts-shimmer 1.4s ease infinite;
  border-radius: var(--tp-radius-xs);
}
@keyframes ts-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 768px)
   ============================================================ */

@media (max-width: 767.98px) {
  :root {
    --tp-sidebar-width: 0px;
    --tp-topbar-height: 56px;
  }

  .app-topbar-inner { padding: 0 var(--tp-space-4); gap: var(--tp-space-3); }

  /* Stack tabs below brand on mobile using a second bar;
     the engineer must wrap .app-tabs in a separate scrollable strip.
     See implementation-notes.md — Mobile nav section. */
  .app-tabs {
    position: fixed;
    top: var(--tp-topbar-height);
    left: 0;
    right: 0;
    background: var(--ts-white);
    border-bottom: 1px solid var(--tp-border);
    height: 44px;
    z-index: 999;
    padding: 0 var(--tp-space-2);
  }

  .app-body {
    padding-top: calc(var(--tp-topbar-height) + 44px);
  }

  .app-content {
    margin-left: 0;
  }

  .app-content .content {
    padding: var(--tp-space-4);
  }

  /* Sidebar becomes a drawer; use a .sidebar-open class on .app-shell
     to slide it in. See implementation-notes.md. */
  .app-sidenav {
    transform: translateX(-100%);
    transition: transform var(--tp-dur-slow) var(--tp-ease-standard);
    z-index: 1100;
    width: 260px;
    box-shadow: var(--tp-shadow-lg);
  }
  .app-shell.sidebar-open .app-sidenav {
    transform: translateX(0);
  }

  /* Overlay behind open sidebar */
  .app-shell.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(14,16,18,0.35);
    z-index: 1050;
  }

  /* Collapse tables to key columns only */
  .table-responsive-hide { display: none; }

  /* Page header stacks on small screens */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   RESPONSIVE — TABLET (769px – 1024px)
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023.98px) {
  :root {
    --tp-sidebar-width: 200px;
  }

  .app-tabs .app-tab { padding: 0 var(--tp-space-3); font-size: var(--tp-fs-12); }
}
