/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: #F6F4EF;
  color: #2C2C2A;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ===================== LOGIN ===================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a5a45 0%, #0F6E56 50%, #1a8f70 100%);
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

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

.login-tagline {
  font-size: 12px;
  color: #888780;
  margin-bottom: 20px;
  letter-spacing: 0.03em;
}

.login-sub {
  font-size: 15px;
  font-weight: 600;
  color: #2C2C2A;
  margin-bottom: 20px;
}

.login-error {
  background: #FCEBEB;
  border: 1px solid #E24B4A44;
  color: #E24B4A;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.login-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #888780;
  margin-bottom: 10px;
}

.demo-accounts {
  display: flex;
  gap: 10px;
}

.demo-chip {
  flex: 1;
  background: #F6F4EF;
  border: 1px solid #D3D1C7;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.5;
  color: #2C2C2A;
  transition: all 0.12s;
}

.demo-chip:hover {
  border-color: #0F6E56;
  background: #E1F5EE;
}

.demo-chip strong { font-size: 12px; }

/* ===================== TOPBAR ===================== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #D3D1C7;
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: #0F6E56;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: #2C2C2A;
}

.portal-label {
  font-size: 13px;
  font-weight: 500;
  color: #888780;
  background: #F1EFE8;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid #D3D1C7;
}

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

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #2C2C2A;
}

/* ===================== LAYOUT ===================== */
.layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 58px);
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 216px;
  background: #fff;
  border-right: 1px solid #D3D1C7;
  padding: 22px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #888780;
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #888780;
  transition: all 0.12s;
  user-select: none;
}

