@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  color-scheme: light;

  /* ── Mellow Consortium brand palette ── */
  --green:       #0078D8;
  --green-dark:  #003C90;
  --green-mid:   #0060C0;
  --green-soft:  #E4F0FC;
  --green-xsoft: #F2F8FE;
  --teal:        #17C3D6;

  --ink:   #111c18;
  --muted: #5a6b64;
  --line:  #dde6e1;
  --paper: #ffffff;
  --wash:  #f3f7f5;
  --card:  #fafcfb;

  --amber:    #D89A17;
  --amber-bg: #FDF2DC;
  --red:      #C62828;
  --red-bg:   #FCE8E8;
  --success:  #2E7D46;
  --success-bg: #E6F4EA;
  --blue:     #0078D8;
  --blue-bg:  #E4F0FC;

  /* typography */
  font-family: 'DM Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size:   15px;
  line-height: 1.5;
  font-feature-settings: 'cv02','cv03','cv04','cv11';

  /* spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(0, 120, 216, 0.92), rgba(0, 60, 144, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='600' viewBox='0 0 900 600'%3E%3Cg fill='none' stroke='rgba(255,255,255,.18)' stroke-width='2'%3E%3Cpath d='M80 490c120-120 260-90 340-210S640 95 820 120'/%3E%3Cpath d='M55 160c105 25 188 80 245 165 61 92 150 143 268 153 83 7 168-5 253-36'/%3E%3Cpath d='M220 55c36 106 39 205 9 297-22 67-22 126 0 177'/%3E%3C/g%3E%3Cg fill='rgba(255,255,255,.18)'%3E%3Ccircle cx='166' cy='438' r='8'/%3E%3Ccircle cx='442' cy='260' r='8'/%3E%3Ccircle cx='704' cy='128' r='8'/%3E%3Ccircle cx='612' cy='480' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 2px 8px rgba(0,120,216,0.32);
  flex-shrink: 0;
}

.auth-panel h1 {
  margin: 18px 0 8px;
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1;
}

.auth-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.login-form,
.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #33413d;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 120, 216, 0.12);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.primary-btn,
.danger-btn,
.soft-btn,
.nav-btn {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.primary-btn {
  color: white;
  background: var(--green);
}
.primary-btn:hover { background: var(--green-mid, #0060C0); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.soft-btn {
  color: var(--green-dark);
  background: var(--green-soft);
}

.ghost-btn {
  color: rgba(255,255,255,0.5);
  background: transparent;
}
.ghost-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
}

.danger-btn {
  color: var(--red);
  background: var(--red-bg);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  display: grid;
  place-items: center;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
  overflow: hidden; /* sidebar stays fixed, workspace scrolls */
}

.sidebar {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative; /* no longer needs sticky — it's in its own scroll column */
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: none;
  background: var(--green-dark);
}

/* Sidebar scrollbar — very subtle */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.doctor-theme .sidebar {
  background: #053f36;
  color: white;
}

.admin-theme .sidebar {
  background: #32124f;
  color: white;
}

.doctor-theme .sidebar .brand-mark {
  background: #0f7d66;
}

.admin-theme .sidebar .brand-mark {
  background: #7a35d8;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.sidebar-brand strong {
  display: block;
  color: #fff;
}

.sidebar-brand span {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-btn {
  justify-content: flex-start;
  color: rgba(255,255,255,0.65);
  background: transparent;
}

.nav-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.14);
  font-weight: 700;
}

/* keep old theme selectors working but they all share the dark style now */
.doctor-theme .nav-btn,
.admin-theme .nav-btn,
.hospital-theme .nav-btn,
.patient-theme .nav-btn {
  color: rgba(255, 255, 255, 0.65);
}

.doctor-theme .nav-btn.active,
.admin-theme .nav-btn.active,
.hospital-theme .nav-btn.active,
.patient-theme .nav-btn.active {
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

/* legacy — keep for compatibility */
.admin-theme .nav-btn.active {
  color: white;
  background: rgba(190, 139, 255, 0.22);
}

.nav-count {
  margin-left: auto;
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: #d63a3a;
  font-size: 11px;
}

/* Sign-out button — matches nav style but with logout accent */
#sign-out {
  margin-top: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
#sign-out:hover {
  background: rgba(220,60,60,0.18);
  color: #ff9999;
}
#sign-out i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 244, 0.92);
  backdrop-filter: blur(12px);
}

#kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 25px;
}

.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.portal-search {
  width: min(300px, 32vw);
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  font-weight: 500;
}

.portal-search input {
  border: 0;
  background: transparent;
  padding: 9px 0;
  box-shadow: none;
}

.notification-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.notification-btn span {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 8px;
  height: 8px;
  display: none; /* shown via JS when unread > 0 */
  border-radius: 50%;
  background: #d63a3a;
}

.doctor-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-weight: 900;
}

#sync-status,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.badge.risk {
  color: var(--red);
  background: var(--red-bg);
}

.badge.info {
  color: var(--blue);
  background: var(--blue-bg);
}

.view {
  padding: 26px 28px 44px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
}

.panel,
.metric,
.row-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3,
.metric h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 16px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.row-list {
  display: grid;
}

.row-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
}

.row-card + .row-card {
  margin-top: 10px;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.row-main {
  min-width: 0;
}

.row-main strong,
.row-main span {
  display: block;
  overflow-wrap: anywhere;
}

.row-main span,
.small-muted {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.patient-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 16px;
}

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

.search-row input {
  max-width: 420px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th,
.report-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.report-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.risk-row.high {
  background: var(--red-bg);
}

.risk-row.moderate {
  background: var(--amber-bg);
}

.risk-row.low {
  background: var(--success-bg);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.message-thread {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.message {
  max-width: 78%;
  padding: 11px 12px;
  border-radius: 8px;
  background: #edf1ee;
}

.message.mine {
  justify-self: end;
  color: white;
  background: var(--green);
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.map-strip {
  min-height: 150px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 120, 216, 0.88), rgba(0, 60, 144, 0.75)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='260' viewBox='0 0 600 260'%3E%3Cg fill='none' stroke='rgba(255,255,255,.28)' stroke-width='2'%3E%3Cpath d='M-20 210C70 130 158 120 244 178s166 62 258-22 150-90 188-72'/%3E%3Cpath d='M10 44c80 34 139 83 177 147M278 18c-10 75 4 147 42 216M450 0c-42 66-63 148-64 246'/%3E%3C/g%3E%3Cg fill='rgba(255,255,255,.55)'%3E%3Ccircle cx='132' cy='135' r='6'/%3E%3Ccircle cx='302' cy='206' r='6'/%3E%3Ccircle cx='475' cy='92' r='6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.bio-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.age-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.age-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.age-card strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
}

.age-card.highlight {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.age-card.highlight span {
  color: rgba(255, 255, 255, 0.78);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebe8;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.admin-theme .progress span {
  background: #7a35d8;
}

.admin-stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trend-chart {
  position: relative;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#eef2ef 1px, transparent 1px),
    linear-gradient(90deg, #eef2ef 1px, transparent 1px);
  background-size: 100% 25%, 20% 100%;
}

.trend-chart span {
  position: absolute;
  inset: 18px;
  border-radius: 8px;
  background-repeat: no-repeat;
}

.trend-chart span:nth-child(1) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 190'%3E%3Cpath d='M5 126 C95 88 152 143 230 92 S374 55 495 34' fill='none' stroke='%237a35d8' stroke-width='7' stroke-linecap='round'/%3E%3C/svg%3E");
}

.trend-chart span:nth-child(2) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 190'%3E%3Cpath d='M5 82 C102 110 171 42 255 72 S390 137 495 95' fill='none' stroke='%23d07a1e' stroke-width='7' stroke-linecap='round'/%3E%3C/svg%3E");
}

.trend-chart span:nth-child(3) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 190'%3E%3Cpath d='M5 150 C96 130 170 127 248 118 S396 76 495 72' fill='none' stroke='%230c6a55' stroke-width='7' stroke-linecap='round'/%3E%3C/svg%3E");
}

.threshold-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.threshold-row input {
  max-width: 260px;
}

.toggle-grid {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch-row span {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: #c7d0cb;
}

.switch-row span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s ease;
}

.switch-row input:checked + span {
  background: #7a35d8;
}

.switch-row input:checked + span::after {
  transform: translateX(22px);
}

.bar-chart {
  height: 220px;
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bar-chart span {
  flex: 1;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #9b63e6, #563078);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 56px);
  color: #87938f;
  font-size: 12px;
  background: #f7f9f7;
}

#footer-admin-link {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: #d5ddd9;
}

.setup-code {
  margin-top: 16px;
  text-align: left;
}

.setup-code pre {
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  color: #dceee8;
  background: #10251f;
}

.setup-code code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell,
  .two-col,
  .patient-layout,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar,
  .view {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar,
  .current-user,
  .search-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .row-card {
    grid-template-columns: auto 1fr;
  }

  .actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.public-site {
  min-height: 100vh;
  background: #fbfcfb;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid rgba(227, 232, 229, 0.82);
  background: rgba(251, 252, 251, 0.92);
  backdrop-filter: blur(14px);
}

.site-brand,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand {
  font-weight: 900;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 26px);
  color: #3c4b47;
  font-size: 14px;
  font-weight: 800;
}

.nav-login {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-soft);
}

.hero-section {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  align-items: center;
  gap: clamp(28px, 6vw, 70px);
  padding: clamp(42px, 7vw, 82px) clamp(18px, 5vw, 56px);
  background:
    linear-gradient(90deg, rgba(251, 252, 251, 0.96), rgba(251, 252, 251, 0.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='760' viewBox='0 0 1200 760'%3E%3Cg fill='none' stroke='%230c6a55' stroke-opacity='.12' stroke-width='2'%3E%3Cpath d='M58 641C216 439 397 438 515 275S821 33 1117 116'/%3E%3Cpath d='M0 203c147 29 254 101 322 216 90 153 250 220 482 201 129-11 260-47 393-108'/%3E%3Cpath d='M318 42c41 174 31 318-31 434-33 62-48 137-43 225'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 640px;
  margin: 22px 0 0;
  color: #4c5a56;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
}

.hero-actions {
  flex-wrap: wrap;
  margin-top: 28px;
}

a.primary-btn,
a.soft-btn {
  width: fit-content;
}

.phone-showcase {
  display: grid;
  place-items: center;
}

.phone-frame {
  width: min(330px, 82vw);
  aspect-ratio: 0.52;
  padding: 18px;
  border: 10px solid #17231f;
  border-radius: 34px;
  background: linear-gradient(180deg, #f8fbf9, #e8f3ed);
  box-shadow: 0 34px 80px rgba(0, 60, 144, 0.18);
}

.phone-top {
  width: 88px;
  height: 8px;
  margin: 0 auto 28px;
  border-radius: 999px;
  background: #23302c;
}

.phone-card {
  padding: 18px;
  border-radius: 8px;
  color: white;
  background: var(--green);
}

.phone-card span,
.phone-card small,
.mini-grid span {
  display: block;
  opacity: 0.78;
  font-size: 12px;
  font-weight: 800;
}

.phone-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 54px;
  line-height: 1;
}

.trend-line {
  height: 106px;
  margin: 18px 0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 120, 216, 0.08), rgba(0, 60, 144, 0.02)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='108' viewBox='0 0 280 108'%3E%3Cpath d='M7 79c42-55 73-24 113-45 45-24 80-14 153-25' fill='none' stroke='%230c6a55' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mini-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mini-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.public-band,
.provider-band,
.login-section {
  padding: clamp(48px, 7vw, 86px) clamp(18px, 5vw, 56px);
}

.provider-band {
  background: #eef5f1;
}

.compact {
  padding-top: clamp(38px, 6vw, 66px);
  padding-bottom: clamp(38px, 6vw, 66px);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.feature-grid,
.provider-layout {
  display: grid;
  gap: 16px;
}

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.feature-card svg,
.check-list svg {
  color: var(--green);
}

.feature-card h3 {
  margin: 18px 0 8px;
  font-size: 20px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.provider-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(22px, 5vw, 54px);
  align-items: center;
}

.portal-preview {
  min-height: 360px;
  display: grid;
  grid-template-columns: 92px 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 24px 60px rgba(0, 60, 144, 0.12);
}

.preview-sidebar {
  background: var(--green-dark);
}

.preview-main {
  padding: 22px;
}

.preview-row,
.preview-stats span {
  display: block;
  border-radius: 8px;
  background: #e8efeb;
}

.preview-row {
  height: 58px;
  margin-top: 14px;
}

.preview-row.wide {
  height: 88px;
  margin-top: 0;
  background: var(--green-soft);
}

.preview-row.short {
  width: 72%;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.preview-stats span {
  height: 78px;
}

.provider-copy {
  display: grid;
  gap: 22px;
}

.check-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  color: #35433f;
  line-height: 1.45;
}

.login-section {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(0, 120, 216, 0.92), rgba(0, 60, 144, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='600' viewBox='0 0 900 600'%3E%3Cg fill='none' stroke='rgba(255,255,255,.18)' stroke-width='2'%3E%3Cpath d='M80 490c120-120 260-90 340-210S640 95 820 120'/%3E%3Cpath d='M55 160c105 25 188 80 245 165 61 92 150 143 268 153 83 7 168-5 253-36'/%3E%3Cpath d='M220 55c36 106 39 205 9 297-22 67-22 126 0 177'/%3E%3C/g%3E%3Cg fill='rgba(255,255,255,.18)'%3E%3Ccircle cx='166' cy='438' r='8'/%3E%3Ccircle cx='442' cy='260' r='8'/%3E%3Ccircle cx='704' cy='128' r='8'/%3E%3Ccircle cx='612' cy='480' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.auth-panel h2 {
  margin: 8px 0;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.05;
}

@media (max-width: 980px) {
  .hero-section,
  .feature-grid,
  .provider-layout {
    grid-template-columns: 1fr;
  }
}

.section-green {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
}
.section-green .eyebrow,
.section-green h2,
.section-green .lead,
.section-green .ca-tag {
  color: #fff;
}
.section-green .ca-tag {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.24);
}

/* ── Hospital theme ──────────────────────────────────────────────── */
.hospital-theme .sidebar {
  background: #0f4f8f;
  color: white;
}
.hospital-theme .sidebar .nav-btn { color: rgba(255,255,255,0.75); }
.hospital-theme .sidebar .nav-btn.active { background: rgba(255,255,255,0.15); color: white; }
.hospital-theme .sidebar .nav-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: white; }
.hospital-theme #role-pill { background: rgba(255,255,255,0.18); color: white; }

/* ── Patient portal theme ────────────────────────────────────────── */
.patient-theme .sidebar {
  background: #0f4f8f;
  color: white;
}
.patient-theme .sidebar .nav-btn { color: rgba(255,255,255,0.75); }
.patient-theme .sidebar .nav-btn.active { background: rgba(255,255,255,0.15); color: white; }
.patient-theme .sidebar .nav-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: white; }
.patient-theme #role-pill { background: rgba(255,255,255,0.18); color: white; }

/* ── Care plan form ──────────────────────────────────────────────── */
#care-plan-form label { font-size: 13px; font-weight: 600; color: #33413d; }
#care-plan-form textarea, #care-plan-form input { margin-top: 4px; font-size: 13px; }

/* ── Recommendation status ───────────────────────────────────────── */
.success-badge { background: var(--green-soft); color: var(--green-dark); }
#rec-push-status { font-size: 13px; color: var(--green-dark); }

/* ── Video consult ───────────────────────────────────────────────── */
.video-room-embed { width: 100%; height: 480px; border: none; border-radius: 8px; background: #111; }

/* ── Admin hospital cards ────────────────────────────────────────── */
.hosp-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--paper); }

/* ── Empty state (ensure defined) ────────────────────────────────── */
.empty-state { padding: 20px 0; color: var(--muted); font-size: 14px; text-align: center; }


/* ── Patient portal additions ──────────────────────────────────── */
.pat-bio-ring { display: flex; flex-direction: column; align-items: center; }

/* trend charts — let canvas fill parent */
canvas { display: block; width: 100% !important; }

/* domain bar last child — no border */
.domain-bar-row:last-child { border-bottom: none; }

/* message row highlight */
[data-read-msg] { cursor: pointer; transition: background .15s; }
[data-read-msg]:hover { background: var(--wash); }

/* expand row in records table */
.report-detail-row td { padding: 12px 14px !important; }

/* Hospital portal additions ────────────────────────────────────── */
#provider-table tbody tr,
#patient-table  tbody tr { transition: background .12s; }

/* Risk bar mini chart */
.risk-bar-row { display: flex; gap: 4px; margin-bottom: 12px; }
.risk-bar-row > div { display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; border-radius: 4px; height: 24px; }

/* Copy button flash */
#copy-hosp-id { transition: background .2s; }

/* Pie chart canvas sizing */
#hosp-risk-chart { max-width: 300px; margin: 0 auto; display: block; }

/* Nav message badge on patient side */
.patient-theme .nav-count { background: var(--green); color: white; }

/* ── Dual login section ──────────────────────────────────────────── */
.dual-login-section {
  padding: clamp(48px, 7vw, 86px) clamp(18px, 5vw, 56px);
  background: linear-gradient(160deg, #f0f7f4 0%, #e8f4f0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dual-login-section::before {
  content: "Patient sign in";
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-dark);
  opacity: 0.7;
}

.dual-login-inner {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 500px;
  justify-content: center;
}

.patient-panel {
  border: 2px solid var(--green);
  box-shadow: 0 8px 32px rgba(0,120,216,0.12);
  width: 100%;
}

.patient-panel h2 {
  color: var(--green-dark);
}

/* ── Patient CTA nav button ──────────────────────────────────────── */
.nav-login.patient-login-btn {
  background: var(--green);
  color: white;
  margin-right: -6px;
}

.nav-login.patient-login-btn:hover {
  background: var(--green-dark);
}

.nav-login.patient-login-btn i {
  margin-right: 4px;
}

/* ── Updated nav for two sign-in buttons ─────────────────────────── */
.site-nav {
  flex-wrap: wrap;
  gap: clamp(8px, 2vw, 20px);
}

/* ── Hospital section green-tinted ──────────────────────────────── */
#hospitals .feature-card {
  border-top: 3px solid var(--green);
}

/* ── Hero updated copy ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .dual-login-inner {
    flex-direction: column;
    align-items: center;
  }
  .patient-panel {
    max-width: 440px;
  }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .hero-section {
    min-height: auto;
  }
  .portal-preview {
    grid-template-columns: 54px 1fr;
  }
}

/* ── Global modal overlay ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 18, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in 0.18s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--paper, #fff);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-slide-up 0.2s ease;
}

@keyframes modal-slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  position: sticky;
  top: 0;
  background: var(--paper, #fff);
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--wash, #f4f7f5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--line); }

.modal-body {
  padding: 16px 24px 24px;
}

/* modal form grid */
.modal-body .form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #18211f);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s;
  font-family: inherit;
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,120,216,0.12);
}
.modal-body textarea { resize: vertical; min-height: 72px; }

.modal-info-box {
  background: #e8f4f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--green-dark, #003C90);
  line-height: 1.5;
}

.modal-info-box.amber {
  background: #fff8e8;
  color: #7a4f10;
}

.modal-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
}

