/* ==========================================================================
   PURE CSS LARAVEL BREEZE & MATERIAL 3 DESIGN SYSTEM (app.css)
   Universal CSS-Only Stylesheet for index.html and all 15 code.html prototypes.
   Zero Tailwind CSS, Zero JavaScript required. Pure CSS Utility & UI Architecture.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Public+Sans:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
  /* Core Design Tokens - Breeze & Material 3 Light Theme */
  --bg-main: #fcf8ff;
  --bg-surface-low: #f5f2ff;
  --bg-surface: #ffffff;
  --bg-surface-high: #eae6f4;
  --bg-surface-highest: #e4e1ee;
  
  /* Text & Content Tokens */
  --text-main: #1b1b24;
  --text-muted: #464555;
  --text-dim: #777587;
  --text-inverse: #ffffff;
  --outline: #777587;
  --outline-variant: #c7c4d8;

  /* Brand Accents */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e2dfff;
  --primary-container: #4f46e5;
  --on-primary: #ffffff;
  --on-primary-container: #dad7ff;
  --secondary: #58579b;
  --on-secondary: #ffffff;
  --secondary-container: #b6b4ff;
  --tertiary: #a44100;
  --on-tertiary: #ffffff;
  --tertiary-container: #ffd2be;
  --error: #ba1a1a;
  --on-error: #ffffff;
  --error-container: #ffdad6;
  --on-error-container: #93000a;

  /* Category Filter Colors */
  --auth-color: #e11d48;
  --auth-bg: #ffe4e6;
  --auth-border: #fecdd3;
  --comp-color: #4f46e5;
  --comp-bg: #e0e7ff;
  --comp-border: #c7d2fe;
  --layout-color: #059669;
  --layout-bg: #d1fae5;
  --layout-border: #a7f3d0;
  --system-color: #d97706;
  --system-bg: #fef3c7;
  --system-border: #fde68a;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(27, 27, 36, 0.06), 0 2px 4px -2px rgba(27, 27, 36, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(27, 27, 36, 0.08), 0 4px 6px -2px rgba(27, 27, 36, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(27, 27, 36, 0.1), 0 10px 10px -5px rgba(27, 27, 36, 0.04);
  --shadow-hover: 0 20px 25px -5px rgba(79, 70, 229, 0.12), 0 8px 10px -6px rgba(79, 70, 229, 0.08);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-label: 'Public Sans', system-ui, -apple-system, sans-serif;
  
  /* Sizing & Transitions */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   CSS Reset & Base Rules
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background-color: var(--primary);
  color: #ffffff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-fast);
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button, label[for^="filter-"] {
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   PURE CSS RADIO FILTERING LOGIC (Zero JavaScript)
   ========================================================================== */
.filter-radio {
  display: none !important;
}

/* Active filter button styles based on checked radio */
#filter-all:checked ~ * .filter-container label[for="filter-all"],
#filter-auth:checked ~ * .filter-container label[for="filter-auth"],
#filter-comp:checked ~ * .filter-container label[for="filter-comp"],
#filter-layout:checked ~ * .filter-container label[for="filter-layout"],
#filter-system:checked ~ * .filter-container label[for="filter-system"] {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

#filter-auth:checked ~ * .filter-container label[for="filter-auth"] {
  background: var(--auth-color);
  border-color: var(--auth-color);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

/* Active count pill styles */
#filter-all:checked ~ * .filter-container label[for="filter-all"] .count-pill,
#filter-auth:checked ~ * .filter-container label[for="filter-auth"] .count-pill,
#filter-comp:checked ~ * .filter-container label[for="filter-comp"] .count-pill,
#filter-layout:checked ~ * .filter-container label[for="filter-layout"] .count-pill,
#filter-system:checked ~ * .filter-container label[for="filter-system"] .count-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Hide non-matching component cards in pure CSS when filter is checked */
#filter-auth:checked ~ * .components-grid .component-card:not([data-group="Authentication"]),
#filter-comp:checked ~ * .components-grid .component-card:not([data-group="Components"]),
#filter-layout:checked ~ * .components-grid .component-card:not([data-group="Layouts"]),
#filter-system:checked ~ * .components-grid .component-card:not([data-group="Design Systems"]) {
  display: none !important;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-surface-highest);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.5rem;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.125rem;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.brand-text h1 span {
  color: var(--primary);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 1rem;
  color: var(--text-main);
  letter-spacing: -0.04em;
}

.hero-title span {
  color: var(--primary);
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem;
  }
  .hero-subtitle {
    font-size: 0.95rem;
  }
}

.module-selector-section {
  background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.16), transparent 32%),
              radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.18), transparent 28%),
              linear-gradient(180deg, #050b1d 0%, #0c1229 42%, #0f172a 100%);
}

.subsystem-dashboard-section {
  background: #090f22;
}

.module-section-header,
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  padding-bottom: 1.5rem;
}

.module-section-header .eyebrow,
.dashboard-header .eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #c4b5fd;
  margin-bottom: 0.5rem;
}

.section-title,
.dashboard-title {
  font-size: clamp(2rem, 2.6vw, 2.75rem);
  color: #f8fafc;
  margin-bottom: 0.75rem;
}

.section-copy,
.dashboard-description {
  color: #cbd5e1;
  max-width: 760px;
  line-height: 1.75;
}

.search-box {
  position: relative;
  width: min(100%, 320px);
}

.search-box .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #8f9fcb;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 3rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.search-input::placeholder {
  color: #8f9fcb;
}

.module-selector-grid,
.dashboard-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.module-selection-panel,
.module-card,
.dashboard-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-2xl);
}

