:root {
  /* Color Palette - Deep Midnight & Gold (Academic/Institutional feel) */
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --accent: #c9a227; /* Sophisticated Gold */
  --accent-hover: #e0b32d;
  --text-main: #e2e2e2;
  --text-muted: #94a3b8;
  --bg-body: #0f0f1a;
  --bg-card: rgba(22, 33, 62, 0.7);
  11 │   --border-color: rgba(201, 162, 39, 0.2);
  12 │   --success: #10b981;
  13 │   --warning: #f59e0b;
  14 │   --error: #ef4444;
  15 │   --maintenance: #8b5cf6;
  
  /* Typography */
  --font-display: 'Playfair Display', serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Spacing & Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.3);
  --shadow-accent: 0 0 20px rgba(201, 162, 39, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, .display-font {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--primary);
  border-right: 1px solid var(--border-color);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: var(--space-md);
  max-width: calc(100vw - 280px);
}

/* Utils */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* Form Controls */
.form-group {
  margin-bottom: var(--space-sm);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23c9a227' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
}

/* Components */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  color: var(--accent);
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  background: rgba(201, 162, 39, 0.1);
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-md);
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-accent);
}

.card-accent {
  background: var(--accent);
  color: var(--primary);
}

.card-accent .btn-primary {
  background: var(--primary);
  color: var(--accent);
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2.5rem;
  font-family: var(--font-display);
  color: var(--accent);
  margin: var(--space-xs) 0;
}

.stat-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stat-trend {
  font-size: 0.8rem;
}

.stat-trend.success { color: var(--success); }
.stat-trend.warning { color: var(--warning); }

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.table-container {
  overflow-x: auto;
}

.card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

.full-height {
  height: 100%;
}

.full-width {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.resident-info {
  display: flex;
  flex-direction: column;
}

.resident-name {
  font-weight: 500;
}

.resident-id {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.capacity-item {
  margin-bottom: 1.5rem;
}

.capacity-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.capacity-value {
  color: var(--accent);
}

.main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-sm);
}

th {
  text-align: left;
  padding: 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
}

td {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-error { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-maintenance { background: rgba(139, 92, 246, 0.1); color: var(--maintenance); }

.hall-visual {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.hall-progress {
  height: 100%;
  background: var(--accent);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.header-title {
  font-size: 2.5rem;
}

.header-subtitle {
  color: var(--text-muted);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Modal / Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  padding: var(--space-md);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-sm);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
}

.close-btn:hover {
  color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.icon-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn.delete:hover {
  border-color: var(--error);
  color: var(--error);
}

.user-info {
  text-align: right;
}

.user-name {
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: bold;
}

/* Auth Pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at top right, var(--primary-light), var(--bg-body));
  padding: var(--space-md);
}

.auth-card {
  width: 100%;
  max-width: 450px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md);
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-md);
}

.auth-brand {
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.auth-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-md);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before { margin-right: 1rem; }
.divider:not(:empty)::after { margin-left: 1rem; }

.social-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeIn 0.6s ease forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
