:root {
  --bg: #edf3f8;
  --panel: #ffffff;
  --panel-2: #f4f8fc;
  --line: #c5d4e3;
  --line-strong: #9fb5cc;
  --ink: #0f2d4f;
  --muted: #4f6683;
  --accent: #0b5d98;
  --accent-soft: #dcedfb;
  --accent-alt: #f3a400;
  --danger: #b3363d;
  --danger-soft: #fde8ea;
  --success: #19724d;
  --success-soft: #e3f4eb;
  --sidebar: #0a5a93;
  --sidebar-muted: #c8d8e9;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --shadow: 0 22px 50px rgba(8, 53, 88, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-ui: Bahnschrift, "Trebuchet MS", sans-serif;
  --font-copy: Cambria, "Times New Roman", serif;
  --admin-field-width: 184px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, #ffffff 0, var(--bg) 42%, #dfeaf4 100%),
    linear-gradient(130deg, rgba(243, 164, 0, 0.08), transparent 38%);
  color: var(--ink);
  font-family: var(--font-ui);
}

.page-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 34, 56, 0.38);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease-in-out;
}

.page-transition-card {
  min-width: min(320px, calc(100vw - 48px));
  max-width: 460px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-transition-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #b7c9db;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: page-spin 700ms linear infinite;
}

.page-transition-message {
  margin: 0;
  color: #183d60;
  font-size: 0.92rem;
  font-weight: 600;
}

@keyframes page-spin {
  to {
    transform: rotate(360deg);
  }
}

body.booting .page-transition-overlay,
body.mpa-freeze .page-transition-overlay {
  opacity: 1;
  pointer-events: auto;
}

body.booting #login-screen,
body.booting #password-change-screen,
body.booting .app-shell {
  visibility: hidden;
}

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

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  z-index: 1000;
  background:
    radial-gradient(circle at top left, #ffffff 0, var(--bg) 42%, #dfeaf4 100%),
    linear-gradient(130deg, rgba(243, 164, 0, 0.08), transparent 38%);
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), #fff);
  border: 1px solid rgba(190, 197, 213, 0.9);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.login-card h2,
.login-card p {
  margin: 0;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 4px;
}

.login-card label {
  font-size: 0.86rem;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.login-logo {
  width: min(220px, 100%);
  margin: 0 auto 4px;
}

.login-ornament {
  position: fixed;
  right: 0;
  bottom: 0;
  width: min(220px, 28vw);
  opacity: 0.45;
  pointer-events: none;
}

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

.password-toggle {
  min-width: 40px;
  height: 40px;
  padding: 0;
}

.login-error {
  font-size: 0.86rem;
  color: var(--danger) !important;
  margin: 0 !important;
}

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


.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    var(--sidebar);
  color: #fff;
  padding: 28px 22px;
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-bottom: 28px;
  padding: 10px 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.36);
}


.brand-logo {
  display: block;
  width: 100%;
  max-width: 232px;
  height: auto;
}

.brand-title {
  margin: 0;
  color: #0f4f84;
  font-weight: 700;
  font-size: 1.14rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.brand h1,
.brand p,
.sidebar-section h2,
.subject-button p,
.subject-button small,
.track-button span,
.track-button small {
  margin: 0;
}

.brand-sub {
  font-size: 0.94rem;
  line-height: 1.45;
}

.brand p,
.sidebar-section h2,
.subject-button small,
.track-button small {
  color: var(--sidebar-muted);
}

.user-block {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-line);
}

.current-user-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--sidebar-muted);
}

.storage-status-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--sidebar-muted);
}

.storage-status-label.is-pending {
  color: #ffe9ad;
}

.storage-status-label.is-ok {
  color: #c9f2dd;
}

.storage-status-label.is-error {
  color: #ffd0d4;
}

.sidebar-logout-button {
  width: 100%;
  text-align: left;
  justify-self: stretch;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.sidebar-logout-button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
}

.sidebar-section {
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-line);
  margin-top: 18px;
}

.sidebar-section > h2 {
  margin-bottom: 12px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.track-list,
.subject-list {
  display: grid;
  gap: 10px;
}

.track-button,
.subject-button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.track-button:hover,
.subject-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
}

