/* ============================================================
   ElderCare Check-In — Family Dashboard
   Design tokens: warm, grounded, calm — this is a safety tool
   for a worried adult child, not a marketing page. Traffic-light
   status: green = recently checked in, amber = approaching the
   alert threshold, brick-red = overdue. Red is reserved ONLY for
   the overdue/urgent state, never used decoratively elsewhere.
   ============================================================ */

:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #22282A;
  --ink-soft: #5B6360;
  --hairline: #DDD8CC;

  --brand: #2B5F5C;
  --brand-dark: #1E4341;
  --good: #4C8C5B;
  --good-soft: #DCEBD3;
  --positive: #C98A3E;
  --positive-soft: #F3E3CC;
  --urgent: #C44536;
  --urgent-soft: #F6DAD5;

  --radius: 10px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--brand-dark);
}

/* ---------- Layout ---------- */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  padding: 40px;
}

.card--narrow {
  max-width: 440px;
  margin: 40px auto;
}

.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--brand-dark);
}

.lede {
  color: var(--ink-soft);
  margin: 0 0 32px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 4px;
  color: var(--brand-dark);
}

.panel-sub {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

/* ---------- Form elements ---------- */

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 18px 0 6px;
  color: var(--ink);
}

.field-label:first-child { margin-top: 0; }

.text-input {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

.text-input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  background: var(--surface);
}

.hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.slider {
  width: 100%;
  accent-color: var(--brand);
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 22px;
}

.btn--primary {
  background: var(--brand);
  color: white;
}

.btn--primary:hover { background: var(--brand-dark); }

.btn--secondary {
  background: var(--positive-soft);
  color: var(--brand-dark);
}

.btn--full { width: 100%; }

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 10px;
}

.error-text {
  color: var(--urgent);
  font-size: 0.85rem;
  margin-top: 10px;
}

/* ---------- Family members list ---------- */

.family-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.family-member-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 6px;
  align-items: center;
}

@media (max-width: 520px) {
  .family-member-row { grid-template-columns: 1fr; }
}

/* ---------- Seniors list & signature check-in strip ---------- */

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--brand);
}

.refresh-icon {
  display: inline-block;
  font-size: 1rem;
  transition: transform 0.5s ease;
}

.refresh-icon.spinning {
  transform: rotate(360deg);
}

.empty-state {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.empty-sub { font-size: 0.82rem; }

.seniors-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.senior-card {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px 18px;
}

.senior-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.senior-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

.status-pill--green {
  background: var(--good-soft);
  color: #2F5C3B;
}

.status-pill--yellow {
  background: var(--positive-soft);
  color: #8A5B1E;
}

.status-pill--overdue {
  background: var(--urgent-soft);
  color: var(--urgent);
}

.senior-card__meta {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin: 6px 0 12px;
}

/* The signature element: a 14-day check-in history strip. Each mark is a
   day; filled amber = checked in, hollow = missed. Encodes something real
   (the actual reliability pattern) rather than decorating. */
.checkin-strip {
  display: flex;
  gap: 4px;
}

.checkin-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--hairline);
}

.checkin-mark--ok { background: var(--positive); }
.checkin-mark--missed { background: var(--urgent-soft); border: 1px solid var(--urgent); }

/* ---------- Past invite codes ---------- */

.invites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

.invite-row__name {
  font-weight: 600;
  font-size: 0.92rem;
  margin-right: 8px;
}

.invite-row__code {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.invite-row__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill--used {
  background: var(--hairline);
  color: var(--ink-soft);
}

/* ---------- Invite result ---------- */

.invite-result {
  margin-top: 8px;
  border-color: var(--brand);
}

.code-display {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--bg);
  border-radius: 8px;
  padding: 18px 24px;
  text-align: center;
  margin: 16px 0;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 960px;
  margin: 40px auto 0;
  padding: 20px 24px 40px;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--hairline);
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--brand);
}
