/* Мобильные интерфейсы преподавателя и родителя. Все классы — с префиксом m-, корень — .m-app */

.m-app {
  --m-accent: #2f6fed;
  --m-accent-dark: #1f56c9;
  --m-accent-soft: #e8f0fe;
  --m-bg: #f2f4f8;
  --m-card: #ffffff;
  --m-text: #1a2030;
  --m-muted: #6b7386;
  --m-border: #e3e7ee;
  --m-green: #188a4e; --m-green-soft: #e3f5ea;
  --m-red: #d93a34; --m-red-soft: #fdeceb;
  --m-amber: #b86e00; --m-amber-soft: #fff3dc;
  --m-blue: #2f6fed; --m-blue-soft: #e8f0fe;
  --m-violet: #7446d6; --m-violet-soft: #f0eafd;
  --m-gray: #5f6778; --m-gray-soft: #eef0f4;
  --m-radius: 14px;
  --m-header-h: 56px;
  --m-nav-h: 60px;
  --m-safe-top: env(safe-area-inset-top, 0px);
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
  --m-shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 1px 8px rgba(20, 30, 60, .04);

  min-height: 100vh;
  min-height: 100dvh;
  background: var(--m-bg);
  color: var(--m-text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}
:where(.m-app) *, :where(.m-app) *::before, :where(.m-app) *::after { box-sizing: border-box; }
:where(.m-app) h1, :where(.m-app) h2, :where(.m-app) h3, :where(.m-app) p { margin: 0; }
:where(.m-app) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
:where(.m-app) button:disabled { cursor: default; }
:where(.m-app) a { color: var(--m-accent); text-decoration: none; }
:where(.m-app) input, :where(.m-app) textarea, :where(.m-app) select { font: inherit; color: inherit; margin: 0; }
:where(.m-app) :focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; }
.m-app [hidden] { display: none !important; }

/* ---------- Шапка ---------- */
.m-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px;
  min-height: calc(var(--m-header-h) + var(--m-safe-top));
  padding: var(--m-safe-top) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, .98);
  -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--m-border);
}
.m-header-gap { width: 8px; flex: none; }
.m-header-title { flex: 1; min-width: 0; padding: 6px 0; }
.m-header-title h1 { font-size: 19px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-header-sub { font-size: 13px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-header-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.m-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 12px; color: var(--m-text);
}
.m-icon-btn:active { background: var(--m-gray-soft); }
.m-icon-btn:disabled { opacity: .35; }
.m-icon-btn.is-active { color: var(--m-accent); background: var(--m-accent-soft); }
.m-icon-btn.is-spinning .m-icon { animation: m-spin .8s linear infinite; }
.m-icon-btn-filled { background: var(--m-green-soft); color: var(--m-green) !important; border-radius: 50%; }
.m-link-btn { color: var(--m-accent) !important; font-weight: 600; font-size: 15px; padding: 10px 8px !important; min-height: 44px; white-space: nowrap; }
.m-link-btn:disabled { opacity: .5; }

/* ---------- Содержимое ---------- */
.m-page { min-height: 100vh; }
.m-content {
  max-width: 640px; margin: 0 auto;
  padding: 12px max(14px, env(safe-area-inset-right, 0px)) calc(var(--m-nav-h) + var(--m-safe-bottom) + 24px) max(14px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.m-content.has-footer { padding-bottom: calc(var(--m-nav-h) + var(--m-safe-bottom) + 96px); }

.m-footer {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--m-nav-h) + var(--m-safe-bottom));
  background: #fff;
  border-top: 1px solid var(--m-border);
  box-shadow: 0 -4px 16px rgba(20, 30, 60, .06);
  padding: 10px 14px;
}
.m-footer > * { max-width: 612px; margin: 0 auto; }

/* ---------- Нижняя навигация ---------- */
.m-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  padding: 0 env(safe-area-inset-right, 0px) var(--m-safe-bottom) env(safe-area-inset-left, 0px);
  background: rgba(255, 255, 255, .97);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--m-border);
}
.m-nav-item {
  flex: 1; max-width: 128px; height: var(--m-nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--m-muted) !important; font-size: 11px; font-weight: 600; letter-spacing: .01em;
}
.m-nav-item.is-active { color: var(--m-accent) !important; }
.m-nav-item:active .m-nav-icon { transform: scale(.92); }
.m-nav-icon { position: relative; display: inline-flex; padding: 2px 14px; border-radius: 14px; transition: background .15s; }
.m-nav-item.is-active .m-nav-icon { background: var(--m-accent-soft); }
.m-nav-badge {
  position: absolute; top: -4px; left: 50%; margin-left: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--m-red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
  border: 2px solid #fff; box-sizing: content-box;
}
.m-nav-label { white-space: nowrap; }

