:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #6b7280;
  --card: #f8fafc;
  --border: #e5e7eb;
  --brand: #1e40af;
  --brand-light: #3b82f6;
  --medipol-blue: #1e40af;
  --medipol-light: #dbeafe;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
}
.dark {
  --bg: #0b0d12;
  --fg: #f3f4f6;
  --muted: #9ca3af;
  --card: #11151d;
  --border: #1f2937;
  --brand: #60a5fa;
  --brand-light: #93c5fd;
  --medipol-blue: #60a5fa;
  --medipol-light: #1e3a8a;
  --ok: #22c55e;
  --warn: #fbbf24;
  --danger: #f87171;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin:0; background: var(--bg); color: var(--fg);
  font: 14px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
}
.app { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
header {
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:12px 16px; border-bottom:1px solid rgba(255, 255, 255, 0.2);
  position: sticky; top:0; background: linear-gradient(135deg, var(--medipol-blue) 0%, #2563eb 100%); z-index: 10;
  height: 70px;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.header-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo-img {
  height: 45px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.header-logo-fallback {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
}
.brand { display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.3px; color: white; }
.brand .dot { width: 10px; height: 10px; border-radius:50%; background: rgba(255, 255, 255, 0.8); display:inline-block; }
.layout { display:grid; grid-template-columns: 260px 1fr; }

aside { border-right:1px solid var(--border); padding:16px; }
.nav { display:grid; gap:8px; }
.nav a { text-decoration:none; color:var(--fg); padding:10px 12px; border-radius:10px;
  display:flex; justify-content:space-between; align-items:center; border:1px solid transparent;
}
.nav a.active { background: var(--card); border-color: var(--border); }

main { padding: 18px; }
.select, .input, .btn, .tag { font: inherit; }
.select, .input { padding: 8px 10px; border:1px solid var(--border); border-radius:8px; background: var(--bg); color: var(--fg); }
.btn { padding: 8px 10px; border-radius: 8px; background: var(--brand); border:none; color:#fff; cursor:pointer; }
.btn.ghost { background: transparent; color: var(--fg); border:1px solid var(--border); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); color:#111; }
.btn.danger { background: var(--danger); }
.tag { padding:4px 8px; border:1px solid var(--border); border-radius:999px; font-size:12px; color: var(--muted); }

.cards { display:grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap:12px; }
.card { background: var(--card); border:1px solid var(--border); border-radius:14px; padding:14px; }
.card h4 { margin:0 0 6px; font-size:12px; color: var(--muted); text-transform: uppercase; letter-spacing:.5px; }
.card .big { font-size:22px; font-weight:800; }

.grid { display:grid; grid-template-columns: 1.2fr .8fr; gap:16px; margin-top: 16px; }
.panel { background: var(--card); border:1px solid var(--border); border-radius:14px; padding:14px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }

.list { display:grid; gap:8px; }
.row { display:grid; gap:8px; align-items:center; padding:10px; border:1px solid var(--border); border-radius:10px;
  grid-template-columns: 1fr .8fr .6fr .6fr .5fr auto;
}
.row.small { grid-template-columns: 1fr auto; }
.row.tight { gap: 6px; }
.row small { color: var(--muted); }

.toolbar-line { display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 12px; align-items:center; }
.form { display:grid; gap:10px; grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.form .field { display:grid; gap:6px; }
.form label { font-size:12px; color: var(--muted); }
.form .full { grid-column: 1 / -1; }

.toolbar { display:flex; align-items:center; gap:8px; color: white; }
.toolbar .tag { background: rgba(255, 255, 255, 0.2); color: white; border: 1px solid rgba(255, 255, 255, 0.3); }
.toolbar .btn-icon { color: white; border-color: rgba(255, 255, 255, 0.3); }
.toolbar .btn-icon:hover { background: rgba(255, 255, 255, 0.1); }
.toolbar select { background: rgba(255, 255, 255, 0.1); color: white; border-color: rgba(255, 255, 255, 0.3); }
.toolbar label { color: rgba(255, 255, 255, 0.9); }
.bar { display:flex; align-items:center; gap:8px; }
.bar .label { width: 120px; color: var(--muted); }
.bar .track { flex:1; height:10px; background: var(--border); border-radius:6px; overflow:hidden; }
.bar .fill { height:100%; background: var(--brand); }
.k { font-weight: 700; }

/* Users page styles */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.filters {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: end;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 280px;
  min-width: 200px;
}

.search-box.modern {
  background: var(--bg);
  border-radius: 16px;
  padding: 0;
  border: 2px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.search-box.modern:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
  transition: color 0.2s ease;
  width: 16px;
  height: 16px;
}

.search-box.modern:focus-within .search-icon {
  color: var(--brand);
}

.search-box.modern input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.search-box.modern input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.search-box.modern input:focus::placeholder {
  color: transparent;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 150px;
}

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

/* Modern Users Page Styles */
.users-page-modern {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
}

.page-header-modern {
  margin-bottom: 32px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 24px 0;
}

.header-title h1 {
  font-size: 32px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-subtitle {
  color: #64748b;
  font-size: 16px;
  margin: 0;
  font-weight: 500;
}

.btn-modern {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-modern.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
}

.btn-modern.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.controls-section {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  align-items: center;
}

.search-modern {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-icon-modern {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  z-index: 2;
}

.search-input-modern {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  transition: all 0.2s ease;
}

.search-input-modern:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-input-modern::placeholder {
  color: #94a3b8;
}

.select-modern {
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.select-modern:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.user-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #f1f5f9;
  position: relative;
  overflow: hidden;
}

.user-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.user-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.avatar-text {
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.user-status {
  position: relative;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-dot.active {
  background: #10b981;
}

.status-dot.inactive {
  background: #ef4444;
}

.user-card-body {
  margin-bottom: 20px;
}

.user-name {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

.user-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.user-name a:hover {
  color: #3b82f6;
}

.user-email {
  color: #64748b;
  font-size: 14px;
  margin: 0 0 16px 0;
  font-weight: 500;
}

.user-roles {
  margin-bottom: 16px;
}

.role-badge-modern {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
  margin-bottom: 4px;
}

.role-badge-modern.role-admin {
  background: #fef3c7;
  color: #92400e;
}

.role-badge-modern.role-sales {
  background: #dbeafe;
  color: #1e40af;
}

.role-badge-modern.role-support {
  background: #d1fae5;
  color: #065f46;
}

.no-roles-modern {
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
}

.user-meta {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

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

.meta-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
}

.user-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.action-btn.edit {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.action-btn.edit:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(1.1);
}

.action-btn.toggle {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.action-btn.toggle:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: scale(1.1);
}

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

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.1);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: #64748b;
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1e293b;
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .users-page-modern {
    padding: 16px;
  }
  
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .controls-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-modern {
    max-width: none;
  }
  
  .users-grid {
    grid-template-columns: 1fr;
  }
}

.no-results {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
}

.role-badge.role-admin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.role-badge.role-admin::before {
  content: '👑';
  font-size: 10px;
}

.role-badge.role-sales {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.role-badge.role-sales::before {
  content: '💼';
  font-size: 10px;
}

.role-badge.role-support {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.role-badge.role-support::before {
  content: '🛠️';
  font-size: 10px;
}

.role-badge:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.status-badge.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.status-badge.active::before {
  content: '●';
  color: #d1fae5;
  font-size: 8px;
}

.status-badge.disabled {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.status-badge.disabled::before {
  content: '●';
  color: #fecaca;
  font-size: 8px;
}

.dark .status-badge.active {
  background: #064e3b;
  color: #34d399;
}

.dark .status-badge.disabled {
  background: #7f1d1d;
  color: #fca5a5;
}

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

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background: var(--card);
}

.btn-icon.danger:hover {
  background: var(--danger);
  color: white;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px 12px 0 0;
}

.modal-header h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--border);
  color: var(--fg);
}

.modal-body {
  padding: 32px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  background: var(--card);
  border-radius: 0 0 12px 12px;
}

.modal-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
  padding: 0;
}

.modal-form .form-group {
  margin-bottom: 0;
}

.modal-form .form-group.full-width {
  grid-column: 1 / -1;
}

.form-section {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-top: 16px;
}

.form-section h5 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* Roles page styles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

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

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.role-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.role-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.role-card.inactive {
  opacity: 0.6;
  background: var(--bg);
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.role-info h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  text-transform: capitalize;
  letter-spacing: 0.5px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: rgba(22, 163, 74, 0.1);
  color: var(--ok);
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.status-badge.inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--muted);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.role-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--card);
  border-color: var(--brand);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}

.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.role-body {
  display: grid;
  gap: 16px;
}

.role-description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.role-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.permissions-summary h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--fg);
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-tag {
  background: rgba(59, 130, 246, 0.1);
  color: var(--brand);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.no-permissions {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

.no-results {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 16px;
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr .8fr .6fr auto; }
  .row .hide-sm { display:none; }
  .form { grid-template-columns: 1fr; }
  
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    max-width: none;
    min-width: auto;
  }
  
  .filter-group {
    min-width: auto;
  }
  
  .modal-form {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .users-table {
    font-size: 12px;
  }
  
  .users-table th,
  .users-table td {
    padding: 8px;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
}

@media (max-width: 768px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }
  
  .role-stats {
    grid-template-columns: 1fr;
  }
  
  .permissions-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

/* User Edit Page Styles */
.user-edit-page {
  min-height: 100vh;
  background: var(--bg);
}

.page-header-section {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  margin-bottom: 32px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

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

.header-title h1 {
  margin: 0 0 4px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
}

.header-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--card) 0%, var(--bg) 100%);
}

.card-header h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card-content {
  padding: 32px;
}

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

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

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.region-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.btn-link-small {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-link-small:hover {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: all 0.2s ease;
}

.checkbox-container:hover {
  border-color: var(--brand);
}

.checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.roles-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.role-option {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
  background: var(--bg);
}

.role-option:hover {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.02);
}

.role-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand);
}

.role-card {
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  transition: all 0.2s ease;
}

.role-option input[type="checkbox"]:checked {
  background: var(--brand);
}

.role-option:has(input[type="checkbox"]:checked) {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.05);
}

.role-name {
  font-weight: 500;
  color: var(--fg);
}

.role-description {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

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

.role-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.role-description {
  font-size: 13px;
  color: var(--muted);
}

.multi-select-wrapper select {
  min-height: 120px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 32px;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-radius: 0 0 16px 16px;
  margin-top: -1px;
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

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

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

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

.btn-primary:hover {
  background: #2563eb;
}

.error-message {
  color: var(--danger);
  font-size: 12px;
  display: none;
}

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

@media (max-width: 768px) {
  .page-content {
    padding: 0 16px 40px;
  }
  
  .card-content {
    padding: 24px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .roles-selection {
    grid-template-columns: 1fr;
  }
  
  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* Reports Page */
.report-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 0.6fr 0.9fr 0.7fr 1fr;
  gap: 8px;
  align-items: center;
}

.list-header.report-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.list-item.report-grid {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
}

.report-grid .cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .report-grid {
    grid-template-columns: 1fr 0.7fr 0.7fr 0.7fr 0.6fr 0.8fr 0.6fr 0.8fr;
  }
}

@media (max-width: 768px) {
  .report-grid {
    grid-template-columns: 1fr 1fr;
    row-gap: 6px;
  }
  .list-header.report-grid {
    display: none;
  }
  .list-item.report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Simple Charts for Reports */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 12px; }
.chart-block { background: var(--card); border:1px solid var(--border); border-radius: 10px; padding: 12px; }
.chart-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.chart-bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 1fr 4fr auto; align-items: center; gap: 8px; }
.bar-label { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--border); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); }

/* Profile Page Styles */
.profile-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 15px;
}

