/* ====== Журнал репетитора — стили прототипа ====== */
:root {
  --paper: #f5f2ec;
  --surface: #fffdf9;
  --surface-2: #faf7f1;
  --ink: #2c2723;
  --ink-soft: #574f47;
  --muted: #938778;
  --line: #e7e0d4;
  --line-strong: #d8cfbf;
  --plum: #7b3f5e;
  --plum-d: #5f2f49;
  --plum-tint: #f3e8ee;
  --teal: #1f7a7a;
  --teal-tint: #e4f1f1;
  --green: #2e7d5b;
  --green-tint: #e6f2eb;
  --amber: #b5742a;
  --amber-tint: #f7ecdc;
  --red: #b0464a;
  --red-tint: #f7e6e6;
  --slate: #5d6b82;
  --slate-tint: #e9edf3;
  --shadow: 0 1px 2px rgba(44, 39, 35, .06), 0 6px 20px rgba(44, 39, 35, .07);
  --shadow-sm: 0 1px 2px rgba(44, 39, 35, .08);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
a { color: var(--plum); }

/* ====== Layout ====== */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px; height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; color: var(--ink); }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--plum), var(--teal));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 2px; }

.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav button {
  border: 0; background: none; color: var(--ink-soft);
  padding: 8px 13px; border-radius: 9px; cursor: pointer;
  font-size: 14.5px; font-weight: 550; font-family: inherit;
}
.nav button:hover { background: var(--surface-2); }
.nav button.active { background: var(--plum-tint); color: var(--plum-d); }

.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; gap: 6px; align-items: center; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 26px 22px 70px; }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); background: var(--plum); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--plum-d); }
.btn.ghost:hover { background: var(--plum-tint); }
.btn.danger { color: var(--red); border-color: #e6c9c9; background: #fff; }
.btn.danger:hover { background: var(--red-tint); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ====== Cards & grid ====== */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }

/* ====== Student cards ====== */
.student-card { cursor: pointer; display: flex; flex-direction: column; gap: 14px; transition: transform .12s, box-shadow .12s; }
.student-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(44,39,35,.08), 0 14px 34px rgba(44,39,35,.1); }
.student-card .top { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 46px; height: 46px; border-radius: 12px; flex: none; color: #fff;
  display: grid; place-items: center; font-weight: 750; font-size: 18px;
}
.student-card .name { font-weight: 680; font-size: 16.5px; }
.student-card .meta { color: var(--muted); font-size: 13px; }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; flex: 1; min-width: 70px; }
.mini-stat .v { font-weight: 720; font-size: 18px; line-height: 1.1; }
.mini-stat .v small { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-stat .k { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ====== Badges ====== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--slate-tint); color: var(--slate);
}
.badge.done { background: var(--green-tint); color: var(--green); }
.badge.warn { background: var(--amber-tint); color: var(--amber); }
.badge.bad { background: var(--red-tint); color: var(--red); }
.badge.neutral { background: var(--slate-tint); color: var(--slate); }
.badge.muted { background: #ece7df; color: var(--muted); }
.badge.plum { background: var(--plum-tint); color: var(--plum-d); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ====== Tabs ====== */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin: 4px 0 22px; flex-wrap: wrap; }
.tab {
  border: 0; background: none; cursor: pointer; font-family: inherit;
  padding: 10px 15px; font-size: 14.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--plum-d); border-bottom-color: var(--plum); }

/* ====== Tables ====== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table .row-actions { opacity: 0; }
.table tr:hover .row-actions { opacity: 1; }

/* ====== Forms ====== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=date], input[type=number], input[type=url], select, textarea {
  font-family: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum-tint); }
textarea { resize: vertical; min-height: 64px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 150px; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--plum); }

/* ====== Modal ====== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 34, 30, .42);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.28);
  width: 100%; max-width: 620px; margin: auto; animation: pop .14s ease-out;
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .left { margin-right: auto; }

/* ====== Criteria grading ====== */
.crit-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--plum-d); margin: 18px 0 8px; }
.crit-group-title:first-child { margin-top: 4px; }
.crit { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.crit .crit-info { flex: 1; min-width: 0; }
.crit .crit-code { font-weight: 720; color: var(--ink); }
.crit .crit-title { color: var(--ink-soft); font-size: 13.5px; }
.crit .crit-hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; flex: none; background: var(--surface); }
.seg button {
  border: 0; background: none; cursor: pointer; font-family: inherit; font-weight: 680; font-size: 14px;
  width: 38px; height: 36px; color: var(--ink-soft); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--plum); color: #fff; }
.total-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--plum-tint); color: var(--plum-d); border-radius: 12px; padding: 10px 16px; font-weight: 600;
}
.total-pill b { font-size: 26px; font-weight: 800; line-height: 1; }
.total-pill .max { color: var(--muted); }

