/* =====================================================================
   style.css — साफ, modern, mobile पर भी ठीक
   रंग config.js से आते हैं (app.js इन variables को भर देता है)
   ===================================================================== */

:root {
  --primary: #1e3a8a;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --bg: #f4f6fb;
  --text: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Noto Sans Devanagari", "Mangal", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}
.logo-placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  border: 3px solid var(--accent);
}
.school-name { font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.school-meta { font-size: 0.82rem; opacity: 0.85; }

.header-user { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.9rem; }
.role-badge {
  background: var(--accent);
  color: #111;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

/* ---------------- Main ---------------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.muted { color: var(--muted); }

/* ---------------- Buttons & forms ---------------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-light { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.5); padding: 6px 14px; font-size: 0.9rem; }
.btn-block { width: 100%; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
select, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
select:focus, input:focus, .btn:focus-visible, .role-card:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* ---------------- Login page ---------------- */
.login-wrap { max-width: 760px; margin: 0 auto; }
.app-title {
  text-align: center;
  font-size: 2rem;
  margin: 8px 0 4px;
  color: var(--primary);
}
.app-subtitle { text-align: center; color: var(--muted); margin: 0 0 24px; }

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.role-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.role-card:hover { border-color: var(--secondary); transform: translateY(-2px); }
.role-card.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, #fff); }
.role-card .icon { font-size: 1.8rem; display: block; }
.role-card .name { font-weight: 700; display: block; margin-top: 4px; }

.user-picker { margin-bottom: 16px; }
.hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 6px;
}
.demo-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 14px;
}

/* ---------------- Panel pages ---------------- */
.panel-title { margin: 0 0 16px; color: var(--primary); }
.notice-card { text-align: center; padding: 48px 20px; }
.notice-card h2 { margin: 8px 0; }
.big-icon { font-size: 3rem; }
.blocked p { font-size: 1.15rem; font-weight: 600; color: var(--danger); }