.profile-header {
  text-align: center;
  margin-bottom: 25px;
}

.profile-header h1 {
  color: #333;
  margin-bottom: 8px;
  font-size: 1.8rem;
}

.profile-sections {
  display: grid;
  gap: 20px;
}

.profile-section {
  background: white;
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.profile-section h2 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.2rem;
  border-bottom: 1px solid #007bff;
  padding-bottom: 8px;
}

/* Avatar Section */
.avatar-section {
  text-align: center;
}

.avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: 15px;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #007bff;
  background-color: #f8f9fa;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #6c757d;
  border: 3px solid #007bff;
}

.avatar-actions {
  margin-top: 12px;
}

.avatar-actions .btn {
  margin: 0 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.file-input-wrapper input[type=file] {
  position: absolute;
  left: -9999px;
}

.avatar-info {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #6c757d;
}

/* Form Styles */
.profile-form {
  display: grid;
  gap: 15px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

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

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

.form-group label {
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
  font-size: 0.9rem;
}

.form-group input {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 15px;
}

/* Password Section */
.password-form {
  display: grid;
  gap: 12px;
}

.password-form .form-group input {
  background-color: #f8f9fa;
}

/* Button Styles */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background-color: #1e40af;
  color: white;
}

.btn-primary:hover {
  background-color: #1e3a8a;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

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

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

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 50%;
  left: 50%;
  margin-left: -7px;
  margin-top: -7px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background-color: #28a745;
}

.toast.error {
  background-color: #dc3545;
}

.toast.info {
  background-color: #17a2b8;
}

/* Icons */
.icon-user::before { content: "👤"; }
.icon-upload::before { content: "📁"; }
.icon-trash::before { content: "🗑️"; }
.icon-loading::before { content: "⏳"; }

/* Login Page Styles */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e40af 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease-out;
}

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

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logo-icon {
  font-size: 2rem;
}