.modal-status {
  font-size: 13px;
  color: var(--green-dark);
  flex: 1;
}
.modal-status.error { color: var(--red, #C62828); }

/* location cards in hospital portal */
.location-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--paper);
  margin-bottom: 10px;
  transition: border-color .15s;
}
.location-card:hover { border-color: var(--green); }
.location-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.location-card-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.location-card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.location-providers {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
/* ── Nearby services map ─────────────────────────────────────────── */
#nearby-results iframe {
  display: block !important;
  min-height: 400px;
  border-radius: 12px;
}

/* ── Clinical trials panel ──────────────────────────────────────── */
.trial-card { border:1px solid var(--line); border-radius:10px; padding:16px; margin-bottom:12px; }

/* ── Notification panel items ───────────────────────────────────── */
[data-notif-id] { cursor: pointer; transition: background .12s; }
[data-notif-id]:hover { background: var(--wash) !important; }

/* ── Sign-out ghost btn fallback (for non-#sign-out ghost btns) ─── */
.sidebar .ghost-btn:not(#sign-out) {
  margin-top: auto;
  color: rgba(255,255,255,0.5);
  background: transparent;
}

/* ── Unified login section ───────────────────────────────────────── */
.unified-login-section {
  padding: clamp(48px, 7vw, 86px) clamp(18px, 5vw, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0,120,216,0.92), rgba(0,60,144,0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='600' viewBox='0 0 900 600'%3E%3Cg fill='none' stroke='rgba(255,255,255,.18)' stroke-width='2'%3E%3Cpath d='M80 490c120-120 260-90 340-210S640 95 820 120'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.unified-panel {
  width: min(480px, 100%);
  padding: 32px;
  border-radius: 14px;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 24px 70px rgba(0,0,0,0.2);
}

/* ── Login tab switcher ─────────────────────────────────────────── */
.login-tabs {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: var(--wash);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s, color .15s;
}
.login-tab:first-child { border-radius: 8px 0 0 8px; }
.login-tab:last-child  { border-radius: 0 8px 8px 0; }
.login-tab.active {
  background: var(--green);
  color: white;
}
.login-tab:not(.active):hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

/* ── Topbar language select ──────────────────────────────────────── */
#topbar-lang-select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: white;
  font-family: inherit;
  cursor: pointer;
  max-width: 110px;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE — Portal app shell + all content grids
   ════════════════════════════════════════════════════════════════════ */

/* ── Tablet: 768px–980px ─────────────────────────────────────────── */
@media (max-width: 980px) {
  /* Sidebar collapses to top nav bar */
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    height: auto;
    min-height: auto;
    overflow: visible;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .sidebar-brand { margin-right: 8px; }
  .nav-list {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    grid-template-columns: unset;
    overflow-x: auto;
  }
  .nav-btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
    white-space: nowrap;
    min-height: 32px;
  }
  #sign-out {
    margin-top: 0;
    width: auto;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 32px;
  }
  #lang-switcher { display: none; } /* use topbar dropdown on tablet */
  .workspace { height: auto; overflow: visible; }

  /* Content grids → single column */
  .stats-grid        { grid-template-columns: repeat(2, 1fr) !important; }
  .admin-stats-grid  { grid-template-columns: repeat(3, 1fr) !important; }
  .two-col           { grid-template-columns: 1fr !important; }
  .patient-layout    { grid-template-columns: 1fr !important; }
  .grid.two-col      { grid-template-columns: 1fr !important; }
}

