:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, .10);
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);

  --primary: #2563eb;
  --primary-2:#1d4ed8;

  --danger:#ef4444;
  --ok:#16a34a;
  --warn:#f59e0b;

  --radius: 18px;
}

/* --- SILK UI UPGRADE --- */
@view-transition { navigation: auto; }

*{ box-sizing:border-box; transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% 0%, rgba(37,99,235,.12), transparent 55%),
              radial-gradient(900px 500px at 90% 10%, rgba(16,185,129,.10), transparent 55%),
              var(--bg);
}

/* Links */
a{ color: inherit; }
.link{ color: var(--primary); text-decoration: none; font-weight: 500; }
.link:hover{ text-decoration: underline; }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  text-decoration:none;
  cursor:pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.btn:hover{ 
  border-color: rgba(37,99,235,.35); 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.1);
}
.btn:active{ transform: translateY(0); }

.btn.primary{
  background: linear-gradient(135deg, var(--primary), #22c55e);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(37,99,235,.2);
}
.btn.primary:hover{ 
  filter: brightness(1.05); 
  box-shadow: 0 12px 25px rgba(37,99,235,.3);
  transform: translateY(-2px);
}
.btn.small{ padding:8px 10px; border-radius:12px; font-size: 13px; }

/* Inputs */
.input, input, select, textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  outline:none;
  background: rgba(255,255,255,.8);
}
.input:focus, input:focus, select:focus, textarea:focus{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}
label{ font-size:13px; color: var(--muted); }