.logo h1 {
  color: #333;
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.login-subtitle {
  color: #666;
  margin: 0;
  font-size: 0.95rem;
}

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

.login-form .form-group {
  display: flex;
  flex-direction: column;
}

.login-form .form-group label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
  font-size: 0.9rem;
}

.login-form .form-group input {
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
}

.login-form .form-group input:focus {
  outline: none;
  border-color: #1e40af;
  background-color: white;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
}

.checkbox-wrapper input[type="checkbox"] {
  margin-right: 8px;
}

.forgot-password {
  color: #1e40af;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.forgot-password:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e1e5e9;
}

.login-divider span {
  background: white;
  padding: 0 15px;
  color: #666;
  font-size: 0.9rem;
}

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

.demo-text {
  margin: 0 0 10px 0;
  color: #666;
  font-size: 0.9rem;
}

.btn-demo {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 2px solid #6c757d;
  background: transparent;
  color: #6c757d;
  transition: all 0.3s;
}

.btn-demo:hover {
  background: #6c757d;
  color: white;
}

.login-footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e1e5e9;
}

.login-footer p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.login-footer a {
  color: #1e40af;
  text-decoration: none;
  font-weight: 600;
}

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

/* Responsive Login */
@media (max-width: 480px) {
  .login-card {
    padding: 30px 20px;
    margin: 10px;
  }
  
  .logo h1 {
    font-size: 1.5rem;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .profile-section {
    padding: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .avatar-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .avatar-actions {
    justify-content: center;
  }
}

/* Notifications Styles */
.notifications-container { position: relative; }
.notification-badge { 
  position: absolute; top: -5px; right: -5px; 
  background: var(--danger); color: white; 
  border-radius: 50%; width: 18px; height: 18px; 
  font-size: 10px; display: flex; align-items: center; justify-content: center; 
  font-weight: bold; 
}
.notifications-dropdown { 
  position: absolute; top: 100%; right: 0; 
  background: var(--bg); border: 1px solid var(--border); 
  border-radius: 10px; width: 320px; max-height: 400px; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; 
  overflow: hidden; 
}
.notifications-header { 
  padding: 12px 16px; border-bottom: 1px solid var(--border); 
  display: flex; justify-content: space-between; align-items: center; 
  background: var(--card); 
}
.notifications-header h4 { margin: 0; font-size: 14px; }
.notifications-list { max-height: 300px; overflow-y: auto; }
.notification-item {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notification-item:hover {
  background-color: var(--hover-color);
}

.notification-item.read {
  opacity: 0.7;
}

.notification-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.notification-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.notification-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Permission Groups Styling - Updated to match form design */
.permissions-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.permission-group-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.permission-group-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.permission-group-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.permission-group-header .group-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.permission-group-header .group-info h4 {
  margin: 0;
  color: #495057;
  font-weight: 600;
  font-size: 1.1rem;
}

.permission-group-header .group-description {
  margin: 0.25rem 0 0 0;
  color: #6c757d;
  font-size: 0.9rem;
}

.permission-items {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.permission-rowheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 70px;
  background: linear-gradient(135deg, var(--medipol-blue) 0%, #2563eb 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
  position: relative;
}

.header-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo-img {
  height: 45px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.header-logo-fallback {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
}

.permission-info {
  flex: 1;
}

.permission-label {
  font-weight: 500;
  color: #495057;
  margin: 0;
  cursor: pointer;
}

.permission-control {
  display: flex;
  align-items: center;
}

.permission-control .form-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: white;
  color: #495057;
  font-size: 0.9rem;
  min-width: 120px;
  cursor: pointer;
}

.permission-control .form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Remove old role edit specific styles */
.role-edit-page {
  display: none;
}

.permissions-grid {
  display: none;
}

.permission-group {
  display: none;
}

.permission-item {
  display: none;
}

.permission-select {
  display: none;
}

/* Responsive Design for Role Edit */
@media (max-width: 768px) {
  .permission-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .permission-control {
    width: 100%;
  }
  
  .permission-control .form-select {
    width: 100%;
  }
  
  .permission-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .permission-group-header .group-icon {
    align-self: center;
  }
}

/* Lead Lifecycle Styles */
.stage-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  padding: 0 20px;
}

.stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.stage-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 60%;
  right: -40%;
  height: 2px;
  background-color: #e5e7eb;
  z-index: 1;
}

.stage-item.completed:not(:last-child)::after {
  background-color: #10b981;
}

.stage-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
  position: relative;
  z-index: 2;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stage-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
}

.stage-item.active .stage-label {
  color: var(--fg);
  font-weight: 600;
}

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: 30px;
}

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

