/* Khoji — deliberately small, no framework, no webfonts.
   Every kilobyte here is a kilobyte someone on a congested mobile tower in
   Rasuwa has to wait for. Keep it that way. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dcdfe5;
  --text: #16191f;
  --muted: #5c6470;
  --brand: #16457a;
  --brand-dark: #0f2f54;
  --missing: #b3261e;
  --missing-bg: #fdecea;
  --safe: #1f6b3a;
  --safe-bg: #e8f5ec;
  --injured: #8a5300;
  --injured-bg: #fdf2e2;
  --dead: #43474d;
  --dead-bg: #eceef1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Devanagari", "Mukta", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 14px; }

/* ------------------------------------------------------------------ header */

header {
  background: var(--brand);
  color: #fff;
  padding: 14px 0 0;
}

.head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand h1 { font-size: 1.2rem; margin: 0; font-weight: 700; letter-spacing: .1px; }
.brand p { margin: 2px 0 0; font-size: .82rem; opacity: .85; }

.lang-toggle {
  flex: none;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.lang-toggle:hover { background: rgba(255, 255, 255, .24); }

nav {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }

nav button {
  flex: none;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, .78);
  font: inherit;
  font-size: .92rem;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
}
nav button[aria-selected="true"] {
  color: #fff;
  font-weight: 600;
  border-bottom-color: #fff;
}

/* ------------------------------------------------------------------ notice */

.notice {
  background: #fff8e1;
  border-bottom: 1px solid #f0e0ae;
  color: #6b4e00;
  font-size: .84rem;
  padding: 9px 0;
}
.notice strong { color: #4a3600; }

/* ------------------------------------------------------------------- panel */

main { padding: 18px 0 60px; }
.panel[hidden] { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

h2 { font-size: 1.05rem; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: .87rem; margin: 0 0 14px; }

/* ------------------------------------------------------------------- forms */

.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #2c323b;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }

input[type="text"], input[type="tel"], input[type="number"],
input[type="date"], input[type="email"], input[type="password"],
select, textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #c3c8d1;
  border-radius: 8px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS Safari zooming on focus */
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
textarea { min-height: 84px; resize: vertical; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; min-width: 0; }

button.primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: var(--brand-dark); }
button.primary:disabled { opacity: .55; cursor: default; }

button.ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid #c3c8d1;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: .87rem;
  cursor: pointer;
}
button.ghost:hover { background: #f0f3f7; }

button.link {
  background: none; border: 0; padding: 0;
  color: var(--brand); font: inherit; font-size: .83rem;
  text-decoration: underline; cursor: pointer;
}

/* ------------------------------------------------------------------ photos */

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.thumbs:empty { display: none; }

.thumb-item { position: relative; }
.thumb-item img {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); background: #eceef1; display: block;
}
.thumb-item button {
  position: absolute; top: -6px; inset-inline-end: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid #fff; background: var(--missing); color: #fff;
  font-size: .8rem; line-height: 1; cursor: pointer; padding: 0;
}

input[type="file"] { font-size: .9rem; max-width: 100%; }

.progress {
  height: 6px; background: #e4e7ec; border-radius: 999px;
  overflow: hidden; margin-top: 10px;
}
.progress[hidden] { display: none; }
.progress .bar {
  height: 100%; width: 0%; background: var(--brand);
  transition: width .2s ease;
}

/* Possible-duplicate warning on the report form */

