@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --font-ui: 'Inter', 'Sarabun', sans-serif;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

/* Midnight Neon (Default Theme) */
body, body[data-theme="midnight"] {
  --bg-main: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-sidebar: #070a12;
  --bg-header: rgba(11, 15, 25, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  --accent-violet: #8b5cf6;
  --accent-violet-rgb: 139, 92, 246;
  --accent-teal: #0ea5e9;
  --accent-teal-rgb: 14, 165, 233;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #f59e0b;
  --accent-amber-rgb: 245, 158, 11;
  --accent-rose: #f43f5e;
  --accent-rose-rgb: 244, 63, 94;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --bg-input: rgba(255, 255, 255, 0.03);
  --glass-blur: blur(12px);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Slate Professional (Light Theme) */
body[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-header: rgba(248, 250, 252, 0.85);
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.15);
  
  --accent-violet: #4f46e5;
  --accent-violet-rgb: 79, 70, 229;
  --accent-teal: #0284c7;
  --accent-teal-rgb: 2, 132, 199;
  --accent-emerald: #059669;
  --accent-emerald-rgb: 5, 150, 105;
  --accent-amber: #d97706;
  --accent-amber-rgb: 217, 119, 6;
  --accent-rose: #e11d48;
  --accent-rose-rgb: 225, 29, 72;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --bg-input: #f8fafc;
  --glass-blur: blur(0px);
  --shadow-main: 0 4px 20px 0 rgba(15, 23, 42, 0.08);
}

/* Cyberpunk Amber (Dark Theme) */
body[data-theme="cyberpunk"] {
  --bg-main: #050505;
  --bg-card: rgba(20, 15, 5, 0.8);
  --bg-sidebar: #000000;
  --bg-header: rgba(5, 5, 5, 0.9);
  --border: rgba(245, 158, 11, 0.2);
  --border-hover: rgba(245, 158, 11, 0.4);
  
  --accent-violet: #f59e0b;
  --accent-violet-rgb: 245, 158, 11;
  --accent-teal: #f59e0b;
  --accent-teal-rgb: 245, 158, 11;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #f59e0b;
  --accent-amber-rgb: 245, 158, 11;
  --accent-rose: #ef4444;
  --accent-rose-rgb: 239, 68, 68;
  
  --text-primary: #f8fafc;
  --text-secondary: #f59e0b;
  --text-muted: #b45309;
  
  --bg-input: rgba(0, 0, 0, 0.5);
  --glass-blur: blur(8px);
  --shadow-main: 0 0 20px rgba(245, 158, 11, 0.15);
}

/* Sunset Breeze (Light Orange-Pink Theme) */
body[data-theme="sunset"] {
  --bg-main: #fffaf5;
  --bg-card: #ffffff;
  --bg-sidebar: #2c1a11;
  --bg-header: rgba(255, 250, 245, 0.85);
  --border: rgba(249, 115, 22, 0.12);
  --border-hover: rgba(249, 115, 22, 0.25);
  
  --accent-violet: #f97316;
  --accent-violet-rgb: 249, 115, 22;
  --accent-teal: #ec4899;
  --accent-teal-rgb: 236, 72, 153;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #eab308;
  --accent-amber-rgb: 234, 179, 8;
  --accent-rose: #ef4444;
  --accent-rose-rgb: 239, 68, 68;
  
  --text-primary: #431407;
  --text-secondary: #7c2d12;
  --text-muted: #9a3412;
  
  --bg-input: #fff7ed;
  --glass-blur: blur(0px);
  --shadow-main: 0 4px 20px 0 rgba(249, 115, 22, 0.06);
}

/* Forest Zen (Dark Green Theme) */
body[data-theme="forest"] {
  --bg-main: #06140e;
  --bg-card: rgba(12, 35, 25, 0.65);
  --bg-sidebar: #030a07;
  --bg-header: rgba(6, 20, 14, 0.85);
  --border: rgba(16, 185, 129, 0.12);
  --border-hover: rgba(16, 185, 129, 0.25);
  
  --accent-violet: #10b981;
  --accent-violet-rgb: 16, 185, 129;
  --accent-teal: #34d399;
  --accent-teal-rgb: 52, 211, 153;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #f59e0b;
  --accent-amber-rgb: 245, 158, 11;
  --accent-rose: #f43f5e;
  --accent-rose-rgb: 244, 63, 94;
  
  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-muted: #65a30d;
  
  --bg-input: rgba(255, 255, 255, 0.02);
  --glass-blur: blur(12px);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Nordic Frost (Light Ice Blue Theme) */
body[data-theme="nordic"] {
  --bg-main: #f0f4f8;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-header: rgba(240, 244, 248, 0.85);
  --border: rgba(56, 189, 248, 0.15);
  --border-hover: rgba(56, 189, 248, 0.3);
  
  --accent-violet: #0284c7;
  --accent-violet-rgb: 2, 132, 199;
  --accent-teal: #0ea5e9;
  --accent-teal-rgb: 14, 165, 233;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #d97706;
  --accent-amber-rgb: 217, 119, 6;
  --accent-rose: #e11d48;
  --accent-rose-rgb: 225, 29, 72;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --bg-input: #f8fafc;
  --glass-blur: blur(0px);
  --shadow-main: 0 4px 20px 0 rgba(2, 132, 199, 0.06);
}

/* Royal Amethyst (Dark Purple Theme) */
body[data-theme="amethyst"] {
  --bg-main: #120b24;
  --bg-card: rgba(26, 17, 51, 0.65);
  --bg-sidebar: #090514;
  --bg-header: rgba(18, 11, 36, 0.85);
  --border: rgba(167, 139, 250, 0.15);
  --border-hover: rgba(167, 139, 250, 0.3);
  
  --accent-violet: #a78bfa;
  --accent-violet-rgb: 167, 139, 250;
  --accent-teal: #fbbf24;
  --accent-teal-rgb: 251, 191, 36;
  --accent-emerald: #34d399;
  --accent-emerald-rgb: 52, 211, 153;
  --accent-amber: #fbbf24;
  --accent-amber-rgb: 251, 191, 36;
  --accent-rose: #f87171;
  --accent-rose-rgb: 248, 113, 113;
  
  --text-primary: #f5f3ff;
  --text-secondary: #ddd6fe;
  --text-muted: #a78bfa;
  
  --bg-input: rgba(255, 255, 255, 0.03);
  --glass-blur: blur(12px);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* Vintage Warmth (Milk Tea Beige Theme) */
body[data-theme="vintage"] {
  --bg-main: #f5efe6;
  --bg-card: #faf6f0;
  --bg-sidebar: #3e2723;
  --bg-header: rgba(245, 239, 230, 0.85);
  --border: rgba(141, 110, 99, 0.15);
  --border-hover: rgba(141, 110, 99, 0.3);
  
  --accent-violet: #8d6e63;
  --accent-violet-rgb: 141, 110, 99;
  --accent-teal: #a1887f;
  --accent-teal-rgb: 161, 136, 127;
  --accent-emerald: #6b8e23;
  --accent-emerald-rgb: 107, 142, 35;
  --accent-amber: #b27a17;
  --accent-amber-rgb: 178, 122, 23;
  --accent-rose: #d32f2f;
  --accent-rose-rgb: 211, 47, 47;
  
  --text-primary: #3e2723;
  --text-secondary: #5d4037;
  --text-muted: #8d6e63;
  
  --bg-input: #fffcf8;
  --glass-blur: blur(0px);
  --shadow-main: 0 4px 20px 0 rgba(141, 110, 99, 0.06);
}

/* Martian Rust (Dark Terracotta Theme) */
body[data-theme="mars"] {
  --bg-main: #180c08;
  --bg-card: rgba(36, 18, 12, 0.65);
  --bg-sidebar: #0d0604;
  --bg-header: rgba(24, 12, 8, 0.85);
  --border: rgba(249, 115, 22, 0.15);
  --border-hover: rgba(249, 115, 22, 0.3);
  
  --accent-violet: #ea580c;
  --accent-violet-rgb: 234, 88, 12;
  --accent-teal: #f97316;
  --accent-teal-rgb: 249, 115, 22;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-amber: #eab308;
  --accent-amber-rgb: 234, 179, 8;
  --accent-rose: #ef4444;
  --accent-rose-rgb: 239, 68, 68;
  
  --text-primary: #ffedd5;
  --text-secondary: #fed7aa;
  --text-muted: #ea580c;
  
  --bg-input: rgba(255, 255, 255, 0.02);
  --glass-blur: blur(12px);
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Dracula Dark (Vampire Neon Theme) */
body[data-theme="dracula"] {
  --bg-main: #1e1f29;
  --bg-card: rgba(40, 42, 54, 0.75);
  --bg-sidebar: #191a21;
  --bg-header: rgba(30, 31, 41, 0.9);
  --border: rgba(98, 114, 164, 0.25);
  --border-hover: rgba(98, 114, 164, 0.5);
  
  --accent-violet: #bd93f9;
  --accent-violet-rgb: 189, 147, 249;
  --accent-teal: #8be9fd;
  --accent-teal-rgb: 139, 233, 253;
  --accent-emerald: #50fa7b;
  --accent-emerald-rgb: 80, 250, 123;
  --accent-amber: #ffb86c;
  --accent-amber-rgb: 255, 184, 108;
  --accent-rose: #ff5555;
  --accent-rose-rgb: 255, 85, 85;
  
  --text-primary: #f8f8f2;
  --text-secondary: #6272a4;
  --text-muted: #6272a4;
  
  --bg-input: #282a36;
  --glass-blur: blur(8px);
  --shadow-main: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-violet);
}

/* App Layout Shell */
#app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Styling */
aside {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 24px 16px;
  transition: transform var(--transition-normal);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-teal));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 0 15px rgba(var(--accent-violet-rgb), 0.4);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.menu-item a:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.menu-item.active a {
  color: white;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 12px rgba(var(--accent-violet-rgb), 0.05);
}

.menu-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: stroke var(--transition-fast);
}

.menu-item.active svg {
  color: var(--accent-violet);
}

/* User switcher in sidebar footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
}

.switch-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.switch-btn.active {
  background: var(--accent-violet);
  color: white;
  box-shadow: 0 4px 12px rgba(var(--accent-violet-rgb), 0.25);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.85rem;
}

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

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

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

/* Main Area Layout */
main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

header {
  height: 70px;
  background-color: var(--bg-header);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Content Container */
.content-wrapper {
  padding: 32px;
  flex-grow: 1;
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-main);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Dashboard Grid & Layouts */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}

.metric-data h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.metric-data p {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Unit Status Colors */
.badge-vacant {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-occupied {
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent-teal);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.badge-reserved {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-maintenance {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

/* Maintenance Status Colors */
.badge-open {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--accent-violet);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--accent-violet-rgb), 0.35);
}

.btn-primary:hover {
  filter: brightness(0.9);
  box-shadow: 0 6px 20px rgba(var(--accent-violet-rgb), 0.45);
}

.btn-success {
  background: var(--accent-emerald);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--accent-emerald-rgb), 0.35);
}

