/* ==========================================
   EnergyOS Design System - Symfony/Twig CSS
   ========================================== */

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

/* Font imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================
   CSS Variables - Theme Tokens
   ========================================== */

:root {
  /* Font families */
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Border radius */
  --radius: 0.5rem;
}

/* Terminal Dark Theme (Default) */
.palette-terminal {
  --background: 222 20% 8%;
  --foreground: 210 20% 95%;
  --card: 222 20% 10%;
  --card-foreground: 210 20% 95%;
  --popover: 222 25% 12%;
  --popover-foreground: 210 20% 95%;
  --primary: 190 95% 45%;
  --primary-foreground: 222 20% 8%;
  --secondary: 222 15% 18%;
  --secondary-foreground: 210 20% 85%;
  --muted: 222 15% 20%;
  --muted-foreground: 215 15% 55%;
  --accent: 190 90% 40%;
  --accent-foreground: 210 20% 95%;
  --border: 222 15% 20%;
  --input: 222 15% 18%;
  --ring: 190 95% 45%;

  /* Energy-specific colors */
  --energy-blue: 200 100% 50%;
  --energy-green: 145 70% 45%;
  --energy-amber: 35 95% 55%;
  --energy-red: 0 85% 55%;
  --energy-purple: 270 70% 60%;
}

/* Ocean Blue Theme */
.palette-ocean {
  --background: 210 30% 96%;
  --foreground: 210 30% 8%;
  --card: 0 0% 100%;
  --card-foreground: 210 30% 8%;
  --popover: 0 0% 100%;
  --popover-foreground: 210 30% 8%;
  --primary: 200 90% 45%;
  --primary-foreground: 0 0% 100%;
  --secondary: 210 25% 92%;
  --secondary-foreground: 210 30% 20%;
  --muted: 210 20% 90%;
  --muted-foreground: 210 20% 35%;
  --accent: 200 85% 50%;
  --accent-foreground: 0 0% 100%;
  --border: 210 20% 80%;
  --input: 210 20% 92%;
  --ring: 200 90% 45%;

  --energy-blue: 200 100% 45%;
  --energy-green: 160 65% 40%;
  --energy-amber: 35 90% 50%;
  --energy-red: 0 80% 50%;
  --energy-purple: 260 60% 55%;
}

/* Mono Modern Theme */
.palette-monochrome {
  --background: 0 0% 100%;
  --foreground: 0 0% 3%;
  --card: 0 0% 98%;
  --card-foreground: 0 0% 3%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 3%;
  --primary: 0 0% 10%;
  --primary-foreground: 0 0% 100%;
  --secondary: 0 0% 94%;
  --secondary-foreground: 0 0% 12%;
  --muted: 0 0% 92%;
  --muted-foreground: 0 0% 40%;
  --accent: 0 0% 20%;
  --accent-foreground: 0 0% 100%;
  --border: 0 0% 85%;
  --input: 0 0% 94%;
  --ring: 0 0% 10%;

  --energy-blue: 210 10% 40%;
  --energy-green: 150 5% 35%;
  --energy-amber: 35 10% 45%;
  --energy-red: 0 10% 40%;
  --energy-purple: 270 5% 45%;
}

/* ==========================================
   Base Styles
   ========================================== */

html {
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
}

/* Modal close button baseline */
.modal .btn-close {
  background-color: hsl(var(--muted));
  border-radius: 6px;
  opacity: 1;
  width: 32px;
  height: 32px;
  background-image: none;
  position: relative;
}

.modal .btn-close:hover {
  background-color: hsl(var(--secondary));
}

.modal .btn-close::before {
  content: "×";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  color: hsl(var(--foreground));
}

/* ==========================================
   Utility Classes
   ========================================== */

/* Layout */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px) {
  .container { max-width: 640px; }
}
@media (min-width: 768px) {
  .container { max-width: 768px; }
}
@media (min-width: 1024px) {
  .container { max-width: 1024px; }
}
@media (min-width: 1280px) {
  .container { max-width: 1280px; }
}
@media (min-width: 1536px) {
  .container { max-width: 1536px; }
}