.track-button.active,
.subject-button.active {
  border-color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.track-button {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.beheer-group {
  display: grid;
  gap: 8px;
}

.beheer-toggle {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.beheer-chevron {
  color: var(--sidebar-muted);
  font-size: 0.92rem;
  line-height: 1;
}

.beheer-list {
  display: grid;
  gap: 8px;
  padding-left: 10px;
}

/* Keep sidebar scroll, but hide scrollbar visuals. */
.sidebar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.beheer-item {
  background: rgba(255, 255, 255, 0.09);
}

.subject-button {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subject-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.main-panel {
  position: relative;
  z-index: 0;
  padding: 28px 28px 42px;
  overflow-y: auto;
  overflow-x: hidden;
}

.offline-control {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.switch-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
  color: #fff;
}

.switch-row input {
  width: 38px;
  height: 20px;
  accent-color: var(--accent-alt);
}

.offline-status {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.main-panel::after {
  content: "";
  position: fixed;
  right: 0;
  bottom: 0;
  width: min(460px, 36vw);
  aspect-ratio: 383 / 220;
  background: url("./assets/ornament-bottom.png") right bottom / contain no-repeat;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

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

.topbar h2,
.section-card h4 {
  margin: 0;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-filters {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(220px, 320px) minmax(150px, 190px);
  gap: 6px;
  max-width: 760px;
}

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

.topbar-filters label,
.filter-field label {
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-filters select,
.filter-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.topbar-filters optgroup {
  font-weight: 800;
}

.topbar-filters option {
  font-weight: 400;
}

.hidden {
  display: none !important;
}

.new-section-panel {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcff, #f4f7ff);
}

.new-section-head h3,
.new-section-head p {
  margin: 0;
}

.new-section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.new-section-head p {
  color: var(--muted);
  font-size: 0.9rem;
}

.new-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.cohort-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.new-section-message {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.new-section-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
}

.section-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #fff);
  border: 1px solid rgba(190, 197, 213, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
}
.section-card:focus-within {
  z-index: 12;
}
.section-card:has(.multi-dropdown[open]) {
  z-index: 12000;
}

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

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

.field-block label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field-block input,
.field-block select,
.field-block textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.multi-dropdown {
  position: relative;
  width: 100%;
}

.multi-dropdown[open] {
  z-index: 14000;
}

.multi-dropdown > summary {
  list-style: none;
}

.multi-dropdown > summary::-webkit-details-marker {
  display: none;
}

.multi-dropdown-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resources-col-head,
.resources-cell {
  width: 13ch;
  min-width: 13ch;
  max-width: 13ch;
}

.resources-cell .multi-dropdown {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.multi-dropdown[open] .multi-dropdown-trigger {
  border-color: var(--line-strong);
}

.multi-dropdown-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 15000;
  width: max-content;
  min-width: 100%;
  max-width: 320px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(11, 35, 64, 0.14);
  padding: 6px;
}

.multi-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.multi-dropdown-item:hover {
  background: #f1f6fc;
}

.multi-dropdown.disabled .multi-dropdown-trigger {
  background: #f7f9fc;
  color: var(--muted);
  cursor: default;
}

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

.section-container {
  display: grid;
  gap: 18px;
}

.admin-blocks-page,
.home-page,
.exam-committee-page,
.year-agenda-page,
.roster-page {
  display: grid;
  gap: 14px;
}

.admin-columns-page {
  display: grid;
  gap: 14px;
}

.admin-users-page {
  display: grid;
  gap: 14px;
}

.admin-users-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.admin-subjects-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.admin-subjects-controls .field-block.compact {
  display: flex;
  align-items: flex-end;
}

.admin-subjects-controls .field-block.compact > label {
  display: none;
}

.admin-subjects-controls .ghost-button {
  width: auto;
  white-space: nowrap;
}

.admin-blocks-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.admin-filters-title {
  grid-column: 1 / -1;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-blocks-select-all-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 2px;
}

.current-schoolyear-control {
  grid-column: 1 / -1;
  max-width: 280px;
}

.admin-columns-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

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

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

.admin-users-list {
  display: block;
}

.admin-users-tabs {
  display: inline-flex;
  gap: 8px;
}

.rights-matrix-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: auto;
}

.rights-matrix-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 980px;
}

.rights-matrix-table th,
.rights-matrix-table td {
  border-bottom: 1px solid #e6edf6;
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}

.rights-matrix-table thead th {
  background: #f2f7fc;
  color: #35587c;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.rights-matrix-table th:first-child,
.rights-matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
  font-weight: 700;
  color: #163f67;
  min-width: 180px;
}

.rights-matrix-table thead th:first-child {
  z-index: 2;
  background: #f2f7fc;
}

.rights-matrix-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.admin-block-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-block-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
}

.admin-users-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  background: #fff;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1168px;
  table-layout: fixed;
}

.admin-users-table th,
.admin-users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6edf6;
  text-align: left;
  vertical-align: middle;
}

.admin-users-table th {
  color: #35587c;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f2f7fc;
}

.admin-users-table tbody tr:hover td {
  background: #fbfdff;
}

.admin-users-table .user-col {
  font-weight: 700;
  color: #163f67;
  width: 260px;
  overflow-wrap: anywhere;
}

.admin-users-table .roles-col {
  width: 320px;
}

.admin-users-table .assigned-subjects-col {
  width: 500px;
}

.admin-users-table .action-col {
  width: 128px;
  text-align: center;
}

.user-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.subject-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.subject-label-text {
  display: inline-block;
  font-weight: 700;
  color: #173b62;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.subject-name-input[disabled] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  cursor: default;
}

.subject-rights-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.subject-rights-table th.subject-col,
.subject-rights-table td.subject-col {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  text-align: left;
}

.subject-rights-table th.combo-col,
.subject-rights-table td.combo-col {
  width: 66px;
  min-width: 66px;
  max-width: 66px;
  text-align: center;
}

.subject-rights-table .subject-combo-select {
  width: 57px;
  min-width: 57px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.subject-rights-table th.subjects-p3-col,
.subject-rights-table td.subjects-p3-col {
  width: 86px;
  min-width: 86px;
  text-align: center;
}

.admin-subject-p3-label {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.subject-rights-table th.action-col,
.subject-rights-table td.action-col {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  text-align: right;
}

.subject-edit-button {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.admin-subject-auto-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink);
}

.admin-subject-auto-create-list {
  margin-top: 10px;
  border: 1px solid #e6edf6;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 12px;
}

.admin-subject-auto-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: #173b62;
  font-size: 0.92rem;
}

.subject-edit-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230b5d98' d='M4 16.9V20h3.1l9.2-9.2-3.1-3.1L4 16.9Zm13.7-8.6a.9.9 0 0 0 0-1.3l-1.7-1.7a.9.9 0 0 0-1.3 0l-1.3 1.3 3.1 3.1 1.2-1.4Z'/%3E%3C/svg%3E");
}

.subject-edit-button.save-mode .subject-edit-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230f6d46' d='M9.2 16.6 4.9 12.3l1.4-1.4 2.9 2.9 8.5-8.5 1.4 1.4-9.9 9.9Z'/%3E%3C/svg%3E");
}

.admin-users-table td select {
  width: 100%;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.admin-users-table .user-subject-list,
.admin-users-table .user-role-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  justify-content: stretch;
  align-items: center;
  max-width: 100%;
}

.admin-users-table .user-subject-row,
.admin-users-table .user-role-row {
  display: grid;
  border: 0;
  background: transparent;
  grid-template-columns: minmax(0, 1fr) 32px;
  min-height: 0;
  padding: 0;
  gap: 6px;
}

.admin-users-table .user-subject-row select,
.admin-users-table .user-role-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  min-width: 0;
  width: 100%;
}

