/*
 * Экраны поверх основы panel.css: сборки из EAS, превью в приложении, журнал, люди, свой вход, первый вход.
 * Только токены из panel.css; исключение — превью телефона и экрана выбора: они рисуют приложение,
 * а оно светлое в любой теме панели.
 */

/* ---------- Сборки в EAS ---------- */

.eas-note {
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
}
.eas-note-error { border-style: solid; border-color: var(--amber-border); background: var(--amber-soft); color: var(--amber-deep); }
.eas { display: flex; flex-direction: column; gap: 8px; padding: 0 24px 18px 160px; }
.eas-title { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.eas-empty { color: var(--text-muted); font-size: 14px; }
.eas-list { display: flex; flex-direction: column; margin: 0; padding: 0; border-top: 1px solid var(--border); list-style: none; }
.eas-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.eas-number { min-width: 40px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.eas-meta { display: flex; min-width: 0; flex: 1 1 320px; flex-direction: column; gap: 2px; }
.eas-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; }
.eas-version { color: var(--text-secondary); font-family: var(--font-mono); font-size: 13px; }
.eas-store { color: var(--text-secondary); }
.eas-store-on { color: var(--emerald-deep); }
.eas-store-warn { color: var(--amber-deep); }
.eas-store-error { color: var(--rose-text); }
.eas-store-muted { color: var(--text-muted); }
.eas-sub { color: var(--text-muted); font-size: 13px; }
.release-hint { max-width: 70ch; color: var(--text-secondary); font-size: 13px; }

/* ---------- Превью в приложении ---------- */

.phone { height: 520px; padding: 10px; border-radius: 40px; background: #1a1a1a; }
.phone-screen {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 14px;
  padding: 32px 24px;
  border-radius: 30px;
  background: #f7f6ef;
  color: #1a1a1a;
}
.phone-screen-center { align-items: center; justify-content: center; text-align: center; }
.phone-icon { display: grid; width: 56px; height: 56px; place-items: center; border-radius: 50%; background: #e6ede7; }
.phone-icon svg { width: 26px; height: 26px; fill: none; stroke: #0f4a3a; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-title { font-size: 18px; font-weight: 600; line-height: 1.3; }
.phone-text { color: #4a564f; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.phone-button { margin-top: 6px; padding: 10px 18px; border: 1px solid #c5c9bb; border-radius: 12px; color: #0f4a3a; font-size: 14px; font-weight: 500; }

.picker { display: flex; flex-direction: column; gap: 14px; padding: 24px 18px; border-radius: 28px; background: var(--board); }
.picker-title { color: var(--chalk-greeting); font-size: 24px; font-weight: 600; line-height: 1.1; text-align: center; }
.picker-list { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: #fbfaf5; color: #1a1a1a; }
.picker-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.picker-tile + .picker-tile { border-top: 1px solid #dcded3; }
.picker-tile .school-badge { width: 36px; height: 36px; background: #e6ede7; color: #0f4a3a; }
.picker-name { display: flex; min-width: 0; flex: 1; flex-direction: column; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.picker-chevron { color: #5b6f65; }
.picker-tile-this { background: #f2f3ec; }
.picker-closed { display: none; color: #8a5b06; font-size: 12px; font-weight: 400; }
.picker-tile-closed { opacity: 0.6; }
.picker-tile-closed .picker-closed { display: inline; }

.warning-box {
  display: flex;
  max-width: 640px;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--rose-border);
  border-radius: var(--radius);
  background: var(--rose-faint);
  color: var(--text-secondary);
  font-size: 14px;
}
.warning-title, .danger-title { color: var(--rose-text); font-size: 15px; font-weight: 500; }

/* ---------- Журнал ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: -16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}
.chip:hover { border-color: var(--focus); color: var(--text); }
.chip[aria-current="true"] { border-color: var(--cta); background: var(--cta); color: var(--cta-ink); }
.chip-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip[aria-current="true"] .chip-count { color: inherit; opacity: 0.8; }
.who { display: flex; align-items: center; gap: 10px; }
.who label { color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.who select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  font: 400 15px var(--font);
}
.days { display: flex; flex-direction: column; gap: 28px; }
.day { display: flex; flex-direction: column; gap: 10px; }
.day-title { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.entries, .people {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  list-style: none;
}
.entry { display: grid; grid-template-columns: 48px 32px minmax(0, 1fr); gap: 0 16px; padding: 14px 20px; }
.entry + .entry { border-top: 1px solid var(--border); }
.entry time { padding-top: 5px; color: var(--text-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.entry-body { display: flex; min-width: 0; flex-direction: column; gap: 6px; padding-top: 4px; }
.entry-body strong { font-weight: 600; }
.entry-lines { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.entry-lines li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--text-secondary); font-size: 14px; }
.was, .now { padding: 1px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.was { background: var(--surface-sunk); color: var(--text-secondary); }
.now { background: var(--emerald-soft); color: var(--emerald-deep); }
.arrow { color: var(--text-muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: -16px; }
.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}
.empty-title { color: var(--text); font-weight: 500; }

/* ---------- Люди ---------- */

.panel-box {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  animation: rise 200ms var(--ease-out) both;
}
.panel-box-success { display: flex; flex-direction: column; gap: 14px; border-color: var(--emerald-border); background: var(--emerald-soft); }
.box-head { display: flex; flex-direction: column; gap: 4px; }
.box-head h2 { font-size: 17px; font-weight: 600; }
.box-head p { max-width: 70ch; color: var(--text-secondary); font-size: 14px; }
.panel-box-success h2 { color: var(--emerald-deep); }
.panel-box-success .box-head p { color: var(--text); }
.copy-row { display: flex; max-width: 760px; flex-wrap: wrap; gap: 8px; }
.copy-input {
  min-width: 0;
  min-height: 44px;
  flex: 1 1 360px;
  padding: 0 14px;
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  font: 400 14px var(--font-mono);
}
.person { scroll-margin-top: 88px; }
.person + .person { border-top: 1px solid var(--border); }
.person-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 16px 20px; }
/* Отключённых приглушаем цветом, а не прозрачностью: так текст не теряет контраст в тёмной теме. */
.person-disabled .person-name, .person-disabled .person-meta dd { color: var(--text-secondary); font-weight: 500; }
.person-disabled .avatar { background: var(--surface-sunk); color: var(--text-secondary); }
.person-who { display: flex; min-width: 0; flex: 1 1 240px; align-items: center; gap: 14px; }
.person-names { display: flex; min-width: 0; flex-direction: column; }
.person-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 600; }
.person-name .tag { padding: 1px 8px; font-size: 12px; }
.person-login { color: var(--text-muted); font: 400 13px var(--font-mono); }
.person-meta { display: flex; flex: 999 1 440px; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.person-meta div { display: flex; min-width: 140px; flex-direction: column; gap: 2px; }
.person-meta dt { color: var(--text-muted); font-size: 13px; }
.person-meta dd { margin: 0; font-size: 14px; }
.person-actions { display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.person-actions form { display: contents; }
.person-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0 20px 16px;
  padding: 14px 16px;
  border: 1px solid var(--rose-border);
  border-radius: var(--radius);
  background: var(--rose-faint);
  animation: rise 200ms var(--ease-out) both;
}
.person-confirm-text { display: flex; flex: 1 1 420px; flex-direction: column; gap: 2px; color: var(--text-secondary); font-size: 14px; }

/* ---------- Мой вход и код ---------- */

.sheet {
  display: flex;
  max-width: 880px;
  flex-direction: column;
  margin-top: -16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.sheet-section { display: flex; flex-direction: column; gap: 16px; padding: 24px; scroll-margin-top: 88px; }
.sheet-section + .sheet-section { border-top: 1px solid var(--border); }
.sheet-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 14px; }
.sheet-head form { display: contents; }
.sheet-icon { display: grid; width: 40px; height: 40px; flex: none; place-items: center; border-radius: var(--radius); background: var(--accent-soft); }
.sheet-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sheet-text { display: flex; min-width: 0; flex: 1 1 380px; flex-direction: column; gap: 2px; }
.sheet-text h2 { font-size: 17px; font-weight: 600; }
.sheet-text p { max-width: 70ch; color: var(--text-secondary); font-size: 14px; }
.phone-setup { display: flex; flex-wrap: wrap; gap: 24px 32px; padding: 20px; border-radius: var(--radius-lg); background: var(--surface-muted); }
.qr { margin: 0; }
.qr img, .setup-qr img { display: block; border: 1px solid var(--border); border-radius: var(--radius); background: #ffffff; }
.phone-setup-form { display: flex; min-width: 0; flex: 1 1 320px; flex-direction: column; gap: 16px; }
.steps-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding-left: 20px; }
.steps-list li { padding-left: 4px; }
.steps-list .field { max-width: 220px; margin-top: 2px; }
.step-note { display: block; margin-top: 6px; color: var(--text-muted); font-size: 13px; }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.key {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}
.field input[name="code"], .field input[name="otp_token"] { font-size: 18px; font-weight: 500; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.codes-box { display: flex; flex-direction: column; gap: 16px; padding: 20px; border: 1px solid var(--amber-border); border-radius: var(--radius-lg); background: var(--amber-soft); }
.codes-warning { color: var(--amber-deep); font-weight: 500; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.codes li { padding: 10px 0; border-radius: var(--radius-sm); background: var(--input); color: var(--text); font: 500 15px var(--font-mono); letter-spacing: 0.04em; text-align: center; }
.password-form { display: flex; flex-direction: column; gap: 16px; }
.reauth-form { display: flex; max-width: 360px; flex-direction: column; gap: 14px; margin-top: 18px; }

/* ---------- Первый вход ---------- */

.greeting-small { font-size: clamp(40px, 5vw, 64px); }
.setup-card { width: min(560px, 100%); }
.setup-head { display: flex; flex-direction: column; gap: 6px; }
.setup-head h1 { font-size: 22px; font-weight: 600; line-height: 1.25; }
.setup-head p { color: var(--text-secondary); font-size: 14px; }
.stepper { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stepper-item { display: flex; flex-direction: column; gap: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.stepper-bar { height: 4px; border-radius: 2px; background: var(--border); }
.stepper-done { color: var(--text); }
.stepper-done .stepper-bar { background: var(--cta); }
.stepper-item[aria-current="step"] { font-weight: 600; }
.setup-qr { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.setup-key { display: flex; min-width: 0; flex: 1 1 200px; flex-direction: column; gap: 6px; }
.setup-card .codes { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 760px) {
  .eas { padding: 0 16px 16px; }
  .entry { grid-template-columns: 44px minmax(0, 1fr); padding: 12px 16px; }
  .entry .avatar { display: none; }
  .person-row { padding: 14px 16px; }
  .person-confirm { margin: 0 16px 14px; }
  .sheet-section { padding: 20px 16px; }
}
