/* =============================================
   Dr. Tanmay Gandre's Dental CRM — Premium UI
   ============================================= */

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

:root {
  --navy:        #1B2A4A;
  --navy-dark:   #111E35;
  --navy-mid:    #243352;
  --gold:        #C9A84C;
  --gold-light:  #F5E9C8;
  --gold-dark:   #A8892E;
  --blue:        #2563EB;
  --blue-light:  #EFF6FF;
  --surface:     #FFFFFF;
  --bg:          #F3F5F9;
  --border:      #E8ECF2;
  --text:        #1A2035;
  --text-muted:  #6B7A99;
  --text-light:  #A0AABF;
  --success:     #16A34A;
  --success-bg:  #DCFCE7;
  --warning:     #D97706;
  --warning-bg:  #FEF3C7;
  --danger:      #DC2626;
  --danger-bg:   #FEE2E2;
  --info:        #0891B2;
  --info-bg:     #CFFAFE;
  --orange:      #EA580C;
  --orange-bg:   #FFEDD5;
  --teal:        #0D9488;
  --teal-bg:     #CCFBF1;
  --nav-h:       68px;
  --header-h:    60px;
  --sidebar-w:   240px;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 40px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
ul, ol { list-style: none; }
html { scroll-behavior: smooth; }
html, body {
  height: 100%;
  background: var(--bg);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* =============================================
   APP SHELL (mobile-first phone frame)
   ============================================= */
.app-shell {
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

/* =============================================
   HEADER
   ============================================= */
.app-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: #fff;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-header .header-back {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 6px;
  margin-left: -6px;
  border-radius: 8px;
  transition: background .15s;
}
.app-header .header-back:hover { background: rgba(255,255,255,.12); }
.app-header .header-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .header-clinic { flex: 1; }
.app-header .header-clinic .clinic-name {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-header .header-clinic .clinic-sub {
  font-size: .7rem;
  opacity: .65;
  margin-top: 1px;
}
.app-header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-icon-btn {
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.1);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 7px;
  text-decoration: none;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  line-height: 1;
}
.header-icon-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.admin-hdr-btn { background: rgba(201,168,76,.2); color: var(--gold); }
.admin-hdr-btn:hover { background: rgba(201,168,76,.35); color: #ffd875; }
.btn-done {
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 20px;
  padding: 5px 16px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: .01em;
}
.btn-done:hover { background: #d4b55a; color: var(--navy); }

/* =============================================
   SIDEBAR (Admin desktop)
   ============================================= */
.admin-sidebar { display: none; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand span {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-section { padding: 8px 8px 0; }
.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 14px 12px 6px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.side-link i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.side-link span { flex: 1; }
.side-link:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.side-link.active {
  background: linear-gradient(135deg, rgba(201,168,76,.25), rgba(201,168,76,.1));
  color: var(--gold);
  border: 1px solid rgba(201,168,76,.2);
}
.side-link.active i { color: var(--gold); }
.sidebar-user {
  margin-top: auto;
  padding: 14px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(201,168,76,.2);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* =============================================
   MAIN CONTENT AREA
   ============================================= */
.app-main { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.app-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + 8px);
  background: var(--bg);
}

/* =============================================
   BOTTOM NAV
   ============================================= */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-light);
  font-size: .65rem;
  font-weight: 600;
  padding: 8px 4px;
  transition: color .15s;
  position: relative;
}
.nav-tab i { font-size: 1.35rem; transition: transform .15s; }
.nav-tab.active { color: var(--navy); }
.nav-tab.active i { transform: translateY(-1px); }
.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--gold);
  border-radius: 0 0 4px 4px;
}

/* =============================================
   FAB BUTTON
   ============================================= */
.fab-btn {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  right: calc(50% - 430px/2 + 16px);
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--navy);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(201,168,76,.45);
  z-index: 150;
  transition: transform .2s, box-shadow .2s;
}
.fab-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 28px rgba(201,168,76,.55);
  color: var(--navy);
}
@media (max-width: 430px) { .fab-btn { right: 16px; } }

/* =============================================
   FLASH ALERTS
   ============================================= */
