/* ═══════════════════════════════════════════════════════════════
   ClinicGrow Design System — Single CSS File
   Inter font · 8px grid · Refined blue-slate palette
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --brand:        #2563EB;
  --brand-dark:   #1D4ED8;
  --brand-light:  #EFF6FF;
  --brand-mid:    #BFDBFE;

  /* Surfaces */
  --bg:           #F8FAFC;
  --surface:      #FFFFFF;
  --surface-2:    #F1F5F9;
  --surface-3:    #E2E8F0;

  /* Text */
  --text-1:       #0F172A;
  --text-2:       #334155;
  --text-3:       #64748B;
  --text-4:       #334155;
  --text-inv:     #FFFFFF;

  /* Border */
  --border:       #E2E8F0;
  --border-2:     #CBD5E1;

  /* Role colours */
  --admin-bgx:     #F5F3FF; --admin-text:  #5B21B6; --admin-border: #DDD6FE;
  --doctor-bgx:    #bfdbfe; --doctor-text: #0F766E; --doctor-border:#99F6E4;
  --patient-bgx:   #EFF6FF; --patient-text:#1D4ED8; --patient-border:#BFDBFE;

  /* Status */
  --green-bg:     #F0FDF4; --green-text:  #15803D; --green-border: #BBF7D0;
  --red-bg:       #FFF1F2; --red-text:    #BE123C; --red-border:   #FECDD3;
  --amber-bg:     #FFFBEB; --amber-text:  #B45309; --amber-border: #FDE68A;
  --slate-bg:     #F8FAFC; --slate-text:  #475569; --slate-border: #E2E8F0;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:       0 4px 6px -1px rgba(15,23,42,.07), 0 2px 4px -2px rgba(15,23,42,.05);
  --shadow-md:    0 10px 15px -3px rgba(15,23,42,.08), 0 4px 6px -4px rgba(15,23,42,.05);
  --shadow-lg:    0 20px 25px -5px rgba(15,23,42,.1),  0 8px 10px -6px rgba(15,23,42,.06);

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  14px;
  --r-lg:  8px;
  --r-xl:  24px;
  --r-full:9999px;

  /* Sidebar */
  --sidebar-w: 220px;
  --topbar-h:  56px;

  /* Transitions */
  --t: .15s ease;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

span.mobile-section-label {display: none!important;}
div#rx-view > div {font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;}
tbody {background: linear-gradient(288deg, rgb(219 247 223 / 5%), rgb(113 178 128 / 7%));}
/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }

/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */
.cf-topbar {
position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    box-shadow: -1px 3px 10px 0px #bfdbfea1;
    background: #fff;
    backgroundx: linear-gradient(358deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%));
    backgroundx:linear-gradient(358deg, rgb(80 174 177 / 48%), rgb(189 218 230 / 0%))
}

.logo {display: flex; flex-wrap: nowrap;margin-top:2px;}
.logo img {height: 55px;width: auto;display: block;}

.cf-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -.3px;
}
.cf-logo-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 16px;
}

.cf-topnav {
  display: flex; align-items: center; gap: 2px;
  flex: 1; padding: 0 16px;
}
.cf-topnav-link {
  padding: 6px 14px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  color: var(--text-3);
  transition: all var(--t);
  display: flex; align-items: center; gap: 6px;
  border: none; background: none;
  text-decoration: none;
}
.cf-topnav-link:hover { background: var(--surface-2); color: var(--text-2); }
.cf-topnav-link.active {
background: #c3ccc242;
    color: #343736
    font-weight: 600;
}

.cf-topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.cf-role-pill {
  font-size: 11px; font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--brand-mid);
  text-transform: capitalize;
  letter-spacing: .3px;
}

.cf-mob-btn {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-3);
  align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.cf-layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }

.cf-sidebar {
  width: var(--sidebar-w);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .1);
    background: linear-gradient(86deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
  transition: transform .25s ease;padding-top: 30px;
}

.cf-mobile-nav {
  display: none;
}

.cf-mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
}

.cf-mobile-nav-link:hover,
.cf-mobile-nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
}

.cf-mobile-nav-link i {
  width: 20px;
  font-size: 17px;
  text-align: center;
}

.cf-sidebar-header {
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.cf-sidebar-portal {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-4);
  margin-bottom: 4px; display: none;
}
.cf-sidebar-name {
  font-size: 16px; font-weight: 600;font-family: "Chakra Petch", sans-serif;
    letter-spacing: 1px;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#rx-print div {font-size: calc(13px * var(--rx-scale));
    color: var(--text-3);
    margin-top: 3px;
    font-family: "Chakra Petch", sans-serif;
    letter-spacing: 1px;}
div#rx-preview div {font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;}

.cf-sidebar-badge {
  display: inline-flex; margin-top: 6px;
  font-size: 11px; font-weight: 500;
  paddingx: 3px 10px;
  border-radius: var(--r-full);
}
.cf-sidebar-badge.adminx   { background: var(--admin-bg);   color: var(--admin-text);   border: 1px solid var(--admin-border); }
.cf-sidebar-badge.doctorx  { background: var(--doctor-bg);  color: var(--doctor-text);  border: 1px solid var(--doctor-border); }
.cf-sidebar-badge.patientx { background: var(--patient-bg); color: var(--patient-text); border: 1px solid var(--patient-border); }

.cf-sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.cf-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  transition: all var(--t);
  white-space: nowrap;
  border: none; background: none; width: 100%;
}
.cf-nav-link i { font-size: 16px; flex-shrink: 0; }
.cf-nav-link:hover { background: var(--surface-2); color: var(--text-1); }
.cf-nav-link.active {
background: #deecff;
    color: #204726ab;
    font-weight: 600;
}
.cf-nav-link.active i { color: var(--brand); }

.cf-sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