/* ---------- Карточки, списки ---------- */
.m-card {
  background: var(--m-card); border-radius: var(--m-radius); box-shadow: var(--m-shadow);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; position: relative;
}
.m-card.has-accent { border-left: 5px solid var(--m-accent); padding-left: 12px; }
.m-card.is-tappable { cursor: pointer; }
.m-card.is-tappable:active { background: #f7f9fc; }
.m-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.m-card-title { font-weight: 700; font-size: 16px; }
.m-card-list { padding: 4px 0; gap: 0; }
.m-card-list > .m-card-head { padding: 8px 14px 0; }
.m-card-warn { background: #fff8f7; box-shadow: inset 0 0 0 1.5px #f6c7c4; }
.m-list { display: flex; flex-direction: column; gap: 8px; }

.m-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; min-height: 32px; }
.m-section-title h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--m-muted); }
.m-section-title .m-link-btn { padding: 6px 4px !important; min-height: 32px; font-size: 14px; }

.m-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 8px 14px; color: var(--m-text) !important; text-align: left;
}
.m-row + .m-row { border-top: 1px solid var(--m-border); }
.m-row.is-tappable:active { background: #f5f7fb; }
.m-row-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--m-gray-soft); color: var(--m-gray); flex: none; }
.m-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-row-title { font-weight: 600; }
.m-row-sub { font-size: 13px; color: var(--m-muted); }
.m-row-right { flex: none; display: flex; align-items: center; }
.m-row-chevron { color: #a9b0bd; flex: none; }
.m-check { color: var(--m-accent); }
.m-count { min-width: 24px; height: 24px; border-radius: 12px; background: var(--m-red); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; }

/* ---------- Кнопки ---------- */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px;
  font-weight: 600; font-size: 15px; line-height: 1.2; text-align: center !important;
  transition: background .15s, transform .05s; user-select: none;
}
.m-btn:active:not(:disabled) { transform: scale(.98); }
.m-btn:disabled { opacity: .55; }
.m-btn-primary { background: var(--m-accent) !important; color: #fff !important; }
.m-btn-primary:active:not(:disabled) { background: var(--m-accent-dark) !important; }
.m-btn-secondary { background: var(--m-accent-soft) !important; color: var(--m-accent) !important; }
.m-btn-ghost { background: transparent; color: var(--m-text) !important; }
.m-btn-ghost:active { background: var(--m-gray-soft) !important; }
.m-btn-danger { background: var(--m-red-soft) !important; color: var(--m-red) !important; }
.m-btn-success { background: var(--m-green-soft) !important; color: var(--m-green) !important; }
.m-btn-sm { min-height: 38px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.m-btn-lg { min-height: 52px; font-size: 16px; padding: 12px 20px; border-radius: 14px; }
.m-btn-block { display: flex; width: 100%; }
.m-stack { display: flex; flex-direction: column; gap: 8px; }
.m-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Бейджи, тона ---------- */
.m-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; vertical-align: middle; }
.m-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.m-tone-green { background: var(--m-green-soft); color: var(--m-green); }
.m-tone-red { background: var(--m-red-soft); color: var(--m-red); }
.m-tone-amber { background: var(--m-amber-soft); color: var(--m-amber); }
.m-tone-blue { background: var(--m-blue-soft); color: var(--m-blue); }
.m-tone-violet { background: var(--m-violet-soft); color: var(--m-violet); }
.m-tone-gray { background: var(--m-gray-soft); color: var(--m-gray); }
.m-text-green { color: var(--m-green) !important; }
.m-text-red { color: var(--m-red) !important; }
.m-text-accent { color: var(--m-accent) !important; }
.m-muted { color: var(--m-muted); }
.m-small { font-size: 13px; }
.m-pad { padding: 4px 4px; }
.m-center { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; }
.m-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--m-accent); flex: none; }
.m-dot-amber { background: #f0a000; }
.m-unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--m-accent); flex: none; margin-top: 6px; }