.timeline-item {
  position: relative;
  margin-bottom: 24px;
  padding-left: 30px;
}

.timeline-marker {
  position: absolute;
  left: -37px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

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

.timeline-header strong {
  color: var(--fg);
}

.timeline-header small {
  color: var(--muted);
  font-size: 12px;
}

.stage-change {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.timeline-notes {
  margin: 8px 0;
  line-height: 1.5;
  color: var(--fg);
}

.timeline-user {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.timeline-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-style: italic;
}

/* Contact Form Styles */
.contact-form .form-group {
  margin-bottom: 16px;
}

.contact-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

/* Assignment Eligibility UI Styles */
.assignment-section {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.assignment-section h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.section-desc {
  margin: 0 0 20px 0;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-item:hover {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.02);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand);
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--brand);
  border-color: var(--brand);
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.selection-actions {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--brand);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #2563eb;
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.limit-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.limit-item label {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.select-modern {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}

.select-modern:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.number-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.number-input {
  padding: 12px 16px;
  padding-right: 60px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  width: 100%;
  transition: all 0.2s ease;
}

.number-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-suffix {
  position: absolute;
  right: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.limit-item small {
  color: var(--muted);
  font-size: 12px;
}

/* Regional Country Selection Styles */
.country-search-wrapper {
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.country-regions {
  margin-bottom: 20px;
}

.region-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.region-title {
  margin: 0;
}

.region-toggle {
  width: 100%;
  background: var(--card);
  border: none;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
}

.region-toggle:hover {
  background: var(--border);
}

.toggle-icon {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.region-content {
  padding: 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  transition: all 0.3s ease;
  max-height: 500px;
  overflow: hidden;
}

.region-content.collapsed {
  max-height: 0;
  padding: 0 16px;
  border-top: none;
}

.checkbox-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.checkbox-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.checkbox-item-compact:hover {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.02);
}

.checkbox-item-compact input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand);
}

.selected-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
}

@media (max-width: 768px) {
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
  
  .checkbox-grid-compact {
    grid-template-columns: 1fr;
  }
  
  .limits-grid {
    grid-template-columns: 1fr;
  }
  
  .assignment-section {
    padding: 16px;
  }
  
  .selection-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

.contact-form .form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  margin: 0;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

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

.modal-body {
  padding: 0 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* Alert Styles */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-error {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
}

/* Button Variants */
.btn.danger {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
}

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

/* Role Edit Modal Styles */
.role-edit-modal .modal-content {
  background: var(--bg);
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
}

.large-modal {
  max-width: 800px;
  width: 95%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

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

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

.role-edit-modal .modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.btn-close {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: var(--card);
  color: var(--fg);
}

.modal-form {
  padding: 20px 24px 24px;
}

.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--fg);
  font-size: 14px;
}

.form-field input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--bg);
  color: var(--fg);
}

.form-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.form-actions .btn {
  padding: 10px 20px;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.form-actions .btn.primary {
  background: var(--brand);
  color: white;
  border: none;
}

.form-actions .btn.primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.form-actions .btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.form-actions .btn.ghost:hover {
  background: var(--card);
  color: var(--fg);
}

/* Role Name Editing Styles */
.role-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-name-display {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin: 0;
}

.role-name-display:hover {
  background: var(--card);
  color: var(--brand);
}

.role-name-input {
  padding: 4px 8px;
  border: 2px solid var(--brand);
  border-radius: 6px;
  font-size: inherit;
  font-weight: inherit;
  background: var(--bg);
  color: var(--fg);
  outline: none;
  min-width: 120px;
}

.role-name-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.role-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.role-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.role-card.inactive {
  opacity: 0.6;
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.role-info {
  flex: 1;
}

.role-actions {
  display: flex;
  gap: 8px;
}

.role-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.role-description {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.role-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-weight: 600;
  color: var(--fg);
}

.permissions-summary h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--fg);
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-tag {
  background: var(--brand);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.no-permissions {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #22c55e;
}

.status-badge.inactive {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

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

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

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  margin: 0;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }
  
  .role-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .role-actions {
    align-self: flex-end;
  }
  
  .stage-progress {
    padding: 0 10px;
  }
  
  .stage-circle {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .stage-label {
    font-size: 11px;
  }
  
  .timeline {
    padding-left: 20px;
  }
  
  .timeline-item {
    padding-left: 20px;
  }
  
  .timeline-marker {
    left: -27px;
    width: 10px;
    height: 10px;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .contact-form .form-actions {
    flex-direction: column;
  }
}

/* Task UI Improvements */
.task-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-sm.btn-success {
  background: #28a745;
  color: white;
}

.btn-sm.btn-success:hover {
  background: #218838;
}

.btn-sm.btn-primary {
  background: #007bff;
  color: white;
}

.btn-sm.btn-primary:hover {
  background: #0056b3;
}

.btn-sm.btn-ghost {
  background: transparent;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.btn-sm.btn-ghost:hover {
  background: #f8f9fa;
  color: #495057;
}

.status-done {
  color: #28a745;
  font-weight: 500;
  font-size: 13px;
}

.status-open {
  color: #ffc107;
  font-weight: 500;
  font-size: 13px;
}

/* Improve row spacing and hover effects */
.panel .row {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f3f4;
  align-items: center;
  transition: background-color 0.2s ease;
}

.panel .row:hover {
  background-color: #f8f9fa;
}

/* Tasks in Lead Details */
.tasks-list {
  margin-top: 16px;
}

.task-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
  transition: all 0.2s ease;
}

.task-row:hover {
  border-color: #007bff;
  box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.task-info {
  flex: 1;
}

.task-title {
  font-weight: 600;
  color: #212529;
  margin-bottom: 4px;
}

.task-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #6c757d;
}

.task-due {
  font-weight: 500;
}

.task-type {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
}

.task-status {
  margin: 0 16px;
}

.no-tasks {
  text-align: center;
  padding: 24px;
  color: #6c757d;
  font-style: italic;
}

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

.panel-header h3 {
  margin: 0;
}

/* Dashboard Medipol Watermark */
.dashboard-page {
  position: relative;
  min-height: 100vh;
}

.dashboard-page::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: url('https://www.medipol.edu.tr/sites/default/files/2024-05/Arma_mavi_TR.png') no-repeat center center;
  background-size: contain;
  opacity: 0.1;
  z-index: 0;
  pointer-events: none;
}

/* Ensure dashboard content is above watermark */
.dashboard-page > * {
  position: relative;
  z-index: 2;
}

/* Dashboard Medipol Professional Design */
.dashboard-page {
  animation: pageSlideIn 0.6s ease-out;
}

@keyframes pageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-page .page-header {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(30, 64, 175, 0.03) 100%);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  border: 1px solid rgba(30, 64, 175, 0.1);
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.08);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.dashboard-page .page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--medipol-blue) 0%, #3b82f6 50%, #60a5fa 100%);
}

