/* ==========================================================================
   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:opsz,wght,FILL,GRAD@20..48,400,0,0&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;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !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.32rem;
  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;
  width: 16rem;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
}

.sidebar-brand-card {
  background: #f8fbff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 2rem;
}

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

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

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

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

.sidebar-subsystem-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  width: 100%;
  padding: 0.75rem 0.95rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 1.25rem;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  overflow: hidden;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.sidebar-subsystem-link::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--primary, #2563eb);
  opacity: 0;
  transform: scaleY(0.55);
  transform-origin: center;
  transition: opacity 200ms ease, transform 200ms ease;
}

.sidebar-subsystem-link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #1e293b;
  border-color: transparent;
}

.sidebar-subsystem-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  min-width: 1.25rem;
  max-width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  overflow: visible;
  background: transparent !important;
  color: #64748b;
  font-size: 1.15rem;
  line-height: 1;
  transition: color 200ms ease;
}

.sidebar-subsystem-link:hover .sidebar-subsystem-link-icon {
  background: transparent !important;
  color: #334155;
}

.sidebar-subsystem-link.active,
.sidebar-subsystem-link[aria-current='page'] {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary, #2563eb);
  font-weight: 600;
}

.sidebar-subsystem-link.active::before,
.sidebar-subsystem-link[aria-current='page']::before {
  opacity: 1;
  transform: scaleY(1);
}

.sidebar-subsystem-link.active .sidebar-subsystem-link-icon,
.sidebar-subsystem-link[aria-current='page'] .sidebar-subsystem-link-icon {
  background: transparent !important;
  color: var(--primary, #2563eb);
}

.sidebar-main-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 3.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 1.1rem;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: none;
  text-decoration: none;
  overflow: hidden;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.sidebar-main-link::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--primary, #2563eb);
  opacity: 0;
  transform: scaleY(0.55);
  transform-origin: center;
  transition: opacity 200ms ease, transform 200ms ease;
}

.dashboard-sidebar > nav > .sidebar-main-link + .sidebar-main-link {
  margin-top: 0.5rem;
}

.sidebar-main-link:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: transparent;
  color: #1e293b;
}

.sidebar-main-link:hover span:last-child {
  font-weight: 500;
}

.sidebar-main-link:focus-visible,
.sidebar-subsystem-link:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
  background: rgba(37, 99, 235, 0.06);
}

.sidebar-main-link.active,
.sidebar-main-link[aria-current='page'] {
  background: rgba(37, 99, 235, 0.08);
  border-color: transparent;
  color: var(--primary, #2563eb);
  font-weight: 600;
  box-shadow: none;
  transform: none;
}

.sidebar-main-link.active::before,
.sidebar-main-link[aria-current='page']::before {
  opacity: 1;
  transform: scaleY(1);
}

.sidebar-main-link.active span:last-child,
.sidebar-main-link[aria-current='page'] span:last-child {
  font-weight: 600;
}

.sidebar-main-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 0;
  background: transparent !important;
  color: #64748b;
  font-size: 1rem;
  transition: color 200ms ease;
}

.sidebar-main-link:hover .sidebar-main-link-icon {
  background: transparent !important;
  color: #334155;
}

.sidebar-main-link.active .sidebar-main-link-icon,
.sidebar-main-link[aria-current='page'] .sidebar-main-link-icon {
  background: transparent !important;
  color: var(--primary, #2563eb);
}
@media (max-width: 767px) {
  #app-sidebar.dashboard-sidebar {
    height: calc(100dvh - 4rem) !important;
    max-height: calc(100dvh - 4rem) !important;
    bottom: auto !important;
  }

  #app-sidebar.dashboard-sidebar > nav {
    padding-bottom: 2rem;
  }
}

.app-body {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.app-sidebar-slot {
  flex-shrink: 0;
  min-height: 0;
}

.app-main-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 0%;
  flex-direction: column;
  overflow: hidden;
}

#app-header-slot {
  position: relative;
  z-index: 100;
}

.app-main {
  position: relative;
  z-index: 0;
  display: flex;
  min-height: 0;
  flex: 1 1 0%;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.app-main:has(.admin-org-drawer-backdrop) {
  z-index: 200;
}

.app-page-content {
  flex: 1 0 auto;
  width: 100%;
  padding: 1.5rem;
}

.app-footer-slot {
  flex-shrink: 0;
  margin-top: auto;
  padding-inline: 1.5rem;
}

.app-footer {
  margin-top: 0;
}

@media (min-width: 768px) {
  .app-page-content {
    padding: 2rem 2.25rem 2rem 1.5rem;
  }

  .app-footer-slot {
    padding-inline: 1.5rem 2.25rem;
  }
}

.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);
}

/* ==========================================================================
   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-8 { padding-top: 2rem !important; } .pt-16 { padding-top: 4rem !important; } .pt-24 { padding-top: 6rem !important; }
.pb-4 { padding-bottom: 1rem !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-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;
}

/* 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);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: var(--bg-surface-low);
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  padding: 2rem;
  border: 1px solid rgba(199, 196, 216, 0.3);
  border-radius: var(--radius-xl);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-lg);
}

.auth-header {
  margin-bottom: 2rem;
  text-align: center;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.auth-subtitle {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-label);
}

.auth-input-shell {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  inset-y: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding-left: 0.75rem;
  pointer-events: none;
  color: var(--outline);
}

.auth-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.auth-input--password {
  padding-right: 2.5rem;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  outline: none;
}

.auth-toggle {
  position: absolute;
  inset-y: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding-right: 0.75rem;
  color: var(--outline);
  background: transparent;
  border: none;
  cursor: pointer;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-link {
  font-weight: 500;
  color: var(--primary);
  font-family: var(--font-label);
}

.auth-submit-btn {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--primary);
  color: var(--on-primary);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-submit-btn:hover {
  background-color: var(--primary-hover);
}

.auth-submit-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}


.material-symbols-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  max-width: 1em;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'Material Symbols Outlined', 'Material Symbols', system-ui, sans-serif;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
  speak: none;
}

/* Facilities & Administrative Dashboard */
.fam-dashboard-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

.contract-table th,
.contract-table td {
    vertical-align: top;
}

.contract-table {
    table-layout: fixed;
}

.contract-table th:nth-child(1),
.contract-table td:nth-child(1) {
    width: 12.5rem;
}

.contract-table th:nth-child(5),
.contract-table td:nth-child(5) {
    width: 9.5rem;
}

.contract-table th:nth-child(6),
.contract-table td:nth-child(6) {
    width: 8.5rem;
}

.contract-table th:nth-child(8),
.contract-table td:nth-child(8) {
    width: 4.25rem;
    text-align: center;
}

.contract-primary-cell strong {
    max-width: 12rem;
    overflow-wrap: anywhere;
}

.contract-title-cell,
.contract-date-cell {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.contract-title-cell strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.25;
}

.contract-title-cell small,
.contract-date-cell small {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.25;
}

.contract-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.contract-workspace .facility-table-header {
    align-items: flex-start;
}

.contract-workspace .facility-table-header > div:first-child {
    flex: 0 0 auto;
    min-width: 12rem;
}

.contract-controls {
    display: flex;
    flex: 1 1 44rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: min(100%, 18rem);
}

.contract-controls .facility-search-field {
    flex: 1 1 16rem;
    width: auto;
    min-width: min(100%, 16rem);
}

.contract-controls .document-filter-field {
    flex: 0 1 10.5rem;
}

.contract-detail-accordion .visitor-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 2.25rem;
    row-gap: 1.05rem;
    padding: 0.95rem 1.05rem 1.1rem;
}

