@font-face {
  font-family: "DagMontserrat";
  src: url("./assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-display: swap;
  font-weight: 400;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.settings-tab {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  white-space: nowrap;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.settings-tab svg {
  width: 18px;
  height: 18px;
}

.settings-tab:hover,
.settings-tab:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}

.settings-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent);
}

.settings-tab-content {
  display: grid;
  gap: 20px;
}

.settings-section-head,
.settings-payroll-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-section-head h2 {
  margin: 4px 0;
}

.settings-payroll-actions {
  justify-content: flex-end;
  margin-top: -4px;
}

.data-transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.data-transfer-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.data-transfer-card.export-card {
  border-color: color-mix(in srgb, var(--success) 32%, var(--line));
}

.data-transfer-card.import-card {
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
}

.data-transfer-icon,
.data-import-warning-icon {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.import-card .data-transfer-icon,
.data-import-warning-icon {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.data-transfer-icon svg,
.data-import-warning-icon svg {
  width: 24px;
  height: 24px;
}

.data-transfer-copy {
  display: grid;
  gap: 8px;
}

.data-transfer-copy .badge {
  justify-self: start;
}

.data-transfer-copy h2,
.data-transfer-copy p {
  margin: 0;
}

.data-transfer-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.data-transfer-action {
  grid-column: 1 / -1;
  width: 100%;
}

.data-transfer-action svg,
.data-transfer-note svg,
.data-import-warning svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.visually-hidden-file {
  display: none;
}

.data-transfer-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
}

.data-transfer-note div {
  display: grid;
  gap: 4px;
}

.data-transfer-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.data-import-confirm-modal {
  width: min(620px, 100%);
}

.data-import-confirm-modal > h2 {
  margin: 10px 0 8px;
}

.data-import-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--line));
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  line-height: 1.5;
}

.data-import-summary {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.data-import-summary > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.4fr) minmax(0, 1fr);
  gap: 16px;
  padding: 11px 14px;
}

.data-import-summary > div + div {
  border-top: 1px solid var(--line);
}

.data-import-summary dt {
  color: var(--muted);
  font-size: 13px;
}

.data-import-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.salary-auto-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
}

.salary-auto-label svg {
  width: 14px;
  height: 14px;
}

.salary-calculation-box {
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
}

.salary-calculation-empty,
.salary-calculation-title > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.salary-calculation-empty svg,
.salary-calculation-title svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--primary);
}

.salary-calculation-empty div,
.salary-calculation-title div div {
  display: grid;
  gap: 3px;
}

.salary-calculation-empty span,
.salary-calculation-title span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.salary-calculation-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.salary-calculation-title a {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.salary-calculation-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.salary-calculation-head > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
}

.salary-calculation-head span {
  color: var(--muted);
  font-size: 12px;
}

.salary-calculation-head strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.salary-calculation-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.salary-calculation-groups span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.salary-calculation-groups b {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .settings-section-head,
  .settings-payroll-actions,
  .salary-calculation-title {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-payroll-actions .button,
  .settings-payroll-actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .salary-calculation-head,
  .salary-calculation-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-transfer-grid {
    grid-template-columns: 1fr;
  }

  .data-import-summary > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@font-face {
  font-family: "DagMontserrat";
  src: url("./assets/fonts/Montserrat-Medium.ttf") format("truetype");
  font-display: swap;
  font-weight: 500;
}

@font-face {
  font-family: "DagSignature";
  src: url("./assets/fonts/Alistair Signature.otf") format("opentype");
  font-display: swap;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --brand-warm: #f7f4e6;
  --brand-green: #474e27;
  --brand-green-deep: #30351a;
  --brand-bordo: #520808;
  --bg: #f7f4e6;
  --surface: #fffdf5;
  --surface-2: #f0ead8;
  --surface-3: #e5ddc8;
  --text: #252514;
  --muted: #676348;
  --faint: #928c70;
  --line: #ddd4bb;
  --primary: #474e27;
  --primary-strong: #30351a;
  --primary-soft: #e4e7d4;
  --accent: #520808;
  --accent-soft: #f1deda;
  --rose: #8b1717;
  --rose-soft: #f1deda;
  --sky: #3c6264;
  --sky-soft: #dce9e7;
  --violet: #69577c;
  --violet-soft: #e8e1ed;
  --success: #3f6f2c;
  --success-soft: #e1eed8;
  --warning: #8b5e13;
  --danger: #9b1c1c;
  --danger-soft: #f4d8d4;
  --shadow-sm: 0 1px 2px rgba(48, 53, 26, 0.08);
  --shadow-md: 0 12px 32px rgba(48, 53, 26, 0.1);
  --shadow-lg: 0 24px 60px rgba(48, 53, 26, 0.16);
  --radius: 8px;
  --radius-sm: 6px;
  --font: "DagMontserrat", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --script-font: "DagSignature", "Brush Script MT", cursive;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-warm: #f7f4e6;
  --brand-green: #aeb88a;
  --brand-green-deep: #15170d;
  --brand-bordo: #d27a72;
  --bg: #11130d;
  --surface: #191b12;
  --surface-2: #222619;
  --surface-3: #303521;
  --text: #f7f4e6;
  --muted: #c5bea2;
  --faint: #8e876e;
  --line: #3c402c;
  --primary: #aeb88a;
  --primary-strong: #e2e8c2;
  --primary-soft: rgba(174, 184, 138, 0.16);
  --accent: #d27a72;
  --accent-soft: rgba(210, 122, 114, 0.15);
  --rose: #ef9a93;
  --rose-soft: rgba(239, 154, 147, 0.14);
  --sky: #8ab4b0;
  --sky-soft: rgba(138, 180, 176, 0.14);
  --violet: #c5acd6;
  --violet-soft: rgba(197, 172, 214, 0.14);
  --success: #9cc878;
  --success-soft: rgba(156, 200, 120, 0.16);
  --warning: #d9ae66;
  --danger: #ef9a93;
  --danger-soft: rgba(239, 154, 147, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-warm) 92%, #ffffff) 0%, var(--bg) 360px),
    var(--bg);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 72%, #000000) 0%, var(--bg) 380px),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, #ffffff);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 1000;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary-strong);
  border-radius: var(--radius-sm);
  transition: top 180ms ease;
}

.skip-link:focus {
  top: 16px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 18px 14px;
  border-right: 1px solid color-mix(in srgb, var(--primary-strong) 76%, #000000);
  background:
    linear-gradient(180deg, var(--primary-strong), color-mix(in srgb, var(--primary-strong) 82%, #101006)),
    var(--primary-strong);
  color: var(--brand-warm);
  z-index: 40;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 150px;
  padding: 8px 8px 22px;
  text-align: center;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  border: 1px solid color-mix(in srgb, var(--brand-warm) 54%, transparent);
  border-radius: var(--radius);
  background: var(--brand-warm);
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  display: block;
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--brand-warm);
  background: var(--primary-strong);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: block;
  color: var(--brand-warm);
  font-size: 25px;
  line-height: 1;
  font-weight: 800;
}

.brand-wordmark {
  display: block;
  width: min(168px, 100%);
  height: 48px;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) saturate(100%) invert(93%) sepia(11%) saturate(567%) hue-rotate(7deg) brightness(107%) contrast(94%);
}

.brand-copy span {
  display: block;
  margin-top: 6px;
  color: color-mix(in srgb, var(--brand-warm) 78%, transparent);
  font-size: 14px;
  line-height: 1.25;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-color: color-mix(in srgb, var(--brand-warm) 32%, transparent) transparent;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section-label {
  padding: 0 12px 4px;
  color: color-mix(in srgb, var(--brand-warm) 50%, transparent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  color: color-mix(in srgb, var(--brand-warm) 72%, transparent);
  background: transparent;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover {
  color: var(--brand-warm);
  background: color-mix(in srgb, var(--brand-warm) 10%, transparent);
}

.nav-item.active {
  color: #30351a;
  background: #f7f4e6;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.locked {
  cursor: not-allowed;
  color: color-mix(in srgb, var(--brand-warm) 46%, transparent);
  background: color-mix(in srgb, var(--brand-warm) 4%, transparent);
}

.nav-item.locked:hover,
.nav-item.locked:active {
  color: color-mix(in srgb, var(--brand-warm) 46%, transparent);
  background: color-mix(in srgb, var(--brand-warm) 4%, transparent);
  transform: none;
}

.nav-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--brand-warm) 20%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--brand-warm) 8%, transparent);
}

.nav-lock small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
}

.nav-lock svg {
  width: 15px;
  height: 15px;
}

.nav-alert-badge {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, #ffffff 34%, transparent);
  border-radius: 999px;
  color: #ffffff;
  background: var(--danger);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--danger) 32%, transparent);
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.nav-item svg,
.topbar svg,
.button svg,
.ghost-button svg,
.icon-button svg,
.metric-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
}

.health-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--brand-warm) 18%, transparent);
  border-radius: var(--radius);
  color: var(--brand-warm);
  background: color-mix(in srgb, var(--brand-warm) 9%, transparent);
}

.health-card strong,
.health-card span {
  display: block;
}

.health-card strong {
  font-size: 13px;
}

.health-card span {
  color: color-mix(in srgb, var(--brand-warm) 72%, transparent);
  font-size: 12px;
}

.health-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 18%, transparent);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(16px);
}

.menu-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
  max-width: 780px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, var(--primary));
  border-radius: var(--radius);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 76%, var(--brand-warm));
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.global-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button,
.ghost-button,
.icon-button,
.profile-chip,
.segmented button,
.mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.button {
  padding: 0 16px;
  color: var(--brand-warm);
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .button {
  color: #11130d;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button.danger-button {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.button:active,
.ghost-button:active,
.icon-button:active,
.profile-chip:active,
.mini-action:active,
.nav-item:active {
  transform: translateY(1px);
}

.ghost-button,
.profile-chip {
  padding: 0 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, #ffffff);
  border-color: var(--line);
}

.ghost-button:hover,
.icon-button:hover,
.profile-chip:hover,
.mini-action:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
}

.icon-button {
  width: 44px;
  padding: 0;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, #ffffff);
  border-color: var(--line);
}

.icon-button.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

.profile-chip .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
  color: var(--brand-warm);
  background: var(--accent);
}

:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .profile-chip .avatar,
:root[data-theme="dark"] .segmented button.active {
  color: #11130d;
}

.search-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 24px;
  width: min(760px, calc(100vw - 48px));
  max-height: min(70dvh, 640px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.search-result {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.search-result:hover {
  background: var(--surface-2);
}

.result-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}

.result-title,
.result-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  color: var(--muted);
  font-size: 13px;
}

.main-content {
  display: grid;
  gap: 22px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px;
}

.main-content > *,
.panel {
  min-width: 0;
}

.page-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 6px;
}

.page-head::after {
  content: "";
  position: absolute;
  top: -10px;
  right: 4px;
  width: 104px;
  aspect-ratio: 1;
  background: url("./assets/brand/dagenglish-mark-green.png") center / contain no-repeat;
  opacity: 0.08;
  pointer-events: none;
}

.page-head > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.page-head h1 {
  overflow-wrap: anywhere;
}

.page-title-with-alert {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.page-alert-badge {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--danger);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--danger) 26%, transparent);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.08;
  font-weight: 500;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
  font-weight: 500;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 500;
}

.page-head p,
.muted {
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.side-main {
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
}

.panel,
.metric-card,
.student-card,
.teacher-card,
.group-card,
.setting-card {
  border: 1px solid color-mix(in srgb, var(--line) 88%, var(--primary));
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 18px;
}

.finance-panel {
  border-top-width: 3px;
}

.finance-panel.income {
  border-top-color: var(--success);
}

.finance-panel.expense {
  border-top-color: var(--danger);
}

.finance-panel.income h2 {
  color: var(--success);
}

.finance-panel.expense h2 {
  color: var(--danger);
}

.finance-summary-panel {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--primary);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 38%),
    var(--surface);
}

