/* ============================================================
   نیکی هلث v0.1 — mobile-first, FA-first design system
   Palette: calm teal + warm neutrals. No external assets.
   ============================================================ */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}

:root {
  --ink: #1c2523;
  --ink-2: #5b6a66;
  --ink-3: #8b9894;
  --bg: #f4f6f4;
  --card: #ffffff;
  --line: #e3e8e5;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --brand-soft: #e6f4f2;
  --accent: #b45309;
  --accent-soft: #fdf1e3;
  --ok: #15803d;
  --ok-soft: #e8f5ec;
  --warn: #b45309;
  --warn-soft: #fdf1e3;
  --no: #b91c1c;
  --no-soft: #fdecec;
  --violet: #6d28d9;
  --violet-soft: #f1ecfb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 37, 35, .05), 0 4px 16px rgba(28, 37, 35, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
  padding-bottom: 76px; /* bottom nav space */
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
img { max-width: 100%; }

/* ---------- layout ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 12px 14px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card > h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- header ---------- */
header.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.brand { font-weight: 700; color: var(--brand); font-size: 1.05rem; white-space: nowrap; }
.brand .muted { font-weight: 400; font-size: .8rem; }
header .sp { flex: 1; }
header a { color: var(--ink-2); font-size: .85rem; white-space: nowrap; }

/* ---------- bottom nav (mobile-first) ---------- */
nav.bottom {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
}
nav.bottom a {
  flex: 1; text-align: center; color: var(--ink-3);
  font-size: .68rem; padding: 6px 2px 4px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none;
}
nav.bottom a .ico { font-size: 1.25rem; line-height: 1.2; }
nav.bottom a.active, nav.bottom a:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }

/* ---------- badges & pills ---------- */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 500;
  padding: 2px 10px; border-radius: 999px; vertical-align: middle;
  border: 1px solid transparent;
}
.badge.ok   { background: var(--ok-soft);   color: var(--ok); }
.badge.no   { background: var(--no-soft);   color: var(--no); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.role { background: var(--brand-soft); color: var(--brand); }
.badge.sig  { background: var(--violet-soft); color: var(--violet); }
.badge.ghostb { background: #f1f3f1; color: var(--ink-2); }
.pill {
  display: inline-block; font-size: .72rem; background: #f1f3f1;
  color: var(--ink-2); border-radius: 8px; padding: 1px 8px; margin: 1px;
}
.pill.src { background: var(--brand-soft); color: var(--brand); }

/* ---------- banner ---------- */
.banner {
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid #f3ddc2; border-radius: 10px;
  padding: 8px 12px; font-size: .82rem; margin-bottom: 12px;
}
.banner.info { background: var(--brand-soft); color: var(--brand); border-color: #cfe8e5; }
.banner.danger { background: var(--no-soft); color: var(--no); border-color: #f5caca; }

/* ---------- forms ---------- */
input, select, textarea, button {
  font-family: inherit; font-size: .9rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: #fbfcfb; max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2);
}
textarea { width: 100%; min-height: 72px; resize: vertical; }
label { font-size: .8rem; color: var(--ink-2); }
button, .btn {
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  font-weight: 500; padding: 9px 18px; border-radius: 10px;
  transition: background .15s;
  display: inline-block; text-align: center;
}
button:hover, .btn:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
button.ghost, .btn.ghost {
  background: transparent; color: var(--brand);
  border: 1px solid var(--brand);
}
button.ghost:hover { background: var(--brand-soft); }
button.danger { background: var(--no); }
button.danger:hover { background: #dc2626; }
form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.row > * { flex: 1 1 130px; min-width: 0; }
.row > button { flex: 0 0 auto; }

/* photo-first camera button */
.camera-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 16px; border: 2px dashed var(--brand-2);
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--radius); font-weight: 700; cursor: pointer;
  font-size: 1rem;
}
.camera-btn input { display: none; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-3); font-weight: 500; font-size: .75rem; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* ---------- tiles / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
.tile {
  background: var(--brand-soft); border-radius: 12px; text-align: center;
  padding: 12px 6px; font-size: .75rem; color: var(--ink-2);
}
.tile b { display: block; font-size: 1.3rem; color: var(--brand); }

/* library cards */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lib-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.lib-card .thumb-box {
  aspect-ratio: 4/3; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; overflow: hidden;
}
.lib-card .thumb-box img { width: 100%; height: 100%; object-fit: cover; }
.lib-card .body { padding: 8px 10px 10px; }
.lib-card .name { font-weight: 700; font-size: .88rem; }
.lib-card .meta { font-size: .7rem; color: var(--ink-3); }

.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.kind-card {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); font-weight: 500;
}
.kind-card:hover { border-color: var(--brand-2); text-decoration: none; }
.kind-card .ico { font-size: 1.5rem; }
.kind-card .cnt { margin-inline-start: auto; color: var(--ink-3); font-size: .8rem; }

/* quick actions (participant home) */
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 8px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink); font-weight: 500; font-size: .88rem; text-align: center;
}
.quick .ico { font-size: 1.7rem; }
.quick:hover { border-color: var(--brand-2); text-decoration: none; }

/* ---------- tabs (in-page anchors) ---------- */
nav.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  flex: 0 0 auto; font-size: .8rem; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line);
  padding: 5px 14px; border-radius: 999px; white-space: nowrap;
}
nav.tabs a:hover { color: var(--brand); border-color: var(--brand-2); text-decoration: none; }

/* ---------- misc ---------- */
.muted { color: var(--ink-3); font-size: .8rem; }
.thumb { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; vertical-align: middle; }
details summary { cursor: pointer; color: var(--brand); font-size: .88rem; padding: 4px 0; }
details[open] summary { margin-bottom: 6px; }
.status-needs_review { color: var(--no); }
.status-waiting_doctor { color: var(--warn); }
.status-waiting_user { color: var(--brand); }
.status-completed { color: var(--ok); }
hr.soft { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

.consent-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.consent-row:last-child { border-bottom: none; }
.consent-row .t { flex: 1 1 200px; font-size: .9rem; }

.footer-note { color: var(--ink-3); font-size: .74rem; margin-top: 28px; text-align: center; }

@media (min-width: 700px) {
  body { font-size: 15.5px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
}
