﻿/* ==========================================================================
   ЕДИНЫЙ СЛОЙ: слои модалок, типографика, оформления интерфейса
   Подключается последним.
   ========================================================================== */

:root {
  --z-modal: 10000;
  --z-toast: 20000;
  --z-popover: 20500;
  --z-progress: 21000;
}

/* Все модалки — один слой. Кто открыт позже, тот выше по DOM. */
.modal { z-index: var(--z-modal) !important; }
#settingsModal, #participantCardModal, #studentJournalModal { z-index: var(--z-modal) !important; }
#toastStack { z-index: var(--z-toast) !important; }
 .score-context-menu, .journal-context-menu, .sc-picker, .cm-popover { z-index: var(--z-popover) !important; }
#topProgress { z-index: var(--z-progress) !important; }

/* Чуть крупнее базовая типографика: мелкие подписи больше не «микроскоп». */
html { font-size: 17px; }
body { font-size: .95rem; }
input, select, textarea, button { font-size: max(.82rem, 13px); }
.cx-head__meta, .summary-label, .filter-label, .form-group label { font-size: .8rem; }
.small, .text-small, .cx-hint { font-size: .8rem; }
table { font-size: .86rem; }
th { letter-spacing: .035em; }

/* ---------- Оформления (не темы светлая/тёмная, а характер интерфейса) ---------- */
body[data-design="soft"]:not(.dark-theme) {
  --c-bg: #f5f4ff;
  --c-surface: #ffffff;
  --c-surface-2: #f8f7ff;
  --c-border: #e8e5f5;
  --c-border-strong: #d8d2ee;
  --c-brand: #6366f1;
  --c-brand-2: #4f46e5;
  --c-brand-soft: #eeeafe;
  --c-radius: 18px;
  --c-radius-sm: 13px;
  --c-radius-lg: 26px;
  --c-shadow: 0 10px 30px -12px rgba(79, 70, 229, .18);
  --c-ring: 0 0 0 3px rgba(99, 102, 241, .22);
}
body[data-design="soft"].dark-theme {
  --c-brand: #818cf8;
  --c-brand-2: #6366f1;
  --c-brand-soft: #1e1b3a;
  --c-radius: 18px;
  --c-radius-sm: 13px;
  --c-radius-lg: 26px;
}
body[data-design="official"]:not(.dark-theme) {
  --c-bg: #eef1f5;
  --c-surface: #ffffff;
  --c-surface-2: #f6f7f9;
  --c-border: #d9dee7;
  --c-border-strong: #c3cbd8;
  --c-brand: #1e3a5f;
  --c-brand-2: #152c49;
  --c-brand-soft: #e8eef6;
  --c-text: #172033;
  --c-text-2: #40506a;
  --c-radius: 6px;
  --c-radius-sm: 5px;
  --c-radius-lg: 9px;
  --c-shadow: 0 1px 2px rgba(23, 32, 51, .08);
  --c-ring: 0 0 0 3px rgba(30, 58, 95, .18);
  --c-font: 'Georgia', 'Times New Roman', serif;
}
body[data-design="official"].dark-theme {
  --c-brand: #b08d57;
  --c-brand-2: #947342;
  --c-brand-soft: #2a2418;
  --c-radius: 6px;
  --c-radius-sm: 5px;
  --c-radius-lg: 9px;
  --c-font: 'Georgia', 'Times New Roman', serif;
}
body[data-design="official"] .content-header h1,
body[data-design="official"] .cx-head__title h2 { font-family: Georgia, 'Times New Roman', serif; letter-spacing: 0; }

body[data-design="contrast"]:not(.dark-theme) {
  --c-bg: #f2f2ef;
  --c-surface: #ffffff;
  --c-surface-2: #f4f4f0;
  --c-border: #d4d4cf;
  --c-border-strong: #a3a39a;
  --c-brand: #0f766e;
  --c-brand-2: #115e59;
  --c-brand-soft: #d9f3ef;
  --c-text: #101010;
  --c-text-2: #333333;
  --c-radius: 2px;
  --c-radius-sm: 2px;
  --c-radius-lg: 3px;
  --c-shadow: none;
  --c-ring: 0 0 0 3px rgba(15, 118, 110, .28);
}
body[data-design="contrast"].dark-theme {
  --c-brand: #2dd4bf;
  --c-brand-2: #14b8a6;
  --c-brand-soft: #10312e;
  --c-radius: 2px;
  --c-radius-sm: 2px;
  --c-radius-lg: 3px;
}
body[data-design="contrast"] .cx-card,
body[data-design="contrast"] .cx-btn { border-width: 1.5px; }