.cf-nav-link.logout { color: #E11D48; }
.cf-nav-link.logout:hover { background: #FFF1F2; color: #BE123C; }

.cf-main {
    flex: 1;
    padding: 28px 32px;
    backgroundxxx: var(--bg);
   background: linear-gradient(358deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%));
    overflow: auto;
    min-width: 0;
}

/* ═══════════════════════════════════════════════════════════
   OVERLAY (mobile)
   ═══════════════════════════════════════════════════════════ */
.cf-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 29; backdrop-filter: blur(2px);
}
.cf-overlay.open { display: block; }

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════ */
.cf-page-header { margin-bottom: 24px; }
.cf-page-title  {font-size: 22px;
    color: #5449a7db;
    font-family: "Chakra Petch", sans-serif;
    font-weight: 800;
    font-style: normal;
    letter-spacing: 1px;}
.cf-page-sub    {font-size: 15px;
    color: var(--text-3);
    margin-top: 3px;
    font-family: "Chakra Petch", sans-serif;
    letter-spacing: 1px;}

/* ═══════════════════════════════════════════════════════════
   HERO STRIP
   ═══════════════════════════════════════════════════════════ */
.cf-hero {
  /* background: linear-gradient(135deg, #1E3A5F 0%, #1D4ED8 50%, #2563EB 100%);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  color: #fff;
  margin-bottom: 24px;
  position: relative; overflow: hidden; */
  
  border-radius: var(--r-lg);
    padding: 24px 28px;
    color: #605b5b;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(213deg, rgb(34 135 109 / 4%), rgb(255 255 255 / 59%));
  
}
.cf-hero::after {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.cf-hero-title {     font-size: 22px;
    color: #5449a7db;
    font-family: "Chakra Petch", sans-serif;
    font-weight: 800;
    font-style: normal;
    letter-spacing: 1px; }
.cf-hero-sub   { font-size: 15px;
    color: var(--text-3);
    margin-top: 3px;
    font-family: "Chakra Petch", sans-serif;
    letter-spacing: 1px; }

/* ═══════════════════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════════════════ */
.cf-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }

.cf-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.cf-stat-val  { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.cf-stat-lbl  { font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 6px; }
.cf-stat-icon { font-size: 20px; margin-bottom: 8px; }

.cf-stat.purple .cf-stat-val { color: #7C3AED; }
.cf-stat.teal   .cf-stat-val { color: #0F766E; }
.cf-stat.green  .cf-stat-val { color: #15803D; }
.cf-stat.amber  .cf-stat-val { color: #B45309; }
.cf-stat.blue   .cf-stat-val { color: var(--brand); }
.cf-stat.rose   .cf-stat-val { color: #BE123C; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.cf-card {
background: linear-gradient(288deg, rgb(255 255 255 / 69%), rgb(255 255 255));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;margin-bottom: 5px;
}
.cf-card-body   { padding: 20px 24px; background: linear-gradient(288deg, rgb(255 255 255), rgb(255 255 255));}
.cf-card-header {
    border-bottom: 1px solid #4630ab24;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
background: linear-gradient(356deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%))!important;
box-shadow: inset 0px 0px 20px 0px #bfdbfe38;
}

div#pathlab-preview-card {
    background: linear-gradient(271deg, rgb(9 145 9 / 6%), rgb(226 221 182 / 13%)) !important;
    border: 1px solid #e9c8b4 !important;
}
#med-list .med-row {background: none !important;}

.cf-card-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-2); font-family: "Chakra Petch", sans-serif;letter-spacing: 1px;}

.cf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cf-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }


/* ═══════════════════════════════════════════════════════════
   patient-profile
   ═══════════════════════════════════════════════════════════ */
div#pat-view {font-family: "Chakra Petch", sans-serif;letter-spacing: 1px;}

.tl-vitals {display: flex; flex-wrap: wrap; gap: 8px; background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; font-size: 11px;  margin: 8px 0; letter-spacing: 1px!important;}
span#cf-clock {
    font-family: "Chakra Petch", sans-serif;
    letter-spacing: 1px;
}
/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.cf-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer; transition: all var(--t);
  white-space: nowrap; line-height: 1;
  text-decoration: none;
}
.cf-btn i { font-size: 15px; }