.max-w-screen-2xl { max-width: 1536px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.grid { display: grid; }
.items-center { align-items: center; }
.items-start { align-items: start; }
.items-end { align-items: end; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Spacing */
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-0\.5 { padding-top: 0.125rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-8 { margin-right: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-0\.5 { margin-left: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* Sizing */
.w-2 { width: 0.5rem; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-full { width: 100%; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-8 { height: 2rem; }
.h-14 { height: 3.5rem; }
.h-full { height: 100%; }
.min-w-\[160px\] { min-width: 160px; }
.min-w-\[180px\] { min-width: 180px; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Colors */
.text-foreground { color: hsl(var(--foreground)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-yellow-500 { color: #eab308; }
.fill-yellow-500 { fill: #eab308; }
.text-energy-green { color: hsl(var(--energy-green)); }
.text-energy-amber { color: hsl(var(--energy-amber)); }
.text-energy-red { color: hsl(var(--energy-red)); }
.bg-background { background-color: hsl(var(--background)); }
.bg-card { background-color: hsl(var(--card)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-secondary { background-color: hsl(var(--secondary)); }
.bg-popover { background-color: hsl(var(--popover)); }
.bg-primary\/10 { background-color: hsl(var(--primary) / 0.1); }
.bg-muted\/30 { background-color: hsl(var(--muted) / 0.3); }
.bg-energy-green { background-color: hsl(var(--energy-green)); }
.bg-energy-green\/10 { background-color: hsl(var(--energy-green) / 0.1); }
.bg-energy-amber { background-color: hsl(var(--energy-amber)); }
.bg-energy-amber\/10 { background-color: hsl(var(--energy-amber) / 0.1); }
.bg-energy-red\/10 { background-color: hsl(var(--energy-red) / 0.1); }
.bg-secondary\/20 { background-color: hsl(var(--secondary) / 0.2); }

/* Borders */
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-l-2 { border-left-width: 2px; }
.border-border { border-color: hsl(var(--border)); }
.border-l-primary { border-left-color: hsl(var(--primary)); }
.border-l-energy-green { border-left-color: hsl(var(--energy-green)); }
.border-l-energy-amber { border-left-color: hsl(var(--energy-amber)); }
.border-l-energy-red { border-left-color: hsl(var(--energy-red)); }
.rounded-full { border-radius: 9999px; }
.rounded-md { border-radius: calc(var(--radius) - 2px); }
.rounded-lg { border-radius: var(--radius); }

/* Effects */
.shadow-xl { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
.backdrop-blur { backdrop-filter: blur(8px); }
.opacity-0 { opacity: 0; }
.invisible { visibility: hidden; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.top-full { top: 100%; }
.right-0 { right: 0; }
.left-0 { left: 0; }
.left-auto { left: auto; }
.z-50 { z-index: 50; }

/* Overflow */
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Flex shrink */
.flex-shrink-0 { flex-shrink: 0; }

/* Inline & Block */
.inline { display: inline; }
.block { display: block; }

/* Float */
.float-right { float: right; }

/* Transitions */
.transition-all { transition: all 150ms ease; }
.transition-colors { transition: color, background-color, border-color 150ms ease; }
.duration-200 { transition-duration: 200ms; }

/* Grid responsive */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

/* Animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ==========================================
   Component Styles
   ========================================== */

/* Navigation */
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border-radius: calc(var(--radius) - 2px);
  transition: color 150ms, background-color 150ms;
  cursor: pointer;
  border: none;
  background: transparent;
}

.nav-link:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--secondary) / 0.5);
}

.nav-link.active {
  color: hsl(var(--primary));
  background-color: hsl(var(--secondary));
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  position: absolute;
  left: 0;
  top: 100%;
  padding-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms, visibility 200ms;
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
}

.nav-dropdown-menu > div,
.nav-dropdown-menu {
  background-color: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  padding: 0.5rem;
  min-width: 280px;
}

.nav-dropdown-sectioned {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  padding: 1rem;
  min-width: 500px;
  max-width: 700px;
}

.nav-dropdown-wide {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
  min-width: 800px;
}

.nav-dropdown-wide .nav-dropdown-section {
  flex: 1;
  min-width: 160px;
}

.nav-dropdown-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.nav-dropdown-item {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: background-color 150ms;
}

.nav-dropdown-item:hover {
  background-color: hsl(var(--secondary));
}

.nav-dropdown-item-compact {
  display: block;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: background-color 150ms;
}

.nav-dropdown-item-compact:hover {
  background-color: hsl(var(--secondary));
}

/* Icon Button */
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: color 150ms, background-color 150ms;
}

.icon-button:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--secondary));
}

/* Page Header */
.page-header {
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  padding: 1.5rem;
  margin-bottom: 0;
}

.page-header-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.page-header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.2;
}

/* Page Content - Padding handled by page-wrapper in base.html.twig */

/* Favorite Icon */
.favorite-icon {
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  transition: color 150ms;
  display: inline-flex;
  align-items: center;
}

.favorite-icon:hover {
  color: hsl(var(--primary));
}

.favorite-icon .fill-current {
  fill: currentColor;
}

/* Pulse Badge for NEW items */
.pulse-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: hsl(var(--energy-green));
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 9999px;
  margin-left: 0.5rem;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Cards */
.card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-body {
  padding: 1.5rem;
}

/* Form Card - No border between header and body */
.form-card .card-header {
  border-bottom: none;
  padding-bottom: 0.5rem;
}

.form-card .card-body {
  padding-top: 1rem;
}

/* KPI Card */
.kpi-card {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* Theme-specific KPI card improvements for light themes */
.palette-ocean .kpi-card,
.palette-monochrome .kpi-card {
  color: hsl(var(--foreground));
}

.palette-ocean .kpi-card .kpi-title,
.palette-monochrome .kpi-card .kpi-title {
  color: hsl(var(--foreground) / 0.7);
}

.palette-ocean .kpi-card .kpi-value,
.palette-monochrome .kpi-card .kpi-value {
  color: hsl(var(--foreground));
}

/* Theme-specific KPI card improvements for light themes */
.palette-ocean .kpi-card,
.palette-monochrome .kpi-card {
  color: hsl(var(--foreground));
}

.palette-ocean .kpi-card .kpi-title,
.palette-monochrome .kpi-card .kpi-title {
  color: hsl(var(--foreground) / 0.7);
}

.palette-ocean .kpi-card .kpi-value,
.palette-monochrome .kpi-card .kpi-value {
  color: hsl(var(--foreground));
}

/* Activity Feed */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.activity-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: hsl(var(--muted) / 0.5);
  border-bottom: 1px solid hsl(var(--border));
}

/* Consistent styling for ALL links in table headers (sortable columns) */
.data-table thead th a {
  color: hsl(var(--muted-foreground)) !important;
  text-decoration: none !important;
  display: inline-block;
  transition: color 150ms;
}

.data-table thead th a:hover {
  color: hsl(var(--foreground)) !important;
  text-decoration: none !important;
}

.data-table thead th a:visited,
.data-table thead th a:link,
.data-table thead th a:active {
  color: hsl(var(--muted-foreground)) !important;
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid hsl(var(--border));
  text-align: left;
}

.data-table td.text-center {
  text-align: center !important;
}

.data-table th.text-center {
  text-align: center !important;
}

.data-table tbody tr:hover {
  background-color: hsl(var(--secondary) / 0.3);
}

/* Sorting styles for KnpPaginator */
.data-table th.sorting {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.data-table th.sorting:hover {
  background-color: hsl(var(--secondary) / 0.5);
}

.data-table th.sorting a {
  color: hsl(var(--muted-foreground)) !important;
  text-decoration: none !important;
  display: block;
  width: 100%;
  transition: color 150ms;
  position: relative;
  padding-right: 1.25rem;
}

.data-table th.sorting a:hover {
  color: hsl(var(--foreground)) !important;
  text-decoration: none !important;
}

.data-table th.sorting a:visited {
  color: hsl(var(--muted-foreground)) !important;
}

.data-table th.sorting a:link {
  color: hsl(var(--muted-foreground)) !important;
}

/* Sorting arrows - Default state (both arrows visible but muted) */
.data-table th.sorting a::before {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 30%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid hsl(var(--muted-foreground) / 0.3);
  transition: border-bottom-color 150ms;
}

.data-table th.sorting a::after {
  content: "";
  position: absolute;
  top: 70%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid hsl(var(--muted-foreground) / 0.3);
  transition: border-top-color 150ms;
}

/* Hover state - brighten both arrows */
.data-table th.sorting a:hover::before {
  border-bottom-color: hsl(var(--muted-foreground) / 0.6);
}

.data-table th.sorting a:hover::after {
  border-top-color: hsl(var(--muted-foreground) / 0.6);
}

/* Ascending sort - up arrow active */
.data-table th.sorting_asc a::before {
  border-bottom-color: hsl(var(--primary)) !important;
}

.data-table th.sorting_asc a::after {
  border-top-color: hsl(var(--muted-foreground) / 0.2);
}

/* Descending sort - down arrow active */
.data-table th.sorting_desc a::before {
  border-bottom-color: hsl(var(--muted-foreground) / 0.2);
}

.data-table th.sorting_desc a::after {
  border-top-color: hsl(var(--primary)) !important;
}

/* Theme-specific colors for sortable links */
.palette-terminal .data-table thead th a {
  color: hsl(var(--muted-foreground)) !important;
}

.palette-terminal .data-table thead th a:hover {
  color: hsl(var(--primary)) !important;
}

.palette-ocean .data-table thead th a,
.palette-monochrome .data-table thead th a {
  color: hsl(var(--muted-foreground)) !important;
}

.palette-ocean .data-table thead th a:hover,
.palette-monochrome .data-table thead th a:hover {
  color: hsl(var(--primary)) !important;
}

.palette-ocean .data-table thead th a:visited,
.palette-ocean .data-table thead th a:link,
.palette-ocean .data-table thead th a:active,
.palette-monochrome .data-table thead th a:visited,
.palette-monochrome .data-table thead th a:link,
.palette-monochrome .data-table thead th a:active {
  color: hsl(var(--muted-foreground)) !important;
}

/* Theme-specific table improvements for light themes */
.palette-ocean .data-table th,
.palette-monochrome .data-table th {
  color: hsl(var(--foreground) / 0.7);
  font-weight: 700;
}

.palette-ocean .data-table td,
.palette-monochrome .data-table td {
  color: hsl(var(--foreground));
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.badge-success {
  background-color: hsl(var(--energy-green) / 0.1);
  color: hsl(var(--energy-green));
}

.badge-warning {
  background-color: hsl(var(--energy-amber) / 0.1);
  color: hsl(var(--energy-amber));
}

.badge-danger {
  background-color: hsl(var(--energy-red) / 0.1);
  color: hsl(var(--energy-red));
}

.badge-secondary {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 150ms;
  border: none;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.5;
}

/* Ensure button tags have same sizing as anchor tags */
button.btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-outline:hover {
  background-color: hsl(var(--secondary));
}

.btn-outline i,
.btn-outline [data-lucide] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Glow Effects */
.glow-primary {
  box-shadow: 0 0 20px hsl(var(--primary) / 0.3);
}

/* ==========================================
   Form Controls (Inputs, Selects, Textareas)
   ========================================== */

/* Remove ALL outlines and focus rings from EVERYTHING - most aggressive approach */
* {
  outline: 0 !important;
  outline: none !important;
}

*:focus,
*:focus-visible,
*:active {
  outline: 0 !important;
  outline: none !important;
  outline-width: 0 !important;
  outline-style: none !important;
  outline-color: transparent !important;
  box-shadow: none !important;
}

input,
select,
textarea,
button {
  outline: 0 !important;
  outline: none !important;
}

input:focus,
input:focus-visible,
input:active,
select:focus,
select:focus-visible,
select:active,
textarea:focus,
textarea:focus-visible,
textarea:active,
button:focus,
button:focus-visible,
button:active {
  outline: 0 !important;
  outline: none !important;
  outline-width: 0 !important;
  box-shadow: none !important;
}

/* Base input styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea,
.form-control {
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
  /* background-color: hsl(var(--background)); */
  transition: border-color 150ms, box-shadow 150ms;
  outline: none;
  box-shadow: none;
}

/* Focus state */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none !important;
  border-color: hsl(var(--primary));
  box-shadow: none !important;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: hsl(var(--muted));
}

/* Placeholder */
input::placeholder,
textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Select dropdown - Only apply to select elements that are NOT form-select */
select:not(.form-select) {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23888' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px 10px;
  padding-right: 2.5rem;
}

/* Theme-specific select arrow colors - Only for select that are NOT form-select */
.palette-terminal select:not(.form-select) {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2 3l3 3 3-3'/%3e%3c/svg%3e");
  background-size: 10px 10px;
}

.palette-ocean select:not(.form-select),
.palette-monochrome select:not(.form-select) {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2 3l3 3 3-3'/%3e%3c/svg%3e");
  background-size: 10px 10px;
}

/* Textarea */
textarea {
  min-height: 100px;
  resize: vertical;
}

/* Form labels */
label,
/* Form groups - Using gap instead of margin for consistent spacing */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0;
}

/* Ensure checkboxes inside form-group maintain row layout */
.form-group .form-check {
  flex-direction: row;
  align-items: center;
  width: auto;
  flex-shrink: 0;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0;
}

.form-label.required,
label.required {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.form-label.required .text-energy-red,
label.required .text-energy-red {
  display: inline-block;
  line-height: 1;
}

/* Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: 0.5rem;
  cursor: pointer;
}

/* ==========================================
   Bootstrap Compatibility & Legacy Pages
   ========================================== */

/* Add default padding to old Bootstrap pages */
main .row:first-child {
  padding: 1.5rem;
}

/* Improve Bootstrap cards to match EnergyOS */
main .form-styled,
main .card-body {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--foreground));
}

/* Bootstrap tables */
main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

main table thead th {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

main table tbody tr {
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color 150ms;
}

main table tbody tr:hover {
  background: hsl(var(--muted) / 0.3);
}

main table tbody td {
  padding: 0.75rem 1rem;
  color: hsl(var(--foreground));
}

/* Bootstrap buttons - Global styles */
.btn,
main .btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  transition: all 150ms;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary,
main .btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.btn-primary:hover,
main .btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  border-color: hsl(var(--primary) / 0.9);
}

.btn-primary:focus,
main .btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.2);
}

.btn-primary i,
.btn-primary [data-lucide],
main .btn-primary i,
main .btn-primary [data-lucide] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-secondary,
main .btn-secondary {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
  font-weight: 500;
}

.btn-secondary:hover,
main .btn-secondary:hover {
  background: hsl(var(--muted) / 0.8);
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--foreground));
}

.btn-secondary:focus,
main .btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
  border-color: hsl(var(--primary) / 0.7);
}

