/* Оформление приложения школы. Крупные кнопки под палец, спокойные цвета,
   ничего лишнего на экране занятия */

:root {
  /* палитра взята напрямую с alexeysvetlov.ru, по просьбе Алексея - тот же спокойный, тёплый тон */
  --ink: #23302a;
  --paper: #f0dab8;
  --card: #fffdf8;
  --line: rgba(35, 48, 42, .16);
  --accent: #c1652f;
  --accent-soft: #efc9ae;
  --warm: #c1652f;
  --ok: #3f6355;
  --muted: #52604f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 14px calc(24px + env(safe-area-inset-bottom));
}

.screen[hidden], [hidden] { display: none !important; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top strong { font-size: 19px; }
.pill {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
}
.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.tabbody { padding-top: 6px; }

h1, h2 { line-height: 1.25; }
h2 { font-size: 18px; margin: 22px 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.center { margin: 12vh auto 0; max-width: 420px; text-align: center; }
.logo { font-size: 30px; margin: 0 0 4px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--warm); font-weight: 600; }
.notice {
  background: #fff6ef;
  border: 1px solid #f2c9b6;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: #8a4a2f;
}

.row { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.row.wrap { flex-wrap: wrap; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  min-height: 46px;
}
button.ghost { background: var(--card); color: var(--accent); }
button.big { flex: 1; font-size: 18px; padding: 16px; }
button.icon { min-height: 40px; padding: 6px 12px; background: var(--card); color: var(--accent); }
button.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
#logoutParent { margin-left: auto; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
/* Ссылка, оформленная как кнопка (например, на официальный банк заданий
   ФИПИ, открывается в новой вкладке) - button.* правила выше не подходят
   тегу <a>, поэтому тот же стиль повторён отдельно */
a.ghost {
  display: inline-flex;
  align-items: center;
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  text-decoration: none;
}
a.ghost.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 46px;
  width: 100%;
}
textarea { min-height: 96px; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.pwd-row { display: flex; gap: 8px; align-items: stretch; }
.pwd-row input { flex: 1; min-width: 0; }
.pwd-row .pwd-toggle { flex: none; }
.field-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 5px; }
/* Выбор даты тремя списками (день/месяц/год) вместо календаря с пролистыванием
   месяцев - раздражает при дате рождения, далёкой от сегодня. Общий принцип
   для ЛЮБОГО поля даты в приложении, не только даты рождения */
.date-picker { display: flex; gap: 6px; }
.date-picker select { flex: none; }
.date-picker .dp-day { flex-basis: 64px; }
.date-picker .dp-month { flex: 1; min-width: 0; }
.date-picker .dp-year { flex-basis: 84px; }
.check { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.check input { width: 22px; min-height: 22px; }

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  margin: 12px 0;
}
.msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.msg.system { align-self: center; background: var(--accent-soft); color: var(--accent); font-size: 15px; }

.ask { display: flex; gap: 10px; }
.ask input { flex: 1; }

.praise {
  background: #eaf7f3;
  border: 1px solid #b9e3d8;
  color: #1f6f62;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 10px 0;
  font-weight: 600;
}

.list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.item button { min-height: 38px; padding: 6px 12px; font-size: 15px; }

.videobox { margin: 16px 0; }
.videobox iframe, .videoitem iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: #000;
}
.videoitem { margin: 14px 0; }
.source { font-size: 14px; color: var(--muted); margin-top: 4px; }

.report {
  white-space: pre-wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font: inherit;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 61, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}
.modal .card { width: 100%; max-width: 440px; }
.modal[hidden] { display: none; }

/* поздравление с днём рождения: тот же блок похвалы, но теплее */
.praise.birthday {
  background: #fff3e6;
  border-color: #f0c99a;
  color: #8a5a1f;
}

/* строка ученика в списке: подпись сверху, кнопки снизу */
#childrenList .item { flex-direction: column; align-items: stretch; }
#childrenList .item .row { margin: 8px 0 0; }

/* мониторинг: список источников в столбик, а не в одну строку таблицей */
#monResult .item { flex-direction: column; align-items: stretch; gap: 6px; }
#monResult .item a, #monResult .item div { word-break: break-word; }

.picker { width: auto; max-width: 55%; min-height: 40px; padding: 8px 10px; }

.linklike {
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  min-height: 0;
}

.danger { color: #a3341f; font-weight: 600; }
button.danger-btn { background: #a3341f; border-color: #a3341f; color: #fff; }

.item.link { justify-content: flex-start; text-align: left; color: var(--ink); }

/* Короткое подтверждение "Сохранено" и подобное - строится сам в app.js (showToast) */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  background: var(--ok);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f7;
    --paper: #12161f;
    --card: #1b2130;
    --line: #2c3448;
    --accent: #7aa2d8;
    --accent-soft: #232c40;
    --muted: #9aa5bd;
  }
  button.primary, .msg.user { color: #101520; }
  .notice { background: #2a2118; border-color: #4a3a28; color: #e8c9ae; }
  .praise { background: #172a26; border-color: #27453e; color: #8fd3c4; }
  .praise.birthday { background: #2c2415; border-color: #4d3f24; color: #e7c489; }
  .danger { color: #f0937d; }
}