.finance-summary-panel.positive {
  border-top-color: var(--success);
}

.finance-summary-panel.negative {
  border-top-color: var(--danger);
}

.finance-profit-hero {
  display: grid;
  gap: 5px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--line);
}

.finance-profit-hero span,
.finance-summary-details span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.finance-profit-hero strong {
  color: var(--success);
  font-size: clamp(30px, 3vw, 44px);
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.finance-summary-panel.negative .finance-profit-hero strong {
  color: var(--danger);
}

.finance-summary-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
}

.finance-summary-details > div {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.finance-summary-details strong {
  font-size: clamp(15px, 1.4vw, 19px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.employee-role-overview {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.employee-role-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.employee-role-overview-head h2,
.employee-role-overview-head p {
  margin-bottom: 0;
}

.employee-role-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.employee-role-summary-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 116px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
}

.employee-role-summary-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.employee-role-summary-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.employee-role-summary-card > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.employee-role-summary-card span:not(.employee-role-summary-icon) {
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.employee-role-summary-card strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.employee-role-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.panel-head,
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head p,
.card-head p {
  margin-bottom: 0;
}

.metric-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 138px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--brand-warm)), var(--surface)),
    var(--surface);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--primary);
}

.metric-card.income::before {
  background: var(--success);
}

.metric-card.expense::before {
  background: var(--danger);
}

.metric-card.warn::before {
  background: var(--warning);
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  min-width: 0;
  font-size: clamp(22px, 2.1vw, 28px);
  line-height: 1.12;
  font-weight: 500;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.analytics-metric-grid .metric-card strong {
  white-space: nowrap;
  overflow-wrap: normal;
  letter-spacing: -0.04em;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--brand-warm);
  background: var(--primary-soft);
  background-color: var(--brand-green-deep);
  border-radius: var(--radius);
}

.metric-card.income .metric-icon {
  color: var(--success);
  background: var(--success-soft);
}

.metric-card.expense .metric-icon,
.metric-card.warn .metric-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.metric-card.income strong,
.mini-kpi.income strong {
  color: var(--success);
}

.metric-card.expense strong,
.mini-kpi.expense strong {
  color: var(--danger);
}

.metric-delta {
  align-self: end;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  font-size: 12px;
  font-weight: 700;
}

.metric-delta.warn {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.metric-delta.positive {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 13%, transparent);
}

.metric-delta.negative {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.metric-card-action {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.metric-card-action:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  box-shadow: var(--shadow-md);
}

.metric-card-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 3px;
}

.metric-card-open {
  display: inline-flex;
  align-items: center;
  align-self: end;
  gap: 5px;
  color: var(--primary-strong) !important;
  font-weight: 800;
}

.metric-card-open svg {
  width: 15px;
  height: 15px;
  transform: rotate(-90deg);
}

.text-positive {
  color: var(--success);
}

.text-negative {
  color: var(--danger);
}

.metric-delta.neutral {
  color: var(--muted);
  background: var(--surface-2);
}

.period-sticky-shell {
  position: sticky;
  top: 84px;
  z-index: 22;
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--text) 11%, transparent);
  backdrop-filter: blur(18px);
  overflow: visible;
}

.report-period-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px 12px 18px;
}

.report-period-current {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.report-period-current span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-period-current strong {
  overflow-wrap: anywhere;
  font-size: clamp(14px, 1.4vw, 17px);
}

.report-period-picker {
  position: relative;
  flex: 0 0 auto;
}

.report-period-picker > summary {
  min-height: 46px;
  min-width: 166px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--text) 7%, transparent);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.report-period-picker > summary::-webkit-details-marker {
  display: none;
}

.report-period-picker > summary:hover,
.report-period-picker > summary:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 9px 24px color-mix(in srgb, var(--primary) 15%, transparent);
}

.report-period-picker > summary:active {
  transform: translateY(1px);
}

.report-period-picker > summary svg {
  width: 18px;
  height: 18px;
}

.report-period-picker > summary svg:last-child {
  width: 15px;
  height: 15px;
  margin-left: 2px;
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.report-period-picker[open] > summary svg:last-child {
  transform: rotate(270deg);
}

.report-period-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: min(430px, calc(100vw - 36px));
  max-height: min(70dvh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 55px color-mix(in srgb, var(--text) 18%, transparent);
  animation: report-period-in 160ms ease-out;
}

body:has([role="dialog"][aria-modal="true"]) {
  overflow: hidden;
}

@keyframes report-period-in {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.report-period-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.report-period-options button {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.report-period-options button:hover,
.report-period-options button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--line));
  background: var(--primary-soft);
}

.report-period-options button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}

.report-custom-range {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.report-custom-range .analytics-date-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-period-done {
  min-height: 44px;
  justify-self: stretch;
}

.receipts-panel {
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--success) 13%, transparent), transparent 28%),
    var(--surface);
}

.receipts-head h2.receipts-period-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  margin: 4px 0 7px;
  font-size: 15px;
  line-height: 1.45;
}

.receipts-period-title span {
  color: var(--text);
  font-weight: 800;
}

.receipts-period-title small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.receipts-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.receipt-kpi,
.receipt-progress {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.receipt-kpi span,
.receipt-progress span,
.receipt-progress small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.receipt-kpi strong,
.receipt-progress strong {
  font-size: clamp(22px, 2vw, 30px);
  font-variant-numeric: tabular-nums;
}

.receipt-kpi.received {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
  background: var(--success-soft);
}

.receipt-kpi.planned {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.receipt-kpi.remainder,
.receipt-debt {
  color: var(--danger);
}

.receipt-kpi.remainder {
  border-color: color-mix(in srgb, var(--danger) 22%, var(--line));
  background: var(--danger-soft);
}

.receipt-progress .progress span {
  background: var(--success);
}

.receipt-branch-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}

.receipt-branch-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--success) 24%, var(--line));
  border-radius: 999px;
  color: var(--success);
  background: var(--surface);
  font-weight: 800;
}

.receipt-branch-chips svg {
  width: 16px;
  height: 16px;
}

.receipt-income {
  color: var(--success);
  font-weight: 800;
}

.receipt-total td {
  background: var(--surface-2);
}

.table-scroll {
  max-height: min(62dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--surface-2) 74%, var(--brand-warm));
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--primary-soft) 58%, transparent);
}

.finance-operation-row {
  cursor: pointer;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.finance-operation-row:focus-visible {
  outline: 0;
  background: color-mix(in srgb, var(--primary-soft) 72%, transparent);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-cell strong,
.person-cell > div > span {
  display: block;
}

.person-cell > div > span {
  color: var(--muted);
  font-size: 13px;
}

.avatar.soft {
  display: inline-grid;
  place-items: center;
  color: var(--primary-strong);
  background: var(--primary-soft);
  line-height: 1;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.rose {
  color: var(--rose);
  background: var(--rose-soft);
}

.badge.sky {
  color: var(--sky);
  background: var(--sky-soft);
}

.badge.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.badge.income {
  color: var(--success);
  background: var(--success-soft);
}

.badge.expense {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress-row {
  display: grid;
  gap: 6px;
}

.progress-row .line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--brand-warm));
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--brand-warm);
  background: var(--surface);
  background-color: var(--primary-strong);
  box-shadow: var(--shadow-sm);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.required-mark {
  color: var(--danger);
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, #ffffff);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.checkbox-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 8px;
}

.schedule-days-field .field-helper {
  margin: 0 0 10px;
}

.schedule-preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.schedule-preset-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.schedule-preset-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.schedule-preset-button:hover,
.schedule-preset-button:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.schedule-preset-button.is-active {
  border-color: var(--primary-strong);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.locked-feature-field {
  gap: 8px;
}

.locked-feature-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.locked-feature-control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
}

.locked-feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--surface);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.locked-feature-icon svg {
  width: 19px;
  height: 19px;
}

.locked-feature-control > span:last-child {
  display: grid;
  gap: 2px;
}

.locked-feature-control strong {
  color: var(--text);
}

.locked-feature-control small {
  font-size: 12px;
  line-height: 1.4;
}

.schedule-days-grid {
  display: grid;
  grid-template-columns: minmax(132px, 1.7fr) repeat(7, minmax(44px, 1fr));
  gap: 8px;
}

.schedule-days-grid .schedule-all span {
  padding-inline: 14px;
}

.checkbox-pill {
  display: grid;
  min-height: 44px;
  cursor: pointer;
}