.btn-success:hover {
  filter: brightness(0.9);
  box-shadow: 0 6px 20px rgba(var(--accent-emerald-rgb), 0.45);
}

.btn-danger {
  background: var(--accent-rose);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(var(--accent-rose-rgb), 0.35);
}

.btn-danger:hover {
  filter: brightness(0.9);
  box-shadow: 0 6px 20px rgba(var(--accent-rose-rgb), 0.45);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.form-control, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-ui);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus, select:focus, textarea:focus {
  border-color: var(--accent-violet);
  background: var(--bg-input);
  filter: brightness(1.05);
  box-shadow: 0 0 10px rgba(var(--accent-violet-rgb), 0.15);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:hover td {
  background: rgba(var(--accent-violet-rgb), 0.03);
}

/* Modal Dialog */
dialog {
  margin: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  width: 550px;
  max-width: 90vw;
  box-shadow: var(--shadow-main);
  outline: none;
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

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

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

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

.close-btn svg {
  width: 24px;
  height: 24px;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

/* Property Grid Layout & Room Selector */
.property-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--border-hover);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.floor-row {
  margin-bottom: 28px;
}

.floor-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 12px;
  padding-left: 4px;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}

.room-card {
  aspect-ratio: 1.2;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.01);
}

.room-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.room-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.room-tenant {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Room Colors matching Unit Status */
.room-vacant {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--accent-emerald);
}
.room-vacant:hover {
  background: rgba(16, 185, 129, 0.16);
}

