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

:root {
  /* Brand Colors */
  --primary: #2563eb;
  /* Medical Blue */
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --secondary: #0d9488;
  /* Hospital Teal */
  --secondary-hover: #0f766e;
  --secondary-light: #f0fdfa;

  /* Status Colors */
  --status-open: #3b82f6;
  /* Blue */
  --status-open-bg: #eff6ff;
  --status-pending: #f59e0b;
  /* Amber */
  --status-pending-bg: #fffbeb;
  --status-progress: #8b5cf6;
  /* Purple */
  --status-progress-bg: #f5f3ff;
  --status-resolved: #10b981;
  /* Green */
  --status-resolved-bg: #ecfdf5;
  --status-rejected: #ef4444;
  /* Red */
  --status-rejected-bg: #fef2f2;

  /* Neutral Palette */
  --bg-main: #f8fafc;
  /* Cool Light Slate */
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #cbd5e1;
  --text-main: #0f172a;
  /* Deep Slate Blue */
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Layout Metrics */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --header-height: 70px;

  /* Aesthetics */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03), 0 0 0 1px rgba(15, 23, 42, 0.04);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  font-weight: 600;
}

a {
  text-decoration: none;
  color: inherit;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: #0f172a;
  /* Slate 900 for high professional contrast */
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width var(--transition-normal);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.brand-logo {
  font-size: 24px;
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

.menu-item-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  transition: all var(--transition-fast);
  gap: 14px;
  white-space: nowrap;
}

.menu-item-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.menu-item-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.menu-item.active .menu-item-link {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

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

.user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: #ffffff;
}

.user-role {
  font-size: 11px;
  color: #64748b;
}

.logout-btn {
  margin-left: auto;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

/* Main Content Panel */
.app-main {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
}

/* Top Header */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

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

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-action-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  padding: 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.header-action-btn:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--bg-surface);
}

/* Page Body */
.app-body {
  padding: 32px;
  flex-grow: 1;
}

/* ==========================================================================
   DASHBOARD COMPONENTS
   ========================================================================== */
/* Grid Containers */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

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

@media (max-width: 1024px) {
  .grid-2-3 {
    grid-template-columns: 1fr;
  }
}

/* Dashboard KPI Cards */
.card-kpi {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

.card-kpi:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium);
  border-color: var(--border-focus);
}

.kpi-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-icon-wrapper.primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.kpi-icon-wrapper.secondary {
  background-color: var(--secondary-light);
  color: var(--secondary);
}

.kpi-icon-wrapper.warning {
  background-color: var(--status-pending-bg);
  color: var(--status-pending);
}

.kpi-icon-wrapper.success {
  background-color: var(--status-resolved-bg);
  color: var(--status-resolved);
}

.kpi-icon-wrapper.danger {
  background-color: var(--status-rejected-bg);
  color: var(--status-rejected);
}

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-label {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.kpi-trend.up {
  color: var(--status-resolved);
}

.kpi-trend.down {
  color: var(--status-rejected);
}

/* Standard Section Cards */
.card-section {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
  background-color: var(--bg-main);
  border-color: var(--border-color);
  color: var(--text-main);
}

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

.btn-success {
  background-color: var(--status-resolved);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--status-rejected);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-warning {
  background-color: var(--status-pending);
  color: #ffffff;
}

.btn-warning:hover {
  background-color: #d97706;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  background-color: var(--bg-surface);
}

.custom-table th {
  background-color: var(--bg-main);
  padding: 14px 20px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.custom-table tbody tr {
  transition: background-color var(--transition-fast);
}

.custom-table tbody tr:hover {
  background-color: #fafbfd;
}

.custom-table tbody tr:nth-child(even) {
  background-color: #fcfdfe;
}

.custom-table tbody tr:nth-child(even):hover {
  background-color: #fafbfd;
}

/* ==========================================================================
   BADGES (STATUS / PRIORITY)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-open {
  background-color: var(--status-open-bg);
  color: var(--status-open);
}

.badge-pending {
  background-color: var(--status-pending-bg);
  color: var(--status-pending);
}

.badge-progress {
  background-color: var(--status-progress-bg);
  color: var(--status-progress);
}

.badge-resolved {
  background-color: var(--status-resolved-bg);
  color: var(--status-resolved);
}

.badge-rejected {
  background-color: var(--status-rejected-bg);
  color: var(--status-rejected);
}

.badge-priority-low {
  background-color: #f1f5f9;
  color: #475569;
}

.badge-priority-medium {
  background-color: #fef3c7;
  color: #d97706;
}

.badge-priority-high {
  background-color: #fee2e2;
  color: #b91c1c;
}

.badge-active {
  background-color: var(--status-resolved-bg);
  color: var(--status-resolved);
}

.badge-inactive {
  background-color: #f1f5f9;
  color: #64748b;
}

/* ==========================================================================
   FILTER TOOLBAR & CONTROLS
   ========================================================================== */
.toolbar-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 360px;
  min-width: 200px;
}

.search-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 16px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.filters-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-main);
  min-width: 130px;
}

.filter-select:focus {
  border-color: var(--primary);
}