.checkbox-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-pill span {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.checkbox-pill input:checked + span {
  border-color: var(--primary-strong);
  color: #fff;
  background: var(--primary-strong);
}

.checkbox-pill input:focus-visible + span {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.gender-choice-fieldset {
  gap: 8px;
}

.gender-choice-fieldset .field-helper {
  margin: 0;
}

.gender-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gender-choice {
  display: grid;
  min-height: 52px;
  cursor: pointer;
}

.gender-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.gender-choice > span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.gender-choice i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: 7px;
  color: transparent;
  background: var(--surface-2);
}

.gender-choice i svg {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}

.gender-choice input:checked + span {
  border-color: var(--primary-strong);
  color: var(--primary-strong);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.gender-choice input:checked + span i {
  border-color: var(--primary-strong);
  color: #fff;
  background: var(--primary-strong);
}

.gender-choice input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  outline-offset: 2px;
}

@media (max-width: 460px) {
  .gender-choice-grid {
    grid-template-columns: 1fr;
  }
}

.mini-action {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  font-size: 13px;
}

.chart {
  width: 100%;
  min-height: 260px;
}

.chart svg {
  width: 100%;
  height: auto;
}

.chart-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.bar-stack {
  display: grid;
  gap: 12px;
}

.rent-payment-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.rent-payment-history-row .record-actions .icon-button {
  width: 36px;
  min-height: 36px;
}

.rent-ledger-operation-row td {
  min-height: 58px;
}

.rent-operation-amount {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rent-ledger-table .record-actions {
  flex-wrap: nowrap;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 140px) minmax(0, 1fr) minmax(72px, max-content);
  gap: 12px;
  align-items: center;
}

.bar-row > * {
  min-width: 0;
}

.bar-row strong {
  overflow-wrap: anywhere;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.mini-kpi {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
  overflow: hidden;
}

.mini-kpi strong,
.mini-kpi span {
  display: block;
}

.mini-kpi strong {
  font-size: 18px;
  line-height: 1.18;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.mini-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}

.salary-payment-item {
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
}

.group-row-actions,
.notification-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.searchable-field {
  position: relative;
  z-index: 4;
}

.searchable-control {
  position: relative;
}

.searchable-control > svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.searchable-control input[type="search"] {
  width: 100%;
  padding-left: 42px;
}

.searchable-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% - 18px);
  right: 0;
  left: 0;
  max-height: 288px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.searchable-suggestions button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.searchable-suggestions button:hover,
.searchable-suggestions button:focus-visible {
  outline: none;
  background: var(--primary-soft);
  color: var(--primary);
}

.searchable-suggestions svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.searchable-empty {
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.salary-ledger-panel {
  padding: 0;
  overflow: hidden;
}

.salary-ledger-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.salary-table-scroll {
  border: 0;
  border-radius: 0;
}

.salary-ledger-table {
  min-width: 1280px;
}

.salary-ledger-table th,
.salary-ledger-table td {
  padding: 15px 16px;
  vertical-align: middle;
}

.salary-ledger-table th:first-child,
.salary-ledger-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 230px;
  background: var(--surface);
}

.salary-ledger-table th:first-child {
  background: var(--surface-2);
}

.salary-number {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.success-text {
  color: var(--success);
}

.warning-text {
  color: var(--warning);
}

.salary-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.salary-status svg {
  width: 16px;
  height: 16px;
}

.salary-status.paid {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

.salary-status.waiting {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.salary-pay-button {
  min-height: 40px;
  white-space: nowrap;
}

.salary-pay-button svg {
  width: 17px;
  height: 17px;
}

.salary-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.salary-row-actions .mini-action {
  min-height: 40px;
  white-space: nowrap;
}

.salary-row-actions svg {
  width: 17px;
  height: 17px;
}

.salary-bottom-grid {
  align-items: start;
}

.salary-branches-panel {
  width: 100%;
}

.salary-history-panel {
  padding: 18px;
}

.salary-history-panel .panel-head {
  margin-bottom: 10px;
}

.salary-history-list {
  max-height: 280px;
  overflow-y: auto;
}

.salary-history-list .timeline-item {
  padding: 8px 10px;
}

.salary-history-layer {
  z-index: 1350;
}

.salary-history-modal {
  display: grid;
  width: min(920px, 100%);
  max-height: calc(100dvh - 40px);
  gap: 16px;
  overflow: hidden;
  padding: clamp(18px, 2.4vw, 26px);
}

.salary-history-modal-head {
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.salary-history-modal [data-salary-history-close] svg {
  transform: rotate(45deg);
}

.salary-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.salary-history-summary > div {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.salary-history-summary span,
.salary-history-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.salary-history-summary strong,
.salary-history-record-main strong {
  font-variant-numeric: tabular-nums;
}

.salary-history-summary strong {
  font-size: 20px;
}

.salary-history-scroll {
  display: grid;
  min-height: 120px;
  max-height: min(54dvh, 560px);
  gap: 10px;
  padding-right: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.salary-history-scroll:focus-visible {
  border-radius: var(--radius);
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 3px;
}

.salary-history-record {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.salary-history-record-main {
  display: grid;
  gap: 6px;
}

.salary-history-record-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.salary-history-record-main strong {
  color: var(--primary);
  font-size: 22px;
}

.salary-history-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}

.salary-history-details > div {
  min-width: 0;
}

.salary-history-details dt,
.salary-history-details dd {
  margin: 0;
}

.salary-history-details dd {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.salary-history-comment {
  grid-column: 1 / -1;
}

.salary-history-record-actions {
  align-self: center;
}

.salary-overpayment-layer {
  z-index: 1500;
}

.salary-overpayment-modal {
  display: grid;
  width: min(560px, 100%);
  gap: 14px;
}

.salary-overpayment-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: var(--warning);
  background: var(--warning-soft);
}

.salary-overpayment-icon svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 720px) {
  .salary-history-summary,
  .salary-history-details {
    grid-template-columns: 1fr;
  }

  .salary-history-record {
    grid-template-columns: 1fr auto;
  }

  .salary-history-details {
    grid-column: 1 / -1;
  }

  .salary-history-comment {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .salary-history-modal {
    max-height: calc(100dvh - 16px);
  }

  .salary-history-record {
    grid-template-columns: 1fr;
  }

  .salary-history-record-actions {
    justify-self: end;
  }
}

.teacher-payroll-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.teacher-payroll-month {
  display: grid;
  min-width: 210px;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.teacher-payroll-month input {
  min-height: 46px;
}

.teacher-payroll-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.teacher-payroll-card {
  display: grid;
  gap: 16px;
}

.teacher-payroll-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.teacher-payroll-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px 16px;
  padding: 15px 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.teacher-payroll-total span,
.teacher-payroll-total small {
  color: var(--muted);
}

.teacher-payroll-total strong {
  color: var(--primary);
  font-size: clamp(22px, 3vw, 30px);
  font-variant-numeric: tabular-nums;
}

.teacher-payroll-total small {
  grid-column: 1 / -1;
}

.teacher-group-payroll-list {
  display: grid;
  gap: 8px;
}

.teacher-group-payroll-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.teacher-group-payroll-row > div {
  display: grid;
  gap: 3px;
}

.teacher-group-payroll-row > div:last-child {
  text-align: right;
}

.teacher-group-payroll-row span {
  color: var(--muted);
  font-size: 12px;
}

.teacher-group-payroll-row strong {
  font-variant-numeric: tabular-nums;
}

.teacher-payroll-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.teacher-payroll-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.teacher-payroll-meta svg {
  width: 15px;
  height: 15px;
}

.teacher-payroll-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--warning);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  background: color-mix(in srgb, var(--warning) 8%, transparent);
  font-size: 13px;
}

.teacher-lessons-panel {
  padding: 0;
  overflow: hidden;
}

.teacher-lessons-panel .panel-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.teacher-lessons-table {
  min-width: 1120px;
}

.teacher-lessons-table th,
.teacher-lessons-table td {
  padding: 13px 15px;
  vertical-align: middle;
}

@media (max-width: 920px) {
  .teacher-payroll-grid {
    grid-template-columns: 1fr;
  }

  .teacher-payroll-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-payroll-month {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .teacher-group-payroll-row {
    grid-template-columns: 1fr;
  }

  .teacher-group-payroll-row > div:last-child {
    text-align: left;
  }
}

.timeline-time {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.student-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
}

.student-hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.75fr);
  gap: 20px;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--success) 10%, transparent), transparent 58%),
    var(--surface);
}

.student-hero-main h2 {
  margin: 4px 0 8px;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -0.05em;
}

.student-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.student-priority-panel {
  display: grid;
  align-content: start;
}

.student-priority-list {
  display: grid;
  gap: 10px;
}

.student-priority-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 68%, var(--surface));
}

.student-priority-item.debt {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 68%, var(--surface));
}

.student-priority-item.risk {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--surface));
}

.student-filter-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 58%),
    var(--surface);
}

.student-filter-topline {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.student-local-search {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.student-local-search > svg {
  position: absolute;
  z-index: 1;
  bottom: 14px;
  left: 14px;
  width: 19px;
  height: 19px;
}

.student-local-search input {
  min-height: 48px;
  padding-left: 44px;
  font-size: 16px;
}

.student-filter-result {
  min-height: 48px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.student-format-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.student-format-filter button {
  display: flex;
  align-items: center;
  min-height: 62px;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.student-format-filter button:hover,
.student-format-filter button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  outline: none;
}

.student-format-filter button:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.student-format-filter button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 34%, transparent);
}

.student-format-filter svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  color: var(--primary);
}

.student-format-filter span,
.student-format-filter strong,
.student-format-filter small {
  display: block;
}

.student-format-filter small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.student-sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-sort-row > span {
  margin-right: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.student-sort-row button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.student-sort-row button:hover,
.student-sort-row button:focus-visible,
.student-sort-row button.active {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.student-advanced-filters {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.student-advanced-filters summary {
  display: grid;
  grid-template-columns: auto minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  min-height: 48px;
  gap: 9px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.student-advanced-filters summary::-webkit-details-marker {
  display: none;
}

.student-advanced-filters summary svg {
  width: 18px;
  height: 18px;
}

.student-advanced-filters summary svg:last-child {
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.student-advanced-filters[open] summary svg:last-child {
  transform: rotate(-90deg);
}

.student-advanced-filters summary small {
  color: var(--muted);
  font-weight: 600;
}

.student-advanced-filters .student-filter-grid {
  padding: 4px 14px 14px;
}

@media (max-width: 720px) {
  .student-filter-topline,
  .student-format-filter {
    grid-template-columns: 1fr;
  }

  .student-filter-result {
    width: 100%;
    text-align: center;
  }

  .student-advanced-filters summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .student-advanced-filters summary small {
    display: none;
  }
}

.student-filter-summary {
  display: flex;
  justify-content: flex-end;
}

.student-payment-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
}

.student-payment-filter button {
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.student-payment-filter button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
}

.student-payment-filter button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  outline-offset: 2px;
}

.student-payment-filter button.active {
  color: #fff;
  border-color: var(--primary-strong);
  background: linear-gradient(135deg, var(--primary-strong), color-mix(in srgb, var(--success) 45%, var(--primary-strong)));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--primary-strong) 18%, transparent);
}

.student-payment-filter strong,
.student-payment-filter span {
  display: block;
}

.student-payment-filter span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.student-payment-filter button.active span {
  color: #fff;
}

.student-overdue-settings {
  display: grid;
  place-items: center;
  align-self: stretch;
  width: 48px;
  min-height: 48px !important;
  padding: 10px !important;
  color: var(--muted) !important;
  background: var(--surface-2) !important;
}

.student-overdue-settings:hover {
  color: var(--primary-strong) !important;
}

.student-overdue-settings svg {
  width: 19px;
  height: 19px;
}

.student-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.student-filter-actions {
  display: flex;
  justify-content: flex-end;
}

.students-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.student-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border-left: 5px solid var(--primary);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 6%, transparent), transparent 58%),
    var(--surface);
}

.student-card.has-debt {
  border-left-color: var(--danger);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--danger) 8%, transparent), transparent 56%),
    var(--surface);
}

.student-card.is-risk:not(.has-debt) {
  border-left-color: var(--accent);
}

.student-card.selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent), var(--shadow-sm);
}

.student-card-head,
.student-person,
.student-card-actions,
.student-card-tags,
.student-card-info span,
.student-payment-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-card-head,
.student-card-actions {
  justify-content: space-between;
}

.student-person {
  min-width: 0;
}

.student-person h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.student-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.student-card-tags {
  flex-wrap: wrap;
}

.student-card-tags span {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--surface));
  font-size: 12px;
  font-weight: 800;
}

.student-card-tags .student-payment-expiry-tag.is-soon {
  color: color-mix(in srgb, var(--warning) 82%, var(--text));
  background: color-mix(in srgb, var(--warning) 13%, var(--surface));
}

.student-card-tags .student-payment-expiry-tag.is-expired {
  color: var(--danger);
  background: var(--danger-soft);
}

.student-card-info {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.student-card-info svg,
.student-payment-strip svg {
  width: 18px;
  height: 18px;
}

.student-next-lesson {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.student-next-lesson-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
}

.student-next-lesson-icon svg {
  width: 22px;
  height: 22px;
}

.student-next-lesson > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.student-next-lesson small,
.student-next-lesson span:not(.student-next-lesson-icon) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.student-next-lesson strong {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.student-next-lesson.is-missing {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: var(--warning-soft);
}

.student-next-lesson.is-missing .student-next-lesson-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
}

@media (max-width: 520px) {
  .student-next-lesson {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .student-next-lesson > .mini-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

.student-payment-strip {
  min-height: 48px;
  padding: 12px;
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}

.student-payment-strip.ok {
  color: var(--success);
  background: var(--success-soft);
}

.student-payment-strip.debt {
  color: var(--danger);
  background: var(--danger-soft);
}

.student-payment-strip.debt[data-student-payment] {
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.student-payment-strip.debt[data-student-payment]:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--danger) 12%, transparent);
}

.student-payment-strip.debt[data-student-payment]:focus-visible,
.group-payment-action:focus-visible,
.student-delete-depart-hint button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 25%, transparent);
  outline-offset: 2px;
}

.student-delete-depart-hint {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--line));
  border-radius: var(--radius);
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.student-delete-depart-hint svg {
  width: 24px;
  height: 24px;
}

.student-delete-depart-hint strong {
  color: var(--warning);
}

.student-delete-depart-hint p {
  margin: 4px 0 0;
  color: var(--muted);
}

.student-delete-depart-hint button {
  min-height: 44px;
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line));
}

.overdue-settings-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.overdue-settings-callout svg {
  width: 24px;
  height: 24px;
}