.module-selection-panel {
  padding: 2rem;
  box-shadow: 0 28px 80px -45px rgba(15, 23, 42, 0.7);
  overflow: hidden;
}

.module-folder-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.folder-card-top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.folder-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  min-height: 3.5rem;
  border-radius: 1rem;
  background: rgba(99, 102, 241, 0.2);
  color: #ede9fe;
  font-size: 1rem;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.folder-title {
  font-size: 1.6rem;
  color: #f8fafc;
  margin: 0 0 0.5rem;
}

.folder-copy {
  margin: 0;
  color: rgba(226, 232, 255, 0.82);
  max-width: 740px;
  line-height: 1.75;
}

.folder-content {
  display: grid;
  gap: 1rem;
}

.folder-card-row {
  display: grid;
  grid-template-columns: repeat( auto-fit, minmax(220px, 1fr) );
  gap: 1rem;
}

.folder-card-item {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-xl);
  padding: 1.2rem;
}

.folder-card-item h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  color: #f8fafc;
}

.folder-card-item p {
  margin: 0;
  color: rgba(226, 232, 255, 0.78);
  line-height: 1.6;
}

.module-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-height: 420px;
  box-shadow: 0 28px 60px -40px rgba(15, 23, 42, 0.8);
  transition: transform var(--transition-smooth), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.module-card:hover {
  transform: translateY(-8px);
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 32px 70px -44px rgba(168, 85, 247, 0.5);
}

.module-card-preview {
  position: relative;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(79, 70, 229, 0.95));
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.75rem;
  min-height: 160px;
}

.module-card-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 30%),
              radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.08), transparent 22%);
}

.module-card-preview-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 1;
}

.module-card-preview-hero {
  position: relative;
  z-index: 1;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.35;
}

.module-card-body {
  padding: 1.75rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.module-card h3 {
  color: #f8fafc;
  font-size: 1.15rem;
  margin: 0;
}

.dashboard-card h3 {
  color: #0f172a;
  font-size: 1.15rem;
  margin: 0;
}

.module-card p,
.module-list li {
  color: rgba(226, 232, 255, 0.88);
}

.dashboard-card p {
  color: #475569;
}

.module-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.module-list li {
  position: relative;
  padding-left: 1.35rem;
  line-height: 1.65;
}

.module-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.8rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c084fc;
}

.btn-open,
.btn-secondary {
  width: fit-content;
  border-radius: var(--radius-lg);
  padding: 0.8rem 1.35rem;
  font-weight: 700;
}

.btn-open {
  margin-top: auto;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  box-shadow: 0 16px 32px -16px rgba(124, 58, 237, 0.5);
}

.btn-open:hover {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 1.5rem;
  padding: 0.9rem 1.35rem;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.btn-secondary:hover {
  background: #f8fbff;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 1.5rem;
  padding: 0.95rem 1.45rem;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 20px 36px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
}

.dashboard-card {
  min-height: 120px;
  padding: 1.75rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-2xl);
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.05);
}

.dashboard-card-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6366f1;
  margin-bottom: 0.55rem;
}

.dashboard-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border-radius: 999px;
  padding: 0.65rem 1.35rem;
  margin: 0;
}

.dashboard-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dashboard-chart-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #ffffff;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
}

.dashboard-line-chart {
  min-height: 220px;
  width: 100%;
}

.dashboard-line-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.donut-chart-wrapper {
  position: relative;
  width: min(100%, 260px);
  margin: 0 auto;
}

.donut-chart {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  position: relative;
}

.donut-center-text {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: inline-grid;
  gap: 0.35rem;
}

.donut-center-text p:first-child {
  color: #64748b;
  font-size: 0.75rem;
  margin: 0;
}

.donut-center-text p:last-child {
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.donut-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1.5rem;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.donut-list-color {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.5rem;
}

.quick-action-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 1.5rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.quick-action-button:hover {
  background: #f8fbff;
  transform: translateY(-1px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill-success {
  background: #ecfdf5;
  color: #166534;
}

.status-pill-info {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-pill-warning {
  background: #ffedd5;
  color: #c2410c;
}

.status-pill-accent {
  background: #ede9fe;
  color: #5b21b6;
}

.status-pill-neutral {
  background: #f8fafc;
  color: #475569;
}

#dashboard-activity-tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
}

#dashboard-activity-tbody tr {
  background: #ffffff;
}

#dashboard-activity-tbody tr:hover {
  background: #f8fbff;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .module-selector-grid,
  .dashboard-module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .module-card {
    min-height: auto;
  }

  .module-card-preview {
    min-height: 125px;
  }
}

@media (max-width: 640px) {
  .module-section-header,
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }
}

/* ==========================================================================
   Filter Bar & Tabs
   ========================================================================== */
.filter-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  padding: 0.6rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.filter-btn:hover {
  background: var(--bg-surface-low);
  color: var(--text-main);
  border-color: var(--primary);
}

.filter-btn .count-pill {
  padding: 0.1rem 0.5rem;
  background: var(--bg-surface-high);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Standalone Module Selector Page
   ========================================================================== */
.module-selector-page {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  background: linear-gradient(180deg, #eef6ff 0%, #f8fbff 48%, #f6f7fb 100%);
}

.module-selector-shell {
  width: min(95vw, 1800px);
  max-width: 95vw;
  margin: 0 auto;
  padding: 3rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 2rem;
  box-shadow: 0 36px 110px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.module-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  gap: 1.75rem;
  align-items: stretch;
}

@media (max-width: 1400px) {
  .module-selector-grid {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }
}

@media (max-width: 1120px) {
  .module-selector-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }
}

@media (max-width: 860px) {
  .module-selector-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 680px) {
  .module-selector-grid {
    grid-template-columns: 1fr;
  }
}

.module-selector-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.25rem;
}