/* ---------- Алерты ---------- */
.m-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.m-alert .m-icon { flex: none; margin-top: 1px; }
.m-alert-red { background: var(--m-red-soft); color: #9b221d; }
.m-alert-amber { background: var(--m-amber-soft); color: #8a5200; }
.m-alert-blue { background: var(--m-blue-soft); color: #1d4aa8; }
.m-inline-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--m-red-soft); color: var(--m-red); font-size: 14px; }
.m-inline-error span { flex: 1; }
.m-inline-error button { font-weight: 700; color: var(--m-red); min-height: 36px; padding: 0 6px; }

/* ---------- Пустые состояния, загрузка ---------- */
.m-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px; gap: 8px; }
.m-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--m-accent-soft); color: var(--m-accent); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.m-empty-title { font-size: 18px; font-weight: 700; }
.m-empty-text { color: var(--m-muted); font-size: 15px; max-width: 320px; }
.m-empty-action { margin-top: 8px; }

.m-spinner { display: inline-block; width: 28px; height: 28px; border: 3px solid rgba(47, 111, 237, .2); border-top-color: var(--m-accent); border-radius: 50%; animation: m-spin .8s linear infinite; flex: none; }
.m-spinner.is-small { width: 18px; height: 18px; border-width: 2px; border-color: rgba(127, 127, 127, .3); border-top-color: currentColor; }
@keyframes m-spin { to { transform: rotate(360deg); } }