.btn-secondary:active,
main .btn-secondary:active {
  background: hsl(var(--muted) / 0.7);
  border-color: hsl(var(--primary) / 0.6);
}

.btn-outline,
main .btn-outline {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-outline:hover,
main .btn-outline:hover {
  background: hsl(var(--secondary));
}

.btn-outline i,
.btn-outline [data-lucide],
main .btn-outline i,
main .btn-outline [data-lucide] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Form inputs in Bootstrap pages */
main input[type="text"],
main input[type="email"],
main input[type="password"],
main input[type="number"],
main input[type="date"],
main input[type="tel"],
main select,
main textarea {
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
}

main input:focus,
main select:focus,
main textarea:focus {
  outline: none !important;
  border-color: hsl(var(--primary));
  box-shadow: none !important;
}

/* Page titles */
main .page-titles h3 {
  color: hsl(var(--foreground));
  font-size: 1.5rem;
  font-weight: 700;
}

main .breadcrumb {
  display: flex;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

main .breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 0.5rem;
}

main .breadcrumb-item.active {
  color: hsl(var(--foreground));
}

/* ==========================================
   DateRangePicker Theme Compatibility
   ========================================== */

.daterangepicker {
  background-color: hsl(var(--card)) !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

.daterangepicker::before,
.daterangepicker::after {
  border-bottom-color: hsl(var(--card)) !important;
}

.daterangepicker .calendar-table {
  background-color: hsl(var(--card)) !important;
  border-color: hsl(var(--border)) !important;
}

.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
  color: hsl(var(--foreground)) !important;
}

.daterangepicker .calendar-table thead tr:first-child th {
  color: hsl(var(--muted-foreground)) !important;
}

.daterangepicker .calendar-table td.available:hover {
  background-color: hsl(var(--secondary)) !important;
  color: hsl(var(--foreground)) !important;
}

.daterangepicker .calendar-table td.active,
.daterangepicker .calendar-table td.active:hover {
  background-color: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

.daterangepicker .calendar-table td.in-range {
  background-color: hsl(var(--primary) / 0.2) !important;
  color: hsl(var(--foreground)) !important;
}

.daterangepicker .calendar-table td.off,
.daterangepicker .calendar-table td.disabled {
  color: hsl(var(--muted-foreground)) !important;
  opacity: 0.5 !important;
}

.daterangepicker select {
  background-color: hsl(var(--input)) !important;
  color: hsl(var(--foreground)) !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: calc(var(--radius) - 2px) !important;
}

.daterangepicker .ranges li {
  color: hsl(var(--foreground)) !important;
  background-color: transparent !important;
  border-radius: calc(var(--radius) - 2px) !important;
}

.daterangepicker .ranges li:hover {
  background-color: hsl(var(--secondary)) !important;
}

.daterangepicker .ranges li.active {
  background-color: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

.daterangepicker .drp-buttons {
  border-top: 1px solid hsl(var(--border)) !important;
}

.daterangepicker .drp-buttons .btn {
  background-color: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
  border: none !important;
  border-radius: calc(var(--radius) - 2px) !important;
  padding: 0.5rem 1rem !important;
  font-weight: 500 !important;
}

.daterangepicker .drp-buttons .btn.btn-default {
  background-color: hsl(var(--secondary)) !important;
  color: hsl(var(--foreground)) !important;
}

.daterangepicker .drp-buttons .btn:hover {
  opacity: 0.9 !important;
}

/* ==========================================
   Light Theme Specific Improvements
   ========================================== */

/* Ocean Blue & Mono Modern - Better contrast for text */
.palette-ocean {
  --muted-foreground: 210 25% 35%;
}

.palette-monochrome {
  --muted-foreground: 0 0% 40%;
}

/* Improve card text visibility */
.palette-ocean .card,
.palette-monochrome .card {
  color: hsl(var(--foreground));
}

.palette-ocean .card-header,
.palette-monochrome .card-header {
  color: hsl(var(--foreground));
}

.palette-ocean .card-body,
.palette-monochrome .card-body {
  color: hsl(var(--foreground));
}

/* Improve table visibility */
.palette-ocean table,
.palette-monochrome table {
  color: hsl(var(--foreground));
}

.palette-ocean table th,
.palette-monochrome table th {
  color: hsl(var(--foreground) / 0.8);
  font-weight: 700;
}

.palette-ocean table td,
.palette-monochrome table td {
  color: hsl(var(--foreground));
}

/* Improve form inputs */
.palette-ocean input,
.palette-ocean select,
.palette-ocean textarea,
.palette-monochrome input,
.palette-monochrome select,
.palette-monochrome textarea {
  color: hsl(var(--foreground));
  background-color: hsl(var(--input));
  border-color: hsl(var(--border));
}

/* Improve button text */
.palette-ocean .btn,
.palette-monochrome .btn {
  color: hsl(var(--foreground));
}

.palette-ocean .btn-primary,
.palette-monochrome .btn-primary {
  color: hsl(var(--primary-foreground));
}

/* Improve navigation text */
.palette-ocean .nav-item,
.palette-monochrome .nav-item {
  color: hsl(var(--foreground) / 0.8);
}

.palette-ocean .nav-item:hover,
.palette-monochrome .nav-item:hover {
  color: hsl(var(--foreground));
}

/* Improve dropdown text */
.palette-ocean .dropdown-item,
.palette-monochrome .dropdown-item {
  color: hsl(var(--foreground));
}

/* Improve activity feed text */
.palette-ocean .activity-item,
.palette-monochrome .activity-item {
  color: hsl(var(--foreground));
}

.palette-ocean .activity-item .font-semibold,
.palette-monochrome .activity-item .font-semibold {
  color: hsl(var(--foreground));
}

/* Improve hub allocation cards */
.palette-ocean .hub-allocation-card,
.palette-monochrome .hub-allocation-card {
  color: hsl(var(--foreground));
}

.palette-ocean .hub-allocation-card .font-semibold,
.palette-monochrome .hub-allocation-card .font-semibold {
  color: hsl(var(--foreground));
}

.palette-ocean .hub-allocation-card .text-2xl,
.palette-monochrome .hub-allocation-card .text-2xl {
  color: hsl(var(--foreground));
}

/* Improve KPI cards text */
.palette-ocean .kpi-card,
.palette-monochrome .kpi-card {
  color: hsl(var(--foreground));
}

.palette-ocean .kpi-card .kpi-title,
.palette-monochrome .kpi-card .kpi-title {
  color: hsl(var(--foreground) / 0.7);
}

.palette-ocean .kpi-card .kpi-value,
.palette-monochrome .kpi-card .kpi-value {
  color: hsl(var(--foreground));
}

/* Improve data table headers */
.palette-ocean .data-table th,
.palette-monochrome .data-table th {
  color: hsl(var(--foreground) / 0.7);
  font-weight: 700;
}

.palette-ocean .data-table td,
.palette-monochrome .data-table td {
  color: hsl(var(--foreground));
}

/* Improve text-muted-foreground class */
.palette-ocean .text-muted-foreground,
.palette-monochrome .text-muted-foreground {
  color: hsl(var(--foreground) / 0.65) !important;
}

/* Improve all text elements */
.palette-ocean p,
.palette-ocean span,
.palette-ocean div,
.palette-monochrome p,
.palette-monochrome span,
.palette-monochrome div {
  color: inherit;
}

/* Ensure font-mono is visible */
.palette-ocean .font-mono,
.palette-monochrome .font-mono {
  color: hsl(var(--foreground));
}

/* ==========================================
   Button Styles - Light Theme Improvements
   ========================================== */

.palette-ocean .btn-secondary,
.palette-monochrome .btn-secondary {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.palette-ocean .btn-secondary:hover,
.palette-monochrome .btn-secondary:hover {
  background: hsl(var(--muted) / 0.8);
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--foreground));
}

.palette-ocean .btn-primary,
.palette-monochrome .btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.palette-ocean .btn-primary:hover,
.palette-monochrome .btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  border-color: hsl(var(--primary) / 0.9);
}

/* ==========================================
   Button Styles - Terminal Dark Theme Improvements
   ========================================== */

.palette-terminal .btn-primary,
.palette-terminal main .btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.palette-terminal .btn-primary:hover,
.palette-terminal main .btn-primary:hover {
  background: hsl(var(--primary) / 0.85);
  border-color: hsl(var(--primary) / 0.85);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.palette-terminal .btn-primary:active,
.palette-terminal main .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.palette-terminal .btn-primary:focus,
.palette-terminal main .btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.palette-terminal .btn-primary i,
.palette-terminal .btn-primary [data-lucide],
.palette-terminal main .btn-primary i,
.palette-terminal main .btn-primary [data-lucide] {
  color: hsl(var(--primary-foreground));
}

/* ==========================================
   Modal Styles - Global Bootstrap Modal Support
   ========================================== */

/* Modal Container */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1050;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

.modal.show,
.modal.fade.show {
  display: block !important;
}

.modal.fade {
  transition: opacity 0.15s linear;
}

.modal.fade:not(.show) {
  opacity: 0;
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
}

.modal-backdrop.fade {
  opacity: 0;
  transition: opacity 0.15s linear;
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Modal Dialog - Centered */
.modal-dialog {
  position: relative;
  width: auto;
  margin: 1.75rem auto;
  max-width: 500px;
  pointer-events: none;
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
}

.modal.show .modal-dialog {
  transform: none;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

/* Modal Content */
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: hsl(var(--card));
  background-clip: padding-box;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  outline: 0;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  border-top-left-radius: calc(var(--radius) - 1px);
  border-top-right-radius: calc(var(--radius) - 1px);
}

.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* Modal Body */
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1.5rem;
  color: hsl(var(--foreground));
}

/* Modal Footer */
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
  border-bottom-right-radius: calc(var(--radius) - 1px);
  border-bottom-left-radius: calc(var(--radius) - 1px);
  gap: 0.75rem;
}

.modal-footer > * {
  margin: 0;
}

/* Close Button */
.btn-close {
  padding: 0.5rem;
  margin: -0.5rem -0.5rem -0.5rem auto;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease-in-out, background-color 0.15s ease-in-out;
  color: hsl(var(--foreground));
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}

.btn-close:hover {
  opacity: 1;
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.btn-close:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  padding-right: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-content {
    border-radius: var(--radius);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
}

/* ==========================================
   Form Elements - Enhanced Styles
   ========================================== */

/* Form Groups - Duplicate removed, using definition above */
/* Form Labels - Duplicate removed, using definition above */

.form-label-disabled {
  color: hsl(var(--muted-foreground));
}

/* Form Inputs - Enhanced */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  background-color: hsl(var(--input));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
  transition: border-color 150ms, box-shadow 150ms;
}

/* Ensure form-select has dropdown arrow - override select styles */
.form-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23888' d='M5 7L1 3h8z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 10px 10px !important;
  padding-right: 2.5rem !important;
  cursor: pointer;
}