.overdue-settings-callout p {
  margin: 4px 0 0;
  color: var(--muted);
}

.student-card-actions {
  flex-wrap: wrap;
}

.student-primary-actions,
.record-actions,
.teacher-card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-primary-actions {
  flex-wrap: wrap;
}

.student-primary-actions .mini-action {
  min-height: 44px;
}

.muted-action {
  color: var(--muted);
}

.student-icon-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.delete-warning-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  border-radius: var(--radius);
  color: var(--danger);
  background: var(--danger-soft);
}

.delete-warning-box svg {
  width: 28px;
  height: 28px;
}

.delete-warning-box p {
  margin: 5px 0 0;
}

.branch-delete-options-modal {
  width: min(860px, 100%);
}

.branch-delete-impact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.branch-delete-impact span {
  display: grid;
  gap: 3px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.branch-delete-impact strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.branch-delete-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.branch-delete-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.branch-delete-choice > span:last-child {
  display: grid;
  gap: 8px;
}

.branch-delete-choice strong {
  font-size: 16px;
  line-height: 1.35;
}

.branch-delete-choice small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.branch-delete-choice-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.branch-delete-choice-icon svg {
  width: 21px;
  height: 21px;
}

.branch-delete-choice.keep:hover,
.branch-delete-choice.keep:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.branch-delete-choice.cascade {
  border-color: color-mix(in srgb, var(--danger) 32%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 42%, var(--surface));
}

.branch-delete-choice.cascade .branch-delete-choice-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.branch-delete-choice.cascade:hover,
.branch-delete-choice.cascade:focus-visible {
  border-color: var(--danger);
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 13%, transparent);
}

.trash-list {
  display: grid;
  gap: 12px;
}

.trash-card {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--line));
  border-left: 5px solid var(--danger);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--danger) 6%, transparent), transparent 48%),
    var(--surface);
}

.trash-card h3 {
  margin: 0 0 4px;
}

.trash-card-meta {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.trash-card-meta span,
.trash-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trash-card-meta svg {
  width: 17px;
  height: 17px;
}

.trash-card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.group-card,
.teacher-card,
.setting-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.groups-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.group-filter-panel {
  display: grid;
  gap: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 58%),
    var(--surface);
}

.group-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.group-filter-wide {
  grid-column: span 2;
}

.teacher-groups-board {
  display: grid;
  gap: 14px;
}

.teacher-group-accordion {
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: clip;
}

.teacher-group-accordion > summary {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) minmax(330px, auto);
  gap: 14px;
  align-items: center;
  min-height: 116px;
  padding: 18px 20px;
  list-style: none;
  cursor: pointer;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 62%),
    var(--surface);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.teacher-group-accordion > summary::-webkit-details-marker {
  display: none;
}

.teacher-group-accordion > summary:hover,
.teacher-group-accordion[open] > summary {
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
}

.teacher-group-accordion[open] > summary {
  border-bottom: 1px solid var(--line);
}

.teacher-group-chevron {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary-strong);
  transition: transform 180ms ease;
}

.teacher-group-chevron svg {
  width: 20px;
  height: 20px;
}

.teacher-group-accordion[open] .teacher-group-chevron {
  transform: rotate(90deg);
}

.teacher-group-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.teacher-group-identity > strong {
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.12;
}

.teacher-group-identity small {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.teacher-group-identity em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.teacher-group-identity svg {
  width: 16px;
  height: 16px;
}

.teacher-group-summary-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
}

.teacher-group-summary-kpis b {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.teacher-group-summary-kpis small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.teacher-group-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}

.teacher-group-content .lesson-group-card {
  box-shadow: none;
}

.teacher-group-content .group-card-actions .record-actions {
  margin-left: auto;
}

.lesson-group-card {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary) 20%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--success) 8%, transparent), transparent 58%),
    var(--surface);
}

.lesson-group-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.group-card-top,
.group-name-wrap,
.group-title-line,
.group-chip-row,
.group-schedule-line,
.group-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-card-top,
.group-title-line,
.group-card-actions {
  justify-content: space-between;
}

.group-title-line {
  flex-wrap: wrap;
}

.group-title-line h2 {
  margin: 0;
}

.group-name-wrap {
  min-width: 0;
}

.group-name-wrap h2 {
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.group-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.group-chip-row,
.group-schedule-line {
  flex-wrap: wrap;
}

.group-schedule-line {
  color: var(--muted);
  font-weight: 700;
}

.group-schedule-line span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.group-schedule-line svg {
  width: 18px;
  height: 18px;
}

.group-finance-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.group-payment-tile,
.group-debt-tile {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
}

.group-payment-tile {
  color: var(--success);
  background: var(--success-soft);
}

.group-debt-tile {
  color: var(--danger);
  background: var(--danger-soft);
}

.group-payment-tile span,
.group-debt-tile span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 900;
}

.group-payment-tile svg,
.group-debt-tile svg {
  width: 18px;
  height: 18px;
}

.group-payment-tile strong,
.group-debt-tile strong {
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.group-comment-preview {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.group-ops-list {
  display: grid;
  gap: 12px;
}

.group-ops-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(260px, 1fr) minmax(220px, 0.9fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 58%, var(--surface));
}

.group-ops-row.has-debt {
  border-left-color: var(--danger);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--danger) 7%, transparent), transparent 38%),
    var(--surface);
}

.group-ops-main p {
  margin: 4px 0 0;
}

.group-ops-meta {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.group-ops-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.group-ops-meta svg {
  width: 17px;
  height: 17px;
}

.group-ops-comment {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.group-ops-comment strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.group-details-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.group-details-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 58%, transparent);
  backdrop-filter: blur(8px);
}

.group-details-modal {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(1360px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.group-details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.group-details-head h2 {
  margin: 0;
}

.group-details-head .icon-button svg {
  transform: rotate(45deg);
}

.group-details-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.group-info-tile,
.group-detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}

.group-info-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 126px;
  padding: 18px;
}

.group-info-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink);
}

.group-info-icon svg {
  width: 22px;
  height: 22px;
}

.group-info-tile span:not(.group-info-icon),
.group-summary-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.group-info-tile strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 19px;
}

.group-info-tile small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.group-details-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.group-detail-column {
  display: grid;
  gap: 18px;
}

.group-detail-panel {
  padding: 18px;
}

.group-detail-panel h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.group-detail-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.group-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.group-summary-cell {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.group-summary-cell strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.group-summary-cell.income {
  background: var(--success-soft);
}

.group-summary-cell.income span,
.group-summary-cell.income strong {
  color: var(--success);
}

.group-summary-cell.accent {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.group-summary-cell.accent span,
.group-summary-cell.accent strong {
  color: var(--accent);
}

.group-summary-cell.danger {
  background: var(--danger-soft);
}

.group-summary-cell.danger span,
.group-summary-cell.danger strong {
  color: var(--danger);
}

.group-students-panel {
  min-width: 0;
}

.group-student-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

button.filter-chip {
  cursor: pointer;
  font: inherit;
}

button.filter-chip:hover,
button.filter-chip:focus-visible,
.filter-chip.active {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.filter-chip.rose {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  background: var(--danger-soft);
}

.group-student-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.group-student-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.group-student-card.debt {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 72%, var(--surface));
}

.group-student-card h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.group-student-payment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.group-student-payment strong {
  color: var(--danger);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.group-payment-action {
  min-height: 44px;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--danger);
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.group-payment-action:hover {
  background: var(--danger-soft);
}

.group-student-card:not(.debt) .group-student-payment strong {
  color: var(--success);
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-actions {
  flex: 0 0 auto;
}

.record-actions .icon-button {
  width: 44px;
  min-height: 44px;
}

.record-actions .icon-button svg {
  width: 18px;
  height: 18px;
}

.payment-term-list {
  display: grid;
  gap: 4px;
  min-width: 170px;
  font-size: 12px;
  font-weight: 700;
}

.payment-term-list span {
  color: var(--muted);
}

.directory-filter-panel {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent 64%),
    var(--surface);
}

.directory-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(170px, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.teacher-directory-filter-grid {
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, .8fr) auto;
}

.directory-filter-reset {
  min-height: 44px;
}

.teacher-movement-positive,
.teacher-movement-negative {
  display: inline-flex;
  min-width: 38px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.teacher-movement-positive {
  color: var(--success);
  background: var(--success-soft);
}

.teacher-movement-negative {
  color: var(--danger);
  background: var(--danger-soft);
}

.teachers-directory-table td:last-child,
.teachers-directory-table th:last-child {
  text-align: right;
}

.teacher-period-toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), var(--surface));
  box-shadow: var(--shadow-sm);
}

.teacher-period-toolbar > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.teacher-period-toolbar > div:first-child strong,
.teacher-period-toolbar > div:first-child > span {
  overflow-wrap: anywhere;
}

.teacher-period-toolbar > div:first-child > span {
  color: var(--muted);
  font-size: 13px;
}

.teacher-period-picker {
  position: relative;
  flex: 0 0 auto;
}

.teacher-period-picker summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.teacher-period-picker summary::-webkit-details-marker {
  display: none;
}

.teacher-period-picker summary svg {
  width: 18px;
  height: 18px;
}

.teacher-period-picker summary svg:last-child {
  width: 16px;
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.teacher-period-picker[open] summary svg:last-child {
  transform: rotate(-90deg);
}

.teacher-period-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 40px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.teacher-period-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.teacher-period-options button {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-2);
}

.teacher-period-options button.active {
  color: var(--brand-warm);
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

.teacher-custom-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.teacher-custom-range label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.teacher-custom-range input {
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
}

.teacher-custom-range .button {
  grid-column: 1 / -1;
}

.teacher-card-tools {
  align-self: start;
  margin-left: auto;
}

.teacher-card .card-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.payment-ledger-panel {
  padding: 0;
  overflow: hidden;
}

.payment-ledger-panel .panel-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.payment-table-scroll {
  width: 100%;
  border-radius: 0;
}

.payment-ledger-table {
  min-width: 1280px;
}

.payment-ledger-table th,
.payment-ledger-table td {
  padding: 14px 16px;
  white-space: nowrap;
}

.payment-ledger-table th:first-child,
.payment-ledger-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  background: var(--surface);
}

.payment-ledger-table th:last-child,
.payment-ledger-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
}

.payment-ledger-table thead th:first-child,
.payment-ledger-table thead th:last-child {
  z-index: 3;
  background: var(--surface-2);
}

.payment-ledger-table .payment-comment {
  min-width: 240px;
  max-width: 340px;
  white-space: normal;
}

.table-actions button.active {
  color: #fff;
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.notification-rule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.rule-channel {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: var(--radius);
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease;
}

.toggle.active {
  background: var(--primary);
}

.toggle.active::after {
  transform: translateX(20px);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.empty-state.compact {
  min-height: 86px;
  padding: 14px;
}

.analytics-toolbar {
  display: grid;
  gap: 20px;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 48%),
    var(--surface);
}

.analytics-view-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 30%),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, transparent), color-mix(in srgb, var(--success) 7%, transparent)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.analytics-view-tabs button {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(88px, auto);
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 2px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: 20px;
  color: var(--text);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 86%, var(--primary-soft)), var(--surface));
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary-strong) 9%, transparent);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.analytics-view-tabs button::after {
  content: "Открыть";
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analytics-view-tabs button:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 64%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface));
}

.analytics-view-tabs button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
  outline-offset: 2px;
}

