:root {
  --bg: #f2f0e8;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --text: #1f2a2e;
  --muted: #617177;
  --line: #d5d1c5;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #dff4ef;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --shadow: 0 24px 70px rgba(38, 49, 54, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.10), transparent 34%),
    linear-gradient(180deg, #faf7f0 0%, var(--bg) 100%);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

html,
body {
  width: 100%;
  height: 100%;
}

a {
  color: var(--accent-strong);
}

img,
video {
  max-width: 100%;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.narrow-shell {
  width: min(560px, calc(100% - 32px));
}

.admin-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.hero,
.topbar,
.panel,
.school-card,
.display-message,
.display-loading {
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid rgba(213, 209, 197, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero,
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  border-radius: 28px;
  padding: 28px;
  margin-bottom: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-center {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex: 1 1 auto;
}

.brand-mark {
  width: 74px;
  height: 86px;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-copy h1,
.brand-copy p {
  margin: 0;
}

.brand-copy .lede {
  max-width: 680px;
}

.auth-brand {
  justify-content: center;
  margin-bottom: 22px;
}

.auth-brand .brand-mark {
  width: 82px;
  height: 94px;
}

.hero h1,
.topbar h1,
.panel h1,
.panel h2,
.school-card h3,
.display-message h1,
.display-loading h1 {
  margin: 0 0 10px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede,
.panel-heading p,
.school-card p,
.helper-note,
.display-message p,
.display-loading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

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

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

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

.device-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.school-card {
  border-radius: 20px;
  padding: 22px;
}

.school-tile {
  display: grid;
  gap: 16px;
}

.subscription-expired-card {
  border-color: rgba(180, 35, 24, 0.35);
}

.subscription-expired-note {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.24);
}

.status-danger {
  color: var(--danger);
  font-weight: 800;
}

.tile-meta {
  display: grid;
  gap: 8px;
}

.tile-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

.subscription-card-form {
  display: grid;
  gap: 16px;
}

.device-association-block {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(242, 240, 232, 0.52);
}

.device-association-heading,
.device-association-empty {
  margin: 0;
}

.device-association-empty {
  color: var(--muted);
}

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

.device-association-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.device-association-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

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

.user-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.user-card h4 {
  margin: 0;
}

.audit-filter-form {
  margin-bottom: 22px;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.audit-search-field {
  grid-column: span 2;
}

.audit-summary-grid {
  margin-bottom: 18px;
}

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

.audit-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(242, 240, 232, 0.48);
}

.audit-summary-row span {
  color: var(--muted);
  font-weight: 700;
}

.device-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.device-section {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(242, 240, 232, 0.52);
}

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

.section-heading h4 {
  margin: 0;
}

.section-heading p,
.device-summary-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.table-subcopy {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.audit-details {
  min-width: 180px;
}

.audit-details summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.audit-details pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.45;
}

.device-card-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
}

.device-card-summary::-webkit-details-marker {
  display: none;
}

.device-card-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  padding: 20px 22px 22px;
  border-top: 1px solid rgba(213, 209, 197, 0.8);
  align-items: start;
}

.device-card-titleblock {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.device-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.device-card-header h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.device-card-titleblock code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.device-card-body > .checkbox-row,
.device-card-body > .device-meta,
.device-card-body > .action-row {
  grid-column: 1 / -1;
}

.device-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.device-online {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.device-offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.device-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(223, 244, 239, 0.45);
}

.device-meta p {
  margin: 0;
  word-break: break-word;
}

.card-actions,
.topbar-actions,
.action-row,
.manager-toolbar,
.toolbar-section {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.card-actions {
  margin-top: 18px;
}

.school-section-nav {
  margin-top: 0;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.button-secondary {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid rgba(15, 118, 110, 0.25);
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: #922019;
}

.button-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.9rem;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form label,
.checkbox-row {
  display: grid;
  gap: 8px;
}

.stack-form span {
  font-weight: 600;
}

.readonly-field {
  display: grid;
  gap: 8px;
}

.readonly-field p {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.55);
  color: var(--text);
  white-space: pre-wrap;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  margin-top: 2px;
}

.helper-note,
.empty-state {
  margin-top: 18px;
  padding: 16px;
  background: rgba(223, 244, 239, 0.62);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

.portal-note {
  display: grid;
  gap: 10px;
}

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

.help-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(242, 240, 232, 0.52);
}

.help-card h3,
.help-card p,
.help-card ul,
.help-card ol {
  margin: 0;
}

.help-list {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.help-list li + li {
  margin-top: 6px;
}

.portal-note code {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  word-break: break-all;
}

.compact-note {
  margin-top: 0;
  margin-bottom: 18px;
}

.display-url-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.display-url-note a {
  word-break: break-all;
}

.flash {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 600;
}

.flash-success {
  background: rgba(223, 244, 239, 0.72);
  color: var(--accent-strong);
}

.flash-error {
  background: rgba(253, 231, 228, 0.74);
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.subscriptions-table input,
.subscriptions-table select {
  min-width: 120px;
}

.manager-toolbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.toolbar-file {
  max-width: 320px;
}

.hidden-upload-form {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.admin-details {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  margin-top: 14px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 34, 38, 0.42);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-window {
  width: min(980px, calc(100vw - 32px));
  max-height: min(86vh, 900px);
  overflow: auto;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.84);
  border: 1px solid rgba(213, 209, 197, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px 24px 0;
}

.modal-header h2 {
  margin: 0;
}

.modal-body {
  padding: 24px;
}

.modal-close {
  flex: 0 0 auto;
}

.admin-details summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 700;
}

.admin-details summary::-webkit-details-marker {
  display: none;
}

.admin-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.details-body {
  padding: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

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

thead th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.32);
}

.thumb {
  width: 90px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: #e7eceb;
}

.drag-handle {
  font-weight: 700;
  cursor: grab;
  color: var(--muted);
  user-select: none;
}

.auth-panel {
  margin-top: 64px;
}

.directory-page .hero {
  margin-top: 18px;
}

.display-page {
  background: #000;
  overflow: hidden;
  cursor: none;
  margin: 0;
}

.display-stage {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.display-page * {
  cursor: none !important;
}

.display-media {
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
  background: #000;
  flex: 0 0 auto;
}

img.display-media {
  display: block;
  margin: auto;
}

video.display-media {
  display: block;
  margin: auto;
}

.display-message,
.display-loading {
  width: min(560px, calc(100% - 32px));
  margin: 48px auto;
  padding: 32px;
  border-radius: 24px;
  text-align: center;
}

code {
  font-family: Consolas, "Courier New", monospace;
}

@media (max-width: 820px) {
  .hero,
  .topbar,
  .split-layout,
  .maintenance-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    align-items: flex-start;
  }

  .brand-mark {
    width: 64px;
    height: 74px;
  }

  .split-layout {
    display: grid;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .topbar-actions,
  .action-row,
  .manager-toolbar,
  .toolbar-section {
    width: 100%;
  }

  .topbar-center {
    width: 100%;
    justify-content: center;
  }

  .button {
    width: 100%;
  }

  .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-file {
    max-width: none;
    width: 100%;
  }

  .audit-search-field {
    grid-column: auto;
  }

  .device-card-header,
  .device-card-body,
  .device-meta {
    grid-template-columns: 1fr;
  }

  .device-card-summary,
  .device-card-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .device-association-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Modern admin dashboard layer */
:root {
  --bg: #f6f8f7;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --text: #17292d;
  --muted: #647278;
  --line: #dde5e2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f5f1;
  --navy: #102a43;
  --navy-soft: #eaf0f6;
  --warning: #9a6700;
  --warning-soft: #fff4d6;
  --success: #176b4d;
  --success-soft: #e4f7ed;
  --muted-soft: #f1f4f3;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --shadow: 0 14px 40px rgba(16, 42, 67, 0.08);
  --shadow-soft: 0 8px 22px rgba(16, 42, 67, 0.06);
  --radius: 16px;
}

.admin-page {
  min-height: 100%;
  background: #f6f8f7;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.admin-page a {
  color: var(--accent-strong);
}

.admin-page .shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 24px 32px 56px 300px;
}

.admin-page .narrow-shell {
  width: min(460px, calc(100% - 32px));
  min-height: auto;
  margin: 0 auto;
  padding: 56px 0;
}

.admin-page .topbar,
.admin-page .panel,
.admin-page .school-card,
.admin-page .display-message,
.admin-page .display-loading {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.admin-page .topbar {
  position: fixed;
  inset: 16px auto 16px 16px;
  z-index: 30;
  width: 252px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 18px;
  margin: 0;
  padding: 18px;
  border-radius: 18px;
}

.admin-page .brand-block {
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.admin-page .brand-mark {
  width: 42px;
  height: 50px;
}

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

.admin-page .brand-copy h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.admin-page .eyebrow,
.admin-page .brand-copy .eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.admin-page .topbar-center {
  flex: 0 0 auto;
  width: 100%;
  justify-content: flex-start;
  align-items: stretch;
}

.admin-page .topbar-actions,
.admin-page .topbar-center-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
}

.admin-page .topbar-actions {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.admin-page .button {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.admin-page .button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.admin-page .button:focus-visible,
.admin-page a:focus-visible,
.admin-page input:focus-visible,
.admin-page select:focus-visible,
.admin-page textarea:focus-visible,
.admin-page summary:focus-visible,
.admin-page button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.admin-page .button-secondary {
  background: #ffffff;
  color: var(--navy);
  border-color: var(--line);
}

.admin-page .button-secondary:hover,
.admin-page .button-secondary.is-active {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--accent-strong);
}

.admin-page .topbar-actions .button,
.admin-page .topbar-center-actions .button {
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-page .topbar-actions .button:hover,
.admin-page .topbar-actions .button.is-active,
.admin-page .topbar-center-actions .button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: none;
}

.admin-page .button-danger {
  background: var(--danger);
  color: #ffffff;
}

.admin-page .button-small {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 0.82rem;
}

.admin-page .panel {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: var(--radius);
}

.admin-page .panel-heading {
  margin-bottom: 18px;
}

.admin-page .panel-heading h1,
.admin-page .panel-heading h2,
.admin-page .school-card h3,
.admin-page .section-heading h3,
.admin-page .section-heading h4 {
  color: var(--text);
  letter-spacing: -0.02em;
}

.admin-page .panel-heading h1,
.admin-page .panel-heading h2 {
  font-size: 1.35rem;
}

.admin-page .panel-heading p,
.admin-page .section-heading p,
.admin-page .tile-meta p,
.admin-page .helper-note {
  color: var(--muted);
  line-height: 1.5;
}

.admin-page .card-actions,
.admin-page .action-row,
.admin-page .manager-toolbar,
.admin-page .toolbar-section {
  gap: 8px;
}

.admin-page .card-actions {
  margin-top: 14px;
}

.admin-page input[type="text"],
.admin-page input[type="password"],
.admin-page input[type="number"],
.admin-page input[type="date"],
.admin-page input[type="email"],
.admin-page input[type="file"],
.admin-page select,
.admin-page textarea {
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.92rem;
}

.admin-page textarea {
  line-height: 1.45;
}

.admin-page .stack-form {
  gap: 14px;
}

.admin-page .stack-form span,
.admin-page .readonly-field span {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-page .readonly-field p {
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--muted-soft);
}

.admin-page .flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9rem;
}

.admin-page .flash-success {
  background: var(--success-soft);
  border-color: rgba(23, 107, 77, 0.14);
  color: var(--success);
}

.admin-page .flash-error {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.14);
  color: var(--danger);
}

.admin-page table {
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-page th,
.admin-page td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.admin-page thead th {
  background: #f8faf9;
  color: #647278;
  font-size: 0.72rem;
  font-weight: 800;
}

.admin-page .school-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.admin-page .school-card,
.admin-page .user-card,
.admin-page .device-card,
.admin-page .admin-details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: none;
}

.admin-page .school-card {
  padding: 18px;
}

.admin-page .device-status,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 0;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.admin-page .device-online,
.badge-success {
  background: var(--success-soft);
  border-color: rgba(23, 107, 77, 0.16);
  color: var(--success);
}

.admin-page .device-offline,
.badge-danger {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.16);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-soft);
  border-color: rgba(154, 103, 0, 0.16);
  color: var(--warning);
}

.badge-muted {
  background: var(--muted-soft);
  border-color: var(--line);
  color: #56666b;
}

.badge-navy {
  background: var(--navy-soft);
  border-color: rgba(16, 42, 67, 0.15);
  color: var(--navy);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.dashboard-header h2 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.035em;
}

.dashboard-header p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.dashboard-primary {
  flex: 0 0 auto;
}

.schools-panel {
  padding: 0;
  overflow: visible;
}

.schools-panel .dashboard-header,
.schools-panel .empty-state,
.school-management-list {
  margin-left: 22px;
  margin-right: 22px;
}

.schools-panel .dashboard-header {
  margin-top: 22px;
}

.school-management-list {
  display: grid;
  gap: 0;
  padding-bottom: 22px;
}

.school-management-header,
.school-management-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(120px, 0.9fr) minmax(150px, 1.1fr) minmax(125px, 0.9fr) minmax(96px, 0.72fr) minmax(106px, 0.82fr) minmax(220px, 1.5fr) 88px;
  gap: 12px;
  align-items: center;
}

.school-management-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--panel);
}

.school-management-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: none;
}

.school-management-card + .school-management-card {
  margin-top: 10px;
}

.school-management-row {
  padding: 15px 16px;
}

.school-management-card:hover {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: var(--shadow-soft);
}

.school-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 0.88rem;
}

.school-name-cell strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-name-cell code {
  color: var(--muted);
  font-size: 0.76rem;
}

.cell-label {
  display: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.truncate-text,
.display-url-cell a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-url-cell a {
  display: block;
  max-width: 100%;
  font-size: 0.82rem;
}

.school-actions-cell {
  justify-content: end;
}

.action-menu {
  position: relative;
  justify-self: end;
}

.action-menu summary {
  list-style: none;
  min-height: 32px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu[open] summary,
.action-menu summary:hover {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.24);
  color: var(--accent-strong);
}

.action-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.menu-link {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-link:hover {
  background: var(--muted-soft);
  color: var(--accent-strong);
}

.subscription-editor {
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.subscription-editor > summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.subscription-editor > summary::-webkit-details-marker {
  display: none;
}

.subscription-editor > summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.subscription-editor-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.subscription-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.admin-page .device-association-block,
.admin-page .help-card,
.admin-page .audit-summary-row,
.admin-page .user-card {
  background: #f8faf9;
}

.admin-page .device-association-item {
  background: #ffffff;
  border: 1px solid var(--line);
}

.modal-window {
  background: #ffffff;
  border-radius: 16px;
}

.modal-header {
  padding: 22px 22px 0;
}

.modal-body {
  padding: 22px;
}

.nav-toggle {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-footer {
  width: auto;
  margin: 0 32px 24px 300px;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 1180px) {
  .school-management-header,
  .school-management-row {
    grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(110px, 0.8fr) minmax(100px, 0.75fr) minmax(110px, 0.85fr) 78px;
  }

  .school-management-header span:nth-child(7),
  .display-url-cell {
    display: none;
  }
}

@media (max-width: 900px) {
  .admin-page {
    padding-bottom: 28px;
  }

  .admin-page .shell {
    width: 100%;
    min-height: 100vh;
    padding: 76px 14px 42px;
  }

  .admin-page .narrow-shell {
    width: min(460px, calc(100% - 28px));
    padding: 76px 0 42px;
  }

  .admin-page .topbar {
    inset: 0 0 auto 0;
    width: auto;
    min-height: 62px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 10px 28px rgba(16, 42, 67, 0.08);
  }

  .admin-page .brand-block {
    flex: 1 1 auto;
  }

  .admin-page .brand-mark {
    width: 32px;
    height: 38px;
  }

  .admin-page .brand-copy h1 {
    max-width: 58vw;
    overflow: hidden;
    font-size: 0.96rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-page .brand-copy .eyebrow {
    font-size: 0.62rem;
  }

  .admin-page .topbar > .topbar-center {
    display: none;
  }

  .admin-page .topbar-actions .topbar-center {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
  }

  .nav-toggle span:not(.sr-only) {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--navy);
  }

  .admin-page .topbar-actions {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    left: 12px;
    display: none;
    max-height: min(72vh, 520px);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .admin-page .topbar.nav-open .topbar-actions {
    display: flex;
  }

  .admin-page .topbar-actions .button {
    min-height: 40px;
  }

  .admin-page .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 12px;
  }

  .dashboard-header h2 {
    font-size: 1.45rem;
  }

  .dashboard-primary {
    width: 100%;
  }

  .schools-panel .dashboard-header,
  .schools-panel .empty-state,
  .school-management-list {
    margin-left: 16px;
    margin-right: 16px;
  }

  .school-management-header {
    display: none;
  }

  .school-management-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px;
  }

  .school-name-cell,
  .display-url-cell,
  .school-actions-cell {
    grid-column: 1 / -1;
  }

  .display-url-cell {
    display: grid;
  }

  .cell-label {
    display: block;
  }

  .school-actions-cell {
    justify-content: stretch;
  }

  .action-menu,
  .action-menu summary {
    width: 100%;
  }

  .action-menu-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .subscription-control-grid {
    grid-template-columns: 1fr;
  }

  .subscription-editor > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-page .device-card-body,
  .admin-page .device-meta,
  .audit-filter-grid,
  .split-layout,
  .maintenance-grid {
    grid-template-columns: 1fr;
  }

  .admin-page .button {
    width: auto;
  }

  .admin-page .card-actions .button,
  .admin-page .manager-toolbar .button,
  .admin-page .toolbar-section .button {
    width: auto;
  }

  .admin-footer {
    margin: 0 14px 24px;
  }
}

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

  .admin-page .panel {
    padding: 14px;
  }

  .schools-panel .dashboard-header,
  .schools-panel .empty-state,
  .school-management-list {
    margin-left: 14px;
    margin-right: 14px;
  }

  .admin-page .card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-page .card-actions .button {
    width: 100%;
  }
}

/* Calendar application layer */
.content-grid {
  margin-top: 18px;
}

.calendar-admin-shell {
  display: grid;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.calendar-toolbar {
  min-width: 860px;
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf9;
}

.calendar-toolbar > div {
  text-align: center;
}

.calendar-toolbar h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 1.25rem;
}

.calendar-month-board {
  min-width: 860px;
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.calendar-weekday {
  padding: 10px 12px;
  background: #eef4f3;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #486166;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-weekday:nth-child(7n) {
  border-right: 0;
}

.calendar-day {
  min-height: 132px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day.is-outside-month {
  background: #f7f8f6;
}

.calendar-day.is-outside-month .calendar-date-button {
  color: #839093;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.36);
}

.calendar-date-button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.calendar-date-button small {
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e6f3f1;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.calendar-date-button:hover small,
.calendar-date-button:focus-visible small {
  background: var(--accent);
  color: #ffffff;
}

.calendar-date-button:focus-visible,
.calendar-event-pill:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.calendar-day-events {
  display: grid;
  gap: 5px;
}

.calendar-event-pill {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #f1faf8;
  color: #16393a;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.calendar-event-pill span {
  display: block;
  margin-bottom: 2px;
  color: #5c7075;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-event-pill[data-event-type="closed"] {
  border-left-color: var(--danger);
  background: #fff4f2;
}

.calendar-event-pill[data-event-type="holiday"] {
  border-left-color: #d98610;
  background: #fff8e8;
}

.calendar-event-pill[data-event-type="testing"],
.calendar-event-pill[data-event-type="seminar"] {
  border-left-color: #2563eb;
  background: #eef4ff;
}

.calendar-event-pill[data-event-type="tournament"],
.calendar-event-pill[data-event-type="special_class"] {
  border-left-color: var(--success);
  background: #edf9f2;
}

.calendar-more-count {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.event-list-block {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.compact-heading {
  margin-bottom: 2px;
}

.compact-heading h3 {
  margin: 0;
}

.event-list-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.9fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.event-list-row h3,
.event-list-row p {
  margin: 0;
}

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

.event-list-actions .delete-form {
  margin-top: 0;
}

.event-modal-window {
  width: min(860px, calc(100vw - 32px));
}

.editor-block {
  display: grid;
  gap: 8px;
}

.editor-label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rich-editor {
  min-height: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.rich-editor:focus {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.message-preview {
  max-height: 180px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf9;
  color: var(--text);
  line-height: 1.45;
}

.message-preview h1,
.message-preview h2,
.message-preview h3,
.message-preview p,
.message-preview ul,
.message-preview ol {
  margin-top: 0;
}

.delete-form {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .event-list-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .event-list-actions {
    justify-content: flex-start;
  }
}