/* Theme-specific select arrow colors for form-select */
.palette-terminal .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2 3l3 3 3-3'/%3e%3c/svg%3e") !important;
  background-size: 10px 10px !important;
}

.palette-ocean .form-select,
.palette-monochrome .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2 3l3 3 3-3'/%3e%3c/svg%3e") !important;
  background-size: 10px 10px !important;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
}

/* Textarea */
.form-textarea {
  min-height: 6rem;
  resize: vertical;
}

.form-textarea-error {
  border-color: hsl(var(--energy-red));
}

.form-textarea-error:focus {
  box-shadow: 0 0 0 3px hsl(var(--energy-red) / 0.15);
}

/* Input States */
.form-input-error {
  border-color: hsl(var(--energy-red));
  background-color: hsl(var(--energy-red) / 0.05);
}

.form-input-error:focus {
  box-shadow: 0 0 0 3px hsl(var(--energy-red) / 0.15);
}

.form-input-success {
  border-color: hsl(var(--energy-green));
  background-color: hsl(var(--energy-green) / 0.05);
}

.form-input-success:focus {
  box-shadow: 0 0 0 3px hsl(var(--energy-green) / 0.15);
}

.form-error-message {
  font-size: 0.75rem;
  color: hsl(var(--energy-red));
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.form-success-message {
  font-size: 0.75rem;
  color: hsl(var(--energy-green));
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Input with Icon */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .form-input {
  padding-right: 2.5rem;
}

.input-icon {
  position: absolute;
  right: 0.75rem;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.input-icon-btn {
  position: absolute;
  right: 0.5rem;
  padding: 0.25rem;
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  border-radius: calc(var(--radius) - 4px);
}

.input-icon-btn:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--secondary));
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  border-radius: 0;
  flex: 1;
}