.analytics-view-tabs button.active {
  border-color: color-mix(in srgb, var(--primary-strong) 72%, var(--success));
  color: #fff;
  background:
    radial-gradient(circle at 92% 18%, color-mix(in srgb, #fff 18%, transparent), transparent 28%),
    linear-gradient(135deg, var(--primary-strong), color-mix(in srgb, var(--success) 54%, var(--primary-strong)));
  box-shadow: 0 18px 36px color-mix(in srgb, var(--primary-strong) 26%, transparent);
}

.analytics-view-tabs button.active::after {
  content: "Выбрано";
  color: var(--primary-strong);
  background: #fff;
}

.analytics-view-tabs strong {
  display: block;
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.analytics-view-tabs small {
  display: block;
  margin-top: 6px;
  color: color-mix(in srgb, var(--muted) 82%, var(--primary-strong));
  font-size: 13px;
  font-weight: 700;
}

.analytics-view-tabs button.active small,
.analytics-view-tabs button.active .analytics-tab-icon,
.analytics-view-tabs button.active strong {
  color: #fff;
}

.analytics-view-tabs button.active .analytics-tab-icon {
  background: color-mix(in srgb, #fff 18%, transparent);
}

.analytics-tab-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.analytics-tab-icon svg {
  width: 28px;
  height: 28px;
}

.branch-analytics-grid {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.branch-analytics-grid .analytics-card {
  padding: 18px;
}

.branch-analytics-grid .mini-kpis {
  grid-template-columns: repeat(3, minmax(132px, 1fr));
}

.branch-analytics-grid .mini-kpi {
  padding: 14px;
}

.branch-analytics-grid .mini-kpi strong {
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: clamp(15px, 1.25vw, 18px);
  letter-spacing: -0.04em;
}

.analytics-toolbar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.analytics-toolbar-head h2 {
  margin: 3px 0 6px;
  font-size: clamp(20px, 2vw, 28px);
  font-variant-numeric: tabular-nums;
}

.analytics-range-summary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--line));
  border-radius: 999px;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.analytics-range-summary svg,
.analytics-date-arrow svg {
  width: 17px;
  height: 17px;
}

.analytics-controls {
  display: grid;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.analytics-period-group {
  display: grid;
  gap: 9px;
}

.analytics-control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.analytics-segmented {
  display: grid;
  grid-template-columns: repeat(8, minmax(88px, 1fr));
  gap: 8px;
}

.analytics-segmented button {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.analytics-segmented button:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.analytics-segmented button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  outline-offset: 2px;
}

.analytics-segmented button.active {
  border-color: var(--primary-strong);
  color: #fff;
  background: var(--primary-strong);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--primary-strong) 22%, transparent);
}

.analytics-custom-range {
  display: grid;
  grid-template-columns: minmax(150px, 0.5fr) minmax(360px, 1fr);
  gap: 20px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.analytics-custom-head {
  display: grid;
  gap: 4px;
  align-self: center;
}

.analytics-custom-head strong {
  font-size: 15px;
}

.analytics-custom-head span {
  color: var(--muted);
  font-size: 12px;
}

.analytics-date-fields {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  gap: 12px;
  align-items: end;
}

.analytics-date-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 44px;
  color: var(--muted);
}

.analytics-card-list {
  display: grid;
  gap: 12px;
}

.analytics-directions-list {
  grid-auto-rows: minmax(48px, auto);
  max-height: 348px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.analytics-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 64%, var(--surface));
}

.analytics-card.compact {
  gap: 12px;
}

.analytics-card h3 {
  margin: 0 0 2px;
  font-size: 17px;
}

.value-bar-row {
  display: grid;
  gap: 7px;
}

.value-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.value-row-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.value-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.departure-reason-row strong {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.analytics-signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.analytics-signal {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 66%, var(--surface));
}

.analytics-signal.income {
  border-color: color-mix(in srgb, var(--success) 38%, var(--line));
}

.analytics-signal.warn {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
}

.analytics-signal span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.analytics-signal strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 26px;
  line-height: 1.1;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.quick-action-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.quick-action-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 13, 0.52);
}

.quick-action-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.quick-action-modal [data-quick-close] svg,
.quick-action-modal [data-record-delete-cancel] svg,
.quick-action-modal [data-student-delete-cancel] svg,
.quick-action-modal [data-experience-category-delete-cancel] svg,
.quick-action-modal [data-employee-role-delete-cancel] svg,
.quick-action-modal [data-dashboard-detail-close] svg,
.quick-action-modal [data-insight-detail-close] svg {
  transform: rotate(45deg);
}

.experience-category-delete-layer {
  z-index: 1500;
}

.employee-role-delete-layer {
  z-index: 1500;
}

.dashboard-detail-modal {
  width: min(1120px, 100%);
  padding: clamp(18px, 2.4vw, 28px);
}

.dashboard-panel-action {
  width: 100%;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dashboard-panel-action:hover {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  box-shadow: var(--shadow-md);
}

.dashboard-panel-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 3px;
}

.dashboard-panel-action:active {
  transform: translateY(1px);
}

.dashboard-panel-action::after {
  content: "Подробнее →";
  display: block;
  margin-top: 14px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dashboard-detail-head h2 {
  margin-bottom: 5px;
}

.dashboard-detail-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.dashboard-detail-kpi {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
}

.dashboard-detail-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-detail-kpi strong {
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dashboard-detail-kpi.positive strong {
  color: var(--success);
}

.dashboard-detail-kpi.negative strong {
  color: var(--danger);
}

.dashboard-detail-kpi.accent strong {
  color: var(--primary-strong);
}

.dashboard-detail-section {
  margin-top: 18px;
}

.dashboard-detail-section h3 {
  margin-bottom: 12px;
}

.dashboard-role-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-role-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  background: var(--surface-muted);
}

.dashboard-detail-table-wrap {
  max-height: min(42vh, 440px);
}

.dashboard-detail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
}

.employee-role-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.employee-role-delete {
  min-width: 44px;
  min-height: 44px;
}

.employee-role-delete svg {
  transform: rotate(45deg);
}

.employee-role-delete:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.quick-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-form-grid .field.full {
  grid-column: 1 / -1;
}

.field-helper {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
}

[data-custom-role-field][hidden] {
  display: none;
}

.monthly-payment-field {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}

.payment-hint-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.payment-hint-chips button {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
}

.payment-hints-toggle {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.payment-hints-toggle svg {
  width: 16px;
  height: 16px;
}

.payment-hints-editor {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.payment-hints-editor[hidden] {
  display: none;
}

.payment-hint-entry,
.payment-hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-hint-entry input {
  flex: 1;
}

.payment-hint-list {
  display: grid;
  gap: 7px;
}

.payment-hint-row {
  justify-content: space-between;
  min-height: 46px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 800;
}

.payment-conditions {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.payment-condition-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.payment-condition-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.payment-condition-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text) !important;
  cursor: pointer;
  font-size: 14px !important;
  text-transform: none !important;
}

.payment-condition-check input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary-strong);
}

.payment-condition-amount {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted) !important;
  font-size: 12px !important;
  text-transform: none !important;
}

.payment-condition-amount input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.field textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.chart svg text {
  font-family: var(--font);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1180px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.side-main {
    grid-template-columns: 1fr;
  }

  .dashboard-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-hero,
  .student-hero-main {
    grid-template-columns: 1fr;
  }

  .group-ops-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-ops-row .mini-action {
    justify-self: start;
  }

  .group-details-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-details-body {
    grid-template-columns: 1fr;
  }

  .trash-card {
    grid-template-columns: 1fr;
  }

  .trash-card-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 920px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--ink) 48%, transparent);
    backdrop-filter: blur(3px);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(-104%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 10px 14px;
  }

  .topbar-actions .ghost-button,
  .profile-chip span:not(.avatar) {
    display: none;
  }

  .main-content {
    padding: 18px 14px 28px;
  }

  .page-head {
    display: grid;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .analytics-segmented {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .analytics-view-tabs {
    grid-template-columns: 1fr;
  }

  .student-payment-filter,
  .student-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-custom-range {
    grid-template-columns: 1fr;
  }

  .group-details-layer {
    padding: 14px;
  }

  .group-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .mini-kpis {
    grid-template-columns: 1fr;
  }

  .schedule-preset-list {
    grid-template-columns: 1fr;
  }

  .dashboard-detail-kpis,
  .dashboard-role-list {
    grid-template-columns: 1fr;
  }

  .dashboard-detail-modal {
    padding: 16px;
  }

  .branch-delete-impact,
  .branch-delete-choice-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 30px;
  }

  .global-search {
    min-width: 0;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar .global-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .search-panel {
    left: 14px;
    width: calc(100vw - 28px);
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .quick-form-grid,
  .analytics-signal-grid,
  .student-hero-metrics,
  .student-payment-filter,
  .student-filter-grid {
    grid-template-columns: 1fr;
  }

  .analytics-toolbar-head {
    display: grid;
    gap: 12px;
  }

  .analytics-range-summary {
    justify-self: start;
  }

  .analytics-segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-sticky-shell {
    top: 128px;
    max-height: none;
    overflow: visible;
  }

  .receipts-kpis,
  .group-filter-grid,
  .teacher-group-content,
  .teacher-group-summary-kpis {
    grid-template-columns: 1fr;
  }

  .group-filter-wide {
    grid-column: auto;
  }

  .teacher-group-accordion > summary {
    grid-template-columns: auto auto minmax(0, 1fr);
    padding: 15px;
  }

  .teacher-group-summary-kpis {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-view-tabs button {
    min-height: 86px;
    padding: 14px;
  }

  .teacher-period-toolbar {
    display: grid;
  }

  .teacher-period-picker,
  .teacher-period-picker summary {
    width: 100%;
  }

  .teacher-period-picker summary {
    justify-content: space-between;
  }

  .teacher-period-popover {
    right: auto;
    left: 0;
    width: 100%;
  }

  .payment-condition-row {
    grid-template-columns: 1fr;
  }

  .payment-condition-amount {
    grid-template-columns: 1fr;
  }

  .analytics-date-fields,
  .analytics-custom-range,
  .analytics-custom-range .field {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .analytics-date-arrow {
    display: none;
  }

  .groups-board,
  .students-board,
  .branch-analytics-grid,
  .group-ops-row,
  .group-details-summary-grid,
  .group-summary-grid,
  .group-student-list {
    grid-template-columns: 1fr;
  }

  .group-card-top,
  .student-card-head,
  .group-details-head {
    display: grid;
  }

  .student-card-actions {
    justify-content: flex-start;
  }

  .group-details-modal {
    padding: 16px;
    border-radius: 20px;
  }

  .branch-analytics-grid .mini-kpis {
    grid-template-columns: 1fr;
  }

  .group-student-list {
    max-height: none;
  }

  .checkbox-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .schedule-days-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .schedule-days-grid .schedule-all {
    grid-column: span 2;
  }

}

/* Protected sign-in and role-based access */
body.auth-required {
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 34%),
    linear-gradient(145deg, var(--bg), color-mix(in srgb, var(--surface-2) 82%, var(--bg)));
}

.auth-card {
  width: min(100%, 460px);
  display: grid;
  gap: 16px;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-lg);
}

.auth-card h1,
.auth-card p {
  margin: 0;
}

.auth-brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--primary-soft);
}

.auth-brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.auth-card form {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.auth-password-field {
  display: grid;
  gap: 8px;
}

.auth-password-control {
  position: relative;
  display: block;
}

.auth-password-control input {
  width: 100%;
  min-height: 52px;
  padding-right: 56px;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.auth-password-control .icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 44px;
  min-height: 44px;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: 12px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.auth-submit {
  min-height: 50px;
  justify-content: center;
}

.auth-security-note,
.access-security-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
}

.auth-security-note {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}

.auth-security-note svg,
.access-security-icon svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.auth-logout-button {
  min-height: 44px;
}

.access-security-banner {
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--line));
  border-radius: var(--radius-lg);
  color: var(--text);
  background: color-mix(in srgb, var(--primary-soft) 52%, var(--surface));
}

