:root {
  --sidebar-width: 240px;
  --primary: #2596be;
  --primary-dark: #1a7a9e;
}

body { background: #f8fafc; color: #1f2937; }

/* ── Logowanie — tzw. sama kolorystyka/typografia co panel admina (frontend/index.html),
   bez animowanego tła i grafiki korepetytora, żeby nie duplikować assetów między dwoma
   niezależnymi aplikacjami statycznymi (mathme / mathme-parent, osobne katalogi statyczne). ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f0f7fa; }
.login-wrapper { width: 100%; max-width: 400px; padding: 1rem; }
.login-card { background: #fff; border-radius: 4px; padding: 2.5rem 2.25rem; box-shadow: 0 8px 40px rgba(0,0,0,.1); }
.login-brand { font-weight: 700; color: var(--primary); margin-bottom: 0; letter-spacing: .5px; }
.login-card .form-control { border-radius: 0; border-color: #cbd5e1; }
.login-card .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,150,190,.15); }
.login-card .btn-primary { background: var(--primary); border-color: var(--primary); border-radius: 0; }
.login-card .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.recovery-info-box { background: #f8fafc; border-radius: 8px; color: #6c757d; }

/* ── Sidebar — identyczna konstrukcja/kolorystyka co frontend/css/style.css (panel admina),
   tu jako stałe menu zakładek zamiast linków między podstronami (panel rodzica to jedna
   strona z zakładkami, nie osobne pliki .html na sekcję). ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #0f3a4d;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1030;
  transition: transform .2s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand h5 { color: #fff; margin: 0; font-weight: 700; letter-spacing: .5px; }
.sidebar-brand small { color: rgba(255,255,255,.5); font-size: .75rem; }

.sidebar-nav { flex: 1; padding: .75rem 0; overflow-y: auto; }

.sidebar-nav .nav-link {
  color: rgba(255,255,255,.7);
  padding: .65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.1);
  border-left-color: var(--primary);
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; }
.sidebar-nav .nav-link .badge { margin-left: auto; font-size: .65rem; }

.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,.1); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 1020;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f8fafc;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: .875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1.1rem; font-weight: 600; color: #0f172a; margin: 0; }

.sidebar-toggle-btn {
  display: none;
  border: none;
  background: none;
  font-size: 1.35rem;
  color: #334155;
  padding: 0 .25rem;
  line-height: 1;
}

.page-body { padding: 1.75rem; flex: 1; }

/* ── Karty/listy — spójne z panelem admina: białe karty, zaokrąglone rogi, cienkie ramki ── */
.card { border: 1px solid #e2e8f0; border-radius: 10px; }
.list-group-item { border-color: #e2e8f0; }
.list-group-item:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.list-group-item:last-child { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }

/* ── Status umów — te same kolory co status-badge-* w frontend/contracts.html ── */
.status-badge-sent, .status-badge-opened { background: #fef3c7; color: #92400e; }
.status-badge-signed { background: #dcfce7; color: #166534; }
.status-badge-rejected { background: #fee2e2; color: #991b1b; }

/* ── Bezpieczeństwo (2FA) ── */
.tfa-qr-box { text-align: center; padding: 1rem; background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0; }
.tfa-qr-box img { max-width: 200px; }
.tfa-secret { font-family: monospace; font-size: .9rem; word-break: break-all; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: .5rem .75rem; margin-top: .5rem; }
.backup-codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: monospace; font-size: .9rem; background: #f8fafc; border-radius: 8px; padding: 1rem; }

.detail-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; margin-bottom: 2px; }
.detail-val { font-size: .95rem; }

/* ── Kontakty (Administrator/Ownerzy/korepetytor) + czat, dwie kolumny jak
   frontend/parent-messages.html po stronie korepetytora ── */
.contacts-layout { display: flex; gap: 1.25rem; min-height: 60vh; }
.contacts-list { width: 260px; flex-shrink: 0; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; background: #fff; height: fit-content; }
.contact-item { padding: .7rem .9rem; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.contact-item:last-child { border-bottom: none; }
.contact-item:hover { background: #f8fafc; }
.contact-item.active { background: #e6f3f8; }
.contact-item .name { font-size: .88rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.contact-item .preview { font-size: .78rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contacts-chat { flex: 1; min-width: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1rem; display: flex; flex-direction: column; }
.chat-contact-header { font-weight: 600; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.chat-back-btn { display: none; border: none; background: none; font-size: 1.2rem; color: #334155; padding: 0 .25rem 0 0; line-height: 1; }

/* ── Wiadomości (dymki), ten sam wzorzec co frontend/telegram.html, przekolorowane na
   turkus panelu zamiast fioletu ── */
.chat-scroll { flex: 1; min-height: 45vh; max-height: 55vh; overflow-y: auto; padding: .5rem; background: #f8fafc; border-radius: 10px; }
.msg-row { display: flex; margin-bottom: .6rem; }
.msg-row.out { justify-content: flex-end; }
.msg-row.in  { justify-content: flex-start; }
.msg-col { max-width: 75%; display: flex; flex-direction: column; }
.msg-row.out .msg-col { align-items: flex-end; }
.msg-bubble { padding: .5rem .75rem; border-radius: 14px; font-size: .88rem; white-space: pre-wrap; word-break: break-word; }
.msg-bubble.out { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.in  { background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.msg-time { font-size: .68rem; opacity: .6; margin-top: 3px; }
.msg-bubble img { max-width: 100%; border-radius: 8px; margin-top: .25rem; display: block; }

.chat-input-bar { display: flex; gap: .5rem; margin-top: .75rem; align-items: flex-end; }
.chat-input-bar textarea { flex: 1; resize: none; }

.empty-hint { color: #94a3b8; text-align: center; padding: 2rem 1rem; font-size: .9rem; }

/* ══════════════════════════════════════════════════════════════════════════════════════
   Responsywność — sidebar chowany poza ekran <992px, otwierany przyciskiem w topbarze +
   przyciemnione tło (ten sam wzorzec co typowe off-canvas menu), a lista kontaktów/czat
   (jedyny dwukolumnowy widok w panelu) przełącza się na jeden ekran naraz na telefonie,
   z przyciskiem powrotu — panel admina nie ma odpowiednika (sidebar zawsze widoczny), ale
   panel rodzica jest tworzony z myślą o telefonie, więc to świadome rozszerzenie wzorca.
   ══════════════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .sidebar-toggle-btn { display: inline-block; }
}

@media (max-width: 767.98px) {
  .page-body { padding: 1rem; }
  .topbar { padding: .75rem 1rem; }

  .contacts-layout { min-height: 0; }
  .contacts-list, .contacts-chat { width: 100%; }
  .contacts-layout.show-chat .contacts-list { display: none; }
  .contacts-layout:not(.show-chat) .contacts-chat { display: none; }
  .chat-back-btn { display: inline-block; }
  .chat-scroll { max-height: none; flex: 1; }

  .backup-codes-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .login-card { padding: 2rem 1.5rem; }
}