.room-occupied {
  background: rgba(14, 165, 233, 0.08);
  border-left: 4px solid var(--accent-teal);
}
.room-occupied:hover {
  background: rgba(14, 165, 233, 0.16);
}

.room-reserved {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--accent-amber);
}
.room-reserved:hover {
  background: rgba(245, 158, 11, 0.16);
}

.room-maintenance {
  background: rgba(244, 63, 94, 0.08);
  border-left: 4px solid var(--accent-rose);
}
.room-maintenance:hover {
  background: rgba(244, 63, 94, 0.16);
}

/* Expiring Alerts Widget */
.alert-strip {
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.alert-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-info svg {
  color: var(--accent-rose);
}

.alert-message {
  font-size: 0.85rem;
}

/* LINE Notification Logs HUD (Floating Overlay) */
#line-hud {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  height: 280px;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-normal);
}

#line-hud.collapsed {
  height: 48px;
}

.line-hud-header {
  background: #06C755; /* LINE Brand Color */
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.line-hud-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-hud-body {
  padding: 12px;
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line-hud-collapsed-toggle {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.line-log-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-log-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.line-log-text {
  color: #a3e635; /* bright light green text for line mock output */
  word-break: break-word;
  white-space: pre-wrap;
}

/* QR Code Display in Payment modal */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  padding: 16px;
  background: white;
  border-radius: var(--radius-md);
  width: fit-content;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}

.qr-code {
  width: 180px;
  height: 180px;
  background-size: contain;
}

.qr-logo {
  margin-top: 8px;
  width: 100px;
}

/* Printable Bill / Invoice Template */
.print-area {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  .print-area, .print-area * {
    visibility: visible;
  }
  .print-area {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    color: black !important;
    background: white !important;
    font-family: 'Sarabun', serif;
  }
  .print-area table, .print-area td, .print-area th {
    border-color: #333 !important;
    color: black !important;
  }
}

.invoice-template {
  background: white;
  color: #1e293b;
  padding: 40px;
  border-radius: var(--radius-lg);
  font-family: 'Sarabun', sans-serif;
  max-width: 800px;
  margin: 0 auto;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.invoice-logo-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

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

.invoice-title h1 {
  font-size: 1.8rem;
  color: #8b5cf6;
  font-weight: 700;
  margin-bottom: 4px;
}

.invoice-title p {
  color: #64748b;
  font-size: 0.9rem;
}

.invoice-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
  font-size: 0.9rem;
}

.invoice-table {
  width: 100%;
  margin-bottom: 30px;
}

.invoice-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
  border: 1px solid #cbd5e1;
}

.invoice-table td {
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 10px 12px;
}

.invoice-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 20px;
  font-size: 0.95rem;
}

