/* =============================================================
 * مراقب کودک من (BabyCare) — style.css
 * Mobile-first، RTL، بدون وابستگی خارجی
 * پالت: فیروزه‌ای نرم #0D9488 | مرجانی SOS #F43F5E | اسلیت ملایم
 * ============================================================= */

:root {
  --teal: #0D9488;
  --teal-dark: #0F766E;
  --teal-soft: #CCFBF1;
  --teal-050: #F0FDFA;
  --coral: #F43F5E;
  --coral-dark: #BE123C;
  --coral-soft: #FFE4E6;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --green: #10B981;
  --green-soft: #D1FAE5;

  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --line-soft: #F1F5F9;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px -12px rgba(15, 23, 42, .25);
  --shadow-lg: 0 18px 45px -20px rgba(15, 23, 42, .45);
  --nav-h: 64px;
  --header-h: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "IRANSans", "Iranian Sans", "Segoe UI",
    system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; overflow-x: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.5; }
p { margin: .35rem 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--teal-dark); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.hidden-input { display: none; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.full { grid-column: 1 / -1; }
.grow { flex: 1 1 auto; }

:focus-visible {
  outline: 3px solid rgba(13, 148, 136, .45);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ================= پوسته برنامه ================= */
.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 26px);
  box-shadow: 0 0 0 1px var(--line);
}

/* ================= هدر ================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  padding: 12px 14px 10px;
  box-shadow: 0 8px 24px -16px rgba(13, 148, 136, .9);
}

.hdr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }

.brand-badge {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  flex: 0 0 auto;
}

.brand-text {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-actions { display: flex; gap: 6px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .28); }
.icon-btn:active { transform: scale(.94); }

.hdr-child {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.child-select {
  flex: 1 1 auto;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, .95) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230F766E' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat left 12px center;
  color: var(--ink);
  border: 0;
  border-radius: 12px;
  padding: 9px 12px 9px 34px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.child-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  font-size: .8rem;
  color: rgba(255, 255, 255, .92);
}
.child-meta .pill {
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 1px 9px;
  font-weight: 600;
}
.child-meta .pill.stage { background: #fff; color: var(--teal-dark); border-color: #fff; }

/* ================= دکمه‌ها ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  background: var(--line);
  color: var(--ink);
  transition: transform .08s ease, filter .15s ease, background .15s ease;
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }
.btn-block { width: 100%; }

.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 8px 18px -12px rgba(13, 148, 136, .9); }
.btn-teal:hover { background: var(--teal-dark); }

.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 8px 18px -12px rgba(244, 63, 94, .9); }
.btn-coral:hover { background: var(--coral-dark); }

.btn-ghost { background: #fff; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal-dark); }

.btn-danger { background: var(--coral); color: #fff; }
.btn-danger:hover { background: var(--coral-dark); }

.btn-danger-ghost { background: #fff; border-color: var(--coral-soft); color: var(--coral); }
.btn-danger-ghost:hover { background: var(--coral-soft); }

/* ================= صفحات ================= */
.main { padding: 14px 14px 8px; }

.page { display: none; animation: fadeUp .22s ease; }
.page.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 2px 12px;
}
.page-head h2 { font-size: 1.15rem; }

