:root{
  --primary:#2A82C7;
  --aqua:#33BDA5;
  --slate:#4A6572;
  --bg:#F7FAFC;
  --border:#E6EEF5;
  --white:#FFFFFF;
  --purple:#8E74DC;
  --danger:#F5855E;
  --warning:#F7C552;
  --ink:#1f2a37;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.10);
  --shadow-sm: 0 6px 16px rgba(17, 24, 39, 0.08);
  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --tap: 44px;
  --maxw: 1120px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--slate);
  background:
    radial-gradient(900px 500px at 15% 20%, rgba(42,130,199,.14), transparent 55%),
    radial-gradient(900px 500px at 85% 10%, rgba(51,189,165,.12), transparent 55%),
    radial-gradient(900px 600px at 70% 85%, rgba(142,116,220,.08), transparent 60%),
    var(--bg);
}
a{ color: var(--primary); text-decoration:none; font-weight:600; }
a:hover{ text-decoration:underline; }

/* App Layout */
.app{
  min-height:100%;
  display:grid;
  grid-template-rows: auto 1fr auto;
}
.container{
  width:min(var(--maxw), 100%);
  margin: 0 auto;
  padding: 16px;
}

/* Top bar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247,250,252,.70);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(230,238,245,.95);
}
.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 16px;
  width:min(var(--maxw), 100%);
  margin: 0 auto;
}
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}
.mark{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--aqua));
  display:grid;
  place-items:center;
  box-shadow: 0 10px 18px rgba(42,130,199,.16);
  flex: 0 0 auto;
}
.mark svg{ width: 26px; height: 26px; }
.brand h1{
  margin:0;
  font-size: 16px;
  color: var(--ink);
  letter-spacing:.2px;
  line-height:1.1;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.brand small{
  display:block;
  font-size: 12px;
  opacity:.92;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.top-actions{
  display:flex;
  align-items:center;
  gap: 10px;
  flex: 0 0 auto;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.85);
  font-size: 12px;
  color: rgba(74,101,114,.98);
  box-shadow: 0 6px 14px rgba(17,24,39,.05);
  cursor:pointer;
  user-select:none;
}
.chip .dot{
  width: 8px; height:8px; border-radius:50%;
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(51,189,165,.12);
}
.chip strong{ color: var(--ink); font-weight:700; }
.iconbtn{
  width: 40px; height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.85);
  display:grid; place-items:center;
  box-shadow: 0 6px 14px rgba(17,24,39,.05);
  cursor:pointer;
}
.iconbtn svg{ width:18px; height:18px; stroke: var(--slate); }

/* Main grid (desktop) */
.main{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items:start;
}

/* Cards */
.card{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(230,238,245,.95);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-hd{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(230,238,245,.95);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  background: rgba(255,255,255,.70);
}
.card-hd h2{
  margin:0;
  font-size: 14px;
  color: var(--ink);
  letter-spacing:.2px;
}
.muted{
  font-size: 12px;
  opacity:.92;
}

/* KPI row */
.kpis{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px 12px 0 12px;
}
.kpi{
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(230,238,245,.95);
  border-radius: 16px;
  padding: 12px 12px;
  box-shadow: var(--shadow-sm);
  display:flex;
  flex-direction:column;
  gap: 4px;
  min-height: 64px;
}
.kpi strong{
  font-size: 18px;
  color: var(--ink);
  letter-spacing:.2px;
  line-height:1.1;
}
.kpi span{
  font-size: 12px;
  color: rgba(74,101,114,.95);
}

/* Calendar */
.cal-wrap{
  padding: 12px;
}
.cal-nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.seg{
  display:inline-flex;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.85);
  border-radius: 999px;
  overflow:hidden;
  box-shadow: 0 6px 14px rgba(17,24,39,.05);
}
.seg button{
  border:0;
  background: transparent;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(74,101,114,.95);
  cursor:pointer;
}
.seg button.active{
  background: rgba(42,130,199,.12);
  color: var(--ink);
}
.navbtn{
  width: 38px; height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.85);
  display:grid; place-items:center;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(17,24,39,.05);
}
.navbtn svg{ width:18px; height:18px; stroke: var(--slate); }
.month-title{
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing:.2px;
}
.filters{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin-top: 10px;
}
.select{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.85);
  font-size: 12px;
  color: rgba(74,101,114,.98);
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(17,24,39,.05);
  user-select:none;
}
.select .mini{
  width: 8px; height:8px; border-radius:50%;
  background: rgba(74,101,114,.35);
}

