/*
 * Application-wide styles, compiled by Propshaft.
 * Kept intentionally simple: mobile-first, lightweight, readable on poor connections.
 */

:root {
  --ink: #1a2230;
  --muted: #5b6577;
  --line: #e2e6ee;
  --bg: #f6f8fb;
  --primary: #1f6feb;
  --primary-ink: #ffffff;
  --secondary: #0b7285;
  --alert: #b42318;
  --radius: 12px;
  --maxw: 720px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.main-logo-div {
  text-align: center;
}

.main-logo {
  width: 100%;
}

@media (min-width: 450px) {
  .main-logo {
    width: 30%;
  }
}
/* Home ------------------------------------------------------------------- */
.home__header { text-align: center; margin: 1rem 0 1.5rem; }
.home__title { font-size: 1.9rem; margin: 0 0 .35rem; }
.home__tagline { color: var(--muted); margin: 0 auto; }
.home__prompt { font-size: 1.15rem; margin: 1.5rem 0 1rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card__icon { font-size: 1.6rem; }
.card__title { margin: .4rem 0 .25rem; font-size: 1.2rem; }
.card__body { color: var(--muted); margin: 0 0 1rem; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: .85rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn--primary   { background: var(--primary);   color: var(--primary-ink); }
.btn--secondary { background: #fff; color: var(--secondary); border-color: var(--secondary); }
.btn--alert     { background: #fff; color: var(--alert); border-color: var(--alert); }

/* Incident + safety note ------------------------------------------------- */
.incident {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--alert);
  border-radius: var(--radius);
  background: #fff6f5;
  text-align: center;
}
.incident__prompt { margin: 0 0 .75rem; color: var(--ink); }

.safety-note {
  margin-top: 1.5rem;
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}

/* Placeholder ------------------------------------------------------------ */
.placeholder { text-align: center; }
.placeholder h1 { margin-top: 2rem; }
.placeholder .btn { max-width: 320px; margin: 1rem auto 0; }

/* A little breathing room between buttons when cards stack on wide screens */
@media (min-width: 560px) {
  .cards { grid-template-columns: 1fr; }
}

/* Shared text + layout helpers ------------------------------------------- */
.lead { color: var(--muted); }
.muted { color: var(--muted); font-size: .92rem; }
.back { margin-top: 1.5rem; }
.back a { color: var(--secondary); text-decoration: none; }
.stack { display: grid; gap: .75rem; margin: 1.25rem 0; }
.btn--ghost { background: transparent; color: var(--muted); border-color: var(--line); }

/* Flash messages --------------------------------------------------------- */
.flash {
  max-width: var(--maxw);
  margin: .75rem auto 0;
  padding: .75rem 1rem;
  border-radius: 10px;
  font-size: .95rem;
}
.flash--notice { background: #e7f6ec; color: #1b5e34; }
.flash--alert  { background: #fdecea; color: var(--alert); }

/* Forms ------------------------------------------------------------------ */
.form-page fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem 1.1rem 1.25rem;
  margin: 0 0 1.25rem;
}
.form-page legend { font-weight: 700; padding: 0 .4rem; }

.field { margin: 0 0 .85rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: .65rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.checkbox { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
.checkbox input { width: auto; margin-top: .2rem; }

.errors {
  background: #fdecea;
  border: 1px solid #f3c2bd;
  color: var(--alert);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
}
.errors ul { margin: .5rem 0 0; padding-left: 1.2rem; }

input[type="submit"].btn, .btn[type="submit"] { width: 100%; cursor: pointer; }

/* Confirmation + case ---------------------------------------------------- */
.code {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 1rem;
  margin: .5rem 0 1rem;
}
.confirmation { text-align: center; }
.confirmation__instructions { text-align: left; color: var(--muted); margin: 0 auto 1rem; max-width: 40ch; }

.status__value { font-size: 1.15rem; font-weight: 600; }
.family-case section { margin-bottom: 1.5rem; }
.family-case dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; }
.family-case dt { color: var(--muted); }
.notes ul { list-style: none; padding: 0; }
.notes li { border-top: 1px solid var(--line); padding: .6rem 0; }
.notes__date { display: block; font-size: .8rem; color: var(--muted); }

/* Institutional lists, profile, activity log ----------------------------- */
.case-list { list-style: none; padding: 0; }
.case-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: .8rem 1rem;
  margin-bottom: .6rem;
}
.case-list a { text-decoration: none; color: var(--ink); font-weight: 700; margin-right: .5rem; }
.case-list__meta { display: block; color: var(--muted); font-size: .85rem; margin-top: .2rem; }

.badge {
  display: inline-block;
  font-size: .75rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
}

.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.25rem 0; }
.actions-row .btn { width: auto; }

.timeline { list-style: none; padding: 0; }
.timeline li {
  border-left: 2px solid var(--line);
  padding: .25rem 0 .7rem .85rem;
  margin-left: .3rem;
}
.timeline__when { display: block; font-size: .78rem; color: var(--muted); }
.timeline__what { font-weight: 600; }
.timeline__who { color: var(--secondary); font-size: .85rem; }

/* Matches dashboard ------------------------------------------------------ */
.match-section { margin: 1.5rem 0; }
.match__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.match__score { color: var(--muted); font-size: .9rem; }
.match__sides { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.match__breakdown { margin-top: .6rem; font-size: .9rem; }
.match__breakdown ul { margin: .4rem 0 0; padding-left: 1.1rem; }

.badge--high   { background: #e7f6ec; color: #1b5e34; }
.badge--medium { background: #fff5e6; color: #8a5a00; }
.badge--low    { background: #eef2f7; color: var(--muted); }

/* Review-status badges */
.badge--confirmed { background: #e7f6ec; color: #1b5e34; }  /* green */
.badge--blocked   { background: #fdecea; color: var(--alert); } /* red */
.badge--rejected  { background: #eef2f7; color: var(--muted); } /* grey */

/* Case-status badges (child cases, family requests, found reports) */
.badge--unidentified         { background: #eef2f7; color: var(--muted); }   /* grey */
.badge--open                 { background: #eef2f7; color: var(--muted); }
.badge--submitted            { background: #eef2f7; color: var(--muted); }
.badge--closed               { background: #eef2f7; color: var(--muted); }
.badge--duplicate            { background: #eef2f7; color: var(--muted); }
.badge--potential_match      { background: #fff5e6; color: #8a5a00; }         /* amber */
.badge--under_review         { background: #fff5e6; color: #8a5a00; }
.badge--under_verification   { background: #e7f1fd; color: #1f4f8a; }         /* blue */.badge--reunified            { background: #e7f6ec; color: #1b5e34; }
.badge--linked_to_child_case { background: #e7f6ec; color: #1b5e34; }
.badge--blocked_risk         { background: #fdecea; color: var(--alert); }    /* red */
.badge--dismissed            { background: #fdecea; color: var(--alert); }

/* Compact match rows (secondary lists) */
.compact__sides { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.compact__role { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.compact__badges { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .7rem; }
.compact__badges .btn { width: auto; margin-left: auto; }
@media (max-width: 560px) { .compact__sides { grid-template-columns: 1fr; } }

/* Pre-handover checklist */
.checklist { list-style: none; padding: 0; }
.checklist-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: .8rem 1rem;
  margin-bottom: .6rem;
}
.checklist-item--done { background: #f3faf5; border-color: #cfe8d8; }
.checklist-item__label { font-weight: 600; margin-bottom: .4rem; }
.checklist-item .btn { width: auto; }
.authorize {
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

/* Señas (structured identifying marks) ----------------------------------- */
.senas { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.senas__legend { margin: 0 0 .25rem; }
.mark-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: .75rem;
  margin-bottom: .6rem;
}
.mark-row .btn { width: auto; margin-top: .25rem; }

/* Match review (side-by-side) -------------------------------------------- */
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.review-col {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 1rem;
}
.review-col dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .6rem; margin: 0; }
.review-col dt { color: var(--muted); }
@media (max-width: 560px) { .review-cols { grid-template-columns: 1fr; } }

/* Site footer */
.site-footer {
  max-width: var(--maxw);
  margin: 2.5rem auto 0;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}
.site-footer p { margin: .35rem 0; }
.site-footer a { color: var(--secondary); }

/* Suspicious-report alerts on a case */
.alerts { margin: 1.25rem 0; }
.alerts h2 { color: var(--alert); }
.alert-item {
  border-left: 4px solid var(--alert);
  background: #fff6f5;
  border-radius: 0 8px 8px 0;
  padding: .7rem .9rem;
  margin-bottom: .6rem;
}

/* ---- Photos (private; never shown on public pages) ---- */
.record-photo-wrap { margin: 0 0 1rem; }
.record-photo {
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 360px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
/* Lazy-loaded thumbnail in lists; links to the full-size variant on click */
.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-right: .5rem;
}
.case-list .thumb { float: left; }