.admin-users-table .user-subject-row .option-remove,
.admin-users-table .user-role-row .option-remove {
  width: 32px;
  height: 32px;
}

.admin-users-table .user-subject-list .option-add,
.admin-users-table .user-role-list .option-add {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
}

.muted-cell {
  color: var(--muted);
  font-size: 0.92rem;
}

.news-composer,
.news-post {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.news-form,
.news-list {
  display: grid;
  gap: 12px;
}

.news-post h3,
.news-post p {
  margin: 0;
}

.news-post {
  display: grid;
  gap: 10px;
}
.news-post p {
  white-space: pre-line;
}

.news-post.archived {
  opacity: 0.75;
  background: #f7f8fb;
}

.news-post-image {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #e1e8f0;
  background: #fff;
}

.news-post-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.news-post.draggable {
  cursor: move;
}

.news-post.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(11, 93, 152, 0.2);
}

.news-post-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px !important;
}

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

.file-button {
  display: inline-flex;
  align-items: center;
}

.pdf-frame {
  width: 100%;
  min-height: calc(100vh - 170px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.review-section-card .section-header {
  align-items: flex-start;
  gap: 12px;
}

.section-card.akkoord {
  border: 2px solid #66b98f;
}

.section-card.pta-card {
  background: linear-gradient(180deg, #f6faff 0%, #eef6ff 100%);
  border-color: #9fbfe2;
  box-shadow:
    inset 0 0 0 1px rgba(124, 163, 203, 0.25),
    var(--shadow);
}

.section-card.pta-card .section-header {
  border-left: 4px solid #7ca3cb;
  padding-left: 10px;
}

.row-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #d63f3f;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: help;
}

.mobile-row-warning {
  display: flex;
  justify-content: flex-end;
}

.admin-block-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

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

.user-delete-button {
  min-width: 44px;
  padding: 8px 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-reset-password-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}

.admin-column-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: grab;
}

.admin-column-item.dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.admin-column-item.drag-over {
  border-color: #0b5d98;
  box-shadow: 0 0 0 2px rgba(11, 93, 152, 0.16);
}

.admin-column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--admin-field-width), var(--admin-field-width)));
  gap: 10px;
  justify-content: start;
  flex: 1;
}