.dashboard-page .page-header .header-left h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--medipol-blue);
  margin: 0 0 8px 0;
  text-shadow: 0 2px 4px rgba(30, 64, 175, 0.1);
}

.dashboard-page .page-header .header-subtitle {
  font-size: 16px;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

.dashboard-page .page-header h1 {
  color: var(--medipol-blue);
  font-weight: 700;
  margin: 0 0 8px 0;
}

.dashboard-page .header-subtitle {
  color: var(--muted);
  margin: 0;
}

.dashboard-page .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.dashboard-page .stat-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(30, 64, 175, 0.02) 100%);
  border: 1px solid rgba(30, 64, 175, 0.15);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.12);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  animation: cardSlideUp 0.6s ease-out;
}

@keyframes cardSlideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-page .stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--medipol-blue) 0%, #3b82f6 50%, #60a5fa 100%);
}

.dashboard-page .stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(30, 64, 175, 0.15);
  border-color: var(--medipol-blue);
}

.dashboard-page .stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--medipol-blue);
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(30, 64, 175, 0.1);
}

.dashboard-page .stat-label {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.dashboard-page .stat-change {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.dashboard-page .stat-change.positive {
  color: #10b981;
}

.dashboard-page .stat-change.negative {
  color: #ef4444;
}

/* Dashboard Grid Layout */
.dashboard-page .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.dashboard-page .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.dashboard-page .panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(30, 64, 175, 0.1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.08);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all 0.3s ease;
}

.dashboard-page .panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(30, 64, 175, 0.12);
}