.input-group .form-input:first-child,
.input-group > :first-child .form-input {
  border-top-left-radius: calc(var(--radius) - 2px);
  border-bottom-left-radius: calc(var(--radius) - 2px);
}

.input-group .form-input:last-child,
.input-group > :last-child {
  border-top-right-radius: calc(var(--radius) - 2px);
  border-bottom-right-radius: calc(var(--radius) - 2px);
}

.input-group-addon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-right: none;
  border-top-left-radius: calc(var(--radius) - 2px);
  border-bottom-left-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground));
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-right: none;
  border-top-left-radius: calc(var(--radius) - 2px);
  border-bottom-left-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.input-group-select {
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  background-color: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-right: none;
  border-top-left-radius: calc(var(--radius) - 2px);
  border-bottom-left-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
}

.input-group-select-right {
  border-left: none;
  border-right: 1px solid hsl(var(--border));
  border-radius: 0;
  border-top-right-radius: calc(var(--radius) - 2px);
  border-bottom-right-radius: calc(var(--radius) - 2px);
}

.input-group-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.875rem;
  background-color: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-left: none;
  border-top-right-radius: calc(var(--radius) - 2px);
  border-bottom-right-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 150ms;
}

.input-group-btn:hover {
  background-color: hsl(var(--muted));
}