.m-skeleton { display: flex; flex-direction: column; gap: 8px; }
.m-skel-card { gap: 10px; }
.m-skel { background: linear-gradient(90deg, #e9edf3 0%, #f5f7fa 50%, #e9edf3 100%); background-size: 200% 100%; animation: m-shimmer 1.2s ease-in-out infinite; border-radius: 8px; }
.m-skel-line { height: 16px; }
.m-skel-line.is-short { width: 40%; height: 12px; }
.m-skel-stats .m-stat { height: 58px; }
@keyframes m-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Тосты ---------- */
.m-toasts {
  position: fixed; left: 0; right: 0; z-index: 100; pointer-events: none;
  top: calc(var(--m-safe-top, env(safe-area-inset-top, 0px)) + 64px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
.m-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: 100%;
  padding: 12px 16px; border-radius: 14px; color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(10, 20, 40, .22); animation: m-toast-in .2s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.m-toast-ok { background: #17803f; }
.m-toast-error { background: #c9302a; }
.m-toast-info { background: #2a3448; }

.m-toast .m-icon { flex: none; }
@keyframes m-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Bottom sheet ---------- */
.m-sheet-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(12, 18, 32, .45); display: flex; align-items: flex-end; justify-content: center; animation: m-fade .15s; }
.m-sheet {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; animation: m-sheet-in .22s ease-out;
  padding-bottom: var(--m-safe-bottom);
}
.m-sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: #d5dae3; margin: 8px auto 0; flex: none; }
.m-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 18px; flex: none; }
.m-sheet-head h3 { font-size: 18px; font-weight: 700; }
.m-sheet-body { overflow-y: auto; padding: 4px 18px 16px; -webkit-overflow-scrolling: touch; }
.m-sheet-footer { padding: 10px 18px 14px; border-top: 1px solid var(--m-border); flex: none; }
@keyframes m-fade { from { opacity: 0; } }
@keyframes m-sheet-in { from { transform: translateY(40px); opacity: .6; } }

/* ---------- Формы ---------- */
.m-form { display: flex; flex-direction: column; gap: 14px; }
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-field-label { font-size: 14px; font-weight: 600; color: #3b4356; }
.m-field-hint { font-size: 13px; color: var(--m-muted); }
.m-field-error { font-size: 13px; color: var(--m-red); font-weight: 600; }
.m-input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid #d6dbe4; background: #fff; font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
.m-input:focus { border-color: var(--m-accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, .15); }
.m-input:disabled, .m-input[readonly] { background: #f3f5f8; color: var(--m-muted); }
.m-field.has-error .m-input { border-color: var(--m-red); }
.m-textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
.m-select { background-image: linear-gradient(45deg, transparent 50%, #6b7386 50%), linear-gradient(135deg, #6b7386 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.m-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-field-wrap { display: flex; flex-direction: column; }

.m-toggle { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; cursor: pointer; position: relative; }
.m-card .m-toggle { padding-left: 0; padding-right: 0; }
.m-card-list .m-toggle { padding: 8px 14px; }
.m-toggle + .m-toggle { border-top: 1px solid var(--m-border); }
.m-toggle-text { flex: 1; display: flex; flex-direction: column; font-weight: 600; }
.m-toggle-text small { font-weight: 400; color: var(--m-muted); font-size: 13px; }
.m-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-toggle-ui { width: 50px; height: 30px; border-radius: 15px; background: #cfd5df; position: relative; transition: background .2s; flex: none; }
.m-toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.m-toggle input:checked + .m-toggle-ui { background: var(--m-green); }
.m-toggle input:checked + .m-toggle-ui::after { transform: translateX(20px); }
.m-toggle input:focus-visible + .m-toggle-ui { outline: 2px solid var(--m-accent); outline-offset: 2px; }

/* ---------- Сегменты, чипы ---------- */
.m-seg { display: flex; background: #e6e9ef; border-radius: 12px; padding: 3px; gap: 2px; }
.m-seg-item { flex: 1; min-height: 38px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #4a5263 !important; text-align: center !important; padding: 0 6px !important; }
.m-seg-item.is-active { background: #fff; color: var(--m-text) !important; box-shadow: 0 1px 3px rgba(20, 30, 60, .12); }
.m-tabs { margin-top: 2px; }

.m-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px; -webkit-overflow-scrolling: touch; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 38px; padding: 0 14px !important;
  border-radius: 19px; background: #fff; border: 1.5px solid var(--m-border) !important; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.m-chip.is-active { background: var(--m-accent); border-color: var(--m-accent) !important; color: #fff !important; }
.m-checks { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Полоска дат, месяц ---------- */
.m-sticky-tools {
  position: sticky; top: calc(var(--m-header-h) + var(--m-safe-top)); z-index: 20;
  margin: -12px -14px 0; padding: 8px 14px 10px; background: var(--m-bg);
  display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--m-border);
}
.m-datestrip { display: flex; align-items: center; gap: 2px; margin: 0 -8px; }
.m-datestrip-arrow { width: 36px; height: 56px; color: var(--m-muted); }
.m-datestrip-days { flex: 1; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 0; -webkit-overflow-scrolling: touch; }
.m-datestrip-days::-webkit-scrollbar { display: none; }
.m-day {
  flex: none; width: 46px; height: 62px; border-radius: 14px; background: #fff; scroll-snap-align: center;
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center !important;
  box-shadow: var(--m-shadow);
}
.m-day.is-monday { margin-left: 6px; }
.m-day-wd { font-size: 11px; font-weight: 600; color: var(--m-muted); text-transform: uppercase; }
.m-day-num { font-size: 18px; font-weight: 700; }
.m-day-dots { display: flex; gap: 3px; height: 6px; }
.m-day-dots i { width: 5px; height: 5px; border-radius: 50%; }
.m-day.is-today .m-day-num { color: var(--m-accent); }
.m-day.is-today { box-shadow: inset 0 0 0 1.5px var(--m-accent); }
.m-day.is-selected { background: var(--m-accent); box-shadow: 0 4px 12px rgba(47, 111, 237, .35); }
.m-day.is-selected .m-day-wd, .m-day.is-selected .m-day-num { color: #fff; }
.m-day.is-selected .m-day-dots i { background: #fff !important; }

.m-month { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 14px; box-shadow: var(--m-shadow); padding: 2px; }
.m-month-label { font-weight: 700; font-size: 17px; }

.m-week-day.is-today .m-section-title h2 { color: var(--m-accent); }

/* ---------- Статистика ---------- */
.m-stats { display: grid; gap: 8px; }
.m-stats-3 { grid-template-columns: repeat(3, 1fr); }
.m-stats-5 { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.m-stat { background: #fff; border-radius: 12px; box-shadow: var(--m-shadow); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.m-stat b { font-size: 20px; line-height: 1.2; white-space: nowrap; }
.m-stat span { font-size: 12px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.m-stats-3 .m-stat b { font-size: 17px; }
.m-stat.m-tone-green b { color: var(--m-green); }
.m-stat.m-tone-red b { color: var(--m-red); }
.m-stat.m-tone-amber b { color: var(--m-amber); }
.m-stat.m-tone-blue b { color: var(--m-blue); }
.m-stat.m-tone-violet b { color: var(--m-violet); }
.m-stat[class*="m-tone-"] { background: #fff; }

/* ---------- Занятия ---------- */
.m-lesson { flex-direction: row; align-items: center; gap: 12px; }
.m-lesson-time { display: flex; flex-direction: column; align-items: flex-start; min-width: 50px; flex: none; }
.m-lesson-time b { font-size: 18px; font-weight: 700; line-height: 1.1; }
.m-lesson-time span { font-size: 13px; color: var(--m-muted); }
.m-lesson-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-lesson-name { font-weight: 700; font-size: 16px; }
.m-lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--m-muted); }
.m-lesson-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.m-lesson-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 3px; }
.m-lesson-note { font-size: 13px; color: #4a5263; }
.m-lesson.is-off .m-lesson-time b, .m-lesson.is-off .m-lesson-name { text-decoration: line-through; color: var(--m-muted); }
.m-lesson.is-off { background: #fafbfc; }
.m-marked { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--m-muted); }
.m-marked.is-done { color: var(--m-green); }
.m-marked.is-warn { color: var(--m-amber); }
.m-section-card { flex-direction: row; align-items: center; }
.m-section-card-main { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-day-group { display: flex; flex-direction: column; gap: 8px; }
.m-day-group-title { font-weight: 700; font-size: 15px; padding: 4px 2px 0; }
.m-day-group-title small { color: var(--m-muted); font-weight: 500; }

/* ---------- Экран занятия ---------- */
.m-lesson-head-date { font-size: 18px; font-weight: 700; }
.m-topic { display: flex; align-items: center; gap: 10px; padding: 10px 12px !important; border-radius: 12px; background: #f5f7fb !important; min-height: 52px; width: 100%; }
.m-topic > span { display: flex; flex-direction: column; min-width: 0; }
.m-topic small { color: var(--m-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-topic .m-icon { color: var(--m-accent); flex: none; }
.m-bulk { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-bulk .m-btn { font-size: 13px; padding: 8px 8px; min-height: 44px; }

.m-mark { background: #fff; border-radius: var(--m-radius); box-shadow: var(--m-shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; border-left: 5px solid #d4d9e2; }
.m-mark.is-present { border-left-color: var(--m-green); }
.m-mark.is-absent { border-left-color: var(--m-red); }
.m-mark.is-excused { border-left-color: #f0a000; }
.m-mark.is-late { border-left-color: var(--m-blue); }
.m-mark.is-trial { border-left-color: var(--m-violet); }
.m-mark.is-changed { box-shadow: var(--m-shadow), inset 0 0 0 1.5px #f3c56b; }
.m-mark-head { display: flex; align-items: center; gap: 10px; }
.m-mark-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-mark-name b { font-size: 16px; line-height: 1.25; }
.m-mark-name span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--m-muted); }
.m-mark-seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.m-mark-btn {
  min-height: 46px; border-radius: 10px; background: #f0f2f6 !important; color: #3b4356 !important;
  font-size: 13px; font-weight: 700; text-align: center !important; padding: 0 2px !important; line-height: 1.1;
  transition: background .12s, color .12s; border: 1.5px solid transparent !important;
}
.m-mark-btn:active:not(:disabled) { transform: scale(.96); }
.m-mark-btn:disabled { opacity: .5; }
.m-mark-present.is-active { background: var(--m-green) !important; color: #fff !important; }
.m-mark-absent.is-active { background: var(--m-red) !important; color: #fff !important; }
.m-mark-excused.is-active { background: #e59400 !important; color: #fff !important; }
.m-mark-late.is-active { background: var(--m-blue) !important; color: #fff !important; }
.m-mark-trial.is-active { background: var(--m-violet) !important; color: #fff !important; }
.m-mark-comment .m-textarea { min-height: 60px; }
.m-mark-comment-text { font-size: 14px; color: #4a5263; font-style: italic; text-align: left; padding: 2px 0 !important; }

.m-savebar { display: flex; align-items: center; gap: 12px; }
.m-savebar-state { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-weight: 600; font-size: 14px; }
.m-savebar-state small { width: 100%; font-weight: 500; color: var(--m-muted); font-size: 13px; }
.m-savebar-state.is-saved { color: var(--m-green); }
.m-savebar-state.is-dirty { color: var(--m-amber); }
.m-savebar .m-btn { min-width: 140px; }

.m-med { background: var(--m-red-soft); color: #9b221d; border-radius: 10px; padding: 8px 10px; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.m-med-inline { flex-direction: row; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 10px; }
.m-med-inline .m-icon { flex: none; margin-top: 2px; }

/* ---------- Ученики секции ---------- */
.m-student { padding: 0; gap: 0; overflow: hidden; }
.m-student-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px !important; text-align: left; }
.m-student-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-student-name { font-weight: 700; }
.m-student-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--m-muted); }
.m-student-stats { display: flex; gap: 12px; font-size: 13px; font-weight: 600; }
.m-student .m-med { margin: 0 14px 12px; }
.m-student-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--m-border); padding-top: 10px; }
.m-rotate { transition: transform .2s; }
.is-open .m-rotate { transform: rotate(180deg); }
.m-contact { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.m-contact + .m-contact { border-top: 1px solid var(--m-border); padding-top: 6px; }
.m-contact > span { display: flex; flex-direction: column; min-width: 0; }
.m-contact small { color: var(--m-muted); font-size: 13px; }

.m-kv { display: flex; flex-direction: column; gap: 8px; }
.m-kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.m-kv > div > span { color: var(--m-muted); flex: none; max-width: 45%; }
.m-kv > div > b { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.m-kv-table > div { padding: 2px 0; }
.m-kv-table > div.is-strong { border-top: 1px solid var(--m-border); padding-top: 8px; font-size: 16px; }
.m-kv-table > div.is-strong b { font-weight: 800; }
.m-kv-table > div.is-green b { color: var(--m-green); }
.m-kv-table > div.is-red b { color: var(--m-red); }

/* ---------- Матрица посещаемости ---------- */
.m-matrix-wrap { overflow-x: auto; background: #fff; border-radius: var(--m-radius); box-shadow: var(--m-shadow); -webkit-overflow-scrolling: touch; }
.m-matrix { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
.m-matrix th, .m-matrix td { padding: 0; text-align: center; border-bottom: 1px solid var(--m-border); white-space: nowrap; }
.m-matrix thead th { font-size: 12px; color: var(--m-muted); font-weight: 600; background: #fafbfd; }
.m-matrix thead th button { display: flex; flex-direction: column; align-items: center; width: 100%; min-width: 42px; padding: 8px 4px !important; text-align: center !important; }
.m-matrix thead th small { text-transform: uppercase; font-size: 10px; }
.m-matrix thead th.is-today { color: var(--m-accent); }
.m-matrix td { min-width: 42px; height: 44px; font-weight: 700; font-size: 15px; }
.m-matrix td.is-future { background: repeating-linear-gradient(45deg, #fff, #fff 4px, #f7f8fa 4px, #f7f8fa 8px); }
.m-matrix .m-matrix-name { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left; padding: 0 10px; font-weight: 600; font-size: 14px; max-width: 128px; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--m-border); }
.m-matrix thead .m-matrix-name { background: #fafbfd; }
.m-matrix-total { padding: 0 10px !important; font-size: 14px !important; }
.m-matrix-total small { display: block; font-size: 11px; color: var(--m-muted); font-weight: 600; }
.m-cell-green { color: var(--m-green); background: var(--m-green-soft); }
.m-cell-red { color: var(--m-red); background: var(--m-red-soft); }
.m-cell-amber { color: var(--m-amber); background: var(--m-amber-soft); }
.m-cell-blue { color: var(--m-blue); background: var(--m-blue-soft); }
.m-cell-violet { color: var(--m-violet); background: var(--m-violet-soft); }
.m-cell-gray { color: var(--m-gray); background: var(--m-gray-soft); }
.m-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--m-muted); padding: 0 2px; }
.m-legend span { display: inline-flex; align-items: center; gap: 6px; }
.m-legend i { font-style: normal; font-weight: 700; width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Уведомления ---------- */
.m-notif { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 14px !important; background: #fff !important; border-radius: var(--m-radius); box-shadow: var(--m-shadow); text-align: left; }
.m-notif.is-unread { background: #f3f7ff !important; box-shadow: var(--m-shadow), inset 3px 0 0 var(--m-accent); }
.m-notif-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.m-notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-notif-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.m-notif-top b { font-size: 15px; }
.m-notif-top time { font-size: 12px; color: var(--m-muted); white-space: nowrap; flex: none; }
.m-notif:not(.is-unread) .m-notif-top b { font-weight: 600; }
.m-notif-body { font-size: 14px; color: #3b4356; }
.m-notif-type { font-size: 12px; color: var(--m-muted); }

/* ---------- Профиль ---------- */
.m-profile { flex-direction: row; align-items: center; gap: 14px; }
.m-profile-name { font-size: 18px; font-weight: 700; }
.m-avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #5b8def, #2f6fed); color: #fff; font-weight: 700; letter-spacing: .02em; }
.m-org { display: flex; align-items: center; gap: 8px; }
.m-org .m-icon { color: var(--m-muted); }

/* ---------- Родитель: главная, ребёнок ---------- */
.m-debt-banner {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px !important; border-radius: var(--m-radius);
  background: linear-gradient(135deg, #e5483f, #c62f28) !important; color: #fff !important; text-align: left; box-shadow: 0 6px 18px rgba(201, 48, 42, .28);
}
.m-debt-banner > span { flex: 1; display: flex; flex-direction: column; }
.m-debt-banner b { font-size: 24px; line-height: 1.15; }
.m-debt-banner small { font-size: 13px; opacity: .9; }
.m-debt-banner.is-small b { font-size: 19px; }
.m-child-card { gap: 12px; }
.m-child-card-head { display: flex; align-items: center; gap: 12px; }
.m-child-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-child-card-main b { font-size: 17px; }
.m-child-sections { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--m-border); padding-top: 10px; }
.m-child-section { display: flex; gap: 10px; align-items: flex-start; }
.m-child-section .m-dot { margin-top: 6px; }
.m-child-section > span { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.m-child-section small { width: 100%; color: var(--m-muted); font-size: 13px; }
.m-child-head { flex-direction: row; align-items: center; gap: 16px; }
.m-child-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.m-child-head-main b { font-size: 19px; line-height: 1.25; }
.m-child-head-main .m-link-btn { padding: 6px 0 !important; min-height: 36px; font-size: 14px; }
.m-photo { position: relative; flex: none; }
.m-photo-btn { position: absolute; right: -2px; bottom: -2px; width: 36px; height: 36px; border-radius: 50%; background: var(--m-accent) !important; color: #fff !important; display: flex !important; align-items: center; justify-content: center; border: 3px solid #fff !important; }
.m-consent { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.m-consent > span:last-child { display: flex; flex-direction: column; }
.m-consent small { color: var(--m-muted); font-size: 13px; }
.m-consent-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.m-details summary { cursor: pointer; font-weight: 600; color: var(--m-muted); padding: 8px 2px; min-height: 40px; }
.m-contact-edit { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: #f6f8fb; }
.m-contact-edit-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -6px -6px 0; }
.m-att { flex-direction: row; align-items: center; gap: 10px; }
.m-att-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Оплата ---------- */
.m-debt-card { background: #fff; box-shadow: var(--m-shadow), inset 0 0 0 1.5px #f4bcb8; }
.m-debt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.m-debt-top span { font-weight: 700; color: var(--m-red); }
.m-debt-top b { font-size: 26px; color: var(--m-red); }
.m-debt-list { display: flex; flex-direction: column; }
.m-debt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 6px 0 !important; border-top: 1px solid var(--m-border) !important; text-align: left; }
.m-debt-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.m-debt-row small { color: var(--m-muted); font-size: 13px; }
.m-debt-sum { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; white-space: nowrap; }
.m-debt-sum small { font-size: 12px; }
.m-ok-card { flex-direction: row; align-items: center; gap: 12px; color: var(--m-green); }
.m-ok-card > span { display: flex; flex-direction: column; color: var(--m-text); }
.m-ok-card small { color: var(--m-muted); }
.m-charge { padding: 0; gap: 0; }
.m-charge-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px !important; min-height: 60px; text-align: left; }
.m-charge-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-charge-main small { color: var(--m-muted); font-size: 13px; }
.m-charge-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.m-charge-body { padding: 10px 14px 14px; border-top: 1px solid var(--m-border); display: flex; flex-direction: column; gap: 12px; }
.m-formula { background: #f5f7fb; border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.m-formula-title { font-weight: 700; font-size: 13px; color: var(--m-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 370px) {
  .m-mark-btn { font-size: 12px; }
  .m-stats-5 .m-stat span { font-size: 10.5px; }
  .m-stats-5 .m-stat b { font-size: 17px; }
  .m-stats-3 .m-stat b { font-size: 15px; }
  .m-nav-icon { padding: 2px 10px; }
  .m-savebar .m-btn { min-width: 118px; padding: 12px 14px; }
  .m-day { width: 42px; }
}
@media (min-width: 700px) {
  .m-nav-item { font-size: 12px; }
}