.app-flash {
  margin: 10px 14px 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .84rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* =============================================
   DASHBOARD — STATS BANNER
   ============================================= */
.dash-stats-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 0 14px 16px;
}
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-top: 10px;
}
.dash-stat-card {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(4px);
}
.dash-stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.dash-stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.dash-stat-lbl {
  font-size: .68rem;
  color: rgba(255,255,255,.6);
  font-weight: 500;
  margin-top: 2px;
}

/* =============================================
   CALENDAR STRIP
   ============================================= */
.cal-strip-wrap {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 0 12px 0;
  color: #fff;
  user-select: none;
}
.cal-strip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 10px;
}
.cal-nav-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  background: rgba(255,255,255,.1);
  font-size: .85rem;
  flex-shrink: 0;
  transition: background .15s;
  border: 1px solid rgba(255,255,255,.12);
}
.cal-nav-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.cal-month-center { text-align: center; flex: 1; }
.cal-month-label {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.2;
}
.cal-sub-label {
  font-size: .68rem;
  opacity: .65;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.cal-today-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  text-align: center;
}
.cal-day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 6px;
}
.cal-days .day-label {
  font-size: .58rem;
  opacity: .5;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  margin-bottom: 5px;
}
.cal-days .day-num {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  color: rgba(255,255,255,.75);
  transition: background .12s;
}
.cal-days .day-num:hover { background: rgba(255,255,255,.15); color: #fff; }
.cal-days .day-num.today {
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(201,168,76,.5);
}
.cal-days .day-num.selected {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}
.cal-dots {
  display: flex;
  gap: 2px;
  margin-top: 3px;
  height: 5px;
  align-items: center;
  justify-content: center;
}
.cal-dot { width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.cal-dot-on  { background: rgba(255,255,255,.4); }
.cal-dot-hi  { background: var(--gold); }

/* =============================================
   SCHEDULE SECTION
   ============================================= */
.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 14px 10px;
}
.schedule-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}
.doctor-filter-btn {
  font-size: .75rem;
  color: var(--navy);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: background .15s;
}
.doctor-filter-btn:hover { background: var(--border); }

/* =============================================
   STATUS CHIPS
   ============================================= */
