/* Operative UI only: official documents, grids, campus map and their fonts keep their own rules. */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
  }
  html[data-theme="light"] {
    color-scheme: light;
  }
  .upp-level-one {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    min-width: 0;
  }
  .upp-level-one :is(h1, h2) {
    text-wrap: balance;
  }
  .upp-level-two {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-width: 0;
  }
  html:root .upp-context-bar {
    gap: 8px;
    min-width: 0;
  }
  html:root .upp-context-bar > * {
    min-width: 0;
  }
  html:root
    .upp-context-bar
    :is(
      input:not([type="checkbox"]):not([type="radio"]),
      select,
      button,
      .btn
    ) {
    min-block-size: 40px !important;
    border-radius: var(--ux-control-radius);
  }
  .upp-search-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  .upp-search-field > input {
    width: 100%;
    min-width: 0;
  }
  html:root .upp-search-clear {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    min-height: 36px;
    margin: 0;
    padding: 6px;
    background: var(--ux-surface);
    color: var(--ux-text);
    border: 1px solid var(--ux-control-line);
    border-radius: var(--ux-control-radius);
    cursor: pointer;
  }
  .upp-search-clear[hidden] {
    display: none !important;
  }
  .upp-search-field input::-webkit-search-cancel-button {
    -webkit-appearance: none;
  }
  .upp-focus-target {
    scroll-margin-block-start: var(--upp-scroll-inset, 9rem);
    scroll-margin-block-end: 2rem;
  }
  .upp-revealed {
    outline: 2px solid color-mix(in srgb, var(--ux-primary) 60%, transparent);
    outline-offset: 3px;
  }
  .upp-busy-mark {
    display: inline-block;
    flex: none;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: upp-busy-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-inline-end: 6px;
  }
  .upp-loading-surface {
    position: relative;
  }
  .upp-loading-surface::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--ux-primary);
    pointer-events: none;
    opacity: 0.7;
  }
  .upp-ui-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: 90dvh;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 24px;
    border: 1px solid var(--ux-line);
    border-radius: var(--ux-radius);
    background: var(--ux-surface);
    color: var(--ux-text);
    font: inherit;
  }
  .upp-ui-dialog::backdrop {
    background: color-mix(in srgb, var(--ux-text) 45%, transparent);
  }
  .upp-ui-dialog h2 {
    margin: 0 0 16px;
    font-size: 1.25rem;
  }
  .upp-ui-dialog p {
    line-height: 1.6;
    white-space: pre-line;
  }
  .upp-ui-dialog textarea {
    width: 100%;
    font: inherit;
    min-height: 100px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--ux-control-line);
    background: var(--ux-surface);
    color: var(--ux-text);
    border-radius: var(--ux-control-radius);
  }
  .upp-dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
  }
  .upp-dialog-actions button {
    min-height: 40px;
    padding: 8px 16px;
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--ux-control-line);
    border-radius: var(--ux-control-radius);
    background: var(--ux-surface);
    color: var(--ux-text);
  }
  .upp-dialog-actions .upp-dialog-primary {
    border-color: var(--ux-primary);
    background: var(--ux-primary);
    color: var(--ux-on-primary);
  }
  .upp-dialog :is(button, input, textarea, select):focus-visible,
  .upp-search-clear:focus-visible {
    outline: 3px solid var(--ux-focus);
    outline-offset: 3px;
  }
  .upp-dialog {
    max-height: 90dvh;
    overscroll-behavior: contain;
  }
  html:root
    :is(.ev-scroll, .table-scroll, .cloud-dialog .table-wrap, .ss-table-wrap) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  html:root .ev-scroll > table {
    min-width: 680px;
    table-layout: auto;
  }
  html:root .ev-scroll :is(th, .ev-badge, button) {
    word-break: normal;
    overflow-wrap: normal;
  }
  html:root .ev-scroll :is(th, .ev-badge) {
    white-space: nowrap;
  }
  html:root
    :is(
      .ev-metric strong,
      .sv-metric,
      .ed-stat strong,
      .ae-stat strong,
      .ss-stat strong,
      .status-pill,
      .teacher-record-state,
      time
    ) {
    font-variant-numeric: tabular-nums;
  }
  html:root .upp-cloud .save-indicator:not(.error) {
    display: none;
  }
  html[data-theme="dark"] :is(.panel, #cvRoot) {
    color: var(--ux-text);
  }
  html[data-theme="dark"] .panel {
    --navy: var(--ux-text);
    --navy-soft: var(--ux-text);
    --line: var(--ux-line);
  }
  html[data-theme="dark"]
    .panel
    :is(
      .card,
      .inbox-item,
      .file-entry,
      .selected-tag,
      .module-status.error,
      .panel-message,
      .just-dialog
    ):not(:where(.doc-area, .doc-area *)),
  html[data-theme="dark"]
    :is(
      .cv-card,
      .cv-tabs,
      .cv-preview-card,
      .cv-fieldset,
      .cv-toolbar,
      .cv-alert
    ) {
    background: var(--ux-surface);
    color: var(--ux-text);
    border-color: var(--ux-line);
  }
  html[data-theme="dark"]
    .panel
    :is(
      h1,
      h2,
      h3,
      p,
      .hint,
      .sub,
      .count,
      .file-info,
      .field label,
      .edit-hint,
      .attachment-link span,
      .pager
    ):not(:where(.doc-area, .doc-area *)),
  html[data-theme="dark"] #cvRoot :is(h1, h2, h3, p, label, small, .cv-note) {
    color: var(--ux-text);
  }
  html[data-theme="dark"]
    .panel
    :is(input, textarea, select, .btn, .type-btn):not(:where(.doc-area *)) {
    background: var(--ux-surface);
    color: var(--ux-text);
    border-color: var(--ux-control-line);
  }
  html[data-theme="dark"] body:has(#cvRoot) {
    background: var(--ux-canvas);
  }
  html[data-theme="dark"] body:has(a.google) {
    background: var(--ux-canvas);
    color: var(--ux-text);
  }
  html[data-theme="dark"] body:has(a.google) > main {
    background: var(--ux-surface);
    border-color: var(--ux-line);
    color: var(--ux-text);
  }
  html[data-theme="dark"] body:has(a.google) > main :is(p, .note, .brand span) {
    color: var(--ux-muted);
  }
  html:root
    :is(.upp-level-one, .upp-level-two, .upp-context-bar)
    :is(button, a.btn) {
    gap: 8px;
  }
  @keyframes upp-busy-spin {
    to {
      transform: rotate(1turn);
    }
  }
}
@media screen and (max-width: 768px) {
  html:root :is(.upp-level-one, .upp-level-two) {
    align-items: flex-start;
    gap: 12px;
  }
  html:root
    .upp-level-one
    > :is(
      .actions,
      .toolbar,
      .sp-actions,
      .ed-actions,
      .ss-actions,
      .sv-actions
    ) {
    width: 100%;
    flex-wrap: wrap;
  }
  html:root
    .upp-context-bar
    :is(input:not([type="checkbox"]):not([type="radio"]), select, button, .btn),
  html:root .upp-search-clear {
    min-block-size: 44px !important;
  }
  html:root .upp-context-bar :is(input, select) {
    font-size: 16px;
  }
  .upp-dialog-actions > button {
    flex: 1 1 auto;
    min-height: 44px;
  }
}
@media screen and (pointer: coarse) {
  html:root .upp-search-clear {
    min-width: 44px;
    min-height: 44px;
  }
}
@media screen and (prefers-reduced-motion: reduce) {
  .upp-busy-mark {
    animation: none;
  }
  .upp-focus-target {
    scroll-behavior: auto;
  }
}
@media screen {
  .upp-focus-target:focus {
    outline: 3px solid var(--ux-focus);
    outline-offset: 3px;
  }
  .week .slot.block .upp-grid-teacher {
    position: absolute;
    inset: auto 6px 4px;
    display: block;
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.15;
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    color: inherit;
  }
  .week .slot.block:has(.bspan) .upp-grid-teacher {
    right: 78px;
  }
  html[data-theme="dark"] body:has(.panel) {
    background: var(--ux-canvas);
  }
}
@media screen {
  /* Decorative labels yield to the actual module title. Instrument codes and folios remain. */
  .module-heading > div > .eyebrow,
  .panel > .eyebrow,
  .cv-heading .cv-eyebrow,
  .ord-eyebrow,
  .sp-header > .sp-eyebrow,
  .ed-top > .ed-eyebrow,
  .ss-top > .ss-eyebrow {
    display: none;
  }
  html[data-theme="dark"] .module-top {
    background: var(--ux-surface);
    color: var(--ux-text);
    border-color: var(--ux-line);
  }
  html[data-theme="dark"] .module-top a {
    color: var(--ux-text);
  }
  .upp-document-preview {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
}
@media screen {
  html[data-theme="dark"] .panel .btn-print:not(:where(.doc-area *)) {
    background: var(--ux-primary);
    color: var(--ux-on-primary);
    border-color: var(--ux-primary);
  }
}

@media screen {
  .student-record-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-start;
  }
  .student-record-identity {
    flex: 1 1 220px;
    min-width: 0;
  }
  .student-record-title,
  .student-record-actions,
  .student-related {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .student-record-title h3 {
    margin: 0;
  }
  .student-record-actions {
    margin-left: auto;
  }
  .student-record-actions .btn {
    min-height: 40px;
  }
  .student-related {
    border-top: 1px solid var(--ux-line);
    padding-top: 12px;
    margin: 12px 0;
  }
  .student-related .btn {
    font-size: 0.8125rem;
    background: transparent;
    color: var(--ux-text);
  }
  .student-record .eyebrow,
  .teacher-record-identity .eyebrow {
    display: none;
  }
}
@media screen and (max-width: 768px) {
  .student-record-actions {
    margin-left: 0;
    width: 100%;
  }
  .student-record-actions .btn,
  .student-related .btn {
    min-height: 44px;
    flex: 1 1 130px;
  }
}

@media screen {
  .room-catalog-filter {
    margin-block: 12px 16px;
  }
  .room-catalog-filter label {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
}

@media screen {
  .upp-busy-original {
    display: none !important;
  }
}
@media screen {
  body:has(a.google) > main > .eyebrow {
    display: none;
  }
}
