:root {
  --teal: #1f6581;
  --teal-dark: #16485d;
  --clivis-aqua: #82c0c7;
  --clivis-burgundy: #8f1d2c;
  --amber: #d99216;
  --blue: #2867b2;
  --green: #16805a;
  --red: #b4232d;
  --ink: #182631;
  --muted: #5f6f7a;
  --line: #d4dee3;
  --line-strong: #aeb8c5;
  --paper: #ffffff;
  --wash: #f3f7f8;
  --soft: #e8f2f4;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--wash);
}

.site-legal-footer {
  padding: 18px 22px 20px;
  color: var(--muted);
  background: var(--paper);
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-legal-footer p {
  margin: 0 0 8px;
  font-size: 12px;
}

.site-legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.site-legal-footer a {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 3px;
}

.site-legal-footer a:hover,
.site-legal-footer a:focus-visible {
  color: var(--clivis-burgundy);
}

body.registry-portal .app-shell {
  min-height: calc(100vh - 94px);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  color: #fff;
  background: var(--teal);
  border-top: 4px solid var(--clivis-burgundy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.notification-control {
  position: relative;
  flex: 0 0 auto;
}

.notification-button {
  position: relative;
  padding-right: 30px;
}

.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  color: #fff;
  background: #b42318;
  border: 2px solid var(--teal-dark);
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}

.notification-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: 420px;
  overflow-y: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 16px 38px rgba(14, 42, 54, 0.22);
}

.notification-menu-head,
.notification-empty {
  padding: 12px 14px;
}

.notification-menu-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.notification-item,
.notification-all {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 11px 14px;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.notification-item:hover,
.notification-item:focus-visible,
.notification-all:hover,
.notification-all:focus-visible {
  background: #eef8f6;
}

.notification-item span,
.notification-empty {
  color: var(--muted);
  font-size: 12px;
}

.notification-all {
  color: var(--teal-dark);
  font-weight: 800;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 300px;
  padding: 4px 10px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.search-box span {
  font-size: 12px;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: #fff;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.68);
}

.topbar select,
.ghost-button {
  min-height: 34px;
  color: #fff;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  padding: 0 10px;
}

.ghost-button {
  font-weight: 700;
}

.ghost-button.active {
  color: var(--teal-dark);
  background: #fff;
  border-color: #fff;
}

.portal-switch {
  display: flex;
  gap: 8px;
}

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.sidebar-toggle {
  width: calc(100% - 24px);
  margin: 14px 12px 10px;
  padding: 9px 10px;
  color: var(--teal-dark);
  background: var(--soft);
  border: 1px solid #b7d1da;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-reopen {
  position: fixed;
  top: 92px;
  left: 14px;
  z-index: 18;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border: 2px solid #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.sidebar-reopen.is-visible {
  display: grid;
}

.sidebar-reopen:hover {
  background: var(--teal-dark);
}

.nav-section {
  padding: 8px 10px 12px;
  border-top: 1px solid var(--line);
}

.nav-section:first-child {
  border-top: 0;
}

.nav-title {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-button {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #eef5f5;
}

.nav-button.active {
  color: var(--teal-dark);
  font-weight: 800;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.nav-button[data-tone="green"] .nav-icon {
  background: var(--green);
}

.nav-button[data-tone="amber"] .nav-icon {
  background: var(--amber);
}

.nav-button[data-tone="red"] .nav-icon {
  background: var(--red);
}

.nav-count {
  min-width: 22px;
  padding: 1px 6px;
  color: var(--muted);
  background: #f2f4f7;
  border-radius: 10px;
  text-align: center;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 24px;
  overflow: auto;
}

body.registry-portal .app-shell,
body.registry-portal .app-shell.collapsed {
  grid-template-columns: minmax(0, 1fr);
}

body.registry-portal .topbar,
body.registry-portal .workspace {
  grid-column: 1 / -1;
}

body.registry-portal .sidebar,
body.registry-portal .sidebar-reopen {
  display: none !important;
}

body.registry-portal .workspace {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* Registro famiglie e docenti: identita visiva Clivis, separata dal gestionale staff. */
body.registry-portal {
  --teal: #8f1d2c;
  --teal-dark: #65131d;
  --clivis-aqua: #78aeb4;
  --clivis-burgundy: #8f1d2c;
  --ink: #181516;
  --muted: #676064;
  --line: #e1dadd;
  --line-strong: #bdb3b7;
  --wash: #f7f5f5;
  --soft: #f5e9eb;
  color: var(--ink);
  font-family: "Poppins", Arial, Helvetica, sans-serif;
  background: var(--wash);
}

body.registry-portal .topbar {
  color: #fff;
  background: #161415;
  border-top-color: var(--clivis-burgundy);
}

body.registry-portal .brand-mark {
  border-color: #fff;
  background: var(--clivis-burgundy);
}

body.registry-portal .ghost-button.active {
  color: #fff;
  background: var(--clivis-burgundy);
  border-color: #b94d5b;
}

body.registry-portal .page-title h1,
body.registry-portal .login-card h1,
body.registry-portal .personal-summary h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

body.registry-portal .button {
  background: var(--clivis-burgundy);
}

body.registry-portal .button:hover {
  background: var(--teal-dark);
}

body.registry-portal .secondary-button:hover,
body.registry-portal .mini-button:hover {
  color: var(--clivis-burgundy);
  border-color: var(--clivis-burgundy);
}

body.registry-portal .surface,
body.registry-portal .kpi,
body.registry-portal .login-card {
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(40, 21, 25, 0.06);
}

body.registry-portal .personal-summary {
  border-left: 5px solid var(--clivis-burgundy);
}

body.registry-portal .personal-summary .surface-body > div:first-child {
  min-width: 250px;
}

body.registry-portal .data-table th {
  color: #4f474b;
  background: #f4edef;
}

body.registry-portal .eyebrow {
  color: #64131d;
  background: #f4dfe3;
}

body.registry-portal .kpi.positive strong {
  color: #236b58;
}

body.registry-portal .kpi.warning strong {
  color: var(--clivis-burgundy);
}

body.login-only .app-shell,
body.login-only .app-shell.collapsed {
  grid-template-columns: minmax(0, 1fr);
}

body.login-only .topbar,
body.login-only .workspace {
  grid-column: 1 / -1;
}

body.login-only .sidebar,
body.login-only .sidebar-reopen {
  display: none !important;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  font-weight: 800;
}

.login-page {
  min-height: calc(100vh - 112px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.registry-login-logo {
  width: 190px;
  max-width: 58%;
  height: 82px;
  display: block;
  object-fit: contain;
  object-position: left center;
}

body.registry-portal.login-only .workspace {
  max-width: none;
  padding: 0;
}

body.registry-portal.login-only .login-page {
  padding: 32px 22px;
  background: #f7f5f5;
}

body.registry-portal.login-only .login-card {
  width: min(500px, 100%);
  padding: 32px;
  border-top: 5px solid var(--clivis-burgundy);
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.login-card .app-slogan {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.login-submit {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.two-factor-hint {
  padding: 10px 12px;
  background: #eef8f6;
  border: 1px solid #a7d9d1;
  border-radius: 6px;
  color: var(--ink) !important;
}

.two-factor-code {
  min-height: 54px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 6px;
  font-variant-numeric: tabular-nums;
}

.login-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.login-secondary-actions button {
  min-height: 42px;
  justify-content: center;
}

@media (max-width: 520px) {
  .login-secondary-actions {
    grid-template-columns: 1fr;
  }
}

.form-alert {
  padding: 10px 12px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-weight: 800;
}

.form-notice {
  padding: 10px 12px;
  color: #075e55;
  background: #ecf9f5;
  border: 1px solid #a7d9d1;
  border-radius: 6px;
  font-weight: 800;
}

.account-profile .grid-two {
  align-items: start;
}

.profile-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.profile-form h3 {
  margin: 0;
  font-size: 18px;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  color: #fff;
  background: var(--teal-dark);
  border-radius: 8px;
}

.portal-hero.teacher {
  background: #1f6581;
}

.registry-support {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(360px, 1.28fr);
  gap: 22px;
  align-items: center;
  margin: 0 0 18px;
  padding: 16px 20px;
  color: #fff;
  background: var(--clivis-burgundy);
  border-left: 6px solid #1a1718;
  border-radius: 6px;
}

.registry-support strong,
.registry-support span {
  display: block;
}

.registry-support strong {
  font-size: 18px;
}

.registry-support span {
  margin-top: 3px;
  color: #f4dde1;
  font-weight: 700;
}

.registry-support .registry-support-kicker {
  margin: 0 0 5px;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.registry-support p {
  margin: 0;
  color: #fff7f8;
}

.registry-support.teacher {
  background: #1a1718;
  border-left-color: var(--clivis-burgundy);
}

.family-review {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  margin: 0 0 18px;
  padding: 20px 22px;
  border: 1px solid #b9ddd3;
  border-left: 6px solid #187b68;
  border-radius: 8px;
  background: linear-gradient(125deg, #f2fbf8 0%, #fff 68%);
  box-shadow: 0 10px 26px rgba(21, 81, 68, 0.08);
}

.family-review-copy {
  display: grid;
  gap: 5px;
}

.family-review-kicker {
  color: #187b68;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.family-review strong {
  color: #1a3130;
  font-size: 18px;
}

.family-review p,
.family-review small {
  margin: 0;
  color: #4c625e;
}

.family-review small {
  font-size: 12px;
}

.family-review-action {
  white-space: nowrap;
}

.portal-hero h2 {
  max-width: 760px;
  margin: 6px 0 8px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.portal-hero p,
.portal-login-panel span {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  color: #083c37;
  background: #dff4ef;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-login-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.portal-login-panel strong {
  font-size: 18px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

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

.button,
.secondary-button,
.danger-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 800;
}

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

.button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line-strong);
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

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

.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 118px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.kpi span {
  color: var(--muted);
}

.kpi.positive strong {
  color: var(--green);
}

.kpi.warning strong {
  color: var(--amber);
}

.kpi.negative strong {
  color: var(--red);
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
}

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

.surface {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.surface-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.surface-header h2,
.surface-header h3 {
  margin: 0;
  font-size: 17px;
}

.surface-header p {
  margin: 3px 0 0;
  color: var(--muted);
}

.surface-body {
  padding: 16px;
}

.personal-summary {
  margin-bottom: 18px;
}

.personal-summary .surface-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.personal-summary h2 {
  margin: 2px 0 4px;
  font-size: 24px;
}

.personal-summary p {
  margin: 0;
  color: var(--muted);
}

.summary-tags {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.chart {
  height: 290px;
  display: grid;
  grid-template-columns: repeat(12, minmax(24px, 1fr));
  align-items: end;
  gap: 10px;
  padding: 12px 8px 4px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chart-column {
  min-width: 0;
  display: grid;
  align-items: end;
  gap: 2px;
  height: 100%;
}

.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
}

.bar.income {
  background: var(--green);
}

.bar.expense {
  background: var(--red);
  opacity: 0.78;
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(12, minmax(24px, 1fr));
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

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

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.list-item strong,
.list-item span {
  display: block;
}

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

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

.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--teal-dark);
  background: var(--soft);
  border: 1px solid #c4ddda;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.amber {
  color: #8a4b00;
  background: #fff4db;
  border-color: #ffd38b;
}

.badge.green {
  color: #0f6b35;
  background: #e7f7ec;
  border-color: #bde9c9;
}

.badge.red {
  color: #9c1c1c;
  background: #feeaea;
  border-color: #fac4c4;
}

.badge.blue {
  color: #174ea6;
  background: #e8f1ff;
  border-color: #b8d2ff;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #244a5a;
  background: #eef6f7;
  border: 1px solid #cddfe4;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

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

.muted-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.filters.compact {
  align-items: center;
  margin-bottom: 12px;
}

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

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

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field input,
.field select,
.field textarea {
  min-height: 36px;
  min-width: 160px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input[readonly],
.field select:disabled {
  color: #526174;
  background: #f4f7f9;
  border-style: dashed;
  cursor: not-allowed;
}

.field select:disabled {
  opacity: 1;
}

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

.field-row .mini-button {
  min-width: 38px;
  height: 36px;
  padding: 0;
}

.option-picker-field {
  position: relative;
}

.option-search-row {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.option-picker-button {
  font-size: 16px;
  line-height: 1;
}

.option-picker-panel {
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.option-picker-list {
  display: grid;
  gap: 2px;
  padding: 6px;
}

.option-picker-choice {
  width: 100%;
  padding: 7px 8px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-weight: 700;
}

.option-picker-choice:hover,
.option-picker-choice:focus {
  background: #eef5f5;
  outline: none;
}

.option-picker-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  min-height: auto;
  min-width: auto;
}

.minute-member-list {
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #f7faf9;
}

.minute-member-list .check-row {
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.minute-member-list .check-row:last-child {
  border-bottom: 0;
}

.minute-member-list .check-row span {
  display: grid;
  gap: 2px;
}

.minute-member-list .check-row small {
  color: var(--muted);
  font-weight: 500;
}

.inline-status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 0;
}

.tab {
  min-height: 34px;
  padding: 0 12px;
  background: #f3f6f8;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 6px 6px 0 0;
  font-weight: 800;
}

.tab.active {
  color: var(--teal-dark);
  background: #fff;
  border-bottom-color: #fff;
}

.communication-workspace {
  overflow: visible;
}

.communication-panel {
  display: grid;
  gap: 18px;
}

.communication-panel > .surface {
  margin: 0;
}

.unread-row td {
  background: #eef8f6;
}

.unread-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 7px;
  color: #fff;
  background: var(--teal-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.table-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tab-panel {
  display: grid;
  gap: 12px;
}

.tab-panel .surface-header {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.tab-panel .surface-body {
  padding: 0;
}

.nested-gap {
  margin-top: 18px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.surface-body.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.data-table th,
.data-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: #eef5f5;
  font-size: 12px;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: #fbfcfd;
}

.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.mini-button {
  min-height: 28px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-weight: 800;
}

.mini-button.primary {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.mini-button.danger {
  color: #8f1d2c;
  border-color: rgba(143, 29, 44, 0.35);
  background: #fff4f4;
}

.muted-row {
  color: var(--muted);
  background: #f8fafc;
}

.muted-row strong {
  color: #526174;
}

.protocol-filter-actions .actions {
  min-height: 36px;
  align-items: center;
}

.protocol-layout {
  grid-template-columns: minmax(0, 1fr) minmax(230px, 290px);
  align-items: start;
}

.protocol-table {
  table-layout: fixed;
  min-width: 880px;
}

.protocol-table th,
.protocol-table td {
  overflow-wrap: anywhere;
}

.protocol-table th:nth-child(1),
.protocol-table td:nth-child(1) {
  width: 96px;
}

.protocol-table th:nth-child(2),
.protocol-table td:nth-child(2) {
  width: 76px;
}

.protocol-table th:nth-child(3),
.protocol-table td:nth-child(3) {
  width: 72px;
}

.protocol-table th:nth-child(4),
.protocol-table td:nth-child(4) {
  width: 140px;
}

.protocol-table th:nth-child(5),
.protocol-table td:nth-child(5) {
  width: 150px;
}

.protocol-table th:nth-child(6),
.protocol-table td:nth-child(6) {
  width: 84px;
}

.protocol-table th:nth-child(7),
.protocol-table td:nth-child(7) {
  width: 128px;
}

.protocol-table th:nth-child(8),
.protocol-table td:nth-child(8) {
  width: 136px;
}

.protocol-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
}

.protocol-actions .mini-button {
  min-height: 26px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.planner-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.planner-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.schedule-board-header {
  align-items: flex-end;
}

.schedule-date-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.schedule-date-controls .field {
  min-width: 164px;
}

.schedule-date-controls .icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.schedule-closure-status {
  margin-top: 12px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}

.legend-dot.lesson {
  background: var(--teal);
}

.legend-dot.trial {
  background: var(--blue);
}

.legend-dot.reserved {
  background: var(--amber);
}

.legend-dot.free {
  background: var(--green);
}

.legend-dot.group {
  background: #7c3aed;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.room-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.room-card {
  min-height: 88px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.room-card.compact {
  min-height: 58px;
  padding: 9px;
}

.room-card strong {
  font-size: 16px;
}

.room-card span,
.room-card small {
  color: var(--muted);
}

.opening-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.opening-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
}

.opening-row {
  display: grid;
  gap: 3px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.opening-row.compact {
  padding: 8px;
}

.opening-row span {
  color: var(--teal-dark);
  font-weight: 800;
}

.opening-row small {
  color: var(--muted);
}

.surface-subtitle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin: 4px 0 10px;
}

.surface-subtitle span {
  color: var(--muted);
}

.planner-shell {
  min-width: 920px;
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.planner-room-row {
  display: grid;
  grid-template-columns: 118px minmax(760px, 1fr);
  gap: 10px;
}

.planner-times {
  display: grid;
  grid-template-columns: 118px repeat(var(--slot-count, 10), minmax(76px, 1fr));
  gap: 4px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.planner-times span:not(:first-child) {
  display: block;
}

.planner-times span:not(:first-child)::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 8px;
  margin-right: 6px;
  background: var(--line-strong);
  vertical-align: middle;
}

.planner-room-label {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.planner-room-label strong {
  font-size: 16px;
}

.planner-room-label span {
  color: var(--muted);
  font-size: 12px;
}

.planner-track {
  min-height: 112px;
  display: grid;
  grid-template-columns: repeat(var(--slot-count, 10), minmax(76px, 1fr));
  gap: 4px;
  padding: 6px;
  background:
    repeating-linear-gradient(
      to right,
      #ffffff 0,
      #ffffff calc(10% - 1px),
      #e7edf2 calc(10% - 1px),
      #e7edf2 10%
    );
  border: 1px solid var(--line);
  border-radius: 8px;
}

.planner-slot {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.planner-slot h3,
.planner-slot p,
.planner-slot small {
  margin: 0;
}

.planner-slot h3 {
  font-size: 14px;
}

.planner-slot p,
.planner-slot small {
  color: var(--muted);
  font-size: 12px;
}

.planner-slot-top,
.planner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.planner-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 2px;
}

.planner-slot.lesson {
  border-color: rgba(0, 143, 134, 0.35);
  background: #e9f7f5;
}

.planner-slot.trial {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eef5ff;
}

.planner-slot.reserved {
  border-color: rgba(245, 158, 11, 0.45);
  background: #fff8e8;
}

.planner-slot.free {
  border-color: rgba(22, 163, 74, 0.35);
  background: #effaf3;
}

.planner-slot.group {
  border-color: rgba(124, 58, 237, 0.3);
  background: #f3efff;
}

.planner-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.catalog-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  border-top: 1px solid var(--line);
}

.catalog-summary strong {
  display: block;
  margin-bottom: 8px;
}

.catalog-preview {
  display: grid;
  gap: 12px;
}

.catalog-preview strong {
  display: block;
  margin-bottom: 8px;
}

.catalog-summary > div:only-child {
  grid-column: 1 / -1;
}

.compact-list {
  gap: 8px;
}

.split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.receipt-preview {
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.receipt-preview.compact {
  padding: 12px;
}

.receipt-preview h3 {
  margin: 0 0 14px;
  font-size: 18px;
  text-align: center;
}

.receipt-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.receipt-row span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.course-strip {
  display: grid;
  gap: 12px;
}

.course-pill {
  display: grid;
  gap: 5px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.course-pill strong {
  font-size: 16px;
}

.course-pill span,
.course-pill small {
  color: var(--muted);
}

.course-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 120px auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.course-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.course-card p {
  margin: 0;
  color: var(--muted);
}

.progress {
  height: 10px;
  overflow: hidden;
  background: #eef2f6;
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.attendance {
  display: inline-grid;
  grid-template-columns: repeat(4, 18px);
  gap: 3px;
}

.dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: 10px;
  font-weight: 800;
}

.dot.ok {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.dot.no {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

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

.report-card {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.report-card p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfd;
}

.protocol-stamp-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.protocol-stamp-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.protocol-stamp-editor-header strong,
.protocol-stamp-editor-header span,
.protocol-stamp-editor > small {
  display: block;
}

.protocol-stamp-editor-header span,
.protocol-stamp-editor > small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.protocol-stamp-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.protocol-stamp-presets button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.protocol-stamp-presets button:hover:not(:disabled),
.protocol-stamp-presets button:focus-visible {
  border-color: #b00020;
  color: #b00020;
}

.protocol-stamp-presets button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.protocol-stamp-status {
  padding: 9px 11px;
  border-left: 4px solid #b00020;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  line-height: 1.4;
}

.protocol-stamp-editor.is-disabled .protocol-stamp-status {
  border-left-color: var(--line-strong);
  color: var(--muted);
}

.protocol-pdf-stage-shell {
  max-height: min(68vh, 820px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: #e8edf1;
}

.protocol-pdf-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 5px 18px rgba(23, 32, 51, 0.18);
}

.protocol-pdf-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.protocol-stamp-box {
  --protocol-stamp-lines: 3;
  --protocol-stamp-font-size: 9px;
  position: absolute;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px 7px;
  border: 2px solid #be0000;
  color: #be0000;
  background: transparent;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.protocol-stamp-box:focus-visible {
  outline: 3px solid rgba(190, 0, 0, 0.28);
  outline-offset: 2px;
}

.protocol-stamp-box > span:first-child {
  display: -webkit-box;
  overflow: hidden;
  width: 100%;
  color: inherit;
  font-size: var(--protocol-stamp-font-size);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--protocol-stamp-lines);
}

.protocol-stamp-resize {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  background: #be0000;
  cursor: nwse-resize;
}

@media (max-width: 720px) {
  .protocol-stamp-editor-header {
    display: grid;
  }

  .protocol-stamp-presets {
    justify-content: flex-start;
  }

  .protocol-pdf-stage-shell {
    padding: 6px;
  }
}

.protocol-mail-options {
  display: grid;
  gap: 8px;
  padding: 14px;
  text-align: left;
}

.protocol-mail-options > span {
  color: var(--muted);
  line-height: 1.35;
}

.protocol-mail-options .check-row {
  min-height: 28px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  padding: 72px 20px 20px;
  background: rgba(15, 23, 42, 0.5);
}

.modal {
  width: min(920px, 100%);
  max-height: calc(100vh - 96px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--amber);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #fff;
  background: var(--amber);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.conversation-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #eef7f5;
  border: 1px solid #b9ddd6;
  border-radius: 6px;
}

.conversation-meta strong,
.conversation-meta span,
.conversation-recipients > strong {
  display: block;
}

.conversation-meta span {
  margin-top: 3px;
  color: var(--muted);
}

.conversation-recipients {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.conversation-messages {
  min-height: 220px;
  max-height: min(46vh, 480px);
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 12px;
  background: #f7f9f9;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.conversation-message {
  max-width: min(720px, 92%);
  padding: 11px 13px;
  background: #fff;
  border: 1px solid #d7dfe1;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
}

.conversation-message.role-famiglia,
.conversation-message.role-allievo {
  justify-self: end;
  background: #fff8e8;
  border-left-color: var(--amber);
}

.conversation-message.role-segreteria,
.conversation-message.role-admin,
.conversation-message.role-direzione {
  border-left-color: var(--clivis-burgundy);
}

.conversation-message-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 6px;
}

.conversation-message-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.conversation-reply {
  margin-top: 14px;
}

.conversation-attachments {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(15, 52, 57, 0.12);
}

.conversation-attachment {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  color: var(--teal-dark);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 121, 113, 0.22);
  border-radius: 7px;
  text-decoration: none;
}

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

.conversation-attachment.expired {
  color: var(--muted);
  background: #f2f3f4;
  border-style: dashed;
}

.pdf-action-status {
  display: block;
  max-width: 220px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

@media (max-width: 640px) {
  .conversation-meta,
  .conversation-recipients,
  .conversation-message-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .conversation-message {
    max-width: 100%;
  }

  .conversation-message-head {
    gap: 2px;
  }
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-action-status {
  flex: 1 1 100%;
  padding: 9px 10px;
  color: #075047;
  background: #e8f6f2;
  border: 1px solid #b9e2d8;
  border-radius: 6px;
  font-weight: 800;
}

.button.is-confirmed {
  background: #05755f;
  border-color: #05755f;
}

.collapsed .app-shell,
.app-shell.collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.app-shell.collapsed .brand span,
.app-shell.collapsed .nav-title,
.app-shell.collapsed .nav-label,
.app-shell.collapsed .nav-count {
  display: none;
}

.app-shell.collapsed .sidebar-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  margin: 12px auto 10px;
  padding: 0;
  color: #fff;
  background: var(--teal);
  border-color: var(--teal-dark);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.app-shell.collapsed .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
}

@media (max-width: 1100px) {
  .kpi-grid,
  .grid-three,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two,
  .split-view {
    grid-template-columns: 1fr;
  }

  .course-card {
    grid-template-columns: minmax(0, 1fr) 140px;
  }
}

@media (max-width: 820px) {
  .app-shell,
  .app-shell.collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .topbar-actions,
  .search-box {
    width: 100%;
    min-width: 0;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .notification-control {
    flex: 1 1 auto;
  }

  .notification-button {
    width: 100%;
  }

  .notification-menu {
    right: auto;
    left: 0;
  }

  .portal-switch {
    width: 100%;
  }

  .portal-switch .ghost-button {
    flex: 1 1 0;
  }

  .sidebar {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #mainNav {
    display: flex;
    overflow-x: auto;
  }

  .nav-section {
    min-width: 210px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .sidebar-toggle {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .portal-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .registry-support {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 15px;
  }

  .family-review {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 17px;
  }

  .family-review-action {
    width: 100%;
    white-space: normal;
  }

  body.registry-portal .personal-summary .surface-body {
    align-items: flex-start;
    flex-direction: column;
  }

  body.registry-portal .personal-summary .surface-body > div:first-child {
    min-width: 0;
  }

  body.registry-portal .summary-tags {
    justify-content: flex-start;
  }

  .page-header {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .kpi-grid,
  .grid-three,
  .form-grid,
  .form-grid.three,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .course-card {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 760px;
  }

  .surface-body.table-scroll {
    overflow-x: auto;
  }
}

.teacher-portal-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  overflow-x: auto;
  background: #eef3f5;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.teacher-portal-tabs button {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 9px 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.teacher-portal-tabs button.active {
  color: var(--teal-dark);
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(15, 52, 57, 0.08);
}

.teacher-week-board {
  margin-bottom: 18px;
}

.teacher-week-shell {
  min-width: 980px;
}

.teacher-week-row .planner-room-label {
  min-height: 126px;
}

.teacher-week-row .planner-room-label small {
  color: var(--muted);
}

.teacher-week-track {
  min-height: 126px;
  position: relative;
}

.teacher-week-track > .planner-slot {
  grid-row: 1;
}

.teacher-availability-band {
  min-height: 108px;
  align-content: end;
  opacity: 0.56;
  z-index: 1;
}

.teacher-lesson-card {
  min-height: 108px;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 87, 80, 0.14);
}

.teacher-payment-detail tr.teacher-payment-paid > td {
  background: #eaf8ee;
}

.teacher-payment-detail tr.teacher-payment-due > td {
  background: #fff7d6;
}

.teacher-payment-detail tr.teacher-payment-excluded > td {
  color: var(--muted);
  background: #f6f7f8;
}

@media (max-width: 640px) {
  .teacher-portal-tabs {
    margin-right: -16px;
    margin-left: -16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .teacher-week-board .table-scroll {
    overflow: visible;
  }

  .teacher-week-shell {
    min-width: 0;
    overflow: visible;
  }

  .teacher-week-shell .planner-times {
    display: none;
  }

  .teacher-week-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .teacher-week-row .planner-room-label {
    min-height: 0;
    padding: 8px 10px;
  }

  .teacher-week-track {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    background: #fff;
  }

  .teacher-week-track > .planner-slot {
    width: 100%;
    min-height: 0;
    grid-column: auto !important;
    grid-row: auto;
    opacity: 1;
  }
}