.status-chips {
  display: flex;
  gap: 8px;
  padding: 0 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.status-chips::-webkit-scrollbar { display: none; }
.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  border: none;
  border: 1.5px solid transparent;
  transition: all .15s;
}
.status-chip .chip-count {
  min-width: 20px; height: 20px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem;
  font-weight: 700;
}
.chip-scheduled {
  background: var(--orange-bg);
  color: var(--orange);
  border-color: #fed7aa;
}
.chip-scheduled.active { background: var(--orange); color: #fff; }
.chip-scheduled .chip-count { background: rgba(0,0,0,.12); }
.chip-waiting {
  background: var(--success-bg);
  color: var(--success);
  border-color: #bbf7d0;
}
.chip-waiting.active { background: var(--success); color: #fff; }
.chip-waiting .chip-count { background: rgba(0,0,0,.12); }
.chip-engage {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: #99f6e4;
}
.chip-engage.active { background: var(--teal); color: #fff; }
.chip-engage .chip-count { background: rgba(0,0,0,.12); }
.chip-done {
  background: var(--bg);
  color: var(--text-muted);
  border-color: var(--border);
}
.chip-done.active { background: var(--text-muted); color: #fff; }
.chip-done .chip-count { background: rgba(0,0,0,.12); }

/* =============================================
   APPOINTMENT CARDS
   ============================================= */
.appt-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 14px 14px 18px;
  margin: 0 14px 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.appt-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.appt-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 0;
}
.appt-card.status-scheduled::before  { background: var(--orange); }
.appt-card.status-waiting::before    { background: var(--success); }
.appt-card.status-completed::before  { background: var(--blue); }
.appt-card.status-cancelled::before  { background: var(--danger); }
.appt-time-col {
  min-width: 50px;
  text-align: center;
  padding-top: 2px;
}
.appt-time {
  font-size: .85rem;
  font-weight: 700;
  color: var(--navy);
}
.appt-ampm { font-size: .65rem; color: var(--text-light); }
.appt-body { flex: 1; min-width: 0; }
.appt-patient {
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
}
.appt-treatment {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.appt-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.appt-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: .68rem;
  font-weight: 600;
}
.badge-scheduled  { background: var(--orange-bg); color: var(--orange); }
.badge-waiting    { background: var(--success-bg); color: var(--success); }
.badge-completed  { background: var(--blue-light); color: var(--blue); }
.badge-cancelled  { background: var(--danger-bg); color: var(--danger); }
.appt-phone { font-size: .72rem; color: var(--text-light); }
.appt-actions { display: flex; gap: 4px; align-items: center; margin-left: 4px; }
.appt-action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: .88rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: all .15s;
}
.appt-action-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.appt-status-dot { display: none; }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-illustration {
  font-size: 3.5rem;
  opacity: .3;
  margin-bottom: 14px;
}
.empty-state p { font-size: .88rem; margin: 0; font-weight: 500; }

/* =============================================
   SEARCH BAR
   ============================================= */
.search-wrap {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}
.search-input-wrap {
  background: rgba(255,255,255,.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.15);
  transition: background .15s;
}
.search-input-wrap:focus-within { background: rgba(255,255,255,.18); }
.search-input-wrap i { color: rgba(255,255,255,.6); font-size: .95rem; }
.search-input-wrap input {
  border: none;
  outline: none;
  flex: 1;
  padding: 11px 0;
  font-size: .88rem;
  background: transparent;
  color: #fff;
  font-family: inherit;
}
.search-input-wrap input::placeholder { color: rgba(255,255,255,.45); }

/* =============================================
   FILTER CHIPS
   ============================================= */
.filter-chips {
  display: flex;
  gap: 8px;
  padding: 8px 14px 12px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  border-radius: 12px;
  padding: 5px 14px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.14);
  display: flex; align-items: center; gap: 4px;
  transition: all .12s;
}
.filter-chip.active { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }
.filter-chips-light {
  background: var(--bg);
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.filter-chips-light .filter-chip {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}
.filter-chips-light .filter-chip.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* =============================================
   PATIENT CARDS
   ============================================= */
.patient-list { padding: 4px 0; }
.patient-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.patient-card:hover { background: #F8FAFC; }
.patient-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  font-weight: 700;
  flex-shrink: 0;
}
.patient-info { flex: 1; min-width: 0; }
.patient-name {
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-sub { font-size: .73rem; color: var(--text-light); margin-top: 2px; }
.patient-badge {
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: .7rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* =============================================
   MORE / PROFILE PAGE
   ============================================= */
.more-profile {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 20px 16px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
}
.more-avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(201,168,76,.2);
  border: 2px solid rgba(201,168,76,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--gold);
}
.more-name  { font-size: 1rem; font-weight: 700; }
.more-role  { font-size: .75rem; opacity: .7; margin-top: 2px; }
.more-clinic{ font-size: .72rem; opacity: .55; margin-top: 1px; }
.more-section {
  background: var(--surface);
  border-radius: var(--radius);
  margin: 12px 12px 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  font-size: .88rem;
  font-weight: 500;
}
.more-item:last-child { border-bottom: none; }
.more-item:hover { background: var(--bg); }
.more-item-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.more-item .more-chevron { margin-left: auto; color: var(--text-light); font-size: .8rem; }
.more-item.logout-btn { color: var(--danger); }
.more-item.logout-btn .more-item-icon { background: var(--danger-bg); color: var(--danger); }

/* =============================================
   FORMS
   ============================================= */
.form-page {
  background: var(--bg);
  min-height: calc(100dvh - var(--header-h));
}
.form-section {
  background: var(--surface);
  margin: 12px 0 0;
  padding: 0 14px;
  border-radius: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.form-field {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.form-field:last-child { border-bottom: none; }
.form-field .field-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-field .field-input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
  font-size: .9rem;
  outline: none;
  background: var(--bg);
  transition: border-color .15s, background .15s;
  font-family: inherit;
  color: var(--text);
}
.form-field .field-input:focus {
  border-color: var(--gold);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}
.form-field .field-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7A99' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}
.form-row { display: flex; gap: 10px; }
.form-row .form-field { flex: 1; }
.expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 12px 14px;
  padding: 12px;
  border: 1.5px solid var(--navy);
  border-radius: 24px;
  background: transparent;
  color: var(--navy);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

/* =============================================
   CARDS (generic)
   ============================================= */
.card-m {
  background: var(--surface);
  border-radius: var(--radius);
  margin: 10px 14px 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-m-header {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  color: var(--text);
}
.card-m-header i { color: var(--gold); }
.card-m-body { padding: 14px; }

/* =============================================
   LIST CARDS
   ============================================= */
.list-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin: 10px 14px 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.list-card-header {
  background: var(--bg);
  padding: 10px 14px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .1s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #F8FAFC; }
.list-item-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: .88rem; font-weight: 600; }
.list-item-sub   { font-size: .73rem; color: var(--text-light); margin-top: 2px; }
.list-item-right { text-align: right; flex-shrink: 0; }
.list-item-amount { font-size: .9rem; font-weight: 700; }
.list-item-status { font-size: .7rem; margin-top: 2px; }

/* =============================================
   BADGES
   ============================================= */
.badge-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: .7rem;
  font-weight: 700;
  gap: 4px;
}
.badge-success   { background: var(--success-bg); color: var(--success); }
.badge-warning   { background: var(--warning-bg); color: var(--warning); }
.badge-danger    { background: var(--danger-bg); color: var(--danger); }
.badge-info      { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--bg); color: var(--text-muted); }
.badge-primary   { background: var(--blue-light); color: var(--blue); }

/* =============================================
   STAT GRID
   ============================================= */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
}
.desktop-grid-4, .desktop-grid-3, .desktop-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
}
.stat-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.stat-box .stat-val { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.stat-box .stat-lbl { font-size: .7rem; color: var(--text-light); margin-top: 3px; font-weight: 500; }
.text-blue   { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-green  { color: var(--success); }
.text-red    { color: var(--danger); }
.text-gold   { color: var(--gold); }

/* =============================================
   SCROLLBARS
   ============================================= */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1a3a6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(201,168,76,.15) 0%, transparent 70%);
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -15%;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(201,168,76,.1) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,.08);
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .logo-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--navy);
  color: var(--gold);
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