/* ── Mobile: ≤ 640px ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar { padding: 10px 12px; gap: 4px; }
  .sidebar-brand strong { display: none; } /* show only avatar on mobile */
  .nav-btn { font-size: 11px; padding: 5px 8px; gap: 5px; }
  .nav-btn i { width: 14px; height: 14px; }

  .view { padding: 16px 12px 32px; }
  .topbar { padding: 12px 14px; min-height: 60px; }
  .topbar h2 { font-size: 18px; }
  #kicker { display: none; }
  .portal-search { display: none; } /* hide search on mobile */
  #topbar-lang-select { max-width: 80px; font-size: 11px; }
  #user-name { display: none; }

  .stats-grid       { grid-template-columns: repeat(2, 1fr) !important; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .two-col          { grid-template-columns: 1fr !important; }
  .metric strong    { font-size: 22px; }

  /* Modal full-screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }

  /* Report tables scroll horizontally */
  .report-table-wrap { overflow-x: auto; }
  .report-table { min-width: 560px; }

  /* Panel headers stack */
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .panel-body { padding: 12px; }

  /* Location card on mobile */
  .location-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Form grids → single column on mobile */
  .form-grid > div[style*="grid-template-columns"],
  .modal-body > form > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Bio summary → stacked */
  .bio-summary { grid-template-columns: 1fr !important; }

  /* Actions wrap */
  .actions { justify-content: flex-start; }

  /* Login panel full width */
  .unified-panel { border-radius: 12px; padding: 22px 18px; }
  .login-tab { font-size: 12px; padding: 8px 10px; }
}