.admin-column-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.admin-column-grid > .field-block.compact label {
  font-weight: 700;
  color: #35587c;
}

.admin-column-grid [data-column-options-wrap],
#admin-new-column-options-field {
  background: linear-gradient(180deg, #eef5fc, #e8f1fa);
  border: 1px dashed #9bb9d8;
  border-radius: 12px;
  padding: 10px;
}

.admin-column-grid [data-column-options-wrap] > label,
#admin-new-column-options-field > label {
  font-weight: 800;
  font-style: italic;
  color: #0b5d98;
  letter-spacing: 0.01em;
}

.option-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--admin-field-width), var(--admin-field-width)));
  gap: 10px;
  justify-content: start;
}

.option-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.option-block input,
.option-block select {
  border: 0;
  outline: none;
  width: 100%;
  min-width: 0;
  background: transparent;
}

.option-remove {
  border: 0;
  background: #f3f5fb;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.option-remove:hover {
  background: #e7ebf6;
}

.option-remove:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.option-add {
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent);
  border-style: dashed;
  cursor: pointer;
}

.admin-block-meta h3,
.admin-block-meta p {
  margin: 0;
}

.admin-block-meta {
  display: grid;
  gap: 4px;
}

.admin-block-index {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-card {
  padding: 18px 18px 16px;
}

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

.section-title-stack {
  display: grid;
  gap: 10px;
  width: 100%;
}

.section-header-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
}

.section-header-actions .ghost-button,
.section-header-actions .accent-button {
  white-space: nowrap;
}

.section-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-edit-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230b5d98' d='M4 16.9V20h3.1l9.2-9.2-3.1-3.1L4 16.9Zm13.7-8.6a.9.9 0 0 0 0-1.3l-1.7-1.7a.9.9 0 0 0-1.3 0l-1.3 1.3 3.1 3.1 1.2-1.4Z'/%3E%3C/svg%3E");
}

.section-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.section-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-meta-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff4fa;
  border: 1px solid #d2dfec;
  color: #1d446d;
  font-size: 0.96rem;
  font-weight: 600;
}

.section-meta-item:first-child {
  font-size: 0.96rem;
  font-weight: 600;
}

.section-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
}

.badge.locked {
  background: #f1ede3;
  color: #8b6427;
}

.badge.akkoord-badge {
  background: #d8f2e4;
  color: #0f6d46;
}

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

.icon-button .plus {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(11, 93, 152, 0.14);
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
  border: 1px solid rgba(190, 197, 213, 0.7);
  border-radius: 16px;
  background: #fff;
  position: relative;
  z-index: 2;
}
.table-wrap:has(.multi-dropdown[open]) {
  z-index: 13000;
}

.table-scrollbar-top {
  overflow-x: scroll;
  overflow-y: hidden;
  height: 14px;
  border-bottom: 1px solid #e6edf5;
  background: #f7f8fc;
}

.table-scrollbar-top-inner {
  height: 1px;
}

.table-scroll-shell {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 0 0 16px 16px;
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f8fc;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: left;
}

tbody td {
  padding: 8px;
  border-bottom: 1px solid #eceff6;
  vertical-align: top;
  font-size: 0.93rem;
}

tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.cell-input,
.cell-select,
.cell-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  min-height: 40px;
}

.cell-textarea {
  height: 40px;
  min-height: 40px;
  resize: none;
  overflow: hidden;
  line-height: 1.35;
}

.cell-input:focus,
.cell-select:focus,
.cell-textarea:focus,
.field-block input:focus,
.field-block select:focus,
.field-block textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(38, 71, 200, 0.12);
}