/* =============================================
   UTILITY
   ============================================= */
.section-gap { padding: 14px; }

/* =============================================
   PRINT
   ============================================= */
@media print {
  .app-header, .app-bottom-nav, .fab-btn, .no-print { display: none !important; }
  .app-content { padding-bottom: 0 !important; }
}

/* =============================================
   ADMIN DESKTOP LAYOUT (≥769px)
   ============================================= */
@media (min-width: 769px) {
  body.role-admin { background: var(--bg); }

  body.role-admin .app-shell.admin-shell {
    max-width: 100%;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas: "header header" "sidebar main";
    box-shadow: none;
    border-radius: 0;
  }

  body.role-admin .app-header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 200;
    padding: 0 24px;
  }

  body.role-admin .admin-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    background: var(--navy-dark);
    color: rgba(255,255,255,.6);
    overflow-y: auto;
    padding: 0 0 16px;
    height: calc(100dvh - var(--header-h));
    position: sticky;
    top: var(--header-h);
    border-right: 1px solid rgba(255,255,255,.05);
  }

  body.role-admin .app-main {
    grid-area: main;
    overflow-y: auto;
    height: calc(100dvh - var(--header-h));
    background: var(--bg);
    display: flex;
    flex-direction: column;
  }

  body.role-admin .app-content {
    padding-bottom: 24px;
    width: 100%;
    flex: 1;
  }

  body.role-admin .app-bottom-nav { display: none !important; }

  body.role-admin .fab-btn {
    right: 28px;
    bottom: 28px;
    left: auto;
    transform: none;
  }
  body.role-admin .fab-btn:hover { transform: translateY(-2px) scale(1.05); }

  body.role-admin .card-m { margin: 10px 20px 0; }
  body.role-admin .appt-card { margin: 0 20px 10px; }
  body.role-admin .stat-grid { padding: 14px 20px; }
  body.role-admin .cal-strip-wrap { padding: 0 20px; }
  body.role-admin .schedule-header { padding: 16px 20px 10px; }
  body.role-admin .status-chips { padding: 0 20px 12px; }
  body.role-admin .search-wrap { padding: 10px 20px; }
  body.role-admin .filter-chips { padding: 8px 20px 12px; }
  body.role-admin .patient-card { padding: 13px 20px; }
  body.role-admin .list-card { margin: 10px 20px 0; }
  body.role-admin .dash-stats-banner { padding: 0 20px 16px; }

  body.role-admin .desktop-grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 20px; }
  body.role-admin .desktop-grid-3 { grid-template-columns: 1fr 1fr 1fr; gap: 14px; padding: 14px 20px; }
  body.role-admin .desktop-grid-4 { grid-template-columns: repeat(4,1fr); gap: 14px; padding: 14px 20px; }
  body.role-admin .stat-grid { grid-template-columns: repeat(4,1fr); gap: 14px; padding: 16px 20px; }
  body.role-admin .dash-stats-grid { grid-template-columns: repeat(4,1fr); gap: 12px; }
}