.invoice-baht-text {
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-style: italic;
  font-weight: 500;
  color: #475569;
  border: 1px solid #e2e8f0;
  min-width: 250px;
}

.invoice-total-calc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
  min-width: 220px;
}

.invoice-total-calc .row {
  display: flex;
  justify-content: space-between;
}

.invoice-total-calc .grand-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  border-top: 2px solid #e2e8f0;
  padding-top: 8px;
  margin-top: 8px;
}

/* Resident Login Simulation Screen */
.resident-login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
}

.login-card {
  width: 420px;
  text-align: center;
  padding: 40px;
}

.login-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
  color: var(--accent-violet);
}

.login-icon-box svg {
  width: 32px;
  height: 32px;
}

/* Helper utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--accent-emerald); }
.text-danger { color: var(--accent-rose); }
.text-warning { color: var(--accent-amber); }
.text-primary-color { color: var(--accent-violet); }
.text-muted-color { color: var(--text-muted); }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-3 { gap: 12px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  #app-container {
    grid-template-columns: 1fr;
  }
  aside {
    position: fixed;
    bottom: 0;
    top: auto;
    height: 60px;
    width: 100%;
    flex-direction: row;
    padding: 8px 16px;
    border-right: none;
    border-top: 1px solid var(--border);
    background-color: var(--bg-sidebar);
  }
  .logo-container, .sidebar-footer .user-profile {
    display: none;
  }
  .menu-list {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }
  .menu-item a {
    padding: 8px;
    font-size: 0.8rem;
    flex-direction: column;
    gap: 4px;
  }
  .menu-item a span {
    font-size: 0.65rem;
  }
  .sidebar-footer {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    justify-content: center;
  }
  main {
    height: calc(100vh - 60px);
    margin-bottom: 60px;
  }
  #line-hud {
    bottom: 80px;
    right: 16px;
    width: calc(100% - 32px);
  }
}

/* ==========================================
   Loading Animation & Transitions
   ========================================== */

/* Page Loader */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  width: 100%;
  animation: amsFadeIn 0.3s ease forwards;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--accent-violet);
  border-radius: 50%;
  animation: amsSpin 1s linear infinite;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 8px rgba(var(--accent-violet-rgb), 0.3));
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* Global Actions Loading Overlay */
#global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#global-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: amsSpin 0.9s linear infinite;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 15px rgba(var(--accent-teal-rgb), 0.5));
}

.overlay-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 1px;
}

@keyframes amsSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes amsFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