/* ================= کارت‌ها ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: .98rem;
  margin-bottom: 10px;
}

.sub-title {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 700;
  margin: 12px 0 6px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 700;
  background: var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge-teal { background: var(--teal-soft); color: var(--teal-dark); }
.badge-coral { background: var(--coral-soft); color: var(--coral-dark); }
.badge-amber { background: var(--amber-soft); color: #B45309; }
.badge-green { background: var(--green-soft); color: #047857; }
.badge-slate { background: #E2E8F0; color: #334155; }

/* ================= هشدارها ================= */
.alerts:empty { display: none; }
.alert {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: .86rem;
  border: 1px solid transparent;
  font-weight: 600;
}
.alert-danger { background: var(--coral-soft); color: var(--coral-dark); border-color: #FDA4AF; }
.alert-warning { background: var(--amber-soft); color: #92400E; border-color: #FDE68A; }
.alert-info { background: var(--teal-050); color: var(--teal-dark); border-color: var(--teal-soft); }

/* ================= کارت مرحله جاری ================= */
.stage-card {
  background: linear-gradient(150deg, #FFFFFF 0%, var(--teal-050) 100%);
  border-color: var(--teal-soft);
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.stage-badge {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--teal-soft);
  font-size: 1.4rem;
  flex: 0 0 auto;
}

.stage-title { font-size: .98rem; }
.stage-range { font-size: .78rem; color: var(--muted); font-weight: 600; }

.stage-tips { margin: 6px 0 4px; }
.stage-tips li {
  position: relative;
  padding: 6px 22px 6px 4px;
  font-size: .87rem;
  border-bottom: 1px dashed var(--line);
}
.stage-tips li:last-child { border-bottom: 0; }
.stage-tips li::before {
  content: "✔";
  position: absolute;
  right: 2px;
  top: 6px;
  color: var(--teal);
  font-weight: 700;
}

.stage-warn {
  background: var(--coral-soft);
  border: 1px solid #FDA4AF;
  color: var(--coral-dark);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: .82rem;
  font-weight: 700;
  margin-top: 8px;
}
.stage-warn ul { margin: 4px 0 0; padding: 0; }
.stage-warn li { padding: 3px 16px 3px 0; position: relative; font-weight: 600; }
.stage-warn li::before { content: "⚠"; position: absolute; right: 0; }

/* ================= آمار داشبورد ================= */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.vital {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  box-shadow: var(--shadow);
}
.vital-label { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; }
.vital strong { display: block; font-size: 1.25rem; color: var(--teal-dark); line-height: 1.4; }
.vital-unit { display: block; font-size: .66rem; color: var(--muted); }

/* ================= چک‌لیست ================= */
.checklist { display: flex; flex-direction: column; gap: 4px; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--line-soft);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s ease;
  font-size: .87rem;
}
.check-item:hover { background: var(--teal-050); }
.check-item.done { background: var(--teal-050); border-color: var(--teal-soft); }
.check-item.done .check-text { color: var(--muted); text-decoration: line-through; }

.check-box {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 2px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: .8rem;
  font-weight: 900;
  margin-top: 1px;
}
.check-item.done .check-box { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ================= فهرست‌ها ================= */
.list { display: flex; flex-direction: column; gap: 8px; }
.list:empty::after,
.recent:empty::after {
  content: "موردی ثبت نشده است.";
  display: block;
  color: var(--muted);
  font-size: .84rem;
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--line-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.list-item:hover { border-color: var(--line); }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-size: .88rem; font-weight: 700; }
.item-sub { font-size: .76rem; color: var(--muted); }
.item-side { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.btn-del {
  border: 0;
  background: transparent;
  color: var(--coral);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.btn-del:hover { background: var(--coral-soft); }

.btn-mini {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal-dark);
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
}
.btn-mini:hover { background: var(--teal-050); border-color: var(--teal-soft); }
.btn-mini.coral { color: var(--coral); }
.btn-mini.coral:hover { background: var(--coral-soft); }

/* ================= آخرین ثبت‌ها ================= */
.recent { display: flex; flex-direction: column; gap: 6px; }
.recent-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .85rem;
  padding: 7px 4px;
  border-bottom: 1px dashed var(--line);
}
.recent-row:last-child { border-bottom: 0; }
.recent-row .k { color: var(--muted); }
.recent-row .v { font-weight: 700; color: var(--ink); }

/* ================= تب‌ها و نمودار ================= */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--line-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 10px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 6px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab.active { background: #fff; color: var(--teal-dark); box-shadow: var(--shadow); }

.chart-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px;
  overflow: hidden;
}
.chart-wrap canvas { display: block; width: 100%; height: 280px; }

/* ================= فرم‌ها ================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid label,
.dose-weight-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
}

input, select, textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink);
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .16);
}
input[readonly] { background: var(--line-soft); color: var(--muted); }
textarea { resize: vertical; min-height: 60px; line-height: 1.7; }
select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat left 10px center;
  padding-left: 32px;
  cursor: pointer;
}

.form-info {
  background: var(--teal-050);
  border: 1px dashed var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .8rem;
  font-weight: 600;
}
.form-info.error { background: var(--coral-soft); border-color: #FDA4AF; color: var(--coral-dark); }
.form-info:empty { display: none; }

/* ================= جدول ================= */
.table-wrap { overflow-x: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 380px; }
.table th, .table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.table th { background: var(--line-soft); color: var(--muted); font-size: .74rem; font-weight: 800; position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--teal-050); }
.table .del { border: 0; background: transparent; color: var(--coral); cursor: pointer; font-weight: 800; }
.table-empty td { color: var(--muted); padding: 16px; }

/* ================= تایم‌لاین واکسن ================= */
.timeline { position: relative; }
.tl-item {
  display: flex;
  gap: 10px;
  position: relative;
  padding-bottom: 12px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  right: 11px;
  top: 24px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }

.tl-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: .7rem;
  font-weight: 900;
  color: var(--muted);
  z-index: 1;
}
.tl-item.done .tl-dot { background: var(--green); border-color: var(--green); color: #fff; }
.tl-item.due .tl-dot { background: var(--coral); border-color: var(--coral); color: #fff; animation: pulse 1.6s infinite; }
.tl-item.upcoming .tl-dot { background: #fff; border-color: var(--teal); color: var(--teal); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, .5); }
  50% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
}

.tl-body { flex: 1 1 auto; min-width: 0; }
.tl-title { font-size: .88rem; font-weight: 700; }
.tl-meta { font-size: .76rem; color: var(--muted); }
.tl-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tl-age {
  display: inline-block;
  background: var(--line-soft);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  margin-left: 6px;
}

/* ================= نقشه مهارت‌ها ================= */
.milestones { display: flex; flex-direction: column; gap: 6px; }
.ms-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--line-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  cursor: pointer;
  font-size: .86rem;
}
.ms-item.done { background: var(--green-soft); border-color: #A7F3D0; }
.ms-item.done .ms-text { color: var(--muted); text-decoration: line-through; }
.ms-box {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: .75rem;
  font-weight: 900;
  margin-top: 2px;
}
.ms-item.done .ms-box { background: var(--green); border-color: var(--green); color: #fff; }
.ms-text { flex: 1; }
.ms-age {
  display: block;
  font-size: .7rem;
  color: var(--muted);
  font-weight: 700;
}

/* ================= محاسبه دوز ================= */
.dose-weight-row { display: flex; gap: 10px; align-items: flex-end; }
.dose-weight-row .btn { height: 42px; flex: 0 0 auto; }

.dose-results { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.dose-results:empty { display: none; }

.dose-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: #fff;
}
.dose-card.warn { border-color: #FDA4AF; background: #FFF7F8; }
.dose-card.cyan { border-color: var(--teal-soft); background: var(--teal-050); }

.dose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.dose-name { font-size: .88rem; font-weight: 800; }
.dose-range {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--teal-dark);
  direction: rtl;
}
.dose-card.warn .dose-range { color: var(--coral-dark); }
.dose-line { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.dose-formula {
  font-size: .76rem;
  background: var(--line-soft);
  border-radius: 8px;
  padding: 5px 8px;
  margin-top: 6px;
  color: var(--muted);
  direction: rtl;
}
.dose-warn {
  font-size: .76rem;
  color: var(--coral-dark);
  background: var(--coral-soft);
  border-radius: 8px;
  padding: 5px 8px;
  margin-top: 6px;
  font-weight: 700;
}
.disclaimer { font-size: .74rem; margin-top: 10px; }

/* ================= تایمر ایمنی ================= */
.timer-card { border-color: var(--coral-soft); }

.timer-panel {
  background: linear-gradient(160deg, #FFF1F2, #FFFFFF);
  border: 1px solid var(--coral-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.timer-panel.ok { background: linear-gradient(160deg, var(--teal-050), #FFFFFF); border-color: var(--teal-soft); }
.timer-panel.idle { background: var(--line-soft); border-color: var(--line); }

.timer-big {
  font-size: 2rem;
  font-weight: 800;
  color: var(--coral-dark);
  direction: ltr;
  letter-spacing: 1px;
  line-height: 1.4;
}
.timer-panel.ok .timer-big { color: var(--teal-dark); }
.timer-panel.idle .timer-big { color: var(--muted); font-size: 1.1rem; }
.timer-meta { font-size: .8rem; color: var(--muted); font-weight: 600; }
.timer-status { font-size: .86rem; font-weight: 800; margin-top: 4px; }

/* ================= راهنمای تب ================= */
.guidance {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: .85rem;
  border: 1px solid transparent;
}
.guidance.danger { background: var(--coral-soft); border-color: #FDA4AF; color: var(--coral-dark); }
.guidance.warning { background: var(--amber-soft); border-color: #FDE68A; color: #92400E; }
.guidance.info { background: var(--teal-050); border-color: var(--teal-soft); color: var(--teal-dark); }
.guidance-title { font-weight: 800; margin-bottom: 2px; }
.guidance-threshold { font-size: .78rem; font-weight: 700; opacity: .9; margin-top: 4px; }

/* ================= خلاصه تغذیه ================= */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 10px 0; }
.summary-item {
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}
.summary-item strong { display: block; color: var(--teal-dark); font-size: 1.1rem; }
.summary-item span { font-size: .72rem; color: var(--muted); font-weight: 700; }

/* ================= آلرژی ================= */
.allergy-box:empty::after {
  content: "آلرژی ثبت‌نشده — در صورت مشاهده حساسیت، آن را در پروفایل کودک وارد کنید.";
  display: block;
  color: var(--muted);
  font-size: .84rem;
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.allergy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--coral-soft);
  color: var(--coral-dark);
  border: 1px solid #FDA4AF;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .82rem;
  font-weight: 800;
  margin: 3px 3px 0 0;
}

/* ================= پروفایل ================= */
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.profile-avatar {
  width: 54px; height: 54px;
  border-radius: 18px;
  background: linear-gradient(150deg, var(--teal), var(--teal-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  flex: 0 0 auto;
}
.profile-name { font-size: 1.05rem; }
.profile-stage { font-size: .78rem; color: var(--muted); font-weight: 700; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.profile-item {
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.profile-label { display: block; font-size: .7rem; color: var(--muted); font-weight: 700; }
.profile-val { font-size: .9rem; font-weight: 800; }
.profile-allergy {
  margin-top: 10px;
  background: var(--coral-soft);
  border: 1px dashed #FDA4AF;
  color: var(--coral-dark);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: .82rem;
  font-weight: 700;
}

/* ================= دندان‌پزشکی ================= */
.dental { display: flex; flex-direction: column; gap: 14px; }
.jaw-label {
  font-size: .74rem;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}
.jaw-row { display: flex; gap: 6px; }
.jaw-row.lower { flex-direction: row-reverse; }
.jaw-col { display: flex; gap: 6px; }

.tooth {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1 / 1.15;
  border-radius: 10px 10px 14px 14px;
  border: 2px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  padding: 2px;
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.tooth.lower { border-radius: 14px 14px 10px 10px; }
.tooth:active { transform: scale(.93); }
.tooth-num { font-size: .78rem; font-weight: 800; color: var(--muted); line-height: 1.2; }
.tooth-name { font-size: .55rem; color: var(--muted); text-align: center; line-height: 1.3; }

.tooth.tooth-present { background: var(--green-soft); border-color: var(--green); }
.tooth.tooth-present .tooth-num { color: #047857; }
.tooth.tooth-issue { background: var(--coral-soft); border-color: var(--coral); }
.tooth.tooth-issue .tooth-num { color: var(--coral-dark); }
.tooth.tooth-fallen { background: var(--line-soft); border-color: var(--line); opacity: .7; }
.tooth.tooth-fallen .tooth-num { text-decoration: line-through; }
.tooth.tooth-new { background: var(--teal-soft); border-color: var(--teal); }
.tooth.tooth-new .tooth-num { color: var(--teal-dark); }
.tooth.selected { outline: 3px solid rgba(13, 148, 136, .4); outline-offset: 1px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.legend-swatch { width: 14px; height: 14px; border-radius: 5px; border: 2px solid var(--line); background: #fff; }
.legend-swatch.present { background: var(--green-soft); border-color: var(--green); }
.legend-swatch.issue { background: var(--coral-soft); border-color: var(--coral); }
.legend-swatch.fallen { background: var(--line-soft); }
.legend-swatch.new { background: var(--teal-soft); border-color: var(--teal); }

.tooth-info {
  margin-top: 10px;
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: .84rem;
  color: var(--muted);
}
.tooth-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tooth-actions:empty { display: none; }

/* ================= دکمه شناور SOS ================= */
.sos-fab {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: max(14px, calc(50% - 280px + 14px));
  z-index: 45;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 30% 25%, #FB7185, var(--coral) 60%, var(--coral-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(244, 63, 94, .75), 0 0 0 4px rgba(244, 63, 94, .18);
  transition: transform .12s ease;
  line-height: 1.1;
}
.sos-fab:active { transform: scale(.93); }
.sos-label { font-size: .95rem; font-weight: 900; letter-spacing: .5px; }
.sos-sub { font-size: .58rem; font-weight: 700; opacity: .95; }

.sos-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(244, 63, 94, .55);
  animation: sosPulse 2s ease-out infinite;
  pointer-events: none;
}
@keyframes sosPulse {
  0% { transform: scale(.9); opacity: .9; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

/* ================= ناوبری پایین ================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 44;
}

.nav-btn {
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: color .15s ease;
}
.nav-btn svg { transition: transform .15s ease; }
.nav-btn.active { color: var(--teal); }
.nav-btn.active svg { transform: translateY(-2px); }
.nav-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 34px;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: var(--teal);
}

/* ================= مودال‌ها ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideUp .24s cubic-bezier(.2, .8, .3, 1);
  padding-bottom: var(--safe-bottom);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

.modal-mini { max-width: 380px; margin: auto; border-radius: 18px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 1rem; }
.modal-head .icon-btn { background: var(--line-soft); color: var(--muted); }
.modal-head-coral { background: linear-gradient(150deg, var(--coral), var(--coral-dark)); color: #fff; border-bottom: 0; }
.modal-head-coral .icon-btn { background: rgba(255, 255, 255, .2); color: #fff; }

.modal-body { padding: 14px 16px 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 6px;
}
.modal-foot .btn { flex: 1 1 auto; }

/* ================= SOS مودال ================= */
.sos-child {
  background: var(--coral-soft);
  border: 1px dashed #FDA4AF;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--coral-dark);
  font-weight: 700;
  margin-bottom: 10px;
}
.sos-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sos-num {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}
.sos-num:hover { border-color: var(--coral); }
.sos-num b { display: block; font-size: 1.25rem; color: var(--coral); direction: rtl; }
.sos-num span { font-size: .7rem; color: var(--muted); font-weight: 700; }

.sos-cases { display: flex; flex-direction: column; gap: 6px; }
.sos-case {
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: .82rem;
}
.sos-case b { display: block; color: var(--coral-dark); font-size: .84rem; }
.sos-case span { color: var(--muted); }

/* ================= اعلان ================= */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 90px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  z-index: 80;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 88%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--coral-dark); }
.toast.ok { background: var(--teal-dark); }

/* ================= حالت خالی ================= */
.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: .87rem;
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 22px 14px;
}
.empty-state b { display: block; font-size: 1.5rem; margin-bottom: 6px; color: var(--teal); }

/* ================= دسکتاپ ================= */
@media (min-width: 600px) {
  body { padding: 0; }
  .shell { border-radius: 0; }
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; max-height: 88vh; }
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .form-grid label.full, .form-grid .full { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  .brand-text { font-size: .95rem; }
  .grid-3 { gap: 6px; }
  .vital strong { font-size: 1.1rem; }
  .tooth-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .bottom-nav, .sos-fab, .app-header .hdr-child, .card-actions { display: none !important; }
  .shell { max-width: 100%; box-shadow: none; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* =============================================================
 * فاز ۲ — زیرتب‌های پرونده، آرشیو آزمایش/سونوگرافی و لایت‌باکس
 * ============================================================= */
.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.subtab {
  flex: 1 1 auto;
  min-width: max-content;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.subtab.active { background: var(--teal); color: #fff; box-shadow: 0 4px 12px -6px var(--teal); }
.subtab:not(.active):hover { background: var(--line-soft); color: var(--ink); }
.rtab-panel[hidden] { display: none; }
.rtab-panel > .card:first-child { margin-top: 2px; }

/* --- ردیف انتخاب فایل و پیش‌نمایش --- */
.file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.file-label { font-size: .8rem; color: var(--muted); font-weight: 700; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--teal-050);
  border: 1px dashed var(--teal);
  border-radius: var(--radius-sm);
}
.preview-box[hidden] { display: none; }
.preview-box img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}
.preview-meta { flex: 1; font-size: .78rem; color: var(--muted); line-height: 1.7; }

/* --- گرید پارامترهای استخراج‌شده --- */
.params-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.params-grid .param-cell {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.param-cell .p-name { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.param-cell .p-row { display: flex; align-items: center; gap: 6px; }
.param-cell input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: .88rem;
  background: var(--surface);
}
.param-cell .p-unit { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.param-cell .p-status { display: block; margin-top: 5px; font-size: .7rem; font-weight: 800; }
.param-cell.st-low { border-color: #60A5FA; background: #EFF6FF; }
.param-cell.st-high { border-color: var(--coral); background: var(--coral-soft); }
.param-cell.st-normal { border-color: var(--green); background: var(--green-soft); }
.p-status.st-low { color: #2563EB; }
.p-status.st-high { color: var(--coral-dark); }
.p-status.st-normal { color: #047857; }

/* --- ماتریس مقایسه آزمایش‌ها --- */
.matrix-wrap { overflow-x: auto; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.matrix { width: 100%; border-collapse: collapse; font-size: .78rem; min-width: 420px; }
.matrix th, .matrix td { padding: 8px 9px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.matrix thead th {
  background: var(--teal-050);
  color: var(--teal-dark);
  font-weight: 800;
  font-size: .74rem;
  border-bottom: 2px solid var(--teal-soft);
  position: sticky;
  top: 0;
}
.matrix .m-name { text-align: right; min-width: 132px; font-weight: 700; color: var(--ink); background: var(--surface); position: sticky; right: 0; }
.matrix tbody tr:last-child td, .matrix tbody tr:last-child th { border-bottom: 0; }
.matrix .m-unit { display: block; font-size: .65rem; color: var(--muted); font-weight: 600; }
.m-val { display: block; font-weight: 800; font-size: .86rem; }
.m-val.st-high { color: var(--coral-dark); }
.m-val.st-low { color: #2563EB; }
.m-val.st-normal { color: #047857; }
.m-range { display: block; font-size: .62rem; color: var(--muted); }
.delta { display: inline-block; margin-top: 3px; font-size: .66rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.delta-up { background: #DBEAFE; color: #1D4ED8; }
.delta-down { background: var(--amber-soft); color: #B45309; }
.delta-flat { background: var(--green-soft); color: #047857; }
.delta-none { background: var(--line-soft); color: var(--muted); }

/* --- جمع‌بندی بالینی خودکار --- */
.trend-summary {
  margin-top: 12px;
  background: var(--teal-050);
  border: 1px solid var(--teal-soft);
  border-inline-start: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .83rem;
  line-height: 2;
}
.trend-summary .tr-head { font-weight: 800; color: var(--teal-dark); margin-bottom: 4px; }
.trend-summary ul { margin: 4px 0 0; padding-inline-start: 18px; }
.trend-summary li.alert { color: var(--coral-dark); font-weight: 700; }
.trend-summary li.good { color: #047857; font-weight: 700; }
.trend-summary li.note { color: var(--ink); }

/* --- گالری کارت‌های تصویری --- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.shot {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s;
  aspect-ratio: 4 / 3;
}
.shot:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .45); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .shot-cap {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 14px 8px 6px;
  background: linear-gradient(transparent, rgba(15, 23, 42, .82));
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  text-align: right;
  line-height: 1.5;
}
.shot .shot-badge {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  background: rgba(13, 148, 136, .95);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.shot .shot-del {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  border: 0;
  background: rgba(244, 63, 94, .95);
  color: #fff;
  font-size: .66rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

/* --- لایت‌باکس تمام‌صفحه (بزرگ‌نمایی + چرخش + درگ) --- */
.lightbox { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .94); }
.lb-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.lb-stage.dragging { cursor: grabbing; }
.lb-stage img {
  max-width: 94vw;
  max-height: 78vh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform-origin: center center;
  background: rgba(255, 255, 255, .04);
}
.lb-top {
  position: absolute;
  top: 0;
  inset-inline: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  z-index: 2;
}
.lb-caption { flex: 1; color: #E2E8F0; font-size: .82rem; font-weight: 700; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.lb-x { background: rgba(255, 255, 255, .14); color: #fff; }
.lb-bar {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  z-index: 2;
}
.lb-btn {
  min-width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .15s, transform .1s;
}
.lb-btn:active { transform: scale(.93); }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn-wide { min-width: 92px; font-size: .82rem; }

@media (max-width: 380px) {
  .subtab { font-size: .78rem; padding: 9px 9px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); }
  .params-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
}


/* ==========================================================
 * ÙØ§Ø² Û³: Ø¯Ø±ÙˆØ§Ø²Ù‡ ÙˆØ±ÙˆØ¯ (Ø´Ù…Ø§Ø±Ù‡ Ù…ÙˆØ¨Ø§ÛŒÙ„ + Ø±Ù…Ø² Ø¹Ø¨ÙˆØ±)
 * ========================================================== */
/* hidden باید بر displayهای نویسنده سرکوب شود (الگوی .modal[hidden] پروژه) —
   در غیر این صورت اورلِی ورود بعد از ورود موفق و کارت روزانه بعد از پنهان‌شدن،
   همچنان روی صفحه دیده می‌شوند */
.auth-screen[hidden] { display: none; }
.shell[hidden] { display: none; }
.daily-body[hidden] { display: none; }
.card-actions[hidden] { display: none; }
.alert[hidden] { display: none; }
.auth-err[hidden] { display: none; }
.daily-tomorrow[hidden] { display: none; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(13, 148, 136, .22), transparent 60%),
    radial-gradient(900px 480px at 10% 110%, rgba(245, 158, 11, .14), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #113f3b 55%, #0f2e46 100%);
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
  animation: authIn .35s ease both;
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.auth-brand { text-align: center; margin-bottom: 16px; }
.auth-logo {
  width: 64px; height: 64px;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  background: linear-gradient(145deg, #ccfbf1, #fef3c7);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(13, 148, 136, .25);
}
.auth-brand h2 { margin: 0 0 6px; font-size: 1.25rem; color: #0f172a; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.auth-tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  color: #64748b;
  padding: 10px 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.active {
  background: #fff;
  color: #0d9488;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .1);
}
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; font-size: .86rem; font-weight: 700; color: #334155; }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  background: #f8fafc;
  transition: border-color .15s, background .15s;
}
.auth-form input:focus {
  outline: none;
  border-color: #0d9488;
  background: #fff;
}
.auth-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .85rem;
  font-weight: 600;
}
.auth-hint { text-align: center; margin: 14px 0 6px; min-height: 1.2em; }
.auth-note {
  text-align: center;
  font-size: .74rem;
  line-height: 1.9;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
  margin: 6px 0 0;
}
.btn-block { width: 100%; }

/* ==========================================================
 * ÙØ§Ø² Û³: Ú©Ø§Ø±Øª Ø¢Ù…ÙˆØ²Ø´â€ŒÙ‡Ø§ÛŒ Ø±ÙˆØ²Ø§Ù†Ù‡ Ù‡ÙˆØ´Ù…Ù†Ø¯ (Ù¾Ø§ÛŒÛŒÙ† Ø¯Ø§Ø´Ø¨ÙˆØ±Ø¯)
 * ========================================================== */
.daily-card {
  background:
    linear-gradient(150deg, rgba(13, 148, 136, .07), rgba(245, 158, 11, .06) 55%, transparent),
    #fff;
  border: 1.5px solid rgba(13, 148, 136, .28);
  position: relative;
  overflow: hidden;
}
.daily-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 4px;
  background: linear-gradient(90deg, #0d9488, #f59e0b, #0d9488);
  background-size: 200% 100%;
  animation: dailyShimmer 6s linear infinite;
}
@keyframes dailyShimmer {
  from { background-position: 200% 0; }
  to { background-position: 0 0; }
}
.daily-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.daily-ico {
  width: 52px; height: 52px;
  flex: 0 0 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  background: linear-gradient(145deg, #ccfbf1, #fef3c7);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(13, 148, 136, .22);
}
.daily-titles { flex: 1 1 200px; min-width: 0; }
.daily-titles .card-title { margin: 0 0 3px; }
.daily-sub { font-size: .8rem; color: #64748b; font-weight: 600; }
.daily-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.daily-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .daily-body { grid-template-columns: 1fr; } }
.daily-h {
  font-size: .88rem;
  font-weight: 800;
  color: #0f766e;
  margin: 0 0 8px;
}
.daily-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.daily-list li {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 12px 9px 10px;
  font-size: .85rem;
  line-height: 1.95;
  color: #1e293b;
}
.daily-list li::before {
  content: 'â–¸';
  color: #0d9488;
  font-weight: 900;
  margin-left: 7px;
}
.daily-rules {
  list-style: none;
  margin: 12px 0 0;
  padding: 10px 12px;
  background: rgba(13, 148, 136, .06);
  border: 1px dashed rgba(13, 148, 136, .4);
  border-radius: 10px;
  display: grid;
  gap: 6px;
}
.daily-rules li {
  font-size: .78rem;
  line-height: 1.95;
  color: #134e4a;
  font-weight: 600;
}
.daily-rules li::before { content: 'âœ” '; color: #0d9488; }
.daily-tomorrow {
  margin-top: 12px;
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: .83rem;
  line-height: 2;
  color: #78350f;
}
.daily-tomorrow strong { color: #92400e; }
.daily-source {
  margin: 12px 0 0;
  font-size: .72rem;
  line-height: 1.9;
  border-top: 1px dashed #e2e8f0;
  padding-top: 9px;
}

/* =============================================================
 * فاز ۴: آکادمی آموزش و امداد — کتابخانه چندرسانه‌ای
 * ============================================================= */
.academy-intro {
  margin: 0 0 14px;
  padding: 11px 13px;
  background: var(--teal-050);
  border: 1px dashed var(--teal);
  border-radius: 12px;
  font-size: .8rem;
  line-height: 2;
}
.academy-hint { margin: -6px 0 12px; }
.academy-manage .card-actions { justify-content: space-between; }

/* --- فیلترهای دسته‌بندی --- */
.media-filters {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 3px;
}
.media-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
  white-space: nowrap;
}
.media-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  box-shadow: 0 6px 14px -8px var(--teal);
}
.media-chip:not(.active):hover { background: var(--line-soft); color: var(--ink); }

/* --- گرید کارت‌های رسانه --- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}
.media-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.media-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.media-cover {
  position: relative;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, #ccfbf1, #a5f3fc);
  border-bottom: 1px solid var(--line);
}
.media-cover.cover-daily { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.media-cover.cover-pdf { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
.media-cover.cover-link { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }
.media-type {
  position: absolute;
  top: 7px;
  inset-inline-start: 7px;
  font-size: .66rem;
  font-weight: 800;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
}
.media-size {
  position: absolute;
  bottom: 7px;
  inset-inline-end: 7px;
  font-size: .64rem;
  font-weight: 700;
  background: rgba(255, 255, 255, .85);
  color: #334155;
  border-radius: 999px;
  padding: 2px 8px;
}
.media-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.media-title { font-size: .87rem; font-weight: 800; line-height: 1.7; color: var(--ink); }
.media-desc { font-size: .75rem; line-height: 1.95; color: var(--muted); flex: 1; }
.media-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.media-tag {
  font-size: .66rem;
  font-weight: 700;
  background: var(--teal-050);
  color: var(--teal-dark);
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 2px 8px;
}
.media-tag.tag-age { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.media-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.media-actions .btn { flex: 1 1 auto; min-width: 64px; }
.media-steps {
  margin: 0;
  padding-inline-start: 18px;
  font-size: .73rem;
  line-height: 2;
  color: #334155;
}
.media-steps li { margin-bottom: 2px; }
.media-steps li::marker { color: var(--teal); font-weight: 700; }
.media-attached {
  font-size: .7rem;
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--teal-050);
  border-radius: 8px;
  padding: 5px 8px;
}
.media-empty { margin-top: 4px; }

/* --- مودال افزودن فایل --- */
.media-tabs { margin-bottom: 4px; }
.media-pane { display: flex; flex-direction: column; gap: 8px; }
.media-pane[hidden] { display: none; }

/* --- پخش‌کننده --- */
.modal-wide .modal-card { max-width: 680px; }
.player-stage {
  background: #0F172A;
  border-radius: 14px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.player-stage video,
.player-stage audio { width: 100%; max-height: 58vh; outline: none; background: #000; }
.player-stage iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.player-stage .player-placeholder { color: #94A3B8; font-size: .82rem; padding: 26px 16px; text-align: center; line-height: 2; }
.doc-stage {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  min-height: 240px;
}
.doc-stage iframe { width: 100%; height: 52vh; min-height: 240px; border: 0; display: block; }
.doc-stage .doc-fallback { padding: 26px 16px; text-align: center; color: var(--muted); font-size: .82rem; line-height: 2; }

@media (max-width: 420px) {
  .media-grid { grid-template-columns: 1fr; }
  .media-filters { gap: 5px; }
  .media-chip { padding: 7px 11px; font-size: .74rem; }
}