/* =============================================
   CENTERED POPUP SYSTEM
   ============================================= */
#popupOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 35, .55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
#popupOverlay.open { display: flex; }

.popup-card {
  background: var(--surface);
  border-radius: 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(.92) translateY(12px);
  opacity: 0;
  transition: transform .2s cubic-bezier(.34,1.4,.64,1), opacity .2s ease;
}
.popup-card.in { transform: scale(1) translateY(0); opacity: 1; }

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.popup-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}
.popup-close {
  background: var(--bg);
  border: none;
  border-radius: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  transition: background .15s, color .15s;
}
.popup-close:hover { background: var(--danger-bg); color: var(--danger); }

.popup-body { padding: 8px; }

/* Popup option rows */
.popup-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .12s;
  font-family: inherit;
}
.popup-opt:hover { background: var(--bg); }
.popup-opt.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: #fff;
}
.popup-opt.active .popup-opt-icon { background: rgba(255,255,255,.15); color: var(--gold); }
.popup-opt.danger { color: var(--danger); }
.popup-opt.danger:hover { background: var(--danger-bg); }
.popup-opt.danger .popup-opt-icon { background: var(--danger-bg); color: var(--danger); }

.popup-opt-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--navy);
  transition: background .12s;
}
.popup-opt:hover .popup-opt-icon { background: rgba(27,42,74,.08); }

.popup-opt-body { flex: 1; }
.popup-opt-label { font-weight: 600; }
.popup-opt-sub { font-size: .72rem; color: var(--text-light); margin-top: 1px; }

.popup-section-label {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
  padding: 8px 14px 4px;
  display: block;
}
.popup-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 8px;
}

/* =============================================
   DROPDOWN OVERRIDES
   ============================================= */
.dropdown-menu {
  list-style: none !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 6px !important;
  min-width: 200px;
  font-size: .82rem;
  animation: dropIn .12s ease;
}
.dropdown-menu li {
  list-style: none !important;
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
}
.dropdown-menu li::before,
.dropdown-menu li::marker { display: none !important; content: none !important; }
.dropdown-item {
  display: flex !important;
  align-items: center;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  color: var(--text) !important;
  font-weight: 500;
  font-size: .82rem;
  text-decoration: none;
  gap: 8px;
  transition: background .1s;
  white-space: nowrap;
}
.dropdown-item i { font-size: .9rem; width: 16px; text-align: center; flex-shrink: 0; }
.dropdown-item:hover { background: var(--bg) !important; color: var(--navy) !important; }
.dropdown-item.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid)) !important;
  color: #fff !important;
}
.dropdown-item.active i { color: var(--gold) !important; }
.dropdown-divider { margin: 4px 2px !important; border-color: var(--border) !important; }