.cell-error {
  border-color: var(--danger) !important;
  background: #fff7f8;
}

tbody tr:focus-within .cell-error {
  border-color: var(--line) !important;
  background: #fff;
}

tbody tr:focus-within .cell-error:focus {
  border-color: var(--accent) !important;
  background: #fff;
}

.cell-input[type="text"]::-webkit-outer-spin-button,
.cell-input[type="text"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cell-input[type="text"] {
  -moz-appearance: textfield;
}

.checkbox-cell {
  text-align: center;
  vertical-align: middle;
}

.cell-checkbox {
  display: block;
  margin: 0 auto;
}

.table-wrap thead th.checkbox-head {
  text-align: center;
}

.row-actions {
  text-align: center;
  vertical-align: middle !important;
}

.row-actions .compact-remove-button {
  min-height: 40px;
  height: 40px;
}

.warning-col-head,
.warning-col-cell {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.warning-col-cell {
  vertical-align: middle;
}

.warning-col-cell .warning-icons {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.warning-col-cell .row-warning-icon + .row-warning-icon {
  margin-left: 4px;
}

.row-reorder-head,
.row-reorder-cell {
  width: 2.2rem;
  text-align: center;
}
.row-reorder-cell {
  vertical-align: middle !important;
}

.row-drag-handle {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: move;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: 100%;
}

tr.draggable-row.drag-over {
  outline: 2px solid rgba(11, 93, 152, 0.3);
  outline-offset: -2px;
}

.ce-preview-button {
  width: 100%;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 8px;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  min-height: 40px;
}
.ce-preview-button.cell-error {
  border-color: var(--danger) !important;
  background: #fff7f8;
}

.ce-preview-sub {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.cell-select[data-column-key="schoolOwn"] {
  min-width: 8ch;
}
.school-own-cell {
  vertical-align: top !important;
}
.exam-withdraw-button {
  white-space: nowrap;
}

.ce-details-dialog {
  border: 0;
  padding: 0;
  border-radius: 16px;
  width: min(900px, 94vw);
}

.ce-details-dialog::backdrop {
  background: rgba(10, 21, 34, 0.45);
}

.ce-details-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.ce-details-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ce-details-list {
  display: grid;
  gap: 10px;
  max-height: 56vh;
  overflow: auto;
}

.ce-details-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ce-details-col {
  display: grid;
  gap: 10px;
  align-content: start;
}

.ce-details-col h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.ce-details-col-list {
  display: grid;
  gap: 8px;
}

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

.weight-warning-head {
  color: var(--danger);
}

.weight-warning-mark {
  display: inline-flex;
  margin-top: 4px;
  cursor: help;
}

.cell-select[data-column-key="schoolYear"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  padding-right: 12px;
}

.table-wrap tbody tr:last-child td:first-child {
  border-bottom-left-radius: 15px;
}

.table-wrap tbody tr:last-child td:last-child {
  border-bottom-right-radius: 15px;
}

.section-add-row {
  display: flex;
  justify-content: center;
  padding-top: 14px;
  position: relative;
  z-index: 1;
}

.add-row-footer-button {
  border-style: dashed;
  min-width: 180px;
  justify-content: center;
}

.copy-previous-button {
  min-width: 168px;
  white-space: nowrap;
}

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

.ghost-button,
.danger-button,
.accent-button {
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover,
.danger-button:hover,
.accent-button:hover {
  border-color: var(--line-strong);
  background: #f9faff;
}

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

.compact-remove-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1;
}

.accent-button {
  color: #fff;
  background: var(--accent);
  border-color: #1f3daa;
}

.accent-button:hover {
  color: #fff;
  background: #2341b5;
  border-color: #1f3daa;
}

.success-button {
  border-radius: 12px;
  padding: 10px 14px;
  border: 1px solid #b6dfca;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
  white-space: nowrap;
}

.success-button:hover {
  border-color: #7fbd9d;
  background: #d5efdf;
}

.roster-tabs {
  margin-top: 4px;
}

.roster-table {
  min-width: 900px;
}

.roster-sort-button {
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.roster-filter-head {
  position: relative;
}

.roster-filter-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.roster-filter-caret {
  font-size: 0.68rem;
  color: #6f86a0;
}

.roster-filter-caret.active {
  color: var(--accent);
}

.roster-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 6px;
  width: min(260px, 90vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.13);
  padding: 8px;
  z-index: 30;
  display: grid;
  gap: 6px;
}

.roster-filter-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.roster-filter-divider {
  border-top: 1px solid #e6edf6;
  margin: 2px 0;
}

.roster-filter-values {
  max-height: 180px;
  overflow: auto;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  padding: 6px;
  background: #fbfdff;
  display: grid;
  gap: 4px;
}

.roster-filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #173b62;
}

.roster-filter-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.user-lock-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
}

.lock-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.lock-icon.closed {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f4dd00' d='M7 10V7a5 5 0 0 1 10 0v3h1.2A1.8 1.8 0 0 1 20 11.8v9.4A1.8 1.8 0 0 1 18.2 23H5.8A1.8 1.8 0 0 1 4 21.2v-9.4A1.8 1.8 0 0 1 5.8 10H7Zm2.4 0h5.2V7a2.6 2.6 0 0 0-5.2 0v3Z'/%3E%3Cpath fill='%23ffffff' d='M12 14.2a1.7 1.7 0 0 0-.9 3.15v2.05h1.8V17.35a1.7 1.7 0 0 0-.9-3.15Z'/%3E%3C/svg%3E");
}

.lock-icon.open {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f4dd00' d='M7 10h11.2A1.8 1.8 0 0 1 20 11.8v9.4A1.8 1.8 0 0 1 18.2 23H5.8A1.8 1.8 0 0 1 4 21.2v-9.4A1.8 1.8 0 0 1 5.8 10H7Z'/%3E%3Cpath fill='%23f4dd00' d='M16.9 8.2h-2.3V7a2.6 2.6 0 0 0-4.44-1.84l-1.7-1.7A5 5 0 0 1 17 7v1.2h.9a1.2 1.2 0 0 1 1.2 1.2v.5a1.2 1.2 0 0 1-1.2 1.2h-2.2a1.2 1.2 0 0 1-1.2-1.2V9.4a1.2 1.2 0 0 1 1.2-1.2Z'/%3E%3Cpath fill='%23ffffff' d='M12 14.2a1.7 1.7 0 0 0-.9 3.15v2.05h1.8V17.35a1.7 1.7 0 0 0-.9-3.15Z'/%3E%3C/svg%3E");
}

.section-note {
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid #e6decb;
  color: #594c31;
  margin-bottom: 14px;
  line-height: 1.55;
}

.empty-state {
  padding: 16px;
  border-radius: 14px;
  background: #f8faff;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.mobile-row-list {
  display: grid;
  gap: 14px;
}

.mobile-row-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfcff;
}

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

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

.mobile-row-field label {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.mobile-row-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .main-panel {
    padding: 20px;
  }

  .sidebar {
    display: none;
  }

  .topbar,
  .section-header {
    flex-direction: column;
  }

  .topbar-filters {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .section-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .section-card {
    padding: 16px 14px 14px;
  }

  .admin-block-item {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-column-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .admin-column-item {
    flex-direction: column;
    align-items: stretch;
  }

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

  .section-badges {
    gap: 6px;
  }

  .ce-details-split {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-height: 1080px), (max-width: 1600px) {
  .app-shell {
    grid-template-columns: 256px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 14px;
  }

  .brand {
    margin-bottom: 16px;
    padding: 8px 8px 10px;
  }

  .sidebar-section {
    margin-top: 12px;
    padding-top: 12px;
  }

  .track-button,
  .subject-button {
    padding: 9px 11px;
    border-radius: 11px;
  }

  .main-panel {
    padding: 18px 18px 28px;
  }

  .section-card {
    padding: 14px 14px 12px;
  }

  thead th {
    padding: 9px 8px;
    font-size: 0.72rem;
  }

  tbody td {
    padding: 6px;
    font-size: 0.88rem;
  }

  .cell-input,
  .cell-select,
  .cell-textarea,
  .ce-preview-button {
    min-height: 36px;
    padding: 7px 8px;
  }

  .add-row-footer-button,
  .copy-previous-button {
    min-width: 150px;
  }
}

@media (max-width: 420px) {
  .section-controls,
  .mobile-row-grid,
  .cohort-grid {
    grid-template-columns: 1fr;
  }

  .mobile-row-field.full-width,
  .field-block.full-width {
    grid-column: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .row-actions,
  .mobile-row-actions,
  #add-section-button,
  #new-section-panel,
  #reset-subject-button,
  .subject-tags {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-panel {
    padding: 0;
  }

  .section-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}