/* Multi-Select Display */
.multi-select-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.75rem;
  background-color: hsl(var(--input));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
}

.multi-select-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background-color: hsl(var(--primary) / 0.1);
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  color: hsl(var(--primary));
}

.multi-select-tag button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  color: hsl(var(--primary));
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.multi-select-tag button:hover {
  color: hsl(var(--energy-red));
}

/* File Input */
.file-input-wrapper {
  width: 100%;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.file-input-btn {
  padding: 0.5rem 1rem;
  background-color: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  transition: background-color 150ms;
}

.file-input-label:hover .file-input-btn {
  background-color: hsl(var(--muted));
}

.file-input-text {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.file-input-hidden {
  display: none;
}

/* Checkboxes - Enhanced */
.form-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  width: auto;
  flex-shrink: 0;
}

.form-check-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-check-input,
input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 4px);
  background-color: hsl(var(--background));
  cursor: pointer;
  accent-color: hsl(var(--primary));
  transition: all 150ms ease;
  flex-shrink: 0;
}

.form-check-input:hover,
input[type="checkbox"]:hover {
  border-color: hsl(var(--primary));
}

.form-check-input:checked,
input[type="checkbox"]:checked {
  background-color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.form-check-input:focus,
input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
}

.form-check-input:disabled,
input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-check-label {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  user-select: none;
  margin: 0;
  line-height: 1.5;
}

/* Radio Buttons */
.form-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-radio-input,
input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid hsl(var(--border));
  border-radius: 9999px;
  background-color: hsl(var(--background));
  cursor: pointer;
  accent-color: hsl(var(--primary));
  transition: all 150ms ease;
  flex-shrink: 0;
}

.form-radio-input:hover,
input[type="radio"]:hover {
  border-color: hsl(var(--primary));
}

.form-radio-input:checked,
input[type="radio"]:checked {
  border-color: hsl(var(--primary));
}

.form-radio-input:focus,
input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
}

.form-radio-input:disabled,
input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-radio-label {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  user-select: none;
}

/* Toggle Switch */
.form-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-switch {
  position: relative;
  display: inline-flex;
  width: 2.75rem;
  height: 1.5rem;
  cursor: pointer;
}

.form-switch-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-switch-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.form-switch-slider {
  position: absolute;
  inset: 0;
  background-color: hsl(var(--muted));
  border-radius: 9999px;
  transition: background-color 200ms;
}

.form-switch-slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  background-color: hsl(var(--card));
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 200ms;
}

.form-switch-input:checked + .form-switch-slider {
  background-color: hsl(var(--primary));
}

.form-switch-input:checked + .form-switch-slider::before {
  transform: translateY(-50%) translateX(1.25rem);
}

.form-switch-label {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
}

/* Dropzone */
.form-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--muted) / 0.2);
  text-align: center;
  transition: border-color 200ms, background-color 200ms;
}

.form-dropzone.dropzone-active {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.05);
}

.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.dropzone-icon svg {
  width: 2rem;
  height: 2rem;
}

.dropzone-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.375rem;
}

.dropzone-description {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
}

.dropzone-browse-btn {
  padding: 0.5rem 1rem;
  background-color: hsl(var(--primary));
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  cursor: pointer;
  transition: background-color 150ms;
}