/* Label row inside dropdown (non-clickable) */
.dropdown-label {
  display: block;
  padding: 6px 12px 4px;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   ADMIN TABLE
   ============================================= */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  padding: 11px 14px;
  text-align: left;
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg);
}
.admin-table tr:hover td { background: #F8FAFC; }
.admin-table .td-actions { white-space: nowrap; text-align: right; }
.admin-table .td-actions a {
  margin-left: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1rem;
}
.admin-table .td-actions a:hover { color: var(--navy); }
.admin-table .td-actions a.del:hover { color: var(--danger); }

/* =============================================
   PHOTO CAPTURE
   ============================================= */
.photo-capture-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.photo-preview-circle {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  overflow: hidden;
  border: 3px solid var(--border);
  position: relative;
  flex-shrink: 0;
}
.photo-preview-circle img { width: 100%; height: 100%; object-fit: cover; }
.photo-capture-btns { display: flex; gap: 10px; }
.photo-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  transition: all .15s;
}
.photo-btn:hover { background: var(--blue-light); border-color: #93c5fd; color: var(--blue); }
.photo-btn i { font-size: .95rem; }

/* =============================================
   DOCTOR CARDS
   ============================================= */
.doctor-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: box-shadow .2s, transform .2s;
}
.doctor-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.doctor-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(27,42,74,.1), rgba(201,168,76,.15));
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  overflow: hidden;
  border: 3px solid var(--gold-light);
}
.doctor-avatar img { width: 100%; height: 100%; object-fit: cover; }
.doctor-name { font-size: .95rem; font-weight: 700; color: var(--text); }
.doctor-spec { font-size: .75rem; color: var(--gold); font-weight: 600; }
.doctor-stats { display: flex; gap: 16px; margin-top: 6px; }
.doctor-stat { text-align: center; }
.doctor-stat .num { font-size: .95rem; font-weight: 800; color: var(--navy); }
.doctor-stat .lbl { font-size: .65rem; color: var(--text-light); font-weight: 500; }
.doctor-actions { display: flex; gap: 8px; margin-top: 6px; }

/* =============================================
   CALENDAR EXPAND
   ============================================= */
.cal-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: .73rem;
  font-weight: 600;
  cursor: pointer;
  margin: 10px auto 0;
  width: calc(100% - 24px);
  font-family: inherit;
  transition: background .15s;
}
.cal-expand-btn:hover { background: rgba(255,255,255,.18); }
.cal-fullview {
  background: var(--surface);
  padding: 12px;
  border-top: 1px solid var(--border);
  display: none;
}
.cal-fullview.open { display: block; }
.fc .fc-toolbar-title { font-size: .92rem; font-weight: 700; }
.fc .fc-button {
  background: var(--navy) !important;
  border-color: var(--navy) !important;
  font-size: .75rem !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  font-family: inherit !important;
}
.fc .fc-button:hover { background: var(--navy-dark) !important; }
.fc .fc-daygrid-event { font-size: .72rem; border-radius: 4px !important; }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number { font-size: .75rem; }

/* =============================================
   TAB BAR
   ============================================= */
.tab-bar {
  display: flex;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  scrollbar-width: none;
  position: sticky;
  top: var(--header-h);
  z-index: 50;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1;
  min-width: 70px;
  padding: 11px 6px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  transition: color .12s, border-color .12s;
  font-family: inherit;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-btn i { font-size: .88rem; }
.tab-badge {
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 5px;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
}
.tab-btn.active .tab-badge { background: var(--gold-light); color: var(--gold-dark); }
.tab-panel { min-height: 100px; }

/* =============================================
   INVOICE STYLES
   ============================================= */
.inv-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.inv-item-row .field-input {
  border-bottom: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.inv-total-bar {
  position: sticky;
  bottom: var(--nav-h);
  background: var(--surface);
  border-top: 2px solid var(--border);
  padding: 10px 14px 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  z-index: 90;
}
.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  padding: 3px 0;
  color: var(--text-muted);
}
.inv-total-num { font-weight: 600; }
.inv-total-big {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 4px;
}

@media (min-width: 769px) {
  body.role-admin .inv-total-bar { bottom: 0; max-width: calc(100% - var(--sidebar-w)); }
  body.role-admin .cal-fullview { padding: 14px 4px; }
}