.module-selector-title {
  font-size: clamp(2.25rem, 3vw, 3.4rem);
  color: #0f172a;
  margin: 0 0 0.85rem;
  letter-spacing: -0.03em;
}

.module-selector-copy {
  color: #475569;
  max-width: 720px;
  font-size: 1rem;
  line-height: 1.85;
}

.module-selector-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.module-selector-actions .btn-view {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #ffffff;
  box-shadow: 0 18px 36px rgba(59, 130, 246, 0.22);
}

.module-selector-actions .btn-view:hover {
  background: linear-gradient(135deg, #4338ca, #1d4ed8);
}

.subsystem-card {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 2rem;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.06);
  transition: transform var(--transition-smooth), border-color var(--transition-fast), box-shadow var(--transition-fast);
  overflow: hidden;
}

.subsystem-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4.5rem;
  height: 4px;
  background: linear-gradient(90deg, #4f46e5, #2563eb);
}

.subsystem-card:hover {
  transform: translateY(-8px);
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 34px 65px rgba(59, 130, 246, 0.12);
}

.subsystem-card-head .eyebrow {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #2563eb;
  font-weight: 700;
}

.subsystem-card-head h3 {
  margin: 0.85rem 0 0.85rem;
  font-size: 1.2rem;
  color: #0f172a;
  line-height: 1.3;
}

.subsystem-card-head p {
  margin: 0;
  color: #64748b;
  line-height: 1.75;
}

.subsystem-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.subsystem-card-meta .btn-view {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 0.75rem;
}

.subsystem-card-count {
  color: #475569;
  font-weight: 700;
  font-size: 0.85rem;
}

.subsystem-module-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0 1.5rem;
  flex-grow: 1;
}

.module-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  border: 1px solid #e2e8f0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.module-chip:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.module-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.5rem;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  flex-shrink: 0;
  font-size: 16px;
  margin-top: -0.05rem;
}

.module-chip-text {
  flex-grow: 1;
  word-break: break-word;
}

.subsystem-detail {
  margin-top: 2rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.subsystem-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.subsystem-detail-title {
  font-size: clamp(1.75rem, 2.2vw, 2.25rem);
  color: var(--text-main);
  margin: 0.25rem 0 0;
}

.subsystem-detail-copy {
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.75;
}

.subsystem-detail-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.subsystem-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.subsystem-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 700;
}

.subsystem-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.module-card-light {
  background: var(--bg-surface-container-low);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1.25rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
}

.module-card-light h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}

.module-selector-shell .eyebrow {
  margin-bottom: 0.85rem;
}

.module-selector-shell .btn-view {
  min-width: 10rem;
}

@media (max-width: 900px) {
  .module-selector-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .module-selector-grid,
  .subsystem-modules-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Components Grid & Breeze UI Cards
   ========================================================================== */
.components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
  min-height: 400px;
}

@media (max-width: 640px) {
  .components-grid {
    grid-template-columns: 1fr;
  }
}

.component-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-highest);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-smooth);
  box-shadow: var(--shadow-md);
}

.component-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.component-card[data-group="Authentication"]:hover {
  border-color: var(--auth-color);
  box-shadow: 0 20px 25px -5px rgba(225, 29, 72, 0.1), 0 8px 10px -6px rgba(225, 29, 72, 0.08);
}

.card-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--bg-surface-low);
  overflow: hidden;
  border-bottom: 1px solid var(--bg-surface-highest);
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.component-card:hover .card-thumb {
  transform: scale(1.05);
}

.fallback-banner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f2ff 0%, #eae6f4 100%);
  color: var(--primary);
  padding: 1.5rem;
  text-align: center;
}

.fallback-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

.fallback-text {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.fallback-subtext {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.card-badge-container {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--outline-variant);
}

.badge-authentication {
  background: var(--auth-bg);
  color: var(--auth-color);
  border-color: var(--auth-border);
}
.badge-components {
  background: var(--comp-bg);
  color: var(--comp-color);
  border-color: var(--comp-border);
}
.badge-layouts {
  background: var(--layout-bg);
  color: var(--layout-color);
  border-color: var(--layout-border);
}
.badge-design-systems {
  background: var(--system-bg);
  color: var(--system-color);
  border-color: var(--system-border);
}

/* Status Badges - Semantic Colors & Breathing Room */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-badge-operational {
  background-color: var(--layout-bg);
  color: var(--layout-color);
  border: 1px solid var(--layout-border);
}
.status-badge-maintenance {
  background-color: var(--system-bg);
  color: var(--system-color);
  border: 1px solid var(--system-border);
}
.status-badge-archived {
  background-color: var(--bg-surface-highest);
  color: var(--text-muted);
  border: 1px solid transparent;
}

.card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  transition: color var(--transition-fast);
}

.component-card:hover .card-title {
  color: var(--primary);
}
.component-card[data-group="Authentication"]:hover .card-title {
  color: var(--auth-color);
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}

.card-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--bg-surface-highest);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-path-info {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-view {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-view:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
  color: #ffffff;
}

.component-card[data-group="Authentication"] .btn-view {
  background: var(--auth-color);
  box-shadow: 0 2px 4px rgba(225, 29, 72, 0.2);
}

.component-card[data-group="Authentication"] .btn-view:hover {
  background: #be123c;
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35);
}