.access-security-icon {
  width: 44px;
  height: 44px;
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-strong);
  background: var(--surface);
}

.access-security-banner p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.access-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.own-access-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
}

.own-access-icon,
.own-password-modal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 15px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.own-access-icon svg,
.own-password-modal-icon svg {
  width: 22px;
  height: 22px;
}

.own-access-card h2 {
  margin: 3px 0 5px;
  font-size: 20px;
}

.own-access-card p {
  margin-bottom: 0;
}

.own-password-open-button {
  min-height: 48px;
  white-space: nowrap;
}

.own-password-layer {
  z-index: 1450;
}

.own-password-modal {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(17, 19, 13, 0.3);
}

.own-password-modal-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--primary-soft));
}

.own-password-modal-head h2 {
  margin: 3px 0 5px;
}

.own-password-modal-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.own-password-modal-head .icon-button svg {
  transform: rotate(45deg);
}

.own-password-modal-form {
  display: grid;
  gap: 14px;
  padding: 22px 24px 24px;
}

.own-password-modal-form .field {
  display: grid;
  gap: 7px;
}

.own-password-modal-form input {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}

.own-password-modal-form > .field-helper {
  margin: 0;
  line-height: 1.55;
}

.own-password-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px -24px -24px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-2));
}

.own-password-modal-actions .button,
.own-password-modal-actions .ghost-button {
  min-height: 46px;
}

.notifications-development-state {
  min-height: min(58dvh, 560px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
}

.notifications-development-state h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 36px);
}

.notifications-development-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.notifications-development-icon svg {
  width: 32px;
  height: 32px;
}

.access-employee-list {
  display: grid;
  gap: 12px;
  max-height: min(70dvh, 880px);
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.access-employee {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: clip;
}

.access-employee > summary {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
  transition: background-color 180ms ease;
}

.access-employee > summary::-webkit-details-marker {
  display: none;
}

.access-employee > summary:hover,
.access-employee > summary:focus-visible {
  background: var(--surface-2);
}

.access-employee > summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 38%, transparent);
  outline-offset: -3px;
}

.access-employee-identity {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.access-employee-identity small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.access-chevron {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 180ms ease;
}

.access-chevron svg {
  width: 18px;
  height: 18px;
  transform: rotate(90deg);
}

.access-employee[open] .access-chevron {
  transform: rotate(180deg);
}

.access-employee-form {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 38%, var(--surface));
}

.access-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.access-code-row .field {
  display: grid;
  gap: 7px;
}

.access-code-row input[type="password"] {
  min-height: 46px;
}

.access-code-row small {
  color: var(--muted);
  line-height: 1.45;
}

.access-active-toggle,
.permission-section-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.access-active-toggle {
  min-height: 46px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.access-active-toggle input,
.permission-section-toggle input,
.permission-chip-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.access-active-toggle > span,
.permission-section-toggle > span {
  width: 24px;
  height: 24px;
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  color: transparent;
  background: var(--surface);
}

.access-active-toggle span svg,
.permission-section-toggle span svg {
  width: 15px;
  height: 15px;
}

.access-active-toggle input:checked + span,
.permission-section-toggle input:checked + span {
  border-color: var(--primary);
  color: var(--surface);
  background: var(--primary);
}

.access-active-toggle input:focus-visible + span,
.permission-section-toggle input:focus-visible + span,
.permission-chip-grid input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--primary) 36%, transparent);
  outline-offset: 2px;
}

.permission-table {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.permission-table-head,
.permission-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 2fr);
}

.permission-table-head {
  padding: 12px 16px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.permission-row {
  min-height: 58px;
  border-top: 1px solid var(--line);
}

.permission-section-toggle {
  min-height: 58px;
  padding: 12px 16px;
}

.permission-row.enabled .permission-section-toggle {
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
}

.permission-details {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-left: 1px solid var(--line);
}

.permission-details[hidden] {
  display: none;
}

.permission-details fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.permission-details legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.permission-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-chip-grid label {
  position: relative;
  cursor: pointer;
}

.permission-chip-grid label > span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
}

.permission-chip-grid span svg {
  width: 14px;
  height: 14px;
  opacity: 0;
}

.permission-chip-grid input:checked + span {
  border-color: color-mix(in srgb, var(--primary) 44%, var(--line));
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.permission-chip-grid input:checked + span svg {
  opacity: 1;
}

.access-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.access-employee-card {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(260px, auto) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 4%, transparent);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.access-employee-card:hover {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  background: color-mix(in srgb, var(--primary-soft) 18%, var(--surface));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--text) 8%, transparent);
}

.access-employee-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 38%, transparent);
  outline-offset: 2px;
}

.access-employee-avatar {
  width: 48px;
  height: 48px;
  font-size: 14px;
}