.dropzone-browse-btn:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Range Slider */
.form-range {
  width: 100%;
  height: 4px;
  background: hsl(var(--secondary));
  border-radius: 2px;
  appearance: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: hsl(var(--primary));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: hsl(var(--primary));
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.range-with-value {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-with-value .form-range {
  flex: 1;
}

.range-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  min-width: 3rem;
  text-align: right;
}

/* ==========================================
   Form Layouts
   ========================================== */

/* Form Actions Row */
.form-actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.form-actions-row-compact {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Horizontal Form */
.form-horizontal {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row-horizontal {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.form-label-horizontal {
  width: 8rem;
  flex-shrink: 0;
  padding-top: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-align: right;
}

.form-input-wrapper {
  flex: 1;
}

/* Inline Form */
.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label-inline {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

/* Form Grid Layouts */
.form-grid {
  display: grid;
  gap: 0.75rem 1rem;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.form-grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.form-grid-mixed {
  grid-template-columns: 2fr 1fr;
}

.form-grid-mixed-2 {
  grid-template-columns: 3fr 1fr;
}

@media (max-width: 640px) {
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .form-grid-5,
  .form-grid-6,
  .form-grid-mixed,
  .form-grid-mixed-2 {
    grid-template-columns: 1fr;
  }

  .form-row-horizontal {
    flex-direction: column;
    gap: 0.375rem;
  }

  .form-label-horizontal {
    width: auto;
    text-align: left;
    padding-top: 0;
  }
}

/* Sectioned Form */
.form-sectioned {
  display: flex;
  flex-direction: column;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.form-section-header svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--primary));
}

.form-divider {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 1.25rem 0;
}

/* Compact Form */
.form-compact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group-compact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-label-compact {
  font-size: 0.625rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.form-input-compact,
.form-select-compact {
  height: 1.875rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  background-color: hsl(var(--input));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground));
}

.form-input-compact:focus,
.form-select-compact:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.15);
}

/* Card-Style Form */
.form-card {
  background-color: hsl(var(--muted) / 0.3);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.form-card:last-of-type {
  margin-bottom: 1.5rem;
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.form-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: hsl(var(--primary) / 0.1);
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--primary));
}

.form-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.form-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.form-card-subtitle {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.form-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Button Icons */
.btn-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.375rem;
}

/* ==========================================
   Show Page / Detail View Styles
   ========================================== */

/* Detail Header with Actions */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
}

/* Simple Detail List */
.detail-list {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.detail-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-align: right;
}

/* Horizontal Detail List */
.detail-list-horizontal {
  display: flex;
  flex-direction: column;
}

.detail-row-horizontal {
  display: flex;
  align-items: flex-start;
  padding: 0.625rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.detail-row-horizontal:last-child {
  border-bottom: none;
}

.detail-label-horizontal {
  width: 10rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.detail-value-horizontal {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

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

.detail-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background-color: hsl(var(--muted) / 0.2);
  border-radius: calc(var(--radius) - 2px);
}

.detail-cell .detail-label {
  font-size: 0.75rem;
}

.detail-cell .detail-value {
  text-align: left;
}

/* Sectioned Detail View */
.detail-sections {
  display: flex;
  flex-direction: column;
}

.detail-section {
  display: flex;
  flex-direction: column;
}

.detail-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
}

.detail-section-header svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--primary));
}

.detail-divider {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 1rem 0;
}

.detail-link {
  color: hsl(var(--primary));
  text-decoration: none;
}

.detail-link:hover {
  text-decoration: underline;
}

/* Card Detail View */
.detail-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

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

.detail-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background-color: hsl(var(--muted) / 0.2);
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: var(--radius);
}

.detail-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}

.detail-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.detail-card-icon.icon-blue {
  background-color: hsl(var(--energy-blue) / 0.15);
  color: hsl(var(--energy-blue));
}

.detail-card-icon.icon-green {
  background-color: hsl(var(--energy-green) / 0.15);
  color: hsl(var(--energy-green));
}

.detail-card-icon.icon-amber {
  background-color: hsl(var(--energy-amber) / 0.15);
  color: hsl(var(--energy-amber));
}

.detail-card-icon.icon-purple {
  background-color: hsl(var(--energy-purple) / 0.15);
  color: hsl(var(--energy-purple));
}

.detail-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.detail-card-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.detail-card-value {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* Timeline/Activity View */
.detail-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 1.5rem;
}

.detail-timeline::before {
  content: '';
  position: absolute;
  left: 0.375rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background-color: hsl(var(--border));
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.125rem;
  top: 0.25rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid hsl(var(--background));
}

.timeline-marker.marker-default {
  background-color: hsl(var(--muted-foreground));
}

.timeline-marker.marker-success {
  background-color: hsl(var(--energy-green));
}

.timeline-marker.marker-warning {
  background-color: hsl(var(--energy-amber));
}