body[data-design="emerald"]:not(.dark-theme) {
  --c-bg: #f1faf7;
  --c-surface: #ffffff;
  --c-surface-2: #f4fcf9;
  --c-border: #d7ece5;
  --c-border-strong: #b9ddd1;
  --c-brand: #0f766e;
  --c-brand-2: #0b5f59;
  --c-brand-soft: #dcf5ed;
  --c-text: #0f2b26;
  --c-radius: 16px;
  --c-radius-sm: 11px;
  --c-radius-lg: 24px;
  --c-shadow: 0 8px 24px -14px rgba(15, 118, 110, .25);
  --c-ring: 0 0 0 3px rgba(15, 118, 110, .2);
}
body[data-design="emerald"].dark-theme {
  --c-brand: #34d399;
  --c-brand-2: #10b981;
  --c-brand-soft: #0c2f28;
  --c-radius: 16px;
  --c-radius-sm: 11px;
  --c-radius-lg: 24px;
}

body[data-design="graphite"]:not(.dark-theme) {
  --c-bg: #f3f4f6;
  --c-surface: #ffffff;
  --c-surface-2: #f7f7f8;
  --c-border: #e2e3e6;
  --c-border-strong: #c8cacf;
  --c-brand: #475569;
  --c-brand-2: #334155;
  --c-brand-soft: #eceef1;
  --c-warning: #b45309;
  --c-radius: 9px;
  --c-radius-sm: 7px;
  --c-radius-lg: 14px;
  --c-shadow: 0 2px 6px rgba(15, 23, 42, .06);
  --c-ring: 0 0 0 3px rgba(71, 85, 105, .2);
}
body[data-design="graphite"].dark-theme {
  --c-brand: #cbd5e1;
  --c-brand-2: #94a3b8;
  --c-brand-soft: #263243;
  --c-radius: 9px;
  --c-radius-sm: 7px;
  --c-radius-lg: 14px;
}

/* Лёгкий характер для карточек и навигации в разных оформлениях */
body[data-design="soft"] .cx-card,
body[data-design="soft"] .nav-item,
body[data-design="soft"] .tpx-day { border-radius: var(--c-radius); }
body[data-design="official"] .nav-item { border-radius: 4px; }
body[data-design="contrast"] .nav-item.active { box-shadow: none; }
body[data-design="graphite"] .cx-btn { font-weight: 650; }

/* ---------- Настройки: выбор оформления ---------- */
.design-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.design-card { border: 1.5px solid var(--c-border); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--c-surface); text-align: left; transition: border-color .15s, box-shadow .15s; }
.design-card:hover { border-color: var(--c-brand); }
.design-card.is-active { border-color: var(--c-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-brand) 18%, transparent); }
.design-card__preview { height: 42px; border-radius: 7px; margin-bottom: 8px; display: flex; gap: 4px; padding: 6px; align-items: center; }
.design-card__preview span { display: block; height: 100%; border-radius: 3px; }
.design-card__preview span:first-child { width: 22%; }
.design-card__preview span:last-child { flex: 1; }
.design-card b { display: block; font-size: .8rem; }
.design-card small { display: block; color: var(--c-muted); font-size: .7rem; margin-top: 2px; line-height: 1.3; }
.design-scale { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.design-scale input[type="range"] { flex: 1; accent-color: var(--c-brand); }
.design-scale b { min-width: 42px; text-align: right; font-size: .82rem; }

@media (max-width: 900px) { .design-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .design-grid { grid-template-columns: 1fr; } }

/* ---------- Единая мини-модалка вместо alert ---------- */
.mini-alert { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(9, 14, 26, .55); backdrop-filter: blur(4px); z-index: var(--z-toast); }
.mini-alert__box { width: min(420px, 100%); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; box-shadow: var(--c-shadow-lg); padding: 22px; text-align: center; animation: mini-in .16s ease-out; }
.mini-alert__icon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.mini-alert__icon.is-error { background: rgba(220, 38, 38, .12); color: var(--c-danger); }
.mini-alert__icon.is-warning { background: rgba(217, 119, 6, .14); color: var(--c-warning); }
.mini-alert__icon.is-success { background: rgba(5, 150, 105, .12); color: var(--c-success); }
.mini-alert__icon.is-info { background: var(--c-brand-soft); color: var(--c-brand); }
.mini-alert__box h3 { margin: 0 0 7px; font-size: 1rem; }
.mini-alert__box p { margin: 0 0 16px; color: var(--c-text-2); font-size: .86rem; line-height: 1.5; word-break: break-word; }
.mini-alert__box button { min-width: 110px; }
@keyframes mini-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Плашки и таблицы не должны уменьшаться до нечитаемого */
.cx-table th, .cx-table td { font-size: .86rem; }
.cx-empty, .tpx-empty { font-size: .86rem; }

.mini-alert__input { width: 100%; height: 40px; border: 1px solid var(--c-border); border-radius: 9px; background: var(--c-surface); color: var(--c-text); padding: 0 11px; font: inherit; margin: 0 0 14px; }
.mini-alert__input:focus { outline: none; border-color: var(--c-brand); box-shadow: var(--c-ring); }
.mini-alert__actions { display: flex; gap: 8px; justify-content: center; }

/* Кастомные оверлеи логистики и разработки — тот же слой, что и .modal */
.lg-modal, .dv-dialog { z-index: var(--z-modal) !important; }