.dashboard-page .panel-header {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(30, 64, 175, 0.02) 100%);
  padding: 24px 28px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-page .panel-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--medipol-blue);
  margin: 0;
}

.dashboard-page .btn-link {
  color: var(--medipol-blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.dashboard-page .btn-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* Chart and Activity Styles */
.dashboard-page .chart-wrapper,
.dashboard-page .activity-list,
.dashboard-page .task-list {
  padding: 24px 28px;
}

.dashboard-page .pie-chart-simple,
.dashboard-page .bar-chart-simple {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-page .chart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.dashboard-page .chart-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dashboard-page .chart-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-page .chart-label {
  font-weight: 500;
  color: #374151;
}

.dashboard-page .chart-value {
  font-weight: 600;
  color: var(--medipol-blue);
}

.dashboard-page .bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-page .bar-label {
  width: 80px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.dashboard-page .bar-track {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.dashboard-page .bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.dashboard-page .bar-value {
  width: 30px;
  text-align: right;
  font-weight: 600;
  color: var(--medipol-blue);
  font-size: 14px;
}

/* Activity and Task Lists */
.dashboard-page .activity-row,
.dashboard-page .task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(30, 64, 175, 0.05);
}

.dashboard-page .activity-row:last-child,
.dashboard-page .task-row:last-child {
  border-bottom: none;
}

.dashboard-page .activity-dot {
  width: 8px;
  height: 8px;
  background: var(--medipol-blue);
  border-radius: 50%;
  margin-right: 16px;
  flex-shrink: 0;
}

.dashboard-page .activity-content,
.dashboard-page .task-info {
  flex: 1;
}

.dashboard-page .activity-text,
.dashboard-page .task-title {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.dashboard-page .activity-time,
.dashboard-page .task-meta {
  font-size: 12px;
  color: #64748b;
}

.dashboard-page .task-row.overdue {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.02);
  padding-left: 20px;
}

.dashboard-page .task-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dashboard-page .task-type {
  font-size: 11px;
  color: var(--medipol-blue);
  background: rgba(30, 64, 175, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-top: 4px;
  font-weight: 500;
}

.dashboard-page .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(30, 64, 175, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: var(--medipol-blue);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.dashboard-page .btn-sm:hover {
  background: rgba(30, 64, 175, 0.05);
  border-color: var(--medipol-blue);
}

.dashboard-page .btn-sm.primary {
  background: var(--medipol-blue);
  color: white;
  border-color: var(--medipol-blue);
}

.dashboard-page .btn-sm.primary:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.dashboard-page .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-style: italic;
}

.dashboard-page .btn-link {
  color: var(--medipol-blue);
  font-weight: 500;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.dashboard-page .btn-link:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

.dashboard-page .chart-wrapper,
.dashboard-page .activity-list,
.dashboard-page .task-list,
.dashboard-page .trend-chart {
  padding: 24px;
}

.dashboard-page .chart-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 12px;
}

.dashboard-page .chart-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(30, 64, 175, 0.05);
}

.dashboard-page .chart-item:last-child {
  border-bottom: none;
}

.dashboard-page .chart-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-page .chart-label {
  font-weight: 500;
  color: var(--fg);
}

.dashboard-page .chart-value {
  font-weight: 600;
  color: var(--medipol-blue);
  font-size: 14px;
}

.dashboard-page .bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.dashboard-page .bar-label {
  min-width: 80px;
  font-weight: 500;
  color: var(--fg);
  font-size: 14px;
}

.dashboard-page .bar-track {
  flex: 1;
  height: 8px;
  background: rgba(30, 64, 175, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.dashboard-page .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--medipol-blue) 0%, var(--brand-light) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.dashboard-page .bar-value {
  min-width: 40px;
  text-align: right;
  font-weight: 600;
  color: var(--medipol-blue);
  font-size: 14px;
}

.dashboard-page .activity-row,
.dashboard-page .task-row {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(30, 64, 175, 0.05);
  transition: all 0.2s ease;
}

.dashboard-page .activity-row:hover,
.dashboard-page .task-row:hover {
  background: rgba(30, 64, 175, 0.02);
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
}

.dashboard-page .activity-row:last-child,
.dashboard-page .task-row:last-child {
  border-bottom: none;
}

.dashboard-page .activity-dot {
  width: 8px;
  height: 8px;
  background: var(--medipol-blue);
  border-radius: 50%;
  margin-right: 16px;
  flex-shrink: 0;
}

.dashboard-page .activity-content,
.dashboard-page .task-info {
  flex: 1;
}

.dashboard-page .activity-text,
.dashboard-page .task-title {
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}

.dashboard-page .activity-time,
.dashboard-page .task-meta {
  font-size: 12px;
  color: var(--muted);
}

.dashboard-page .task-row.overdue {
  border-left: 4px solid var(--danger);
  background: rgba(239, 68, 68, 0.02);
}

.dashboard-page .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-style: italic;
}

.dashboard-page .line-chart-simple {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 80px;
  padding: 20px 0;
}

.dashboard-page .chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Medipol Login Page Styles */
.login-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 25%, #3b82f6 50%, #60a5fa 75%, #93c5fd 100%);
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.15) 0%, transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.15) 0%, transparent 60%),
    radial-gradient(circle at 40% 40%, rgba(255,255,255,0.08) 0%, transparent 40%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M30 30c0-11.046-8.954-20-20-20s-20 8.954-20 20 8.954 20 20 20 20-8.954 20-20zm0 0c0 11.046 8.954 20 20 20s20-8.954 20-20-8.954-20-20-20-20 8.954-20 20z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: backgroundFloat 20s ease-in-out infinite;
}

@keyframes backgroundFloat {
  0%, 100% { 
    background-position: 0% 0%, 100% 100%, 50% 50%, 0px 0px;
  }
  25% { 
    background-position: 10% 10%, 90% 90%, 60% 40%, 20px 20px;
  }
  50% { 
    background-position: 20% 5%, 80% 95%, 40% 60%, 40px 10px;
  }
  75% { 
    background-position: 5% 20%, 95% 80%, 55% 35%, 10px 30px;
  }
}

.login-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 64, 175, 0.1);
}