/* ==========================================================================
   FORM COMPONENTS & LAYOUTS
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .form-group.full-width {
    grid-column: span 1;
  }
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
  resize: vertical;
  min-height: 110px;
}

/* ==========================================================================
   LOGIN CARD / SPLIT LAYOUTS
   ========================================================================== */
.auth-page {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-main);
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Subtle medical graphic background decorations */
.auth-bg-decor {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0) 70%);
  z-index: 0;
}

.auth-bg-decor.top-left {
  top: -200px;
  left: -200px;
}

.auth-bg-decor.bottom-right {
  bottom: -200px;
  right: -200px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  border: 1px solid var(--border-color);
  padding: 40px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  font-size: 42px;
  color: var(--primary);
  margin-bottom: 12px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-options-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
}

.checkbox-input {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.forgot-password-link {
  color: var(--primary);
  font-weight: 500;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-credentials-hint {
  margin-top: 20px;
  background-color: var(--primary-light);
  border: 1px dashed rgba(37, 99, 235, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--primary-hover);
  text-align: left;
}

.auth-credentials-hint code {
  font-weight: 600;
}

/* ==========================================================================
   PORTAL SELECTION ROOT
   ========================================================================== */
.portal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  position: relative;
}

.portal-header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  position: relative;
  z-index: 10;
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.portal-logo i {
  color: var(--primary);
  font-size: 24px;
}

.portal-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  z-index: 10;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 360px);
  gap: 32px;
  max-width: 100%;
}

@media (max-width: 768px) {
  .portal-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 380px;
  }
}

.portal-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.portal-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-premium);
  border-color: var(--primary);
}

.portal-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
  transition: all var(--transition-normal);
}

.portal-card:hover .portal-icon {
  background-color: var(--primary);
  color: #ffffff;
}

.portal-card.admin-theme:hover .portal-icon {
  background-color: var(--secondary);
  color: #ffffff;
}

.portal-card.admin-theme:hover {
  border-color: var(--secondary);
}

.portal-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.portal-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.6;
}

.portal-footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-light);
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}

/* ==========================================================================
   MODALS AND SLIDE-OUT DRAWERS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Slide-out Drawer Panel (e.g. Complaint Details) */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: -550px;
  width: 100%;
  max-width: 500px;
  height: 100%;
  background-color: var(--bg-surface);
  box-shadow: -10px 0 25px -5px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  transition: right var(--transition-normal);
}

.drawer-backdrop.active .drawer-panel {
  right: 0;
}

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

.drawer-title {
  font-size: 18px;
  font-weight: 700;
}

.drawer-body {
  padding: 24px;
  flex-grow: 1;
  overflow-y: auto;
}

/* Drawer Detail Elements */
.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 1px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

.detail-label {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
}

.detail-value-block {
  font-size: 14px;
  background-color: var(--bg-main);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  white-space: pre-line;
}

/* Timeline Components */
.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
  margin-top: 10px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 4px;
  width: 2px;
  height: 100%;
  background-color: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

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

.timeline-marker {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background-color: var(--text-light);
  border: 2px solid var(--bg-surface);
}

.timeline-marker.active {
  background-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.timeline-marker.success {
  background-color: var(--status-resolved);
}

.timeline-marker.warning {
  background-color: var(--status-pending);
}

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

.timeline-time {
  font-size: 11px;
  color: var(--text-light);
}

.timeline-title {
  font-size: 13.5px;
  font-weight: 600;
}

.timeline-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   TOAST ALERTS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  transform: translateY(20px);
  opacity: 0;
  animation: toastFadeIn 0.3s forwards cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.toast.success {
  border-left-color: var(--status-resolved);
}

.toast.error {
  border-left-color: var(--status-rejected);
}

.toast.warning {
  border-left-color: var(--status-pending);
}

.toast-icon {
  font-size: 18px;
}

.toast.success .toast-icon {
  color: var(--status-resolved);
}

.toast.error .toast-icon {
  color: var(--status-rejected);
}

.toast.warning .toast-icon {
  color: var(--status-pending);
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
}

.toast-message {
  font-size: 12.5px;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
}

@keyframes toastFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   EMPTY STATE COMPONENT
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

.empty-state-icon {
  font-size: 48px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 20px;
}

/* ==========================================================================
   RESPONSIVENESS AND COLLAPSED SIDEBAR
   ========================================================================== */
.app-container.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed-width);
}

.app-container.sidebar-collapsed .app-sidebar .brand-name,
.app-container.sidebar-collapsed .app-sidebar .user-info,
.app-container.sidebar-collapsed .app-sidebar .logout-btn,
.app-container.sidebar-collapsed .app-sidebar .menu-item-link span {
  display: none;
}

.app-container.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed-width);
}

@media (max-width: 768px) {

  /* On tablets/mobile, sidebar starts hidden and toggles overlay */
  .app-sidebar {
    left: calc(-1 * var(--sidebar-width));
  }

  .app-container.sidebar-active .app-sidebar {
    left: 0;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-header {
    padding: 0 16px;
  }

  .app-body {
    padding: 20px;
  }

  /* Semi transparent backdrop overlay when sidebar is active on mobile */
  .app-container.sidebar-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99;
  }
}