/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius:999px;
  font-size:12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.75);
}
.pill.ok{ border-color: rgba(22,163,74,.28); color: #166534; background: rgba(22,163,74,.10); }
.pill.warn{ border-color: rgba(245,158,11,.28); color: #92400e; background: rgba(245,158,11,.12); }

/* Logo */
.logo{
  width:44px; height:44px;
  border-radius: 14px;
  display:grid; place-items:center;
  font-weight:800;
  color:white;
  background: linear-gradient(135deg, var(--primary), #22c55e);
  box-shadow: 0 12px 24px rgba(37,99,235,.18);
}

/* Cards */
.card{
  background: rgba(255,255,255,.78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 14px 0;
}
.card-head h3{ margin:0; font-size: 16px; }
.card > *:not(.card-head){ padding: 14px; }
.card > .table-wrap{ padding: 0 14px 14px; }

/* Auth (Login) */
.auth{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  min-height: 100vh;
}
.auth-card{
  width:min(420px, 100%);
  background: rgba(255,255,255,.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.auth-brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom: 14px;
}
.auth-brand h1{ font-size:18px; margin:0; }
.auth-brand p{ margin:2px 0 0; color:var(--muted); font-size:13px; }
.form label{ display:block; margin-top: 10px; }
.form .hint{ margin:12px 0 0; color:var(--muted); font-size:12px; }
.row{
  display:flex;
  gap: 10px;
  align-items:center;
}
.between{ justify-content: space-between; }
.checkbox{ display:flex; gap:8px; align-items:center; color: var(--muted); font-size: 13px; }

/* App Layout */
.app{
  display:flex;
  min-height:100vh;
}

/* Sidebar */
.side{
  width: 260px;
  padding: 16px;
  background: rgba(255,255,255,.70);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.side-head{
  display:flex;
  gap:12px;
  align-items:center;
  padding: 8px 6px 16px;
}
.brand-title{ font-weight:800; letter-spacing:.2px; }
.brand-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.nav-item{
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration:none;
  color: var(--text);
  border: 1px solid transparent;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.nav-item:hover{ background: rgba(37,99,235,.08); }
.nav-item.active{
  background: rgba(37,99,235,.10);
  border-color: rgba(37,99,235,.20);
}
.nav-item.danger{ color: var(--danger); }
.side-foot{ margin-top:auto; padding-top: 14px; }

/* Main */
.main{
  flex:1;
  padding: 18px;
}
.top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.top h2{ margin:0; font-size:22px; }
.muted{ margin:4px 0 0; color: var(--muted); font-size:13px; }
.top-right{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.chip{
  font-size:12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.7);
  padding: 7px 10px;
  border-radius: 999px;
}
.chip.soft{ color: var(--muted); }

/* Dashboard layouts */
.cards{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  margin-bottom: 12px;
}
.stat{ padding: 14px; }
.stat-title{ color: var(--muted); font-size: 13px; }
.stat-value{ font-size: 28px; font-weight: 800; margin-top: 6px; }
.stat-note{ color: var(--muted); font-size: 12px; margin-top: 6px; }

.grid2{
  display:grid;
  grid-template-columns: 1.6fr 1fr;
  gap:12px;
}

/* Tables */
.table-wrap{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 720px; /* scroll on small screens instead of breaking */
}
.table th, .table td{
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
.table th{ color: var(--muted); font-weight: 700; }

/* Filters */
.filters{
  display:grid;
  grid-template-columns: 1.4fr .7fr .9fr;
  gap: 10px;
  padding: 14px;
}

/* Actions list */
.actions{
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding: 14px;
}
.action{
  text-decoration:none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.75);
  border-radius: 16px;
  padding: 14px;
}
.action:hover{
  border-color: rgba(37,99,235,.25);
  box-shadow: 0 10px 25px rgba(15,23,42,.06);
}
.action-title{ font-weight: 800; margin-bottom: 4px; }

/* Forms */
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px;
}
.form-grid .full{ grid-column: 1 / -1; }
.form-actions{
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  padding: 0 14px 14px;
}
.actions-td{ display:flex; gap:10px; }

/* Mobile menu button + overlay */
.menu-btn{
  display:none;
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
}
.overlay{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 40;
}

/* Responsive */
@media (max-width: 1024px){
  .cards{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2{ grid-template-columns: 1fr; }
}

@media (max-width: 768px){
  .app{ display:block; }

  .side{
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-110%);
    transition: transform .25s ease;
    z-index: 50;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
  }
  body.menu-open .side{ transform: translateX(0); }
  body.menu-open .overlay{ display:block; }

  .main{ padding: 14px; min-height: 100vh; }

  .menu-btn{ display:inline-flex; align-items:center; gap:8px; }

  .cards{ grid-template-columns: 1fr; }
  .table{ min-width: 640px; }
  .filters{ grid-template-columns: 1fr; }

  .form-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 420px){
  .logo{ width:40px; height:40px; border-radius: 12px; }
  .top h2{ font-size: 20px; }
}

/* Alerts */
.alert{
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.75);
}
.alert.ok{
  border-color: rgba(22,163,74,.25);
  background: rgba(22,163,74,.08);
  color: #166534;
}
.alert.error{
  border-color: rgba(239,68,68,.25);
  background: rgba(239,68,68,.08);
  color: #991b1b;
}

/* HTMX Indicator */
.htmx-indicator{
  opacity: 0;
  transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator{ opacity: 1; }
.htmx-request.htmx-indicator{ opacity: 1; }

/* Timeline Styles */
.timeline-item::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 40px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }

@media (max-width: 768px){
  .desktop-only{ display:none; }
  .mobile-only{ display:block; }
}

/* Patient card */
.p-card{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.75);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 10px 25px rgba(15,23,42,.06);
}
.p-title{ font-weight: 800; font-size: 16px; }
.p-meta{ display:flex; gap:8px; margin-top: 8px; flex-wrap: wrap; }
.p-actions{ display:flex; gap:10px; margin-top: 12px; flex-wrap: wrap; }

/* View details grid */
.detail-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.detail-grid .full{ grid-column: 1 / -1; }
.detail{ font-weight: 700; margin-top: 4px; }

@media (max-width: 640px){
  .detail-grid{ grid-template-columns: 1fr; }
}

.alert{
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(15, 23, 42, .10);
  background: rgba(255,255,255,.75);
}
.alert.ok{ border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.08); color:#166534; }
.alert.error{ border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.08); color:#991b1b; }

.desktop-only{ display:block; }
.mobile-only{ display:none; }
@media (max-width:768px){ .desktop-only{display:none;} .mobile-only{display:block;} }

.p-card{
  border: 1px solid rgba(15, 23, 42, .10);
  background: rgba(255,255,255,.75);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}
.p-title{ font-weight: 800; font-size: 16px; }
.p-actions{ display:flex; gap:10px; margin-top:12px; flex-wrap:wrap; }

/* ===== Minimalist Dashboard Upgrade ===== */
:root{
  --glass: rgba(255,255,255,.72);
  --glass2: rgba(255,255,255,.55);
}

/* Page container feel */
.main{
  max-width: 1200px;
  margin: 0 auto;
}

/* Header line */
.pagehead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin: 6px 0 14px;
  flex-wrap: wrap;
}
.pagehead h2{
  font-size: 22px;
  letter-spacing: -.2px;
}
.pagehead .subtitle{
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.header-actions{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  align-items:center;
}

/* “Hero” card */
.hero{
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(34,197,94,.10));
  border: 1px solid rgba(15,23,42,.10);
  padding: 16px;
  box-shadow: 0 18px 45px rgba(15,23,42,.06);
}
.hero-inner{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-title{
  font-weight: 800;
  font-size: 16px;
}
.hero-note{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* Stat cards: more minimal */
.stats{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.kpi{
  background: var(--glass);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 14px 35px rgba(15,23,42,.05);
}
.kpi .label{
  color: var(--muted);
  font-size: 12px;
}
.kpi .value{
  font-size: 28px;
  font-weight: 850;
  margin-top: 6px;
  letter-spacing: -.3px;
}
.kpi .hint{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* Two-column section */
.panel-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.panel{
  background: var(--glass);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  box-shadow: 0 14px 35px rgba(15,23,42,.05);
  overflow:hidden;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 14px 14px 10px;
}
.panel-head h3{
  margin:0;
  font-size: 14px;
  letter-spacing: -.1px;
}
.panel-body{
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Quick links: minimal “list buttons” */
.quick{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.q-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.70);
  text-decoration:none;
}
.q-item:hover{
  border-color: rgba(37,99,235,.22);
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
}
.q-left{
  display:flex;
  flex-direction:column;
  gap: 2px;
}
.q-title{
  font-weight: 800;
  color: var(--text);
  font-size: 13px;
}
.q-sub{
  color: var(--muted);
  font-size: 12px;
}
.q-pill{
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.7);
}

/* Responsive */
@media (max-width: 1024px){
  .stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 640px){
  .stats{ grid-template-columns: 1fr; }
  .hero{ padding: 14px; }
}

/* =========================
   Dashboard Mobile Fix Pack
   Paste at END of ui.css
========================= */

/* Keep content from touching edges on phones */
@media (max-width: 768px){
  .main{
    max-width: 100%;
    margin: 0;
    padding: 12px !important;
  }

  /* Header: stack properly */
  .pagehead{
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    margin: 0 0 12px;
  }

  .pagehead h2{
    font-size: 20px;
  }

  /* Pills/actions wrap cleanly */
  .header-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }

  /* Hero: remove wide layout problems */
  .hero{
    padding: 12px;
    border-radius: 18px;
  }

  .hero-inner{
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Buttons become full-width on phones */
  .hero .btn{
    width: 100%;
    justify-content: center;
  }

  /* Stats: single column on small screens */
  .stats{
    grid-template-columns: 1fr !important;
    gap: 10px;
    margin-top: 10px;
  }

  .kpi{
    padding: 12px;
    border-radius: 16px;
  }

  .kpi .value{
    font-size: 24px;
  }

  /* Panels: single column with proper spacing */
  .panel-grid{
    grid-template-columns: 1fr !important;
    gap: 10px;
    margin-top: 10px;
  }

  .panel{
    border-radius: 16px;
  }

  .panel-head{
    padding: 12px 12px 8px;
  }
  .panel-body{
    padding: 0 12px 12px;
    font-size: 13px;
  }

  /* Quick links: bigger tap targets */
  .q-item{
    padding: 12px;
    border-radius: 16px;
  }

  /* Hide the "Open" pill if it crowds */
  .q-item .q-pill{
    display: none;
  }
}

/* Extra small devices */
@media (max-width: 420px){
  .hero-title{ font-size: 15px; }
  .hero-note{ font-size: 12px; }
  .pagehead h2{ font-size: 19px; }
}
body.logged-in .app { display: flex; min-height: 100vh; }
body.logged-in .main { flex: 1; }
@media (max-width: 768px) { body.logged-in .app { display: block; } }


/* ===== 2026 UI Refresh Layer ===== */
:root{
  --bg: #f3f7f6;
  --card: rgba(255,255,255,.86);
  --text: #0e2320;
  --muted: #5e7470;
  --border: rgba(14,35,32,.14);
  --shadow: 0 22px 45px rgba(4, 41, 34, .10);
  --primary: #0b8f78;
  --primary-2: #067a66;
  --danger: #d83e4d;
  --ok: #1f8a44;
  --warn: #c88609;
  --radius: 20px;
}

*{
  font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
}

h1, h2, h3, .brand-title, .hero-title, .stat-value, .kpi .value{
  font-family: "Space Grotesk", "Manrope", "Segoe UI", sans-serif;
}

body{
  color: var(--text);
  background:
    radial-gradient(950px 500px at 0% -10%, rgba(11,143,120,.18), transparent 60%),
    radial-gradient(850px 420px at 100% 0%, rgba(16,148,129,.12), transparent 58%),
    linear-gradient(180deg, #f6faf9 0%, #eef5f3 52%, #f2f8f6 100%);
}

.side{
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(248,255,252,.76));
  border-right: 1px solid rgba(11,143,120,.16);
  box-shadow: 12px 0 28px rgba(5, 51, 42, .06);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.side-head{
  border-bottom: 1px solid rgba(11,143,120,.14);
  margin-bottom: 10px;
}

.logo{
  border-radius: 15px;
  background: linear-gradient(145deg, #089982, #0d6f5f);
  box-shadow: 0 12px 26px rgba(6, 122, 102, .30);
}

.brand-title{
  font-size: 18px;
  letter-spacing: .2px;
}

.brand-sub{
  color: #4f6964;
  font-weight: 600;
}

.nav-item{
  border-radius: 13px;
  padding: 11px 12px;
  font-weight: 600;
}

.nav-item:hover{
  background: rgba(8,153,130,.10);
  border-color: rgba(8,153,130,.20);
}

.nav-item.active{
  background: linear-gradient(90deg, rgba(8,153,130,.20), rgba(8,153,130,.10));
  border-color: rgba(8,153,130,.28);
  box-shadow: inset 4px 0 0 #0b8f78;
}

.main{
  padding: 22px;
}

.pagehead,
.top{
  margin-bottom: 16px;
}

.pagehead h2,
.top h2{
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -.4px;
}

.btn{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(245,252,250,.9));
  border-color: rgba(11,143,120,.20);
  border-radius: 13px;
  font-weight: 700;
}

.btn:hover{
  border-color: rgba(11,143,120,.40);
  box-shadow: 0 10px 20px rgba(6,122,102,.14);
  transform: translateY(-2px);
}

.btn.primary{
  background: linear-gradient(135deg, #0b8f78, #12a38c);
  box-shadow: 0 14px 28px rgba(6,122,102,.32);
}

.btn.primary:hover{
  box-shadow: 0 18px 30px rgba(6,122,102,.38);
}

.card,
.panel,
.kpi,
.auth-card,
.hero,
.p-card,
.action,
.q-item{
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero{
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(11,143,120,.15), rgba(11,143,120,.05));
}

.hero::after{
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -40px;
  top: -40px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(13,111,95,.26), transparent 62%);
}

.kpi .value,
.stat-value{
  font-size: clamp(24px, 2.2vw, 34px);
}

.table{
  min-width: 700px;
}

.table th{
  background: rgba(11,143,120,.08);
  color: #1d5750;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.table tbody tr:nth-child(even){
  background: rgba(11,143,120,.03);
}

.table tbody tr:hover{
  background: rgba(11,143,120,.08);
}

input,
select,
textarea,
.input{
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(11,143,120,.25);
  border-radius: 12px;
  min-height: 42px;
}

input:focus,
select:focus,
textarea:focus,
.input:focus{
  border-color: rgba(11,143,120,.48);
  box-shadow: 0 0 0 4px rgba(11,143,120,.16);
}

.alert{
  border-left: 4px solid rgba(11,143,120,.45);
}

.pill,
.chip,
.q-pill{
  border-color: rgba(11,143,120,.24);
  background: rgba(255,255,255,.9);
}

.card,
.panel,
.kpi,
.hero,
.p-card,
.action{
  animation: riseIn .35s ease both;
}

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

@media (max-width: 1024px){
  .main{
    padding: 16px;
  }
}

@media (max-width: 768px){
  .side{
    position: fixed;
    height: 100vh;
    box-shadow: 0 18px 42px rgba(0,0,0,.20);
  }

  .main{
    padding: 14px;
  }

  .btn,
  .menu-btn{
    min-height: 42px;
  }
}

/* ===== User Pages Upgrade ===== */
.auth-shell{
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 380px at 0% 0%, rgba(11,143,120,.20), transparent 62%),
    radial-gradient(650px 300px at 100% 0%, rgba(10,120,103,.12), transparent 60%),
    linear-gradient(180deg, #f5fbf8, #edf6f3);
}

.auth-wrap{
  width: min(560px, 100%);
}

.brand-banner{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(11,143,120,.20);
  border-radius: 14px;
  box-shadow: 0 12px 22px rgba(5,51,42,.08);
}

.brand-logo{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .05em;
  color: #fff;
  background: linear-gradient(145deg, #0b8f78, #0a6d5d);
}

.brand-copy strong{
  display: block;
  font-size: 14px;
  letter-spacing: .02em;
  color: var(--text);
}

.brand-copy span{
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.auth-card.enhanced{
  width: min(560px, 100%);
  padding: 24px;
  border-radius: 18px;
}

.auth-head h1{
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -.2px;
}

.auth-head p{
  margin: 0 0 18px;
  color: var(--muted);
}

.auth-grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-label{
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #34534e;
}

.password-field-wrap{
  position: relative;
}

.password-field-wrap .input,
.password-field-wrap input{
  padding-right: 74px;
}

.password-toggle{
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.password-toggle:hover{
  color: var(--primary);
}

.auth-help{
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}

.portal-brand{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(11,143,120,.22);
  background: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 700;
  color: #1e6258;
}

.portal-brand .dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(145deg, #0b8f78, #11a28b);
}

@media (max-width: 640px){
  .auth-shell{ padding: 14px; }
  .auth-card.enhanced{ padding: 18px; }
  .auth-grid-2{ grid-template-columns: 1fr; }
}

/* ===== Patient Portal Layout ===== */
.portal-shell{
  min-height: 100vh;
  padding: 18px;
  background:
    radial-gradient(700px 340px at 0% 0%, rgba(11,143,120,.13), transparent 65%),
    radial-gradient(600px 280px at 100% 0%, rgba(10,120,103,.10), transparent 62%),
    linear-gradient(180deg, #f5fbf8, #ecf4f1);
}

.portal-wrap{
  max-width: 980px;
  margin: 0 auto;
}

.portal-brand-head{
  margin: 0 0 12px;
}

.portal-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.portal-title h1{
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
}

.portal-title p{
  margin: 4px 0 0;
  color: var(--muted);
}

.portal-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-card{
  margin-bottom: 14px;
}

.kv{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kv .full{
  grid-column: 1 / -1;
}

.pill.danger{
  border-color: rgba(239,68,68,.30);
  color: #991b1b;
  background: rgba(239,68,68,.10);
}

@media (max-width: 760px){
  .portal-shell{ padding: 14px; }
  .portal-top{ align-items: flex-start; }
  .portal-actions{ width: 100%; }
  .portal-actions .btn{ flex: 1; }
  .kv{ grid-template-columns: 1fr; }
}

/* ===== Index Theme Uniformity ===== */
:root{
  --green: #2E7D32;
  --green-lt: #E8F5E9;
  --green-dk: #1B5E20;
  --gold: #F9A825;
  --bg: #EEF4EF;
  --text: #1C2B2A;
  --muted: #607D8B;
}

body{
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(46,125,50,.14), transparent 62%),
    radial-gradient(900px 420px at 92% -10%, rgba(249,168,37,.10), transparent 60%),
    var(--bg);
}

h1, h2, h3, .serif{
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
}

.site-header{
  background: var(--green-dk);
  padding: 0 1rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(249,168,37,.35);
  box-shadow: 0 2px 16px rgba(0,0,0,.22);
}

.site-logo-area{
  display: flex;
  align-items: center;
  gap: .65rem;
}

.site-logo-seal{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 25%, #ffffff, #d6ead8 80%);
  color: var(--green-dk);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
}

.site-logo-text{
  color: #fff;
}

.site-logo-text strong{
  display: block;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-logo-text span{
  display: block;
  font-size: .67rem;
  opacity: .75;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.site-nav{
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a{
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .8rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  font-weight: 600;
  border: 1px solid transparent;
}

.site-nav a:hover{
  color: #fff;
  background: rgba(255,255,255,.10);
}

.site-nav a.active{
  color: var(--gold);
  border-color: rgba(249,168,37,.50);
  background: rgba(249,168,37,.10);
}

.auth-shell{
  padding: 0;
  background:
    linear-gradient(180deg, rgba(27,94,32,.92), rgba(46,125,50,.90)) top/100% 180px no-repeat,
    var(--bg);
}

.auth-wrap{
  width: min(560px, calc(100% - 24px));
  margin: 18px auto 28px;
}

.brand-banner{
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(46,125,50,.20);
}

.brand-logo{
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: linear-gradient(145deg, #2e7d32, #1b5e20);
}

.auth-card.enhanced,
.card{
  border-radius: 20px;
  box-shadow: 0 8px 34px rgba(27,94,32,.14);
}

.btn.primary{
  background: linear-gradient(135deg, var(--green), var(--green-dk));
}

.portal-shell{
  padding: 0 0 22px;
  background:
    linear-gradient(180deg, rgba(27,94,32,.92), rgba(46,125,50,.90)) top/100% 170px no-repeat,
    var(--bg);
}

.portal-wrap{
  margin-top: 16px;
  width: min(980px, calc(100% - 24px));
}

@media (max-width: 720px){
  .site-header{
    padding: .6rem .75rem;
    align-items: flex-start;
    min-height: 72px;
    flex-direction: column;
  }
  .site-nav{
    width: 100%;
    justify-content: flex-start;
  }
}

.site-logo-seal img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block;}
.brand-logo img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block;}.site-logo-seal img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.brand-logo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ===== Admin Shell Polish ===== */
.logo{
  overflow: hidden;
  border: 2px solid var(--gold);
  background: #ffffff;
}

.logo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.side-head .brand-title{
  font-size: 14px;
  line-height: 1.2;
}

.side-head .brand-sub{
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.main .top,
.main .pagehead{
  border: 1px solid rgba(11,143,120,.20);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 20px rgba(5,51,42,.08);
}

.main .top{
  margin-bottom: 14px;
}
