:root {
  --bg: #eaf3f8;
  --surface: #f7fbfe;
  --surface-2: #ffffff;
  --ink: #273746;
  --muted: #61788a;
  --line: #bfd7e6;
  --accent: #3498db;
  --accent-2: #2980b9;
  --accent-soft: #dceefb;
  --danger: #b42318;
  --header: #2471a3;
  --font: "Segoe UI", "Candara", "Calibri", sans-serif;
  --header-h: 44px;
  --status-h: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

body.is-app {
  overflow: hidden;
  height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.workbench {
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr) var(--status-h);
  height: 100dvh;
}

.wb-header {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: linear-gradient(180deg, #3498db 0%, var(--header) 100%);
  color: #f4f8f8;
  border-bottom: 1px solid #1f618d;
}

.wb-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wb-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  background: #111;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
}
.wb-logo-fallback {
  width: 28px; height: 28px; border-radius: 6px;
  background: #fff; color: var(--header);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.wb-brand-name { font-weight: 700; font-size: 0.9rem; line-height: 1.1; }
.wb-brand-sub {
  font-size: 0.7rem; opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}

.wb-tabs {
  display: flex; gap: 2px; overflow-x: auto; align-items: end;
  height: 100%; padding-top: 6px;
}
.wb-tab {
  color: #eaf6ff; padding: 6px 12px 8px; border-radius: 8px 8px 0 0;
  font-size: 0.84rem; white-space: nowrap; text-decoration: none;
}
.wb-tab:hover { background: rgba(255,255,255,0.08); text-decoration: none; color: #fff; }
.wb-tab.is-active {
  background: var(--surface); color: var(--ink); font-weight: 600;
}

.wb-user { display: flex; align-items: center; gap: 8px; }
.wb-user-name { font-size: 0.8rem; opacity: 0.9; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-notif {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  color: #fff;
}
.wb-notif:hover { background: rgba(255,255,255,0.14); text-decoration: none; }
.wb-notif-icon {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px 3px 4px 4px;
  position: relative;
  opacity: 0.95;
}
.wb-notif-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: -4px;
  height: 4px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  box-sizing: border-box;
}
.wb-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e35d4f;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.grid-table tr.is-unread td { background: #eef8ff; font-weight: 600; }

.wb-btn, .btn {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: inherit;
  border-radius: 6px;
  padding: 5px 10px;
  font: inherit;
  cursor: pointer;
}
.btn {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { background: #edf6fc; text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-danger { background: var(--danger); border-color: #8f1c14; color: #fff; }

.wb-branch-select {
  background: rgba(0,0,0,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  max-width: 180px;
}
.wb-branch-select option { color: #111; }

.wb-admin-menu { position: relative; }
.wb-admin-menu summary { list-style: none; }
.wb-admin-menu summary::-webkit-details-marker { display: none; }
.wb-admin-popover {
  position: absolute; right: 0; top: calc(100% + 4px);
  min-width: 180px; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); padding: 6px; z-index: 20;
}
.wb-admin-item {
  display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none;
}
.wb-admin-item:hover, .wb-admin-item.is-active { background: var(--accent-soft); text-decoration: none; }

.wb-main { min-height: 0; overflow: auto; padding: 12px; }

.wb-status {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  height: var(--status-h);
  min-height: var(--status-h);
  max-height: var(--status-h);
  padding: 0 12px; font-size: 0.75rem; color: #eaf6ff;
  background: #1f618d; border-top: 1px solid #154360;
  box-sizing: border-box;
  overflow: hidden;
}
.wb-status > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-status > span:first-child {
  flex: 1;
  min-width: 0;
}

.page { max-width: 1200px; margin: 0 auto; }
.page-narrow { max-width: 860px; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px;
}
.page-head h1 { margin: 0; font-size: 1.35rem; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }
.lead { font-size: 1rem; color: var(--ink); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.toolbar .form-control { min-width: 160px; flex: 1; }

.table-wrap {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e4eaec;
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: #edf6fc;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.data-table tr:hover td { background: #f3f8f7; }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }
.row-actions { white-space: nowrap; display: flex; gap: 10px; }
.row-actions .danger { color: var(--danger); }
.tag { color: #b7791f; margin-left: 4px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field-span { grid-column: 1 / -1; }
.field label { font-size: 0.82rem; color: var(--muted); }
.form-control, input[type="text"], input[type="password"], input[type="search"],
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  font: inherit;
  background: #fff;
}
.field-error { color: var(--danger); font-size: 0.8rem; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

.flash-messages { list-style: none; margin: 0 0 12px; padding: 0; }
.flash {
  padding: 8px 12px; border-radius: 8px; margin-bottom: 6px;
  background: var(--accent-soft); border: 1px solid #b7d9d5;
}
.flash-error, .flash-error { background: #fde8e6; border-color: #f0b4ae; color: var(--danger); }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }

.stub-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  background-image: linear-gradient(160deg, #f7fbfb 0%, #eef5f4 55%, #e4ecec 100%);
}
.stub-card h1 { margin-top: 0; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, #c5ddd9 0, transparent 40%),
    radial-gradient(circle at 80% 0%, #b7c9d2 0, transparent 35%),
    linear-gradient(160deg, #d5e0e4, #c7d4d1);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(28, 42, 50, 0.12);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.login-brand h1 { margin: 0; font-size: 1.35rem; }
.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: contain;
  background: #111;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.login-card .field { margin-bottom: 12px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }
.messages { list-style: none; padding: 0; }
.messages .error { color: var(--danger); margin-bottom: 10px; }

@media (max-width: 720px) {
  .wb-header { grid-template-columns: 1fr; height: auto; padding: 8px; }
  .workbench { grid-template-rows: auto minmax(0, 1fr) var(--status-h); }
  .form-grid { grid-template-columns: 1fr; }
  .wb-user-name { display: none; }
}

/* —— Master-detail / editable grid —— */
.wb-main:has(.master-detail),
.wb-main:has(.students-layout) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.students-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  height: 100%;
}
.students-sidebar {
  border-right: 1px solid var(--line);
  background: #edf6fc;
  overflow: auto;
  min-height: 0;
}
.side-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 10px;
}
.side-filters-title {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.side-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.side-field .wb-input {
  min-width: 0;
  width: 100%;
  font-size: 0.84rem;
}
.side-static {
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.84rem;
}
.side-reset {
  margin-top: 4px;
  text-align: center;
  justify-content: center;
}
.side-quick-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-quick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}
.side-quick input {
  margin: 0;
}
.side-quick:has(input:checked),
.side-quick.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.students-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}
.students-main .md-split {
  min-height: 0;
  height: 100%;
}
.master-detail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}
.students-layout.master-detail {
  display: grid;
  grid-template-rows: none;
  grid-template-columns: 200px minmax(0, 1fr);
}
.md-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.md-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.md-quicksearch form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.wb-input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  background: #fff;
  min-width: 120px;
}
.wb-btn-primary {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #fff;
}
.wb-btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-sm { padding: 2px 8px; font-size: 0.85rem; }

.md-split {
  min-height: 0;
  display: grid;
  /* высота карточки снизу = остаток (по умолчанию ~половина) */
  grid-template-rows: var(--md-master-pct, 50%) 8px minmax(0, 1fr);
  height: 100%;
}
.md-master, .md-detail {
  min-height: 0;
  overflow: hidden;
  background: var(--surface-2);
}
.md-splitter {
  position: relative;
  z-index: 2;
  background: #c5d0d4;
  background-image: linear-gradient(180deg, #d5dee2 0%, #b8c4c8 100%);
  cursor: row-resize;
  touch-action: none;
  user-select: none;
}
.md-splitter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 3px;
  margin: -1.5px 0 0 -18px;
  border-radius: 2px;
  background: #7a8a90;
  opacity: 0.7;
  pointer-events: none;
}
body.is-md-resizing {
  cursor: row-resize !important;
  user-select: none !important;
}
body.is-md-resizing * {
  cursor: row-resize !important;
  user-select: none !important;
}
.md-detail {
  border-top: 1px solid var(--line);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.md-detail > .detail-empty {
  margin: auto;
  padding: 24px;
}
.md-detail > .detail-pane-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.grid-scroll { height: 100%; overflow: auto; }
.grid-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}
.grid-table th, .grid-table td {
  border-bottom: 1px solid #e4eaec;
  border-right: 1px solid #eef2f3;
  padding: 0;
  vertical-align: middle;
  background: #fff;
}
.grid-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf6fc;
  font-weight: 600;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}
.grid-table .col-fixed {
  position: sticky;
  background: #fff;
  z-index: 1;
}
.grid-table th.col-fixed { z-index: 3; background: #edf6fc; }
.col-id { left: 0; width: 56px; min-width: 56px; text-align: right; padding: 4px 6px !important; }
.col-status { right: 36px; width: 36px; min-width: 36px; text-align: center; }
.col-actions { right: 0; width: 36px; min-width: 36px; text-align: center; }

.grid-row { cursor: pointer; }
.grid-row:hover td:not(.colorize-cell) { background: #f3f8f7; }
.grid-row:hover td.colorize-cell {
  filter: brightness(0.97);
}
.grid-row.is-selected td:not(.colorize-cell) { background: #dceeea !important; }
.grid-row.is-selected td.colorize-cell {
  box-shadow: inset 0 0 0 2px rgba(52, 152, 219, 0.35);
}
.grid-table td.colorize-cell {
  background-color: var(--cell-bg, #fff) !important;
  color: var(--cell-fg, inherit);
}
.grid-table td.colorize-cell.is-colorized .cell-display[data-value=""]::before {
  content: "—";
  color: var(--cell-fg, #a35b00);
  opacity: 0.9;
}
.grid-row-new { cursor: default; }
.grid-row-new td { background: #f7fbf3 !important; }
.row-flash td { animation: rowFlash 0.7s ease; }
@keyframes rowFlash {
  from { background: #cfeee8; }
  to { background: transparent; }
}

.cell-display, .cell-readonly {
  display: block;
  min-height: 28px;
  padding: 5px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.cell-display:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell-input {
  width: 100%;
  min-width: 80px;
  border: 1px solid var(--accent);
  border-radius: 0;
  padding: 4px 6px;
  font: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.cell-select { min-width: 100px; }
.btn-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 8px;
}
.btn-icon:hover { color: var(--danger); }
.save-ok { color: #0a7a4b; font-size: 0.75rem; }
.save-err { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }

.detail-empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
.detail-pane-inner {
  background: #f7fafa;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px 8px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.detail-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}
.detail-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.detail-sub span:not(.muted) {
  background: #eef4f4;
  color: var(--ink);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.detail-transfer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.detail-transfer-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}
.detail-transfer-label .wb-input {
  min-width: 180px;
}
.detail-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.detail-docs-menu { position: relative; }
.detail-docs-menu > summary {
  list-style: none;
  cursor: pointer;
}
.detail-docs-menu > summary::-webkit-details-marker { display: none; }
.detail-docs-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 34, 0.14);
  padding: 4px;
  z-index: 20;
}
.detail-docs-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}
.detail-docs-item:hover { background: var(--accent-soft); }

.detail-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid #e8efef;
  flex-shrink: 0;
}
.detail-kpi-item {
  background: #f3f8f7;
  border: 1px solid #e0ebe9;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 0;
}
.detail-kpi-item.is-warn {
  background: #fff5f3;
  border-color: #f0c4bc;
}
.detail-kpi-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-kpi-item strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.detail-kpi-instructors strong {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-pane-inner > .highlight-reasons {
  padding: 6px 14px 0;
  flex-shrink: 0;
  background: #fff;
}

.detail-tabs {
  display: flex;
  gap: 2px;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}
.detail-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 12px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.detail-tab:hover { color: var(--ink); }
.detail-tab.is-active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}
.detail-tab .tab-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8efef;
  color: var(--muted);
}
.detail-tab .tab-badge.is-hot {
  background: #f3b5ad;
  color: #7a1f16;
}
.detail-tab.is-active .tab-badge.is-hot {
  background: var(--accent);
  color: #fff;
}

.detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 16px;
  background: #f7fafa;
}
.detail-panel[hidden] { display: none !important; }
.detail-panel.is-active { display: block; }

.detail-overview {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.detail-overview-block {
  background: #fff;
  border: 1px solid #e4eaec;
  border-radius: 10px;
  padding: 10px 12px 12px;
}
.detail-dl {
  margin: 0;
  display: grid;
  gap: 8px;
}
.detail-dl > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  align-items: start;
}
.detail-dl dt {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.detail-dl dd {
  margin: 0;
  font-size: 0.9rem;
  word-break: break-word;
}
.detail-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-hint { margin: 0; font-size: 0.78rem; line-height: 1.4; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 16px;
}
.detail-grid .muted { font-size: 0.75rem; }
.group-detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px;
}
.group-detail-head {
  padding-block: 8px;
}
.group-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.group-facts > div {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #e0ebe9;
  border-radius: 7px;
  background: #fff;
}
.group-facts span {
  display: block;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 0.68rem;
}
.group-facts strong {
  font-size: 0.88rem;
}
.group-date-words {
  margin-top: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}
.group-date-words summary {
  padding: 5px 0;
  cursor: pointer;
  font-weight: 600;
}
.group-date-words p {
  margin: 0 0 5px;
}
.group-date-words p span {
  font-weight: 600;
}
.group-detail-notes {
  margin: 8px 0 0;
  padding: 7px 9px;
  font-size: 0.8rem;
}
.group-teachers-panel {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #e0ebe9;
  border-radius: 8px;
  background: #fff;
}
.group-teachers-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2f5f73;
}
.group-teachers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.group-teachers-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  font-size: 0.86rem;
}
.group-teachers-remove {
  margin: 0;
}
.group-teachers-assign {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.group-teachers-assign .wb-input,
.group-teachers-assign .select2-container {
  flex: 1 1 160px;
  min-width: 0;
}
.group-teachers-assign .select2-container {
  width: auto !important;
}
.group-teachers-empty {
  margin: 8px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.group-complete-msg {
  margin: 8px 0 0;
}
.group-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.group-detail-actions form {
  margin: 0;
}
.group-action-btn {
  display: flex;
  width: 100%;
  min-height: 48px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 6px 9px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.group-action-btn.wb-btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.group-action-btn small {
  opacity: 0.78;
  font-size: 0.68rem;
}
.group-action-btn:disabled {
  cursor: default;
  opacity: 0.55;
}
@media (max-width: 700px) {
  .group-detail-actions { grid-template-columns: 1fr; }
}
.detail-section-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.detail-field .cell-display,
.detail-field .cell-readonly,
.detail-field .cell-input {
  max-width: none;
  background: #fff;
  border: 1px solid #e4eaec;
  border-radius: 6px;
}
.detail-field .cell-display:hover {
  border-color: var(--accent);
}
.detail-save-status {
  min-width: 24px;
  text-align: right;
}
.detail-field.colorize-cell {
  background-color: var(--cell-bg, transparent);
  border-radius: 8px;
  padding: 4px 6px;
}
.detail-field.colorize-cell.is-colorized,
.detail-field.colorize-cell[style*="--cell-bg"] {
  background-color: var(--cell-bg, #ffe8cc);
}
.detail-field.colorize-cell .cell-display,
.detail-field.colorize-cell .cell-readonly {
  color: var(--cell-fg, inherit);
  font-weight: inherit;
  background: transparent;
}
.highlight-reasons {
  margin-bottom: 4px;
}
.highlight-reasons-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
@media (max-width: 900px) {
  .detail-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-overview { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .detail-head { flex-direction: column; }
  .detail-tools { width: 100%; justify-content: flex-end; }
  .detail-kpi { grid-template-columns: 1fr 1fr; }
  .detail-dl > div { grid-template-columns: 1fr; gap: 2px; }
}
.highlight-reason {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
}
.highlight-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex: 0 0 auto;
}
.highlight-swatch--bold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}
.highlight-reason--bold { font-weight: 700; }

.page-panel {
  padding: 16px 18px;
  height: 100%;
  overflow: auto;
  background: var(--surface);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.page-head h1 { margin: 0 0 4px; font-size: 1.35rem; }
.page-actions { display: flex; gap: 8px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.wb-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.wb-btn-primary:hover { background: var(--accent-2); color: #fff; text-decoration: none; }
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.detail-actions--stack {
  flex-direction: column;
  align-items: flex-start;
}
.detail-complete-msg {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #e8f6ef;
  color: #1e6b45;
  font-size: 0.88rem;
}
.doc-help {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.doc-help code {
  font-size: 0.85em;
  background: #edf6fc;
  padding: 1px 4px;
  border-radius: 3px;
}
.empty { text-align: center; color: var(--muted); padding: 24px !important; }

.wb-btn-danger {
  background: #f8e8e6;
  border-color: #e0a8a2;
  color: var(--danger);
}
.wb-btn-danger:hover {
  background: #f0d2ce;
  text-decoration: none;
}

.tpl-upload {
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tpl-upload > summary {
  cursor: pointer;
  font-weight: 600;
}

/* —— Documents workspace —— */
.wb-main:has(.documents-layout) {
  padding: 0;
  overflow: hidden;
}
.documents-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.documents-sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
  min-height: 0;
}
.docs-filters {
  padding: 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.docs-filters-title,
.side-filters-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.side-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.side-field > span {
  font-weight: 600;
}
.side-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.docs-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.docs-filters-actions .wb-btn-primary {
  flex: 1;
}
.docs-kind-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.docs-kind-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-kind-chip:hover {
  border-color: #85c1e9;
  color: var(--ink);
}
.docs-kind-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.docs-date-input {
  font-size: 0.82rem;
}
.documents-main {
  padding: 14px 16px;
  overflow: auto;
  min-height: 0;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}
.documents-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.documents-head h1 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.docs-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 0.8rem;
}
.docs-filter-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #b8d4d0;
  color: var(--accent-2);
  font-weight: 600;
}
.docs-filter-clear {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--accent);
}
.documents-grid {
  flex: 1;
  min-height: 200px;
}
.documents-table .docs-row:hover td {
  background: #f6fafa;
}
.docs-cell-date {
  white-space: nowrap;
}
.docs-date-main {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
}
.docs-date-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}
.docs-cell-num {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.84rem;
  color: var(--muted);
}
.docs-cell-title {
  font-weight: 500;
  max-width: 280px;
}
.docs-cell-subject {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.84rem;
}
.docs-subject-name {
  font-weight: 600;
}
.docs-subject-group {
  font-size: 0.76rem;
  color: var(--muted);
}
.docs-col-actions {
  width: 52px;
  text-align: right;
}
.docs-dl-btn {
  min-width: 36px;
  padding: 4px 10px;
  font-weight: 700;
}
.doc-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: #eef2f3;
  color: var(--muted);
}
.doc-kind--contract { background: #e8f4f8; color: #1a5f6e; }
.doc-kind--group_list { background: #eef0f8; color: #3a4a7a; }
.doc-kind--application { background: #f0f8ee; color: #3a6a3a; }
.doc-kind--certificate { background: #f8f4e8; color: #7a5a1a; }
.doc-kind--driving_card { background: #f8eef4; color: #6a3a5a; }
.doc-kind--exam { background: #f8ece8; color: #7a3a2a; }
.doc-kind--other { background: #eef2f3; color: #5a6a70; }
.docs-empty {
  padding: 32px 16px !important;
}
@media (max-width: 900px) {
  .documents-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .documents-sidebar {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .docs-kind-chips {
    max-height: 88px;
    overflow: auto;
  }
}

/* —— Payments workspace —— */
.wb-main:has(.payments-layout) {
  padding: 0;
  overflow: hidden;
}
.payments-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.payments-sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #eef4f7 0%, var(--surface) 140px);
  overflow: auto;
  min-height: 0;
}
.payments-main {
  padding: 16px 18px 20px;
  overflow: auto;
  min-height: 0;
  min-width: 0;
  background:
    radial-gradient(ellipse 70% 36% at 0% 0%, #e8f1f6 0%, transparent 55%),
    var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.payments-side-hero {
  padding: 12px 12px 14px;
  margin: -2px -2px 4px;
  border-radius: 12px;
  background: linear-gradient(145deg, #243b4a 0%, #2f5f73 55%, #3a7a8c 100%);
  color: #f3faff;
  box-shadow: 0 8px 20px rgba(47, 95, 115, 0.22);
}
.payments-side-hero-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.78;
  font-weight: 700;
}
.payments-side-hero-value {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.payments-side-hero-meta {
  font-size: 0.8rem;
  opacity: 0.9;
}
.payments-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.payments-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2f5f73;
}
.payments-head h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.2;
}
.payments-head-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.payments-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.payments-stat-card {
  min-width: 110px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.payments-stat-card--sum {
  background: #eef4f8;
  border-color: #c5d6e2;
}
.payments-stat-card--debt {
  background: #fdf2f0;
  border-color: #e8c4c0;
}
.payments-stat-card--ok {
  background: #eef8f1;
  border-color: #c5e4cf;
}
.payments-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.payments-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.payments-add-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.payments-add-panel > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: #2f5f73;
  list-style: none;
  background: linear-gradient(180deg, #fff 0%, #f5f9fb 100%);
}
.payments-add-panel > summary::-webkit-details-marker {
  display: none;
}
.payments-add-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}
.payments-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
  align-items: end;
}
.payments-add-form > * {
  min-width: 0;
}
.payments-add-form .select2-container {
  width: 100% !important;
  min-width: 0;
}
.payments-add-form .wb-btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
}
.payments-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.payment-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(28, 42, 50, 0.04);
  transition: box-shadow 0.15s, transform 0.15s;
}
.payment-card:hover {
  box-shadow: 0 8px 22px rgba(28, 42, 50, 0.08);
  transform: translateY(-1px);
}
.payment-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 12px 6px;
  background: linear-gradient(180deg, #eaf2f7 0%, #dce8f0 100%);
  border-right: 1px solid var(--line);
  text-transform: lowercase;
}
.payment-card-day {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.payment-card-year {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.payment-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.payment-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.payment-card-student {
  font-weight: 700;
  font-size: 0.95rem;
}
.payment-card-meta {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}
.payment-card-amount {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1f4f63;
  white-space: nowrap;
}
.payment-card-notes {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f5f8f9;
  font-size: 0.84rem;
  color: var(--ink);
}
.payment-card-actions {
  display: flex;
  justify-content: flex-end;
}
.payments-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 220px;
  padding: 32px 20px;
  border: 1px dashed #b7c5cd;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}
.payments-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 700;
  background: #e8f1f6;
  color: #2f5f73;
  border: 1px solid #c5d6e2;
}
.payments-empty h2 {
  margin: 4px 0 0;
  font-size: 1.1rem;
}
.payments-empty p {
  margin: 0;
  max-width: 360px;
}
@media (max-width: 980px) {
  .payments-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .payments-sidebar {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 560px) {
  .payments-main {
    padding: 12px 10px 16px;
  }
  .payments-add-form {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }
  .payments-add-form .wb-btn-primary {
    width: 100%;
    justify-self: stretch;
  }
}

/* —— Practice workspace —— */
.wb-main:has(.practice-layout) {
  padding: 0;
  overflow: hidden;
}
.practice-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.practice-sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
  min-height: 0;
}
.practice-main {
  padding: 14px 16px;
  overflow: auto;
  min-height: 0;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}
.practice-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.practice-head h1 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.practice-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.practice-stat {
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}
.practice-stat--hours {
  background: #eef4f8;
  color: #2a5a6e;
}
.practice-period-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.practice-add-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.practice-add-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-2);
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
  list-style: none;
}
.practice-add-summary::-webkit-details-marker {
  display: none;
}
.practice-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  align-items: end;
}
.practice-add-form .wb-btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
}

/* —— Schedule workspace —— */
.wb-main:has(.schedule-layout) {
  padding: 0;
  overflow: hidden;
}
.schedule-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.schedule-sidebar {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, #eef5f4 0%, var(--surface) 120px);
  overflow: auto;
  min-height: 0;
}
.schedule-main {
  padding: 16px 18px 20px;
  overflow: auto;
  min-height: 0;
  background:
    radial-gradient(ellipse 80% 40% at 100% 0%, #e3f2fd 0%, transparent 55%),
    var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.schedule-side-hero {
  padding: 12px 12px 14px;
  margin: -2px -2px 4px;
  border-radius: 12px;
  background: linear-gradient(145deg, #21618c 0%, #3498db 55%, #5dade2 100%);
  color: #f4fbff;
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.22);
}
.schedule-side-hero-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.78;
  font-weight: 700;
}
.schedule-side-hero-day {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.schedule-side-hero-meta {
  font-size: 0.82rem;
  opacity: 0.92;
  text-transform: capitalize;
}
.schedule-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.schedule-week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.schedule-week-day:hover {
  border-color: #85c1e9;
  transform: translateY(-1px);
}
.schedule-week-day.is-today {
  border-color: #9ec9c4;
}
.schedule-week-day.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.28);
}
.schedule-week-wd {
  font-size: 0.62rem;
  text-transform: lowercase;
  opacity: 0.8;
  font-weight: 600;
}
.schedule-week-num {
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.schedule-day-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.schedule-day-btn {
  min-width: 36px;
  padding-left: 8px;
  padding-right: 8px;
}
.schedule-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.schedule-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.schedule-toggle-ui {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #c9d4d2;
  position: relative;
  transition: background 0.15s;
}
.schedule-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}
.schedule-toggle.is-on,
.schedule-toggle:has(input:checked) {
  border-color: #9ec9c4;
  background: #f3faf9;
}
.schedule-toggle:has(input:checked) .schedule-toggle-ui,
.schedule-toggle.is-on .schedule-toggle-ui {
  background: var(--accent);
}
.schedule-toggle:has(input:checked) .schedule-toggle-ui::after,
.schedule-toggle.is-on .schedule-toggle-ui::after {
  transform: translateX(16px);
}
.schedule-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.schedule-toggle-text strong {
  font-size: 0.84rem;
  color: var(--ink);
}
.schedule-toggle-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.schedule-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.schedule-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.schedule-head h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
  text-transform: capitalize;
}
.schedule-head-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.schedule-head-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.schedule-stat-card {
  min-width: 78px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.schedule-stat-card--open {
  background: #eef8f1;
  border-color: #c5e4cf;
}
.schedule-stat-card--booked {
  background: #eef4f8;
  border-color: #c5d6e2;
}
.schedule-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.schedule-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.schedule-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.schedule-tool {
  flex: 1 1 280px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.schedule-tool > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-2);
  list-style: none;
  background: linear-gradient(180deg, #fff 0%, #f7fafa 100%);
}
.schedule-tool > summary::-webkit-details-marker {
  display: none;
}
.schedule-tool[open] > summary {
  border-bottom: 1px solid var(--line);
}
.schedule-tool-form,
.schedule-tool .slot-gen-body {
  padding: 12px 14px 14px;
}
.schedule-tool-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}
.schedule-tool-form .wb-btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
}

.schedule-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.slot-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(28, 42, 50, 0.04);
  transition: box-shadow 0.15s, transform 0.15s;
}
.slot-card:hover {
  box-shadow: 0 8px 22px rgba(28, 42, 50, 0.08);
  transform: translateY(-1px);
}
.slot-card.is-open {
  border-color: #b9dcc8;
}
.slot-card.is-booked {
  border-color: #c5d6e2;
}
.slot-card.is-blocked {
  opacity: 0.72;
}
.slot-card-time {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 14px 8px;
  background: linear-gradient(180deg, #f2f7f6 0%, #e7efee 100%);
  border-right: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.slot-card.is-open .slot-card-time {
  background: linear-gradient(180deg, #e8f7ee 0%, #d8efe0 100%);
}
.slot-card.is-booked .slot-card-time {
  background: linear-gradient(180deg, #eaf2f8 0%, #dce8f1 100%);
}
.slot-card-start {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.slot-card-end {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.slot-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.slot-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.slot-card-instructor {
  font-weight: 700;
  font-size: 0.95rem;
}
.slot-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.slot-card-student {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f5f8f9;
  font-size: 0.9rem;
}
.slot-card-student.is-empty {
  color: var(--muted);
  font-style: italic;
  background: #f7fbf8;
}
.slot-card.is-booked .slot-card-student {
  background: #eef4f8;
}
.slot-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.schedule-status {
  display: inline-block;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f4;
  font-weight: 700;
  white-space: nowrap;
}
.schedule-status--open {
  background: #dff3e6;
  color: #1f6b3a;
}
.schedule-status--blocked {
  background: #f3f0e8;
  color: #7a5c20;
}
.schedule-status--cancelled {
  background: #eceff1;
  color: #546e7a;
}
.schedule-book-form,
.schedule-complete-form,
.schedule-reschedule-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.schedule-book-form .select2-container,
.schedule-reschedule-form .select2-container {
  min-width: 200px;
}
.schedule-complete-form .wb-input {
  width: 72px;
}
.schedule-btn-danger {
  color: var(--danger);
  border-color: #e8c4c0;
}
.schedule-btn-danger:hover {
  background: #fdf2f0;
}
.schedule-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 240px;
  padding: 32px 20px;
  border: 1px dashed #b7c9c5;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}
.schedule-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid #b9d8d4;
}
.schedule-empty h2 {
  margin: 4px 0 0;
  font-size: 1.1rem;
}
.schedule-empty p {
  margin: 0;
  max-width: 360px;
}

/* Instructor detail students */
.instructor-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 14px;
}
.instructor-detail-notes {
  margin: 0 0 8px;
  padding: 6px 8px;
  font-size: 0.78rem;
}
.instructor-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin: 0 0 8px;
}
.instructor-kpi .detail-kpi-item {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.instructor-kpi .detail-kpi-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.instructor-kpi-btn {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.instructor-kpi-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.instructor-kpi-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.instructor-load-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 0 6px !important;
}
.instructor-load-cell.is-hot {
  color: #b45309;
  background: #fff8f0;
}
.instructor-students-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.instructor-students-filters .side-field {
  min-width: 150px;
  flex: 1 1 150px;
  margin: 0;
}
.instructor-students-filters .side-field > span {
  display: none;
}
.instructor-students-panel {
  margin: 0 0 6px;
}
.instructor-students-panel .instructor-students-list {
  margin-top: 2px;
}
.instructor-students-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.instructor-student-card {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  border-left: 3px solid #c5cdd2;
}
.instructor-student-card.is-pending {
  border-left-color: var(--accent, #0b6e4f);
  background: #f7fbf9;
}
.instructor-student-card.is-done {
  border-left-color: #b8c4c8;
  opacity: 0.88;
}
.instructor-student-card.is-inactive {
  border-left-color: #d0d5d8;
  opacity: 0.7;
}
.instructor-student-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.instructor-student-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.instructor-remaining.is-hot {
  color: #b45309;
  font-weight: 600;
}
.instructor-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.instructor-settings-panel {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.instructor-settings-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  list-style: none;
}
.instructor-settings-panel > summary::-webkit-details-marker {
  display: none;
}
.instructor-settings-panel > summary::before {
  content: "›";
  color: var(--muted);
  font-size: 1rem;
  transition: transform 0.12s;
}
.instructor-settings-panel[open] > summary::before {
  transform: rotate(90deg);
}
.instructor-settings-panel > summary > span {
  flex: 1;
}
.instructor-settings-panel > summary small {
  color: var(--muted);
  font-weight: 500;
}
.instructor-settings-content {
  padding: 8px;
  border-top: 1px solid var(--line);
}
.instructor-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.instructor-setting-row p {
  margin: 0;
  font-size: 0.78rem;
}
.instructor-settings-content .toolbar {
  margin: 8px 0 0;
}
@media (max-width: 680px) {
  .instructor-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instructor-setting-row { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 980px) {
  .schedule-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .schedule-sidebar {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .slot-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* Генерация слотов расписания */
.slot-gen-panel {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.slot-gen-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-2, #0b6e4f);
  background: linear-gradient(180deg, #fff 0%, var(--surface, #f7f8f7) 100%);
  list-style: none;
}
.slot-gen-summary::-webkit-details-marker {
  display: none;
}
.slot-gen-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.slot-gen-instructor,
.slot-gen-preview,
.slot-gen-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}
.slot-gen-instructor .side-field,
.slot-gen-preview .side-field,
.slot-gen-form .side-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}
.slot-gen-instructor .side-field {
  min-width: 260px;
  flex: 1 1 260px;
}
.slot-gen-instructor .side-field > span,
.slot-gen-preview .side-field > span,
.slot-gen-form .side-field > span {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}
.slot-gen-weekdays,
.slot-gen-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.slot-gen-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #f7f8f7);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}
.slot-gen-chip input {
  margin: 0;
}
.slot-gen-chip--all {
  font-weight: 600;
}
.slot-gen-chip small {
  color: var(--muted, #6b7280);
  text-transform: lowercase;
}
.slot-gen-ranges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
}
.slot-gen-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slot-gen-range-row .wb-input {
  width: 90px;
}
.slot-gen-hint {
  margin: 0;
  width: 100%;
  font-size: 0.8rem;
}
.slot-gen-form .side-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.practice-grid {
  flex: 1;
  min-height: 200px;
}
.practice-table .practice-row:hover td {
  background: #f6fafa;
}
.practice-cell-date {
  white-space: nowrap;
}
.practice-cell-student {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.practice-student-name {
  font-weight: 600;
  font-size: 0.88rem;
}
.practice-student-group {
  font-size: 0.74rem;
  color: var(--muted);
}
.practice-instructor {
  font-size: 0.86rem;
}
.practice-instructor--empty {
  font-size: 0.86rem;
}
.practice-hours-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: #eef4f8;
  color: #2a5a6e;
  font-weight: 700;
  font-size: 0.88rem;
}
.practice-cell-notes {
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 200px;
}
.practice-col-actions {
  width: 44px;
  text-align: center;
}
.practice-del-btn {
  opacity: 0.65;
}
.practice-row:hover .practice-del-btn {
  opacity: 1;
}
.practice-empty {
  padding: 32px 16px !important;
}
@media (max-width: 900px) {
  .practice-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .practice-sidebar {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .practice-add-form {
    grid-template-columns: 1fr;
  }
}
.tpl-upload-form,
.tpl-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 12px;
}
.tpl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.tpl-field > span:first-child { color: var(--muted); }
.tpl-field-wide { grid-column: 1 / -1; }
.tpl-field-actions {
  display: flex;
  align-items: flex-end;
}
.tpl-field-file input[type="file"] { padding: 6px; }
.tpl-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
}
.tpl-hint { font-size: 0.78rem; }
.tpl-code { font-size: 0.8rem; }
.tpl-row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}
.grid-table tr.is-inactive td { opacity: 0.55; }
.tpl-ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
}
.tpl-ph-group h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}
.tpl-ph-group ul {
  margin: 0;
  padding-left: 16px;
  font-size: 0.85rem;
}
.tpl-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 14px;
  align-items: start;
}
.tpl-editor-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.tpl-editor-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.tpl-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.tpl-readonly {
  margin: 0;
  padding: 8px 10px;
  background: #eef2f3;
  border-radius: 6px;
}
.tpl-ph-scroll {
  max-height: 420px;
  overflow: auto;
  font-size: 0.82rem;
}
.tpl-ph-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.tpl-ph-list li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
  border-bottom: 1px solid #e8eef0;
}
.tpl-ph-list code { font-size: 0.78rem; }
.tpl-ph-list span { color: var(--muted); }
.tpl-danger-card { border-color: #e0a8a2; }
.flash-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.flash-success { background: #e9f7ef; border: 1px solid #a9dfbf; color: #176b3a; padding: 8px 10px; border-radius: 6px; }

.branch-form {
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.branch-form-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.branch-form-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.branch-form-lead {
  margin: -4px 0 12px;
  font-size: 0.85rem;
}
.branch-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.branch-form-actions {
  display: flex;
  gap: 8px;
}
.branch-form .tpl-field .wb-input,
.branch-form .tpl-field input[type="text"] {
  width: 100%;
}
.branch-form input[readonly] {
  background: #eef2f3;
  color: var(--muted);
}

@media (max-width: 900px) {
  .tpl-upload-form,
  .tpl-editor-grid,
  .tpl-editor,
  .branch-form-grid { grid-template-columns: 1fr; }
}


.student-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(1080px, 96vw);
  max-height: min(88vh, 820px);
  background: transparent;
  box-shadow: 0 24px 64px rgba(18, 32, 38, 0.28);
  overflow: hidden;
}
.student-dialog::backdrop {
  background: rgba(18, 32, 38, 0.52);
  backdrop-filter: blur(2px);
}
.student-dialog-body {
  max-height: min(88vh, 820px);
  overflow: hidden;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #b8c6c8;
}
.student-form {
  display: flex;
  flex-direction: column;
  height: min(88vh, 820px);
  max-height: min(88vh, 820px);
  padding: 0;
  gap: 0;
  background:
    linear-gradient(180deg, #f3f7f7 0%, #eef4f4 48px, #fff 48px);
}
.student-form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 10px;
}
.student-form-head-text { min-width: 0; }
.student-form-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
}
.student-form-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.student-form-meta span:not(.muted) {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.student-dialog-x {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.student-dialog-x:hover {
  background: #fdecea;
  border-color: #f0b4ae;
  color: var(--danger);
}
.student-form-error {
  margin: 0 18px 10px;
  background: #fdecea;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
}
.student-form-tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.student-form-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 14px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.student-form-tab:hover { color: var(--ink); }
.student-form-tab.is-active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}
.student-form-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 8px;
  background: #fff;
}
.student-form-panel[hidden] { display: none !important; }
.student-form-panel.is-active { display: block; }
.student-form-section + .student-form-section { margin-top: 16px; }
.student-form-section-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.student-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}
.student-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.student-form-field.span-2 { grid-column: span 2; }
.student-form-field.span-3 { grid-column: 1 / -1; }
.student-form-field.is-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
}
.student-form-field.is-check .student-form-label { order: 2; margin: 0; color: var(--ink); }
.student-form-field.has-error .wb-input,
.student-form-field.has-error select.wb-input {
  border-color: #e2a39d;
  background: #fff8f7;
}
.student-form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.student-form-label i {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}
.student-form .wb-input,
.student-form select.wb-input,
.student-form textarea.wb-input {
  width: 100%;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid #c9d5d7;
  background: #fbfcfc;
  padding: 6px 10px;
}
.student-form .wb-input:focus,
.student-form select.wb-input:focus,
.student-form textarea.wb-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ru-date-widget {
  position: relative;
  display: block;
  width: 100%;
}
.ru-date-widget .ru-date-text {
  width: 100%;
  padding-right: 36px;
}
.cell-date-widget {
  min-width: 110px;
}
.cell-date-widget .ru-date-text.cell-input {
  padding-right: 30px;
}
.cell-date-widget .ru-date-native {
  width: 28px;
  height: 26px;
  right: 1px;
}
.cell-date-widget .ru-date-icon {
  right: 8px;
  width: 12px;
  height: 12px;
}
.ru-date-widget .ru-date-native {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 30px;
  opacity: 0.02;
  cursor: pointer;
  border: 0;
  padding: 0;
  z-index: 2;
}
.ru-date-widget .ru-date-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 1;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  opacity: 0.75;
  box-sizing: border-box;
}
.ru-date-widget .ru-date-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 3px;
  height: 1.5px;
  background: var(--muted);
}
.ru-date-widget .ru-date-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: -3px;
  width: 2px;
  height: 4px;
  background: var(--muted);
  box-shadow: 6px 0 0 var(--muted);
  border-radius: 1px;
}
.ru-date-widget:hover .ru-date-icon {
  opacity: 1;
  border-color: var(--accent);
}
.ru-date-widget:hover .ru-date-icon::before,
.ru-date-widget:hover .ru-date-icon::after {
  background: var(--accent);
}

.student-form textarea.wb-input {
  min-height: 72px;
  resize: vertical;
}
.student-form .student-instructors {
  min-height: 120px;
  padding: 6px;
}
.student-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: #f7fafa;
}
@media (max-width: 860px) {
  .student-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-form-field.span-2,
  .student-form-field.span-3 { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .student-dialog { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .student-dialog-body,
  .student-form {
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .student-form-grid { grid-template-columns: 1fr; }
  .student-form-tabs { overflow-x: auto; }
  .student-form-field.is-check { padding-top: 4px; }
}

.wb-btn.is-active-toggle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.head-labels.is-hidden,
.head-search.is-hidden { display: none; }

.head-search th {
  background: #dff0ed !important;
  padding: 2px 3px !important;
  vertical-align: middle;
}

.th-search {
  width: 100%;
  min-width: 0;
  height: 24px;
  border: 1px solid #9eb0b4;
  border-radius: 2px;
  padding: 0 4px;
  font: inherit;
  font-size: 0.72rem;
  background: #fff;
}

.th-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

table.is-search-mode thead .head-search {
  position: sticky;
  top: 0;
  z-index: 4;
}

.md-filters-sf {
  display: none;
}

/* —— Theory tickets workspace —— */
.wb-main:has(.theory-layout) {
  padding: 0;
  overflow: hidden;
}
.theory-layout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.theory-sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.theory-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.theory-side-count {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
}
.theory-side-search,
.theory-q-search {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.theory-filter-input {
  width: 100%;
  font-size: 0.82rem;
  padding: 5px 8px;
}
.theory-ticket-list {
  overflow: auto;
  flex: 1;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-content: start;
}
.theory-ticket-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 4px;
  align-items: center;
  padding: 6px 7px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  background: var(--surface-2);
}
.theory-ticket-item:hover {
  border-color: var(--line);
  background: var(--accent-soft);
  text-decoration: none;
}
.theory-ticket-item.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.theory-ticket-item.is-off {
  opacity: 0.5;
}
.theory-ticket-num {
  grid-column: 1;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
}
.theory-ticket-meta {
  grid-column: 1;
  font-size: 0.68rem;
  opacity: 0.8;
}
.theory-ticket-toggle {
  grid-column: 2;
  grid-row: 1 / span 2;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  align-self: center;
}
.theory-ticket-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.55;
}
.theory-ticket-dot.is-on {
  background: currentColor;
  opacity: 1;
}
.theory-ticket-item.is-active .theory-ticket-dot {
  border-color: rgba(255,255,255,0.85);
}
.theory-side-empty {
  grid-column: 1 / -1;
  padding: 10px 4px;
  font-size: 0.8rem;
}
.theory-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}
.theory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
}
.theory-toolbar h1 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.theory-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.theory-stat {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  white-space: nowrap;
}
.theory-settings-panel {
  position: relative;
}
.theory-settings-panel summary {
  list-style: none;
  cursor: pointer;
}
.theory-settings-panel summary::-webkit-details-marker {
  display: none;
}
.theory-settings-form {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 42, 50, 0.12);
  font-size: 0.82rem;
  min-width: 280px;
}
.theory-settings-form label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
}
.theory-settings-form .wb-input {
  width: 88px;
}
.theory-hsplit {
  display: grid;
  grid-template-columns: var(--theory-left-pct, 38%) 7px minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}
.theory-hsplitter {
  position: relative;
  z-index: 2;
  background: #c5d0d4;
  background-image: linear-gradient(90deg, #d5dee2 0%, #b8c4c8 100%);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.theory-hsplitter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 36px;
  margin: -18px 0 0 -1.5px;
  border-radius: 2px;
  background: #7a8a90;
  opacity: 0.7;
  pointer-events: none;
}
body.is-theory-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.is-theory-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
.theory-questions,
.theory-editor {
  min-height: 0;
  overflow: auto;
}
.theory-questions {
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}
.theory-q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.theory-q-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.theory-q-head-meta {
  font-size: 0.8rem;
  white-space: nowrap;
}
.theory-q-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.theory-q-badge--ok {
  background: #d7f0e8;
  color: #1e8449;
}
.theory-q-badge--off {
  background: #f0e8e6;
  color: #8a4a42;
}
.theory-q-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 6px;
  flex: 1;
}
.theory-q-item {
  display: grid;
  grid-template-columns: 26px 56px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.theory-q-item:hover {
  border-color: #85c1e9;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
}
.theory-q-item.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 2px 10px rgba(52, 152, 219, 0.12);
  background: #f3f9fd;
}
.theory-q-item.is-off {
  opacity: 0.58;
}
.theory-q-item[hidden] {
  display: none;
}
.theory-q-num {
  font-weight: 700;
  font-size: 0.92rem;
  padding-top: 2px;
}
.theory-q-thumb-wrap {
  width: 56px;
}
.theory-q-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8eef0;
  display: block;
}
.theory-q-thumb--empty {
  border: 1px dashed #c5d0c8;
}
.theory-q-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theory-q-text {
  font-size: 0.82rem;
  line-height: 1.38;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.theory-q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.theory-q-tag {
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef2f3;
  color: var(--muted);
  white-space: nowrap;
}
.theory-q-tag--answer {
  background: #d7f0e8;
  color: #176b3a;
  font-weight: 600;
}
.theory-q-tag--off {
  background: #fde8e6;
  color: #8a3b32;
}
.theory-pane-empty {
  margin: auto;
  padding: 24px;
  text-align: center;
}
.theory-editor {
  background: var(--surface);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.theory-editor-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 12px 14px 0;
}
.theory-editor-empty {
  margin: auto;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  max-width: 280px;
}
.theory-editor-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px dashed var(--line);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
}
.theory-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}
.theory-editor-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.theory-editor-head h2 {
  margin: 0;
  font-size: 1.02rem;
}
.theory-editor-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.theory-nav-btn {
  min-width: 32px;
  padding: 4px 8px;
  font-weight: 700;
}
.theory-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.theory-saved {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  padding-left: 4px;
}
.theory-editor-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.theory-editor-grid {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.theory-editor-media {
  position: sticky;
  top: 52px;
}
.theory-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.theory-field--grow {
  flex: 1;
  margin-bottom: 0;
}
.theory-field-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.theory-textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.theory-textarea--sm {
  min-height: 72px;
}
.theory-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.theory-check--inline {
  margin: 6px 0 0;
  font-size: 0.8rem;
}
.theory-check--pill {
  margin: 0 0 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
}
.theory-image-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.theory-image-link {
  display: block;
  text-decoration: none;
}
.theory-image-preview {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  background: #f4f7f8;
}
.theory-image-placeholder {
  display: grid;
  place-items: center;
  min-height: 100px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
  background: #fafcfc;
}
.theory-field--file {
  margin: 8px 0 0;
}
.theory-file-input {
  font-size: 0.78rem;
  width: 100%;
}
.theory-options {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  background: #fff;
}
.theory-options-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 600;
}
.theory-option-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.theory-option-row.is-correct {
  border-color: #9ed4cc;
  background: #eefaf8;
}
.theory-option-letter {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.theory-option-letter input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.theory-option-letter span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: #fff;
  transition: all 0.12s;
}
.theory-option-letter input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.theory-option-row--new {
  opacity: 0.85;
}
.theory-editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 16px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: var(--surface);
  z-index: 2;
}
.theory-editor-hint {
  font-size: 0.76rem;
}
.theory-readonly-text {
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0 0 12px;
}
.theory-readonly-opts {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.theory-readonly-opts li {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}
.theory-readonly-opts .is-correct {
  border-color: #9ed4cc;
  background: #eefaf8;
  font-weight: 600;
  color: var(--accent-2);
}
.theory-readonly-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.theory-readonly-explain {
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.88rem;
}
.theory-readonly-explain p {
  margin: 6px 0 0;
  color: var(--ink);
}
.theory-ticket-item[hidden] {
  display: none;
}
.theory-layout--videos {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}
.theory-theme-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  overflow: auto;
  flex: 1;
}
.theory-theme-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: inherit;
}
.theory-theme-item:hover {
  background: #eef4f4;
}
.theory-theme-item.is-active {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.theory-theme-item.is-off {
  opacity: 0.62;
}
.theory-theme-num {
  flex: 0 0 auto;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #d6ebf8;
  color: #1a5f8a;
  font-weight: 700;
  font-size: 0.8rem;
}
.theory-theme-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.theory-theme-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
}
.theory-theme-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.theory-theme-panels {
  display: flex;
  gap: 4px;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.theory-theme-panel-tab {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.theory-theme-panel-tab:hover {
  background: #eef4f4;
  color: var(--ink);
}
.theory-theme-panel-tab.is-active {
  background: #d6ebf8;
  color: #1a5f8a;
  border-color: #b7d7ea;
}
.theory-theme-panel {
  display: none;
}
.theory-theme-panel.is-active {
  display: block;
}
.theory-html-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 220px;
}
.theory-html-preview-wrap {
  margin-top: 10px;
}
.theory-html-preview-wrap summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
}
.theory-html-preview {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 360px;
  overflow: auto;
  line-height: 1.5;
}
.theory-html-preview img {
  max-width: 100%;
  height: auto;
}
.theory-theme-link-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theory-theme-link-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafa;
  font-size: 0.84rem;
}
.theory-theme-link-list a {
  font-weight: 600;
  color: #1a5f8a;
  text-decoration: none;
}
.theory-theme-link-list a:hover {
  text-decoration: underline;
}
.theory-theme-item[hidden] {
  display: none;
}
.theory-toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.theory-page-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.theory-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  padding: 3px;
  border-radius: 10px;
  background: #e8eeef;
  border: 1px solid var(--line);
}
.theory-mode-tab {
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
}
.theory-mode-tab:hover {
  text-decoration: none;
  color: var(--ink);
  background: rgba(255,255,255,0.65);
}
.theory-mode-tab.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--accent-2);
  box-shadow: 0 1px 4px rgba(28, 42, 50, 0.08);
}
.theory-layout--videos .theory-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.theory-video-list {
  overflow: auto;
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theory-video-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.theory-video-item:hover {
  border-color: #85c1e9;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
}
.theory-video-item.is-active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #f3f9fd 0%, #eaf4fb 100%);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.theory-video-item.is-off {
  opacity: 0.55;
}
.theory-video-item[hidden] {
  display: none;
}
.theory-video-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.theory-video-item.is-active .theory-video-play {
  background: var(--accent);
  color: #fff;
}
.theory-video-title-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  min-width: 0;
}
.theory-video-order {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.theory-video-title {
  line-height: 1.35;
  font-weight: 600;
  min-width: 0;
}
.theory-q-tag--theme {
  background: #e8f0f8;
  color: #3a5a7a;
}
.theory-video-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.theory-video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.theory-side-actions {
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.theory-side-actions .wb-btn {
  width: 100%;
}
.theory-ticket-new-form {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.theory-ticket-new-form .wb-input {
  width: 100%;
  min-width: 0;
  padding-inline: 5px;
}
.theory-side-actions .theory-ticket-new-form .wb-btn {
  width: 100%;
  min-width: 0;
  padding-inline: 4px;
  font-size: 0.74rem;
  white-space: nowrap;
}
.theory-q-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.theory-q-head-actions .wb-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
}
.theory-video-pane {
  min-height: 0;
  overflow: auto;
  flex: 1;
  background: var(--surface);
  padding: 0;
}
.theory-video-editor {
  padding: 14px 16px 0;
  max-width: 920px;
}
.theory-video-hero {
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0a0a;
  box-shadow: 0 4px 20px rgba(28, 42, 50, 0.12);
}
.theory-video-player,
.theory-video-embed {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 420px;
  border: 0;
  background: #000;
}
.theory-video-external {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 24px;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  background: #f4f8f8;
}
.theory-video-external:hover {
  text-decoration: none;
  background: var(--accent-soft);
}
.theory-video-external-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.theory-form-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.theory-form-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.theory-form-card--theme {
  border-color: #c5e0dc;
  background: linear-gradient(180deg, #fff 0%, #f8fcfb 100%);
}
.theory-form-card-title {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}
.theory-form-card-hint {
  margin: -4px 0 10px;
  font-size: 0.78rem;
}
.theory-upload-zone {
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: #fafcfc;
}
.theory-video-theme-card {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 0.84rem;
}
.theory-video-theme-card p {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.4;
}
.theory-video-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
}
.theory-video-empty-icon {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
}
.theory-inline-delete {
  display: inline;
  margin: 0;
}
.theory-inline-delete .wb-btn-danger {
  min-width: 32px;
  padding: 4px 8px;
}
.theory-field--narrow .wb-input {
  max-width: 140px;
}
.theory-video-flags {
  flex-wrap: wrap;
}
.theory-file-current {
  font-size: 0.76rem;
  display: block;
  margin-top: 4px;
  word-break: break-all;
}

/* Select2 — под стиль workbench */
.select2-container {
  min-width: 8rem;
  max-width: 100%;
  font-size: 0.875rem;
  vertical-align: middle;
}
.select2-container--default .select2-selection--single {
  height: 32px;
  border: 1px solid var(--line, #d0d7db);
  border-radius: 6px;
  background: #fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 30px;
  padding-left: 10px;
  padding-right: 28px;
  color: var(--ink, #1a1f22);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 30px;
  right: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted, #6b7280);
}
.select2-container--default .select2-selection--single .select2-selection__clear {
  height: 30px;
  margin-right: 18px;
  font-weight: 600;
  color: var(--muted, #6b7280);
}
.select2-container--default .select2-selection--multiple {
  min-height: 32px;
  border: 1px solid var(--line, #d0d7db);
  border-radius: 6px;
  background: #fff;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--accent, #0b6e4f);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #0b6e4f) 22%, transparent);
}
.select2-dropdown {
  border: 1px solid var(--line, #d0d7db);
  border-radius: 8px;
  z-index: 10050;
  overflow: hidden;
}
.select2-container--open {
  z-index: 10050;
}
.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--line, #d0d7db);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.875rem;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--accent, #0b6e4f);
}
.select2-container--default .select2-results__option--selected {
  background: var(--accent-soft, #e8f5f1);
  color: var(--ink, #1a1f22);
}
.toolbar .select2-container,
.side-field .select2-container,
.wb-branch-form .select2-container {
  min-width: 10rem;
}
.wb-branch-select + .select2-container {
  min-width: 11rem;
}
.th-search + .select2-container,
select.th-search + .select2-container {
  min-width: 100%;
  width: 100% !important;
}
.inline-form .select2-container,
td .select2-container {
  min-width: 9rem;
}
@media (max-width: 1100px) {
  .theory-editor-grid {
    grid-template-columns: 1fr;
  }
  .theory-editor-media {
    position: static;
  }
}
@media (max-width: 980px) {
  .theory-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .theory-sidebar {
    max-height: 160px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .theory-ticket-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .theory-hsplit {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 42%) 7px minmax(0, 1fr);
  }
  .theory-hsplitter {
    cursor: row-resize;
    background-image: linear-gradient(180deg, #d5dee2 0%, #b8c4c8 100%);
  }
  .theory-hsplitter::after {
    width: 36px;
    height: 3px;
    margin: -1.5px 0 0 -18px;
  }
  body.is-theory-resizing {
    cursor: row-resize !important;
  }
  body.is-theory-resizing * {
    cursor: row-resize !important;
  }
}

.app-access-card {
  margin: 0;
}
.app-access-msg {
  margin: .55rem 0 0;
  font-size: .9rem;
  color: var(--ok, #1a7f4b);
}
.app-access-msg.is-error { color: var(--danger, #b42318); }

/* Назначение инструкторов по группе */
.assign-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}
.assign-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.assign-toolbar .side-field { min-width: 220px; }
.assign-board {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.assign-board-meta { margin-bottom: 10px; font-size: 0.85rem; }
.assign-rows { display: flex; flex-direction: column; gap: 10px; }
.assign-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.assign-student {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.assign-current {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.assign-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.assign-empty-hint { margin: 0; }
.assign-active {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assign-active-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.assign-active-item.is-primary {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.assign-active-name {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 0.9rem;
}
.assign-norm-form,
.assign-remove-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.assign-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.assign-add-form .assign-instructor-select,
.assign-add-form .select2-container {
  min-width: 220px;
  flex: 1 1 220px;
}
.assign-lessons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}
.assign-lessons .wb-input { width: 72px; }
.instructor-categories { margin: 0; }
@media (max-width: 900px) {
  .assign-row { grid-template-columns: 1fr; }
}

/* Кабинет преподавателя теории */
.tt-layout { padding: 12px 16px 24px; max-width: 1200px; }
.tt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.tt-head h1 { margin: 4px 0 0; font-size: 1.25rem; }
.tt-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.tt-group-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.tt-group-card:hover { border-color: var(--accent); }
.tt-columns {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 18px;
}
.tt-section-title {
  margin: 18px 0 8px;
  font-size: 1rem;
}
.tt-create-lesson {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.tt-create-lesson label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.tt-lesson-list,
.tt-student-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tt-lesson-list li,
.tt-student-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f7fafa;
}
.tt-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tt-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tt-table th,
.tt-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tt-table th { background: #eef4f4; font-weight: 600; }
.tt-bulk-marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.tt-bulk-marks strong {
  margin-right: 4px;
  font-size: 0.85rem;
}
.tt-bulk-btn {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tt-bulk-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tt-attendance-table th:first-child,
.tt-attendance-table td:first-child {
  width: 40%;
  vertical-align: middle;
}
.tt-journal-table {
  width: max-content;
  min-width: 100%;
}
.tt-journal-table th,
.tt-journal-table td {
  vertical-align: middle;
}
.tt-journal-table .tt-journal-student {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}
.tt-journal-table thead .tt-journal-student {
  z-index: 4;
  background: #eef4f4;
}
.tt-journal-date {
  width: 72px;
  min-width: 72px;
  text-align: center !important;
}
.tt-journal-date small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
}
.tt-journal-date.is-current {
  min-width: 318px;
  background: #dcefeb;
  color: var(--accent-2);
}
.tt-journal-cell {
  text-align: center !important;
  font-weight: 700;
}
.tt-journal-cell.is-current {
  background: #f2faf7;
}
.tt-journal-cell .tt-mark-picker {
  flex-wrap: nowrap;
  justify-content: center;
}
.tt-journal-cell .tt-mark-option span {
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
}
.tt-journal-value {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
}
.tt-journal-mark--absent .tt-journal-value,
.tt-journal-mark--2 .tt-journal-value {
  background: #fdecea;
  color: #8a1f11;
}
.tt-journal-mark--4 .tt-journal-value,
.tt-journal-mark--5 .tt-journal-value {
  background: #e8f5ee;
  color: #1e6b45;
}
.tt-mark-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tt-mark-option {
  position: relative;
  cursor: pointer;
}
.tt-mark-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.tt-mark-option span {
  display: inline-flex;
  min-width: 40px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 600;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.tt-mark-option:hover span {
  border-color: var(--accent);
}
.tt-mark-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tt-mark-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.tt-mark--absent input:checked + span {
  border-color: #b84a3a;
  background: #fdecea;
  color: #8a1f11;
  box-shadow: inset 0 0 0 1px #b84a3a;
}
.tt-mark--5 input:checked + span,
.tt-mark--4 input:checked + span {
  border-color: #34845e;
  background: #e8f5ee;
  color: #1e6b45;
  box-shadow: inset 0 0 0 1px #34845e;
}
.tt-mark--2 input:checked + span {
  border-color: #b84a3a;
  background: #fdecea;
  color: #8a1f11;
  box-shadow: inset 0 0 0 1px #b84a3a;
}
.tt-q-text { line-height: 1.35; }
.tt-kpi {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.tt-kpi > div {
  min-width: 110px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tt-kpi strong { font-size: 1.2rem; }
.tt-ok { color: #1e6b45; font-weight: 600; }
.tt-no { color: #a33; font-weight: 600; }
.tt-actions { margin-top: 12px; }
.tt-flash {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fdecea;
  color: #8a1f11;
}
.tt-assign-card {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.tt-assign-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.tt-assign-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.tt-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}
.tt-flash--ok {
  background: #e8f6ef;
  color: #1e6b45;
}
.tt-create-panel {
  margin-bottom: 8px;
}
.tt-create-panel > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}
.tt-create-panel > summary::-webkit-details-marker { display: none; }
.tt-create-form,
.tt-edit-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.tt-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.tt-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.tt-check--block {
  justify-content: flex-start;
  align-items: center;
  margin-top: 22px;
}
.tt-chip {
  display: inline-block;
  margin: 1px 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e8eef2;
  font-size: 0.78rem;
}
.tt-table tr.is-off { opacity: 0.55; }
.tt-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .tt-columns { grid-template-columns: 1fr; }
  .tt-journal-table .tt-journal-student {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }
}


