:root {
  --navy: #2E3559;
  --navy-dark: #232847;
  --gray-text: #9AA0AD;
  --orange: #F5931B;
  --green: #8DCB56;
  --teal: #74CAD6;
  --red: #EE4B20;
  --plum: #67173D;
  --bg: #EDF1F7;
  --card: #FFFFFF;
  --ink: #384156;
  --muted: #7C8598;
  --border: #E1E6EE;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Marketing / logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.5px;
}
.logo .my { color: var(--gray-text); }
.logo .visitor { color: var(--navy); }
.logo svg { display: block; }

.hero {
  text-align: center;
  padding: 64px 20px 40px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}
.hero p.tagline {
  font-size: 18px;
  color: var(--muted);
  max-width: 520px;
  margin: 18px auto 0;
}
.module-icons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 28px 0;
}
.icon-circle {
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  flex: none;
  line-height: 1;
}
.module-icons .icon-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 20px;
}
.btn {
  display: inline-block;
  border: none;
  border-radius: 6px;
  padding: 12px 26px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.96); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 5px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px;
  padding: 40px 0 64px;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 18px;
  text-align: center;
}
.feature .icon-circle { margin: 0 auto 12px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.feature p { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- App shell ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar .wrap {
  max-width: 1180px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.topbar .logo { font-size: 20px; margin-right: 8px; }
.topbar-spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); text-align: right; }
.topbar .who strong { color: var(--ink); display: block; font-size: 14px; }

.tabbar {
  display: flex;
  background: var(--navy);
  border-radius: 8px;
  overflow: hidden;
  flex-wrap: wrap;
}
.tabbar a {
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  text-transform: lowercase;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.92;
}
.tabbar a:hover { text-decoration: none; opacity: 1; }
.tabbar a.active { opacity: 1; }
.tab-home { background: var(--navy); }
.tab-visit { background: var(--orange); }
.tab-needs { background: var(--green); }
.tab-meals { background: var(--teal); }
.tab-message { background: var(--red); }
.tab-give { background: var(--plum); }

.appmain { max-width: 1180px; margin: 24px auto; padding: 0 20px; }
.grid3 {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  gap: 20px;
}
@media (max-width: 860px) {
  .grid3 { grid-template-columns: 1fr; }
}

.grid-team {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 860px) {
  .grid-team { grid-template-columns: 1fr; }
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.field-row > .form-field {
  flex: 1 1 140px;
  min-width: 140px;
}

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

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.page-header h1 { flex: 1 1 auto; margin: 0; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1px;
}
.table-scroll table.simple { min-width: 540px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2, .card h3 { margin-top: 0; color: var(--navy); }

.patient-card img.avatar {
  width: 100%;
  max-width: 160px;
  border-radius: 8px;
  object-fit: cover;
  aspect-ratio: 1;
}
.patient-card h3 { margin: 12px 0 2px; }
.patient-card .meta { font-size: 13px; color: var(--muted); line-height: 1.6; }

.hospital-photo {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
}
.hospital-photo-empty {
  background: var(--bg);
  border: 1px dashed var(--border);
}

.photo-frame {
  position: relative;
  display: block;
}
.photo-edit-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.photo-frame-wide .photo-edit-btn { bottom: 16px; }
.photo-edit-btn:hover { filter: brightness(1.1); }
.photo-edit-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.sidebar-stats .stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-stats .stat-row:last-of-type { border-bottom: none; }
.stat-icon {
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; flex-shrink: 0;
}
.stat-row .num { font-weight: 700; color: var(--navy); }
.stat-row .label { color: var(--muted); font-size: 13px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid var(--border); padding: 8px 6px;
}
table.simple td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; color: #fff;
}
.badge-open { background: var(--green); }
.badge-booked { background: var(--navy); }
.badge-blocked { background: var(--red); }
.badge-done { background: var(--muted); }
.badge-claimed { background: var(--orange); }

.msg { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.msg .msg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.msg .who strong { display: block; font-size: 14px; color: var(--navy); }
.msg .who span { font-size: 12px; color: var(--muted); }
.msg .body { font-size: 14px; line-height: 1.5; }
.msg .actions { margin-top: 8px; display: flex; gap: 8px; }

.form-field { margin-bottom: 14px; }
.form-field > label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.form-field input:not([type="checkbox"]):not([type="radio"]), .form-field textarea, .form-field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; font-family: inherit;
}
.form-field input[type="checkbox"], .form-field input[type="radio"] {
  width: auto; flex: none;
}
.form-field textarea { resize: vertical; }
.auth-card { max-width: 380px; margin: 60px auto; }
.auth-card h1 { text-align: center; font-size: 20px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.flash-error {
  background: #FDEAEA; color: #B4231C; border: 1px solid #F3C2C0;
  padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px;
}
.flash-ok {
  background: #EEF9E9; color: #3F7D20; border: 1px solid #CBEAB8;
  padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px;
}
.progress-outer {
  background: var(--border); border-radius: 20px; height: 14px; overflow: hidden;
}
.progress-inner { background: var(--plum); height: 100%; }
.checklist label {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.footer-note {
  text-align: center; font-size: 12px; color: var(--muted); margin: 40px 0 20px;
}
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.demo-banner {
  background: #FFF7E6; border: 1px solid #F3DDA4; color: #8A6116;
  font-size: 12.5px; padding: 8px 14px; border-radius: 6px; margin-bottom: 16px;
}
