:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel2: #212b40;
  --text: #e7ecf5;
  --muted: #93a0b8;
  --accent: #6ea8fe;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --warn: #ffb454;
  --border: #2a3550;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}
html[dir="ltr"] body { direction: ltr; }
html[dir="ltr"] th, html[dir="ltr"] td { text-align: left; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar a { color: var(--accent); text-decoration: none; }

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mini-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.brand-mini-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
  background: linear-gradient(90deg, #2dd4bf, #a855f7 50%, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  text-align: center;
}
.brand-logo {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 0 0 3px var(--panel2);
}
.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  direction: ltr;
  background: linear-gradient(90deg, #2dd4bf, #a855f7 50%, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tagline {
  font-size: 12px;
  margin: 0;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  color: var(--muted) !important;
  text-decoration: none;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 999px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--panel2);
  color: var(--text) !important;
}

.nav-link.active {
  background: var(--accent);
  color: #0f1420 !important;
  font-weight: 600;
}

.nav-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 6px;
}

.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}

h1, h2, h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

form.inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

input, select, textarea {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

textarea { width: 100%; min-height: 60px; }

button {
  background: var(--accent);
  color: #0f1420;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { opacity: .9; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel2);
  color: var(--muted);
}

.badge.warn { background: #3a2a1a; color: #ffb454; }
.badge.danger { background: #3a1a1a; color: var(--danger); }

a.child-link {
  color: var(--text);
  text-decoration: none;
  display: block;
  padding: 8px;
  border-radius: 6px;
}
a.child-link:hover { background: var(--panel2); }

.muted { color: var(--muted); font-size: 13px; }

.login-box {
  max-width: 360px;
  margin: 80px auto;
}

.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  background: #3a1a1a;
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-card.ok { border-color: var(--ok); }
.stat-card.warn { border-color: #ffb454; }
.stat-card.danger { border-color: var(--danger); }

.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.badge.ok { background: #12321f; color: var(--ok); }
.badge.muted-badge { background: var(--panel2); color: var(--muted); }

/* ---- فورم التسجيل متعدد المراحل ---- */
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  padding: 10px;
  background: var(--panel2);
  border-radius: 10px;
}

.wizard-step-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.wizard-step-btn:hover { background: var(--panel); color: var(--text); }

.wizard-step-btn .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.wizard-step-btn.visited .step-num {
  background: var(--ok);
  color: #0f1420;
}

.wizard-step-btn.active {
  background: var(--accent);
  color: #0f1420;
  border-color: var(--accent);
  font-weight: 700;
}

.wizard-step-btn.active .step-num {
  background: #0f1420;
  color: var(--accent);
}

.wizard-progress-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
}

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.field-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.field-group.column { flex-direction: column; align-items: flex-start; }

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 18px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 4px 0;
}
.checkbox-row input { width: auto; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.pickup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

textarea.small { min-height: 40px; }

/* ---- رسوم بيانية بسيطة (بدون مكتبات) ---- */
.chart-title {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 90px;
  padding-bottom: 22px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.bar-fill {
  width: 60%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  transition: opacity .15s;
}

.bar-fill.today { background: var(--ok); }
.bar-fill:hover { opacity: .8; }

.bar-day-label {
  position: absolute;
  bottom: -20px;
  font-size: 11px;
  color: var(--muted);
}

.mood-strip {
  display: flex;
  gap: 8px;
}

.mood-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--panel2);
  cursor: default;
}

.mood-cell.status-ok { box-shadow: inset 0 -3px 0 var(--ok); }
.mood-cell.status-warn { box-shadow: inset 0 -3px 0 var(--warn); }
.mood-cell.status-danger { box-shadow: inset 0 -3px 0 var(--danger); }
.mood-cell.status-muted { box-shadow: inset 0 -3px 0 var(--border); }

.mood-cell .emoji { font-size: 18px; }
.mood-cell .label { font-size: 10px; color: var(--muted); }

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }
.dot-muted { background: var(--border); }

.meal-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 16px;
}

.dot-sm {
  width: 10px;
  height: 10px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .charts-grid { grid-template-columns: 1fr; } }

/* ---- كرت "تقرير اليوم" ---- */
.today-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (max-width: 560px) { .today-grid { grid-template-columns: repeat(3, 1fr); } }

.today-tile {
  background: var(--panel2);
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  border-bottom: 3px solid var(--border);
}
.today-tile.status-ok { border-bottom-color: var(--ok); }
.today-tile.status-warn { border-bottom-color: var(--warn); }
.today-tile.status-danger { border-bottom-color: var(--danger); }
.today-tile.status-muted { border-bottom-color: var(--border); }

.today-tile .tile-icon { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.today-tile .tile-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.today-tile .tile-value { font-size: 13px; font-weight: 600; min-height: 18px; display: flex; align-items: center; justify-content: center; }

.today-detail-line {
  padding: 6px 2px;
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.today-detail-line:first-of-type { border-top: none; }

.detail-section { margin-top: 14px; }
.detail-section-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-card {
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.detail-card + .detail-card { margin-top: 6px; }
.detail-card.tone-danger { background: #3a1a1a; }
.detail-card.tone-ok { background: #12321f; }
.detail-card.tone-warn { background: #3a2a1a; }

.meal-list { display: flex; flex-direction: column; gap: 6px; }
.meal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.meal-row .meal-food { flex: 1; }
.meal-row .meal-time { font-size: 11px; color: var(--muted); }

.nap-list { display: flex; flex-direction: column; gap: 4px; }
.nap-row { font-size: 13px; }

.incident-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.incident-time { font-size: 11px; color: var(--muted); }

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topnav { flex-wrap: wrap; width: 100%; justify-content: center; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .nav-sep { display: none; }
}