/* ---------------- Footer ---------------- */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  font-size: 0.85rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.powered strong { color: #fff; }

/* ---------------- Mobile ---------------- */
@media (max-width: 600px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .app-title { font-size: 1.6rem; }
  .school-name { font-size: 1.05rem; }
  .header-inner { justify-content: center; }
  .user-info { align-items: flex-start; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* =====================================================================
   Student Panel
   ===================================================================== */
.small { font-size: 0.85rem; }
.mt { margin-top: 16px; }

.picker-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.picker-bar label { margin: 0; }
.picker-bar select { width: auto; max-width: 100%; flex: 1; min-width: 220px; }

/* ---- Profile ---- */
.profile { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; flex-shrink: 0;
  object-fit: cover; border: 3px solid var(--accent);
}
.small-avatar { width: 48px; height: 48px; font-size: 1rem; border-width: 2px; }
.profile h1 { margin: 0 0 6px; font-size: 1.5rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); }
.profile-meta strong { color: var(--text); }
.house-dot::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--house); margin-right: 6px; vertical-align: middle;
}

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  margin-bottom: 16px; scrollbar-width: thin;
}
.tab {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--card);
  color: var(--text); padding: 8px 14px; border-radius: 999px;
  font-family: inherit; font-size: 0.92rem; cursor: pointer;
}
.tab:hover { border-color: var(--secondary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Sections ---- */
.section { margin-bottom: 16px; }
.section h2 { margin: 0 0 12px; font-size: 1.1rem; color: var(--primary); }
.section h3 { margin: 0 0 8px; font-size: 1rem; }

/* ---- Stat tiles ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat-label { font-size: 0.82rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.stat-sub { font-size: 0.8rem; color: var(--muted); }

.house-strip {
  display: inline-block; margin-bottom: 12px; padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--house) 14%, #fff); border: 1px solid var(--house);
  font-weight: 600; font-size: 0.9rem;
}
.house-card { border-left: 5px solid var(--house); padding-left: 14px; }
.house-card .stat-grid { margin-bottom: 0; }
.house-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }

/* ---- Lists ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill-box { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--border); }
.pill-box.good { background: #f0fdf4; border-color: #bbf7d0; }
.pill-box.weak { background: #fff7ed; border-color: #fed7aa; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
}
ul.plain li:last-child { border-bottom: none; }
.stars { color: var(--accent); letter-spacing: 2px; white-space: nowrap; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f8fafc; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-good { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-bad { background: #fee2e2; color: #991b1b; }
.event-flag { background: #eff6ff; border-radius: 8px; padding: 6px 10px; margin: 0 0 10px; }

/* ---- Study ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 6px 14px; border-radius: 999px; font-family: inherit; font-size: 0.92rem; cursor: pointer;
}
.chip.active { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.chip.static { cursor: default; background: #f1f5f9; }
.topic { padding: 12px 0; border-bottom: 1px solid var(--border); }
.topic:last-child { border-bottom: none; }
.topic-name { font-weight: 600; margin-bottom: 8px; }
.topic-ways { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-small { padding: 5px 12px; font-size: 0.85rem; border-radius: 8px; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; filter: none; }
.ai-output {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: #f8fafc; border: 1px dashed var(--secondary);
  white-space: pre-wrap; font-size: 0.95rem;
}
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; }

/* ---- Results chart ---- */
.bar-chart { display: flex; align-items: flex-end; gap: 16px; height: 240px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; max-width: 110px; }
.bar-value { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.bar-track {
  flex: 1; width: 60%; max-width: 48px; display: flex; align-items: flex-end;
  border-bottom: 1px solid var(--border);
}
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar { filter: brightness(1.2); }
.bar-label { font-size: 0.8rem; text-align: center; margin-top: 6px; color: var(--text); }
.bar-label span { color: var(--muted); }

/* ---- Notices & calendar ---- */
.notice { padding: 10px 0; border-bottom: 1px solid var(--border); }
.notice:last-child { border-bottom: none; }
.notice-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.notice p { margin: 4px 0 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.month { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.month h3 { font-size: 0.95rem; margin: 0 0 6px; color: var(--primary); }
.month ul { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.month li { padding: 2px 0; }
.month.past { opacity: 0.55; }
.month.current { border: 2px solid var(--secondary); background: #f0f9ff; }

/* ---- Teachers ---- */
.teacher-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.teacher-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.contact { display: inline-block; margin-top: 4px; text-decoration: none; font-weight: 600; }

.notice-card .btn { margin-top: 12px; }

@media (max-width: 800px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .profile { flex-direction: column; text-align: center; }
  .profile-meta { justify-content: center; }
  .two-col, .teacher-grid, .calendar-grid { grid-template-columns: 1fr; }
  .bar-chart { gap: 8px; }
  .ask-row { flex-direction: column; }
}

/* =====================================================================
   Teacher Panel
   ===================================================================== */
.tt-grid th, .tt-grid td { text-align: center; white-space: nowrap; }
.today-row { background: #f0f9ff; }
.today-row th:first-child, .today-row td:first-child { box-shadow: inset 4px 0 0 var(--secondary); }
tr.free td { background: #fafafa; }
tr.plan-row td { background: #fff; }

.att-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 10px; }
.att-list { list-style: none; margin: 0 0 14px; padding: 0; }
.att-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.att-toggle {
  min-width: 96px; padding: 8px 12px; border-radius: 999px; border: 2px solid;
  font-family: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.att-toggle.is-present { background: #dcfce7; color: #166534; border-color: #86efac; }
.att-toggle.is-absent { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.save-msg { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: #dcfce7; color: #166534; font-weight: 600; }

.gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gen-btn {
  padding: 14px 10px; border-radius: 12px; border: 2px solid var(--border); background: #fff;
  font-family: inherit; font-size: 1rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.gen-btn:hover { border-color: var(--primary); color: var(--primary); }

.book { display: flex; gap: 12px; align-items: center; }
.book-icon { font-size: 2rem; }

@media (max-width: 600px) {
  .gen-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================
   Parents Panel
   ===================================================================== */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; border: 1px solid; }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-good { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.link-btn {
  background: none; border: none; padding: 0; margin-left: 6px; cursor: pointer;
  color: inherit; font: inherit; text-decoration: underline;
}

.reason-form {
  display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.reason-form:last-child { border-bottom: none; }
.reason-date { font-weight: 600; }
.reason-form.needs .reason-sel { border-color: var(--danger); }

.hbar-list { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 200px 1fr 30px; gap: 10px; align-items: center; font-size: 0.9rem; }
.hbar-track { height: 12px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.hbar { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.hbar.ill { background: var(--danger); }
.hbar-val { font-weight: 700; text-align: right; }

.pay-row td { background: #f8fafc; }
.pay-box { padding: 6px 0; }
.pay-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ptm-card { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ptm-card:last-child { border-bottom: none; }
.ptm-card.next .ptm-date { background: var(--primary); color: #fff; }
.ptm-date {
  width: 74px; flex-shrink: 0; border-radius: 12px; background: #f1f5f9;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 4px;
}
.ptm-date .d { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.ptm-date .m { font-size: 0.75rem; }
.ptm-info { display: flex; flex-direction: column; gap: 2px; }
.ptm-info .badge { align-self: flex-start; margin-bottom: 4px; }

@media (max-width: 700px) {
  .reason-form { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 1fr 1fr 24px; }
}

/* =====================================================================
   Principal Panel
   ===================================================================== */
.two-col > .section { margin-bottom: 16px; }
.pos { color: #15803d; }
.neg { color: var(--danger); }
.link-btn.danger { color: var(--danger); }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-link {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px;
  border: 2px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600;
}
.quick-link:hover { border-color: var(--primary); color: var(--primary); }
.quick-link .icon { font-size: 1.6rem; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.duty-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.new-teacher { padding: 10px 0; border-bottom: 1px solid var(--border); }
.new-teacher:last-child { border-bottom: none; }
.new-teacher.just-added { background: #f0fdf4; border-radius: 10px; padding: 10px 12px; }

.legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 8px; }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
.legend .key:first-child { margin-left: 0; }
.k-last { background: #94a3b8; }
.k-now { background: var(--primary); }
.gbar-chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; margin-bottom: 14px; }
.gbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.gbar-pair { flex: 1; width: 100%; display: flex; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.gbar-track { width: 40%; max-width: 22px; display: flex; align-items: flex-end; }
.gbar { width: 100%; border-radius: 4px 4px 0 0; }
.gbar.last { background: #94a3b8; }
.gbar.now { background: var(--primary); }
.gbar-track:hover .gbar { filter: brightness(1.15); }

.camera-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.camera { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.camera-screen {
  aspect-ratio: 16 / 9; background: #0f172a; color: #94a3b8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 0.85rem;
}
.cam-icon { font-size: 1.8rem; }
.camera-name { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; }

@media (max-width: 800px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .camera-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .camera-grid { grid-template-columns: 1fr; }
  .gbar-chart { gap: 4px; }
  .gbar-col .bar-label { font-size: 0.7rem; }
}

/* =====================================================================
   Director Panel
   ===================================================================== */
.badge-master { background: var(--accent); color: #111; vertical-align: middle; font-size: 0.75rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 0.95rem; color: var(--text); resize: vertical;
}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid > .section { margin-bottom: 0; }
.alerts li { justify-content: flex-start; }

.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cat-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.cat-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; text-align: center; }
.cat-nums strong { display: block; font-size: 1.3rem; }
.cat-nums span { font-size: 0.75rem; color: var(--muted); }

.k-rev { background: var(--primary); }
.k-exp { background: var(--secondary); }
.gbar.rev { background: var(--primary); }
.gbar.exp { background: var(--secondary); }
.hbar-row:has(.hbar-val.wide) { grid-template-columns: 170px 1fr 150px; }

.camera-grid.mini { grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; }
.camera-grid.mini .camera-screen { font-size: 0.7rem; }

.btn-wa { background: #16a34a; color: #fff; }
.dash-pick { margin-bottom: 14px; }

@media (max-width: 800px) {
  .dash-grid, .three-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hbar-row:has(.hbar-val.wide) { grid-template-columns: 1fr; gap: 4px; }
  .hbar-val.wide { text-align: left; }
  .camera-grid.mini { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
   Preview bar (Super Master से किसी school का preview)
   ===================================================================== */
.preview-bar {
  background: #fef3c7; color: #78350f; text-align: center; padding: 6px 12px; font-size: 0.88rem; font-weight: 600;
}
.preview-bar button {
  margin-left: 8px; border: 1px solid #b45309; background: #fff; color: #78350f; border-radius: 999px;
  padding: 2px 10px; font-family: inherit; cursor: pointer;
}

/* =====================================================================
   Super Master Panel (AI Pathsala के अपने रंग)
   ===================================================================== */
body.super-master { --primary: #4c1d95; --secondary: #7c3aed; --accent: #f59e0b; --bg: #f6f4fb; }
.small-val { font-size: 1rem; }
tr.just-saved td { background: #f0fdf4; }

.sm-school { display: flex; gap: 10px; align-items: center; }
.sm-logo {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--p); border: 2px solid var(--a); font-weight: 700; font-size: 0.72rem;
}
.pchips { display: flex; flex-wrap: wrap; gap: 4px; }
.pchip { font-size: 0.72rem; padding: 1px 8px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.pchip.on { background: #dcfce7; color: #166534; text-decoration: none; }

.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.color-row { display: flex; flex-wrap: wrap; gap: 16px; }
.color-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.color-row input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 2px; background: #fff; }
.panel-checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.pcheck { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; }
.pcheck.disabled { color: var(--muted); }

.mini-preview { max-width: 460px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.mini-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff; }
.mini-header .sm-logo { font-size: 0.8rem; }
.mini-name { font-weight: 700; }
.mini-meta { font-size: 0.75rem; opacity: 0.85; }
.mini-body { padding: 14px 12px; }
.mini-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.mini-btns { display: flex; gap: 6px; margin-bottom: 8px; }
.mini-btns span { color: #fff; padding: 4px 12px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; }
.mini-footer { background: #0f172a; color: #cbd5e1; font-size: 0.75rem; padding: 6px 12px; text-align: right; }

@media (max-width: 800px) {
  .form-grid .span2, .form-grid .span3 { grid-column: auto; }
}

/* ---- AI Settings ---- */
.model-opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 8px 0; border-bottom: 1px solid var(--border); margin: 0; }
.model-opt:last-child { border-bottom: none; }
.model-opt input { margin-top: 4px; }

/* =====================================================================
   Forms (Admission / Leaving)
   ===================================================================== */
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 8px 0 12px; }
.progress-bar { height: 100%; background: var(--secondary); border-radius: 999px; transition: width 0.3s; }
.form-steps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.form-steps li { flex-shrink: 0; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); padding: 4px 10px 4px 4px; border-radius: 999px; background: #fff; border: 1px solid var(--border); }
.form-steps .n { width: 22px; height: 22px; border-radius: 50%; background: #e5e7eb; color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; }
.form-steps li.done .n { background: #16a34a; color: #fff; }
.form-steps li.current { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.form-steps li.current .n { background: var(--primary); color: #fff; }

.form-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field.wide { grid-column: 1 / -1; }
.field label, .field .flabel { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="date"], .field input[type="tel"], .field input[type="email"], .field input[type="number"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; font-family: inherit; background: #fff; color: var(--text);
}
.req { color: var(--danger); }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500 !important; margin: 0 !important;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, #fff); }
.consent-box { border-radius: 12px; align-items: flex-start; padding: 12px 14px; width: 100%; line-height: 1.5; }
.consent-box input { margin-top: 4px; flex-shrink: 0; }
.ferr { color: var(--danger); font-size: 0.85rem; margin-top: 4px; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .choice { border-color: var(--danger); }
.form-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

.form-view { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font-size: 0.9rem; }
.form-view div { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.form-view .k { color: var(--muted); font-size: 0.8rem; display: block; }
details.form-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
details.form-item summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 700px) {
  .form-fields, .form-view { grid-template-columns: 1fr; }
}
.info-block .alert { margin-bottom: 0; }
.leave-child { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; line-height: 1.6; }

/* ---- Add / Remove users ---- */
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; filter: none; }