/* ====== Stats / bars ====== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat-box .v { font-size: 26px; font-weight: 780; line-height: 1.05; }
.stat-box .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat-box .k { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 210px 1fr 64px; align-items: center; gap: 12px; }
.bar-row .bar-label { font-size: 13.5px; color: var(--ink-soft); }
.bar-row .bar-label b { color: var(--ink); }
.bar { height: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width .3s; }
.bar-row.weak .bar-fill { background: linear-gradient(90deg, var(--amber), var(--red)); }
.bar-row .bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 680; font-size: 13.5px; }
.bar-row.weak .bar-val { color: var(--red); }
.weak-tag { color: var(--red); font-size: 12px; font-weight: 600; margin-left: 6px; }

.spark { display: block; }

/* ====== Misc ====== */
.muted { color: var(--muted); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; border: 0; background: none; padding: 0; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; font-size: 12.5px; color: var(--ink-soft); }
.note-text { white-space: pre-wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.help-banner { background: var(--teal-tint); border: 1px solid #cbe6e6; color: #1c5e5e; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; }

/* ====== Роли / порталы ====== */
.rolebar { display: flex; align-items: center; gap: 10px; padding: 9px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.rolebar .lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rolebar select { width: auto; min-width: 140px; padding: 6px 10px; font-size: 13.5px; }
.role-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.role-seg button { border: 0; background: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13.5px; padding: 6px 13px; color: var(--ink-soft); border-right: 1px solid var(--line); }
.role-seg button:last-child { border-right: 0; }
.role-seg button.on { background: var(--plum); color: #fff; }
.portal-banner { border-radius: 12px; padding: 11px 16px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.portal-banner.student { background: var(--teal-tint); color: #1c5e5e; border: 1px solid #cbe6e6; }
.portal-banner.parent { background: var(--amber-tint); color: #8a591f; border: 1px solid #ecd9bf; }
.plaque { background: linear-gradient(135deg, var(--plum), #9a5ba8); color: #fff; border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); }
.plaque .k { opacity: .82; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.plaque .v { font-size: 19px; font-weight: 750; margin-top: 4px; }
.plaque .stub { margin-top: 12px; font-size: 12.5px; opacity: .85; border-top: 1px solid rgba(255,255,255,.25); padding-top: 10px; }
.theme-table .grp { font-weight: 700; color: var(--plum-d); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 16px 0 6px; }
.theme-row { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.theme-row .th { color: var(--ink-soft); font-size: 13.5px; }
.theme-row input { padding: 6px 9px; font-size: 13.5px; }
.theme-block { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.theme-name { font-weight: 650; color: var(--ink); font-size: 13.5px; margin-bottom: 7px; }
.theme-entries { display: flex; flex-direction: column; gap: 6px; padding-left: 12px; }
.theme-entry { display: grid; grid-template-columns: 1fr 1.5fr 30px; gap: 8px; align-items: center; }
.theme-entry input { padding: 6px 9px; font-size: 13px; }

/* ====== Экран входа ====== */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand { font-size: 22px; }
.upload-stub { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; background: var(--surface-2); }
.stat-section-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 4px 0 2px; }

/* ====== Таймлайн готовности ====== */
.readiness-big { font-size: 40px; font-weight: 800; line-height: 1; white-space: nowrap; }
.readiness-big small { font-size: 18px; font-weight: 700; }
.timeline { margin: 10px 0 4px; }
.tl-track { position: relative; height: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--teal), var(--plum)); border-radius: 999px; }
.tl-now { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--plum); transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.tl-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.tl-labels span:nth-child(2) { font-weight: 700; color: var(--plum-d); }

/* ====== Календарь занятий ====== */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-weight: 650; font-size: 17px; margin-left: 6px; min-width: 150px; }
.cal-summary { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }
.cal-summary b { color: var(--ink-soft); }
.cal-card { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; gap: 6px; }
.cal-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.cal-cell { min-height: 94px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 5px 6px; cursor: pointer; transition: background .12s, border-color .12s; overflow: hidden; display: flex; flex-direction: column; }
.cal-cell:hover { border-color: var(--line-strong); background: var(--surface-2); }
.cal-cell.out { background: transparent; cursor: default; }
.cal-cell.out .cal-daynum { color: #cabfae; }
.cal-cell.out:hover { background: transparent; border-color: var(--line); }
.cal-cell.wknd:not(.out) .cal-daynum { color: var(--plum); }
.cal-cell.today { border-color: var(--plum); box-shadow: inset 0 0 0 1px var(--plum); }
.cal-daynum { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; flex: none; }
.cal-cell.today .cal-daynum { color: var(--plum-d); }
.cal-items { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-chip { display: flex; align-items: center; gap: 5px; width: 100%; border: none; cursor: pointer; text-align: left; font: inherit; font-size: 12px; padding: 2px 7px; border-radius: 999px; line-height: 1.35; }
.cal-chip:hover { filter: brightness(.96); }
.cal-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cal-chip.done { background: var(--green-tint); color: var(--green); }
.cal-chip.warn { background: var(--amber-tint); color: var(--amber); }
.cal-chip.bad { background: var(--red-tint); color: var(--red); }
.cal-chip.neutral { background: var(--slate-tint); color: var(--slate); }
.cal-chip.muted { background: #ece7df; color: var(--ink-soft); }
.cal-chip.st-cancel_student .cal-chip-name, .cal-chip.st-cancel_teacher .cal-chip-name { text-decoration: line-through; opacity: .85; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.cal-leg { display: inline-flex; align-items: center; gap: 6px; }
.cal-leg-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cal-leg-dot.done { background: var(--green); }
.cal-leg-dot.warn { background: var(--amber); }
.cal-leg-dot.bad { background: var(--red); }
.cal-leg-dot.neutral { background: var(--slate); }
.cal-leg-dot.muted { background: var(--muted); }
/* строка выбора ученика при добавлении занятия */
.pick-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; font: inherit; color: var(--ink); }
.pick-row:hover { border-color: var(--plum); background: var(--plum-tint); }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.cell-sub { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }

/* ====== Повторяющиеся занятия ====== */
.wd-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.wd-seg button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); width: 46px; height: 38px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 650; font-size: 13.5px; }
.wd-seg button:hover { background: var(--surface-2); }
.wd-seg button.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.recur-preview { margin-top: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 13.5px; color: var(--ink-soft); }
.recur-preview.empty { color: var(--muted); }
.recur-preview b { color: var(--plum-d); }

/* ====== Мобильный адаптив ====== */
@media (max-width: 720px) {
  /* верхняя панель: бренд + инструменты в строку, навигация — отдельной прокручиваемой строкой */
  .topbar { height: auto; flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  .topbar .spacer { display: none; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .nav button { white-space: nowrap; padding: 7px 11px; }
  .topbar .tools { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .topbar .tools .btn { padding: 5px 9px; font-size: 12.5px; }

  .rolebar { padding: 8px 12px; gap: 8px; }
  .rolebar select { min-width: 0; flex: 1; }

  .container { padding: 16px 12px 56px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }

  /* формы: поля и парные карточки в столбик */
  .row { flex-direction: column; gap: 12px; }
  .row > .field { min-width: 0; margin-bottom: 0; }

  .table th, .table td { padding: 9px 10px; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 10px; }
  .stat-box { padding: 11px 12px; }
  .stat-box .v { font-size: 22px; }

  /* полоски статистики: подпись над полосой */
  .bar-row { grid-template-columns: 1fr auto; grid-template-areas: "label label" "bar value"; gap: 4px 10px; }
  .bar-row .bar-label { grid-area: label; }
  .bar-row .bar { grid-area: bar; }
  .bar-row .bar-val { grid-area: value; }

  /* критерии: кнопки-баллы уходят под текст */
  .crit { flex-wrap: wrap; }
  .crit .crit-info { flex: 1 1 100%; margin-bottom: 8px; }

  /* модалки занимают почти всю ширину */
  .modal-backdrop { padding: 12px 8px; }
  .modal-head { padding: 14px 16px; }
  .modal-head h3 { font-size: 16.5px; }
  .modal-body { padding: 16px 15px; }
  .modal-foot { padding: 13px 15px; }

  /* сквозные темы (литература) в столбик */
  .theme-row { grid-template-columns: 1fr; gap: 6px; }
  .theme-entry { grid-template-columns: 1fr 28px; grid-template-areas: "a a" "q r"; gap: 6px; }
  .theme-entry > :nth-child(1) { grid-area: a; }
  .theme-entry > :nth-child(2) { grid-area: q; }
  .theme-entry > :nth-child(3) { grid-area: r; }

  /* календарь */
  .cal-cell { min-height: 56px; padding: 3px; }
  .cal-grid, .cal-head { gap: 3px; }
  .cal-card { padding: 6px; }
  .cal-nav { flex-wrap: wrap; }
  .cal-chip { justify-content: center; padding: 3px; gap: 0; }
  .cal-chip-name { display: none; }
  .cal-title { min-width: 0; font-size: 15px; }

  /* дни недели на всю ширину */
  .wd-seg { width: 100%; }
  .wd-seg button { flex: 1; width: auto; min-width: 36px; }
}