.login-card {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 24px;
  padding: 50px;
  width: 100%;
  max-width: 480px;
  box-shadow: 
    0 30px 60px rgba(30, 64, 175, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
  animation: cardSlideIn 0.8s ease-out;
}

@keyframes cardSlideIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.login-header .logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.login-header .logo-img {
  width: 200px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(30, 64, 175, 0.3));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

.login-header .logo-fallback {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-radius: 16px;
  filter: drop-shadow(0 4px 8px rgba(30, 64, 175, 0.2));
}

.login-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1e40af;
  margin: 0;
  text-shadow: 0 2px 4px rgba(30, 64, 175, 0.1);
  animation: titleFadeIn 1s ease-out 0.3s both;
}

@keyframes titleFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-subtitle {
  color: #64748b;
  font-size: 18px;
  margin: 0;
  font-weight: 500;
  animation: subtitleFadeIn 1s ease-out 0.5s both;
}

@keyframes subtitleFadeIn {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: formFadeIn 1s ease-out 0.7s both;
}

@keyframes formFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.login-form label {
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

.login-form input {
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.8);
}

.login-form input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(255, 255, 255, 1);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
}

.forgot-password {
  color: #3b82f6;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

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

.btn-login {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-divider {
  text-align: center;
  position: relative;
  margin: 24px 0;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e5e7eb;
}

.login-divider span {
  background: rgba(255, 255, 255, 0.95);
  padding: 0 16px;
  color: #9ca3af;
  font-size: 14px;
}

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

.demo-text {
  color: #6b7280;
  font-size: 14px;
  margin: 0 0 12px 0;
}

.btn-demo {
  background: rgba(255, 255, 255, 0.8);
  color: #374151;
  border: 2px solid #e5e7eb;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-demo:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #d1d5db;
}

.login-footer {
  margin-top: 32px;
  text-align: center;
}

.university-info {
  padding: 20px 0;
  border-top: 1px solid rgba(229, 231, 235, 0.5);
}

.university-name {
  font-weight: 700;
  color: #1e40af;
  font-size: 16px;
  margin: 0 0 8px 0;
}

.university-contact {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
}

.university-contact a {
  color: #3b82f6;
  text-decoration: none;
}

.university-contact a:hover {
  text-decoration: underline;
}

/* Toast notifications for login */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Responsive design */
@media (max-width: 480px) {
  .login-card {
    margin: 20px;
    padding: 32px 24px;
  }
  
  .login-header h1 {
    font-size: 24px;
  }
  
  .login-header .logo-img {
    width: 160px;
    height: 100px;
  }
  
  .login-header .logo-fallback {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }
}

.dashboard-page .chart-bar:hover .bar {
  background: linear-gradient(180deg, #1e3a8a 0%, var(--medipol-blue) 100%);
}

.dashboard-page .chart-bar .bar-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dashboard-page::before {
    width: 250px;
    height: 250px;
    opacity: 0.02;
  }
  
  .dashboard-page .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
  
  .dashboard-page .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .dashboard-page .stat-card {
    padding: 20px;
  }
  
  .dashboard-page .stat-number {
    font-size: 2rem;
  }
}