.btn-icon {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}
.btn-view:hover .btn-icon {
  transform: translateX(3px);
}

.sidebar-subsystem-card {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 1.75rem;
  padding: 1.25rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.04);
}

.sidebar-subsystem-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.sidebar-subsystem-card-header p {
  margin: 0;
}

.sidebar-subsystem-card-header .text-sm {
  color: var(--text-muted);
}

.sidebar-subsystem-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
}

.sidebar-subsystem-modules {
  display: grid;
  gap: 0.75rem;
}

.sidebar-subsystem-module {
  background: #f8f9ff;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1.75rem;
  padding: 1rem 1rem;
  color: #0f172a;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sidebar-subsystem-module:nth-child(odd) {
  background: #ffffff;
}

.dashboard-sidebar {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.15);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 4rem);
}

.sidebar-brand-section {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.sidebar-brand-card {
  background: #f8fbff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1.5rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.sidebar-brand-card .sidebar-brand-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #020617;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-card .sidebar-brand-subtitle {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-icon {
  background: rgba(59, 130, 246, 0.14);
}

.sidebar-subsystem-nav-panel {
  margin-top: 1.75rem;
}

.dashboard-sidebar > .flex-1 {
  min-height: 0;
}

.sidebar-subsystem-modules {
  display: grid;
  gap: 0.75rem;
}

.sidebar-subsystem-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 1.25rem;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-subsystem-link:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: transparent;
  transform: translateX(2px);
}

.sidebar-subsystem-link-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-width: 2.25rem;
  max-width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.15rem;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-subsystem-link:hover .sidebar-subsystem-link-icon {
  background: #e2e8f0;
  color: #0f172a;
}

.sidebar-subsystem-link.active {
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-subsystem-link.active .sidebar-subsystem-link-icon {
  background: rgba(59, 130, 246, 0.16);
  color: #2563eb;
}

/* Sidebar Module Group with Submenu */
.sidebar-module-group {
  margin-bottom: 0.25rem;
}

.sidebar-module-toggle {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 1.75rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: transparent;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.sidebar-module-toggle:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: transparent;
  transform: translateX(2px);
}

.sidebar-module-toggle.active {
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-module-toggle.active .sidebar-subsystem-link-icon {
  background: rgba(59, 130, 246, 0.16);
  color: #2563eb;
}

.sidebar-chevron {
  transition: transform var(--transition-fast);
  margin-left: auto;
}

.sidebar-module-group.open .sidebar-chevron {
  transform: rotate(180deg);
}

/* Sidebar Submenu */
.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding-left: 2.5rem;
}

.sidebar-module-group.open .sidebar-submenu {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

.sidebar-submenu-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-submenu-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.sidebar-submenu-link.active {
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar-submenu-icon {
  font-size: 1rem;
  color: #94a3b8;
  transition: color var(--transition-fast);
}

.sidebar-submenu-link:hover .sidebar-submenu-icon,
.sidebar-submenu-link.active .sidebar-submenu-icon {
  color: #2563eb;
}

/* Collapsed Sidebar Flyout */
.sidebar-flyout-menu {
  position: fixed;
  left: 5rem;
  top: 0;
  z-index: 1000;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  padding: 0.75rem;
  min-width: 200px;
  max-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
}

.sidebar-flyout-menu.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.sidebar-flyout-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #0f172a;
}

.sidebar-flyout-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

.sidebar-flyout-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.sidebar-flyout-item.active {
  background: #eef2ff;
  color: #1d4ed8;
  font-weight: 600;
}

/* Collapsed sidebar state - hide non-icon elements but keep icons visible */
.sidebar.w-20 .sidebar-module-toggle > span:not(.material-symbols-outlined),
.sidebar.w-20 .sidebar-chevron,
.sidebar.w-20 .sidebar-submenu,
.sidebar.w-20 .sidebar-brand-title,
.sidebar.w-20 .sidebar-brand-subtitle,
.sidebar.w-20 .sidebar-main-link span:not(.material-symbols-outlined),
.dashboard-sidebar.w-20 .sidebar-module-toggle > span:not(.material-symbols-outlined),
.dashboard-sidebar.w-20 .sidebar-chevron,
.dashboard-sidebar.w-20 .sidebar-submenu,
.dashboard-sidebar.w-20 .sidebar-brand-title,
.dashboard-sidebar.w-20 .sidebar-brand-subtitle,
.dashboard-sidebar.w-20 .sidebar-main-link span:not(.material-symbols-outlined) {
  display: none !important;
}

.sidebar.w-20 .sidebar-module-toggle,
.dashboard-sidebar.w-20 .sidebar-module-toggle {
  justify-content: center;
  padding: 0.85rem;
}

.sidebar.w-20 .sidebar-module-toggle .material-symbols-outlined,
.sidebar.w-20 .sidebar-subsystem-link .material-symbols-outlined,
.sidebar.w-20 .sidebar-main-link .material-symbols-outlined,
.sidebar.w-20 .material-symbols-outlined,
.dashboard-sidebar.w-20 .sidebar-module-toggle .material-symbols-outlined,
.dashboard-sidebar.w-20 .sidebar-subsystem-link .material-symbols-outlined,
.dashboard-sidebar.w-20 .sidebar-main-link .material-symbols-outlined,
.dashboard-sidebar.w-20 .material-symbols-outlined {
  display: inline-flex !important;
  font-size: 1.25rem;
}

.sidebar.w-20 .sidebar-module-group,
.dashboard-sidebar.w-20 .sidebar-module-group {
  position: relative;
}

.sidebar.w-20 .sidebar-module-group:hover .sidebar-flyout-menu,
.dashboard-sidebar.w-20 .sidebar-module-group:hover .sidebar-flyout-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Sidebar resize handle */
#sidebar-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.2s;
  z-index: 50;
}

#sidebar-resize-handle:hover {
  background: rgba(59, 130, 246, 0.3);
}