.nav-item:hover { background: #F1EFE8; color: #2C2C2A; }
.nav-item.active { font-weight: 500; color: #0F6E56; background: #E1F5EE; }
.nav-icon { font-size: 14px; }

/* ===================== MAIN ===================== */
.main { flex: 1; padding: 28px 32px; overflow-y: auto; }
.page-title { font-size: 21px; font-weight: 600; color: #2C2C2A; margin-bottom: 22px; letter-spacing: -0.3px; }
.page { display: none; }
.page.active { display: block; }

/* ===================== CARD ===================== */
.card {
  background: #fff;
  border: 1px solid #D3D1C7;
  border-radius: 12px;
  padding: 24px;
}

/* ===================== FORM ===================== */
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: #888780; text-transform: uppercase;
  margin-bottom: 12px; margin-top: 20px;
}
.section-label:first-child { margin-top: 0; }

.field-grid { display: grid; gap: 16px; }
.field-grid.col-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.span-2 { grid-column: span 2; }
.field-label { font-size: 13px; font-weight: 500; color: #2C2C2A; }
.optional { color: #888780; font-weight: 400; }

.input, .select, .textarea {
  padding: 9px 12px;
  border: 1px solid #D3D1C7;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #2C2C2A;
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: #0F6E56;
  box-shadow: 0 0 0 3px rgba(15,110,86,0.09);
}
.input.error-field, .select.error-field { border-color: #E24B4A; }
.textarea { resize: vertical; min-height: 80px; }

.error { font-size: 12px; color: #E24B4A; min-height: 16px; display: block; }
.success-msg { margin-top: 12px; font-size: 13px; color: #0F6E56; font-weight: 500; min-height: 20px; }

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

/* ===================== BUTTONS ===================== */
.btn {
  padding: 10px 20px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 14px; font-weight: 500;
  font-family: inherit; transition: all 0.12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #0F6E56; color: #fff; }
.btn-primary:hover { background: #085041; }
.btn-secondary { background: transparent; color: #2C2C2A; border: 1px solid #D3D1C7; }
.btn-secondary:hover { background: #F1EFE8; }
.btn-danger { background: #FCEBEB; color: #E24B4A; border: 1px solid rgba(226,75,74,0.3); }
.btn-danger:hover { background: #f5c6c6; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ===================== AVATAR ===================== */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #E1F5EE; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600;
  color: #085041; flex-shrink: 0;
}
.avatar-lg { width: 52px; height: 52px; font-size: 16px; }

/* ===================== BADGES ===================== */
.badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  display: inline-block; white-space: nowrap;
}
.badge-scheduled { background: #E6F1FB; color: #185FA5; }
.badge-completed  { background: #EAF3DE; color: #3B6D11; }
.badge-cancelled  { background: #FCEBEB; color: #E24B4A; }

/* ===================== TABLE ===================== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 14px; text-align: left;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: #888780;
  border-bottom: 1px solid #D3D1C7; white-space: nowrap;
}
.table td { padding: 12px 14px; font-size: 14px; color: #2C2C2A; border-bottom: 1px solid #F1EFE8; }
.table tbody tr:hover td { background: #F6F4EF; }
.table tbody tr:last-child td { border-bottom: none; }
.table-count { padding: 10px 14px; font-size: 12px; color: #888780; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: #F1EFE8; color: #888780; }
.action-btns { display: flex; gap: 6px; }

/* ===================== FILTER BAR ===================== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }

/* ===================== PATIENT SEARCH ===================== */
.dropdown {
  border: 1px solid #D3D1C7; border-radius: 8px;
  margin-top: 6px; overflow: hidden; background: #fff;
}
.dropdown-item {
  padding: 10px 14px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid #F1EFE8;
  display: flex; justify-content: space-between; align-items: center;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #F6F4EF; }
.dropdown-item-name { font-weight: 500; }
.dropdown-item-meta { font-size: 12px; color: #888780; }

.selected-patient {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: #E1F5EE; border-radius: 8px;
  border: 1px solid rgba(29,158,117,0.2);
}
.selected-patient-name { font-weight: 600; font-size: 14px; color: #085041; }
.selected-patient-meta { font-size: 12px; color: #0F6E56; margin-top: 2px; }

.avail-msg { font-size: 12px; margin-top: 4px; display: block; }
.avail-available { color: #3B6D11; }
.avail-busy { color: #E24B4A; }

/* ===================== CONFIRM BOX ===================== */
.confirm-box {
  margin: 16px 0; padding: 14px 18px;
  background: #EAF3DE; border: 1px solid rgba(59,109,17,0.2); border-radius: 8px;
}
.confirm-title { font-weight: 600; font-size: 14px; color: #3B6D11; }
.confirm-meta { font-size: 13px; color: #3B6D11; margin-top: 4px; }

/* ===================== DOCTOR DASHBOARD ===================== */
.doc-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.doc-greeting { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; color: #2C2C2A; }
.doc-subtitle { font-size: 13px; color: #888780; margin-top: 3px; }

.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.metric-card {
  background: #fff; border: 1px solid #D3D1C7;
  border-top: 3px solid #888780; border-radius: 10px; padding: 16px 18px;
}
.metric-value { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; }
.metric-label { font-size: 12px; color: #888780; font-weight: 500; margin-top: 4px; }

.dashboard-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.card-heading { font-weight: 600; color: #2C2C2A; font-size: 14px; margin-bottom: 14px; }

.schedule-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #F1EFE8;
}
.schedule-item:last-child { border-bottom: none; }
.time-badge {
  background: #E1F5EE; border-radius: 8px; padding: 6px 10px;
  font-size: 12px; font-weight: 600; color: #085041;
  min-width: 56px; text-align: center; line-height: 1.4;
}
.time-badge span { font-size: 10px; font-weight: 400; color: #0F6E56; display: block; }
.schedule-info { flex: 1; }
.schedule-name { font-weight: 500; font-size: 14px; }
.schedule-type { font-size: 12px; color: #888780; margin-top: 1px; }

.notif { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.notif:last-child { margin-bottom: 0; }
.notif-info    { background: #E6F1FB; }
.notif-warn    { background: #FAEEDA; }
.notif-success { background: #EAF3DE; }
.notif-msg { font-size: 13px; font-weight: 500; }
.notif-info .notif-msg    { color: #185FA5; }
.notif-warn .notif-msg    { color: #BA7517; }
.notif-success .notif-msg { color: #3B6D11; }
.notif-time { font-size: 11px; color: #888780; margin-top: 2px; }

.divider { height: 1px; background: #D3D1C7; border: none; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===================== DOC APPOINTMENTS ===================== */
.tab-switch { display: flex; gap: 4px; background: #F1EFE8; padding: 4px; border-radius: 8px; }
.tab-btn {
  padding: 6px 16px; border-radius: 6px; border: none;
  cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit; background: transparent; color: #888780; transition: all 0.12s;
}
.tab-btn.active { background: #fff; color: #2C2C2A; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.appt-card {
  background: #fff; border: 1px solid #D3D1C7; border-radius: 12px;
  padding: 16px 20px; display: flex; align-items: center;
  gap: 16px; margin-bottom: 10px; transition: box-shadow 0.12s;
}
.appt-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.appt-time-block {
  background: #E1F5EE; border-radius: 10px;
  padding: 10px 14px; text-align: center; min-width: 68px; flex-shrink: 0;
}
.appt-time { font-size: 18px; font-weight: 700; color: #085041; }
.appt-date-small { font-size: 10px; color: #0F6E56; margin-top: 2px; }
.appt-info { flex: 1; }
.appt-patient { font-weight: 600; font-size: 15px; }
.appt-meta { font-size: 13px; color: #888780; margin-top: 2px; }

/* ===================== PATIENT DETAILS ===================== */
.patient-header {
  display: flex; align-items: center; gap: 18px;
}
.patient-name-lg { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.patient-sub { font-size: 13px; color: #888780; margin-top: 4px; }
.patient-badges { display: flex; gap: 24px; margin-left: auto; }
.patient-badge-item { text-align: center; }
.patient-badge-label {
  font-size: 10px; font-weight: 700; color: #888780;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.patient-badge-value { font-size: 14px; font-weight: 600; color: #2C2C2A; margin-top: 4px; }
.patient-badge-value.allergy-alert { color: #E24B4A; }

.tab-bar {
  display: flex; gap: 0;
  border-bottom: 1px solid #D3D1C7; margin-bottom: 20px;
}
.tab-bar .tab-btn {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0; color: #888780;
  padding: 8px 18px; font-size: 14px; font-weight: 400;
}
.tab-bar .tab-btn.active {
  border-bottom-color: #0F6E56; color: #0F6E56;
  font-weight: 600; background: none; box-shadow: none;
}

.patient-tab { display: none; }
.patient-tab.active { display: block; }

.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.info-item { margin-bottom: 14px; }
.info-item:last-child { margin-bottom: 0; }
.info-label {
  font-size: 11px; font-weight: 600; color: #888780;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.info-value { font-size: 14px; color: #2C2C2A; margin-top: 4px; }

.visit-entry { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid #F1EFE8; }
.visit-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.visit-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 8px;
}
.visit-date { font-weight: 600; font-size: 14px; }
.visit-doctor { font-size: 12px; color: #888780; margin-top: 2px; }
.visit-notes { font-size: 14px; line-height: 1.6; color: #2C2C2A; }

.notes-entry { padding: 12px 0; border-bottom: 1px solid #F1EFE8; }
.notes-entry:last-child { border-bottom: none; }
.notes-meta { font-size: 12px; color: #888780; }
.notes-text { font-size: 14px; line-height: 1.6; margin-top: 6px; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: #2C2C2A; color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; z-index: 9999;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.2s ease;
}
.toast-check { color: #1D9E75; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D3D1C7; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #888780; }