/* Month Grid */
.grid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.dow{
  font-size: 11px;
  font-weight: 700;
  color: rgba(74,101,114,.85);
  text-transform: uppercase;
  letter-spacing: .6px;
  text-align:center;
  padding: 6px 0;
}
.day{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(230,238,245,.95);
  border-radius: 16px;
  min-height: 92px;
  padding: 10px;
  display:flex;
  flex-direction:column;
  gap: 8px;
  cursor:pointer;
  position:relative;
  box-shadow: 0 6px 14px rgba(17,24,39,.04);
  transition: transform .05s ease, border-color .15s ease;
}
.day:active{ transform: translateY(1px); }
.day:hover{ border-color: rgba(42,130,199,.35); }
.day .num{
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 0px;
  width: 100%;
  text-align: center;
}
.day .num .day-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--slate);
  opacity: 0.8;
  letter-spacing: 0.5px;
}
.day .num .day-number {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.day .dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  min-height: 20px;
}
.s-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.s-dot.primary { background: var(--primary); }
.s-dot.aqua { background: var(--aqua); }
.s-dot.purple { background: var(--purple); }
.s-dot.canceled { background: var(--slate); opacity: 0.5; }
.day .count {
  font-size: 10px;
  font-weight: 800;
  color: var(--slate);
  margin-left: 2px;
}
.day .tag {
  font-size: 9px;
  font-weight: 800;
  background: rgba(42,130,199,.1);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

.day .dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  min-height: 20px;
}
.s-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.s-dot.primary { background: var(--primary); }
.s-dot.aqua { background: var(--aqua); }
.s-dot.purple { background: var(--purple); }
.s-dot.canceled { background: var(--slate); opacity: 0.5; }
.day .count {
  font-size: 10px;
  font-weight: 800;
  color: var(--slate);
  margin-left: 2px;
}
.day .tag {
  font-size: 9px;
  font-weight: 800;
  background: rgba(42,130,199,.1);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

/* Day View Styling */
.day-grid {
  display: none;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
  border: 1px solid rgba(230,238,245,.95);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: rgba(255,255,255,0.5);
}
.time-slot {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  background: #fff;
}
.time-slot:last-child { border-bottom: none; }
.time-label {
  width: 65px;
  padding: 12px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--slate);
  text-align: center;
  border-right: 1px solid var(--border);
  background: #f9fafb;
  flex-shrink: 0;
}
.time-content {
  flex: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.slot-appt {
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-appt.canceled {
  background: var(--slate);
  opacity: 0.6;
}
.grid.day-view { display: none; }
.day-view-active .day-grid { display: flex; }
.day-view-active .grid { display: none; }
.day-view-active .dow { display: none; }

/* Week View Grid */
.week-grid {
  display: none;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
}
.week-view-active .week-grid { display: grid; }
.week-view-active .grid { display: none; }
.week-view-active .dow { display: none; }
.week-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.4);
  border-radius: var(--r-md);
  padding: 8px;
  border: 1px solid var(--border);
  min-height: 200px;
}
.week-col.today {
  background: rgba(51,189,165,.05);
  border-color: rgba(51,189,165,.30);
}
.week-day-hd { text-align: center; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.week-day-hd strong { font-size: 14px; color: var(--ink); display: block; }
.week-day-hd small { font-size: 10px; text-transform: uppercase; color: var(--slate); font-weight: 700; }
.week-appt-item {
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  margin-bottom: 4px;
}
.week-appt-item.aqua { border-left-color: var(--aqua); }
.week-appt-item time { font-weight: 800; display: block; margin-bottom: 2px; color: var(--ink); }

/* Right panel: Selected day */
.panel{
  position: sticky;
  top: 76px;
}
.panel-body{
  padding: 12px;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px 0 12px;
}
.panel-head .title{
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.panel-head .sub{
  font-size: 12px;
  opacity:.92;
}
.appt-list{
  padding: 10px 12px 12px 12px;
  display:grid;
  gap: 10px;
}
.appt{
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.92);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(17,24,39,.04);
  cursor:pointer;
}
.appt-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.time{
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing:.2px;
  min-width: 62px;
}
.who{
  flex:1;
  min-width:0;
}
.who strong{
  display:block;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.who span{
  display:block;
  font-size: 12px;
  opacity:.92;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.pills{
  display:flex;
  gap: 6px;
  flex-wrap:wrap;
  margin-top: 8px;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing:.2px;
}
.pill.scheduled{ background: var(--primary); }
.pill.ok{ background: var(--aqua); }
.pill.warn{ background: var(--warning); color: #3b3b3b; }
.pill.bad{ background: var(--danger); }
.pill.canceled{ background: var(--slate); opacity: 0.7; }
.pill.ai{ background: var(--purple); }
.pill.self{ background: var(--primary); }
.pill.assistant{ background: var(--slate); }
.pill.doctor{ background: var(--aqua); }
.pill.cash{ background: rgba(51,189,165,.20); color: #124a42; border: 1px solid rgba(51,189,165,.35); }
.pill.ins{ background: rgba(42,130,199,.16); color: #163a5a; border: 1px solid rgba(42,130,199,.28); }
.pill.unpaid{ background: rgba(245,133,94,.15); color: #6c2f24; border: 1px solid rgba(245,133,94,.28); }
.actions{
  display:flex;
  gap: 8px;
  margin-top: 10px;
}
.btn{
  flex:1;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.92);
  color: rgba(74,101,114,.98);
  font-weight: 900;
  font-size: 12px;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(17,24,39,.04);
}
.btn.primary{
  background: linear-gradient(135deg, var(--primary), #1f73b3);
  border: none;
  color:#fff;
  box-shadow: 0 10px 18px rgba(42,130,199,.18);
}
.btn.danger{
  background: rgba(245,133,94,.14);
  border-color: rgba(245,133,94,.32);
  color:#6c2f24;
}

/* Activity card */
.feed{
  padding: 12px;
  display:grid;
  gap: 10px;
}
.event{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(255,255,255,.92);
  box-shadow: 0 6px 14px rgba(17,24,39,.04);
}
.event .ic{
  width: 30px; height: 30px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  flex: 0 0 auto;
  background: rgba(42,130,199,.12);
  border: 1px solid rgba(42,130,199,.18);
}
.event .ic.ai{ background: rgba(142,116,220,.12); border-color: rgba(142,116,220,.18); }
.event .ic.ok{ background: rgba(51,189,165,.12); border-color: rgba(51,189,165,.18); }
.event .ic.bad{ background: rgba(245,133,94,.12); border-color: rgba(245,133,94,.18); }
.event strong{ display:block; font-size: 12px; color: var(--ink); }
.event span{ display:block; font-size: 12px; opacity:.92; line-height:1.35; }
.event small{ display:block; font-size: 11px; opacity:.75; margin-top: 4px; }

/* Floating Add button */
.fab{
  position: fixed;
  right: 16px;
  bottom: 78px; /* above bottom nav */
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, var(--aqua), var(--primary));
  box-shadow: 0 16px 30px rgba(42,130,199,.22);
  cursor:pointer;
  display:grid;
  place-items:center;
  z-index: 40;
}
.fab svg{ width: 22px; height: 22px; stroke: #fff; }

/* Bottom nav (mobile) */
.bottomnav{
  position: sticky;
  bottom: 0;
  z-index: 35;
  background: rgba(255,255,255,.92);
  border-top: 1px solid rgba(230,238,245,.95);
  backdrop-filter: blur(10px);
  display:none;
}
.bottomnav-inner{
  width:min(var(--maxw), 100%);
  margin: 0 auto;
  padding: 10px 12px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.navitem{
  border: 1px solid rgba(230,238,245,.95);
  background: rgba(247,250,252,.75);
  border-radius: 16px;
  height: 44px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  color: rgba(74,101,114,.98);
  cursor:pointer;
  user-select:none;
}
.navitem.active{
  background: rgba(42,130,199,.10);
  border-color: rgba(42,130,199,.22);
  color: var(--ink);
}
.navitem svg{ width:16px; height:16px; stroke: rgba(74,101,114,.95); }
.navitem.active svg{ stroke: var(--primary); }

/* Autocomplete Dropdown */
.ac-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}
.ac-results.open { display: block; }
.ac-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg);
  transition: background 0.2s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--bg); }
.ac-item strong { display: block; font-size: 13px; color: var(--ink); }
.ac-item span { font-size: 11px; color: var(--slate); }

/* Trial & Plan UI */
.trial-banner {
  background: linear-gradient(90deg, #F5855E, #f7ac52);
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  z-index: 100;
}
.trial-banner a { color: white; text-decoration: underline; margin-left: 10px; }

.plan-badge {
  font-size: 9px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 900;
  margin-left: 8px;
  vertical-align: middle;
}
.plan-badge.trial { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.plan-badge.pro { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.plan-badge.free { background: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }
.plan-badge.ambassador { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Powered by footer (always tiny) */
.powered{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 10px;
  display:flex;
  justify-content:center;
  pointer-events:none;
  z-index: 50;
}
.powered .inner{
  pointer-events:auto;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(230,238,245,.95);
  box-shadow: 0 8px 18px rgba(17,24,39,.08);
  backdrop-filter: blur(10px);
}
.powered img{ height: 18px; width:auto; display:block; }
.powered span{
  font-size: 11px;
  color: rgba(74,101,114,.92);
  font-weight: 700;
  letter-spacing:.2px;
}

/* Responsive rules */
@media (max-width: 980px){
  .main{
    grid-template-columns: 1fr;
  }
  .panel{
    position: static;
  }
}
@media (max-width: 760px){
  .kpis{ grid-template-columns: repeat(2, 1fr); padding: 8px; }
  .bottomnav{ display:block; }
  .fab{ bottom: 132px; }
  .brand h1{ max-width: 160px; }
  .brand small{ max-width: 180px; }
  .day{ min-height: 80px; padding: 6px; }
  .day .num .day-label { font-size: 8px; }
  .day .num .day-number { font-size: 14px; }
  .day .dots { gap: 2px; min-height: 16px; }
  .s-dot { width: 5px; height: 5px; }
  .grid { gap: 4px; }
}
@media (max-width: 480px){
  .container{ padding: 8px; }
  .topbar-inner{ padding: 8px 10px; gap: 8px; }
  .mark{ width: 38px; height: 38px; border-radius: 12px; }
  .mark svg { width: 22px; height: 22px; }
  .brand h1 { font-size: 14px; }
  .brand small { font-size: 11px; }
  .chip { display: none; } /* Hide clinic status on very small to save space */
  .top-actions { gap: 6px; }
  .iconbtn { width: 36px; height: 36px; border-radius: 10px; }

  .day .num .day-label { display: none; } /* Numbers only on mobile grid */
  .day .tag { font-size: 8px; padding: 1px 4px; }
  .kpi { padding: 8px; min-height: 54px; }
  .kpi strong { font-size: 15px; }
  .kpi span { font-size: 10px; }

  .time-label { width: 55px; font-size: 10px; padding: 10px 4px; }
  .slot-appt { font-size: 11px; padding: 6px 10px; }

  .cal-nav { flex-direction: column; align-items: stretch; gap: 12px; }
  .seg { width: 100%; display: flex; }
  .seg button { flex: 1; }
}

/* Desktop Navigation */
.d-nav { display: flex; gap: 8px; margin-left: 20px; flex: 1; }
@media (max-width: 760px) { .d-nav { display: none; } }
.d-nav .navitem { height: 38px; padding: 0 16px; border-radius: 12px; font-size: 13px; border: 1px solid transparent; background: transparent; box-shadow: none; }
.d-nav .navitem:hover { background: rgba(0,0,0,0.03); }
.d-nav .navitem.active { background: white; border-color: var(--border); box-shadow: var(--shadow-sm); }

/* Progress tracking: Grey out placeholders that lack logic */
.iconbtn:not(#bell-btn):not(#btn-profile):not(#p-menu-toggle),
.select,
.appt .btn {
  opacity: 0.4;
  filter: grayscale(1);
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}

/* Patients View Styles */
#view-patients { display: none; }
.patients-container { background: rgba(255,255,255,.92); border-radius: var(--r-xl); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; min-height: 600px; }
.view-hd { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: #fff; }
.view-hd h2 { margin: 0; font-size: 18px; color: var(--ink); }
.search-wrap { position: relative; flex: 1; max-width: 400px; }
.search-input { width: 100%; height: 42px; padding: 0 40px 0 16px; border-radius: 12px; border: 1px solid var(--border); background: #f9fafb; font-size: 14px; transition: 0.2s; }
.search-input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(42,130,199,0.05); }
.search-icon { position: absolute; right: 12px; top: 11px; opacity: 0.4; pointer-events: none; }
.table-wrap { overflow-x: auto; }
.p-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.p-table th { padding: 16px; background: #f9fafb; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--slate); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
.p-table td { padding: 16px; border-bottom: 1px solid var(--border); color: var(--ink); vertical-align: middle; }
.p-table tr:hover { background: rgba(42,130,199,0.02); }
.p-info { display: flex; align-items: center; gap: 12px; }
.p-avatar { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--aqua)); color: white; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.p-name { font-weight: 700; color: var(--ink); display: block; }
.p-sub { font-size: 11px; color: var(--slate); opacity: 0.8; }
.p-badge { display: inline-flex; padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: #f3f4f6; color: var(--slate); }

/* Modal Enhancements & Layouts */
.modal.modal-lg { width: min(800px, 98vw); }
.modal.wide { width: min(1100px, 98vw); }

.modal-body.scrollable { flex: 1; overflow-y: auto; padding: 24px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.form-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 15px 0 5px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

/* Patient Ficha Layout */
.ficha-layout { display: flex; flex: 1; min-height: 0; }
.ficha-aside {
  width: 280px;
  background: #f9fafb;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}
.ficha-content { flex: 1; display: flex; flex-direction: column; background: #fff; min-width: 0; }
.ficha-scroll { flex: 1; overflow-y: auto; padding: 20px; }

.history-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.history-card h4 { margin: 0 0 10px 0; font-size: 13px; color: var(--ink); }

.indication-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.indication-item time { font-size: 11px; color: var(--slate); font-weight: 700; }
.indication-item .content { font-size: 13px; margin: 8px 0; line-height: 1.4; color: var(--ink); }

@media (max-width: 760px) {
  .ficha-layout { flex-direction: column; height: auto; }
  .ficha-aside { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}

/* Modal Enhancements & Layouts */
.modal.modal-lg { width: min(800px, 95vw); }
.modal.wide { width: min(1000px, 95vw); }
.modal-body.scrollable { max-height: 80vh; overflow-y: auto; padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 15px 0 5px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

/* Patient Ficha Layout */
.ficha-layout { display: flex; height: 600px; }
.ficha-aside {
  width: 280px;
  background: #f9fafb;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}
.ficha-content { flex: 1; display: flex; flex-direction: column; background: #fff; }
.ficha-scroll { flex: 1; overflow-y: auto; padding: 20px; }

.history-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.history-card h4 { margin: 0 0 10px 0; font-size: 13px; color: var(--ink); }

.indication-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.indication-item time { font-size: 11px; color: var(--slate); font-weight: 700; }
.indication-item .content { font-size: 13px; margin: 8px 0; line-height: 1.4; color: var(--ink); }

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 55, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 16px;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--white);
  width: min(440px, 100%);
  max-height: 95vh;
  border-radius: var(--r-xl);
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-hd { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 16px; color: var(--ink); }
.close-modal { cursor: pointer; opacity: 0.5; transition: 0.2s; }
.close-modal:hover { opacity: 1; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--slate); }
.form-input { width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); font-family: inherit; font-size: 14px; color: var(--ink); }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(42,130,199,0.1); }

/* Profile Tabs */
.tabs-nav { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 16px; font-size: 13px; font-weight: 700; border: none; background: none; color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; transition: 0.2s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Location Cards in Profile */
.loc-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #f9fafb; }
.loc-card-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.availability-row { display: grid; grid-template-columns: 100px 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.insurance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ins-check { display: flex; align-items: center; gap: 8px; font-size: 12px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }

/* Quick Check-in UI */
.bell-wrapper { position: relative; display: flex; align-items: center; }
.flyout {
  position: absolute;
  top: 50px;
  right: 0;
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.flyout.open { display: flex; }
.fly-hd { padding: 12px 16px; background: #f9fafb; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.fly-hd h4 { margin:0; font-size: 13px; color: var(--ink); }
.fly-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.fly-item:last-child { border-bottom: none; }
.fly-info strong { display: block; font-size: 13px; color: var(--ink); line-height: 1.2; }
.fly-info span { font-size: 11px; color: var(--slate); }
.fly-btns { display: flex; gap: 4px; flex-shrink: 0; }
.f-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; display: grid; place-items: center; cursor: pointer;
}
.f-btn.active-chk { background: var(--aqua); border-color: var(--aqua); color: white; }
.f-btn.active-noshow { background: var(--warning); border-color: var(--warning); color: white; }
.f-btn.active-paid { background: var(--primary); border-color: var(--primary); color: white; }
.f-btn svg { width: 14px; height: 14px; stroke-width: 2.5; }
.bell-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid #fff; display:none; }