.contract-detail-accordion .visitor-detail-item {
    display: grid;
    gap: 0.32rem;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.contract-detail-accordion .visitor-detail-item span {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.contract-detail-accordion .visitor-detail-item strong {
    min-width: 0;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.contract-detail-accordion .visitor-detail-item strong .facility-badge {
    vertical-align: middle;
}

.contract-detail-accordion .detail-item--full {
    grid-column: 1 / -1;
}

.contract-detail-accordion .detail-item--full strong {
    max-width: 68rem;
    font-weight: 600;
    line-height: 1.55;
}

.contract-date-cell .facility-badge {
    padding: 0.16rem 0.45rem;
    font-size: 0.66rem;
}

.contract-table td:nth-child(6) .facility-badge {
    max-width: 100%;
}

.contract-current-step {
    margin: 0.8rem 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.contract-current-step strong {
    color: var(--text-main);
}

.contract-approval-list,
.contract-history-list {
    display: grid;
    gap: 0.65rem;
    margin: 0.85rem 0 0;
    padding: 0;
    list-style: none;
}

.contract-approval-step,
.contract-history-event {
    display: grid;
    gap: 0.45rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.contract-approval-step {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.contract-approval-main,
.contract-approval-meta {
    display: grid;
    gap: 0.28rem;
    min-width: 0;
}

.contract-approval-main strong,
.contract-history-event strong {
    color: var(--text-main);
    font-size: 0.92rem;
    line-height: 1.3;
}

.contract-approval-main span,
.contract-history-event span,
.contract-approval-step p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.contract-approval-meta {
    justify-items: end;
}

.contract-approval-meta small,
.contract-history-event small {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.contract-approval-step p {
    grid-column: 1 / -1;
    padding-top: 0.2rem;
}

@media (max-width: 1120px) {
    .contract-table th:nth-child(4),
    .contract-table td:nth-child(4),
    .contract-table th:nth-child(7),
    .contract-table td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 680px) {
    .contract-controls {
        justify-content: stretch;
    }

    .contract-controls .facility-search-field,
    .contract-controls .document-filter-field,
    .contract-detail-accordion .visitor-detail-item {
        flex-basis: 100%;
    }

    .contract-detail-accordion .visitor-detail-grid {
        grid-template-columns: 1fr !important;
    }

    .contract-table th:nth-child(2),
    .contract-table td:nth-child(2) {
        max-width: 11rem;
    }

    .contract-table th:nth-child(3),
    .contract-table td:nth-child(3),
    .contract-table th:nth-child(4),
    .contract-table td:nth-child(4),
    .contract-table th:nth-child(7),
    .contract-table td:nth-child(7) {
        display: none;
    }

    .contract-approval-step {
        grid-template-columns: 1fr;
    }

    .contract-approval-meta {
        justify-items: start;
    }
}

.fam-page-header,
.fam-card,
.fam-alert-card {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

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

.fam-title-block {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.fam-title-block h1 {
  font-size: clamp(1.55rem, 2.1vw, 2.15rem);
  letter-spacing: 0;
}

.fam-title-block p {
  color: var(--text-muted);
  max-width: 760px;
}

.fam-last-updated,
.fam-muted {
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.fam-header-actions,
.fam-section-heading,
.fam-card-header,
.fam-kpi-footer,
.fam-alert-card,
.fam-activity-item {
  display: flex;
  align-items: center;
}

.fam-header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
}

.fam-create-menu {
  position: relative;
}

.fam-create-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  min-width: 15rem;
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: var(--shadow-xl);
}

.fam-create-menu-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 700;
}

.fam-create-menu-item:hover,
.fam-create-menu-item:focus-visible,
.fam-kpi-card:hover,
.fam-kpi-card:focus-visible,
.fam-alert-card:hover,
.fam-alert-card:focus-visible {
  background: var(--bg-surface-low);
}

.fam-section {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.fam-section-heading {
  justify-content: space-between;
  gap: 1.5rem;
}

.fam-section-heading h2 {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.fam-link,
.fam-table-action {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 800;
}

.fam-icon-button {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
}

.fam-icon-button:hover,
.fam-icon-button:focus-visible {
  background: var(--bg-surface-low);
}

.fam-alert-grid,
.fam-kpi-grid,
.fam-chart-grid {
  display: grid;
  gap: 1.5rem;
}

.fam-alert-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fam-alert-card {
  min-width: 0;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-left-width: 4px;
}

.fam-alert-critical { border-left-color: #dc2626; }
.fam-alert-warning { border-left-color: #d97706; }
.fam-alert-informational { border-left-color: #0284c7; }

.fam-alert-severity {
  flex: 0 0 auto;
  width: 6.1rem;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.fam-alert-copy {
  min-width: 0;
  flex: 1;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.fam-alert-count {
  min-width: 2rem;
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-surface-low);
  color: var(--text-main);
  font-weight: 900;
}

.fam-kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fam-card {
  min-width: 0;
  padding: 1.5rem;
}

.fam-kpi-card {
  display: grid;
  gap: 1rem;
  min-height: 10.5rem;
  color: inherit;
}

.fam-kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}

.fam-kpi-top p,
.fam-activity-item strong {
  color: var(--text-main);
  font-weight: 800;
}

.fam-kpi-top h3 {
  margin-top: 0.5rem;
  font-size: 2rem;
  letter-spacing: 0;
}

.fam-kpi-icon,
.fam-activity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.fam-kpi-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-lg);
  background: #eef2ff;
  color: var(--primary);
}

.fam-kpi-main-label,
.fam-kpi-footer,
.fam-activity-item span {
  color: var(--text-muted);
  font-size: 0.825rem;
}

.fam-kpi-footer {
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.fam-chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fam-card-header {
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.fam-card-header h3 {
  font-size: 1rem;
  letter-spacing: 0;
}

.fam-chart-box {
  position: relative;
  width: 100%;
  height: 18rem;
  min-height: 16rem;
}

.fam-chart-card:not(.fam-chart-card-wide) .fam-chart-box {
  height: 18rem;
}

.fam-chart-state:empty {
  display: none;
}

.fam-chart-state:not(:empty) .fam-state {
  min-height: 18rem;
  justify-content: center;
}

.fam-operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.fam-operations-grid + .fam-section {
  margin-top: 0.5rem;
}

.fam-pending-section .fam-card {
  border-color: rgba(79, 70, 229, 0.24);
}

.fam-timeline,
.fam-activity-list {
  display: grid;
  gap: 0.75rem;
}

.fam-timeline-item {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

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

.fam-timeline-item time {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 800;
}

.fam-timeline-item div,
.fam-activity-item div {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.fam-timeline-item strong {
  color: var(--text-main);
}

.fam-timeline-item span {
  color: var(--text-muted);
  font-size: 0.825rem;
}

.fam-activity-item {
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-lg);
  background: #f8fafc;
}

.fam-activity-item div {
  flex: 1;
  min-width: 0;
}

.fam-activity-item strong,
.fam-activity-item span {
  overflow-wrap: anywhere;
}

.fam-activity-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: #eef2ff;
  color: var(--primary);
}

.fam-retention-attention-list {
  gap: 0.55rem;
  padding: 1rem;
}

.fam-retention-attention-list .fam-activity-item {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
}

.fam-retention-attention-list .fam-activity-icon {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1rem;
  border-radius: var(--radius-sm);
}

.fam-retention-attention-list .fam-activity-item div {
  gap: 0.15rem;
}

.fam-retention-attention-list .fam-activity-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.2;
}

.fam-retention-attention-list .fam-activity-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.fam-retention-attention-list .fam-status-badge {
  padding: 0.2rem 0.5rem;
  font-size: 0.66rem;
}

.fam-table-card {
  padding: 0;
  overflow: hidden;
}

.fam-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.fam-table-card table {
  min-width: 820px;
}

.fam-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.fam-status-critical { background: #fee2e2; color: #991b1b; }
.fam-status-warning { background: #fef3c7; color: #92400e; }
.fam-status-info { background: #e0f2fe; color: #075985; }
.fam-status-progress { background: #dbeafe; color: #1e40af; }
.fam-status-scheduled { background: #e0f2fe; color: #075985; }
.fam-status-pending { background: #ede9fe; color: #5b21b6; }
.fam-status-completed { background: #dcfce7; color: #166534; }
.fam-status-inactive { background: #f1f5f9; color: #475569; }

.fam-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Facility Request Management */
.facility-requests-shell {
  width: min(100%, 1440px);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.facility-page-header,
.facility-table-card {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

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

.facility-title-block {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.facility-title-block h1 {
  font-size: clamp(1.55rem, 2.1vw, 2.15rem);
  letter-spacing: 0;
}

.facility-title-block p {
  max-width: 760px;
  color: var(--text-muted);
}

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

.facility-section {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.facility-table-header,
.facility-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.facility-table-header {
  flex-wrap: wrap;
}

.facility-table-header h2 {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.facility-table-header p,
.facility-schema-note {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.825rem;
}

.facility-text-button,
.facility-page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.facility-text-button,
.facility-page-button {
  min-height: 2.25rem;
  padding: 0.5rem 0.85rem;
}

.facility-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

.facility-header-controls .facility-search-field {
  width: clamp(20rem, 30vw, 23.75rem);
}

.facility-field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.facility-field span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.facility-field input,
.facility-field select,
.facility-field textarea {
  width: 100%;
  min-height: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
}

.facility-table-card {
  overflow: hidden;
}

.facility-table-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.facility-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.facility-requests-table {
  min-width: 1060px;
  table-layout: auto;
}

.facility-requests-table th:nth-child(1),
.facility-requests-table td:nth-child(1) {
  min-width: 8.5rem;
}

.facility-requests-table th:nth-child(2),
.facility-requests-table td:nth-child(2) {
  min-width: 16rem;
}

.facility-requests-table th:nth-child(3),
.facility-requests-table td:nth-child(3) {
  min-width: 9rem;
}

.facility-requests-table th:nth-child(4),
.facility-requests-table td:nth-child(4),
.facility-requests-table th:nth-child(5),
.facility-requests-table td:nth-child(5),
.facility-requests-table th:nth-child(6),
.facility-requests-table td:nth-child(6) {
  min-width: 8rem;
}

.facility-requests-table th:nth-child(7),
.facility-requests-table td:nth-child(7) {
  min-width: 9.5rem;
}

.facility-requests-table th:nth-child(8),
.facility-requests-table td:nth-child(8) {
  min-width: 7rem;
}

.facility-requests-table th:nth-child(9),
.facility-requests-table td:nth-child(9) {
  width: 5rem;
}

.facility-requests-table th {
  overflow: visible;
}

.facility-sort-button,
.facility-column-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.facility-sort-button::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 0.25rem solid transparent;
  border-right: 0.25rem solid transparent;
  border-top: 0.35rem solid currentColor;
  opacity: 0.45;
}

.facility-column-menu {
  position: relative;
  display: inline-flex;
}

.facility-column-trigger {
  position: relative;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.35rem;
}

.facility-column-trigger.active {
  background: #eef2ff;
  color: var(--text-muted);
}

.facility-column-trigger.active .facility-filter-dot,
.facility-column-trigger.active .facility-sort-indicator {
  color: var(--primary);
}

.facility-filter-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: var(--radius-full);
  background: var(--primary);
}

.facility-sort-indicator {
  display: inline-flex;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.45;
  transform: rotate(45deg) translateY(-1px);
}

.facility-sort-asc {
  opacity: 0.9;
  transform: rotate(225deg) translateY(-1px);
}

.facility-sort-desc {
  opacity: 0.9;
  transform: rotate(45deg) translateY(-1px);
}

.facility-column-dropdown {
  position: fixed;
  left: 0;
  z-index: 60;
  display: grid;
  gap: 0.5rem;
  min-width: 14rem;
  max-width: min(18rem, calc(100vw - 2rem));
  padding: 0.45rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.facility-column-menu-group {
  display: grid;
  gap: 0.25rem;
}

.facility-column-menu-group > span,
.facility-column-note {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.facility-column-menu-group button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
}

.facility-column-menu-group button:hover,
.facility-column-menu-group button:focus-visible,
.facility-column-menu-group button.selected {
  background: var(--bg-surface-low);
  color: var(--primary);
}

.facility-subject-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.facility-subject-cell strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.35;
}

.facility-request-number strong,
.facility-date-cell {
  white-space: nowrap;
}

.facility-ai-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(79, 70, 229, 0.18);
  background: #eef2ff;
  color: var(--primary);
  font-size: 0;
}

.facility-ai-indicator::before {
  content: "\2726";
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
}

.facility-badge,
.facility-sla {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.facility-sla {
  gap: 0.3rem;
}

.facility-sla .material-symbols-outlined {
  font-size: 0.95rem;
}

.facility-priority-critical,
.facility-status-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.facility-priority-high,
.facility-status-needs-attention,
.facility-status-priority-review {
  background: #fef3c7;
  color: #92400e;
}

.facility-priority-medium,
.facility-status-pending-approval,
.facility-status-submitted,
.facility-status-draft {
  background: #ede9fe;
  color: #5b21b6;
}

.facility-priority-low,
.facility-status-active,
.facility-status-on-track,
.facility-status-approved,
.facility-status-assigned,
.facility-status-in-progress,
.facility-status-completed,
.facility-status-verified,
.facility-status-closed {
  background: #dcfce7;
  color: #166534;
}

.facility-status-cancelled {
  background: #f1f5f9;
  color: #475569;
}

.facility-status-open,
.facility-status-due-soon,
.facility-status-scheduled {
  background: #e0f2fe;
  color: #075985;
}

.facility-status-waiting-for-trigger,
.facility-status-on-hold,
.facility-status-needs-attention,
.facility-status-unavailable,
.facility-condition-fair,
.facility-condition-for-inspection,
.facility-lifecycle-assigned {
  background: #fef3c7;
  color: #92400e;
}

.facility-condition-excellent,
.facility-condition-good,
.facility-lifecycle-available,
.facility-lifecycle-in-use {
  background: #dcfce7;
  color: #166534;
}

.facility-condition-poor,
.facility-condition-critical,
.facility-lifecycle-unavailable {
  background: #fee2e2;
  color: #991b1b;
}

.facility-lifecycle-under-maintenance {
  background: #e0f2fe;
  color: #075985;
}

.facility-lifecycle-retired,
.facility-lifecycle-for-disposal,
.facility-lifecycle-disposed {
  background: #f1f5f9;
  color: #475569;
}

.facility-approval-pending,
.facility-status-pending-approval,
.facility-status-submitted,
.facility-status-draft {
  background: #ede9fe;
  color: #5b21b6;
}

.facility-approval-approved,
.facility-status-approved,
.facility-status-completed {
  background: #dcfce7;
  color: #166534;
}

.facility-status-checked-in,
.facility-status-checked-out {
  background: #e0f2fe;
  color: #075985;
}

.facility-approval-rejected,
.facility-status-rejected,
.facility-status-no-show {
  background: #fee2e2;
  color: #991b1b;
}

.facility-approval-not-required,
.facility-status-cancelled,
.facility-status-not-required {
  background: #f1f5f9;
  color: #475569;
}

.facility-status-forwarded-to-supply-chain,
.facility-status-processing {
  background: #e0f2fe;
  color: #075985;
}

.facility-status-partially-fulfilled {
  background: #fef3c7;
  color: #92400e;
}

.facility-status-fulfilled,
.facility-status-completed {
  background: #dcfce7;
  color: #166534;
}

.facility-status-integration-failed {
  background: #fee2e2;
  color: #991b1b;
}

.facility-status-under-review {
  background: #fef3c7;
  color: #92400e;
}

.facility-status-archived,
.facility-status-obsolete {
  background: #f1f5f9;
  color: #475569;
}

.facility-status-expired {
  background: #fee2e2;
  color: #991b1b;
}

.facility-sla-on-track {
  background: #dcfce7;
  color: #166534;
}

.facility-sla-due-soon {
  background: #fef3c7;
  color: #92400e;
}

.facility-sla-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.facility-actions-cell {
  overflow: visible;
}

.facility-action-menu {
  position: relative;
  display: inline-flex;
}

.facility-action-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.facility-action-dropdown {
  position: absolute;
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 13rem;
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
}

.facility-action-dropdown[data-fam-menu-open='true'] {
  right: auto;
  bottom: auto;
  width: max-content;
  max-width: min(16rem, calc(100vw - 24px));
}

.facility-action-dropdown-down {
  top: calc(100% + 0.4rem);
}

.facility-action-dropdown-up {
  bottom: calc(100% + 0.4rem);
}

.facility-action-dropdown button,
.facility-action-dropdown a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.25rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-main);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
}

.facility-action-dropdown button:hover,
.facility-action-dropdown button:focus-visible,
.facility-action-dropdown a:hover,
.facility-action-dropdown a:focus-visible {
  background: var(--bg-surface-low);
  color: var(--primary);
}

.facility-empty-state {
  display: grid;
  place-items: center;
  gap: 0.5rem;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  text-align: center;
}

.facility-empty-state .material-symbols-outlined {
  color: var(--primary);
  font-size: 2rem;
}

.facility-empty-state strong {
  color: var(--text-main);
}

.facility-pagination {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.facility-page-button:disabled {
  opacity: 0.45;
}

.facility-drawer-placeholder[hidden] {
  display: none;
}

.asset-management-table {
  min-width: 1180px;
  table-layout: auto;
}

.asset-management-table th:nth-child(1),
.asset-management-table td:nth-child(1) {
  min-width: 8rem;
}

.asset-management-table th:nth-child(2),
.asset-management-table td:nth-child(2) {
  min-width: 17rem;
}

.asset-management-table th:nth-child(3),
.asset-management-table td:nth-child(3) {
  min-width: 10rem;
}

.asset-management-table th:nth-child(4),
.asset-management-table td:nth-child(4) {
  min-width: 13rem;
}

.asset-management-table th:nth-child(5),
.asset-management-table td:nth-child(5),
.asset-management-table th:nth-child(6),
.asset-management-table td:nth-child(6),
.asset-management-table th:nth-child(8),
.asset-management-table td:nth-child(8) {
  min-width: 9rem;
}

.asset-management-table th:nth-child(7),
.asset-management-table td:nth-child(7) {
  min-width: 9.5rem;
}

.asset-management-table th:nth-child(9),
.asset-management-table td:nth-child(9) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  text-align: center;
}

.asset-name-cell {
  align-items: flex-start;
  flex-direction: column;
}

.asset-work-order {
  display: inline-flex;
  width: fit-content;
  border-radius: var(--radius-full);
  background: #e0f2fe;
  color: #075985;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.asset-custodian-cell {
  white-space: normal;
  line-height: 1.35;
}

.reservation-table {
  min-width: 1040px;
}

.reservation-calendar-section {
  gap: 0.75rem;
}

.reservation-calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(18rem, auto) minmax(0, 1fr);
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-lg);
  background: var(--surface-card, #ffffff);
  padding: 0.875rem 1rem;
}

.reservation-calendar-navigation,
.reservation-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.reservation-calendar-navigation h2 {
  min-width: 8.75rem;
  margin-right: 0.35rem;
  color: var(--text-main);
  font-size: 1.15rem;
  letter-spacing: 0;
}

.reservation-toolbar-controls {
  justify-content: flex-end;
}

.reservation-filter-field {
  min-width: 10rem;
}

.reservation-search-field {
  min-width: min(18rem, 100%);
}

.reservation-calendar-card,
.reservation-focus-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-lg);
  background: var(--surface-card, #ffffff);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.04);
}

.reservation-calendar-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(2px);
}

.reservation-calendar {
  display: block;
  min-height: clamp(18rem, calc(100vh - 17.5rem), 26rem);
  padding: 0;
}

.reservation-calendar-weekdays,
.reservation-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.reservation-calendar-weekdays {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.82);
}

.reservation-calendar-weekdays span {
  padding: 0.55rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reservation-day-cell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.25rem;
  min-height: clamp(3.25rem, calc((100vh - 20.75rem) / 6), 4.75rem);
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 0.4rem;
  background: var(--surface-card, #ffffff);
}

.reservation-day-cell:nth-child(7n) {
  border-right: 0;
}

.reservation-day-cell.muted {
  background: rgba(248, 250, 252, 0.9);
  color: rgba(100, 116, 139, 0.42);
}

.reservation-day-cell.muted .reservation-day-number,
.reservation-day-cell.muted .reservation-day-events {
  opacity: 0.34;
}

.reservation-day-cell.today {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.28);
}

.reservation-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 900;
}

.reservation-day-cell.today .reservation-day-number {
  background: var(--primary, #2563eb);
  color: #ffffff;
}

.reservation-day-events,
.reservation-agenda-day > div,
.reservation-focus-list {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.reservation-event,
.reservation-focus-row {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 0.45rem 0.55rem;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.reservation-event:hover,
.reservation-event:focus-visible,
.reservation-focus-row:hover,
.reservation-focus-row:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  outline: 2px solid rgba(37, 99, 235, 0.2);
  outline-offset: 1px;
}

.reservation-event strong,
.reservation-focus-row strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-event span,
.reservation-focus-row span,
.reservation-focus-row small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-focus-row small {
  display: block;
  color: var(--text-dim);
}

.reservation-event-time {
  color: var(--text-main) !important;
  font-weight: 900;
}

.reservation-event-warning { border-left-color: #d97706; background: #fffbeb; }
.reservation-event-success { border-left-color: #16a34a; background: #f0fdf4; }
.reservation-event-danger { border-left-color: #dc2626; background: #fef2f2; }
.reservation-event-muted { border-left-color: #64748b; background: #f8fafc; }
.reservation-event-info { border-left-color: #0284c7; background: #f0f9ff; }
.reservation-event-neutral { border-left-color: #64748b; background: #f1f5f9; }

.reservation-more-events,
.reservation-calendar-message {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.reservation-calendar-message {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 0.9rem 1rem;
}

.reservation-agenda {
  display: grid;
  gap: 0;
}

.reservation-agenda-day {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 1rem;
  min-height: 5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 1rem;
}

.reservation-agenda-day header {
  display: grid;
  align-content: start;
  gap: 0.15rem;
}

.reservation-agenda-day header span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reservation-agenda-day header strong {
  color: var(--text-main);
  font-size: 1rem;
}

.reservation-agenda-day.today {
  background: rgba(37, 99, 235, 0.06);
}

.reservation-focus-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.reservation-focus-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.reservation-focus-panel h3 {
  color: var(--text-main);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.reservation-focus-panel p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.reservation-focus-row {
  grid-template-columns: minmax(4.5rem, auto) minmax(0, 1fr) auto;
  align-items: start;
  background: #ffffff;
}

.reservation-focus-row.reservation-event-warning { border-left-color: #d97706; background: #fffbeb; }
.reservation-focus-row.reservation-event-success { border-left-color: #16a34a; background: #f0fdf4; }
.reservation-focus-row.reservation-event-danger { border-left-color: #dc2626; background: #fef2f2; }
.reservation-focus-row.reservation-event-muted { border-left-color: #64748b; background: #f8fafc; }
.reservation-focus-row.reservation-event-info { border-left-color: #0284c7; background: #f0f9ff; }
.reservation-focus-row.reservation-event-neutral { border-left-color: #64748b; background: #f1f5f9; }

.reservation-focus-row small {
  grid-column: 2 / 3;
}

.reservation-focus-row .facility-badge {
  justify-self: end;
}

.reservation-list-card {
  margin-top: 0.25rem;
}

.reservation-table th:nth-child(1),
.reservation-table td:nth-child(1) {
  min-width: 9rem;
}

.reservation-table th:nth-child(2),
.reservation-table td:nth-child(2) {
  min-width: 16rem;
}

.reservation-table th:nth-child(3),
.reservation-table td:nth-child(3) {
  min-width: 9rem;
}

.reservation-table th:nth-child(4),
.reservation-table td:nth-child(4) {
  min-width: 9.5rem;
}

.reservation-table th:nth-child(5),
.reservation-table td:nth-child(5) {
  min-width: 9rem;
}

.reservation-table th:nth-child(6),
.reservation-table td:nth-child(6) {
  min-width: 6.5rem;
}

.reservation-table th:nth-child(7),
.reservation-table td:nth-child(7),
.reservation-table th:nth-child(8),
.reservation-table td:nth-child(8) {
  min-width: 8rem;
}

.reservation-table th:nth-child(9),
.reservation-table td:nth-child(9) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  text-align: center;
}

.reservation-view-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
  background: #ffffff;
}

.reservation-view-toggle button {
  min-height: 2.25rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.reservation-view-toggle button.active,
.reservation-view-toggle button:focus-visible {
  background: #eef2ff;
  color: var(--primary);
}

.reservation-purpose-cell {
  align-items: flex-start;
  flex-direction: column;
}

.reservation-conflict {
  display: inline-flex;
  width: fit-content;
  border-radius: var(--radius-full);
  background: #fee2e2;
  color: #991b1b;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.reservation-schedule-cell,
.reservation-requester-cell {
  display: grid;
  gap: 0.15rem;
  line-height: 1.35;
}

.reservation-schedule-cell strong,
.reservation-requester-cell {
  color: var(--text-main);
}

.reservation-schedule-cell span,
.reservation-requester-cell span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.reservation-static-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.reservation-calendar-day {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-lg);
  background: #f8fafc;
  padding: 1rem;
}

.reservation-calendar-day h3 {
  color: var(--text-main);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.reservation-calendar-day > div {
  display: grid;
  gap: 0.65rem;
}

.reservation-event-card {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 0.75rem;
  color: var(--text-main);
  text-align: left;
}

.reservation-event-card span,
.reservation-event-card small {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.reservation-event-card strong {
  font-weight: 800;
}

.procurement-table {
  min-width: 1080px;
  table-layout: auto;
}

.procurement-table th:nth-child(1),
.procurement-table td:nth-child(1) {
  min-width: 8.5rem;
}

.procurement-table th:nth-child(2),
.procurement-table td:nth-child(2) {
  min-width: 17rem;
}

.procurement-table th:nth-child(3),
.procurement-table td:nth-child(3) {
  min-width: 10rem;
}

.procurement-table th:nth-child(4),
.procurement-table td:nth-child(4) {
  min-width: 7.5rem;
}

.procurement-table th:nth-child(5),
.procurement-table td:nth-child(5) {
  min-width: 11rem;
}

.procurement-table th:nth-child(6),
.procurement-table td:nth-child(6) {
  min-width: 9rem;
}

.procurement-table th:nth-child(7),
.procurement-table td:nth-child(7) {
  min-width: 9.5rem;
}

.procurement-table th:nth-child(8),
.procurement-table td:nth-child(8) {
  min-width: 7rem;
}

.procurement-table th:nth-child(9),
.procurement-table td:nth-child(9) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  text-align: center;
}

.procurement-origin-cell,
.procurement-requester-cell {
  display: grid;
  gap: 0.15rem;
  line-height: 1.35;
}

.procurement-origin-cell strong,
.procurement-requester-cell {
  color: var(--text-main);
}

.procurement-origin-cell span,
.procurement-requester-cell span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.procurement-cost-cell {
  text-align: right;
  white-space: nowrap;
  font-weight: 800;
}

.procurement-status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.procurement-integration {
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.procurement-integration-info {
  background: #0284c7;
}

.procurement-integration-warning {
  background: #d97706;
}

.procurement-integration-danger {
  background: #dc2626;
}

.records-table {
  min-width: 980px;
  table-layout: auto;
}

.records-table th:nth-child(1),
.records-table td:nth-child(1) {
  min-width: 9rem;
}

.records-table th:nth-child(2),
.records-table td:nth-child(2) {
  min-width: 18rem;
}

.records-table th:nth-child(3),
.records-table td:nth-child(3) {
  min-width: 10rem;
}

.records-table th:nth-child(4),
.records-table td:nth-child(4) {
  min-width: 10rem;
}

.records-table th:nth-child(5),
.records-table td:nth-child(5) {
  min-width: 6.5rem;
}

.records-table th:nth-child(6),
.records-table td:nth-child(6) {
  min-width: 8rem;
}

.records-table th:nth-child(7),
.records-table td:nth-child(7) {
  min-width: 8.5rem;
}

.records-table th:nth-child(8),
.records-table td:nth-child(8) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  text-align: center;
}

.records-owner-cell {
  display: grid;
  gap: 0.15rem;
  color: var(--text-main);
  line-height: 1.35;
}

.records-owner-cell span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.reports-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 1rem 1.5rem 0;
}

.reports-tabs button {
  min-height: 2.25rem;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
  background: #ffffff;
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.reports-tabs button.active,
.reports-tabs button:focus-visible {
  background: #eef2ff;
  color: var(--primary);
}

.reports-grid,
.reports-insights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.report-card,
.report-insight-card {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.report-card-top,
.report-card-footer,
.report-meta,
.report-insight-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.report-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  background: #eef2ff;
  color: var(--primary);
}

.report-favorite {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #94a3b8;
}

.report-favorite.active {
  color: #d97706;
  background: #fef3c7;
}

.report-card-body {
  display: grid;
  gap: 0.35rem;
}

.report-card-body h3,
.report-insight-card h3 {
  color: var(--text-main);
  font-size: 1rem;
  letter-spacing: 0;
}

.report-card-body p,
.report-insight-card p,
.report-meta,
.report-card-footer small,
.report-insight-card span,
.report-insight-card small {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.report-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  min-height: 1.5rem;
}

.report-generate {
  min-height: 2rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

.facility-report-recent,
.facility-report-new,
.facility-report-scheduled,
.facility-report-requires-parameters,
.facility-status-generating {
  background: #e0f2fe;
  color: #075985;
}

.facility-status-ready {
  background: #dcfce7;
  color: #166534;
}

.facility-status-failed,
.facility-status-expired {
  background: #fee2e2;
  color: #991b1b;
}

.facility-report-pdf,
.facility-report-excel,
.facility-report-csv {
  background: #f1f5f9;
  color: #475569;
}

.reports-history-table {
  min-width: 820px;
  table-layout: auto;
}

.reports-history-table th:nth-child(1),
.reports-history-table td:nth-child(1) {
  min-width: 16rem;
}

.reports-history-table th:nth-child(2),
.reports-history-table td:nth-child(2) {
  min-width: 13rem;
}

.reports-history-table th:nth-child(3),
.reports-history-table td:nth-child(3) {
  min-width: 10rem;
}

.reports-history-table th:nth-child(4),
.reports-history-table td:nth-child(4),
.reports-history-table th:nth-child(5),
.reports-history-table td:nth-child(5) {
  min-width: 8rem;
}

.reports-history-table th:nth-child(6),
.reports-history-table td:nth-child(6) {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 4.5rem;
  text-align: center;
}

.admin-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.admin-mobile-picker {
  display: none;
}

.admin-nav-card,
.admin-panel-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.admin-nav-card {
  position: sticky;
  top: 1rem;
  padding: 0.75rem;
}

.admin-category-nav {
  display: grid;
  gap: 0.35rem;
}

.admin-category-nav button,
.admin-role-list button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.5rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: left;
}

.admin-category-nav button.active,
.admin-category-nav button:focus-visible,
.admin-role-list button.active {
  background: #eef2ff;
  color: var(--primary);
}

.admin-panel-card {
  display: flex;
  max-height: calc(100vh - 11rem);
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  padding: 0;
}

.admin-unsaved {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 900;
}

.admin-unsaved span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: #d97706;
}

.admin-panel-content {
  display: grid;
  gap: 1.25rem;
  min-height: 0;
  overflow: auto;
  padding: 1.5rem;
  padding-bottom: 1.75rem;
}

.admin-panel-heading {
  position: sticky;
  top: -1.5rem;
  z-index: 2;
  display: grid;
  gap: 0.35rem;
  margin: -1.5rem -1.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: #ffffff;
  padding: 1.5rem;
}

.admin-panel-heading h2 {
  font-size: 1.25rem;
  letter-spacing: 0;
}

.admin-panel-heading p,
.admin-advisory {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-form-grid,
.admin-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  max-width: 58rem;
}

.admin-form-section {
  display: grid;
  gap: 0.9rem;
  padding-top: 0.15rem;
}

.admin-form-section + .admin-form-section {
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  padding-top: 1.25rem;
}

.admin-form-section h3 {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-management-grid,
.admin-workflow-grid,
.admin-integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-mini-section,
.admin-workflow-card,
.admin-integration-card,
.admin-info-card,
.admin-ai-summary {
  display: grid;
  gap: 0.85rem;
}

.admin-reference-card {
  overflow: hidden;
}

.admin-reference-card-header,
.admin-reference-card-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-reference-card-header {
  justify-content: space-between;
}

.admin-reference-card-title {
  display: grid;
  gap: 0.2rem;
}

.admin-reference-card-title p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.admin-reference-card-actions {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.admin-reference-card-actions button {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.admin-reference-add {
  min-width: 4rem;
}

.admin-reference-table-scroll {
  overflow-x: visible;
}

.admin-reference-table {
  min-width: 0;
  table-layout: fixed;
}

.admin-reference-table th:nth-child(1),
.admin-reference-table td:nth-child(1) {
  width: 58%;
}

.admin-reference-table th:nth-child(2),
.admin-reference-table td:nth-child(2) {
  width: 24%;
}

.admin-reference-table th:nth-child(3),
.admin-reference-table td:nth-child(3) {
  width: 18%;
}

.admin-reference-search {
  max-width: 100%;
}

.admin-reference-empty {
  display: grid;
  place-items: center;
  gap: 0.45rem;
  min-height: 9rem;
  border: 1px dashed rgba(148, 163, 184, 0.32);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 1rem;
  text-align: center;
}

.admin-reference-empty p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-organization-tabs {
  padding: 0;
}

.admin-organization-workspace {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.admin-organization-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(28rem, 0.95fr);
  align-items: flex-start;
  gap: 1.25rem;
}

.admin-organization-header h3 {
  color: var(--text-main);
  font-size: 1.05rem;
  letter-spacing: 0;
}

.admin-organization-header span {
  display: inline-block;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-organization-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  width: 100%;
  min-width: 0;
}

.admin-organization-controls .facility-search-field {
  flex: 1 1 15rem;
}

.admin-organization-workspace .admin-compact-table {
  min-width: 0;
}

.admin-organization-workspace .admin-reference-table th:nth-child(1),
.admin-organization-workspace .admin-reference-table td:nth-child(1) {
  width: 42%;
}

.admin-organization-workspace .admin-reference-table th:nth-child(2),
.admin-organization-workspace .admin-reference-table td:nth-child(2) {
  width: 18%;
}

.admin-organization-workspace .admin-reference-table th:nth-child(3),
.admin-organization-workspace .admin-reference-table td:nth-child(3) {
  width: 22%;
}

.admin-organization-workspace .admin-reference-table th:nth-child(4),
.admin-organization-workspace .admin-reference-table td:nth-child(4),
.admin-organization-workspace .admin-reference-table th:nth-child(5),
.admin-organization-workspace .admin-reference-table td:nth-child(5) {
  width: 18%;
}

.admin-organization-empty {
  margin: 1rem;
}

.admin-mini-section > div,
.admin-workflow-card footer,
.admin-integration-card footer,
.admin-ai-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-compact-table {
  min-width: 720px;
}

.admin-inner-header {
  padding: 0 0 1rem;
  border-bottom: 0;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-toggle input,
.admin-permission-table input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.admin-role-layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 1rem;
}

.admin-role-list {
  display: grid;
  gap: 0.35rem;
  align-self: start;
}

.admin-permission-table {
  min-width: 980px;
  table-layout: auto;
}

.admin-workflow-card div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.admin-workflow-card div span {
  border-radius: var(--radius-full);
  background: #f8fafc;
  padding: 0.35rem 0.65rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-notification-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) repeat(3, auto) minmax(8rem, 0.8fr);
  gap: 0.6rem;
  align-items: center;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  padding-top: 0.65rem;
}

.admin-ai-summary {
  grid-template-columns: minmax(0, 1fr) repeat(3, auto) auto;
  margin-bottom: 1rem;
}

.admin-ai-summary div {
  display: grid;
  gap: 0.15rem;
}

.admin-integration-card dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-info-card span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.admin-info-card strong {
  color: var(--text-main);
}

.admin-panel-actions {
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 3;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.96);
  padding: 1rem 1.5rem;
}

.admin-panel-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.admin-panel-action-buttons button {
  min-width: 8.75rem;
  min-height: 2.5rem;
  justify-content: center;
}

.admin-panel-action-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
  box-shadow: none;
  pointer-events: none;
  visibility: hidden;
}

.admin-org-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.38);
}

.admin-org-modal {
  display: flex;
  width: min(58rem, 100%);
  max-height: min(42rem, calc(100vh - 3rem));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.admin-org-modal header,
.admin-org-modal footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.admin-org-modal header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-org-modal header h2 {
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-org-modal header p {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-org-modal footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: #ffffff;
}

.admin-org-modal footer button {
  min-width: 8.5rem;
  min-height: 2.5rem;
  justify-content: center;
}

.admin-org-modal footer button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
  box-shadow: none;
  pointer-events: none;
}

.admin-org-modal-body {
  display: grid;
  grid-template-columns: minmax(16rem, 0.75fr) minmax(0, 1.25fr);
  gap: 1rem;
  min-height: 0;
  overflow: auto;
  padding: 1.25rem;
}

.admin-org-modal-body-form-only {
  grid-template-columns: 1fr;
}

.admin-org-selector,
.admin-org-edit-form {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  min-width: 0;
}

.admin-org-record-list {
  display: grid;
  gap: 0.45rem;
  max-height: 18rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.admin-org-record-list button {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 0.55rem 0.7rem;
  color: var(--text-main);
  text-align: left;
}

.admin-org-record-list button.selected,
.admin-org-record-list button:hover,
.admin-org-record-list button:focus-visible {
  border-color: rgba(79, 70, 229, 0.36);
  background: #eef2ff;
  outline: none;
}

.admin-org-record-list small,
.admin-org-empty-form p {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.admin-org-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-org-empty-form,
.admin-org-danger {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 1rem;
}

.admin-org-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-color: rgba(220, 38, 38, 0.18);
  background: #fff7f7;
}

.admin-org-danger h3 {
  color: #991b1b;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-org-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.34);
}

.admin-org-drawer {
  display: flex;
  width: min(30rem, 100%);
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  border-left: 1px solid rgba(148, 163, 184, 0.32);
  background: #ffffff;
  box-shadow: -24px 0 70px rgba(15, 23, 42, 0.2);
}

.admin-org-drawer header,
.admin-org-drawer footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.admin-org-drawer header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-org-drawer footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-org-drawer footer button {
  min-width: 8.5rem;
  min-height: 2.5rem;
  justify-content: center;
}

.admin-org-drawer footer button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
  box-shadow: none;
  pointer-events: none;
}

.admin-org-drawer-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.admin-org-drawer-title h2 {
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-org-drawer-title p {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-org-drawer-body {
  display: grid;
  gap: 1rem;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
}

.admin-org-metadata {
  display: grid;
  gap: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 1rem;
}

.admin-org-metadata h3 {
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-org-metadata dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-org-error {
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-org-danger p {
  color: #7f1d1d;
  font-size: 0.78rem;
}

@media (max-width: 1180px) {
  .fam-alert-grid,
  .fam-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fam-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .fam-page-header,
  .facility-page-header,
  .facility-table-header,
  .facility-pagination,
  .facility-header-actions,
  .fam-header-actions,
  .fam-section-heading,
  .fam-kpi-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .facility-header-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .facility-header-controls .facility-search-field {
    width: min(100%, 23.75rem);
  }

  .facility-header-actions > *,
  .facility-header-actions button {
    width: 100%;
  }

  .fam-header-actions > *,
  .fam-header-actions a,
  .fam-header-actions button {
    width: 100%;
  }

  .fam-create-menu-list {
    left: 0;
    right: 0;
  }

  .fam-alert-grid,
  .fam-kpi-grid {
    grid-template-columns: 1fr;
  }

  .fam-operations-grid {
    grid-template-columns: 1fr;
  }

  .facility-requests-table {
    min-width: 680px;
  }

  .facility-requests-table th:nth-child(3),
  .facility-requests-table td:nth-child(3),
  .facility-requests-table th:nth-child(6),
  .facility-requests-table td:nth-child(6),
  .facility-requests-table th:nth-child(7),
  .facility-requests-table td:nth-child(7),
  .facility-requests-table th:nth-child(8),
  .facility-requests-table td:nth-child(8) {
    display: none;
  }

  .facility-requests-table th:nth-child(1),
  .facility-requests-table td:nth-child(1) {
    width: 8rem;
  }

  .facility-requests-table th:nth-child(2),
  .facility-requests-table td:nth-child(2) {
    width: 17rem;
  }

  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(5),
  .facility-requests-table td:nth-child(5) {
    width: 7.5rem;
  }

  .facility-requests-table th:nth-child(9),
  .facility-requests-table td:nth-child(9) {
    width: 4rem;
  }

  .maintenance-requests-table {
    min-width: 680px;
  }

  .maintenance-requests-table th:nth-child(3),
  .maintenance-requests-table td:nth-child(3),
  .maintenance-requests-table th:nth-child(6),
  .maintenance-requests-table td:nth-child(6),
  .maintenance-requests-table th:nth-child(7),
  .maintenance-requests-table td:nth-child(7),
  .maintenance-requests-table th:nth-child(8),
  .maintenance-requests-table td:nth-child(8) {
    display: none;
  }

  .maintenance-requests-table th:nth-child(1),
  .maintenance-requests-table td:nth-child(1) {
    width: 8.5rem;
  }

  .maintenance-requests-table th:nth-child(2),
  .maintenance-requests-table td:nth-child(2) {
    width: 17rem;
  }

  .maintenance-requests-table th:nth-child(4),
  .maintenance-requests-table td:nth-child(4),
  .maintenance-requests-table th:nth-child(5),
  .maintenance-requests-table td:nth-child(5) {
    width: 7.5rem;
  }

  .maintenance-requests-table th:nth-child(9),
  .maintenance-requests-table td:nth-child(9) {
    width: 4rem;
  }

  .asset-management-table {
    min-width: 1180px;
  }

  .asset-management-table th:nth-child(3),
  .asset-management-table td:nth-child(3),
  .asset-management-table th:nth-child(4),
  .asset-management-table td:nth-child(4),
  .asset-management-table th:nth-child(6),
  .asset-management-table td:nth-child(6),
  .asset-management-table th:nth-child(7),
  .asset-management-table td:nth-child(7),
  .asset-management-table th:nth-child(8),
  .asset-management-table td:nth-child(8) {
    display: table-cell;
  }

  .asset-management-table th:nth-child(1),
  .asset-management-table td:nth-child(1) {
    width: 8rem;
  }

  .asset-management-table th:nth-child(2),
  .asset-management-table td:nth-child(2) {
    width: 24%;
  }

  .asset-management-table th:nth-child(5),
  .asset-management-table td:nth-child(5),
  .asset-management-table th:nth-child(6),
  .asset-management-table td:nth-child(6) {
    width: 7.5rem;
  }

  .asset-management-table th:nth-child(9),
  .asset-management-table td:nth-child(9) {
    width: 4rem;
  }

  .reservation-table {
    min-width: 1040px;
  }

  .reservation-calendar-toolbar,
  .reservation-calendar-navigation,
  .reservation-toolbar-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .reservation-calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .reservation-calendar-navigation {
    display: grid;
    grid-template-columns: auto 2.75rem 2.75rem;
    align-items: center;
    justify-content: start;
    gap: 0.65rem;
  }

  .reservation-calendar-navigation h2 {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0 0 0.15rem;
  }

  .reservation-calendar-navigation .facility-page-button,
  .reservation-calendar-navigation .fam-icon-button {
    width: auto;
    min-width: 2.75rem;
    justify-content: center;
  }

  .reservation-toolbar-controls .reservation-view-toggle,
  .reservation-filter-field,
  .reservation-search-field,
  .reservation-search-field input,
  .reservation-filter-field select {
    width: 100%;
  }

  .reservation-calendar {
    min-height: 0;
  }

  .reservation-agenda-day,
  .reservation-focus-row {
    grid-template-columns: 1fr;
  }

  .reservation-focus-row small {
    grid-column: auto;
  }

  .reservation-focus-row .facility-badge {
    justify-self: start;
  }

  .reservation-focus-grid {
    grid-template-columns: 1fr;
  }

  .reservation-table th:nth-child(3),
  .reservation-table td:nth-child(3),
  .reservation-table th:nth-child(5),
  .reservation-table td:nth-child(5),
  .reservation-table th:nth-child(6),
  .reservation-table td:nth-child(6),
  .reservation-table th:nth-child(7),
  .reservation-table td:nth-child(7) {
    display: table-cell;
  }

  .reservation-table th:nth-child(8),
  .reservation-table td:nth-child(8) {
    display: table-cell;
  }

  .procurement-table {
    min-width: 1080px;
  }

  .procurement-table th:nth-child(3),
  .procurement-table td:nth-child(3),
  .procurement-table th:nth-child(6),
  .procurement-table td:nth-child(6),
  .procurement-table th:nth-child(7),
  .procurement-table td:nth-child(7),
  .procurement-table th:nth-child(8),
  .procurement-table td:nth-child(8) {
    display: table-cell;
  }

  .records-table {
    min-width: 980px;
  }

  .records-table th:nth-child(3),
  .records-table td:nth-child(3),
  .records-table th:nth-child(4),
  .records-table td:nth-child(4),
  .records-table th:nth-child(5),
  .records-table td:nth-child(5),
  .records-table th:nth-child(6),
  .records-table td:nth-child(6) {
    display: table-cell;
  }

  .records-table th:nth-child(7),
  .records-table td:nth-child(7),
  .records-table th:nth-child(8),
  .records-table td:nth-child(8) {
    display: table-cell;
  }

  .reports-grid,
  .reports-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-layout {
    grid-template-columns: 13rem minmax(0, 1fr);
  }

  .admin-panel-card {
    max-height: calc(100vh - 10rem);
  }

  .admin-org-drawer {
    width: min(90vw, 30rem);
  }

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

  .admin-management-grid,
  .admin-workflow-grid,
  .admin-integration-grid {
    grid-template-columns: 1fr;
  }

  .admin-ai-summary {
    grid-template-columns: 1fr 1fr;
  }

  .fam-alert-card,
  .fam-activity-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .fam-alert-severity {
    width: auto;
  }

  .fam-chart-box,
  .fam-chart-card:not(.fam-chart-card-wide) .fam-chart-box {
    height: 304px;
  }

  .fam-timeline-item {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}

@media (max-width: 640px) {
  .facility-header-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .facility-header-controls .facility-search-field,
  .facility-header-controls .facility-text-button {
    width: 100%;
  }

  .asset-management-table {
    min-width: 680px;
  }

  .asset-management-table th:nth-child(3),
  .asset-management-table td:nth-child(3),
  .asset-management-table th:nth-child(4),
  .asset-management-table td:nth-child(4),
  .asset-management-table th:nth-child(7),
  .asset-management-table td:nth-child(7),
  .asset-management-table th:nth-child(8),
  .asset-management-table td:nth-child(8) {
    display: none;
  }

  .asset-management-table th:nth-child(1),
  .asset-management-table td:nth-child(1) {
    width: 8rem;
  }

  .asset-management-table th:nth-child(2),
  .asset-management-table td:nth-child(2) {
    width: 17rem;
  }

  .asset-management-table th:nth-child(5),
  .asset-management-table td:nth-child(5),
  .asset-management-table th:nth-child(6),
  .asset-management-table td:nth-child(6) {
    width: 7.5rem;
  }

  .asset-management-table th:nth-child(9),
  .asset-management-table td:nth-child(9) {
    width: 4rem;
  }

  .reservation-table {
    min-width: 700px;
  }

  .reservation-table th:nth-child(3),
  .reservation-table td:nth-child(3),
  .reservation-table th:nth-child(5),
  .reservation-table td:nth-child(5),
  .reservation-table th:nth-child(6),
  .reservation-table td:nth-child(6),
  .reservation-table th:nth-child(7),
  .reservation-table td:nth-child(7) {
    display: none;
  }

  .reservation-table th:nth-child(1),
  .reservation-table td:nth-child(1) {
    width: 8.5rem;
  }

  .reservation-table th:nth-child(2),
  .reservation-table td:nth-child(2) {
    width: 16rem;
  }

  .reservation-table th:nth-child(4),
  .reservation-table td:nth-child(4) {
    width: 10rem;
  }

  .reservation-table th:nth-child(8),
  .reservation-table td:nth-child(8) {
    display: table-cell;
    width: 8rem;
  }

  .reservation-table th:nth-child(9),
  .reservation-table td:nth-child(9) {
    width: 4rem;
  }

  .reservation-view-toggle {
    width: 100%;
  }

  .reservation-view-toggle button {
    flex: 1;
  }

  .reservation-calendar {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .procurement-table {
    min-width: 700px;
  }

  .procurement-table th:nth-child(3),
  .procurement-table td:nth-child(3),
  .procurement-table th:nth-child(6),
  .procurement-table td:nth-child(6),
  .procurement-table th:nth-child(7),
  .procurement-table td:nth-child(7),
  .procurement-table th:nth-child(8),
  .procurement-table td:nth-child(8) {
    display: none;
  }

  .procurement-table th:nth-child(1),
  .procurement-table td:nth-child(1) {
    width: 8.5rem;
  }

  .procurement-table th:nth-child(2),
  .procurement-table td:nth-child(2) {
    width: 17rem;
  }

  .procurement-table th:nth-child(4),
  .procurement-table td:nth-child(4),
  .procurement-table th:nth-child(5),
  .procurement-table td:nth-child(5) {
    width: 8.5rem;
  }

  .procurement-table th:nth-child(9),
  .procurement-table td:nth-child(9) {
    width: 4rem;
  }

  .records-table {
    min-width: 560px;
  }

  .records-table th:nth-child(3),
  .records-table td:nth-child(3),
  .records-table th:nth-child(4),
  .records-table td:nth-child(4),
  .records-table th:nth-child(5),
  .records-table td:nth-child(5),
  .records-table th:nth-child(6),
  .records-table td:nth-child(6) {
    display: none;
  }

  .records-table th:nth-child(7),
  .records-table td:nth-child(7),
  .records-table th:nth-child(8),
  .records-table td:nth-child(8) {
    display: table-cell;
  }

  .records-table th:nth-child(1),
  .records-table td:nth-child(1) {
    width: 9rem;
  }

  .records-table th:nth-child(2),
  .records-table td:nth-child(2) {
    width: 18rem;
  }

  .records-table th:nth-child(7),
  .records-table td:nth-child(7) {
    width: 8rem;
  }

  .records-table th:nth-child(8),
  .records-table td:nth-child(8) {
    width: 4rem;
  }

  .reports-grid,
  .reports-insights-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .report-card-footer,
  .report-insight-card div {
    align-items: stretch;
    flex-direction: column;
  }

  .reports-history-table {
    min-width: 620px;
  }

  .reports-history-table th:nth-child(2),
  .reports-history-table td:nth-child(2),
  .reports-history-table th:nth-child(4),
  .reports-history-table td:nth-child(4) {
    display: none;
  }

  .reports-history-table th:nth-child(1),
  .reports-history-table td:nth-child(1) {
    min-width: 18rem;
  }

  .reports-history-table th:nth-child(3),
  .reports-history-table td:nth-child(3),
  .reports-history-table th:nth-child(5),
  .reports-history-table td:nth-child(5) {
    min-width: 8rem;
  }

  .reports-history-table th:nth-child(6),
  .reports-history-table td:nth-child(6) {
    width: 4rem;
    min-width: 4rem;
    max-width: 4rem;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-mobile-picker {
    display: grid;
  }

  .admin-nav-card {
    display: none;
  }

  .admin-panel-card {
    max-height: none;
    padding: 0;
  }

  .admin-panel-content {
    overflow: visible;
    padding: 1rem;
    padding-bottom: 1.25rem;
  }

  .admin-panel-heading {
    position: static;
    margin: -1rem -1rem 0;
    padding: 1rem;
  }

  .admin-form-grid,
  .admin-info-grid,
  .admin-ai-summary {
    grid-template-columns: 1fr;
  }

  .admin-mini-section > div,
  .admin-workflow-card footer,
  .admin-integration-card footer,
  .admin-ai-summary,
  .admin-panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-reference-card-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .admin-reference-card-actions {
    flex-wrap: nowrap;
  }

  .admin-organization-tabs {
    margin-right: -1rem;
    padding-right: 1rem;
  }

  .admin-organization-header,
  .admin-organization-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-organization-controls {
    min-width: 0;
    width: 100%;
  }

  .admin-organization-controls .facility-search-field {
    flex-basis: auto;
    width: 100%;
  }

  .admin-organization-controls button {
    width: 100%;
  }

  .admin-panel-actions {
    position: sticky;
    bottom: 0;
    padding: 1rem;
  }

  .admin-panel-action-buttons {
    display: flex;
    width: 100%;
    flex-direction: column;
  }

  .admin-panel-action-buttons button {
    width: 100%;
  }

  .admin-notification-row {
    grid-template-columns: 1fr;
  }

  .admin-role-layout {
    grid-template-columns: 1fr;
  }

  .admin-role-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-compact-table {
    min-width: 720px;
  }

  .admin-reference-table {
    min-width: 0;
  }

  .admin-reference-table th:nth-child(1),
  .admin-reference-table td:nth-child(1) {
    width: 50%;
  }

  .admin-organization-workspace .admin-reference-table th:nth-child(1),
  .admin-organization-workspace .admin-reference-table td:nth-child(1) {
    width: 46%;
  }

  .admin-organization-workspace .admin-reference-table th:nth-child(2),
  .admin-organization-workspace .admin-reference-table td:nth-child(2) {
    width: 26%;
  }

  .admin-organization-workspace .admin-reference-table th:nth-child(3),
  .admin-organization-workspace .admin-reference-table td:nth-child(3) {
    width: 28%;
  }

  .admin-organization-workspace .admin-reference-table th:nth-child(4),
  .admin-organization-workspace .admin-reference-table td:nth-child(4),
  .admin-organization-workspace .admin-reference-table th:nth-child(5),
  .admin-organization-workspace .admin-reference-table td:nth-child(5) {
    display: none;
  }

  .admin-org-modal-backdrop {
    align-items: stretch;
    padding: 0.75rem;
  }

  .admin-org-modal {
    width: 100%;
    max-height: calc(100vh - 1.5rem);
  }

  .admin-org-modal-body {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .admin-org-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-org-modal footer,
  .admin-org-danger {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-org-modal footer button {
    width: 100%;
  }

  .admin-org-drawer-backdrop {
    padding: 0;
  }

  .admin-org-drawer {
    width: min(90vw, 30rem);
    border-left: 0;
  }

  .admin-org-drawer header,
  .admin-org-drawer footer {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-org-drawer footer button {
    width: 100%;
  }

  .admin-org-drawer-title {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .admin-org-drawer {
    width: 100%;
  }
}

.notification-bell-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.75rem;
  color: var(--color-on-surface-variant, #64748b);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.notification-bell-button:hover,
.notification-bell-button:focus-visible {
  color: var(--color-on-surface, #0f172a);
  background: var(--color-surface-container-low, #f8fafc);
  border-color: rgba(148, 163, 184, 0.45);
  outline: none;
}

.notification-unread-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.2rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border: 2px solid var(--color-surface, #ffffff);
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 0.8rem;
}

.notification-dropdown-menu {
  position: absolute;
  top: 3.35rem;
  right: clamp(-5.5rem, -12vw, 0rem);
  z-index: 60;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(37.5rem, calc(100vh - 5rem));
  overflow: hidden;
  transform-origin: top right;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 1rem;
  background: var(--color-surface, #ffffff);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  transition: opacity 180ms ease, transform 180ms ease;
}

.notification-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.notification-panel-header h2 {
  margin: 0;
  color: var(--color-on-surface, #0f172a);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.notification-panel-header p {
  margin: 0.2rem 0 0;
  color: var(--color-on-surface-variant, #64748b);
  font-size: 0.75rem;
}

.notification-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notification-panel-actions button,
.notification-panel-actions a,
.notification-card-actions button,
.notification-card-actions a {
  border: 0;
  background: transparent;
  color: var(--color-primary, #2563eb);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.notification-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.notification-tabs button {
  min-height: 2rem;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--color-on-surface-variant, #64748b);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.notification-tabs button.active,
.notification-tabs button:hover,
.notification-tabs button:focus-visible {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-primary, #2563eb);
  outline: none;
}

.notification-list {
  max-height: 27rem;
  overflow-y: auto;
  padding: 0.5rem;
}

.notification-card {
  position: relative;
  border-left: 3px solid transparent;
  border-radius: 0.75rem;
  transition: background 160ms ease, border-color 160ms ease;
}

.notification-card.unread {
  border-left-color: var(--color-primary, #2563eb);
  background: rgba(37, 99, 235, 0.05);
}

.notification-card.read {
  opacity: 0.78;
}

.notification-card:hover,
.notification-card:focus-within {
  background: var(--color-surface-container-low, #f8fafc);
}

.notification-card-main {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 0.5rem 1.25rem;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 0.7rem;
  color: inherit;
  text-decoration: none;
}

.notification-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: rgba(15, 23, 42, 0.06);
  color: var(--color-on-surface-variant, #64748b);
  font-size: 1.15rem;
}

.notification-card-copy {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.notification-card-title {
  color: var(--color-on-surface, #0f172a);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.notification-card-message,
.notification-card-meta {
  color: var(--color-on-surface-variant, #64748b);
  font-size: 0.75rem;
  line-height: 1.35;
}

.notification-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.notification-card-badge {
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--color-on-surface, #0f172a);
  font-size: 0.65rem;
  font-weight: 800;
}

.notification-unread-dot {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--color-primary, #2563eb);
}

.notification-card.read .notification-unread-dot {
  background: transparent;
}

.notification-chevron {
  color: var(--color-on-surface-variant, #64748b);
  font-size: 1.05rem;
}

.notification-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  max-height: 0;
  overflow: hidden;
  padding: 0 0.75rem;
  opacity: 0;
  transition: max-height 160ms ease, opacity 160ms ease, padding 160ms ease;
}

.notification-card:hover .notification-card-actions,
.notification-card:focus-within .notification-card-actions {
  max-height: 2rem;
  padding: 0 0.75rem 0.65rem;
  opacity: 1;
}

.notification-empty-state {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--color-on-surface-variant, #64748b);
}

.notification-empty-state .material-symbols-outlined {
  margin-bottom: 0.65rem;
  color: var(--color-primary, #2563eb);
  font-size: 2.25rem;
}

.notification-empty-state strong {
  color: var(--color-on-surface, #0f172a);
  font-size: 0.95rem;
}

.notification-empty-state p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
}

.notification-skeleton-card {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.8rem 0.7rem;
}

.notification-skeleton-card span,
.notification-skeleton-card div span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.18), rgba(148, 163, 184, 0.34), rgba(148, 163, 184, 0.18));
  background-size: 200% 100%;
  animation: notification-skeleton 1.1s ease-in-out infinite;
}

.notification-skeleton-card > span {
  width: 2rem;
  height: 2rem;
}

.notification-skeleton-card div {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.2rem;
}

.notification-skeleton-card div span:first-child {
  width: 70%;
  height: 0.7rem;
}

.notification-skeleton-card div span:last-child {
  width: 92%;
  height: 0.6rem;
}

@keyframes notification-skeleton {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@media (max-width: 640px) {
  .notification-dropdown-menu {
    position: absolute;
    top: 3.35rem;
    right: -3.25rem;
    width: calc(100vw - 2rem);
    max-height: calc(100vh - 5rem);
    border-radius: 1rem;
    transform-origin: top right;
  }

  .notification-panel-header {
    align-items: stretch;
    flex-direction: column;
    gap: 0.75rem;
  }

  .notification-panel-actions {
    justify-content: flex-start;
  }

  .notification-list {
    max-height: calc(100vh - 14.5rem);
  }
}

.facility-link-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.facility-link-button:hover,
.facility-link-button:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.facility-drawer,
.facility-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.34);
}

.facility-dialog {
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.facility-drawer[hidden],
.facility-dialog[hidden] {
  display: none;
}

.facility-drawer-panel,
.facility-dialog-panel {
  width: min(46rem, 100%);
  height: 100%;
  overflow: auto;
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
}

.facility-dialog-panel {
  height: auto;
  max-height: min(92vh, 52rem);
  border-radius: var(--radius-lg);
}

.facility-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.facility-drawer-header p {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facility-drawer-header h2 {
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 900;
}

.facility-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
  background: #ffffff;
  color: var(--text-main);
  font-size: 1.3rem;
}

.facility-detail-grid,
.facility-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.facility-detail-grid section {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.facility-detail-grid h3 {
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 900;
  margin-bottom: 0.65rem;
}

.facility-detail-wide {
  grid-column: 1 / -1;
}

.facility-detail-row {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.55rem;
}

.facility-detail-row dt {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facility-detail-row dd,
.facility-detail-grid p,
.facility-detail-list,
.facility-history-list {
  color: var(--text-main);
  font-size: 0.875rem;
}

.facility-detail-list,
.facility-history-list {
  display: grid;
  gap: 0.55rem;
  padding-left: 1rem;
}

.facility-history-list span {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.facility-field textarea {
  min-height: 6rem;
  resize: vertical;
}

.facility-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.facility-form-error,
.facility-field-error {
  display: block;
  color: #991b1b;
  font-size: 0.8rem;
  font-weight: 700;
}

.facility-form-error {
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  background: #fef2f2;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .facility-drawer-panel,
  .facility-dialog-panel {
    width: 100%;
    border-radius: 0;
  }

  .facility-detail-grid,
  .facility-form-grid {
    grid-template-columns: 1fr;
  }
}

.facility-action-dropdown { z-index: 90; }

/* Facility Requests live-data layout fixes */
.facility-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.facility-requests-table {
  width: 100%;
  min-width: 1320px;
  table-layout: auto;
  border-collapse: collapse;
}

.facility-requests-table .facility-col-request-no { min-width: 11rem; }
.facility-requests-table .facility-col-subject { min-width: 17rem; }
.facility-requests-table .facility-col-category { min-width: 9rem; }
.facility-requests-table .facility-col-priority { min-width: 7.25rem; }
.facility-requests-table .facility-col-status { min-width: 9rem; }
.facility-requests-table .facility-col-sla { min-width: 9.5rem; }
.facility-requests-table .facility-col-assigned { min-width: 10rem; }
.facility-requests-table .facility-col-submitted { min-width: 10rem; }
.facility-requests-table .facility-col-actions { width: 4.75rem; min-width: 4.75rem; }

.facility-requests-table th,
.facility-requests-table td {
  box-sizing: border-box;
  vertical-align: top;
  overflow: visible;
}

.facility-requests-table td {
  white-space: normal;
  overflow-wrap: break-word;
}

.facility-requests-table th:nth-child(1),
.facility-requests-table td:nth-child(1),
.facility-requests-table th:nth-child(2),
.facility-requests-table td:nth-child(2),
.facility-requests-table th:nth-child(3),
.facility-requests-table td:nth-child(3),
.facility-requests-table th:nth-child(4),
.facility-requests-table td:nth-child(4),
.facility-requests-table th:nth-child(5),
.facility-requests-table td:nth-child(5),
.facility-requests-table th:nth-child(6),
.facility-requests-table td:nth-child(6),
.facility-requests-table th:nth-child(7),
.facility-requests-table td:nth-child(7),
.facility-requests-table th:nth-child(8),
.facility-requests-table td:nth-child(8),
.facility-requests-table th:nth-child(9),
.facility-requests-table td:nth-child(9) {
  width: auto;
}

.facility-requests-table td:nth-child(1),
.facility-request-number,
.facility-request-number strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: normal;
}

.facility-request-number .facility-link-button,
.facility-subject-cell .facility-link-button {
  display: block;
  max-width: 100%;
  white-space: normal;
}

.facility-subject-cell strong {
  display: -webkit-box;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: break-word;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.facility-actions-cell {
  text-align: right;
  white-space: nowrap;
}

.facility-action-menu {
  justify-content: flex-end;
}

.facility-action-dropdown {
  z-index: 130;
}

.facility-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.facility-drawer[hidden] {
  display: none;
}

.facility-drawer-panel {
  position: relative;
  z-index: 121;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(640px, 88vw);
  height: 100dvh;
  overflow: hidden;
  background: #ffffff;
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.22);
  padding: 0;
}

.facility-drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
}

.facility-drawer-header p {
  margin: 0 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.facility-drawer-header .facility-drawer-request-number {
  display: block;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.facility-drawer-header h2 {
  margin: 0.2rem 0 0;
  color: var(--text-main);
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.facility-drawer-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
}

.facility-drawer-close {
  flex: 0 0 auto;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: #ffffff;
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 800;
}

.facility-drawer-close:hover,
.facility-drawer-close:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.facility-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.facility-detail-grid section,
.facility-detail-row dd,
.facility-detail-grid p,
.facility-detail-list,
.facility-history-list {
  overflow-wrap: break-word;
}

body.facility-drawer-open {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .facility-requests-table {
    min-width: 760px;
  }
  .facility-requests-table .facility-col-request-no { width: 180px; }
  .facility-requests-table .facility-col-subject { width: auto; }
  .facility-requests-table .facility-col-priority { width: 118px; }
  .facility-requests-table .facility-col-status { width: 150px; }
  .facility-requests-table .facility-col-actions { width: 76px; }
  .facility-requests-table th:nth-child(3),
  .facility-requests-table td:nth-child(3),
  .facility-requests-table th:nth-child(6),
  .facility-requests-table td:nth-child(6),
  .facility-requests-table th:nth-child(7),
  .facility-requests-table td:nth-child(7),
  .facility-requests-table th:nth-child(8),
  .facility-requests-table td:nth-child(8) {
    display: none;
  }
  .facility-drawer-panel {
    width: min(90vw, 640px);
  }
  .facility-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .facility-requests-table {
    min-width: 620px;
  }
  .facility-requests-table .facility-col-request-no { width: 155px; }
  .facility-requests-table .facility-col-subject { width: auto; }
  .facility-requests-table .facility-col-priority { width: 105px; }
  .facility-requests-table .facility-col-status { width: 130px; }
  .facility-requests-table .facility-col-actions { width: 64px; }
  .facility-requests-table th:nth-child(3),
  .facility-requests-table td:nth-child(3),
  .facility-requests-table th:nth-child(6),
  .facility-requests-table td:nth-child(6),
  .facility-requests-table th:nth-child(7),
  .facility-requests-table td:nth-child(7),
  .facility-requests-table th:nth-child(8),
  .facility-requests-table td:nth-child(8) {
    display: none;
  }
  .facility-drawer-panel {
    width: 100vw;
  }
  .facility-drawer-header {
    padding: 1rem;
  }
  .facility-drawer-body {
    padding: 1rem;
  }
}

#facility-request-drawer[hidden] { display: none !important; pointer-events: none !important; }
#facility-request-drawer:not([hidden]) { pointer-events: auto; }


@media (max-width: 1024px) {
  .facility-requests-table th:nth-child(1),
  .facility-requests-table td:nth-child(1),
  .facility-requests-table th:nth-child(2),
  .facility-requests-table td:nth-child(2),
  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(5),
  .facility-requests-table td:nth-child(5),
  .facility-requests-table th:nth-child(9),
  .facility-requests-table td:nth-child(9) {
    display: table-cell;
  }
}

@media (max-width: 520px) {
  .facility-requests-table th:nth-child(1),
  .facility-requests-table td:nth-child(1),
  .facility-requests-table th:nth-child(2),
  .facility-requests-table td:nth-child(2),
  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(5),
  .facility-requests-table td:nth-child(5),
  .facility-requests-table th:nth-child(9),
  .facility-requests-table td:nth-child(9) {
    display: table-cell;
  }
}

@media (max-width: 1024px) {
  .facility-requests-table th:nth-child(1),
  .facility-requests-table td:nth-child(1),
  .facility-requests-table th:nth-child(2),
  .facility-requests-table td:nth-child(2),
  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(5),
  .facility-requests-table td:nth-child(5),
  .facility-requests-table th:nth-child(9),
  .facility-requests-table td:nth-child(9) {
    display: table-cell !important;
  }
  .facility-requests-table th:nth-child(3),
  .facility-requests-table td:nth-child(3),
  .facility-requests-table th:nth-child(6),
  .facility-requests-table td:nth-child(6),
  .facility-requests-table th:nth-child(7),
  .facility-requests-table td:nth-child(7),
  .facility-requests-table th:nth-child(8),
  .facility-requests-table td:nth-child(8) {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .facility-requests-table .facility-col-category,
  .facility-requests-table .facility-col-sla,
  .facility-requests-table .facility-col-assigned,
  .facility-requests-table .facility-col-submitted {
    visibility: collapse;
    width: 0;
  }
  .facility-requests-table .facility-col-request-no { min-width: 11rem; }
  .facility-requests-table .facility-col-subject { min-width: 16rem; }
  .facility-requests-table .facility-col-priority { min-width: 7.25rem; }
  .facility-requests-table .facility-col-status { min-width: 9rem; }
  .facility-requests-table .facility-col-actions { width: 4.75rem; min-width: 4.75rem; }
  .facility-requests-table { min-width: 784px; }
}

@media (max-width: 520px) {
  .facility-requests-table .facility-col-request-no { min-width: 9.75rem; }
  .facility-requests-table .facility-col-subject { min-width: 14rem; }
  .facility-requests-table .facility-col-priority { min-width: 6.75rem; }
  .facility-requests-table .facility-col-status { min-width: 8rem; }
  .facility-requests-table .facility-col-actions { width: 4rem; min-width: 4rem; }
  .facility-requests-table { min-width: 674px; }
}

@media (max-width: 1024px) {
  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4) {
    display: table-cell !important;
    min-width: 7.25rem;
  }
}

@media (max-width: 520px) {
  .reservation-calendar-weekdays,
  .reservation-month-grid {
    display: none;
  }

  .reservation-calendar-month::before {
    content: 'Use Week or Day for a compact schedule on smaller screens.';
    display: block;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
  }

  .facility-requests-table th:nth-child(4),
  .facility-requests-table td:nth-child(4) {
    min-width: 6.75rem;
  }
}

@media (max-width: 1024px) {
  .facility-requests-table {
    table-layout: auto;
  }
  .facility-requests-table td:nth-child(1),
  .facility-requests-table th:nth-child(1) { min-width: 11rem; }
  .facility-requests-table td:nth-child(2),
  .facility-requests-table th:nth-child(2) { min-width: 16rem; }
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(4) { min-width: 7.25rem; }
  .facility-requests-table td:nth-child(5),
  .facility-requests-table th:nth-child(5) { min-width: 9rem; }
  .facility-requests-table td:nth-child(9),
  .facility-requests-table th:nth-child(9) { min-width: 4.75rem; }
}

@media (max-width: 520px) {
  .facility-requests-table td:nth-child(1),
  .facility-requests-table th:nth-child(1) { min-width: 9.75rem; }
  .facility-requests-table td:nth-child(2),
  .facility-requests-table th:nth-child(2) { min-width: 14rem; }
  .facility-requests-table td:nth-child(4),
  .facility-requests-table th:nth-child(4) { min-width: 6.75rem; }
  .facility-requests-table td:nth-child(5),
  .facility-requests-table th:nth-child(5) { min-width: 8rem; }
  .facility-requests-table td:nth-child(9),
  .facility-requests-table th:nth-child(9) { min-width: 4rem; }
}

/* Facility request details modal */
.facility-details-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 3vw, 2rem);
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
}

.facility-details-modal[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.facility-details-modal-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(980px, 94vw);
  max-height: min(86vh, 860px);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.32);
}

.facility-details-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.facility-details-modal-header p {
  margin: 0 0 0.2rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.facility-details-modal-request-number {
  display: block;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.facility-details-modal-header h2 {
  margin: 0.2rem 0 0;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.facility-details-modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
}

.facility-details-modal-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: #ffffff;
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 800;
}

.facility-details-modal-close:hover,
.facility-details-modal-close:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

body.facility-details-modal-open {
  overflow: hidden;
}

.facility-details-modal .facility-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .facility-details-modal {
    padding: 0;
  }

  .facility-details-modal-panel {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .facility-details-modal .facility-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .facility-details-modal {
    padding: 0.5rem;
  }

  .facility-details-modal-panel {
    width: calc(100vw - 1rem);
    height: calc(100dvh - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 12px;
  }
}

.visitor-details-panel {
  width: min(880px, calc(100vw - 64px));
  max-height: min(var(--modal-shell-max-height), 760px);
  border-radius: 16px;
}

#visitor-details-drawer.facility-details-modal {
  position: fixed !important;
  z-index: 9999 !important;
}

#visitor-details-drawer.facility-details-modal .visitor-details-panel {
  z-index: 10000;
}

.visitor-details-header {
  padding: 1.05rem 1.35rem;
}

.visitor-details-header > div {
  display: grid;
  gap: 0.18rem;
}

.visitor-details-header p {
  margin: 0;
  color: #334155;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.visitor-details-header .facility-details-modal-request-number {
  width: fit-content;
  color: var(--primary, #2563eb);
  font-size: 0.82rem;
  line-height: 1.15;
}

.visitor-details-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.visitor-details-body {
  padding: 1.05rem 1.25rem 1.25rem;
}

.visitor-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1rem;
}

.visitor-detail-accordion {
  display: grid;
  gap: 0.75rem;
}

.visitor-detail-grid section {
  min-height: auto;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #ffffff;
}

.visitor-detail-grid h3 {
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
}

.visitor-detail-grid .facility-detail-row {
  display: grid;
  gap: 0.22rem;
  margin: 0 0 0.72rem;
}

.visitor-detail-grid .facility-detail-row:last-child {
  margin-bottom: 0;
}

.visitor-detail-grid dt {
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visitor-detail-grid dd {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.visitor-detail-grid .facility-detail-wide {
  grid-column: 1 / -1;
}

.visitor-detail-grid .visitor-activity-timeline {
  max-height: 14rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.visitor-detail-disclosure {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.65rem;
  background: #ffffff;
  overflow: hidden;
}

@supports selector(details::details-content) {
  .visitor-detail-disclosure::details-content {
    block-size: 0;
    opacity: 0;
    overflow: clip;
    transition:
      block-size 180ms ease,
      opacity 140ms ease;
    transition-behavior: allow-discrete;
  }

  .visitor-detail-disclosure[open]::details-content {
    block-size: auto;
    opacity: 1;
  }
}

.visitor-detail-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
}

.visitor-detail-disclosure summary::after {
  content: '+';
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease, color 160ms ease;
}

.visitor-detail-disclosure[open] summary::after {
  content: '-';
  color: var(--primary, #2563eb);
  transform: rotate(180deg);
}

.detail-grid,
.visitor-detail-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.6rem;
  margin: 0.15rem 1rem 1rem;
}

.detail-grid .facility-detail-row,
.visitor-detail-content .facility-detail-row {
  min-width: 0;
  margin: 0;
}

.detail-grid .facility-detail-row dt,
.visitor-detail-content .facility-detail-row dt {
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-grid .facility-detail-row dd,
.visitor-detail-content .facility-detail-row dd {
  margin: 0.18rem 0 0;
  color: var(--text-main, #111827);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.detail-grid .detail-item--full,
.detail-grid .facility-detail-wide,
.visitor-detail-content .visitor-detail-item--full,
.visitor-detail-content .facility-detail-wide {
  grid-column: 1 / -1;
}

.facility-detail-grid section > .detail-grid {
  margin: 0;
}

@media (max-width: 1180px) {
  .facility-detail-grid section > .detail-grid {
    grid-template-columns: 1fr;
  }
}

.visitor-detail-disclosure > .facility-detail-row,
.visitor-detail-disclosure p,
.visitor-detail-disclosure .facility-history-list {
  margin: 0 1rem 0.75rem;
}

.visitor-detail-disclosure > .facility-detail-row:first-of-type {
  margin-top: 0.15rem;
}

@media (prefers-reduced-motion: reduce) {
  .visitor-detail-disclosure::details-content,
  .visitor-detail-disclosure summary::after {
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .visitor-details-panel {
    width: calc(100vw - 24px);
    max-height: var(--modal-shell-max-height);
  }

  .visitor-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .detail-grid,
  .visitor-detail-content {
    grid-template-columns: 1fr;
  }
}

/* Keep Facility Request details modal above the global shell/header/sidebar */
#facility-request-drawer.facility-details-modal {
  position: fixed !important;
  z-index: 9999 !important;
  isolation: isolate;
}

#facility-request-drawer.facility-details-modal .facility-details-modal-panel {
  z-index: 10000 !important;
}

body.facility-details-modal-open #app-header-slot,
body.facility-details-modal-open .app-sidebar-slot {
  pointer-events: none;
}

.fam-toast,
#dash-toast-container {
  box-sizing: border-box;
}

#dash-toast-container {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 11000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  pointer-events: none;
}

.fam-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: max-content;
  max-width: min(26rem, calc(100vw - 2rem));
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 0.85rem;
  background: #ffffff;
  color: var(--text-main, #111827);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

.fam-toast-enter {
  opacity: 0;
  transform: translateY(0.75rem);
}

.fam-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 1rem;
  flex: 0 0 auto;
}


.fam-toast-error {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fff7f7;
}

.fam-toast-error .fam-toast-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.fam-toast-error .fam-toast-message {
  color: #991b1b;
}
.fam-toast-message {
  min-width: 0;
  color: var(--text-main, #111827);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.facility-form-error[hidden],
#auth-error[hidden] {
  display: none !important;
}

/* ==========================================================================
   Application Theme System
   ========================================================================== */
:root {
  --color-bg: #fcf8ff;
  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-border: rgba(148, 163, 184, 0.24);
  --color-border-strong: rgba(100, 116, 139, 0.36);
  --color-text: #1b1b24;
  --color-text-muted: #475569;
  --color-text-subtle: #64748b;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: rgba(37, 99, 235, 0.08);
  --color-focus: rgba(37, 99, 235, 0.35);
  --color-shadow: rgba(15, 23, 42, 0.10);
  --color-overlay: rgba(15, 23, 42, 0.52);
  --color-success: #166534;
  --color-success-bg: #dcfce7;
  --color-warning: #92400e;
  --color-warning-bg: #fef3c7;
  --color-danger: #991b1b;
  --color-danger-bg: #fee2e2;
  --color-info: #075985;
  --color-info-bg: #e0f2fe;
}

html[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #0f172a;
  --color-surface: #111c2f;
  --color-surface-elevated: #17233a;
  --color-surface-muted: #1c2942;
  --color-border: rgba(148, 163, 184, 0.18);
  --color-border-strong: rgba(203, 213, 225, 0.28);
  --color-text: #f8fafc;
  --color-text-muted: #cbd5e1;
  --color-text-subtle: #94a3b8;
  --color-primary: #60a5fa;
  --color-primary-hover: #93c5fd;
  --color-primary-soft: rgba(96, 165, 250, 0.13);
  --color-focus: rgba(96, 165, 250, 0.45);
  --color-shadow: rgba(0, 0, 0, 0.34);
  --color-overlay: rgba(2, 6, 23, 0.68);
  --color-success: #86efac;
  --color-success-bg: rgba(34, 197, 94, 0.16);
  --color-warning: #facc15;
  --color-warning-bg: rgba(234, 179, 8, 0.16);
  --color-danger: #fca5a5;
  --color-danger-bg: rgba(239, 68, 68, 0.16);
  --color-info: #7dd3fc;
  --color-info-bg: rgba(14, 165, 233, 0.16);
  --bg-main: var(--color-bg);
  --bg-surface-low: #0b1222;
  --bg-surface: var(--color-surface);
  --bg-surface-high: var(--color-surface-elevated);
  --bg-surface-highest: var(--color-surface-muted);
  --text-main: var(--color-text);
  --text-muted: var(--color-text-muted);
  --text-dim: var(--color-text-subtle);
  --outline: var(--color-border-strong);
  --outline-variant: rgba(148, 163, 184, 0.22);
  --primary: var(--color-primary);
  --primary-hover: var(--color-primary-hover);
  --primary-light: var(--color-primary-soft);
  --primary-container: #2563eb;
  --on-primary-container: #dbeafe;
  --error: var(--color-danger);
  --error-container: var(--color-danger-bg);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.28);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.36);
  --shadow-hover: 0 18px 42px rgba(0, 0, 0, 0.32);
}

html[data-theme='dark'] body,
html[data-theme='dark'] .app-body,
html[data-theme='dark'] .app-main,
html[data-theme='dark'] .bg-background,
html[data-theme='dark'] .bg-surface-container-lowest {
  background: var(--color-bg) !important;
  color: var(--color-text);
}

html[data-theme='dark'] .bg-surface,
html[data-theme='dark'] .bg-white,
html[data-theme='dark'] .fam-card,
html[data-theme='dark'] .fam-table-card,
html[data-theme='dark'] .facility-table-card,
html[data-theme='dark'] .facility-dialog-panel,
html[data-theme='dark'] .facility-details-modal-panel,
html[data-theme='dark'] .notification-dropdown-menu,
html[data-theme='dark'] #profile-dropdown-menu,
html[data-theme='dark'] .facility-action-dropdown,
html[data-theme='dark'] .facility-column-dropdown,
html[data-theme='dark'] .fam-create-menu-list,
html[data-theme='dark'] .report-card,
html[data-theme='dark'] .report-insight-card,
html[data-theme='dark'] .admin-panel,
html[data-theme='dark'] .admin-mini-section,
html[data-theme='dark'] .admin-org-drawer,
html[data-theme='dark'] .facility-details-modal-header,
html[data-theme='dark'] .facility-drawer-header {
  background: var(--color-surface-elevated) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
  box-shadow: 0 18px 42px var(--color-shadow);
}

html[data-theme='dark'] header,
html[data-theme='dark'] .dashboard-sidebar,
html[data-theme='dark'] #app-sidebar,
html[data-theme='dark'] .app-footer,
html[data-theme='dark'] footer {
  background: color-mix(in srgb, var(--color-surface) 88%, transparent) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

html[data-theme='dark'] .sidebar-brand-card,
html[data-theme='dark'] .facility-table-header,
html[data-theme='dark'] .fam-card-header,
html[data-theme='dark'] .notification-panel-header,
html[data-theme='dark'] .reservation-calendar-day,
html[data-theme='dark'] .reservation-calendar-toolbar,
html[data-theme='dark'] .reservation-calendar-card,
html[data-theme='dark'] .reservation-focus-panel,
html[data-theme='dark'] .reservation-day-cell,
html[data-theme='dark'] .reservation-focus-row,
html[data-theme='dark'] .facility-column-menu-group,
html[data-theme='dark'] .admin-section,
html[data-theme='dark'] .admin-tabs,
html[data-theme='dark'] .admin-category-nav,
html[data-theme='dark'] .facility-detail-grid section {
  background: var(--color-surface-muted) !important;
  border-color: var(--color-border) !important;
}

html[data-theme='dark'] .reservation-calendar-overlay {
  background: rgba(15, 23, 42, 0.84);
}

html[data-theme='dark'] .reservation-calendar-weekdays,
html[data-theme='dark'] .reservation-day-cell.muted {
  background: rgba(30, 41, 59, 0.72);
}

html[data-theme='dark'] .reservation-event,
html[data-theme='dark'] .reservation-event-muted,
html[data-theme='dark'] .reservation-event-neutral {
  background: #111827;
}

html[data-theme='dark'] .reservation-event-warning {
  background: rgba(217, 119, 6, 0.14);
}

html[data-theme='dark'] .reservation-event-success {
  background: rgba(22, 163, 74, 0.14);
}

html[data-theme='dark'] .reservation-event-danger {
  background: rgba(220, 38, 38, 0.14);
}

html[data-theme='dark'] .reservation-event-info {
  background: rgba(2, 132, 199, 0.16);
}

html[data-theme='dark'] .reservation-focus-row.reservation-event-warning {
  background: rgba(217, 119, 6, 0.14) !important;
}

html[data-theme='dark'] .reservation-focus-row.reservation-event-success {
  background: rgba(22, 163, 74, 0.14) !important;
}

html[data-theme='dark'] .reservation-focus-row.reservation-event-danger {
  background: rgba(220, 38, 38, 0.14) !important;
}

html[data-theme='dark'] .reservation-focus-row.reservation-event-info {
  background: rgba(2, 132, 199, 0.16) !important;
}

html[data-theme='dark'] .reservation-agenda-day.today {
  background: rgba(59, 130, 246, 0.12);
}

html[data-theme='dark'] h1,
html[data-theme='dark'] h2,
html[data-theme='dark'] h3,
html[data-theme='dark'] h4,
html[data-theme='dark'] .text-on-surface,
html[data-theme='dark'] .facility-title-block h1,
html[data-theme='dark'] .fam-title-block h1,
html[data-theme='dark'] .facility-subject-cell strong,
html[data-theme='dark'] .facility-request-number strong,
html[data-theme='dark'] .notification-card-title {
  color: var(--color-text) !important;
}

html[data-theme='dark'] p,
html[data-theme='dark'] .text-on-surface-variant,
html[data-theme='dark'] .text-outline-variant,
html[data-theme='dark'] .fam-muted,
html[data-theme='dark'] .fam-last-updated,
html[data-theme='dark'] .facility-title-block p,
html[data-theme='dark'] .fam-title-block p,
html[data-theme='dark'] .facility-subject-cell span,
html[data-theme='dark'] .notification-card-message,
html[data-theme='dark'] .notification-card-meta,
html[data-theme='dark'] .facility-date-cell {
  color: var(--color-text-subtle) !important;
}

html[data-theme='dark'] .sidebar-main-link,
html[data-theme='dark'] .sidebar-subsystem-link {
  color: var(--color-text-muted);
}

html[data-theme='dark'] .sidebar-main-link:hover,
html[data-theme='dark'] .sidebar-subsystem-link:hover {
  background: rgba(148, 163, 184, 0.10);
  color: var(--color-text);
}

html[data-theme='dark'] .sidebar-main-link.active,
html[data-theme='dark'] .sidebar-main-link[aria-current='page'],
html[data-theme='dark'] .sidebar-subsystem-link.active,
html[data-theme='dark'] .sidebar-subsystem-link[aria-current='page'] {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

html[data-theme='dark'] .sidebar-main-link-icon,
html[data-theme='dark'] .sidebar-subsystem-link-icon,
html[data-theme='dark'] .material-symbols-outlined {
  color: currentColor;
}

html[data-theme='dark'] table,
html[data-theme='dark'] tbody,
html[data-theme='dark'] tr,
html[data-theme='dark'] td {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border) !important;
}

html[data-theme='dark'] thead,
html[data-theme='dark'] th {
  background: var(--color-surface-muted) !important;
  color: var(--color-text-muted) !important;
  border-color: var(--color-border) !important;
}

html[data-theme='dark'] tbody tr:hover {
  background: rgba(148, 163, 184, 0.08) !important;
}

html[data-theme='dark'] input,
html[data-theme='dark'] select,
html[data-theme='dark'] textarea,
html[data-theme='dark'] .facility-field input,
html[data-theme='dark'] .facility-field select,
html[data-theme='dark'] .facility-field textarea {
  background: var(--color-surface) !important;
  border-color: var(--color-border-strong) !important;
  color: var(--color-text) !important;
}

html[data-theme='dark'] input::placeholder,
html[data-theme='dark'] textarea::placeholder {
  color: var(--color-text-subtle) !important;
}

html[data-theme='dark'] input:focus,
html[data-theme='dark'] select:focus,
html[data-theme='dark'] textarea:focus,
html[data-theme='dark'] button:focus-visible,
html[data-theme='dark'] a:focus-visible {
  outline-color: var(--color-focus) !important;
  box-shadow: 0 0 0 3px var(--color-focus) !important;
}

html[data-theme='dark'] input:-webkit-autofill,
html[data-theme='dark'] input:-webkit-autofill:hover,
html[data-theme='dark'] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-text);
  box-shadow: 0 0 0 1000px var(--color-surface) inset;
}

html[data-theme='dark'] .btn-secondary,
html[data-theme='dark'] .dashboard-action-button:not(.btn-primary),
html[data-theme='dark'] .fam-icon-button,
html[data-theme='dark'] .notification-bell-button,
html[data-theme='dark'] .facility-action-toggle,
html[data-theme='dark'] .facility-column-trigger,
html[data-theme='dark'] .facility-text-button,
html[data-theme='dark'] .reservation-view-toggle,
html[data-theme='dark'] .reports-tabs button,
html[data-theme='dark'] .admin-category-nav button,
html[data-theme='dark'] .admin-role-list button {
  background: var(--color-surface-muted) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-muted) !important;
}

html[data-theme='dark'] .btn-secondary:hover,
html[data-theme='dark'] .dashboard-action-button:not(.btn-primary):hover,
html[data-theme='dark'] .fam-icon-button:hover,
html[data-theme='dark'] .notification-bell-button:hover,
html[data-theme='dark'] .facility-action-toggle:hover,
html[data-theme='dark'] .facility-column-trigger:hover,
html[data-theme='dark'] .facility-text-button:hover,
html[data-theme='dark'] .facility-action-dropdown button:hover,
html[data-theme='dark'] .facility-column-dropdown button:hover,
html[data-theme='dark'] #profile-dropdown-menu a:hover,
html[data-theme='dark'] #profile-dropdown-menu button:hover {
  background: rgba(148, 163, 184, 0.12) !important;
  color: var(--color-text) !important;
}

html[data-theme='dark'] .facility-details-modal,
html[data-theme='dark'] .facility-drawer,
html[data-theme='dark'] .admin-org-drawer-backdrop,
html[data-theme='dark'] #sidebar-backdrop {
  background: var(--color-overlay) !important;
}

html[data-theme='dark'] .facility-empty-state,
html[data-theme='dark'] .fam-state,
html[data-theme='dark'] .notification-empty-state {
  background: var(--color-surface-muted) !important;
  color: var(--color-text-muted) !important;
  border-color: var(--color-border) !important;
}

html[data-theme='dark'] .facility-badge,
html[data-theme='dark'] .fam-status-badge {
  border: 1px solid currentColor;
}

html[data-theme='dark'] .facility-status-open,
html[data-theme='dark'] .facility-status-due-soon,
html[data-theme='dark'] .facility-status-scheduled,
html[data-theme='dark'] .facility-status-checked-in,
html[data-theme='dark'] .facility-status-checked-out,
html[data-theme='dark'] .facility-sla-on-track,
html[data-theme='dark'] .fam-status-info {
  background: var(--color-info-bg) !important;
  color: var(--color-info) !important;
}

html[data-theme='dark'] .facility-status-completed,
html[data-theme='dark'] .facility-status-approved,
html[data-theme='dark'] .facility-approval-approved,
html[data-theme='dark'] .facility-condition-good,
html[data-theme='dark'] .facility-condition-excellent,
html[data-theme='dark'] .fam-status-completed,
html[data-theme='dark'] .fam-status-success {
  background: var(--color-success-bg) !important;
  color: var(--color-success) !important;
}

html[data-theme='dark'] .facility-status-on-hold,
html[data-theme='dark'] .facility-status-needs-attention,
html[data-theme='dark'] .facility-condition-fair,
html[data-theme='dark'] .facility-condition-for-inspection,
html[data-theme='dark'] .facility-status-pending-approval,
html[data-theme='dark'] .facility-status-submitted,
html[data-theme='dark'] .facility-status-draft,
html[data-theme='dark'] .fam-status-warning,
html[data-theme='dark'] .fam-status-pending {
  background: var(--color-warning-bg) !important;
  color: var(--color-warning) !important;
}

html[data-theme='dark'] .facility-status-cancelled,
html[data-theme='dark'] .facility-status-not-required,
html[data-theme='dark'] .fam-status-inactive {
  background: rgba(148, 163, 184, 0.16) !important;
  color: var(--color-on-surface-variant, #cbd5e1) !important;
}

html[data-theme='dark'] .facility-status-overdue,
html[data-theme='dark'] .facility-status-rejected,
html[data-theme='dark'] .facility-condition-poor,
html[data-theme='dark'] .facility-condition-critical,
html[data-theme='dark'] .fam-status-critical {
  background: var(--color-danger-bg) !important;
  color: var(--color-danger) !important;
}

.theme-segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  padding: 0.2rem;
}

.theme-segmented-control button {
  min-height: 2rem;
  border-radius: calc(var(--radius-lg) - 0.2rem);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.theme-segmented-control button:hover {
  color: var(--color-text);
  background: rgba(148, 163, 184, 0.12);
}

.theme-segmented-control button.active,
.theme-segmented-control button[aria-pressed='true'] {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

html[data-theme='dark'] ::-webkit-scrollbar-track {
  background: var(--color-bg);
}
html[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.34);
}
html[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  html,
  html[data-theme='dark'] {
    color-scheme: light;
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    --color-text: #111827;
    --color-text-muted: #374151;
  }
  body { background: #ffffff !important; color: #111827 !important; }
}

html[data-theme='dark'] .auth-shell,
html[data-theme='dark'] body.bg-surface-container-low {
  background: var(--color-bg) !important;
  color: var(--color-text) !important;
}

html[data-theme='dark'] .auth-card,
html[data-theme='dark'] main.bg-surface-container-lowest {
  background: var(--color-surface-elevated) !important;
  border-color: var(--color-border) !important;
  box-shadow: 0 22px 48px var(--color-shadow) !important;
}

html[data-theme='dark'] .auth-title,
html[data-theme='dark'] .auth-card h1,
html[data-theme='dark'] main.bg-surface-container-lowest h1 {
  color: var(--color-text) !important;
}

html[data-theme='dark'] .auth-subtitle,
html[data-theme='dark'] .auth-label,
html[data-theme='dark'] .auth-card label,
html[data-theme='dark'] main.bg-surface-container-lowest p,
html[data-theme='dark'] main.bg-surface-container-lowest label {
  color: var(--color-text-muted) !important;
}

/* Operational data table standardization */
.facility-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.facility-requests-table,
.admin-compact-table,
.admin-permission-table,
.dashboard-pending-table {
  width: 100%;
  table-layout: fixed;
}

.facility-requests-table th,
.facility-requests-table td,
.admin-compact-table th,
.admin-compact-table td,
.admin-permission-table th,
.admin-permission-table td,
.dashboard-pending-table th,
.dashboard-pending-table td {
  min-width: 0;
  vertical-align: middle;
}

.facility-requests-table th,
.admin-compact-table th,
.admin-permission-table th,
.dashboard-pending-table th {
  white-space: nowrap;
}

col.table-col-reference { width: 10rem; }
col.table-col-subject { width: 18rem; }
col.table-col-visitor { width: 16rem; }
col.table-col-purpose { width: 18rem; }
col.table-col-category { width: 9rem; }
col.table-col-type { width: 8rem; }
col.table-col-department { width: 11rem; }
col.table-col-person { width: 11rem; }
col.table-col-datetime { width: 10.5rem; }
col.table-col-status { width: 8.5rem; }
col.table-col-priority { width: 7rem; }
col.table-col-code { width: 8rem; }
col.table-col-amount { width: 9rem; }
col.table-col-actions { width: 4.75rem; }

.table-cell-truncate,
.table-cell-primary,
.table-cell-secondary,
.facility-column-label,
.facility-sort-button,
.facility-column-trigger > span:first-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-cell-primary {
  color: var(--text-main);
  font-weight: 700;
}

.table-cell-secondary {
  margin-top: 0.18rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.table-cell-stack,
.facility-subject-cell,
.visitor-name-cell,
.asset-name-cell,
.procurement-origin-cell,
.procurement-requester-cell,
.records-owner-cell {
  min-width: 0;
}

.facility-actions-cell,
.facility-requests-table th:last-child,
.admin-compact-table th:last-child {
  text-align: center;
  white-space: nowrap;
}

.facility-actions-cell .facility-action-menu,
.facility-actions-cell .facility-action-toggle {
  margin-inline: auto;
}

.facility-badge,
.facility-sla,
.facility-action-toggle {
  max-width: 100%;
  white-space: nowrap;
}

.visitor-management-table {
  table-layout: fixed;
}

.asset-management-table col:nth-child(1) { width: 13%; }
.asset-management-table col:nth-child(2) { width: 24%; }
.asset-management-table col:nth-child(3) { width: 15%; }
.asset-management-table col:nth-child(4) { width: 20%; }
.asset-management-table col:nth-child(5) { width: 13%; }
.asset-management-table col:nth-child(6) { width: 15%; }
.asset-management-table col:nth-child(7) { width: 4.75rem; }

.asset-management-table th,
.asset-management-table td {
  overflow: hidden;
}

.asset-management-table th:nth-child(7),
.asset-management-table td:nth-child(7) {
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 1.15rem;
}

.maintenance-requests-table col:nth-child(1) { width: 13%; }
.maintenance-requests-table col:nth-child(2) { width: 22%; }
.maintenance-requests-table col:nth-child(3) { width: 18%; }
.maintenance-requests-table col:nth-child(4) { width: 11%; }
.maintenance-requests-table col:nth-child(5) { width: 13%; }
.maintenance-requests-table col:nth-child(6) { width: 23%; }
.maintenance-requests-table col:nth-child(7) { width: 4.75rem; }

.maintenance-requests-table th,
.maintenance-requests-table td {
  overflow: hidden;
}

.maintenance-requests-table th:nth-child(7),
.maintenance-requests-table td:nth-child(7) {
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 1.15rem;
}

.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(1) { width: 13%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(2) { width: 27%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(3) { width: 17%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(4) { width: 11%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(5) { width: 13%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(6) { width: 19%; }
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table col:nth-child(7) { width: 4.75rem; }

.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table th,
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table td {
  overflow: hidden;
}

.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table th:nth-child(7),
.facility-requests-workspace:not(.maintenance-workspace):not(.asset-management-workspace):not(.reservation-workspace):not(.procurement-workspace):not(.records-workspace):not(.visitor-management-workspace):not(.visitor-scanner-workspace):not(.reports-workspace):not(.admin-workspace) .facility-requests-table td:nth-child(7) {
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 1.15rem;
}

@media (max-width: 760px) {
  .visitor-management-table {
    min-width: 38rem;
  }

  .visitor-management-table col:nth-child(3),
  .visitor-management-table col:nth-child(4),
  .visitor-management-table col:nth-child(5),
  .visitor-management-table col:nth-child(6),
  .visitor-management-table th:nth-child(3),
  .visitor-management-table td:nth-child(3),
  .visitor-management-table th:nth-child(4),
  .visitor-management-table td:nth-child(4),
  .visitor-management-table th:nth-child(5),
  .visitor-management-table td:nth-child(5),
  .visitor-management-table th:nth-child(6),
  .visitor-management-table td:nth-child(6) {
    display: none !important;
  }

  .visitor-management-table col:nth-child(1) { width: 10rem; }
  .visitor-management-table col:nth-child(2) { width: 16rem; }
  .visitor-management-table col:nth-child(7) { width: 7.5rem; }
  .visitor-management-table col:nth-child(8) { width: 4.5rem; }
}






.visitor-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.visitor-summary-strip span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-md);
  background: var(--surface-card, #fff);
  padding: 0.55rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.visitor-summary-strip strong { color: var(--text-main); font-size: 0.95rem; }
.visitor-table-header { align-items: flex-end; row-gap: 0.85rem; }
.visitor-records-toolbar {
  display: grid;
  grid-template-columns: minmax(18rem, 2fr) repeat(2, minmax(10rem, 1fr));
  gap: 0.75rem;
  align-items: center;
}
.visitor-check-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}
.visitor-name-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}
.visitor-name-cell strong,
.visitor-name-cell span {
  display: block;
  max-width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}
.visitor-management-table { min-width: 1120px; table-layout: auto; }
.visitor-management-table th:nth-child(1), .visitor-management-table td:nth-child(1) { min-width: 10rem; }
.visitor-management-table th:nth-child(2), .visitor-management-table td:nth-child(2) { min-width: 15rem; }
.visitor-management-table th:nth-child(3), .visitor-management-table td:nth-child(3) { min-width: 8rem; }
.visitor-management-table th:nth-child(4), .visitor-management-table td:nth-child(4) { min-width: 11rem; }
.visitor-management-table th:nth-child(5), .visitor-management-table td:nth-child(5),
.visitor-management-table th:nth-child(6), .visitor-management-table td:nth-child(6) { min-width: 11.5rem; }
.visitor-management-table th:nth-child(7), .visitor-management-table td:nth-child(7) { min-width: 8.5rem; }
.visitor-management-table th:nth-child(8), .visitor-management-table td:nth-child(8) { width: 4.5rem; min-width: 4.5rem; max-width: 4.5rem; text-align: center; }
.visitor-management-table th:nth-child(8) { padding-left: 0.5rem; padding-right: 0.5rem; }
.visitor-management-table td:nth-child(8).facility-actions-cell { text-align: center; }
.visitor-management-table .facility-actions-cell .facility-action-menu { display: inline-flex; justify-content: center; }
.visitor-management-table .facility-action-toggle { margin: 0 auto; }
.visitor-management-table th,
.visitor-management-table td { padding-left: 0.95rem; padding-right: 0.95rem; }
.visitor-management-table td:nth-child(4) {
  word-break: normal;
  overflow-wrap: break-word;
}
.visitor-management-table td:nth-child(5),
.visitor-management-table td:nth-child(6) {
  word-break: normal;
  overflow-wrap: normal;
}

.visitor-scanner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.38fr);
  gap: 1.5rem;
  align-items: start;
}
.scanner-panel { order: 2; }
.resolved-panel { order: 1; }
.scanner-card { display: grid; gap: 1.25rem; padding: 1.25rem; }
.scanner-card-header h2 { margin: 0; font-size: 1.1rem; }
.scanner-card-header p,
.scanner-manual-copy p {
  margin: 0.25rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.scanner-camera-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  max-height: 520px;
  overflow: hidden;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 1rem;
  background: var(--surface-container, #f8fafc);
}
.scanner-camera-frame video {
  width: 100%;
  height: min(54vh, 420px);
  object-fit: cover;
  background: #111827;
}
.scanner-camera-frame video[hidden],
.scanner-empty-state[hidden] {
  display: none !important;
}
.scanner-empty-state {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  max-width: 24rem;
  padding: 1rem;
  text-align: center;
  color: var(--text-muted, #64748b);
}
.scanner-empty-state .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 1rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 2.25rem;
}
.scanner-empty-state strong {
  color: var(--text-main, #111827);
  font-size: 1.3rem;
}
.scanner-empty-state p { margin: 0; line-height: 1.45; }
.scanner-frame-guide,
.scanner-scan-line {
  display: none;
  position: absolute;
  pointer-events: none;
}
.scanner-camera-frame.is-active .scanner-frame-guide,
.scanner-camera-frame.is-active .scanner-scan-line { display: block; }
.scanner-frame-guide {
  position: absolute;
  inset: 18%;
}
.scanner-camera-frame.is-active .scanner-frame-guide {
  inset: 16% 18% 24%;
}
.scanner-frame-guide span {
  position: absolute;
  width: 2.4rem;
  height: 2.4rem;
  border-color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.45));
}
.scanner-frame-guide span:nth-child(1) { top: 0; left: 0; border-top: 3px solid; border-left: 3px solid; border-radius: 0.5rem 0 0 0; }
.scanner-frame-guide span:nth-child(2) { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; border-radius: 0 0.5rem 0 0; }
.scanner-frame-guide span:nth-child(3) { bottom: 0; left: 0; border-bottom: 3px solid; border-left: 3px solid; border-radius: 0 0 0 0.5rem; }
.scanner-frame-guide span:nth-child(4) { right: 0; bottom: 0; border-right: 3px solid; border-bottom: 3px solid; border-radius: 0 0 0.5rem 0; }
.scanner-scan-line {
  left: 22%;
  right: 22%;
  top: 24%;
  height: 2px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.65);
  animation: scanner-line 2.4s ease-in-out infinite;
}
.scanner-status-card {
  position: absolute !important;
  display: block;
  grid-template-columns: auto 1fr;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.scanner-status-card .material-symbols-outlined { color: var(--primary, #2563eb); }
.scanner-status-card.is-success .material-symbols-outlined { color: #15803d; }
.scanner-status-card.is-error .material-symbols-outlined { color: #b91c1c; }
.scanner-status-card strong {
  display: block;
  color: var(--text-main, #111827);
  font-size: 0.95rem;
}
.scanner-status-card p {
  margin: 0.2rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
  line-height: 1.4;
}
.scanner-action-row,
.scanner-manual-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}
.scanner-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.scanner-controls .dashboard-action-button {
  width: 100%;
  justify-content: center;
}
.scanner-manual-form {
  padding-top: 1rem;
  border-top: 1px solid var(--outline-variant, #d6dbe6);
}
.scanner-manual-copy { flex: 1 1 100%; }
.scanner-manual-copy h3 { margin: 0; font-size: 0.95rem; }
.scanner-manual-form .facility-field { flex: 1 1 260px; }
.scanner-result-card { min-height: 260px; }
.scanner-result-card { padding: 1.35rem; }
.scanner-result-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.65rem;
  min-height: 30rem;
  color: var(--text-muted, #64748b);
  text-align: center;
}
.scanner-result-empty .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 2rem;
}
.scanner-result-empty h2 { margin: 0; color: var(--text-main, #111827); font-size: 1.35rem; }
.scanner-result-empty p { margin: 0; max-width: 24rem; }
.scanner-result-empty ol {
  display: grid;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  text-align: left;
}
.scanner-visitor-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
}
.scanner-visitor-hero p {
  margin: 0 0 0.25rem;
  color: var(--on-surface-variant, #475569);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
}
.scanner-visitor-hero h2 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.35rem); line-height: 1.1; }
.scanner-visitor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.scanner-visitor-meta span {
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 700;
}
.scanner-summary-card {
  padding: 1.2rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.875rem;
  background: var(--surface-container-low, #f8fafc);
}
.scanner-summary-card dl,
.scanner-modal-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin: 0;
}
.scanner-summary-card div,
.scanner-modal-facts div { display: grid; gap: 0.2rem; min-width: 0; }
.scanner-summary-card dt,
.scanner-modal-facts dt {
  color: var(--text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.scanner-summary-card dd,
.scanner-modal-facts dd {
  margin: 0;
  color: var(--text-main, #111827);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.scanner-secondary-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.15rem;
}
.scanner-secondary-grid details {
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.875rem;
  padding: 1rem 1.15rem;
  background: var(--surface-container-lowest, #fff);
}
.scanner-secondary-grid summary {
  color: var(--text-main, #111827);
  font-weight: 800;
  cursor: pointer;
}
.scanner-secondary-grid .facility-detail-row:first-of-type { margin-top: 0.75rem; }
.scanner-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.scanner-detail-grid section {
  padding: 1.15rem;
  min-height: 10rem;
}
.scanner-detail-grid .facility-detail-row {
  margin-bottom: 0.8rem;
}
.scanner-detail-grid .facility-detail-row:last-child {
  margin-bottom: 0;
}
.scanner-action-panel {
  position: sticky;
  bottom: 1rem;
  margin-top: 1.25rem;
  padding: 1.2rem;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 0.875rem;
  background: var(--surface-container-low, #f8fafc);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}
.scanner-action-panel h3 { margin: 0 0 0.45rem; font-size: 1.12rem; }
.scanner-action-panel p,
.scanner-dialog-copy {
  margin: 0;
  color: var(--on-surface-variant, #475569);
}
.scanner-action-eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--primary, #2563eb);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.scanner-danger-button,
.scanner-danger-primary {
  border-color: #fecaca !important;
  color: #991b1b !important;
}
.scanner-danger-primary {
  background: #b91c1c !important;
  color: #fff !important;
}
.scanner-modal-panel { width: min(40rem, 100%); }
.scanner-modal-body {
  display: grid;
  gap: 1rem;
}
.scanner-modal-visitor {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.875rem;
  background: var(--surface-container-low, #f8fafc);
}
.scanner-modal-visitor strong { color: var(--text-main, #111827); font-size: 1.05rem; }
.scanner-modal-visitor span { color: var(--text-muted, #64748b); font-size: 0.88rem; }
.scanner-modal-section {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.875rem;
}
.scanner-modal-section h3 { margin: 0; font-size: 0.95rem; }

.visitor-reception-workspace .facility-page-header {
  align-items: center;
}

.reception-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(20rem, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.reception-side-column {
  display: grid;
  gap: 1rem;
}

.reception-card {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.reception-form {
  display: grid;
  gap: 1rem;
}

.reception-inline-actions {
  padding: 0;
  border: 0;
  background: transparent;
}

.reception-id-scan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.reception-id-scan-row .scanner-dialog-copy {
  margin: 0;
}

.reception-id-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  padding: 0.4rem 0.65rem;
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: 999px;
  background: rgba(220, 252, 231, 0.75);
  color: #166534;
  font-size: 0.82rem;
  font-weight: 700;
}

.reception-id-confirmed[hidden] {
  display: none !important;
}

.reception-id-confirmed .material-symbols-outlined {
  font-size: 1rem;
}

.id-capture-panel {
  width: min(44rem, calc(100vw - 2rem));
}

.id-capture-body {
  display: grid;
  gap: 1rem;
}

.id-camera-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.9rem;
  background: #020617;
}

.id-camera-frame video,
.id-captured-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.id-captured-image {
  max-height: 24rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.9rem;
  background: var(--surface-container-low, #f8fafc);
}

.id-review-layout {
  display: grid;
  gap: 1rem;
}

.id-review-layout .id-captured-image {
  aspect-ratio: 16 / 10;
  max-height: 18rem;
}

.id-diagnostics-panel {
  padding: 0.9rem;
  border: 1px dashed var(--outline-variant, #cbd5e1);
  border-radius: 0.85rem;
  background: var(--surface-container-low, #f8fafc);
}

.id-diagnostics-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.id-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
}

.id-diagnostics-grid span {
  display: block;
  color: var(--text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.id-diagnostics-grid strong {
  display: block;
  color: var(--text-main, #111827);
  font-size: 0.86rem;
}

.id-frame-guide {
  position: absolute;
  inset: 1.6rem;
  pointer-events: none;
}

.id-frame-guide span {
  position: absolute;
  width: 3.25rem;
  height: 2.25rem;
  color: rgba(255, 255, 255, 0.85);
}

.id-frame-guide span:nth-child(1) { top: 0; left: 0; border-top: 3px solid; border-left: 3px solid; border-radius: 0.55rem 0 0 0; }
.id-frame-guide span:nth-child(2) { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; border-radius: 0 0.55rem 0 0; }
.id-frame-guide span:nth-child(3) { bottom: 0; left: 0; border-bottom: 3px solid; border-left: 3px solid; border-radius: 0 0 0 0.55rem; }
.id-frame-guide span:nth-child(4) { right: 0; bottom: 0; border-right: 3px solid; border-bottom: 3px solid; border-radius: 0 0 0.55rem 0; }

.id-capture-status,
.id-capture-empty {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border-subtle, #dbe3ef);
  border-radius: 0.85rem;
  background: var(--surface-container-low, #f8fafc);
}

.id-capture-status strong,
.id-capture-empty h3 {
  margin: 0;
  color: var(--text-main, #111827);
}

.id-capture-status p,
.id-capture-empty p {
  margin: 0.15rem 0 0;
  color: var(--text-muted, #64748b);
  line-height: 1.45;
}

.id-capture-status .material-symbols-outlined,
.id-capture-empty .material-symbols-outlined {
  color: var(--primary, #4f46e5);
}

.id-capture-empty {
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  text-align: center;
}

.id-capture-empty .material-symbols-outlined {
  font-size: 2rem;
}

.id-processing-icon {
  animation: fam-soft-spin 1.1s linear infinite;
}

.id-ocr-raw-text {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-subtle, #dbe3ef);
  border-radius: 0.8rem;
  background: var(--surface-container-low, #f8fafc);
}

.id-ocr-raw-text summary {
  cursor: pointer;
  font-weight: 800;
}

.id-ocr-raw-text pre {
  max-height: 12rem;
  overflow: auto;
  margin: 0.75rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-main, #111827);
  font: inherit;
}

@keyframes fam-soft-spin {
  to { transform: rotate(360deg); }
}

.reception-badge-return-card {
  border-top: 3px solid rgba(79, 70, 229, 0.3);
}

.reception-badge-summary {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--border-subtle, #dbe3ef);
  border-radius: 0.75rem;
  background: var(--surface-container-low, #f8fafc);
}

.reception-badge-summary[hidden] {
  display: none !important;
}

.reception-badge-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.reception-badge-summary h3,
.reception-badge-summary p {
  margin: 0;
}

.reception-badge-summary h3 {
  font-size: 1rem;
}

.reception-badge-summary p {
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
}

.reception-badge-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.reception-badge-summary dt {
  color: var(--text-muted, #64748b);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reception-badge-summary dd {
  margin: 0.15rem 0 0;
  color: var(--text-main, #111827);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
@keyframes scanner-line {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(8rem); opacity: 0.95; }
}
@media (prefers-reduced-motion: reduce) {
  .scanner-scan-line { animation: none; }
}
@media (max-width: 760px) {
  .visitor-records-toolbar,
  .visitor-records-toolbar .facility-search-field,
  .visitor-records-toolbar .document-filter-field {
    width: 100%;
    justify-content: stretch;
  }
  .visitor-management-table { min-width: 560px; }
  .visitor-management-table th:nth-child(3), .visitor-management-table td:nth-child(3),
  .visitor-management-table th:nth-child(4), .visitor-management-table td:nth-child(4),
  .visitor-management-table th:nth-child(5), .visitor-management-table td:nth-child(5),
  .visitor-management-table th:nth-child(6), .visitor-management-table td:nth-child(6) { display: none !important; }
  .visitor-management-table th:nth-child(7), .visitor-management-table td:nth-child(7),
  .visitor-management-table th:nth-child(8), .visitor-management-table td:nth-child(8) { display: table-cell !important; }
  .visitor-scanner-grid, .scanner-summary-card dl, .scanner-modal-facts { grid-template-columns: 1fr; }
  .scanner-panel, .resolved-panel { order: initial; }
  .scanner-camera-frame { min-height: 220px; }
  .scanner-controls .dashboard-action-button,
  .scanner-action-panel .dashboard-action-button { width: 100%; justify-content: center; }
  .scanner-action-panel { position: static; }
  .scanner-visitor-hero { display: grid; }
  .scanner-dialog .facility-dialog-panel { width: calc(100vw - 1rem); max-height: var(--modal-shell-max-height); border-radius: 12px; }
  .reception-console-grid { grid-template-columns: 1fr; }
  .reception-id-scan-row { align-items: stretch; flex-direction: column; }
  .reception-id-scan-row .dashboard-action-button { width: 100%; justify-content: center; }
  .id-capture-panel { width: calc(100vw - 1rem); }
  .id-camera-frame { aspect-ratio: 4 / 3; }
  .id-frame-guide { inset: 1rem; }
  .id-diagnostics-grid { grid-template-columns: 1fr; }
  .reception-badge-summary dl { grid-template-columns: 1fr; }
  .reception-badge-summary .dashboard-action-button { width: 100%; justify-content: center; }
}

.visitor-management-table {
  table-layout: fixed;
}

.records-table col:nth-child(1) { width: 14%; }
.records-table col:nth-child(2) { width: 30%; }
.records-table col:nth-child(3) { width: 17%; }
.records-table col:nth-child(4) { width: 15%; }
.records-table col:nth-child(5) { width: 16%; }
.records-table col:nth-child(6) { width: 8%; }
.records-table col:nth-child(7) { width: 4.75rem; }

.records-table th,
.records-table td {
  overflow: hidden;
}

.records-table th:nth-child(7),
.records-table td:nth-child(7) {
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 1.15rem;
}

.procurement-table col:nth-child(1) { width: 13%; }
.procurement-table col:nth-child(2) { width: 32%; }
.procurement-table col:nth-child(3) { width: 11%; }
.procurement-table col:nth-child(4) { width: 13%; }
.procurement-table col:nth-child(5) { width: 15%; }
.procurement-table col:nth-child(6) { width: 16%; }
.procurement-table col:nth-child(7) { width: 4.75rem; }

.procurement-table th,
.procurement-table td {
  overflow: hidden;
}

.procurement-table th:nth-child(7),
.procurement-table td:nth-child(7) {
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 1.15rem;
}

@media (max-width: 760px) {
  .visitor-management-table {
    min-width: 38rem;
  }

  .visitor-management-table th:nth-child(3),
  .visitor-management-table td:nth-child(3),
  .visitor-management-table th:nth-child(4),
  .visitor-management-table td:nth-child(4),
  .visitor-management-table th:nth-child(5),
  .visitor-management-table td:nth-child(5),
  .visitor-management-table th:nth-child(6),
  .visitor-management-table td:nth-child(6) {
    display: none !important;
  }
}

/* Employee Portal */
.employee-workspace { padding-top: 0.9rem; }
.employee-shell {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}
.employee-shell.facility-requests-shell {
  gap: 2rem;
  max-width: 1440px;
}
.employee-shell > .fam-section,
.employee-shell > .facility-section {
  gap: 0.65rem;
}
.employee-page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.15rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.75rem;
  background: var(--surface, #fff);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.08));
}
.employee-portal-body .facility-page-header.employee-admin-header {
  align-items: flex-start;
  padding: 1.25rem 1.35rem;
  min-height: auto;
  border-radius: var(--radius-lg);
}
.employee-page-header h1,
.employee-request-page-header h1 {
  margin: 0.05rem 0 0.25rem;
  color: var(--text-main, #111827);
  font-size: clamp(1.32rem, 1.8vw, 1.7rem);
  line-height: 1.12;
}
.employee-page-header p { margin: 0; color: var(--text-muted, #64748b); }
.employee-section-heading {
  display: block;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.employee-section-heading p {
  margin: 0.25rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.employee-card-kicker {
  color: var(--primary, #2563eb);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.employee-eyebrow {
  color: var(--primary, #2563eb) !important;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.employee-header-actions,
.employee-quick-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.employee-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 0.85rem;
  align-items: start;
}
.employee-home-panel {
  min-width: 0;
  padding: 1rem 1.1rem;
  background: var(--surface-card, #fff);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}
.employee-attention-list {
  display: grid;
  gap: 0.55rem;
}
.employee-attention-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  color: inherit;
  text-decoration: none;
}
.employee-attention-card > .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.75rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 1.25rem;
}
.employee-attention-card strong,
.employee-attention-card small {
  display: block;
  min-width: 0;
}
.employee-attention-card strong {
  color: var(--text-main, #111827);
  font-size: 0.95rem;
}
.employee-attention-card small {
  margin-top: 0.2rem;
  color: var(--text-muted, #64748b);
  font-size: 0.84rem;
}
.employee-attention-action {
  color: var(--primary, #2563eb);
  font-size: 0.82rem;
  font-weight: 800;
}
.employee-attention-card:hover strong,
.employee-attention-card:focus-visible strong {
  color: var(--primary, #2563eb);
}
.employee-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.employee-summary-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
}
.employee-summary-strip {
  margin-bottom: 0;
}
.employee-summary-strip span {
  min-height: 2.35rem;
}
.employee-summary-card > .material-symbols-outlined,
.employee-action-card > .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.7rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 1.2rem;
  flex: 0 0 auto;
}
.employee-summary-card strong {
  display: block;
  color: var(--text-main, #111827);
  font-size: 1.28rem;
  line-height: 1;
}
.employee-summary-card p,
.employee-action-card span:last-child {
  margin: 0.25rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
}
.employee-workspace .employee-summary-grid:has(#employee-upcoming-count) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.employee-workspace .employee-summary-card {
  min-height: 4.05rem;
}
.employee-compact-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.employee-task-summary-strip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: -0.15rem;
}
.employee-task-summary-card {
  flex: 0 0 min(100%, 16rem);
}
.employee-task-summary-copy {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.employee-reservation-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(19rem, 0.95fr);
  gap: 0.85rem;
  align-items: stretch;
}
.employee-calendar-panel,
.employee-selected-date-panel {
  padding: 1rem 1.1rem;
}
.employee-next-panel {
  display: grid;
  grid-template-rows: max-content minmax(0, 1fr);
  gap: 0.85rem;
  min-height: 100%;
}
.employee-side-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
}
.employee-side-card .employee-section-heading {
  margin-bottom: 0;
}
.employee-side-card .employee-next-card {
  min-height: 0;
  box-shadow: none;
  background: var(--surface-container-low, #f8fafc);
}
.employee-calendar-header,
.employee-selected-date-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.employee-next-panel .employee-selected-date-header {
  flex-direction: column;
}
.employee-next-panel .employee-selected-date-header .dashboard-action-button {
  width: 100%;
  justify-content: center;
  margin-top: 0.45rem;
  box-shadow: none;
}
.employee-calendar-header h2,
.employee-selected-date-header h2 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1.1rem;
  font-weight: 800;
}
.employee-calendar-header p,
.employee-selected-date-header p {
  margin: 0.25rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.employee-room-selector {
  display: grid;
  gap: 0.35rem;
  min-width: min(100%, 16rem);
}
.employee-room-selector span {
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.employee-room-selector select {
  min-height: 2.45rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.75rem;
  background: var(--surface, #fff);
  color: var(--text-main, #111827);
  padding: 0 0.75rem;
}
.employee-room-meta {
  margin: 0.75rem 0 0;
}
.employee-calendar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--outline-variant, #d6dbe6);
}
.employee-calendar-toolbar h3 {
  margin: 0;
  padding-left: 0;
  color: var(--text-main, #111827);
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}
.employee-calendar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.employee-calendar-view-toggle {
  margin-left: 0;
}
.employee-availability-calendar {
  margin-top: 0.85rem;
}
.employee-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--surface, #fff);
}
.employee-calendar-day {
  min-height: 5.65rem;
  padding: 0.42rem;
  border-right: 1px solid var(--outline-variant, #d6dbe6);
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
  background: var(--surface, #fff);
}
.employee-calendar-week .employee-calendar-day {
  min-height: 8.75rem;
}
.employee-calendar-day:nth-child(7n) {
  border-right: 0;
}
.employee-calendar-day.outside {
  background: var(--surface-container-low, #f8fafc);
  color: var(--text-muted, #64748b);
}
.employee-calendar-day.today .employee-calendar-date-button {
  color: var(--primary, #2563eb);
}
.employee-calendar-day.selected {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.32);
}
.employee-calendar-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main, #111827);
  font-weight: 800;
}
.employee-calendar-date-button:hover,
.employee-calendar-date-button:focus-visible {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
}
.employee-calendar-day-events {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.3rem;
}
.employee-calendar-event {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  border: 0;
  border-left: 3px solid #64748b;
  border-radius: 0.45rem;
  background: var(--surface-container-low, #f8fafc);
  color: var(--text-main, #111827);
  text-align: left;
  font-size: 0.7rem;
}
.employee-calendar-event.self {
  border-left-color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.08);
  cursor: pointer;
}
.employee-calendar-event.other {
  border-left-color: #94a3b8;
}
.employee-calendar-event strong,
.employee-calendar-event span,
.employee-calendar-event small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-calendar-available,
.employee-calendar-more {
  color: var(--text-muted, #64748b);
  font-size: 0.75rem;
}
.employee-selected-date-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}
.employee-selected-date-row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-left: 3px solid #94a3b8;
  border-radius: 0.65rem;
  background: var(--surface-container-low, #f8fafc);
}
.employee-next-panel .employee-selected-date-row {
  grid-template-columns: 1fr;
  gap: 0.25rem;
}
.employee-next-panel .employee-selected-date-list .employee-empty-state {
  min-height: 100%;
  padding: 1rem 0.5rem;
}
.employee-next-panel .employee-selected-date-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
  align-self: stretch;
}
.employee-next-panel .employee-selected-date-list {
  align-content: center;
}
.employee-selected-date-row.self {
  border-left-color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.08);
}
.employee-selected-date-row span,
.employee-selected-date-row small {
  color: var(--text-muted, #64748b);
}
.employee-selected-date-row strong {
  color: var(--text-main, #111827);
}
.employee-next-up,
.employee-active-list {
  display: grid;
  gap: 0.55rem;
}
.employee-next-up {
  width: 100%;
}
.employee-next-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.85rem 0.95rem;
  border-left: 3px solid var(--primary, #2563eb);
}
.employee-next-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.employee-next-card h3,
.employee-active-card h3 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1.15rem;
  font-weight: 800;
}
.employee-next-card p,
.employee-active-card p {
  margin: 0.35rem 0 0;
  color: var(--text-muted, #64748b);
}
.employee-next-meta {
  color: var(--text-main, #111827) !important;
  font-weight: 650;
}
.employee-next-helper {
  color: var(--primary, #2563eb) !important;
  font-size: 0.9rem;
  font-weight: 700;
}
.employee-next-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.employee-active-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
}
.employee-active-card > div:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}
.employee-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.employee-action-card {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-height: 10rem;
  padding: 1.15rem;
  text-decoration: none;
}
.employee-action-card strong { color: var(--text-main, #111827); }
.employee-activity-card,
.employee-placeholder-card {
  min-height: 5.5rem;
  display: grid;
  place-items: center;
  padding: 0.75rem 0.9rem;
}
.employee-activity-list {
  display: grid;
  gap: 0.85rem;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.employee-activity-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
  background: transparent;
}
.employee-activity-link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  color: inherit;
  text-decoration: none;
}
.employee-activity-link:hover strong {
  color: var(--primary, #2563eb);
}
.employee-activity-list .material-symbols-outlined {
  color: var(--primary, #2563eb);
}
.employee-activity-list strong {
  color: var(--text-main, #111827);
}
.employee-activity-list p,
.employee-activity-list small {
  display: block;
  margin: 0.18rem 0 0;
  color: var(--text-muted, #64748b);
}
.employee-empty-state {
  min-height: 4.75rem;
  padding: 0.9rem 0.85rem;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  text-align: center;
}
.employee-empty-state strong {
  color: var(--text-main, #111827);
  font-size: 0.98rem;
}
.employee-empty-state p {
  margin: 0.35rem 0 0;
  color: var(--text-muted, #64748b);
  font-weight: 400;
}
.employee-empty-action {
  margin-top: 0.9rem;
}
.employee-data-table {
  table-layout: fixed;
  width: 100%;
}
.employee-data-table td { padding: 0.68rem 0.85rem; }
.employee-request-page-header {
  align-items: center;
}
.employee-records-card {
  overflow: hidden;
}
.employee-records-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem 0.7rem;
}
.employee-records-header h2 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1.05rem;
  font-weight: 800;
}
.employee-records-header p {
  margin: 0.3rem 0 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.employee-records-toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.1rem 0.8rem;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
}
.employee-search-field,
.employee-status-filter {
  display: flex;
  align-items: center;
  min-height: 2.6rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.85rem;
  background: var(--surface, #fff);
}
.employee-search-field {
  flex: 1 1 auto;
  min-width: 16rem;
  gap: 0.65rem;
  padding: 0 0.85rem;
}
.employee-search-field .material-symbols-outlined {
  color: var(--text-muted, #64748b);
  font-size: 1.15rem;
}
.employee-search-field input,
.employee-status-filter select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main, #111827);
  font: inherit;
}
.employee-search-field input::placeholder {
  color: var(--text-muted, #64748b);
}
.employee-search-field:has(input:disabled),
.employee-status-filter:has(select:disabled) {
  opacity: 0.72;
}
.employee-status-filter {
  flex: 0 0 14rem;
  padding: 0 0.8rem;
}
.employee-records-table-wrap {
  margin-top: 0;
}
.employee-mobile-record-list {
  display: none;
}
.employee-data-table {
  min-width: 780px;
}
.employee-col-request { width: 14%; }
.employee-col-subject { width: 30%; }
.employee-col-category { width: 16%; }
.employee-col-priority { width: 10%; }
.employee-col-status { width: 13%; }
.employee-col-updated { width: 13%; }
.employee-col-actions { width: 4.75rem; }
.employee-data-table th:last-child,
.employee-data-table td:last-child {
  overflow: visible;
  text-overflow: clip;
}
.employee-data-table th,
.employee-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-data-table td[colspan] {
  padding: 0;
  white-space: normal;
}
.employee-reservations-table {
  min-width: 820px;
}
.employee-reservations-table .employee-col-request { width: 13%; }
.employee-reservations-table .employee-col-subject { width: 20%; }
.employee-reservations-table .employee-col-category { width: 22%; }
.employee-reservations-table .employee-col-datetime { width: 12%; }
.employee-reservations-table .employee-col-status { width: 12%; }
.employee-reservations-table .employee-col-actions { width: 6.75rem; }
.employee-reservations-table th:last-child,
.employee-reservations-table td:last-child {
  overflow: visible;
  text-overflow: clip;
}
.employee-reservations-table td[colspan] {
  padding: 0;
}
.employee-reservations-table .employee-empty-state {
  min-height: 5rem;
  padding: 1.1rem 1rem;
}
.employee-records-card .facility-table-header {
  gap: 0.85rem;
  padding: 0.95rem 1.1rem 0.8rem;
}
.employee-records-card .facility-table-header p {
  margin-top: 0.35rem;
}
.employee-records-card .facility-header-controls {
  align-items: center;
  gap: 0.9rem;
  width: min(100%, 46rem);
}
.employee-records-card .facility-search-field {
  flex: 1 1 auto;
  min-width: 18rem;
}
.employee-records-card .facility-filter-field {
  flex: 0 0 13rem;
}
.employee-record-card {
  position: relative;
  display: grid;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.95rem;
  background: var(--surface, #fff);
}
.employee-record-card-top,
.employee-record-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.employee-record-reference {
  max-width: min(13rem, 70vw);
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary, #2563eb);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.employee-record-card h3 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-record-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}
.employee-record-meta div {
  min-width: 0;
}
.employee-record-meta dt {
  margin: 0 0 0.18rem;
  color: var(--text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.employee-record-meta dd {
  margin: 0;
  color: var(--text-main, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-record-card .facility-action-menu {
  margin-left: auto;
}
.employee-record-card .facility-action-dropdown {
  position: fixed;
  z-index: 10050;
  min-width: 11rem;
}
.employee-data-table .facility-action-dropdown {
  min-width: 10rem;
  position: fixed;
  z-index: 10050;
}
.table-cell-subtext {
  display: block;
  margin-top: 0.2rem;
  max-width: 18rem;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-approval-panel {
  width: min(58rem, calc(100vw - 2rem));
}
.employee-approval-steps {
  display: grid;
  gap: 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.employee-approval-step {
  align-items: center;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 8px;
  display: grid;
  gap: 0.25rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.75rem 0.85rem;
}
.employee-approval-step span {
  color: var(--text-main, #111827);
  font-weight: 650;
  min-width: 0;
}
.employee-approval-step strong {
  color: var(--primary, #2563eb);
  font-size: 0.78rem;
  text-transform: uppercase;
}
.employee-approval-step small {
  color: var(--text-muted, #64748b);
  grid-column: 1 / -1;
}
.employee-request-form,
.employee-request-details {
  width: min(720px, calc(100vw - 48px));
}
.employee-request-form .facility-details-modal-header {
  padding: 1.15rem 1.35rem;
}
.employee-request-form .facility-form-grid {
  gap: 1rem 1.15rem;
  margin: 1.2rem 1.35rem 0;
}
.employee-request-form .facility-field {
  gap: 0.4rem;
}
.employee-request-form > .facility-field {
  margin: 1rem 1.35rem 0;
}
.employee-request-form textarea {
  min-height: 7.25rem;
}
.employee-reservation-form {
  width: min(840px, calc(100vw - 48px));
  max-height: min(86vh, 820px);
  overflow: hidden;
}
.employee-reservation-form-body {
  display: grid;
  gap: 1.35rem;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 1.35rem 1.55rem 1.5rem;
  scrollbar-gutter: stable both-edges;
}
.facility-dialog-panel > .employee-reservation-form-body {
  margin: 0;
}
.employee-reservation-form .facility-form-error:not([hidden]),
.employee-reservation-form .employee-requester-summary,
.employee-reservation-form .employee-form-section {
  margin: 0;
}
.employee-form-section {
  display: grid;
  gap: 1rem;
  margin: 1.15rem 1.35rem 0;
  padding-top: 0;
}
.employee-form-section h3 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1.02rem;
  font-weight: 700;
}
.employee-reservation-form .facility-form-grid {
  gap: 1.15rem 1.25rem;
}
.employee-reservation-form .facility-field {
  gap: 0.5rem;
}
.employee-reservation-form textarea {
  min-height: 6.5rem;
}
.employee-form-section .facility-form-grid,
.employee-form-section > .facility-field {
  margin: 0;
}
.employee-form-section .facility-field b {
  color: var(--color-error, #b91c1c);
}
.reservation-availability-state {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}
.reservation-availability-state[data-available="true"] {
  color: var(--success, #047857);
}
.reservation-availability-state[data-available="false"] {
  color: var(--danger, #b91c1c);
}
.employee-request-form .facility-dialog-actions {
  margin-top: 1.2rem;
}
.employee-reservation-form .facility-dialog-actions {
  margin-top: 0;
  padding: 1.05rem 1.55rem;
}
.employee-request-details .employee-reservation-detail-footer {
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1rem;
}
.employee-reservation-action-note {
  flex: 1 1 18rem;
  min-width: 0;
  margin: 0;
  text-align: left;
  line-height: 1.4;
}
.employee-reservation-footer-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}
.employee-requester-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 0.55rem;
  background: var(--surface-container-low, #f8fafc);
}
.employee-requester-section {
  gap: 0.65rem;
}
.employee-requester-summary span {
  min-width: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.employee-requester-summary span:first-child {
  flex: 1 1 auto;
}
.employee-requester-summary span:not(:first-child) {
  flex: 0 1 18rem;
}
.employee-requester-summary strong {
  display: block;
  color: var(--text-main, #111827);
  font-size: 0.95rem;
}
.employee-requester-summary small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
}
.reservation-detail-accordion {
  display: grid;
  gap: 0.75rem;
}
.reservation-request-letter-row strong,
.reservation-request-letter-row small {
  overflow-wrap: anywhere;
  white-space: normal;
}
.reservation-request-letter-row .document-file-actions {
  justify-content: flex-end;
}
.reservation-history-timeline li {
  overflow-wrap: anywhere;
}
.reservation-accordion-subhead {
  margin: 0.75rem 1rem 0.5rem;
  color: var(--text-main, #111827);
  font-size: 0.88rem;
}
.employee-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.employee-filter-pills button {
  min-height: 2.25rem;
  padding: 0 0.9rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 999px;
  color: var(--text-muted, #64748b);
  background: var(--surface, #fff);
  font-weight: 600;
}
.employee-filter-pills button.active {
  color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
}
.employee-notifications-card {
  overflow: hidden;
}
.employee-notifications-header {
  align-items: center;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
}
.employee-notifications-header .employee-filter-pills {
  justify-content: flex-end;
}
.employee-notifications-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.employee-notifications-state {
  min-height: 12rem;
  padding: 1rem 1.35rem 1.35rem;
  place-items: stretch;
}
.employee-notifications-state .employee-empty-state {
  min-height: auto;
  max-width: none;
  padding: 0;
}
.employee-notification-group {
  display: grid;
  gap: 0.55rem;
}
.employee-notification-group + .employee-notification-group {
  margin-top: 1.1rem;
}
.employee-notification-group h3 {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.employee-notifications-state .notification-page-list {
  width: min(100%, 1080px);
  margin: 0;
  max-height: none;
  overflow: visible;
  padding: 0;
}
.employee-notifications-state .notification-card-main {
  padding: 0.9rem 1rem;
}
.employee-notifications-state .employee-empty-state .material-symbols-outlined {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.25rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  font-size: 1.35rem;
}
.employee-profile-card { padding: 1.25rem; }
.employee-profile-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
}
.employee-profile-avatar {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary, #2563eb);
  font-weight: 800;
}
.employee-profile-summary h2 {
  margin: 0;
  color: var(--text-main, #111827);
  font-size: 1.25rem;
}
.employee-profile-summary p {
  margin: 0.2rem 0 0;
  color: var(--text-muted, #64748b);
}
.employee-profile-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
  margin-top: 1.25rem;
}
.employee-info-section h2 {
  margin: 0 0 0.7rem;
  color: var(--text-main, #111827);
  font-size: 1rem;
}
.employee-info-row {
  display: grid;
  grid-template-columns: minmax(9rem, 0.5fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--outline-variant, #d6dbe6);
}
.employee-info-row span {
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
}
.employee-info-row strong {
  color: var(--text-main, #111827);
  font-weight: 650;
}
.employee-access-state {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  border: 1px solid var(--outline-variant, #d6dbe6);
  border-radius: 1rem;
  background: var(--surface, #fff);
  text-align: center;
}
.employee-access-state .material-symbols-outlined {
  color: var(--primary, #2563eb);
  font-size: 2.5rem;
}
.employee-access-state h1 { margin: 0; font-size: 1.4rem; }
.employee-access-state p {
  max-width: 34rem;
  margin: 0;
  color: var(--text-muted, #64748b);
}
@media (max-width: 900px) {
  .employee-page-header { flex-direction: column; }
  .employee-home-grid,
  .employee-reservation-workspace,
  .employee-quick-actions,
  .employee-profile-sections { grid-template-columns: 1fr; }
  .employee-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-task-summary-strip {
    align-items: stretch;
    flex-direction: column;
  }
  .employee-task-summary-card {
    flex-basis: auto;
  }
  .employee-next-card,
  .employee-active-card {
    grid-template-columns: 1fr;
  }
  .employee-next-actions,
  .employee-active-card > div:last-child {
    justify-content: flex-start;
  }
  .employee-header-actions,
  .employee-header-actions .dashboard-action-button { width: 100%; }
  .employee-header-actions .dashboard-action-button { justify-content: center; }
}
@media (max-width: 640px) {
  .employee-workspace { padding-top: 1rem; }
  .employee-page-header { padding: 1.1rem; }
  .employee-summary-grid { grid-template-columns: 1fr; }
  .employee-notifications-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .employee-notifications-header .employee-filter-pills {
    justify-content: flex-start;
    width: 100%;
  }
  .employee-notifications-toolbar {
    justify-content: flex-start;
    width: 100%;
  }
  .employee-records-header,
  .employee-records-toolbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .employee-records-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .employee-search-field,
  .employee-status-filter {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }
  .employee-request-form,
  .employee-request-details {
    width: calc(100vw - 24px);
  }
  .employee-reservation-form {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 32px);
  }
  .employee-reservation-form-body {
    gap: 0.95rem;
    padding: 1rem 0.9rem 1.1rem;
    scrollbar-gutter: stable;
  }
  .employee-reservation-form .employee-form-section {
    gap: 0.75rem;
  }
  .employee-reservation-form .facility-dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    padding: 0.9rem 1rem;
  }
  .employee-requester-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.8rem;
  }
  .employee-requester-summary span,
  .employee-requester-summary span:not(:first-child) {
    flex: 0 1 auto;
    width: 100%;
    white-space: normal;
  }
  .employee-profile-summary {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .employee-profile-summary .facility-badge {
    grid-column: 1 / -1;
    justify-self: flex-start;
  }
  .employee-info-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .employee-records-table-wrap {
    display: none;
  }
  .employee-mobile-record-list {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
  }
  .employee-record-card {
    padding: 0.9rem;
  }
  .employee-record-meta {
    grid-template-columns: 1fr;
  }
  .employee-records-card .facility-table-header,
  .employee-records-card .facility-header-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .employee-records-card .facility-search-field,
  .employee-records-card .facility-filter-field {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }
}

/* Global Modal/Dialog Audit Normalization */
:root {
  --app-header-height: 64px;
  --modal-viewport-padding: 20px;
  --modal-usable-height: calc(100vh - var(--app-header-height));
  --modal-shell-max-height: calc(var(--modal-usable-height) - (var(--modal-viewport-padding) * 2));
  --modal-motion-duration: 180ms;
  --modal-motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (height: 100dvh) {
  :root {
    --modal-usable-height: calc(100dvh - var(--app-header-height));
  }
}

body.fam-modal-open,
body.facility-details-modal-open,
body.facility-drawer-open {
  overflow: hidden !important;
}

.facility-dialog,
.facility-details-modal,
.facility-drawer,
.admin-org-drawer-backdrop,
[data-modal-backdrop] {
  z-index: 9999 !important;
}

.facility-dialog,
.facility-details-modal {
  position: fixed !important;
  inset-inline: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  padding: calc(var(--app-header-height) + var(--modal-viewport-padding)) 24px var(--modal-viewport-padding) !important;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: none;
  animation: famModalBackdropIn var(--modal-motion-duration) ease-out both;
}

.facility-dialog.fam-modal-closing,
.facility-details-modal.fam-modal-closing,
[data-modal-backdrop].fam-modal-closing {
  animation: famModalBackdropOut 150ms ease-in both;
}

.facility-dialog.fam-modal-closing .facility-dialog-panel,
.facility-details-modal.fam-modal-closing .facility-details-modal-panel,
[data-modal-backdrop].fam-modal-closing > [role="dialog"] {
  animation: famModalPanelOut 150ms ease-in both;
}

.facility-details-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

.facility-dialog {
  display: flex;
  align-items: center;
  justify-content: center;
}

.facility-drawer {
  padding: 24px 24px 24px 0;
}

.facility-details-modal-panel,
.facility-dialog-panel {
  width: min(940px, calc(100vw - 48px));
  max-height: var(--modal-shell-max-height);
  height: auto;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.26);
  contain: layout paint;
  transform-origin: center top;
  animation: famModalPanelIn var(--modal-motion-duration) var(--modal-motion-ease) both;
}

.facility-dialog-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  contain: content;
  scroll-behavior: auto;
  padding: 0;
}

.facility-dialog-panel > :not(.facility-details-modal-header):not(.facility-dialog-actions):not(.facility-drawer-header) {
  margin-left: 1.25rem;
  margin-right: 1.25rem;
}

.facility-dialog-panel > :not(.facility-details-modal-header):not(.facility-dialog-actions):not(.facility-drawer-header):first-child {
  margin-top: 1.25rem;
}

.facility-dialog-panel > :not(.facility-details-modal-header):not(.facility-dialog-actions):not(.facility-drawer-header):last-child {
  margin-bottom: 1.25rem;
}

.facility-dialog-panel > .facility-field,
.facility-dialog-panel > .facility-form-grid,
.facility-dialog-panel > .facility-form-error:not([hidden]) {
  margin-top: 1rem;
}

.facility-dialog-panel > .facility-field + .facility-field {
  margin-top: 0.85rem;
}

.facility-details-modal-header,
.facility-drawer-header,
.facility-dialog-panel > .facility-details-modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.facility-details-modal-body,
.facility-drawer-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  contain: content;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  padding: 1.15rem 1.25rem;
}

.facility-dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 1.15rem 0 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.fam-action-dialog-panel {
  width: min(460px, calc(100vw - 32px));
  max-height: min(80vh, 520px);
}

.fam-action-dialog-body {
  display: grid;
  gap: 1rem;
  padding: 1.2rem 1.25rem;
}

.fam-action-dialog-body p {
  margin: 0;
  color: var(--text-main, #111827);
  line-height: 1.5;
}

.fam-action-dialog-body textarea {
  min-height: 7rem;
  resize: vertical;
}

.facility-detail-grid section {
  min-height: auto;
}

.facility-detail-row dd,
.facility-detail-grid p,
.facility-detail-list,
.facility-history-list {
  overflow-wrap: anywhere;
}

.facility-request-details-panel {
  width: min(820px, calc(100vw - 48px));
}

.facility-request-detail-accordion {
  max-width: 100%;
}

.facility-drawer-panel {
  width: min(32rem, calc(100vw - 48px));
  height: calc(100dvh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 16px 0 0 16px;
}

.admin-org-drawer-backdrop {
  padding: 24px 24px 24px 0;
}

.admin-org-drawer {
  width: min(30rem, calc(100vw - 48px));
  height: calc(100dvh - 48px);
  border-radius: 16px 0 0 16px;
}

.admin-org-drawer header,
.admin-org-drawer footer {
  flex: 0 0 auto;
}

.admin-org-drawer-body {
  min-height: 0;
}

[data-modal-backdrop] {
  position: fixed !important;
  inset-inline: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  padding: calc(var(--app-header-height) + var(--modal-viewport-padding)) 24px var(--modal-viewport-padding) !important;
  align-items: center !important;
  justify-content: center !important;
  animation: famModalBackdropIn var(--modal-motion-duration) ease-out both;
}

[data-modal-backdrop] > [role="dialog"] {
  max-width: min(28rem, calc(100vw - 48px));
  max-height: var(--modal-shell-max-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  contain: content;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  border-radius: 16px !important;
  animation: famModalPanelIn var(--modal-motion-duration) var(--modal-motion-ease) both;
}

@keyframes famModalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes famModalBackdropOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes famModalPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes famModalPanelOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  .facility-dialog,
  .facility-details-modal,
  .facility-dialog-panel,
  .facility-details-modal-panel,
  [data-modal-backdrop],
  [data-modal-backdrop] > [role="dialog"] {
    animation-duration: 0.01ms !important;
  }
}

.scanner-modal-panel {
  width: min(42rem, calc(100vw - 48px));
}

#facility-request-drawer.facility-details-modal,
#visitor-details-drawer.facility-details-modal,
#reservation-details-drawer.facility-details-modal,
#shared-details-modal.facility-details-modal {
  z-index: 9999 !important;
}

#facility-request-drawer.facility-details-modal .facility-details-modal-panel,
#visitor-details-drawer.facility-details-modal .facility-details-modal-panel,
#reservation-details-drawer.facility-details-modal .facility-details-modal-panel,
#shared-details-modal.facility-details-modal .facility-details-modal-panel {
  z-index: 10000 !important;
}

@media (max-width: 760px) {
  :root {
    --app-header-height: 56px;
    --modal-viewport-padding: 12px;
  }

  .facility-dialog,
  .facility-details-modal,
  .facility-drawer,
  .admin-org-drawer-backdrop,
  [data-modal-backdrop] {
    padding: 12px !important;
  }

  .facility-details-modal-panel,
  .facility-dialog-panel,
  [data-modal-backdrop] > [role="dialog"] {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
    border-radius: 14px !important;
  }

  .facility-details-modal-panel,
  .facility-dialog-panel,
  [data-modal-backdrop] > [role="dialog"] {
    max-height: var(--modal-shell-max-height) !important;
  }

  .facility-drawer-panel,
  .admin-org-drawer {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    height: auto !important;
    max-height: calc(100dvh - 24px) !important;
    border-radius: 14px !important;
  }

  .facility-drawer,
  .admin-org-drawer-backdrop {
    justify-content: center;
  }

  .facility-details-modal-header,
  .facility-drawer-header,
  .facility-dialog-panel > .facility-details-modal-header,
  .facility-details-modal-body,
  .facility-drawer-body,
  .facility-dialog-actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .facility-dialog-actions {
    flex-direction: column-reverse;
  }

  .facility-dialog-actions .dashboard-action-button,
  .facility-dialog-actions button {
    width: 100%;
    justify-content: center;
  }

  .employee-request-details .employee-reservation-detail-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .employee-reservation-action-note {
    width: 100%;
    flex-basis: auto;
  }

  .employee-reservation-footer-actions {
    width: 100%;
    justify-content: flex-end;
  }
}














/* Responsive Tables & Calendars Standardization */
.employee-availability-calendar .reservation-calendar-weekdays,
.employee-availability-calendar .employee-calendar-grid {
  min-width: 0;
}

@media (max-width: 640px) {
  .employee-calendar-header,
  .employee-selected-date-header {
    align-items: stretch;
    flex-direction: column;
  }
  .employee-calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .employee-calendar-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .employee-calendar-toolbar h3 {
    margin-left: 0;
    padding-left: 0;
    text-align: left;
  }
  .employee-calendar-view-toggle {
    display: none;
  }
  .employee-availability-calendar {
    overflow-x: visible;
  }
  .employee-calendar-mobile-agenda {
    display: grid;
    gap: 0.85rem;
  }
  .employee-calendar-week-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .employee-calendar-strip-day {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
    min-width: 0;
    min-height: 4.25rem;
    padding: 0.45rem 0.2rem;
    border: 1px solid var(--outline-variant, #d6dbe6);
    border-radius: 0.75rem;
    background: var(--surface, #fff);
    color: var(--text-main, #111827);
  }
  .employee-calendar-strip-day span {
    color: var(--text-muted, #64748b);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
  }
  .employee-calendar-strip-day strong {
    font-size: 1rem;
    line-height: 1;
  }
  .employee-calendar-strip-day i {
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 999px;
    background: var(--primary, #2563eb);
  }
  .employee-calendar-strip-day.selected {
    border-color: rgba(37, 99, 235, 0.42);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary, #2563eb);
  }
  .employee-calendar-strip-day.today strong {
    color: var(--primary, #2563eb);
  }
  .employee-calendar-mobile-selected {
    display: grid;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--outline-variant, #d6dbe6);
    border-radius: 0.9rem;
    background: var(--surface, #fff);
  }
  .employee-calendar-mobile-selected h4 {
    margin: 0;
    color: var(--text-main, #111827);
    font-size: 0.98rem;
  }
  .employee-calendar-mobile-agenda-list {
    display: grid;
    gap: 0.5rem;
  }
  .employee-calendar-mobile-agenda .employee-calendar-event {
    font-size: 0.82rem;
    padding: 0.65rem 0.75rem;
  }
}

@media (max-width: 640px) {
  .facility-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
  }
  .facility-requests-table:not(.visitor-management-table),
  .maintenance-requests-table,
  .asset-management-table,
  .procurement-table,
  .records-table,
  .visitor-management-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  .facility-requests-table th,
  .facility-requests-table td {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }
  .facility-requests-table th:last-child,
  .facility-requests-table td:last-child {
    display: table-cell;
    width: 4.5rem;
    min-width: 4.5rem;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .facility-requests-table th:last-child {
    font-size: 0.68rem;
  }
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) th:nth-child(3),
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) td:nth-child(3),
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) th:nth-child(4),
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) td:nth-child(4),
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) th:nth-child(6),
  .facility-requests-table:not(.maintenance-requests-table):not(.asset-management-table):not(.procurement-table):not(.records-table):not(.visitor-management-table) td:nth-child(6),
  .maintenance-requests-table th:nth-child(3),
  .maintenance-requests-table td:nth-child(3),
  .maintenance-requests-table th:nth-child(4),
  .maintenance-requests-table td:nth-child(4),
  .maintenance-requests-table th:nth-child(6),
  .maintenance-requests-table td:nth-child(6),
  .asset-management-table th:nth-child(3),
  .asset-management-table td:nth-child(3),
  .asset-management-table th:nth-child(4),
  .asset-management-table td:nth-child(4),
  .asset-management-table th:nth-child(6),
  .asset-management-table td:nth-child(6),
  .procurement-table th:nth-child(3),
  .procurement-table td:nth-child(3),
  .procurement-table th:nth-child(5),
  .procurement-table td:nth-child(5),
  .procurement-table th:nth-child(6),
  .procurement-table td:nth-child(6),
  .records-table th:nth-child(3),
  .records-table td:nth-child(3),
  .records-table th:nth-child(4),
  .records-table td:nth-child(4),
  .records-table th:nth-child(5),
  .records-table td:nth-child(5),
  .visitor-management-table th:nth-child(3),
  .visitor-management-table td:nth-child(3),
  .visitor-management-table th:nth-child(4),
  .visitor-management-table td:nth-child(4),
  .visitor-management-table th:nth-child(5),
  .visitor-management-table td:nth-child(5),
  .visitor-management-table th:nth-child(6),
  .visitor-management-table td:nth-child(6) {
    display: none;
  }
}

/* Document Management */
.document-page-header {
  min-height: 0;
  padding-block: 1.55rem;
}

.document-page-header .facility-title-block {
  gap: 0.35rem;
}

.document-page-header .facility-header-actions {
  align-items: center;
}

.document-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.document-summary-strip article {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  min-height: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-md);
  background: var(--surface-card, #fff);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: none;
}

.document-summary-strip .material-symbols-outlined {
  display: none;
}

.document-summary-strip strong {
  display: inline;
  color: var(--text-main, #0f172a);
  font-size: 0.95rem;
  line-height: 1;
}

.document-summary-strip p {
  display: inline;
  margin: 0 0 0 0.25rem;
  color: var(--text-muted, #64748b);
}

.records-workspace .facility-table-header {
  align-items: flex-end;
}

.records-workspace .facility-header-controls {
  display: grid;
  grid-template-columns: minmax(18rem, 2fr) repeat(3, minmax(10rem, 1fr)) auto;
  gap: 0.75rem;
  align-items: center;
}

.document-filter-field {
  min-width: 0;
}

.records-table {
  min-width: 1040px;
  table-layout: fixed;
}

.records-table col.document-col-document { width: 34%; }
.records-table col.document-col-category { width: 14%; }
.records-table col.document-col-related { width: 16%; }
.records-table col.document-col-version { width: 8%; }
.records-table col.document-col-status { width: 10%; }
.records-table col.document-col-updated { width: 13%; }
.records-table col.document-col-actions { width: 5rem; }

.records-table th,
.records-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.records-table th:nth-child(7),
.records-table td:nth-child(7) {
  text-align: center;
}

.document-primary-cell {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.document-primary-cell > span:last-child {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}

.document-primary-cell strong {
  overflow: hidden;
  color: var(--text-main, #0f172a);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-primary-cell small,
.document-primary-cell em {
  overflow: hidden;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-file-icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary, #4f46e5);
  font-size: 1.15rem;
}

.document-action-dropdown {
  min-width: 12.5rem;
  padding: 0.35rem;
}

.document-action-dropdown hr {
  width: 100%;
  margin: 0.25rem 0;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.document-action-dropdown .document-danger-action,
.document-danger-action-button {
  color: #991b1b;
}

.document-action-dropdown .document-danger-action:hover,
.document-action-dropdown .document-danger-action:focus-visible {
  background: rgba(254, 226, 226, 0.72);
  color: #991b1b;
}

.document-form .facility-details-modal-header,
.document-details-panel .facility-details-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface, #fff);
}

.visitor-form,
.document-form {
  display: flex !important;
  flex-direction: column;
  max-height: var(--modal-shell-max-height) !important;
  overflow: hidden !important;
  min-height: 0;
}

.visitor-form-body {
  display: grid;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  box-sizing: border-box;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.visitor-form-body .facility-field + .facility-field {
  margin-top: 0;
}

#document-dialog.facility-dialog,
#document-details-modal.facility-details-modal {
  align-items: center;
  padding-top: calc(var(--app-header-height) + 1.25rem) !important;
}

#document-dialog .document-form,
#document-details-modal .document-details-panel {
  width: min(920px, calc(100vw - 64px));
  max-height: min(760px, calc(100vh - var(--app-header-height) - 56px));
  border-radius: 16px;
}

#document-dialog .facility-details-modal-header,
#document-details-modal .facility-details-modal-header {
  padding: 1.05rem 1.25rem;
}

#document-dialog .facility-details-modal-header h2,
#document-details-modal .facility-details-modal-header h2 {
  margin-top: 0.25rem;
  line-height: 1.15;
}

#document-dialog .facility-dialog-actions,
#document-details-modal .facility-dialog-actions {
  padding: 1rem 1.25rem;
}

.document-form-body {
  display: grid;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  box-sizing: border-box;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.document-form-section {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--outline-variant, #dbe2ef);
  border-radius: 0.85rem;
  background: var(--surface-container-lowest, #fff);
}

.document-form-section h3 {
  margin: 0;
  color: var(--text-main, #0f172a);
  font-size: 1rem;
  line-height: 1.2;
}

.document-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.document-full-field {
  grid-column: 1 / -1;
}

.document-form-error {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: 0.75rem;
  background: rgba(254, 226, 226, 0.8);
  color: #991b1b;
  font-weight: 600;
}

.document-current-file {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--outline-variant, #dbe2ef);
  border-radius: 0.75rem;
  background: var(--surface-container-low, #f8fafc);
}

.document-current-file strong {
  color: var(--primary, #4f46e5);
}

.document-current-file span {
  color: var(--text-main, #0f172a);
}

.document-form-note {
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
  line-height: 1.45;
}

.document-file-field input[type="file"] {
  padding: 0.75rem;
  background: var(--surface-container-low, #f8fafc);
}

.document-file-field input[type="file"]::file-selector-button {
  margin-right: 0.85rem;
  padding: 0.48rem 0.8rem;
  border: 1px solid var(--outline-variant, #dbe2ef);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main, #0f172a);
  font-weight: 700;
  cursor: pointer;
}

.document-details-header-status {
  margin-left: auto;
  align-self: flex-start;
}

.document-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 1rem 0.75rem;
  padding: 0.15rem 0 0.2rem;
}

.document-file-row > div:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.document-file-row > div:first-child > div,
.document-version-row div:first-child {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}

.document-file-row strong,
.document-file-row small,
.document-version-row strong,
.document-version-row span,
.document-version-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-file-row small,
.document-version-row span,
.document-version-row small {
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
}

.document-version-button {
  margin-top: 0.9rem;
}

.document-details-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.75rem;
  margin: 0 1rem 0.85rem;
}

.document-file-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.9rem;
}

.document-file-actions a {
  color: var(--primary, #4f46e5);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.document-file-actions a:hover,
.document-file-actions a:focus-visible {
  text-decoration: underline;
}

.document-details-body .document-danger-action-button {
  margin: 0.25rem 1rem 0.85rem;
}

.document-version-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--outline-variant, #dbe2ef);
}

.document-version-list {
  display: grid;
  gap: 0.65rem;
  margin: 0 1rem 0.75rem;
}

.document-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0 0.65rem;
  border: 0;
  border-bottom: 1px solid var(--outline-variant, #dbe2ef);
  background: transparent;
}

.document-version-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.document-version-row div:first-child {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.document-version-row span,
.document-version-row small {
  color: var(--text-muted, #64748b);
}

.document-version-row p {
  margin: 0;
}

.document-version-row div:last-child {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.document-version-row a {
  color: var(--primary, #4f46e5);
  font-weight: 700;
  text-decoration: none;
}

.document-details-header {
  align-items: flex-start;
}

.document-detail-accordion .visitor-detail-disclosure .document-file-row {
  margin: 0 1rem 0.85rem;
  padding: 0.75rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.document-detail-accordion .document-version-list {
  gap: 0;
  margin: 0 1rem 0.85rem;
}

.document-detail-accordion .document-version-row {
  padding: 0.75rem 0;
  border: 0;
  border-top: 1px solid var(--outline-variant, #dbe2ef);
}

.document-detail-accordion .document-version-row:first-child {
  border-top: 0;
  padding-top: 0.2rem;
}

.document-detail-accordion .visitor-detail-disclosure summary {
  min-height: 2.75rem;
}

.document-detail-accordion .document-summary-action {
  margin-left: auto;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-full);
  background: var(--surface, #fff);
  color: var(--primary, #4f46e5);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-details-footer {
  justify-content: space-between;
}

.document-details-footer > div {
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .document-form-grid {
    grid-template-columns: 1fr;
  }

  .records-workspace .facility-header-controls,
  .visitor-records-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #document-details-modal .document-details-panel {
    width: calc(100vw - 24px);
  }
  .document-file-row,
  .document-version-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .document-file-actions,
  .document-details-footer,
  .document-details-footer > div {
    width: 100%;
    flex-wrap: wrap;
  }
  .document-details-footer {
    align-items: stretch;
  }
  .document-details-footer .dashboard-action-button {
    width: 100%;
    justify-content: center;
  }
  .document-details-actions {
    justify-content: stretch;
  }
  .document-details-actions .dashboard-action-button {
    width: 100%;
    justify-content: center;
  }
}

/* Records Retention & Compliance */
.retention-workspace .facility-table-card {
  overflow: visible;
}

.retention-controls {
  grid-template-columns: minmax(16rem, 1.4fr) repeat(4, minmax(10rem, 0.7fr));
}

.retention-table {
  table-layout: fixed;
}

.retention-col-record { width: 26%; }
.retention-col-category { width: 14%; }
.retention-col-schedule { width: 23%; }
.retention-col-review { width: 18%; }
.retention-col-hold { width: 8%; }
.retention-col-status { width: 7%; }
.retention-col-actions { width: 4%; }

/* Legal Management */
.legal-controls {
  grid-template-columns: minmax(14rem, 1.5fr) repeat(5, minmax(9rem, 1fr));
}

.legal-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.legal-col-matter { width: 38%; }
.legal-col-type { width: 10%; }
.legal-col-priority { width: 10%; }
.legal-col-status { width: 11%; }
.legal-col-assignee { width: 15%; }
.legal-col-updated { width: 11%; }
.legal-col-actions { width: 5%; }

.legal-table th,
.legal-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legal-table th:last-child,
.legal-table td:last-child {
  text-align: center;
  overflow: visible;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.legal-table td:last-child .facility-action-toggle {
  margin-inline: auto;
}

.legal-primary-cell {
  width: 100%;
}

.legal-primary-cell strong {
  display: -webkit-box;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.legal-primary-cell small {
  white-space: nowrap;
}

.legal-form {
  width: min(58rem, calc(100vw - 2rem));
}

.legal-form-body {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.legal-assign-form {
  width: min(46rem, calc(100vw - 2rem));
}

.legal-attach-form {
  width: min(48rem, calc(100vw - 2rem));
}

.legal-details-panel {
  width: min(58rem, calc(100vw - 2rem));
}

.legal-ai-summary {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--outline-variant, #dbe2ef);
  border-left: 4px solid var(--primary, #4f46e5);
  border-radius: 0.85rem;
  background: var(--surface-container-lowest, #fff);
}

.legal-ai-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.legal-ai-summary h3,
.legal-ai-summary-header p,
.legal-ai-summary-content p {
  margin: 0;
}

.legal-ai-summary-header p,
.legal-ai-summary-content small {
  color: var(--text-muted);
}

.legal-ai-summary-content {
  display: grid;
  gap: 0.75rem;
  color: var(--text-main);
  line-height: 1.55;
}

.legal-ai-summary-paragraph {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  text-align: justify;
  text-justify: inter-word;
}

.legal-ai-summary-content small {
  font-size: var(--text-xs, 0.8125rem);
  font-style: italic;
  line-height: 1.45;
  text-align: left;
}

.legal-ai-summary-action {
  flex: 0 0 auto;
}

.legal-supporting-upload-section {
  margin-top: 0.25rem;
}

.legal-supporting-documents,
.legal-supporting-documents-empty {
  display: grid;
  gap: 0.85rem;
  margin: 0.15rem 1rem 1rem;
}

.legal-supporting-documents-list {
  display: grid;
  border-top: 1px solid var(--border-subtle);
}

.legal-supporting-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-supporting-document:last-child {
  border-bottom: 0;
}

.legal-supporting-copy {
  min-width: 0;
}

.legal-supporting-document strong,
.legal-supporting-document small {
  display: block;
}

.legal-supporting-document strong {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.35;
}

.legal-supporting-document small {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.legal-contract-metadata-state {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.legal-contract-metadata-confirmed {
  color: #047857;
}

.legal-contract-metadata-pending {
  color: var(--primary, #4f46e5);
}

.legal-contract-metadata-unavailable {
  color: #9a3412;
}

.legal-supporting-document .document-file-actions button {
  border: 0;
  background: transparent;
  color: var(--primary, #4f46e5);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.legal-contract-confidence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin-top: 0.85rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.legal-contract-confidence strong {
  color: var(--text-main);
}

.legal-attach-button {
  justify-self: start;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
}

.legal-supporting-footer {
  display: flex;
  justify-content: flex-start;
}

.legal-assignment-footer {
  display: flex;
  justify-content: flex-start;
  margin: 0.85rem 1rem 1rem;
}

.legal-parties-section,
.legal-actions-section {
  display: grid;
  gap: 0.85rem;
  margin: 0.15rem 1rem 1rem;
}

.legal-party-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.legal-parties-section section {
  display: grid;
  gap: 0.55rem;
}

.legal-parties-section h3 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.legal-inline-action {
  font-size: 0.82rem;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
}

.legal-party-list,
.legal-party-suggestions,
.legal-action-list,
.legal-action-suggestions {
  display: grid;
  border-top: 1px solid var(--border-subtle);
}

.legal-party-entry,
.legal-action-entry {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-party-entry:last-child,
.legal-action-entry:last-child {
  border-bottom: 0;
}

.legal-party-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
}

.legal-party-copy {
  min-width: 0;
}

.legal-party-copy strong,
.legal-party-copy span,
.legal-party-copy small {
  display: block;
}

.legal-party-copy strong {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.35;
}

.legal-party-copy span {
  margin-top: 0.12rem;
  color: var(--text-main);
  font-size: 0.84rem;
  line-height: 1.35;
}

.legal-party-copy small {
  margin-top: 0.1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.legal-party-copy .legal-action-basis,
.legal-party-copy .legal-ai-provenance {
  color: var(--primary, #4f46e5);
  font-weight: 800;
}

.legal-party-copy p {
  display: -webkit-box;
  margin: 0.3rem 0 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.legal-party-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: flex-end;
}

.legal-party-actions .dashboard-action-button {
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--primary, #4f46e5);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0;
}

.legal-party-actions .dashboard-action-button:hover,
.legal-party-actions .dashboard-action-button:focus-visible {
  text-decoration: underline;
}

.legal-party-actions .document-danger-action {
  color: var(--danger, #b91c1c);
}

.legal-party-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-start;
}

.legal-details-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  justify-content: flex-start;
}

.legal-workflow-guidance {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.legal-action-side {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.legal-recommendation-meta {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-muted, #f8fafc);
}

.legal-recommendation-meta div,
.legal-recommendation-meta strong,
.legal-recommendation-meta span {
  display: block;
}

.legal-recommendation-meta strong {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.legal-recommendation-meta span {
  margin-top: 0.12rem;
  color: var(--text-main);
  font-size: 0.86rem;
  line-height: 1.35;
}

.legal-party-form,
.legal-action-form {
  width: min(52rem, calc(100vw - 2rem));
}

@media (max-width: 900px) {
  .legal-controls {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .legal-table {
    min-width: 40rem;
  }

  .legal-table col:nth-child(2),
  .legal-table col:nth-child(6),
  .legal-table th:nth-child(2),
  .legal-table td:nth-child(2),
  .legal-table th:nth-child(6),
  .legal-table td:nth-child(6) {
    display: none !important;
  }

  .legal-form-body {
    padding: 1rem;
  }

  .legal-supporting-document {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .legal-party-actions {
    justify-content: flex-start;
  }

  .legal-party-summary {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .legal-party-section-heading {
    flex-direction: column;
    gap: 0.45rem;
  }

  .legal-ai-summary-header {
    flex-direction: column;
  }

  .legal-ai-summary-paragraph {
    text-align: left;
  }
}

.retention-table th,
.retention-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retention-table th:nth-child(1),
.retention-table td:nth-child(1),
.retention-table th:nth-child(2),
.retention-table td:nth-child(2),
.retention-table th:nth-child(3),
.retention-table td:nth-child(3),
.retention-table th:nth-child(4),
.retention-table td:nth-child(4),
.retention-table th:nth-child(5),
.retention-table td:nth-child(5),
.retention-table th:nth-child(6),
.retention-table td:nth-child(6),
.retention-table th:nth-child(7),
.retention-table td:nth-child(7) {
  width: auto;
  min-width: 0;
  max-width: none;
}

.retention-table th:nth-child(7),
.retention-table td:nth-child(7) {
  text-align: center;
}

.retention-table th:nth-child(6),
.retention-table td:nth-child(6) {
  text-align: left;
}

.retention-table td:nth-child(6) .facility-badge {
  justify-content: flex-start;
  margin-inline: 0;
}

.retention-table td:nth-child(6),
.retention-table td:nth-child(7) {
  padding-inline: 0.5rem;
}

.retention-table th:nth-child(7),
.retention-table td:nth-child(7) {
  overflow: visible;
}

.retention-table th:nth-child(7) {
  padding-right: 0.75rem;
}

.retention-table td:nth-child(7) .facility-action-toggle {
  margin-inline: auto;
}

.retention-hold-stack {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.retention-hold-stack .table-cell-secondary {
  max-width: 100%;
}

.retention-muted {
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
}

.facility-status-due-for-review,
.facility-status-overdue {
  background: #fef3c7;
  color: #92400e;
}

.facility-status-on-hold,
.facility-status-legal-hold {
  background: #fee2e2;
  color: #991b1b;
}

.facility-status-permanent {
  background: #e0f2fe;
  color: #075985;
}

.facility-status-disposed {
  background: #f1f5f9;
  color: #475569;
}

.facility-status-unavailable {
  background: #f1f5f9;
  color: #475569;
}

.retention-dialog .facility-dialog-panel,
.retention-details-modal .facility-details-modal-panel {
  width: min(900px, calc(100vw - 48px));
}

.retention-form-body {
  padding: 1.25rem;
}

.retention-related-list {
  display: grid;
  gap: 0.65rem;
  margin: 0 1rem 0.85rem;
}

.retention-related-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.retention-related-row:last-child {
  border-bottom: 0;
}

.retention-related-row strong,
.retention-related-row small {
  display: block;
}

.retention-related-row small {
  margin-top: 0.2rem;
  color: var(--text-muted, #64748b);
  font-size: 0.8rem;
}

.retention-ai-card {
  margin: 0 0 0.8rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle, #dbe4ef);
  border-left: 4px solid var(--primary, #4f46e5);
  border-radius: 10px;
  background: var(--surface-container-lowest, #fff);
}

.retention-ai-card h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.retention-ai-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.retention-ai-badges,
.retention-ai-meta,
.retention-ai-flags,
.retention-ai-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.retention-ai-reason {
  margin: 0.7rem 0 0;
  color: var(--text-primary, #111827);
  font-size: 0.9rem;
  line-height: 1.55;
}

.retention-ai-meta {
  margin-top: 0.7rem;
  color: var(--text-muted, #64748b);
  font-size: 0.8rem;
}

.retention-ai-flags {
  margin-top: 0.6rem;
}

.retention-ai-flags span {
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 700;
}

.retention-ai-actions {
  margin-top: 0.85rem;
  justify-content: flex-end;
}

.retention-recommendation-review .detail-grid {
  margin-bottom: 1rem;
}

@media (max-width: 980px) {
  .retention-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .retention-controls {
    grid-template-columns: 1fr;
  }

  .retention-dialog .facility-dialog-panel,
  .retention-details-modal .facility-details-modal-panel {
    width: calc(100vw - 24px) !important;
  }

  .retention-ai-card-header,
  .retention-ai-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