/* ── Extra small: ≤ 400px ────────────────────────────────────────── */
@media (max-width: 400px) {
  .nav-btn span { display: none; } /* icon only on tiny screens */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .topbar { gap: 8px; }
}

/* ── Site / marketing pages responsive ───────────────────────────── */
@media (max-width: 760px) {
  .hero-section { grid-template-columns: 1fr; min-height: auto; }
  .phone-showcase { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .provider-layout { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; align-items: center; gap: 10px; text-align: center; }
  .dual-login-inner { flex-direction: column; }
}

/* ── Tables — always scrollable inside panels ────────────────────── */
.panel-body { overflow-x: auto; }
.report-table { min-width: 500px; }

/* ── Overflow protection ─────────────────────────────────────────── */
.view * { max-width: 100%; box-sizing: border-box; }
img, canvas, iframe { max-width: 100%; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════
   UI POLISH — Patient panel, admin sizing, search, general cleanup
   ═══════════════════════════════════════════════════════════════════ */

/* ── Admin panel text sizing ─────────────────────────────────────── */
.admin-theme .metric strong  { font-size: 26px; }
.admin-theme .metric span    { font-size: 11px; letter-spacing:.04em; }
.admin-theme .panel-header h3 { font-size: 14px; font-weight: 700; }
.admin-theme .report-table   { font-size: 12px; }
.admin-theme .row-card       { padding: 10px 12px; }
.admin-theme .row-main strong { font-size: 13px; }
.admin-theme .row-main span   { font-size: 12px; }
.admin-theme .badge          { font-size: 11px; padding: 2px 7px; }

/* ── Patient portal polish ───────────────────────────────────────── */
.patient-theme .panel-header h3 { font-size: 15px; font-weight: 700; }
.patient-theme .metric strong   { font-size: 28px; }
.patient-theme .metric span     { font-size: 11px; }
/* Soft card backgrounds on patient side */
.patient-theme .panel           { border-radius: 12px; }
.patient-theme .panel-header    { background: var(--green-xsoft, #f0faf6); }
/* Recommendation cards */
.patient-theme .rec-card {
  padding: 14px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: var(--green-xsoft,#f0faf6);
  margin-bottom: 8px;
}

/* ── Search bar functional styling ──────────────────────────────── */
.portal-search input:focus {
  outline: none;
  box-shadow: none;
}
/* Search results dropdown */
#search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
}
.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.search-result-item:hover { background: var(--wash); }
.search-result-item:last-child { border-bottom: none; }
.search-result-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--wash);
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Table improvements ──────────────────────────────────────────── */
.report-table tbody tr:hover { background: var(--wash); }
.report-table th { letter-spacing: .04em; }

/* ── Button micro-improvements ───────────────────────────────────── */
.primary-btn:active { transform: translateY(1px); }
.soft-btn:hover     { background: #c8eadb; }

/* ── Nav badge animation on new item ─────────────────────────────── */
.nav-count { animation: pulse-badge .4s ease; }
@keyframes pulse-badge {
  0%   { transform: scale(0.6); opacity:0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity:1; }
}

/* ── Nearby services — tighter clinic cards ──────────────────────── */
.nearby-clinic-card { transition: box-shadow .15s, border-color .15s; }
.nearby-clinic-card:hover {
  border-color: var(--green);
  box-shadow: 0 2px 12px rgba(0,120,216,0.1);
}

/* ── Modal improvements ──────────────────────────────────────────── */
.modal-box { scrollbar-width: thin; }
details > summary { outline: none; }
details[open] > summary {
  background: var(--green-soft);
  color: var(--green-dark);
}

/* ── Language dropdown in topbar ──────────────────────────────────── */
#topbar-lang-select {
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: white;
  font-family: inherit;
  cursor: pointer;
}

/* ── Footer language selector ─────────────────────────────────────── */
.site-footer select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #dde6e1;
  font-size: 12px;
  background: white;
  font-family: inherit;
  cursor: pointer;
}

/* ── Spin keyframe (for loaders) ─────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════ */
:root.dark {
  color-scheme: dark;
  --green:       #2F8FE8;
  --green-dark:  #0A5FB7;
  --green-mid:   #3B98EB;
  --green-soft:  #153A58;
  --green-xsoft: #112A44;
  --teal:        #17C3D6;
  --ink:         #e8f0ec;
  --muted:       #7a9088;
  --line:        #2a3832;
  --paper:       #1a2420;
  --wash:        #141e1b;
  --card:        #1f2b27;
  --amber:       #D89A17;
  --amber-bg:    #2a2010;
  --red:         #C62828;
  --red-bg:      #2a1818;
  --success:     #2E7D46;
  --success-bg:  #1f3b27;
  --blue:        #2F8FE8;
  --blue-bg:     #153A58;
}

:root.dark body                { background: var(--wash); color: var(--ink); }
:root.dark .app-shell          { background: var(--wash); }
:root.dark .panel, :root.dark .metric, :root.dark .row-card,
:root.dark .auth-panel         { background: var(--paper); border-color: var(--line); }
:root.dark input, :root.dark select, :root.dark textarea {
  background: var(--wash); color: var(--ink); border-color: var(--line);
}
:root.dark .topbar             { background: rgba(20,30,27,0.95); border-color: var(--line); }
:root.dark .notification-btn, :root.dark .portal-search { background: var(--paper); border-color: var(--line); }
:root.dark .portal-search input { background: transparent; color: var(--ink); }
:root.dark .modal-box, :root.dark .modal-header { background: var(--paper); }
:root.dark .modal-body input, :root.dark .modal-body select, :root.dark .modal-body textarea {
  background: var(--wash); color: var(--ink);
}
:root.dark .modal-info-box     { background: #153A58; color: #9ad8ff; }
:root.dark .site-header        { background: rgba(20,30,27,0.95); border-color: var(--line); }
:root.dark .public-site        { background: var(--wash); }
:root.dark .feature-card       { background: var(--paper); border-color: var(--line); }
:root.dark .unified-panel      { background: rgba(26,36,32,0.97); }
:root.dark .login-tab:not(.active) { background: var(--wash); color: var(--muted); }
:root.dark .soft-btn           { background: var(--green-soft); color: var(--green-mid); }
:root.dark .report-table th    { color: var(--muted); }
:root.dark .report-table tbody tr:hover { background: var(--wash); }
:root.dark .nav-btn            { color: rgba(255,255,255,0.55); }
:root.dark .nav-btn.active     { background: rgba(255,255,255,0.12); color: #fff; }
:root.dark #topbar-lang-select { background: var(--paper); color: var(--ink); border-color: var(--line); }
:root.dark .empty-state        { color: var(--muted); }
:root.dark .search-result-item { background: var(--paper); }
:root.dark .search-result-item:hover { background: var(--wash); }
:root.dark #search-results-dropdown { background: var(--paper); border-color: var(--line); }

/* Dark mode toggle button */
#dark-mode-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper, white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
#dark-mode-toggle:hover { background: var(--wash); color: var(--ink); }
/* ═══════════════════════════════════════════════════════
   LANDING PAGE IMPROVEMENTS
═══════════════════════════════════════════════════════ */

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--ink);
  align-items: center;
  justify-content: center;
}
@media (max-width: 860px) {
  .mobile-menu-btn { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 12px 20px 20px;
    gap: 4px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  .site-nav.mobile-open { display: flex; }
  .site-nav a { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav-divider { display: none; }
  .site-header { position: relative; }
}
.nav-divider {
  width: 1px; height: 20px;
  background: var(--line);
  margin: 0 4px;
}

/* Hero improvements */
.hero-sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 0 8px;
}
.hero-cta {
  font-size: 15px !important;
  padding: 13px 24px !important;
}
.hero-disclaimer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
}
.hero-disclaimer a { color: var(--green-dark); }

/* Steps section */
.steps-band { background: var(--wash); }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.step-card h3 { font-size: 15px; margin-bottom: 8px; }
.step-card p  { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Section sub-heading */
.section-sub {
  color: var(--muted);
  max-width: 560px;
  margin: 8px auto 0;
  font-size: 15px;
}

/* Section CTA row */
.section-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 36px;
  flex-wrap: wrap;
}

/* Trust section */
.trust-band { background: #f7faf8; }
.trust-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}
@media (max-width: 700px) { .trust-grid { grid-template-columns: 1fr; } }
.trust-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.trust-card i {
  width: 28px; height: 28px;
  color: var(--green-dark);
  margin-bottom: 12px;
  display: block;
}
.trust-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.trust-card p  { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Auth / sign-in improvements */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.auth-brand strong { font-size: 18px; font-weight: 800; }
.auth-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}
.tab-description {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.5;
}
.login-submit-btn { width: 100%; margin-top: 4px; }
.auth-footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.auth-footer-links a { color: var(--green-dark); font-weight: 700; }
.create-account-link {
  background: var(--green-soft);
  padding: 5px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.auth-switch-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
}
.auth-switch-note a { color: var(--green-dark); font-weight: 700; }

/* Footer improvements */
.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.footer-links {
  display: flex;
  gap: 16px;
  font-size: 12px;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-admin-link { opacity: 0.4; }
.footer-admin-link:hover { opacity: 1; }
.lang-select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #dde6e1;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  font-family: inherit;
}

/* Dark mode */
.dark .trust-band { background: #111816; }
.dark .steps-band { background: #111816; }
.dark .step-card,
.dark .trust-card { background: #18211f; }
.dark .lang-select { background: #18211f; color: #fff; border-color: #2a3632; }
.dark .site-nav { background: #0e1a17; }