.dup-panel {
  background: #fff8e1;
  border: 1px solid #f0e0ae;
  border-radius: var(--radius);
  padding: 13px;
  margin-bottom: 14px;
}
.dup-panel[hidden] { display: none; }
.dup-head { margin: 0 0 3px; font-weight: 700; font-size: .92rem; color: #6b4e00; }
.dup-sub { margin: 0 0 11px; font-size: .83rem; color: #7a5f1a; }

.dup-item {
  display: flex;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px;
}
.dup-item + .dup-item { margin-top: 8px; }
.dup-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.dup-actions button { font-size: .83rem; padding: 7px 12px; }

.dup-linked {
  background: var(--safe-bg);
  border: 1px solid #bcdcc7;
  color: #17492a;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: .88rem;
}
.dup-linked[hidden] { display: none; }
.dup-linked .link { color: #17492a; margin-inline-start: 8px; }

/* Merged reports inside a person's detail view */
.merged { border-inline-start: 3px solid var(--brand); padding-inline-start: 11px; }

/* Detail-view gallery */
.gallery { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.gallery a { display: block; }
.gallery img {
  height: 132px; max-width: 100%; border-radius: 8px;
  object-fit: cover; background: #eceef1; border: 1px solid var(--border);
}

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

.results { display: grid; gap: 11px; }

.person {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px;
  cursor: pointer;
  text-align: start;
  width: 100%;
  font: inherit;
  color: inherit;
}
.person:hover { border-color: #a9b2bf; }

.avatar {
  width: 56px; height: 56px; flex: none;
  border-radius: 8px; object-fit: cover;
  background: #e4e7ec;
  display: grid; place-items: center;
  color: #8b93a1; font-size: 1.25rem; font-weight: 600;
}

.person-body { min-width: 0; flex: 1; }
.person-name {
  font-weight: 700; font-size: 1rem; margin: 0 0 2px;
  overflow-wrap: anywhere;
}
.person-meta { color: var(--muted); font-size: .85rem; margin: 0; }

.badge {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-inline-start: 6px;
  vertical-align: 2px;
  white-space: nowrap;
}
.b-missing { background: var(--missing-bg); color: var(--missing); }
.b-found_safe { background: var(--safe-bg); color: var(--safe); }
.b-found_injured { background: var(--injured-bg); color: var(--injured); }
.b-deceased { background: var(--dead-bg); color: var(--dead); }
.b-verified { background: #e6f0fb; color: var(--brand); }
.b-flagged { background: var(--missing-bg); color: var(--missing); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}

.count { color: var(--muted); font-size: .84rem; margin: 0 0 10px; }

/* ------------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 24, 40, .55);
  display: grid; place-items: end center;
  padding: 0;
}
.modal[hidden] { display: none; }

.modal-inner {
  background: var(--surface);
  width: 100%; max-width: 620px;
  max-height: 92vh; overflow-y: auto;
  border-radius: 14px 14px 0 0;
  padding: 18px 16px 28px;
}
@media (min-width: 620px) {
  .modal { place-items: center; padding: 20px; }
  .modal-inner { border-radius: 14px; }
}

.modal-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.modal-head h3 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.close {
  flex: none; background: #eceef1; border: 0; border-radius: 8px;
  width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer;
  color: #444; line-height: 1;
}

.detail-photo {
  width: 100%; max-height: 300px; object-fit: contain;
  background: #eceef1; border-radius: 8px; margin-bottom: 14px;
}

dl.detail { margin: 0 0 16px; }
dl.detail div {
  display: flex; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid #eef0f3; font-size: .9rem;
}
dl.detail dt { flex: 0 0 40%; color: var(--muted); margin: 0; }
dl.detail dd { flex: 1; margin: 0; overflow-wrap: anywhere; }

.contact-box {
  background: #f0f4f9; border: 1px solid #d5dfeb;
  border-radius: 8px; padding: 12px; margin-bottom: 14px; font-size: .88rem;
}
.scam-warn {
  color: var(--missing); font-size: .8rem; margin: 8px 0 0; line-height: 1.45;
}

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

/* ------------------------------------------------------------------ toasts */

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #16191f; color: #fff; padding: 11px 18px;
  border-radius: 999px; font-size: .88rem; z-index: 90;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); max-width: 90vw; text-align: center;
}
#toast[hidden] { display: none; }
#toast.err { background: var(--missing); }

/* ------------------------------------------------------------------ footer */

footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 34px;
  color: var(--muted);
  font-size: .8rem;
  background: #fff;
}
footer a { color: var(--brand); }

.center { text-align: center; }
.mt { margin-top: 14px; }