#sidebar-resize-handle:active {
  background: rgba(59, 130, 246, 0.5);
}

.sidebar-main-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 1.75rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 12px 18px rgba(15, 23, 42, 0.06);
  text-decoration: none;
}

.sidebar-main-link:hover,
.sidebar-main-link.active {
  background: #dde9ff;
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
}

.sidebar-main-link:hover,
.sidebar-main-link.active {
  background: #eef2ff;
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
}

.sidebar-main-link-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 1rem;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  font-size: 1.1rem;
}

.sidebar-profile-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  box-shadow: none;
}

.sidebar-profile-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.5rem 0.75rem 0.65rem;
  background: #ffffff;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f8fafc;
  color: #334155;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  background: #eef2ff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.35);
}

.sidebar-toggle-btn .material-symbols-outlined {
  font-size: 1.35rem;
  line-height: 1;
}

.sidebar-backdrop {
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--bg-surface-highest);
  background: #ffffff;
  text-align: center;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   UNIVERSAL CSS UTILITIES FOR ALL CODE.HTML TEMPLATES (No Tailwind Needed)
   ========================================================================== */

/* Layout & Flex/Grid */
/* Layout & Flex/Grid */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }
.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-grow, .flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0, .shrink-0 { flex-shrink: 0 !important; }
.flex-shrink, .shrink { flex-shrink: 1 !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-start { justify-content: flex-start !important; }
.justify-end { justify-content: flex-end !important; }
.self-center { align-self: center !important; }

/* Grid columns */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }

/* Sizing & Slices */
.w-full { width: 100% !important; }
.h-full { height: 100% !important; }
.h-screen { height: 100vh !important; }
.min-h-screen { min-height: 100vh !important; }
.max-w-xs { max-width: 20rem !important; }
.max-w-sm { max-width: 24rem !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-lg { max-width: 32rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-2xl { max-width: 42rem !important; }
.max-w-4xl { max-width: 56rem !important; }
.max-w-7xl { max-width: 80rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.w-2 { width: 0.5rem !important; } .h-2 { height: 0.5rem !important; }
.w-3 { width: 0.75rem !important; } .h-3 { height: 0.75rem !important; }
.w-4 { width: 1rem !important; } .h-4 { height: 1rem !important; }
.w-5 { width: 1.25rem !important; } .h-5 { height: 1.25rem !important; }
.w-6 { width: 1.5rem !important; } .h-6 { height: 1.5rem !important; }
.w-7 { width: 1.75rem !important; } .h-7 { height: 1.75rem !important; }
.w-8 { width: 2rem !important; } .h-8 { height: 2rem !important; }
.w-9 { width: 2.25rem !important; } .h-9 { height: 2.25rem !important; }
.w-10 { width: 2.5rem !important; } .h-10 { height: 2.5rem !important; }
.w-11 { width: 2.75rem !important; } .h-11 { height: 2.75rem !important; }
.w-12 { width: 3rem !important; } .h-12 { height: 3rem !important; }
.w-14 { width: 3.5rem !important; } .h-14 { height: 3.5rem !important; }
.w-16 { width: 4rem !important; } .h-16 { height: 4rem !important; }
.w-20 { width: 5rem !important; } .h-20 { height: 5rem !important; }
.w-24 { width: 6rem !important; } .h-24 { height: 6rem !important; }
.w-48 { width: 12rem !important; }
.w-64 { width: 16rem !important; }
.w-72 { width: 18rem !important; }
.w-80 { width: 20rem !important; }

/* Positioning */
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.fixed { position: fixed !important; }
.sticky { position: sticky !important; }
.top-0 { top: 0px !important; }
.top-16 { top: 4rem !important; }
.h-\[calc\(100vh-4rem\)\] { height: calc(100vh - 4rem) !important; }
.top-1 { top: 0.25rem !important; }
.top-1\.5 { top: 0.375rem !important; }
.top-1\/2 { top: 50% !important; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0px !important; }
.left-3 { left: 0.75rem !important; }
.left-4 { left: 1rem !important; }
.left-5 { left: 1.25rem !important; }
.left-6 { left: 1.5rem !important; }
.right-0 { right: 0px !important; }
.right-1\.5 { right: 0.375rem !important; }
.right-2 { right: 0.5rem !important; }
.right-3 { right: 0.75rem !important; }
.right-4 { right: 1rem !important; }
.right-5 { right: 1.25rem !important; }
.right-6 { right: 1.5rem !important; }
.top-2 { top: 0.5rem !important; }
.top-3 { top: 0.75rem !important; }
.top-4 { top: 1rem !important; }
.top-5 { top: 1.25rem !important; }
.top-6 { top: 1.5rem !important; }
.bottom-0 { bottom: 0px !important; }
.bottom-4 { bottom: 1rem !important; }
.bottom-6 { bottom: 1.5rem !important; }
.-translate-y-1\/2 { transform: translateY(-50%) !important; }
.w-0 { width: 0px !important; }
.border-r-0 { border-right-width: 0px !important; }
.opacity-0 { opacity: 0 !important; }
.opacity-100 { opacity: 1 !important; }
.translate-x-0 { transform: translateX(0) !important; }
.-translate-x-full { transform: translateX(-100%) !important; }
.duration-200 { transition-duration: 200ms !important; }
.duration-300 { transition-duration: 300ms !important; }
.top-12 { top: 3rem !important; }
.top-14 { top: 3.5rem !important; }
.w-56 { width: 14rem !important; }
.w-60 { width: 15rem !important; }
.scale-95 { transform: scale(0.95) !important; }
.scale-100 { transform: scale(1) !important; }
.origin-top-right { transform-origin: top right !important; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important; }
.pointer-events-auto { pointer-events: auto !important; }
.min-w-\[2\.5rem\] { min-width: 2.5rem !important; }
.min-h-\[2\.5rem\] { min-height: 2.5rem !important; }
.z-10 { z-index: 10 !important; } .z-20 { z-index: 20 !important; } .z-30 { z-index: 30 !important; } .z-40 { z-index: 40 !important; } .z-50 { z-index: 50 !important; }

/* Paddings & Margins */
.p-0 { padding: 0px !important; } .p-1 { padding: 0.25rem !important; } .p-2 { padding: 0.5rem !important; } .p-3 { padding: 0.75rem !important; } .p-4 { padding: 1rem !important; } .p-6 { padding: 1.5rem !important; } .p-8 { padding: 2rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.pt-4 { padding-top: 1rem !important; } .pt-6 { padding-top: 1.5rem !important; } .pt-8 { padding-top: 2rem !important; } .pt-16 { padding-top: 4rem !important; } .pt-24 { padding-top: 6rem !important; }
.pb-4 { padding-bottom: 1rem !important; } .pb-5 { padding-bottom: 1.25rem !important; } .pb-8 { padding-bottom: 2rem !important; } .pb-16 { padding-bottom: 4rem !important; }
.pl-3 { padding-left: 0.75rem !important; } .pl-7 { padding-left: 1.75rem !important; } .pl-8 { padding-left: 2rem !important; } .pl-9 { padding-left: 2.25rem !important; } .pl-10 { padding-left: 2.5rem !important; } .pl-11 { padding-left: 2.75rem !important; } .pl-12 { padding-left: 3rem !important; }
.pr-3 { padding-right: 0.75rem !important; } .pr-7 { padding-right: 1.75rem !important; } .pr-8 { padding-right: 2rem !important; } .pr-9 { padding-right: 2.25rem !important; } .pr-10 { padding-right: 2.5rem !important; } .pr-11 { padding-right: 2.75rem !important; } .pr-12 { padding-right: 3rem !important; }
.m-0 { margin: 0px !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; } .my-4 { margin-top: 1rem !important; margin-bottom: 1rem !important; } .my-6 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; } .mb-1\.5 { margin-bottom: 0.375rem !important; } .mb-2 { margin-bottom: 0.5rem !important; } .mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; } .mb-6 { margin-bottom: 1.5rem !important; } .mb-8 { margin-bottom: 2rem !important; }
.mt-1 { margin-top: 0.25rem !important; } .mt-1\.5 { margin-top: 0.375rem !important; } .mt-2 { margin-top: 0.5rem !important; } .mt-4 { margin-top: 1rem !important; } .mt-6 { margin-top: 1.5rem !important; } .mt-8 { margin-top: 2rem !important; }
.ml-2 { margin-left: 0.5rem !important; } .mr-2 { margin-right: 0.5rem !important; }

/* Gaps & Spacing */
.gap-1 { gap: 0.25rem !important; } .gap-2 { gap: 0.5rem !important; } .gap-3 { gap: 0.75rem !important; } .gap-4 { gap: 1rem !important; } .gap-6 { gap: 1.5rem !important; } .gap-8 { gap: 2rem !important; }
.space-y-1 > * + * { margin-top: 0.25rem !important; }
.space-y-2 > * + * { margin-top: 0.5rem !important; }
.space-y-4 > * + * { margin-top: 1rem !important; }
.space-y-6 > * + * { margin-top: 1.5rem !important; }
.space-y-8 > * + * { margin-top: 2rem !important; }
.space-x-2 > * + * { margin-left: 0.5rem !important; }
.space-x-4 > * + * { margin-left: 1rem !important; }
.space-x-6 > * + * { margin-left: 1.5rem !important; }
.space-x-8 > * + * { margin-left: 2rem !important; }

/* Backgrounds & Surface Colors */
.bg-background { background-color: var(--bg-main); }
.bg-surface { background-color: var(--bg-surface); }
.bg-surface-container-lowest { background-color: var(--bg-surface); }
.bg-surface-container-low { background-color: var(--bg-surface-low); }
.bg-surface-container { background-color: #f0ecf9; }
.bg-surface-container-high { background-color: var(--bg-surface-high); }
.bg-surface-container-highest { background-color: var(--bg-surface-highest); }
.bg-primary { background-color: var(--primary); }
.bg-primary-container { background-color: var(--primary-light); }
.bg-secondary { background-color: var(--secondary); }
.bg-secondary-container { background-color: var(--secondary-container); }
.bg-error { background-color: var(--error); }
.bg-error-container { background-color: var(--error-container); }
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-800\/50 { background-color: rgba(31, 41, 55, 0.5) !important; }
.bg-gray-900 { background-color: #111827; }
.bg-gray-900\/50 { background-color: rgba(17, 24, 39, 0.5) !important; }
.bg-indigo-50 { background-color: #eef2ff; }
.bg-indigo-600 { background-color: #4f46e5; }
.bg-primary-container\/10 { background-color: rgba(79, 70, 229, 0.1) !important; }
.bg-surface\/80 { background-color: rgba(255, 255, 255, 0.85) !important; }
.bg-surface-container-low\/30 { background-color: rgba(245, 242, 255, 0.3) !important; }
.bg-surface-container-low\/50 { background-color: rgba(245, 242, 255, 0.5) !important; }
.bg-green-100 { background-color: #dcfce7 !important; }
.bg-amber-100 { background-color: #fef3c7 !important; }
.bg-red-50 { background-color: #fef2f2 !important; }
.bg-red-100 { background-color: #fee2e2 !important; }
.bg-red-600 { background-color: #dc2626 !important; }
.hover\:bg-red-700:hover { background-color: #b91c1c !important; }
.border-red-200 { border-color: #fecaca !important; }
.text-red-600 { color: #dc2626 !important; }
.text-red-700 { color: #b91c1c !important; }
.text-red-800 { color: #991b1b !important; }
.shadow-red-600\/20 { box-shadow: 0 4px 14px 0 rgba(220, 38, 38, 0.2) !important; }
.bg-amber-50 { background-color: #fffbeb !important; }
.bg-amber-600 { background-color: #d97706 !important; }
.hover\:bg-amber-700:hover { background-color: #b45309 !important; }
.border-amber-200 { border-color: #fde68a !important; }
.text-amber-700 { color: #b45309 !important; }
.text-amber-800 { color: #92400e !important; }
.shadow-amber-600\/20 { box-shadow: 0 4px 14px 0 rgba(217, 119, 6, 0.2) !important; }
.bg-blue-100 { background-color: #dbeafe !important; }
.border-blue-200 { border-color: #bfdbfe !important; }
.text-blue-600 { color: #2563eb !important; }
.text-blue-800 { color: #1e40af !important; }

/* Text Colors & Fonts */
.text-on-surface { color: var(--text-main); }
.text-on-surface-variant { color: var(--text-muted); }
.text-on-background { color: var(--text-main); }
.text-primary { color: var(--primary); }
.text-primary-container { color: var(--primary); }
.text-on-primary { color: var(--on-primary); }
.text-on-primary-container { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-on-secondary { color: var(--on-secondary); }
.text-outline { color: var(--outline); }
.text-outline-variant { color: var(--outline-variant); }
.text-error { color: var(--error); }
.text-on-error { color: var(--on-error) !important; }
.text-on-error-container { color: var(--on-error-container); }
.text-white { color: #ffffff; }
.text-green-600 { color: #16a34a !important; }
.text-green-800 { color: #166534 !important; }
.text-amber-800 { color: #92400e !important; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-indigo-600 { color: #4f46e5; }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }
.font-headline { font-family: var(--font-sans); }
.font-body { font-family: var(--font-sans); }
.label-text { font-family: var(--font-label); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }

/* Borders & Radii */
.border { border: 1px solid var(--outline-variant); }
.border-2 { border-width: 2px; }
.border-t { border-top: 1px solid var(--outline-variant); }
.border-b { border-bottom: 1px solid var(--outline-variant); }
.border-l { border-left: 1px solid var(--outline-variant); }
.border-r { border-right: 1px solid var(--outline-variant); }
.border-outline { border-color: var(--outline); }
.border-outline-variant { border-color: var(--outline-variant); }
.border-outline-variant\/30 { border-color: rgba(199, 196, 216, 0.3); }
.border-outline\/20 { border-color: rgba(119, 117, 135, 0.2); }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-slate-200 { border-color: #e2e8f0 !important; }
.bg-slate-100 { background-color: #f1f5f9 !important; }
.text-slate-500 { color: #64748b !important; }
.text-slate-950 { color: #020617 !important; }
.rounded-\[2rem\] { border-radius: 2rem !important; }
.rounded-\[1\.75rem\] { border-radius: 1.75rem !important; }
.border-primary { border-color: var(--primary) !important; }
.border-transparent { border-color: transparent !important; }
.border-l-4 { border-left-width: 4px !important; border-left-style: solid !important; }
.divide-y > * + * { border-top: 1px solid var(--outline-variant); }
.divide-outline-variant\/20 > * + * { border-color: rgba(199, 196, 216, 0.2); }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadows & Effects */
.shadow { box-shadow: var(--shadow-sm); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-80 { opacity: 0.8; }
.opacity-90 { opacity: 0.9; }
.pointer-events-none { pointer-events: none; }

/* Transitions & Hover Utility Behaviors */
.transition { transition: all var(--transition-fast); }
.transition-all { transition: all var(--transition-fast); }
.transition-colors { transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }
.hover\:bg-primary:hover { background-color: var(--primary) !important; color: #ffffff !important; }
.hover\:bg-surface-container-low:hover { background-color: var(--bg-surface-low) !important; }
.hover\:text-primary:hover { color: var(--primary) !important; }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md) !important; }
.active\:scale-95:active { transform: scale(0.95); }

/* Universal Form & Input Elements for All HTML */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: #ffffff;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="search"]:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

input[type="checkbox"], input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.password-field-toggle {
  position: relative;
  z-index: 10;
  cursor: pointer;
  pointer-events: auto;
}

/* Universal Table Styling */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  padding: 0.875rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--outline-variant);
  background-color: var(--bg-surface-low);
}

tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--outline-variant);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background-color: rgba(79, 70, 229, 0.03);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINT UTILITIES (sm: 640px, md: 768px, lg: 1024px, xl: 1280px)
   ========================================================================== */

@media (min-width: 640px) {
  .sm\:block { display: block !important; }
  .sm\:flex { display: flex !important; }
  .sm\:inline-flex { display: inline-flex !important; }
  .sm\:hidden { display: none !important; }
  .sm\:flex-row { flex-direction: row !important; }
  .sm\:flex-1 { flex: 1 1 0% !important; }
  .sm\:items-center { align-items: center !important; }
  .sm\:justify-between { justify-content: space-between !important; }
  .sm\:justify-center { justify-content: center !important; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .sm\:gap-3 { gap: 0.75rem !important; }
  .sm\:p-8 { padding: 2rem !important; }
  .sm\:p-10 { padding: 2.5rem !important; }
  .sm\:px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
  .sm\:px-12 { padding-left: 3rem !important; padding-right: 3rem !important; }
}

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:inline-flex { display: inline-flex !important; }
  .md\:hidden { display: none !important; }
  .md\:flex-row { flex-direction: row !important; }
  .md\:items-center { align-items: center !important; }
  .md\:justify-between { justify-content: space-between !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .md\:ml-4 { margin-left: 1rem !important; }
  .md\:ml-6 { margin-left: 1.5rem !important; }
  .md\:mt-0 { margin-top: 0px !important; }
  .md\:p-8 { padding: 2rem !important; }
  .md\:p-12 { padding: 3rem !important; }
  .md\:pb-0 { padding-bottom: 0px !important; }
  .md\:w-auto { width: auto !important; }
  .md\:w-96 { width: 24rem !important; }
  .md\:translate-x-0 { transform: translateX(0) !important; }
  .md\:opacity-0 { opacity: 0 !important; }
  .md\:static { position: static !important; }
  .md\:shadow-none { box-shadow: none !important; }
  .md\:border-r-0 { border-right-width: 0px !important; }
  .md\:w-0 { width: 0px !important; }
}

@media (min-width: 1024px) {
  .lg\:block { display: block !important; }
  .lg\:flex { display: flex !important; }
  .lg\:inline-flex { display: inline-flex !important; }
  .lg\:hidden { display: none !important; }
  .lg\:flex-row { flex-direction: row !important; }
  .lg\:items-center { align-items: center !important; }
  .lg\:justify-between { justify-content: space-between !important; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .lg\:p-16 { padding: 4rem !important; }
  .lg\:p-24 { padding: 6rem !important; }
  .lg\:px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
  .lg\:px-24 { padding-left: 6rem !important; padding-right: 6rem !important; }
  .lg\:w-auto { width: auto !important; }
  .lg\:border-t-0 { border-top-width: 0px !important; }
}

/* Universal Viewport & Responsive Layout Safeguards */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

.max-w-full { max-width: 100% !important; }
.min-w-0 { min-width: 0px !important; }
.break-words { word-break: break-word !important; overflow-wrap: break-word !important; }
.truncate { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }

@media (max-width: 767px) {
  .mobile-stack {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }
  .mobile-full {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   GLOBAL UX MICRO-INTERACTIONS & HOVER DYNAMICS
   ========================================================================== */

/* Universal Tactile Button Hover & Active UX */
button,
.btn,
a[class*="btn"] {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.18s ease,
              border-color 0.18s ease,
              color 0.18s ease;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled),
a[class*="btn"]:hover {
  transform: translateY(-1px);
}

button:active:not(:disabled),
.btn:active:not(:disabled),
a[class*="btn"]:active {
  transform: translateY(0px) scale(0.98);
}

/* Primary Button Enhanced Hover Glow */
button[class*="bg-primary"]:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 18px -4px rgba(79, 70, 229, 0.35);
}

/* Surface / Neutral Action Button Hover Lift */
button[class*="bg-surface-container"]:hover:not(:disabled) {
  box-shadow: 0 4px 10px -2px rgba(27, 27, 36, 0.08);
}

/* Focus Visible Accessibility Ring for all controls */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* Table Row Smooth Interactive Hover */
tbody tr {
  transition: background-color 0.15s ease;
}
tbody tr:hover {
  background-color: rgba(79, 70, 229, 0.035);
}

/* Card Interactive Hover Lift & Shadow Depth */
.dashboard-card,
.sidebar-subsystem-card {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s ease;
}

.dashboard-card:hover,
.sidebar-subsystem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -6px rgba(27, 27, 36, 0.09);
  border-color: rgba(79, 70, 229, 0.25);
}

/* Disabled State UX Feedback */
button:disabled,
.btn:disabled {
  cursor: not-allowed !important;
  opacity: 0.45;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   BUTTON COMPONENT LIBRARY EXPLICIT HOVER & ACTIVE UTILITIES
   ========================================================================== */
.hover\:bg-primary-container:hover {
  background-color: var(--primary-hover) !important;
}
.hover\:text-on-primary-container:hover {
  color: #ffffff !important;
}
.hover\:bg-surface-dim:hover {
  background-color: #e2e8f0 !important;
}
.hover\:brightness-95:hover {
  filter: brightness(0.94) !important;
}
.hover\:bg-error\/90:hover {
  background-color: rgba(186, 26, 26, 0.9) !important;
  box-shadow: 0 8px 18px -4px rgba(186, 26, 26, 0.35) !important;
}
.hover\:bg-primary\/10:hover {
  background-color: rgba(79, 70, 229, 0.12) !important;
}
.hover\:bg-error\/10:hover {
  background-color: rgba(186, 26, 26, 0.12) !important;
}
.hover\:bg-on-surface\/5:hover {
  background-color: rgba(27, 27, 36, 0.06) !important;
}

/* Connected Button Group UX Polish */
div[role="group"] button {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
div[role="group"] button:hover {
  z-index: 5;
  transform: translateY(-1px);
}
div[role="group"] button:active {
  transform: translateY(0px) scale(0.99);
}