.access-employee-access {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.access-code-preview {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
}

.access-code-preview > span {
  color: var(--muted);
  font-weight: 700;
}

.access-code-preview code {
  max-width: 240px;
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-code-preview.muted code {
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
}

.access-employee-card .access-chevron {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
}

.access-employee-card:hover .access-chevron {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.access-editor-layer {
  z-index: 1400;
}

.access-editor-modal {
  position: relative;
  width: min(1080px, 100%);
  height: min(900px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(17, 19, 13, 0.28);
}

.access-editor-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
}

.access-editor-person {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.access-editor-person h2,
.access-editor-section h3,
.access-discard-modal h2 {
  margin: 0;
}

.access-editor-person p:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--muted);
}

.access-editor-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.access-editor-close {
  flex: 0 0 auto;
}

.access-editor-close svg {
  transform: rotate(45deg);
}

.access-editor-form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.access-editor-scroll {
  min-height: 0;
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  padding: 20px 24px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.access-editor-section {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.access-editor-code-section {
  background: color-mix(in srgb, var(--primary-soft) 18%, var(--surface));
}

.access-editor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.access-editor-section-head p:not(.eyebrow) {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.access-modal-toggle {
  flex: 0 0 auto;
  background: var(--surface);
}

.access-code-field {
  display: grid;
  gap: 8px;
}

.access-code-input {
  position: relative;
  display: flex;
  align-items: center;
}

.access-code-input input {
  width: 100%;
  min-height: 48px;
  padding-right: 54px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.access-code-input .icon-button {
  position: absolute;
  right: 4px;
  min-width: 40px;
  min-height: 40px;
}

.access-code-field small {
  color: var(--muted);
  line-height: 1.5;
}

.access-modal-permission-table {
  max-height: min(50dvh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.access-editor-footer {
  min-height: 76px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-2));
  box-shadow: 0 -12px 30px color-mix(in srgb, var(--text) 5%, transparent);
}

.access-editor-save-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.access-editor-save-state.dirty {
  color: var(--warning-strong, #8a5b00);
}

.access-editor-actions {
  display: flex;
  gap: 10px;
}

.access-editor-actions .button,
.access-editor-actions .ghost-button {
  min-height: 46px;
  min-width: 116px;
  justify-content: center;
}

.access-discard-layer {
  z-index: 1600;
}

.access-discard-modal {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  overflow: visible;
}

.access-discard-modal p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.access-discard-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.access-discard-icon svg {
  width: 22px;
  height: 22px;
}

.access-discard-modal .modal-actions {
  grid-column: 1 / -1;
}

@media (max-width: 1040px) {
  .own-access-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .own-password-open-button {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .access-employee-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .access-employee-access {
    grid-column: 2;
    justify-content: flex-start;
  }

  .access-employee-card .access-chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

/* Lesson journal */
.journal-toolbar {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.journal-month-switcher,
.journal-filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.journal-month-switcher {
  align-items: center;
}

.journal-month-switcher > div {
  display: grid;
  min-width: 210px;
  gap: 2px;
  text-align: center;
}

.journal-month-switcher > div span,
.journal-filter > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.journal-month-switcher > div strong {
  font-size: 18px;
  text-transform: capitalize;
}

.journal-month-previous svg {
  transform: rotate(180deg);
}

.journal-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
}

.journal-filter {
  display: grid;
  gap: 6px;
}

.journal-filter select {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
}

.journal-calendar-panel,
.journal-attendance-panel {
  margin-top: 18px;
}

.journal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.journal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.journal-legend span::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--faint);
  content: "";
}

.journal-legend .conducted::before {
  background: var(--success);
}

.journal-legend .planned::before {
  background: var(--sky);
}

.journal-legend .cancelled::before {
  background: var(--danger);
}

.journal-legend .rescheduled::before {
  background: var(--accent);
}

.journal-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  gap: 1px;
}

.journal-weekday {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.journal-day {
  min-width: 0;
  min-height: 132px;
  padding: 8px;
  color: var(--text);
  background: var(--surface);
}

.journal-day.outside {
  opacity: 0.42;
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
}

.journal-day.today {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.journal-day-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.journal-day-head > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.journal-day.today .journal-day-head > span {
  color: var(--surface);
  background: var(--primary);
}

.journal-day-head button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--primary-strong);
  background: transparent;
}

.journal-day-head button:hover,
.journal-day-head button:focus-visible {
  background: var(--primary-soft);
}

.journal-day-head button svg {
  width: 16px;
  height: 16px;
}

.journal-day-lessons {
  display: grid;
  gap: 5px;
  margin-top: 4px;
}

.journal-calendar-lesson,
.journal-more-lessons {
  min-width: 0;
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-2);
  text-align: left;
}

.journal-calendar-lesson span {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.journal-calendar-lesson strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-calendar-lesson.conducted {
  border-color: color-mix(in srgb, var(--success) 34%, var(--line));
  background: var(--success-soft);
}

.journal-calendar-lesson.planned {
  border-color: color-mix(in srgb, var(--sky) 34%, var(--line));
  background: var(--sky-soft);
}

.journal-calendar-lesson.cancelled {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: var(--danger-soft);
  text-decoration: line-through;
}

.journal-calendar-lesson.rescheduled {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.journal-more-lessons {
  display: block;
  min-height: 28px;
  color: var(--primary-strong);
  background: transparent;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.journal-mobile-agenda {
  display: none;
}

.journal-attendance-scroll {
  max-height: min(52dvh, 520px);
  margin-top: 14px;
  overflow: auto;
}

.journal-attendance-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
}

.journal-attendance-rate {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.journal-attendance-rate.low {
  color: var(--danger);
  background: var(--danger-soft);
}

.journal-lesson-modal {
  width: min(1040px, 100%);
  padding: 0;
  overflow: hidden;
}

.journal-lesson-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--primary-soft) 36%, var(--surface));
}

.journal-lesson-modal-head h2 {
  margin: 3px 0;
}

.journal-lesson-modal-head [data-journal-close] svg {
  transform: rotate(45deg);
}

.journal-lesson-modal form {
  max-height: calc(100dvh - 150px);
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.journal-lesson-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.journal-lesson-fields .field {
  min-width: 0;
}

.journal-lesson-fields .field input,
.journal-lesson-fields .field select,
.journal-lesson-fields .field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.journal-lesson-fields [data-journal-student-field][hidden] {
  display: none !important;
}

.journal-lesson-fields .field.full {
  grid-column: 1 / -1;
}

.journal-status-note {
  position: relative;
  grid-column: 1 / -1;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 14px 10px 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.journal-status-note::before {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--sky);
  transform: translateY(-50%);
  content: "";
}

.journal-status-note strong {
  font-size: 13px;
}

.journal-status-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.journal-status-note.conducted::before {
  background: var(--success);
}

.journal-status-note.cancelled::before {
  background: var(--danger);
}

.journal-status-note.rescheduled::before {
  background: var(--accent);
}

.journal-attendance-editor {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.journal-attendance-editor.is-disabled {
  opacity: 0.72;
}

.journal-attendance-editor.is-disabled .journal-attendance-roster {
  background: var(--surface-2);
}

.journal-attendance-editor.is-disabled .journal-attendance-options {
  pointer-events: none;
}

.journal-attendance-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.journal-attendance-editor legend {
  padding: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.journal-attendance-roster {
  display: grid;
  max-height: min(42dvh, 460px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.journal-attendance-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(420px, 1.5fr);
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.journal-attendance-row:last-child {
  border-bottom: 0;
}

.journal-attendance-student {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.journal-attendance-student > span {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 900;
}

.journal-attendance-student strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-attendance-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
  gap: 6px;
}

.journal-attendance-options label {
  min-width: 0;
  cursor: pointer;
}

.journal-attendance-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.journal-attendance-options span {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.journal-attendance-options input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, #ffffff);
  outline-offset: 2px;
}

.journal-attendance-options .present input:checked + span {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.journal-attendance-options .late input:checked + span {
  border-color: var(--warning);
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.journal-attendance-options .excused input:checked + span {
  border-color: var(--sky);
  color: var(--sky);
  background: var(--sky-soft);
}

.journal-attendance-options .absent input:checked + span {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.journal-attendance-options .unmarked input:checked + span {
  border-color: var(--faint);
  color: var(--text);
}

.journal-attendance-hidden {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-2);
}

.journal-attendance-hidden svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.journal-lesson-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.journal-lesson-actions > div {
  display: flex;
  gap: 10px;
}

.danger-text {
  color: var(--danger);
}

.journal-lesson-modal.is-readonly input:disabled,
.journal-lesson-modal.is-readonly select:disabled,
.journal-lesson-modal.is-readonly textarea:disabled {
  opacity: 1;
  color: var(--text);
  background: var(--surface-2);
}

@media (max-width: 1180px) {
  .journal-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .journal-attendance-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .journal-filters,
  .journal-lesson-fields {
    grid-template-columns: 1fr;
  }

  .journal-month-switcher > div {
    min-width: 0;
    flex: 1;
  }

  .journal-calendar {
    display: none;
  }

  .journal-mobile-agenda {
    display: grid;
    gap: 12px;
    margin-top: 16px;
  }

  .journal-agenda-day {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .journal-agenda-date {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--surface-2);
  }

  .journal-agenda-date > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .journal-agenda-date > strong {
    font-size: 13px;
  }

  .journal-agenda-lesson {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 0;
    border-top: 1px solid var(--line);
    color: var(--text);
    background: var(--surface);
    text-align: left;
  }

  .journal-agenda-lesson > span {
    font-weight: 900;
    font-variant-numeric: tabular-nums;
  }

  .journal-agenda-lesson > div {
    min-width: 0;
    display: grid;
  }

  .journal-agenda-lesson small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .journal-agenda-lesson > svg {
    width: 18px;
    height: 18px;
  }

  .journal-agenda-lesson.conducted {
    box-shadow: inset 4px 0 0 var(--success);
  }

  .journal-agenda-lesson.planned {
    box-shadow: inset 4px 0 0 var(--sky);
  }

  .journal-agenda-lesson.cancelled {
    box-shadow: inset 4px 0 0 var(--danger);
  }

  .journal-agenda-lesson.rescheduled {
    box-shadow: inset 4px 0 0 var(--accent);
  }

  .journal-lesson-layer {
    padding: 8px;
  }

  .journal-lesson-modal {
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .journal-lesson-modal-head {
    padding: 16px;
  }

  .journal-lesson-modal form {
    max-height: calc(100dvh - 118px);
    padding: 16px;
  }

  .journal-attendance-editor-head,
  .journal-lesson-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .journal-attendance-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journal-attendance-options .unmarked {
    grid-column: 1 / -1;
  }

  .journal-lesson-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .journal-lesson-actions .button,
  .journal-lesson-actions .ghost-button {
    min-height: 48px;
    justify-content: center;
  }
}

/* Notification center */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notification-center {
  position: relative;
  flex: 0 0 auto;
}

.notification-bell {
  position: relative;
}

.notification-center.is-open .notification-bell {
  color: var(--primary-strong);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 21px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  color: #fff;
  background: #d92d20;
  box-shadow: 0 3px 10px rgba(155, 28, 28, 0.3);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 80;
  width: min(430px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 70px color-mix(in srgb, var(--text) 20%, transparent);
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, var(--primary-soft));
}

.notification-panel-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.notification-panel-head .eyebrow {
  margin: 0;
}

.notification-panel-head .mini-action {
  min-height: 40px;
  white-space: nowrap;
}

.notification-panel-list {
  max-height: min(62dvh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.notification-panel-footer {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--primary-strong);
  background: var(--surface);
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.notification-panel-footer:hover,
.notification-panel-footer:focus-visible {
  background: var(--primary-soft);
}

.notification-panel-footer svg {
  width: 18px;
  height: 18px;
}

.notification-feed-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color 180ms ease, opacity 180ms ease;
}

.notification-page-feed .notification-feed-item {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.notification-feed-item.is-unread {
  background: color-mix(in srgb, var(--primary-soft) 34%, var(--surface));
}

.notification-feed-item.is-read {
  opacity: 0.72;
}

.notification-feed-item.priority-critical {
  box-shadow: inset 3px 0 0 var(--danger);
}

.notification-feed-item.priority-important {
  box-shadow: inset 3px 0 0 var(--warning);
}

.notification-feed-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.notification-feed-item.priority-critical .notification-feed-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.notification-feed-item.priority-important .notification-feed-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 13%, var(--surface));
}

.notification-feed-icon svg {
  width: 20px;
  height: 20px;
}

.notification-feed-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.notification-feed-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-feed-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #d92d20;
  box-shadow: 0 0 0 3px color-mix(in srgb, #d92d20 12%, transparent);
}

.notification-feed-copy p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.notification-feed-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.notification-feed-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notification-read-button,
.notification-open-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.notification-read-button:hover,
.notification-read-button:focus-visible,
.notification-open-icon:hover,
.notification-open-icon:focus-visible {
  color: var(--primary-strong);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.notification-read-button svg,
.notification-open-icon svg {
  width: 17px;
  height: 17px;
}

.notification-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.notification-empty svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.notification-empty strong {
  color: var(--text);
  font-size: 16px;
}

.notification-empty-large {
  min-height: 300px;
}

.notification-summary-grid {
  margin-bottom: 20px;
}

.notification-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  gap: 20px;
  align-items: start;
}

.notification-feed-panel,
.notification-rules-panel {
  min-width: 0;
}

.notification-feed-panel .panel-head,
.notification-rules-panel .panel-head {
  align-items: flex-start;
}

.notification-feed-panel .panel-head h2,
.notification-rules-panel .panel-head h2 {
  margin: 4px 0;
}

.notification-page-feed {
  max-height: min(72dvh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.notification-rule-list {
  max-height: min(62dvh, 680px);
  display: grid;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.notification-rule-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface-2) 48%, var(--surface));
  transition: border-color 180ms ease, opacity 180ms ease;
}

.notification-rule-card.is-disabled {
  opacity: 0.65;
}

.notification-rule-card.is-enabled {
  border-color: color-mix(in srgb, var(--primary) 27%, var(--line));
}

.notification-settings-form {
  display: grid;
  gap: 16px;
}

.notification-setting-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 42%, var(--surface));
  transition: border-color 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.notification-setting-card.is-enabled {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  background: color-mix(in srgb, var(--primary-soft) 18%, var(--surface));
}

.notification-setting-card.is-disabled {
  opacity: 0.76;
}

.notification-setting-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.notification-setting-card-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 750;
}

.notification-setting-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.notification-setting-toggle {
  min-width: 112px;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.notification-setting-toggle > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notification-setting-switch {
  position: relative;
  width: 38px;
  height: 22px;
  display: block;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 26%, var(--surface-2));
  transition: background-color 180ms ease;
}

.notification-setting-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(17, 19, 13, 0.22);
  transition: transform 180ms ease;
}

.notification-setting-toggle > input:checked + .notification-setting-switch {
  background: var(--primary-strong);
}

.notification-setting-toggle > input:checked + .notification-setting-switch::after {
  transform: translateX(16px);
}

.notification-setting-toggle > input:focus-visible + .notification-setting-switch {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 3px;
}

.notification-setting-toggle > input:disabled + .notification-setting-switch {
  cursor: not-allowed;
  opacity: 0.5;
}

.notification-setting-toggle > span:last-child {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.notification-setting-body {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.notification-setting-body .field {
  display: grid;
  gap: 7px;
}

.notification-setting-body .field > small,
.notification-setting-helper {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.notification-setting-fields.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.notification-number-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.notification-number-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.notification-number-control input {
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.notification-number-control input:focus {
  box-shadow: none;
}

.notification-number-control > span {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 750;
}

.notification-expiry-checkbox {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.notification-expiry-checkbox > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notification-expiry-checkbox > span:first-of-type {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: transparent;
  background: var(--surface-2);
}

.notification-expiry-checkbox > input:checked + span {
  color: #ffffff;
  border-color: var(--primary-strong);
  background: var(--primary-strong);
}

.notification-expiry-checkbox > input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 3px;
}

.notification-expiry-checkbox svg {
  width: 17px;
  height: 17px;
}

.notification-expiry-checkbox > span:last-child {
  display: grid;
  gap: 3px;
}

.notification-expiry-checkbox small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.notification-settings-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-2));
  box-shadow: 0 -8px 24px color-mix(in srgb, var(--text) 6%, transparent);
}

.notification-settings-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.notification-settings-actions .button {
  min-height: 46px;
  white-space: nowrap;
}

.notification-rule-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.notification-rule-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.notification-rule-icon svg {
  width: 20px;
  height: 20px;
}

.notification-rule-card h3 {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.3;
}

.notification-rule-type {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.notification-rule-when,
.notification-rule-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.notification-rule-when strong,
.notification-rule-message strong {
  color: var(--text);
}

.notification-rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notification-rule-tags > span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
}

.notification-rule-tags svg {
  width: 13px;
  height: 13px;
}

.notification-rule-tags .priority-critical {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 27%, var(--line));
  background: var(--danger-soft);
}

.notification-rule-tags .priority-important {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.notification-rule-edit {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.notification-rule-edit:hover,
.notification-rule-edit:focus-visible {
  color: var(--primary-strong);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.notification-rule-edit svg {
  width: 16px;
  height: 16px;
}

.notification-manual-reminders {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 15px;
  border: 1px dashed color-mix(in srgb, var(--primary) 34%, var(--line));
  border-radius: 15px;
  background: color-mix(in srgb, var(--primary-soft) 24%, var(--surface));
}

.notification-manual-reminders > div {
  display: grid;
  gap: 4px;
}

.notification-manual-reminders span {
  color: var(--muted);
  font-size: 11px;
}

.notification-manual-list {
  max-height: min(38dvh, 360px);
  display: grid;
  gap: 8px;
  margin-top: 12px;
  overflow-y: auto;
}

.notification-manual-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.notification-manual-card p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.notification-rule-layer {
  z-index: 1450;
}

.notification-rule-modal {
  position: relative;
  width: min(900px, 100%);
  height: min(900px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(17, 19, 13, 0.3);
}

.notification-rule-modal-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--primary-soft));
}

.notification-rule-modal-head h2 {
  margin: 3px 0 5px;
}

.notification-rule-modal-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.notification-rule-modal-head .icon-button svg {
  transform: rotate(45deg);
}

.notification-rule-form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.notification-rule-modal-scroll {
  min-height: 0;
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  padding: 20px 24px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.notification-form-section {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.notification-form-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notification-form-step > span {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 800;
}

.notification-form-step p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.notification-form-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.notification-form-grid .field.full,
.notification-enabled-control {
  grid-column: 1 / -1;
}

.notification-enabled-control {
  min-height: 66px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary-soft) 30%, var(--surface));
  cursor: pointer;
}

.notification-enabled-control > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notification-enabled-control > span:nth-of-type(1) {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-2);
}

.notification-enabled-control > input:checked + span {
  color: var(--primary-strong);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}

.notification-enabled-control > input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  outline-offset: 3px;
}

.notification-enabled-control > span:last-child {
  display: grid;
  gap: 3px;
}

.notification-enabled-control small {
  color: var(--muted);
  line-height: 1.45;
}

.notification-rule-modal-footer {
  min-height: 76px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, var(--surface-2));
  box-shadow: 0 -12px 30px color-mix(in srgb, var(--text) 5%, transparent);
}

.notification-rule-modal-footer > span {
  color: var(--muted);
  font-size: 12px;
}

.notification-rule-modal-footer > div {
  display: flex;
  gap: 10px;
}

@media (max-width: 1180px) {
  .notification-layout {
    grid-template-columns: 1fr;
  }

  .notification-page-feed,
  .notification-rule-list {
    max-height: min(62dvh, 660px);
  }
}

@media (max-width: 680px) {
  .notification-center {
    margin-left: auto;
  }

  .notification-panel {
    position: fixed;
    top: 68px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100dvh - 82px);
  }

  .notification-panel-list {
    max-height: calc(100dvh - 210px);
  }

  .notification-panel-head {
    padding: 15px 14px 12px;
  }

  .notification-feed-item {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 14px;
  }

  .notification-feed-actions {
    grid-column: 2;
    justify-content: flex-end;
  }

  .notification-page-feed .notification-feed-actions {
    justify-content: flex-start;
  }

  .notification-page-feed,
  .notification-rule-list {
    max-height: min(65dvh, 620px);
  }

  .notification-setting-card {
    padding: 15px;
  }

  .notification-setting-card-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .notification-setting-toggle {
    grid-column: 1 / -1;
    width: 100%;
  }

  .notification-setting-fields.two-columns {
    grid-template-columns: 1fr;
  }

  .notification-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .notification-settings-actions .button {
    width: 100%;
    justify-content: center;
  }

  .notification-manual-reminders {
    align-items: stretch;
    flex-direction: column;
  }

  .notification-manual-reminders .mini-action {
    width: 100%;
  }

  .notification-manual-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .notification-manual-card .notification-card-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .notification-rule-layer {
    padding: 10px;
  }

  .notification-rule-modal {
    height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .notification-rule-modal-head {
    padding: 18px 16px 14px;
  }

  .notification-rule-modal-scroll {
    padding: 14px 14px 20px;
  }

  .notification-form-section {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .notification-form-grid {
    grid-template-columns: 1fr;
  }

  .notification-form-grid .field.full,
  .notification-enabled-control {
    grid-column: auto;
  }

  .notification-rule-modal-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 14px;
  }

  .notification-rule-modal-footer > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notification-feed-item,
  .notification-rule-card,
  .notification-rule-edit {
    transition: none;
  }
}

@media (max-width: 760px) {
  .auth-gate {
    padding: 12px;
  }

  .auth-card {
    border-radius: 22px;
  }

  .access-summary,
  .access-code-row,
  .permission-table-head,
  .permission-row {
    grid-template-columns: 1fr;
  }

  .own-access-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }

  .own-access-card > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .own-password-open-button {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }

  .own-password-layer {
    padding: 10px;
  }

  .own-password-modal {
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .own-password-modal-head {
    padding: 18px 16px 14px;
  }

  .own-password-modal-form {
    padding: 18px 16px 20px;
  }

  .own-password-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 4px -16px -20px;
    padding: 12px 16px;
  }

  .own-password-modal-actions .button,
  .own-password-modal-actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .permission-table-head {
    display: none;
  }

  .permission-details {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .access-employee > summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .access-employee > summary .badge {
    grid-column: 2;
    justify-self: start;
  }

  .access-chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .access-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .access-form-actions .button {
    justify-content: center;
  }

  .access-editor-layer {
    padding: 8px;
  }

  .access-editor-modal {
    height: calc(100dvh - 16px);
    border-radius: 22px;
  }

  .access-editor-header {
    padding: 16px;
  }

  .access-editor-scroll {
    padding: 14px 14px 22px;
  }

  .access-editor-section {
    padding: 16px;
  }

  .access-editor-section-head {
    flex-direction: column;
  }

  .access-modal-toggle {
    width: 100%;
  }

  .access-editor-footer {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
    padding: 12px 14px;
  }

  .access-editor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .access-employee-card {
    gap: 10px;
    padding: 14px;
  }

  .access-code-preview {
    max-width: 100%;
  }

  .access-code-preview code {
    max-width: min(54vw, 260px);
  }

  .access-discard-modal {
    padding: 20px;
  }

  .access-discard-modal .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .access-discard-modal .modal-actions .button,
  .access-discard-modal .modal-actions .ghost-button {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }
}

.teacher-experience-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.experience-category-dropdown {
  position: relative;
  min-width: 0;
}

.experience-category-trigger {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 88%, #ffffff);
  text-align: left;
}

.experience-category-trigger:hover,
.experience-category-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.experience-category-trigger svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  transform: rotate(90deg);
  transition: transform 180ms ease;
}

.experience-category-trigger[aria-expanded="true"] svg {
  transform: rotate(-90deg);
}

.experience-category-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  width: min(100%, 520px);
  min-width: 100%;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.experience-category-menu[hidden] {
  display: none;
}

.experience-category-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 6px;
  align-items: center;
  border-radius: 10px;
}

.experience-category-option-row:has(.experience-category-option:last-child) {
  grid-template-columns: 1fr;
}

.experience-category-option-row:hover,
.experience-category-option-row.selected {
  background: var(--surface-2);
}

.experience-category-option {
  display: flex;
  min-height: 44px;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.experience-category-option span {
  overflow-wrap: anywhere;
}

.experience-category-option svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--primary);
}

.experience-category-option-delete {
  display: grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--danger);
  background: transparent;
}

.experience-category-option-delete:hover,
.experience-category-option-delete:focus-visible {
  background: var(--danger-soft);
}

.experience-category-option-delete svg {
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
}

[data-student-format-section][hidden],
[data-teacher-only-field][hidden],
[data-teacher-experience-field][hidden] {
  display: none !important;
}

.compact-action,
.experience-add-range {
  min-height: 30px;
  width: fit-content;
  padding: 4px 9px;
  font-size: 11px;
}

.compact-action svg,
.experience-add-range svg {
  width: 13px;
  height: 13px;
}

.teacher-experience-summary {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary-soft) 48%, var(--surface));
}

.teacher-experience-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.teacher-experience-layer {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgb(17 24 16 / 58%);
  backdrop-filter: blur(5px);
}

.teacher-experience-dialog {
  width: min(720px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgb(10 20 10 / 28%);
}

.teacher-experience-dialog form {
  display: grid;
  gap: 18px;
}

.teacher-experience-dialog .modal-head {
  margin-bottom: 0;
}

.experience-brackets {
  display: grid;
  gap: 10px;
}

.experience-bracket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.experience-bracket-row label {
  display: grid;
  gap: 6px;
}

.experience-bracket-row label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .teacher-experience-control,
  .experience-bracket-row {
    grid-template-columns: 1fr;
  }

  .teacher-experience-control .mini-action {
    justify-content: center;
  }

  .experience-bracket-row .icon-button {
    justify-self: end;
  }

  .teacher-experience-dialog {
    padding: 18px;
    border-radius: 18px;
  }
}

@media (max-width: 1100px) {
  .receipts-kpis,
  .group-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-group-accordion > summary {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .teacher-group-summary-kpis {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .receipts-kpis,
  .group-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-period-toolbar {
    min-height: 66px;
    gap: 10px;
    padding: 10px 11px 10px 14px;
  }

  .report-period-picker > summary {
    min-width: 0;
    min-height: 44px;
  }

  .report-period-popover {
    right: -2px;
    width: min(390px, calc(100vw - 28px));
  }

  .receipts-panel {
    padding: 16px;
  }

  .group-filter-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 460px) {
  .receipts-kpis,
  .group-filter-grid,
  .teacher-group-summary-kpis {
    grid-template-columns: 1fr;
  }

  .report-period-current strong {
    max-width: 150px;
    font-size: 13px;
  }

  .report-period-picker > summary span {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .report-custom-range .analytics-date-fields {
    grid-template-columns: 1fr;
  }

  .finance-summary-details {
    grid-template-columns: 1fr;
  }

  .teacher-group-summary-kpis {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .directory-filter-grid,
  .teacher-directory-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .directory-filter-reset {
    justify-self: start;
  }
}

@media (max-width: 680px) {
  .directory-filter-grid,
  .teacher-directory-filter-grid,
  .group-finance-tiles {
    grid-template-columns: 1fr;
  }

  .directory-filter-reset {
    width: 100%;
  }

  .employee-role-overview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-role-overview-head .badge {
    align-self: flex-start;
  }
}

@media (max-width: 460px) {
  .employee-role-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Ограниченные рабочие области не растягивают страницу при большом объёме данных. */
.students-board,
.teacher-groups-board,
.analytics-card-list,
.employee-role-summary-grid,
.trash-list,
.timeline,
.group-student-list,
.panel > .bar-stack {
  max-height: min(64dvh, 680px);
  overflow: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.insight-card-action,
.insight-panel-action,
.insight-row-action {
  cursor: pointer;
}

.insight-card-action,
.insight-panel-action {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.insight-card-action:hover,
.insight-panel-action:hover {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.insight-card-action:focus-visible,
.insight-panel-action:focus-visible,
.insight-row-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 2px;
}

.insight-row-action:hover td,
.insight-row-action:focus-visible td {
  background: color-mix(in srgb, var(--primary-soft) 46%, var(--surface));
}

.detail-open-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
}

.detail-open-hint svg {
  width: 16px;
  height: 16px;
}

.insight-detail-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1320px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}

.insight-detail-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.insight-detail-head h2 {
  margin-bottom: 5px;
  font-size: clamp(25px, 3vw, 38px);
}

.insight-detail-scroll {
  display: grid;
  gap: 18px;
  min-height: 0;
  max-height: calc(100dvh - 220px);
  overflow: auto;
  padding: 4px 6px 4px 2px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.insight-detail-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-2) 46%, var(--surface));
}

.insight-detail-section .panel-head {
  margin-bottom: 0;
}

.insight-detail-section h3 {
  margin: 0;
  font-size: 20px;
}

.insight-detail-section .dashboard-detail-table-wrap {
  max-height: min(48dvh, 480px);
}

.detail-link {
  padding: 0;
  border: 0;
  color: var(--primary-strong);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 32%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}

.detail-link:hover {
  text-decoration-color: currentColor;
}

.insight-identity-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
}

.insight-identity-card .avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  font-size: 18px;
}

.insight-identity-card > div {
  display: grid;
  gap: 5px;
}

.insight-identity-card > div > strong {
  font-size: 20px;
}

@media (max-width: 680px) {
  .analytics-view-tabs button {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .analytics-view-tabs button::after {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: center;
  }

  .insight-detail-layer {
    padding: 10px;
  }

  .insight-detail-modal {
    max-height: calc(100dvh - 20px);
  }

  .insight-detail-scroll {
    max-height: calc(100dvh - 205px);
  }

  .students-board,
  .teacher-groups-board,
  .analytics-card-list,
  .employee-role-summary-grid,
  .trash-list,
  .timeline,
  .group-student-list,
  .panel > .bar-stack {
    max-height: min(66dvh, 620px);
  }
}