.cf-btn-primary {
background: #e9f3ff;
color: var(--text-2);
border-color: #bfdbfe;letter-spacing: 1px;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.cf-btn-primary:hover { box-shadow: -1px 2px 4px rgb(37 99 235 / 76%); }

.cf-btn-outline {
  background: var(--surface); color: var(--text-2);
  border-color: var(--border-2);
}
.cf-btn-outline:hover { background: var(--surface-2); border-color: var(--border-2); }

.cf-btn-danger  { background: var(--red-bg);   color: var(--red-text);   border-color: var(--red-border); }
.cf-btn-danger:hover  { background: #FFE4E6; }
.cf-btn-success { background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.cf-btn-success:hover { background: #DCFCE7; }
.cf-btn-green   { background: #22C55E; color: #fff; border-color: #22C55E; }
.cf-btn-green:hover { background: #16A34A; }
.cf-btn-teal    { background: #0D9488; color: #fff; border-color: #0D9488; }
.cf-btn-teal:hover { background: #0F766E; }
.cf-btn-purple  { background: #7C3AED; color: #fff; border-color: #7C3AED; }
.cf-btn-purple:hover { background: #6D28D9; }

.cf-btn-sm { padding: 6px 13px; font-size: 12px; }
.cf-btn-lg { padding: 12px 24px; font-size: 14px; }
.cf-btn-block { width: 100%; justify-content: center; }

.cf-btn-wa {
  background: #22C55E; color: #fff; border-color: #22C55E;
  font-size: 12px; padding: 6px 12px;
}
.cf-btn-wa:hover { background: #16A34A; }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */
.cf-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.cf-badge-blue    { background: var(--patient-bg); color: var(--patient-text); border-color: var(--patient-border); }
.cf-badge-green   { background: var(--green-bg);   color: var(--green-text);   border-color: var(--green-border); }
.cf-badge-red     { background: var(--red-bg);     color: var(--red-text);     border-color: var(--red-border); }
.cf-badge-amber   { background: var(--amber-bg);   color: var(--amber-text);   border-color: var(--amber-border); }
.cf-badge-gray    { background: var(--slate-bg);   color: var(--slate-text);   border-color: var(--slate-border); }
.cf-badge-teal    { background: var(--doctor-bg);  color: var(--doctor-text);  border-color: var(--doctor-border); }
.cf-badge-purple  { background: var(--admin-bg);   color: var(--admin-text);   border-color: var(--admin-border); }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.cf-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  margin-top: 6px;
  letter-spacing: .01em;
}
.cf-label .req { color: #E11D48; margin-left: 2px; }

.cf-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 14px; font-weight: 400;
  color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
}
.cf-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.cf-input::placeholder { color: var(--text-4); }

textarea.cf-input  { resize: vertical; min-height: 90px; line-height: 1.5; }
select.cf-input    { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
input[type=time].cf-input, input[type=date].cf-input { padding: 9px 12px; }

.cf-form-group  { display: flex; flex-direction: column; gap: 6px; }
.cf-form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cf-form-stack  { display: flex; flex-direction: column; gap: 16px; }

.cf-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 9px 13px;
  transition: border-color var(--t);
}
.cf-search:focus-within { border-color: var(--brand); }
.cf-search i { font-size: 16px; color: var(--text-4); flex-shrink: 0; }
.cf-search input { flex: 1; border: none; outline: none; font-size: 14px; color: var(--text-1); background: none; }
.cf-search input::placeholder { color: var(--text-4); }

/* ═══════════════════════════════════════════════════════════
   OTP INPUTS
   ═══════════════════════════════════════════════════════════ */
.cf-otp-row { display: flex; gap: 10px; justify-content: center; }
.cf-otp {
  width: 52px; height: 60px;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
  font-size: 24px; font-weight: 700;
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  background: var(--surface);
}
.cf-otp:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */
.cf-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cf-table thead {background: linear-gradient(356deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%))!important;
box-shadow: inset 0px 0px 20px 0px #bfdbfe38; }
.cf-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cf-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cf-table tbody tr:last-child td { border-bottom: none; }
.cf-table tbody tr { transition: background var(--t); background: linear-gradient(360deg, rgb(255 255 255 / 91%), rgb(255 255 255)) !important;}
.cf-table tbody tr:hover { background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════════ */
.cf-avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; font-size: 12px;
}
.cf-avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.cf-avatar-md { width: 40px; height: 40px; font-size: 13px; }
.cf-avatar-lg { width: 48px; height: 48px; font-size: 15px; }

.cf-av-1 { background: #EFF6FF; color: #1D4ED8; }
.cf-av-2 { background: #F0FDFA; color: #0F766E; }
.cf-av-3 { background: #FFFBEB; color: #B45309; }
.cf-av-4 { background: #F5F3FF; color: #6D28D9; }
.cf-av-5 { background: #FFF1F2; color: #BE123C; }
.cf-av-6 { background: #F0FDF4; color: #15803D; }

/* ═══════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════ */
.cf-tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 2px;
  margin-bottom: 20px;
}
.cf-tab {
  padding: 7px 16px;
  border-radius: var(--r);
  font-size: 12px; font-weight: 500;
  color: var(--text-3);
  border: none; background: none; cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.cf-tab:hover { color: var(--text-2); background: var(--surface-2); }
.cf-tab.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.cf-tab .cnt {
  font-size: 10px; font-weight: 700;
  opacity: .7;
}
.cf-tab.active .cnt { opacity: .85; }

/* ═══════════════════════════════════════════════════════════
   FILTER CHIPS
   ═══════════════════════════════════════════════════════════ */
.cf-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip {
  padding: 5px 13px;
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer; transition: all var(--t);
  text-decoration: none; display: inline-block;
}
.cf-chip:hover  { border-color: var(--brand); color: var(--brand); }
.cf-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ═══════════════════════════════════════════════════════════
   LIST ROWS (appointments, doctors, etc.)
   ═══════════════════════════════════════════════════════════ */
.cf-list { display: flex; flex-direction: column; gap: 10px; }

.cf-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}
.cf-list-item:hover {
  border-color: var(--brand-mid);
  box-shadow: var(--shadow);
}
.cf-list-item.muted { opacity: .55; }
.cf-list-item.selected {
  border-color: var(--brand);
  background: var(--brand-light);
}
.cf-list-item-body { flex: 1; min-width: 0; }
.cf-list-item-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.cf-list-item-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cf-list-item-meta  { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--text-2); align-items: center; }

/* ═══════════════════════════════════════════════════════════
   APPOINTMENT CARD
   ═══════════════════════════════════════════════════════════ */
.cf-appt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}
.cf-appt-card:hover { border-color: var(--brand-mid); box-shadow: var(--shadow); }
.cf-appt-card.cancelled { opacity: .5; }

.cf-appt-id {
font-family: 'Inter';
    font-weight: 700;
    color: var(--brand);
    background: #bfdbfe;
    border-radius: 8px;
    display: inline-block;
    padding: 4px 11px;
    font-size: 12px;
    letter-spacing: 1px;
}

.cf-meta-item { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.cf-meta-item strong { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════════════ */
.cf-cal { user-select: none; }

.cf-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cf-cal-nav-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; cursor: pointer; transition: all var(--t);
  line-height: 1;
}
.cf-cal-nav-btn:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text-1); }
.cf-cal-month { font-size: 14px; font-weight: 600; color: var(--text-1); }

.cf-cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cf-cal-hdr  { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-4); padding: 4px 0; }

.cf-cal-day {
  text-align: center; padding: 8px 2px;
  border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px;
  position: relative; transition: all var(--t); line-height: 1;
  color: var(--text-2);
}
.cf-cal-day:hover  { background: var(--brand-light); color: var(--brand); }
.cf-cal-day.sel    { background: var(--brand); color: #fff; font-weight: 600; }
.cf-cal-day.tod    { font-weight: 700; color: var(--brand); }
.cf-cal-day.tod.sel { color: #fff; }
.cf-cal-day.has::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: #10B981;
}
.cf-cal-day.sel.has::after { background: rgba(255,255,255,.7); }
.cf-cal-day.empty  { cursor: default; pointer-events: none; }
.cf-cal-legend {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 11px; color: var(--text-4);
}
.cf-cal-dot { width: 6px; height: 6px; border-radius: 50%; background: #10B981; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   SLOT BUTTONS
   ═══════════════════════════════════════════════════════════ */
.cf-slots { display: flex; flex-wrap: wrap; gap: 8px; }

.cf-slot {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 12px; font-weight: 500;
  cursor: pointer; background: var(--surface);
  color: var(--text-2);
  transition: all var(--t); white-space: nowrap;
}
.cf-slot:hover:not(.booked) { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.cf-slot.sel   { background: var(--brand); color: #fff; border-color: var(--brand); }
.cf-slot.booked {
  background: var(--surface-2); color: var(--text-4);
  text-decoration: line-through; cursor: not-allowed;
}

/* Slot chips (availability page) */
.cf-slot-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #0D9488; color: #fff;
  font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r);
}
.cf-slot-chip.booked {
  background: var(--surface-2); color: var(--text-4);
  cursor: not-allowed;
}
.cf-slot-chip-remove {
  background: none; border: none; color: inherit;
  opacity: .7; cursor: pointer; font-size: 16px; line-height: 1;
  padding: 0; display: flex; align-items: center;
}
.cf-slot-chip-remove:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════════════════════ */
.cf-toggle {
  position: relative; display: inline-block;
  width: 40px; height: 22px;
}
.cf-toggle input { opacity: 0; width: 0; height: 0; }
.cf-toggle-slider {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border-radius: var(--r-full);
  cursor: pointer; transition: background var(--t);
}
.cf-toggle-slider::before {
  content: '';
  position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: transform var(--t);
  box-shadow: var(--shadow-sm);
}
.cf-toggle input:checked + .cf-toggle-slider { background: var(--brand); }
.cf-toggle input:checked + .cf-toggle-slider::before { transform: translateX(18px); }

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.cf-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 13px 18px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  color: #fff; display: none;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  display: none;
  animation: cf-toast-in .2s ease;
}
@keyframes cf-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGES
   ═══════════════════════════════════════════════════════════ */
.cf-login-wrap {
  min-height: calc(100vh - var(--topbar-h));
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
 background: linear-gradient(358deg, rgb(39 160 246 / 19%), rgb(189 218 230 / 0%));
}
.cf-login-box {
  backgroundx: linear-gradient(288deg, rgb(219 247 223 / 5%), rgb(113 178 128 / 7%));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-md);
}
.cf-login-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 16px;display: none;
}
.cf-login-title { font-size: 20px; font-weight: 700; text-align: center; color: var(--text-1); letter-spacing: -.3px; }
.cf-login-sub   { font-size: 13px; color: var(--text-3); text-align: center; margin-top: 4px; }

/* Step indicator */
.cf-steps { display: flex; align-items: center; margin-bottom: 24px; }
.cf-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-4); background: var(--surface);
  transition: all var(--t);
}
.cf-step-dot.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cf-step-dot.done   { background: #10B981; color: #fff; border-color: #10B981; }
.cf-step-label { font-size: 12px; font-weight: 500; margin-left: 6px; color: var(--text-3); }
.cf-step-label.active { color: var(--text-1); }
.cf-step-line { flex: 1; height: 1px; background: var(--border); margin: 0 10px; }
.cf-step-line.done { background: #10B981; }

/* ═══════════════════════════════════════════════════════════
   ALERTS & NOTICES
   ═══════════════════════════════════════════════════════════ */
.cf-alert {
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid;
  margin-bottom: 16px;
}
.cf-alert-info    { background: var(--patient-bg); color: var(--patient-text); border-color: var(--patient-border); }
.cf-alert-successxx { background: var(--green-bg);   color: var(--green-text);   border-color: var(--green-border); }
.cf-alert-warning { background: var(--amber-bg);   color: var(--amber-text);   border-color: var(--amber-border); }
.cf-alert-error   { background: var(--red-bg);     color: var(--red-text);     border-color: var(--red-border); }
.cf-alert-success {background: #fdf9f0; color: #806615;  border-color: #f7d1bb; }
/* ═══════════════════════════════════════════════════════════
   CONFIRMATION BOX (booking success)
   ═══════════════════════════════════════════════════════════ */
.cf-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 28px; text-align: center;
  max-width: 360px; margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.cf-confirm-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 32px; font-weight: 700;
  letter-spacing: .15em;
  color: var(--brand);
  margin: 12px 0 20px;
}
.cf-info-table { background: var(--surface-2); border-radius: var(--r); padding: 14px 16px; }
.cf-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.cf-info-row:last-child { border: none; }
.cf-info-lbl { color: var(--text-3); }
.cf-info-val { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */
.cf-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 24px;
  text-align: center; color: var(--text-4);
}
.cf-empty-icon { font-size: 48px; margin-bottom: 12px; }
.cf-empty-title { font-size: 15px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.cf-empty-sub   { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.cf-modal-wrap {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 50; align-items: center; justify-content: center;
  padding: 16px;
}
.cf-modal-wrap.open { display: flex; }
.cf-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.cf-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.cf-modal-sub   { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   HERO LANDING PAGE
   ═══════════════════════════════════════════════════════════ */
.cf-landing-hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 40%, #1D4ED8 100%);
  color: #fff;
  padding: 56px 24px;
  text-align: center;
}
.cf-landing-title { font-size: 36px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 8px; }
.cf-landing-sub   { font-size: 16px; opacity: .75; max-width: 520px; margin: 0 auto 28px; }
.cf-feature-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cf-feature-pill  {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-full);
  padding: 6px 16px; font-size: 12px; font-weight: 500;
}

.cf-portal-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.cf-portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
  text-decoration: none; color: inherit; display: block;
}
.cf-portal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cf-portal-card-header { padding: 24px 24px 20px; color: #fff; }
.cf-portal-card-icon   { font-size: 32px; margin-bottom: 10px; }
.cf-portal-card-title  { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.cf-portal-card-desc   { font-size: 13px; opacity: .8; }
.cf-portal-card-body   { padding: 18px 24px 22px; }
.cf-portal-feature {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); margin-bottom: 7px;
}
.cf-portal-feature::before {
  content: '✓'; font-size: 11px; font-weight: 700;
  color: #10B981; flex-shrink: 0;
}
.cf-portal-cta {
  font-size: 13px; font-weight: 600;
  color: var(--brand); margin-top: 14px;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════
   SCHEDULE ITEMS (availability panel)
   ═══════════════════════════════════════════════════════════ */
.cf-schedule-list { display: flex; flex-direction: column; gap: 8px; max-height:620px; overflow-y: auto; padding-right: 4px; }
.cf-schedule-item {
display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r);
    cursor: pointer;
    transition: all var(--t);
border: 1px solid #4630ab24;
    background: linear-gradient(360deg, rgb(255 255 255 / 91%), rgb(255 255 255));
}
.cf-schedule-item:hover  { background: var(--brand-light); border-color: var(--brand-mid); }
.cf-schedule-item.active { background: var(--doctor-bg); border-color: var(--doctor-border); }
.cf-schedule-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; flex-shrink: 0; margin-top: 4px; }
.cf-schedule-date { font-size: 13px; font-weight: 600; color: var(--text-1); }
.cf-schedule-slots { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; }
#schedule-summary > div.cf-schedule-list > div:nth-child(2) > div {min-width: 260px;} /* fix for mobile*/
.cf-schedule-tag  {
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  padding: 2px 8px; border-radius: var(--r-sm);
}
.cf-schedule-tag.booked {
  background: var(--surface-2); color: var(--text-4);
  text-decoration: line-through; border-color: transparent;
}
.cf-schedule-count { font-size: 11px; color: var(--text-4); margin-left: auto; white-space: nowrap; padding-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .cf-stats { grid-template-columns: repeat(2,1fr); }
  .cf-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .cf-mob-btn { display: flex; }
  .cf-topnav  { display: none; }

  .cf-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    flex-shrink: 0;
    transition: transform .25s ease;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .15);
    background: var(--surface);
    overflow-y: auto;
  }
  .cf-sidebar.open { transform: translateX(0); }
  .cf-mobile-nav {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 200;
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .15);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .cf-mobile-nav.open { transform: translateX(0); }
  .cf-layout { display: block; }
  .cf-main   { padding: 16px; margin-left: 0 !important; }

  .cf-stats       { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cf-grid-2      { grid-template-columns: 1fr; }
  .cf-grid-3      { grid-template-columns: 1fr; }
  .cf-portal-grid { grid-template-columns: 1fr; }
  .cf-form-row    { grid-template-columns: 1fr; }
  .cf-table-wrap  { overflow-x: auto; }

  .cf-login-box { padding: 24px 20px; }
  .cf-confirm-box { padding: 24px 20px; }
  .cf-hero { padding: 18px 20px; }
  .cf-card-body { padding: 16px; }
  .cf-card-header { padding: 14px 16px; }
  .cf-main { min-height: calc(100vh - var(--topbar-h)); }

  .cf-tabs { flex-wrap: wrap; }
  .cf-modal-wrap { align-items: flex-end; }
  .cf-modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-width: 100%; }
}

@media (max-width: 480px) {
  .cf-landing-title { font-size: 26px; }
  .cf-stats { grid-template-columns: 1fr 1fr; }
  .cf-otp { width: 44px; height: 52px; font-size: 20px; }
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES (minimal set — avoid repeating Tailwind)
   ═══════════════════════════════════════════════════════════ */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap  { flex-wrap: wrap; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.w-full  { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.font-mono { font-family: 'SF Mono','Fira Code','Roboto Mono',monospace; }


/* ==========================
   Mobile Responsive Table
========================== */

@media (max-width:768px){

.cf-table,
.cf-table tbody,
.cf-table tr,
.cf-table td{
    display:block;
    width:unset;
}

.cf-table thead{
    display:none;
}

.cf-table tr{
    margin:18px;
    padding:14px;
    border:1px solid #e5e7eb;
    border-radius:14px;
    background:#fff;
    box-shadow:0 2px 10px rgba(0,0,0,.06);
}

.cf-table td{

    display:flex;
    justify-contentx:space-between;
    align-itemsx:flex-start;
    gapx:15px;

    padding:10px 0;
    border:none;
    border-bottom:1px solid #f1f5f9;

    text-align:right;
}

.cf-table td:last-child{
    border-bottom:none;
}

.cf-table td::before{

    content:attr(data-label);

    font-weight:600;
    color:#64748b;

    min-widthxx:95px;

    text-align:left;
}

.cf-table td strong {padding-left: 10px;}
.cf-btn-sm {padding: 16px 30px;}
.cf-btn-wa {padding: 16px 30px;}

.cf-table td>*{

    flex:1;

    text-align:left;
}

.cf-table td[data-label="Actions"]{

    display:block;

}

.cf-table td[data-label="Actions"]::before{

    display:block;
    margin-bottom:10px;

}

.cf-table td[data-label="Actions"]>div{

    justify-content:flex-end;
    display:flex;
    gap:8px;
    flex-wrap:wrap;

}

}
/* ═══════════════════════════════════════════════════════════
   BOOTSTRAP 5 INTEGRATION LAYER
   Bridges Bootstrap grid/utilities with cf.css design tokens
   ═══════════════════════════════════════════════════════════ */

/* ── Use Bootstrap grid inside cf-main ── */
.cf-main .row > [class*="col-"] { padding-top: 0; }

/* ── cf-grid-2 → Bootstrap row on mobile ── */
@media (max-width: 767px) {
  .cf-grid-2,
  .cf-grid-3 { display: flex; flex-direction: column; gap: 12px; }
  /* Availability page: stack on mobile */
  .avail-grid { grid-template-columns: 1fr !important; }
  /* 5-col stat grid → 2+3 on mobile */
  .cf-stats[style*="repeat(5,1fr)"] { grid-template-columns: repeat(2,1fr) !important; }

  /* Appointment 3-col grid → 1 col on mobile */
  .appt-grid { grid-template-columns: 1fr !important; }

  /* Page header stack on mobile */
  .cf-page-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Card header wrap */
  .cf-card-header { flex-wrap: wrap; gap: 8px; }

  /* Prescription clinical grid → stack */
  .cf-grid-2[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Table cards on mobile — improve readability */
  .cf-table td { font-size: 13px; }
  .cf-table td::before { font-size: 11px; min-widthxx: 90px; }

  /* Buttons — full width on small screens when in block context */
  .cf-btn-block-mob { width: 100% !important; justify-content: center; }

  /* Modal — slides up from bottom */
  .cf-modal { max-height: 90vh; overflow-y: auto; }

  /* Stats 2-col */
  .cf-stats { grid-template-columns: 1fr 1fr; }

  /* Tabs scroll horizontally */
  .cf-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .cf-tab  { white-space: nowrap; flex-shrink: 0; }

  /* Prescription page action bar */
  [style*="display:flex;align-items:center;justify-content:space-between"] {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Doctor login role toggle */
  .role-opt { font-size: 12px; padding: 7px 4px; }

  /* OTP row center on mobile */
  .cf-otp-row { justify-content: center; }

  /* Form rows → stack */
  .cf-form-row { grid-template-columns: 1fr; }

  /* Vitals boxes in prescription — wrap */
  #rx-view [style*="display:flex;gap:6px;flex-shrink:0"] { flex-wrap: wrap; }

  /* Booking page slots */
  .cf-slots { justify-content: center; }
}

@media (max-width: 480px) {
  .cf-topbar { padding: 0 12px; gap: 8px; }
  .cf-logo span { display: none; }       /* hide "ClinicGrow" text, keep icon */
  .cf-role-pill { font-size: 10px; padding: 2px 8px; }
  .cf-page-title { font-size: 18px; font-family: "Chakra Petch", sans-serif;}
  .cf-card-body  { padding: 14px; }
  .cf-avatar-lg  { width: 44px; height: 44px; font-size: 15px; }

  /* Prescription patient strip vitals wrap */
  #rx-view > div { font-size: 12px; }

  /* Pathlab dashboard cards */
  #testcard [style*="display:flex;align-items:center;gap:12px"] { flex-wrap: wrap; }

  /* Btn sizes on very small screens */
  .cf-btn { padding: 8px 12px; font-size: 12px; }
  .cf-btn-sm { padding: 5px 8px; font-size: 11px; }
}

/* ── Tablet (768-1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .cf-stats[style*="repeat(5,1fr)"] { grid-template-columns: repeat(3,1fr) !important; }
  .cf-sidebar { width: 200px; }
  .cf-main { padding: 20px; }
  .cf-stats { grid-template-columns: repeat(2,1fr); }
  .cf-grid-2 { grid-template-columns: 1fr 1fr; gap: 14px; }
  .cf-grid-3 { grid-template-columns: 1fr 1fr; }
  .appt-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* Prescription form — single col on tablet */
  .cf-grid-2[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
}

/* ── Large desktop ── */
@media (min-width: 1280px) {
  .cf-main { padding: 28px 32px; }
  .cf-stats { grid-template-columns: repeat(4,1fr); }
}

/* ── Bootstrap modal override to use cf modal styles ── */
/* (we keep using cf-modal, not Bootstrap modal, so no conflict) */

/* ── Ensure Bootstrap utility classes don't break cf layouts ── */
.cf-card  { overflow: hidden; }
.cf-table-wrap { -webkit-overflow-scrolling: touch; }

/* Medicines card must not clip the autocomplete suggestions dropdown
   (was being cut off behind the Live Preview card below it) */
#meds-card { overflow: visible; }

/* Lab Test Advice card must not clip the lab-tests multi-select dropdown */
#lab-card { overflow: visible; }

/* ── Touch targets ── min 44px height for buttons on mobile ── */
@media (max-width: 767px) {
  .cf-btn     { min-height: 40px; }
  .cf-nav-link { min-height: 40px; padding: 10px 16px; }
  .cf-otp     { min-height: 52px; }
  select.cf-input { min-height: 40px; }
  input.cf-input  { min-height: 40px; }
}

/* ── Prevent horizontal scroll on body ── */
html, body { overflow-x: hidden; max-width: 100vw; }

/* ── Fix inline style grids used across pages ── */
@media (max-width: 767px) {
  /* [style*="display:grid;grid-template-columns:repeat(3"] { grid-template-columns: 1fr !important; }*/
  [style*="display:grid;grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr 1fr"]           { grid-template-columns: 1fr !important; }
 /* [style*="grid-template-columns:repeat(3,1fr)"]         { grid-template-columns: 1fr !important; }*/
  [style*="grid-template-columns:1fr 1fr"]               { grid-template-columns: 1fr !important; }
}
@media (min-width: 768px) and (max-width: 1023px) {
 /*  [style*="display:grid;grid-template-columns:repeat(3"] { grid-template-columns: 1fr 1fr !important; }*/
  [style*="grid-template-columns:1fr 1fr 1fr"]           { grid-template-columns: 1fr 1fr !important; }
  /* [style*="grid-template-columns:repeat(3,1fr)"]         { grid-template-columns: 1fr 1fr !important; }*/
}

/* ── Pathlab dashboard responsive ── */
@media (max-width: 767px) {
  #testcard [style*="display:flex;align-items:center;gap:12px;flex-wrap:wrap"] {
    flex-direction: column; align-items: flex-start;
  }
  [id^="sendbtn-"] { width: 100%; justify-content: center; margin-top: 8px; }
}

/* ── Prescription pad settings responsive ── */
@media (max-width: 767px) {
  .cf-form-group [style*="display:flex;align-items:center;gap:8px"] { flex-wrap: wrap; }
}

/* ── Book page hero responsive ── */
@media (max-width: 480px) {
  .bk-hero { padding: 24px 16px; }
  .bk-hero-name { font-size: 20px; }
  .bk-section { padding: 16px 12px; }
  .cf-slot { padding: 8px 12px; font-size: 12px; }
}

/* ── Vitals flash animation (appointments + patient-profile) ── */
@keyframes vitals-pulse {
  0%,100% { background:var(--surface); color:var(--text-2); border-color:var(--border); box-shadow:none; }
  50%      { background:#FEF3C7; color:#92400E; border-color:#F59E0B; box-shadow:0 0 0 3px rgba(245,158,11,.25); }
}
.vitals-flash {
  animation: vitals-pulse 1.4s ease-in-out infinite;
}
.vitals-flash:hover {
  animation: none;
  background: #FEF3C7 !important;
  color: #92400E !important;
  border-color: #F59E0B !important;
}

@media (max-width: 767px){
/* 5-col stat grid → 2-col on mobile */
.cf-stats[style*="repeat(5,1fr)"] { grid-template-columns: repeat(2,1fr) !important; }}

@media (min-width: 768px) and (max-width: 1023px) {
/* 5-col stat grid → 3-col on tablet */
.cf-stats[style*="repeat(5,1fr)"] { grid-template-columns: repeat(3,1fr) !important; }
}

/* ═══════════════════════════════════════════════════════════
   PHASE 1 — MOBILE OPTIMISATION
   ═══════════════════════════════════════════════════════════ */

/* ── 1. iOS input zoom prevention (font-size < 16px triggers zoom) ── */
@media (max-width: 767px) {
  input.cf-input,
  select.cf-input,
  textarea.cf-input { font-size: 16px !important; }
}

/* ── 2. Topbar: hide clock + username on small screens ─────────── */
@media (max-width: 600px) {
  #cf-clock { display: none !important; }
  .cf-topbar-right > span[style*="font-weight:600"] { display: nonex; }
  .mobile-section-label { display: inline !important; }
  .cf-topbar { padding: 0 10px; gap: 8px; }
  .cf-logo img { margin-top:7px !important; }
}

/* ── 3. Sidebar improvements on mobile ─────────────────────────── */
@media (max-width: 767px) {
  .cf-sidebar {
    width: 260px;
  }
  .cf-sidebar-header { padding: 8px 8px 14px; }
  .cf-sidebar-portal { display: block; }
  .cf-sidebar-name { font-size: 14px; }
  .cf-nav-link { padding: 11px 12px; font-size: 14px; min-height: 46px; }
  .cf-nav-link i { font-size: 18px; }
}

/* ── 4. Tables → card view with labels ─────────────────────────── */
@media (max-width: 767px) {
  /* Already handled but fix typos + improve */
  .cf-table td { justify-content: space-between; align-items: flex-start; gap: 8px; }
  .cf-table td::before { min-widthxx: 100px; flex-shrink: 0; }

  /* Buttons inside table cells — reasonable size */
  .cf-table td .cf-btn-sm { padding: 8px 12px; font-size: 12px; min-height: 36px; }
  .cf-table td .cf-btn-wa { padding: 8px 12px; font-size: 12px; min-height: 36px; }
  .cf-btn-sm { padding: 8px 12px; }
  .cf-btn-wa { padding: 8px 12px; }
}

/* ── 5. Modals — full-screen on very small screens ──────────────── */
@media (max-width: 480px) {
  .cf-modal-wrap { padding: 0; align-items: flex-end; }
  .cf-modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px 18px;
  }
  .cf-modal-title { font-size: 16px; }
}

/* ── 6. Page header — stack title and actions ───────────────────── */
@media (max-width: 767px) {
  .cf-page-header {
    display: flex; flex-direction: column;
    align-items: flex-start; gap: 10px;
    margin-bottom: 16px;
  }
  .cf-page-title { font-size: 19px; font-family: "Chakra Petch", sans-serif;}
}

/* ── 7. Stat tiles — 2-col on mobile, 3-col on tablet ──────────── */
@media (max-width: 767px) {
  .cf-stats { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .cf-stat { padding: 14px 14px; }
  .cf-stat-val { font-size: 22px; }
}
@media (max-width: 360px) {
  .cf-stats { grid-template-columns: 1fr !important; }
}

/* ── 8. Cards — tighter padding on mobile ───────────────────────── */
@media (max-width: 767px) {
  .cf-card-header { padding: 12px 16px; }
  .cf-card-body   { padding: 14px 16px; }
  .cf-card-title  { font-size: 13px; }
}

/* ── 9. Tabs — horizontal scroll, no wrapping ───────────────────── */
@media (max-width: 767px) {
  .cf-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 2px;
  }
  .cf-tabs::-webkit-scrollbar { display: none; }
  .cf-tab { white-space: nowrap; flex-shrink: 0; padding: 8px 14px; font-size: 12px; }
}

/* ── 10. Appointment list cards on mobile ───────────────────────── */
@media (max-width: 767px) {
  .cf-appt-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
  }
  .cf-appt-card .cf-avatar-lg { width: 40px; height: 40px; font-size: 14px; }
  .cf-list-item-body { width: 100%; }
}

/* ── 11. Filter chips — scroll on mobile ────────────────────────── */
@media (max-width: 767px) {
  .cf-filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .cf-filter-chips::-webkit-scrollbar { display: none; }
  .cf-chip { flex-shrink: 0; }
}

/* ── 12. Slot grid — center + wrap on mobile ────────────────────── */
@media (max-width: 767px) {
  .cf-slots { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .cf-slot  { padding: 10px 16px; font-size: 14px; min-height: 42px; }
}

/* ── 13. Calendar — full width on mobile ────────────────────────── */
@media (max-width: 767px) {
  .cf-cal { width: 100%; }
  .cf-cal-day { padding: 8px 2px; font-size: 13px; }
  .cf-cal-hdr { font-size: 11px; }
  .cf-cal-month { font-size: 15px; }
}

/* Patient booking date/time picker — fit the calendar and slot buttons on phones. */
@media (max-width: 767px) {
  #book-form > .cf-grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #book-form #slot-panel {
    width: 100%;
    min-width: 0;
    scroll-margin-top: calc(var(--topbar-h) + 12px);
  }

  #book-form #slot-panel > .cf-card,
  #book-form #slot-panel .cf-card-body,
  #book-form #book-cal {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #book-form #book-cal .cf-cal-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
  }

  #book-form #book-cal .cf-cal-hdr {
    min-width: 0;
    padding: 4px 0;
  }

  #book-form #book-cal .cf-cal-day {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    min-height: 40px;
    padding: 0;
  }

  #book-form #book-cal .cf-cal-day.has::after {
    bottom: 4px;
  }

  #book-form #slots-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #book-form #slots-grid .cf-slot {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    box-sizing: border-box;
    padding: 10px 8px;
    white-space: normal;
  }
}

@media (max-width: 360px) {
  #book-form #slots-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── 14. Overview page stat tiles (5-col) ───────────────────────── */
@media (max-width: 767px) {
  .ov-stats { grid-template-columns: 1fr 1fr !important; }
  .ov-grid  { grid-template-columns: 1fr !important; }
  .ov-hero  { padding: 18px 16px; }
  .ov-hero-name { font-size: 18px; }
  .ov-hero-actions { gap: 6px; }
  .ov-hero-btn { padding: 7px 12px; font-size: 11px; }
}
@media (max-width: 360px) {
  .ov-stats { grid-template-columns: 1fr !important; }
}

/* ── 15. Doctor/patient profile — stack columns ─────────────────── */
@media (max-width: 767px) {
  .cf-grid-2 { grid-template-columns: 1fr !important; gap: 12px; }
  .cf-grid-3 { grid-template-columns: 1fr !important; gap: 12px; }
}

/* ── 16. Login box — full width on mobile ───────────────────────── */
@media (max-width: 480px) {
  .cf-login-wrap { padding: 16px; }
  .cf-login-box  { padding: 24px 18px; width: 100%; }
  .cf-login-title { font-size: 20px; }
}

/* ── 17. Toast — full width on mobile ───────────────────────────── */
@media (max-width: 767px) {
  .cf-toast {
    left: 12px !important; right: 12px !important;
    bottom: 12px !important;
    width: auto !important;
    text-align: center;
  }
}

/* ── 18. Hero section on patient/doctor pages ───────────────────── */
@media (max-width: 767px) {
  .cf-hero { padding: 16px 18px; border-radius: var(--r-md); margin-bottom: 16px; }
  .cf-hero-title { font-size: 17px; }
  .cf-hero-sub   { font-size: 12px; }
}

/* ── 19. Prescription view — vitals strip wraps ─────────────────── */
@media (max-width: 767px) {
  #rx-view [style*="display:flex"][style*="gap:6px"] { flex-wrap: wrap; gap: 8px !important; }
  .cf-rx-vitals-bar { flex-wrap: wrap; font-size: 12px; }
}

/* ── 20. Booking page on patient portal ─────────────────────────── */
@media (max-width: 767px) {
  #slot-panel { margin-top: 12px; }
  .cf-list { gap: 10px; }
}

/* ── 21. Availability page calendar grid ────────────────────────── */
@media (max-width: 767px) {
  .avail-grid { grid-template-columns: 1fr !important; gap: 14px; }
}

/* ── 22. Topbar logout button — icon only on mobile ─────────────── */
@media (max-width: 480px) {
  a[href*="logout"] span { display: none; }
  a[href*="logout"] { padding: 6px 10px; }
}

/* ── 23. Swipe-friendly sidebar close gesture hint ──────────────── */
@media (max-width: 767px) {
  .cf-sidebar.open::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -4px;
    width: 4px;
    height: 40px;
    background: var(--border-2);
    border-radius: 2px;
    transform: translateY(-50%);
    opacity: .5;
  }
}

/* ── 24. Main content — no padding bleed on mobile ──────────────── */
@media (max-width: 480px) {
  .cf-main { padding: 12px; }
}