.timeline-marker.marker-info {
  background-color: hsl(var(--energy-blue));
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.timeline-date {
  font-size: 0.625rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.timeline-description {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* ============================================
   Select2 Styling - EnergyOS Theme
   ============================================ */

/* Select2 Container */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: all 150ms ease;
}

.select2-container--default .select2-selection--single:hover {
  border-color: hsl(var(--primary));
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: hsl(var(--primary));
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: hsl(var(--foreground));
  line-height: 1.5rem;
  padding-left: 0;
  padding-right: 0;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: hsl(var(--muted-foreground));
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 2.5rem;
  right: 0.5rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: hsl(var(--muted-foreground)) transparent transparent transparent;
  border-style: solid;
  border-width: 5px 4px 0 4px;
  height: 0;
  left: 50%;
  margin-left: -4px;
  margin-top: -2px;
  position: absolute;
  top: 50%;
  width: 0;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent hsl(var(--muted-foreground)) transparent;
  border-width: 0 4px 5px 4px;
}

/* Select2 Dropdown */
.select2-dropdown {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px hsl(var(--foreground) / 0.1),
              0 2px 4px -1px hsl(var(--foreground) / 0.06);
  z-index: 9999;
}

.select2-container--default .select2-search--dropdown {
  padding: 0.5rem;
  background-color: hsl(var(--background));
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* Select2 Results */
.select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.select2-container--default .select2-results__option[aria-disabled=true] {
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.select2-container--default .select2-results__option--highlighted[aria-selected]:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.select2-results__option {
  transition: background-color 100ms ease;
}

/* Select2 No Results */
.select2-container--default .select2-results__message {
  color: hsl(var(--muted-foreground));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Select2 Clear Button */
.select2-container--default .select2-selection--single .select2-selection__clear {
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  float: right;
  font-size: 1.25rem;
  font-weight: 700;
  margin-right: 1.5rem;
  margin-top: -0.125rem;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
  color: hsl(var(--foreground));
}

/* Select2 Multiple Selection */
.select2-container--default .select2-selection--multiple {
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  min-height: 2.5rem;
  padding: 0.25rem 0.5rem;
  cursor: text;
}

.select2-container--default .select2-selection--multiple:hover {
  border-color: hsl(var(--primary));
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: hsl(var(--primary));
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.25rem 0.5rem;
  margin: 0.25rem 0.25rem 0 0;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: hsl(var(--primary-foreground));
  margin-right: 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  order: -1;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: hsl(var(--primary-foreground));
  opacity: 0.8;
}

.select2-container--default .select2-search--inline .select2-search__field {
  background-color: transparent;
  border: none;
  outline: none;
  color: hsl(var(--foreground));
  padding: 0.25rem 0;
  margin: 0.25rem 0 0 0.25rem;
  font-size: 0.875rem;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Select2 Loading */
.select2-container--default .select2-results__option[aria-disabled=true] {
  color: hsl(var(--muted-foreground));
}

.select2-container--default.select2-container--disabled .select2-selection--single {
  background-color: hsl(var(--muted));
  cursor: not-allowed;
  opacity: 0.6;
}

.select2-container--default.select2-container--disabled .select2-selection--multiple {
  background-color: hsl(var(--muted));
  cursor: not-allowed;
  opacity: 0.6;
}

/* Select2 in Filter Forms */
.filter-field-wrapper .select2-container {
  width: 100% !important;
}

.filter-field-wrapper .select2-container--default .select2-selection--single {
  height: 2.5rem;
}

/* Fix Select2 in Modal */
.modal .select2-container {
  z-index: 9999;
}

.select2-container--open {
  z-index: 99999;
}

/* Select2 Dark Theme Adjustments */
.palette-terminal .select2-dropdown,
.palette-terminal .select2-container--default .select2-selection--single,
.palette-terminal .select2-container--default .select2-selection--multiple {
  background-color: hsl(var(--background));
  border-color: hsl(var(--border));
}

.palette-terminal .select2-container--classic .select2-selection--single,
.palette-terminal .select2-container--classic .select2-selection--multiple {
  background-color: hsl(var(--input)) !important;
  background-image: none !important;
  border-color: hsl(var(--border)) !important;
  color: hsl(var(--foreground));
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__rendered,
.palette-terminal .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: hsl(var(--foreground));
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__arrow,
.palette-terminal .select2-container--default .select2-selection--single .select2-selection__arrow {
  background-color: hsl(var(--input));
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__arrow b,
.palette-terminal .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: hsl(var(--muted-foreground)) transparent transparent transparent !important;
}

.palette-terminal .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b,
.palette-terminal .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent hsl(var(--muted-foreground)) transparent !important;
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__arrow,
.palette-terminal .select2-container--default .select2-selection--single .select2-selection__arrow {
  background-color: hsl(var(--input)) !important;
}

.palette-terminal .select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: hsl(var(--background));
  border-color: hsl(var(--border));
}

.palette-terminal .select2-dropdown {
  background-color: hsl(var(--background));
  border-color: hsl(var(--border));
}

.palette-terminal .select2-container--default .select2-selection--single,
.palette-terminal .select2-container--classic .select2-selection--single {
  background-color: hsl(var(--input)) !important;
  background-image: none !important;
  color: hsl(var(--foreground));
}

.palette-terminal .select2-container--default .select2-selection--single .select2-selection__rendered,
.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__rendered {
  color: hsl(var(--foreground)) !important;
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__clear {
  color: hsl(var(--muted-foreground)) !important;
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__clear:hover {
  color: hsl(var(--foreground)) !important;
}

.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__arrow {
  border-left: 1px solid hsl(var(--border));
}

.palette-terminal .select2-container--default .select2-selection--single .select2-selection__placeholder,
.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__placeholder {
  color: hsl(var(--muted-foreground)) !important;
}

.palette-terminal .select2-container--default .select2-results__option,
.palette-terminal .select2-container--classic .select2-results__option {
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
}

.palette-terminal .select2-container--default .select2-results__option--highlighted[aria-selected],
.palette-terminal .select2-container--classic .select2-results__option--highlighted[aria-selected] {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.palette-terminal .select2-container--default .select2-results__option[aria-selected=true],
.palette-terminal .select2-container--classic .select2-results__option[aria-selected=true] {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.palette-terminal .select2-container--default .select2-results__option[aria-disabled=true],
.palette-terminal .select2-container--classic .select2-results__option[aria-disabled=true] {
  color: hsl(var(--muted-foreground));
}

.palette-terminal .select2-container--default .select2-search--dropdown,
.palette-terminal .select2-container--classic .select2-search--dropdown {
  background-color: hsl(var(--background));
}

.palette-terminal .select2-container--default .select2-search--dropdown .select2-search__field,
.palette-terminal .select2-container--classic .select2-search--dropdown .select2-search__field {
  background-color: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}

.palette-terminal .select2-container--default .select2-selection--single .select2-selection__clear,
.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__clear {
  color: hsl(var(--muted-foreground));
}

.palette-terminal .select2-container--default .select2-selection--single .select2-selection__clear:hover,
.palette-terminal .select2-container--classic .select2-selection--single .select2-selection__clear:hover {
  color: hsl(var(--foreground));
}

/* Ensure form-control class doesn't conflict */
.form-control.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
}

.select2-container--classic .select2-selection--single{
  height: 2.4rem !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: 0.375rem !important;
}

/* Select2 Classic Theme - Arrow Styling */
.select2-container--classic .select2-selection--single .select2-selection__arrow {
  height: 2.3rem !important;
  right: 0.07rem !important;
  width: 1.5rem !important;
  top: 1px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.select2-container--classic .select2-selection--single .select2-selection__arrow b {
  border-color: hsl(var(--muted-foreground)) transparent transparent transparent !important;
  border-style: solid !important;
  border-width: 6px 5px 0 5px !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  transition: border-color 0.2s ease !important;
}

.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent hsl(var(--muted-foreground)) transparent !important;
  border-width: 0 5px 6px 5px !important;
}

.select2-container--classic .select2-selection--single:hover .select2-selection__arrow b {
  border-color: hsl(var(--foreground)) transparent transparent transparent !important;
}

.select2-container--classic.select2-container--open .select2-selection--single:hover .select2-selection__arrow b {
  border-color: transparent transparent hsl(var(--foreground)) transparent !important;
}

.select2-container--classic .select2-selection--single .select2-selection__clear{
  margin-right: 30px !important;
  margin-top: 5px !important;
}

.select2-container--classic .select2-selection--single .select2-selection__rendered{
  line-height: 36px !important;
}
