:root {
  --primary: #0b6674;
  --primary-strong: #084f5b;
  --accent: #12a99b;
  --accent-soft: #e7f7f5;
  --bg: #f3f8f9;
  --surface: #ffffff;
  --surface-muted: #f7fafb;
  --text: #17252d;
  --muted: #647681;
  --border: #dce8eb;
  --danger: #dc3f4f;
  --success: #0b8f69;
  --warning: #c57b08;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 2px 8px rgba(8, 79, 91, 0.05);
  --shadow-md: 0 12px 30px rgba(8, 79, 91, 0.08);
  --focus: 0 0 0 3px rgba(18, 169, 155, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  overflow-x: clip;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(14px, 0.25vw + 13px, 16px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

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

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  color: var(--primary-strong);
  font-size: clamp(1.55rem, 2.1vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  color: var(--primary-strong);
  font-size: clamp(1.2rem, 1.4vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  color: var(--primary-strong);
  font-size: clamp(1.02rem, 1vw, 1.15rem);
  line-height: 1.3;
}

a {
  color: var(--primary);
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(210px, 16vw, 250px) minmax(0, 1fr);
  min-width: 0;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  padding: clamp(18px, 2vw, 28px) clamp(14px, 1.5vw, 22px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px rgba(8, 79, 91, 0.035);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(18px, 3vh, 30px);
}

.brand-mark,
.login-mark {
  display: inline-grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(8, 79, 91, 0.18);
  font-weight: 800;
  letter-spacing: 0;
  user-select: none;
}

.brand-mark {
  width: clamp(52px, 4.5vw, 64px);
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
}

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

.nav button {
  width: 100%;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav button:hover {
  color: var(--primary);
  background: var(--accent-soft);
}

.nav button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(11, 102, 116, 0.2);
}

.user-panel {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.install-app-btn {
  width: 100%;
  min-height: 40px;
  color: var(--primary-strong);
  background: var(--accent-soft);
  border-color: #bfe4e1;
}

.mobile-title-copy,
.bottom-nav {
  display: none;
}

.mobile-icon-button svg,
.bottom-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#currentUser {
  color: var(--primary-strong);
  font-size: 0.88rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.main {
  min-width: 0;
  min-height: 100dvh;
}

.workspace {
  width: min(100%, 1440px);
  min-width: 0;
  margin-inline: auto;
  padding: clamp(18px, 3vw, 42px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: clamp(16px, 2vw, 24px);
}

.topbar-copy {
  min-width: 0;
  flex: 1;
}

#viewSubtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(0.9rem, 0.4vw + 0.82rem, 1rem);
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
  animation: view-in 0.22s ease-out both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.panel {
  min-width: 0;
  height: auto;
  margin-bottom: clamp(14px, 2vw, 24px);
  padding: clamp(16px, 2.2vw, 30px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: clamp(16px, 2vw, 24px);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-head > * {
  min-width: 0;
}

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

#draftState {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.dashboard-shell {
  display: grid;
  gap: 16px;
}

.overview-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 3vw, 34px);
  min-width: 0;
  height: auto;
  padding: clamp(20px, 2.5vw, 32px);
  overflow: hidden;
  color: #fff;
  background: #075966;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

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

.overview-card .eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #c9f5ef;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.overview-card h2 {
  color: #fff;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.overview-card p {
  max-width: 58ch;
  margin-top: 6px;
  color: #dceff1;
  font-size: 0.92rem;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(105px, 1fr));
  gap: 9px;
  flex: 0 1 310px;
  min-width: min(100%, 230px);
}

.overview-metrics div {
  min-width: 0;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
}

.overview-metrics span {
  color: #d8f3f1;
  font-size: 0.78rem;
  font-weight: 700;
}

.overview-metrics strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}

.stat {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  height: auto;
  padding: clamp(15px, 1.6vw, 21px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

.stat > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stat > strong {
  color: var(--primary-strong);
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1;
}

.stat-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.stat-breakdown small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  color: var(--muted);
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
}

.stat-breakdown b {
  color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(15px, 1.8vw, 22px);
  min-width: 0;
}

.form-grid > *,
.choice-field,
.class-block,
.class-blocks,
.split-inputs > *,
.row-card > * {
  min-width: 0;
}

.form-grid.compact {
  gap: 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

label,
.choice-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.choice-label {
  color: var(--text);
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  box-shadow: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input,
select {
  min-block-size: 44px;
}

textarea {
  min-block-size: 7rem;
  field-sizing: content;
  resize: vertical;
  line-height: 1.5;
}

.note-input {
  min-block-size: 5.5rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

input::placeholder,
textarea::placeholder {
  color: #94a2aa;
  opacity: 1;
}

input[readonly],
textarea[readonly] {
  color: var(--muted);
  background: var(--surface-muted);
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b6674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field-hint,
.form-help {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}

.field-hint {
  display: none;
}

.required {
  display: none;
  color: var(--danger);
}

.segmented-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
  padding: 5px;
  background: #edf4f5;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.segmented-choice.three,
#teachingSubjectChoices,
#videoSubjectChoices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.segmented-choice.class-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 88px), 1fr));
  overflow: visible;
}

.office-period-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(10px, 1.4vw, 18px);
  min-width: 0;
}

.office-period-grid > * {
  min-width: 0;
}

.segmented-choice button {
  min-width: 0;
  min-block-size: 42px;
  padding: 8px 9px;
  overflow-wrap: anywhere;
  color: var(--primary);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  font-size: clamp(0.82rem, 0.5vw + 0.72rem, 0.94rem);
  font-weight: 750;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.segmented-choice button:hover {
  border-color: rgba(18, 169, 155, 0.5);
}

.segmented-choice button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(11, 102, 116, 0.18);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  margin-top: 6px;
}

.chips input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chips label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-block-size: 40px;
  padding: 8px 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.chips label:hover {
  color: var(--primary);
  border-color: var(--accent);
}

.chips input:checked + label,
.chips label:has(input:checked) {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.class-blocks {
  display: grid;
  gap: 14px;
}

.classless-note {
  margin: 0;
  padding: 10px 13px;
  color: var(--primary-strong);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.class-block {
  height: auto;
  padding: clamp(14px, 1.7vw, 22px);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.class-block > h3 {
  margin-bottom: 13px;
}

.split-inputs {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
  gap: 10px;
  min-width: 0;
}

.attendance-fields {
  margin-top: 6px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.upload-input {
  min-block-size: auto;
  padding: 10px;
  color: var(--muted);
  background: #fbfefe;
  border: 1px dashed #91c9c5;
  cursor: pointer;
}

.upload-input::file-selector-button {
  margin-right: 10px;
  padding: 7px 10px;
  color: var(--primary);
  background: var(--accent-soft);
  border: 0;
  border-radius: 7px;
  font-weight: 650;
  cursor: pointer;
}

button {
  min-width: 0;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

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

button.primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 5px 12px rgba(11, 102, 116, 0.18);
}

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

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

button.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

button.ghost {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

button.ghost:hover {
  color: var(--danger);
  background: #fff0f1;
}

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

.full-width-btn {
  width: 100%;
}

.btn-icon {
  width: 18px;
  height: 18px;
  margin-right: 7px;
}

.btn-loading {
  pointer-events: none;
  opacity: 0.75;
}

.btn-loading::before {
  content: "";
  width: 16px;
  aspect-ratio: 1;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e4eef0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--primary-strong);
  background: #edf6f7;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.data-table tbody tr:hover > td {
  background: #f8fcfc;
}

.actions-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 1%;
  min-width: 116px;
  white-space: nowrap;
  background: #fff;
  box-shadow: -8px 0 14px rgba(8, 79, 91, 0.06);
}

.data-table th:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 116px;
  background: #edf6f7;
  box-shadow: -8px 0 14px rgba(8, 79, 91, 0.06);
}

.data-table tbody tr:hover > td.actions-cell {
  background: #f8fcfc;
}

.video-list-table {
  min-width: 980px;
}

.video-list-table .video-summary-row > td {
  padding-block: 10px;
  vertical-align: middle;
  background: #f1fbf7;
}

.video-list-table .video-summary-row:nth-of-type(4n + 3) > td {
  background: #f8fafb;
}

.video-list-table .video-summary-row:hover > td,
.video-list-table .video-summary-row.is-open > td {
  background: #e8f8f2;
}

.video-list-table .video-summary-row td:not(.actions-cell) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-list-table .actions-cell {
  min-width: 104px;
}

.table-action {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.data-table-detail-row > td {
  position: static;
  padding: 0;
  background: #f8fbfc;
  box-shadow: none;
}

.table-detail-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.table-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.video-list-table .data-table-detail-row > td {
  background: #fff;
}

.video-list-table .table-detail-panel {
  width: 100%;
  padding: 16px;
}

.video-list-table .table-detail-panel .media-set-video {
  width: 100%;
}

.table-detail-grid span,
.detail-note {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-detail-grid strong,
.detail-note strong {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.detail-note span {
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}

.row-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  height: auto;
  padding: 15px 17px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.row-card h3 {
  overflow-wrap: anywhere;
}

.row-card .actions {
  flex: 0 1 auto;
  align-items: center;
  margin: 0;
}

.row-card .actions button {
  padding: 7px 10px;
  font-size: 0.82rem;
}

.access-section,
.user-access-summary {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.access-section > summary,
.user-access-summary > summary {
  min-height: 44px;
  padding: 11px 13px;
  color: var(--primary-strong);
  font-weight: 750;
  cursor: pointer;
}

.access-section[open] > summary,
.user-access-summary[open] > summary {
  border-bottom: 1px solid var(--border);
}

.access-options,
.access-grid,
.user-access-summary > .meta {
  margin: 0;
  padding: 12px;
}

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

.admin-accounts-panel {
  display: grid;
  gap: 14px;
}

.admin-head {
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.admin-head-actions {
  margin-left: auto;
}

.user-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fcfc;
}

.account-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.account-fields input,
.account-fields select,
.account-fields label > input,
.account-fields label > select {
  min-height: 42px;
}

.account-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.permission-group-editor-fields {
  display: none;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f3fbfb;
}

.permission-group-sync-field {
  grid-column: 1 / -1;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  text-transform: none !important;
}

.permission-group-sync-field input {
  width: 18px;
  height: 18px;
  min-height: 18px !important;
  flex: 0 0 auto;
}

.permission-builder {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.permission-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-presets button {
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 8px;
}

.permission-presets .warning {
  color: #a35a00;
  border-color: #f3c64d;
  background: #fff8df;
}

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

.permission-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

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

.permission-card header {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.permission-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
}

.permission-card header span {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 8px;
  background: var(--surface-muted);
}

.permission-card label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 9px;
  min-height: 40px;
  margin-top: 0;
  padding: 8px 11px;
  color: #334155;
  font-weight: 650;
  font-size: 0.82rem;
  line-height: 1.25;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.permission-card label:hover {
  border-color: var(--accent);
  background: #fff;
}

.permission-card label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--primary-strong);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.permission-card label:has(input:disabled) {
  color: #8a99a3;
  background: #f4f6f7;
  opacity: 0.62;
  cursor: not-allowed;
}

.permission-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: #137a8a;
}

.account-subject-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.account-subject-picker label {
  margin: 0;
}

.subject-library {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.subject-library > summary {
  padding: 11px 13px;
  color: var(--primary-strong);
  font-size: 0.92rem;
  font-weight: 850;
  cursor: pointer;
}

.subject-library[open] > summary {
  border-bottom: 1px solid var(--border);
}

.subject-library .team-library-head {
  padding: 10px 12px 0;
}

.subject-catalog-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
}

.subject-catalog-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.subject-catalog-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subject-catalog-item strong {
  color: var(--text);
  font-size: 0.87rem;
}

.subject-catalog-item span,
.subject-catalog-item p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.subject-catalog-item p {
  margin: 5px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.users-table-wrap {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th {
  padding: 14px 16px;
  color: #667789;
  background: #f7fbfc;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.users-table td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #edf3f4;
}

.users-table tbody tr:last-child td {
  border-bottom: 0;
}

.employee-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.employee-avatar,
.video-feed-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  color: #fff;
  background: linear-gradient(135deg, #0b6674, #158b83);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(8, 79, 91, 0.16);
  font-weight: 900;
}

.employee-cell strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
}

.employee-cell small,
.permission-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 900;
}

.role-pill.admin {
  color: #9a5700;
  background: #fff4d8;
  border: 1px solid #f1c857;
}

.role-pill.scoped {
  color: #0b6b8c;
  background: #e6f7ff;
  border: 1px solid #b3e5fa;
}

.role-pill.employee {
  color: #1d5f9f;
  background: #eef7ff;
  border: 1px solid #cfe7fb;
}

.status-pill.active {
  color: #0c805e;
  background: #e6fbf3;
}

.status-pill.locked {
  color: #9f1239;
  background: #fff1f2;
}

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

.table-icon-actions button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #7a8da1;
  background: transparent;
  border: 0;
  border-radius: 9px;
  box-shadow: none;
}

.table-icon-actions button:hover {
  color: var(--primary);
  background: #edf7f8;
}

.table-icon-actions button.danger:hover {
  color: #b4233b;
  background: #fff1f2;
}

.table-icon-actions svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(8px);
}

.account-modal.hidden {
  display: none;
}

.account-modal-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(940px, calc(100vw - 30px));
  max-height: min(92dvh, 780px);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.team-modal-box {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(760px, calc(100vw - 30px));
  max-height: min(90dvh, 760px);
  padding: 0 14px 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.team-modal-box .account-modal-head {
  margin: 0 -14px;
}

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

.team-form-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.team-modal-box > .scope-picker {
  min-height: 0;
  overflow: hidden;
}

.team-modal-box .scope-picker-options {
  max-height: 330px;
}

.account-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: #f8fbfc;
}

.account-modal-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
}

.account-modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #7a8da1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: none;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-close:hover {
  color: var(--primary);
  background: #edf7f8;
}

.account-modal .user-form-shell {
  max-height: 100%;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 14px;
}

.account-modal-footer {
  position: sticky;
  bottom: -12px;
  z-index: 5;
  justify-content: flex-end;
  padding: 9px 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), #fff 38%);
}

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

.video-feed-card {
  display: grid;
  gap: 9px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.video-feed-card.is-open {
  border-color: rgba(19, 122, 138, 0.28);
  box-shadow: 0 12px 28px rgba(8, 79, 91, 0.09);
}

.video-feed-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.video-feed-copy {
  min-width: 0;
}

.video-feed-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.video-feed-title-row h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.video-feed-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.video-feed-toggle {
  min-width: 88px;
  min-height: 36px;
  padding: 7px 11px;
}

.video-feed-meta {
  display: grid;
  grid-template-columns: repeat(var(--meta-count, 4), minmax(92px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce9eb;
  border-radius: 7px;
}

.video-feed-meta span {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  min-height: 50px;
  padding: 7px 9px;
  color: #405261;
  background: #f8fbfc;
  border-right: 1px solid #dce9eb;
  font-size: 0.82rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.video-feed-meta span:last-child {
  border-right: 0;
}

.video-feed-meta strong {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.video-feed-card.is-open .video-feed-meta {
  margin-top: -4px;
}

.video-feed-note {
  padding: 9px 11px;
  color: #334155;
  background: #fffdf3;
  border: 1px solid #f5e3a6;
  border-radius: 10px;
  font-weight: 650;
}

.video-feed-card:not(.is-open) .video-feed-note {
  max-height: 38px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.video-feed-media {
  min-width: 0;
  padding-top: 2px;
}

.video-feed-card.is-open .video-feed-media {
  width: 100%;
  padding-top: 5px;
  border-top: 1px solid #e3edef;
}

.video-feed-media .media-set-video .media-mosaic,
.video-feed-media .media-set-video .media-mosaic.few,
.video-feed-media .media-set-video .media-mosaic.many {
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  width: 100%;
  gap: 10px;
}

.video-feed-media .media-set-video .media-mosaic.single {
  grid-template-columns: minmax(220px, min(420px, 100%));
}

.advanced-scope {
  background: #fff;
}

.advanced-scope > summary {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 0.88rem;
}

.scope-picker {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.scope-picker legend {
  padding: 0 5px;
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

.scope-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.scope-picker-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-muted);
  cursor: pointer;
}

.scope-picker-options input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
}

.scope-picker-options span,
.scope-picker-options strong,
.scope-picker-options small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.scope-picker-options small {
  color: var(--muted);
}

.scope-picker.scope-disabled {
  opacity: 0.48;
  background: #f4f6f7;
}

.permission-library {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.permission-library > summary {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--primary-strong);
  font-weight: 800;
  cursor: pointer;
}

.team-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 10px;
}

.team-library-head p,
.empty-library {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.scope-rule-note {
  margin: 0;
  padding: 9px 11px;
  color: #35515a;
  background: #edf8f6;
  border: 1px solid #cfe9e4;
  border-radius: 7px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.permission-group-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 0 12px 12px;
}

.permission-group-chip {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.permission-group-chip strong,
.permission-group-chip span {
  display: block;
  overflow-wrap: anywhere;
}

.permission-group-chip strong {
  color: var(--text);
  font-size: 0.9rem;
}

.permission-group-chip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.permission-group-chip.system {
  background: #f8fbff;
}

.permission-group-chip.create {
  border-style: dashed;
  border-color: rgba(19, 122, 138, 0.38);
  background: #f3fbfb;
}

.permission-group-chip.create strong {
  color: var(--primary);
}

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

.permission-group-actions button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

.account-modal.group-builder-mode .account-fields > input,
.account-modal.group-builder-mode .account-user-only,
.account-modal.group-builder-mode .permission-group-select-field,
.account-modal.group-builder-mode #savePermissionGroupBtn,
.account-modal.group-builder-mode #saveUserBtn {
  display: none;
}

.account-modal.group-builder-mode .permission-group-editor-fields {
  display: grid;
}

#savePermissionGroupFooterBtn {
  display: none;
}

.account-modal.group-builder-mode #savePermissionGroupFooterBtn {
  display: inline-flex;
}

.secondary.danger {
  color: #a53b3b;
  border-color: #f1c4c4;
  background: #fff7f7;
}

#adminView .row-card {
  padding: 12px;
}

#adminView .row-card h3 {
  margin-bottom: 2px;
  font-size: 1rem;
}

#adminView .user-access-summary {
  margin-top: 7px;
}

#adminView .user-access-summary > summary {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

#adminView .row-card .actions {
  gap: 6px;
}

#adminView .row-card .actions button {
  min-height: 34px;
}

.user-access-summary {
  margin-top: 9px;
}

.user-access-summary > .meta {
  padding-block: 5px;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.strong-line {
  color: var(--text);
  font-weight: 600;
}

.teaching-card {
  display: block;
  padding: clamp(14px, 1.6vw, 20px);
}

.teaching-card-body {
  min-width: 0;
}

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

.teaching-card-title h3 {
  color: var(--primary);
  font-size: clamp(0.92rem, 0.22vw + 0.88rem, 1.03rem);
  line-height: 1.35;
  font-weight: 800;
}

.teaching-card-actions {
  display: flex;
  align-items: center;
  justify-items: end;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.video-card {
  display: block;
  padding: clamp(14px, 2vw, 22px);
  border-radius: 16px;
}

.video-card-main {
  min-width: 0;
}

.video-card h3 {
  margin: 0;
  color: var(--primary);
  font-size: clamp(0.92rem, 0.22vw + 0.88rem, 1.03rem);
  line-height: 1.35;
  font-weight: 800;
}

.video-card-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.video-compact-title {
  color: var(--text) !important;
}

.load-more-sentinel {
  width: 100%;
  padding: 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: center;
  font-weight: 800;
}

.load-more-button {
  cursor: pointer;
}

.load-more-button:hover {
  color: var(--primary);
  background: var(--accent-soft);
}

.media-load-more {
  width: fit-content;
  margin: 10px auto 0;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
}

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

.pagination-controls button,
.pagination-controls select {
  min-height: 40px;
}

.data-table tr.log-row.submitted td { background: #F3F4F6; }
.data-table tr.log-row.approved td { background: rgba(16, 185, 129, 0.08); }
.data-table tr.log-row.approved-edited td { background: rgba(248, 113, 113, 0.12); }

.status-note {
  margin-top: 4px;
  color: #B91C1C;
  font-size: 0.82rem;
  font-weight: 800;
}

.reports-panel {
  margin-top: 18px;
}

.reports-stack {
  display: grid;
  gap: 22px;
}

.report-cutoff-note {
  padding: 10px 12px;
  color: var(--primary-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(18, 169, 155, 0.22);
  border-radius: 8px;
  font-weight: 800;
}

.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
}

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

.report-dot {
  width: 13px;
  height: 13px;
  border: 2px solid #777;
  border-radius: 4px;
  display: inline-block;
  background: #fff;
}

.report-dot.submitted { background: #E5E7EB; }
.report-dot.approved { background: #86EFAC; }
.report-dot.edited { background: #FCA5A5; }

.report-section-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.report-section h3 {
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 3vw, 2rem);
  text-transform: uppercase;
}

.report-section-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.report-section-meta span {
  padding: 5px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.report-table-wrap {
  overflow-x: auto;
  border: 1px solid #111;
  border-radius: 8px;
}

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
  font-family: Georgia, "Times New Roman", serif;
}

.report-table th,
.report-table td {
  border: 1px solid #111;
  text-align: center;
  padding: 7px 9px;
}

.report-table th {
  background: #FFFF00;
  color: #000;
  font-weight: 900;
}

.report-table tbody th {
  white-space: nowrap;
}

.report-cell span {
  width: 24px;
  height: 24px;
  border: 3px solid #888;
  border-radius: 5px;
  display: inline-block;
  vertical-align: middle;
}

.report-cell.submitted span { background: #22C55E; border-color: #15803D; }
.report-cell.approved span { background: #22C55E; border-color: #15803D; }
.report-cell.edited span { background: #FCA5A5; border-color: #DC2626; }

.report-cell em {
  margin-left: 5px;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 900;
}

.video-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.video-files,
.file-preview {
  margin-top: 14px;
  background: var(--accent-soft);
  border: 1px solid #bfe4e0;
  border-radius: var(--radius-sm);
}

.video-files {
  overflow: hidden;
  background: #f7fbfb;
  border-color: #d7e7ea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.media-mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(130px, 18vw, 210px);
  gap: 2px;
  background: #dfe9eb;
}

.media-mosaic.single {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: auto;
}

.media-mosaic.few {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: clamp(170px, 26vw, 300px);
}

.media-set-video {
  max-width: 100%;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.media-set-video .media-mosaic {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 300px));
  grid-auto-rows: auto;
  justify-content: start;
  gap: 14px;
  background: transparent;
}

.media-set-video .media-mosaic.single {
  grid-template-columns: minmax(180px, min(260px, 100%));
}

.media-set-video .media-mosaic.few {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 300px));
  grid-auto-rows: auto;
}

.media-set-video .media-mosaic.many {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 300px));
  grid-auto-rows: auto;
}

.media-set-video .media-mosaic.many .media-item:nth-child(n) {
  grid-column: auto;
  grid-row: auto;
}

.media-set-video .media-item {
  aspect-ratio: var(--media-aspect, 9 / 16);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(8, 79, 91, 0.08);
}

.media-set-video .media-item.media-landscape {
  grid-column: span 2;
  width: min(100%, 614px);
}

.media-more-tile {
  display: grid;
  place-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 130px;
  padding: 18px;
  color: var(--primary);
  background: #f7fbfc;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}

.media-more-tile strong {
  font-size: 1rem;
}

.media-more-tile span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.media-set-video .media-more-tile {
  min-height: 180px;
  border: 1px dashed #bdd9dd;
  border-radius: 8px;
}

.media-set-video .media-item video,
.media-set-video .media-item img {
  object-fit: cover;
}

.media-mosaic.many .media-item:nth-child(6n) {
  grid-column: span 2;
}

.media-mosaic.many .media-item:nth-child(6n + 5) {
  grid-row: span 2;
}

.media-set-video .media-mosaic .media-item.media-landscape {
  grid-column: span 2;
}

.detail-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  min-width: 0;
}

.detail-identity h2 {
  flex: 0 1 auto;
  margin: 0;
}

.detail-breadcrumb {
  flex: 1 1 420px;
  min-width: min(100%, 280px);
  padding: 7px 9px;
  color: #405261;
  background: #f7fbfc;
  border-radius: 6px;
  font-size: 0.78rem;
}

.detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 12px 14px 14px;
}

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

.detail-summary-grid > div.wide {
  grid-column: span 2;
}

.detail-summary-grid strong {
  color: var(--muted);
  font-size: 0.74rem;
}

.detail-summary-grid span {
  color: var(--text);
  overflow-wrap: anywhere;
}

.media-item {
  position: relative;
  min-width: 0;
  margin: 0;
  background: #122426;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.media-openable {
  cursor: zoom-in;
}

.media-openable:focus-visible {
  outline: 3px solid rgba(18, 169, 155, 0.55);
  outline-offset: 2px;
}

.media-item video,
.media-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #132426;
  object-fit: cover;
}

.media-video-preview video,
.media-video-preview img {
  filter: saturate(1.04);
}

.media-video-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.24));
}

.media-count-chip,
.media-open-hint {
  position: absolute;
  z-index: 3;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.media-count-chip {
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.media-open-hint {
  right: 10px;
  bottom: 42px;
  max-width: calc(100% - 20px);
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 800;
}

.media-mosaic.single .media-item {
  aspect-ratio: 16 / 9;
}

.media-mosaic.single .media-item video,
.media-mosaic.single .media-item img {
  object-fit: contain;
}

.media-set-video .media-mosaic.single .media-item {
  aspect-ratio: 9 / 16;
}

.media-set-video .media-mosaic.single .media-item video,
.media-set-video .media-mosaic.single .media-item img {
  object-fit: cover;
}

.media-item figcaption,
.media-caption {
  position: absolute;
  left: 8px;
  right: 74px;
  bottom: 8px;
  z-index: 2;
  width: fit-content;
  max-width: calc(100% - 82px);
  margin: 0;
  padding: 4px 7px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.media-item.legacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 112px;
  padding: 12px;
  background: #fff;
}

.media-item.legacy .media-caption {
  position: static;
  color: var(--text);
  background: transparent;
  padding: 0;
}

.media-item.legacy .media-save-quick {
  position: static;
  flex: 0 0 auto;
  color: #fff;
  background: var(--primary);
}

.document-item {
  display: grid;
  min-height: 220px;
  background: #f8fbfc;
}

.document-item .media-menu-button {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 12px rgba(8, 79, 91, 0.14);
}

.doc-preview {
  position: relative;
  min-height: 155px;
  background: linear-gradient(145deg, #eef7f8, #ffffff);
  overflow: hidden;
}

.doc-preview iframe {
  width: 100%;
  height: 100%;
  min-height: 190px;
  border: 0;
  background: #fff;
  transform-origin: top left;
}

.doc-sheet {
  position: absolute;
  inset: 16px 18px 12px;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 26px 18px 16px;
  background: #fff;
  border: 1px solid #dfe9ec;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(8, 79, 91, 0.08);
}

.doc-corner {
  position: absolute;
  top: -1px;
  right: -1px;
  padding: 5px 9px;
  color: #fff;
  background: var(--primary);
  border-radius: 0 8px 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.doc-line {
  display: block;
  height: 7px;
  background: #d7e6e8;
  border-radius: 999px;
}

.doc-line.wide { width: 84%; }
.doc-line.short { width: 52%; }

.doc-block {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  background: #edf5f6;
  border: 1px dashed #c8dcdf;
  border-radius: 7px;
}

.doc-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  background: #fff;
  border-top: 1px solid #dfe9ec;
}

.doc-info strong {
  color: var(--text);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.play-chip {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 1;
  width: 54px;
  height: 54px;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.play-chip::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 16px;
  border-block: 11px solid transparent;
  border-left: 16px solid #fff;
}

.media-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
}

.media-menu-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
}

.media-save-quick {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  min-width: 44px;
  min-height: 34px;
  padding: 6px 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 850;
}

.media-save-quick:hover,
.media-save-quick:focus-visible {
  background: var(--primary);
}

.media-menu-popover {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 8;
  display: grid;
  min-width: 178px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.media-menu-popover a,
.media-menu-popover button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.media-menu-popover a:hover,
.media-menu-popover button:hover {
  background: var(--surface-muted);
}

html.media-viewer-open,
body.media-viewer-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(5, 18, 22, 0.94);
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
}

.media-viewer.hidden {
  display: none;
}

.media-viewer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  color: #fff;
  background: linear-gradient(rgba(5, 18, 22, 0.92), rgba(5, 18, 22, 0.5));
}

.media-viewer-top strong {
  display: block;
  max-width: min(68vw, 620px);
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-viewer-top span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
}

.media-viewer-actions {
  display: flex;
  align-items: center;
}

.media-viewer-menu {
  position: relative;
}

.media-viewer-menu > summary {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.media-viewer-menu > summary::-webkit-details-marker {
  display: none;
}

.media-viewer-action-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 20;
  display: grid;
  width: max-content;
  min-width: 158px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.media-viewer-action-menu .ghost {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.82rem;
  text-align: left;
  text-decoration: none;
}

.media-viewer-action-menu .ghost:hover {
  background: var(--surface-muted);
}

.media-viewer-action-menu .media-viewer-save {
  color: var(--primary-strong);
  font-weight: 850;
}

.media-viewer-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 8px max(58px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(58px, env(safe-area-inset-left));
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.media-viewer-stage img,
.media-viewer-stage video {
  display: block;
  max-width: min(100%, 1200px);
  max-height: calc(100dvh - 96px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.media-viewer-stage video {
  width: auto;
  height: auto;
  touch-action: auto;
  user-select: auto;
}

.media-viewer.media-viewer-zoomed .media-viewer-stage img,
.media-viewer.media-viewer-zoomed .media-viewer-stage video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  object-fit: contain;
  border-radius: 8px;
}

.media-viewer-nav {
  position: fixed;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 58px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow: none;
  font-size: 2.1rem;
  line-height: 1;
  transform: translateY(-50%);
}

.media-viewer-nav.prev {
  left: max(10px, env(safe-area-inset-left));
}

.media-viewer-nav.next {
  right: max(10px, env(safe-area-inset-right));
}

.video-files.empty {
  color: var(--muted);
  padding: 12px;
}

.media-file-list {
  display: grid;
  gap: 7px;
  padding: 10px 12px 12px;
  background: #fff;
}

.media-set-teaching .media-file-list,
.media-set-detail .media-file-list {
  display: none;
}

.video-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-kind-icon {
  display: inline-grid;
  place-items: center;
  min-inline-size: 24px;
  min-block-size: 24px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 800;
}

.file-name {
  min-width: 0;
  color: var(--text);
  font-weight: 600;
}

.folder-link {
  white-space: nowrap;
}

.file-preview ol {
  margin: 6px 0 0 1.2rem;
  padding: 0;
}

.file-preview li {
  overflow-wrap: anywhere;
}

.list-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 12px;
  padding: 5px;
  background: #edf4f5;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.list-tabs button {
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.list-tabs button.active {
  color: #fff;
  background: var(--primary);
}

.list-filter-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin-bottom: 10px;
}

.list-query-bar {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.list-search {
  display: flex;
  align-items: center;
  width: 220px;
  min-width: 0;
  margin: 0;
}

.list-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.list-search input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  flex: 0 0 100%;
  padding: 7px 10px;
  border-radius: 8px;
}

#clearListFiltersBtn {
  min-height: 38px;
  padding: 6px 9px;
  white-space: nowrap;
}

.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
}

.filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
}

.empty-choice {
  grid-column: 1 / -1;
  padding: 11px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.filters {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.filters > * {
  flex: 0 0 148px;
  width: 148px;
  min-width: 148px;
  min-height: 38px;
  height: 38px;
  padding: 6px 9px;
}

.filters > button {
  flex-basis: auto;
  width: auto;
  min-width: 84px;
}

.video-filters > :disabled {
  display: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.tag.PENDING_REVIEW,
.tag.PENDING { color: #8b5705; background: #fff2cd; }
.tag.APPROVED,
.tag.SUCCESS { color: #067354; background: #dff6ee; }
.tag.NEED_EDIT { color: #1768a0; background: #e7f3fc; }
.tag.DELETED,
.tag.FAILED { color: #b72d3b; background: #fdebed; }
.tag.ACTIVE { color: #354c9c; background: #e9edff; }
.tag.LOCKED,
.tag.INACTIVE { color: #59656c; background: #edf0f2; }

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 8px 18px;
  min-width: 0;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.detail-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-bottom: 10px;
}

.detail-section {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: clip;
}

.detail-section > summary {
  min-height: 46px;
  padding: 12px 14px;
  color: var(--primary-strong);
  background: var(--surface-muted);
  font-weight: 800;
  cursor: pointer;
}

.detail-section > .detail-grid,
.detail-section > .form-grid,
.detail-section > .media-block {
  margin: 0;
  padding: 14px;
}

.storage-tree {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.detail-grid strong {
  color: var(--muted);
  font-size: 0.84rem;
}

.detail-grid span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-edit-form {
  margin-top: 14px;
}

.detail-section-head {
  margin-top: 18px;
  margin-bottom: 10px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eye-toggle {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.8;
  cursor: pointer;
}

.diff-view {
  padding: 10px 11px;
  white-space: pre-wrap;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.45;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: var(--bg);
}

.login-card {
  width: min(100%, 420px);
  height: auto;
  padding: clamp(24px, 5vw, 38px);
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-mark {
  width: 76px;
  margin: 0 auto 14px;
  font-size: 1.15rem;
}

.login-card h1 {
  font-size: clamp(1.35rem, 4vw, 1.75rem);
}

.login-card > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stack {
  display: grid;
  gap: 11px;
  text-align: left;
}

.overlay,
.global-loader,
.mobile-overlay {
  position: fixed;
  inset: 0;
}

.mobile-overlay {
  z-index: 9998;
  background: rgba(16, 35, 43, 0.4);
  backdrop-filter: blur(2px);
}

.modal-overlay {
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 35, 43, 0.55);
  backdrop-filter: blur(5px);
}

.modal-box {
  width: min(100%, 430px);
  max-height: calc(100dvh - 32px);
  padding: clamp(18px, 4vw, 28px);
  overflow-y: auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.modal-box h3 {
  margin-bottom: 7px;
}

.modal-box p {
  margin-bottom: 16px;
  color: var(--muted);
}

.modal-input,
.progress-wrapper {
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 650;
}

.progress-wrapper progress {
  width: 100%;
  accent-color: var(--accent);
}

.loading-copy {
  text-align: center;
}

.global-loader {
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 35, 43, 0.5);
  backdrop-filter: blur(4px);
}

.global-loader-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 22px;
  color: var(--primary);
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-weight: 650;
}

.spinner {
  display: block;
  width: 34px;
  aspect-ratio: 1;
  margin: 4px auto 10px;
  border: 3px solid #dceeed;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.toast {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 11000;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 11px 14px;
  color: #fff;
  background: var(--primary-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.toast::before {
  content: "✓";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  aspect-ratio: 1;
  color: var(--primary-strong);
  background: #bff2e9;
  border-radius: 50%;
  font-weight: 800;
}

.submit-result-summary,
.submit-result-list {
  display: grid;
  gap: 7px;
  text-align: left;
}

.submit-result-summary {
  margin-bottom: 12px;
}

.submit-result-summary span,
.submit-result-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.submit-result-list {
  max-height: min(45dvh, 340px);
  overflow-y: auto;
}

.submit-result-row {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.submit-result-row.success { border-color: #a7dfcc; background: #effaf6; }
.submit-result-row.failed { border-color: #f1b8bf; background: #fff3f4; }

.highlight-header {
  border-bottom-color: rgba(18, 169, 155, 0.45);
}

.highlight-header h2 {
  color: var(--accent);
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: max(10px, env(safe-area-inset-right));
    left: auto;
    z-index: 9999;
    width: min(calc(100vw - 20px), 300px);
    height: 100dvh;
    padding: 20px 16px;
    border: 0;
    border-left: 1px solid var(--border);
    transform: translateX(calc(100% + 12px));
    transition: transform 0.22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .brand {
    justify-content: flex-start;
    margin-bottom: 18px;
  }

  .sidebar .brand-mark {
    width: 52px;
  }

  .nav button {
    padding: 11px 12px;
    text-align: left;
  }

  .main {
    min-height: 100dvh;
  }

  .workspace {
    width: 100%;
    padding: 0 14px calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: calc(58px + env(safe-area-inset-top));
    margin: 0 -14px 14px;
    padding: max(9px, env(safe-area-inset-top)) 14px 9px;
    background: rgba(243, 248, 249, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
  }

  .mobile-brand {
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }

  .mobile-brand .brand-mark {
    flex: 0 0 auto;
    width: 40px;
    font-size: 0.75rem;
    box-shadow: 0 5px 12px rgba(8, 79, 91, 0.15);
  }

  .mobile-title-copy {
    display: grid;
    min-width: 0;
    line-height: 1.15;
  }

  .mobile-title-copy strong {
    overflow: hidden;
    color: var(--primary-strong);
    font-size: 0.94rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .connection-status {
    margin-top: 3px;
    color: var(--success);
    font-size: 0.68rem;
    font-weight: 700;
  }

  .connection-status.offline {
    color: var(--danger);
  }

  .mobile-icon-button,
  .menu-toggle {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 8px;
  }

  .mobile-icon-button {
    display: inline-grid !important;
    place-items: center;
    color: var(--primary);
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .menu-toggle {
    display: inline-grid !important;
    place-items: center;
    margin-left: auto;
    padding: 7px;
    color: var(--primary);
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .bottom-nav.mobile-only {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(8, 79, 91, 0.08);
    backdrop-filter: blur(16px);
  }

  .bottom-nav button {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    font-size: 0.67rem;
    font-weight: 700;
    line-height: 1;
  }

  .bottom-nav button::before {
    position: absolute;
    top: -5px;
    width: 28px;
    height: 3px;
    background: transparent;
    border-radius: 0 0 3px 3px;
    content: "";
  }

  .bottom-nav button.active {
    color: var(--primary);
  }

  .bottom-nav button.active::before {
    background: var(--accent);
  }

  .bottom-nav button span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #updateAppBtn {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

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

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

  #logsView .panel {
    padding: 12px;
  }

  #logsView .list-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px;
    border-radius: 14px;
  }

  #logsView .list-tabs button {
    min-height: 38px;
    padding: 7px 6px;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.15;
  }

  #logsView .list-search {
    width: min(42vw, 190px);
    margin-bottom: 0;
  }

  #logsView .list-search input {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 0.88rem;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .user-form-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .account-modal-box {
    width: min(760px, calc(100vw - 24px));
  }

  .team-modal-box {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  .team-form-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .team-form-fields .span-2 {
    grid-column: 1;
  }

  .team-library-head {
    align-items: stretch;
    flex-direction: column;
  }

  .account-modal .user-form-shell {
    padding: 12px;
  }

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

  .video-feed-meta {
    gap: 5px;
  }

  .permission-groups {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .permission-group-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-2 {
    grid-column: 1;
  }

  .overview-card {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .overview-metrics {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .row-card {
    flex-direction: column;
    gap: 11px;
  }

  .row-card .actions {
    width: 100%;
    justify-content: flex-start;
    padding-top: 9px;
    border-top: 1px solid var(--border);
  }

  .data-table {
    min-width: 760px;
    font-size: 0.84rem;
  }

  .data-table th,
  .data-table td {
    padding: 9px 10px;
  }

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

  .teaching-card-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .teaching-card-actions {
    display: flex;
    justify-content: flex-start;
    justify-items: start;
  }

  .filters {
    gap: 8px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .filters button {
    width: auto;
  }

  .filters input,
  .filters select {
    min-height: 40px;
    padding-inline: 10px;
    border-radius: 11px;
    font-size: 0.9rem;
  }

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

  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .detail-grid strong:not(:first-child) {
    margin-top: 7px;
  }
}

@media (max-width: 560px) {
  body {
    background: #f5f9fa;
  }

  #logsView .panel {
    padding: 8px;
  }

  #logsView .list-tabs {
    display: flex;
    grid-template-columns: none;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  #logsView .list-tabs button {
    flex: 0 0 132px;
    min-width: 132px;
    scroll-snap-align: start;
  }

  .list-filter-toolbar {
    gap: 6px;
    margin-bottom: 8px;
    overflow: hidden;
  }

  #logsView .list-search {
    width: min(40vw, 164px);
  }

  #clearListFiltersBtn {
    min-height: 36px;
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  .filters > * {
    flex-basis: 122px;
    width: 122px;
    min-width: 122px;
    min-height: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  .workspace {
    padding-inline: 10px;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .mobile-title-copy strong {
    max-width: 44vw;
  }

  #updateAppBtn {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .panel {
    padding: 14px 12px;
    border-radius: 12px;
    box-shadow: 0 5px 16px rgba(8, 79, 91, 0.055);
  }

  .table-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .detail-toolbar .table-action {
    min-height: 44px;
  }

  .data-table,
  .data-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: block;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
  }

  .video-list-table tbody tr.video-summary-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-list-table tbody tr.video-summary-row td {
    align-content: start;
    min-height: 52px;
    padding: 8px 9px;
    font-size: 0.84rem;
  }

  .video-list-table tbody tr.video-summary-row .actions-cell {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 7px 9px;
  }

  .video-list-table tbody tr.video-summary-row .actions-cell::before {
    display: none;
    content: none;
  }

  .video-list-table tbody tr.video-summary-row .table-action {
    min-height: 38px;
    font-size: 0.84rem;
  }

  .video-list-professional .video-summary-row td:nth-child(2),
  .video-list-professional .video-summary-row td:nth-child(5),
  .video-list-office .video-summary-row td:nth-child(2),
  .video-list-weekly .video-summary-row td:nth-child(3),
  .video-list-weekly .video-summary-row td:nth-child(8) {
    display: none;
  }

  .video-list-table tbody tr.data-table-detail-row {
    display: block;
    grid-column: 1 / -1;
    width: calc(100vw - 44px);
    max-width: none;
    margin: -4px 0 10px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .video-list-table .data-table-detail-row > td,
  .video-list-table .table-detail-panel,
  .video-list-table .detail-note,
  .video-list-table .video-files {
    width: 100%;
    min-width: 0;
  }

  .video-list-table .data-table-detail-row > td {
    display: block;
    width: calc(100vw - 44px);
    max-width: none;
    padding: 0;
    overflow: visible;
  }

  .video-list-table .table-detail-panel {
    display: grid;
    gap: 10px;
    width: calc(100vw - 44px);
    max-width: none;
    padding: 10px 0 0;
  }

  .video-list-table .detail-note {
    display: block;
    width: 100%;
    padding: 10px 11px;
    background: #f8fbfc;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .video-list-table .detail-note strong {
    display: block;
    margin-bottom: 4px;
  }

  .video-list-table .media-set-video .media-mosaic.single {
    width: min(100%, 350px);
    grid-template-columns: minmax(0, 1fr);
    margin-inline: auto;
  }

  .video-list-table .media-set-video .media-mosaic.single .media-item {
    width: 100%;
    min-width: 0;
    border-radius: 8px;
  }

  .video-list-table .media-open-hint,
  .video-list-table .media-save-quick {
    display: none;
  }

  .data-table tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 9px;
    width: 100%;
    padding: 9px 11px;
    border-bottom: 1px solid #edf2f3;
    overflow-wrap: anywhere;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .data-table .actions-cell {
    position: static;
    min-width: 0;
    white-space: normal;
    background: #fff;
    box-shadow: none;
  }

  .data-table .actions-cell .table-action {
    width: 100%;
    min-height: 44px;
  }

  .data-table-detail-row > td {
    display: block;
    padding: 0;
  }

  .data-table-detail-row > td::before {
    display: none;
    content: none;
  }

  .users-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .users-table,
  .users-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .users-table thead {
    display: none;
  }

  .users-table tbody tr {
    position: relative;
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
    padding: 13px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
  }

  .users-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .users-table td::before {
    display: none;
  }

  .users-table td[data-label="Email đăng nhập"] {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .users-table td[data-label="Vai trò"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
  }

  .users-table td[data-label="Trạng thái"] {
    position: absolute;
    top: 13px;
    right: 12px;
  }

  .users-table td[data-label="Thao tác"] {
    padding-top: 8px;
    border-top: 1px solid #edf3f4;
  }

  .table-icon-actions {
    justify-content: space-between;
  }

  .table-icon-actions button {
    width: 42px;
    height: 38px;
    background: #f7fbfc;
    border: 1px solid var(--border);
  }

  .employee-cell {
    padding-right: 108px;
  }

  .employee-avatar {
    width: 40px;
    height: 40px;
  }

  .account-modal {
    align-items: stretch;
    padding: 0;
  }

  .account-modal-box {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  .account-modal-head {
    position: sticky;
    top: 0;
    z-index: 7;
    padding: 14px;
  }

  .account-modal-head h2 {
    font-size: 1.05rem;
  }

  .account-modal-head p {
    font-size: 0.8rem;
  }

  .account-modal .user-form-shell {
    padding: 10px;
  }

  .account-fields {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .subject-catalog-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-modal-footer {
    bottom: -10px;
    grid-column: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-feed-card {
    padding: 12px;
    border-radius: 14px;
  }

  .video-feed-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .video-feed-toggle {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
  }

  .video-feed-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .video-feed-meta {
    display: flex;
    gap: 0;
    overflow-x: auto;
  }

  .video-feed-meta span {
    flex: 0 0 min(42vw, 170px);
    min-height: 48px;
    padding: 6px 8px;
    border-right: 1px solid #dce9eb;
    font-size: 0.78rem;
  }

  .video-feed-media .media-set-video .media-mosaic,
  .video-feed-media .media-set-video .media-mosaic.few,
  .video-feed-media .media-set-video .media-mosaic.many {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 8px;
  }

  .video-feed-media .media-set-video .media-mosaic.single {
    grid-template-columns: minmax(0, min(260px, 72vw));
    justify-content: center;
  }

  .video-feed-media .media-set-video .media-item {
    border-radius: 12px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
    padding-bottom: 9px;
  }

  #draftState {
    text-align: left;
  }

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

  .stat {
    padding: 13px;
  }

  .stat-breakdown {
    display: grid;
  }

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

  .segmented-choice,
  .segmented-choice.three,
  #teachingSubjectChoices,
  #videoSubjectChoices,
  .segmented-choice.class-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .office-period-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .segmented-choice button {
    min-block-size: 40px;
    padding: 7px 6px;
  }

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

  .chips label {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

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

  .permission-presets {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-card {
    padding: 9px;
  }

  .permission-card label {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    min-height: 40px;
    padding: 8px 10px;
  }

  .scope-picker-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .class-block {
    padding: 12px;
  }

  .attendance-fields {
    padding: 10px;
  }

  #logsView .list-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .media-viewer-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
  }

  .media-viewer-top strong {
    max-width: 100%;
  }

  .media-viewer-actions {
    justify-content: flex-end;
  }

  .media-viewer-actions .ghost {
    min-height: 34px;
    padding-inline: 9px;
  }

  .media-viewer-stage {
    padding: 6px 0 max(8px, env(safe-area-inset-bottom));
  }

  .media-viewer-stage img,
  .media-viewer-stage video {
    max-width: 100%;
    max-height: calc(100dvh - 118px);
    border-radius: 0;
  }

  .media-viewer.media-viewer-zoomed .media-viewer-stage img,
  .media-viewer.media-viewer-zoomed .media-viewer-stage video {
    max-height: calc(100dvh - 18px);
    border-radius: 0;
  }

  .media-viewer-nav {
    width: 36px;
    height: 48px;
    font-size: 1.8rem;
  }

  .media-mosaic,
  .media-mosaic.few,
  .media-mosaic.many {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(150px, 48vw, 230px);
  }

  .media-mosaic.single {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }

  .media-mosaic.many .media-item:nth-child(n) {
    grid-column: auto;
    grid-row: auto;
  }

  .media-set-video .media-mosaic .media-item.media-landscape {
    grid-column: 1 / -1;
  }

  .media-set-video .media-mosaic,
  .media-set-video .media-mosaic.few,
  .media-set-video .media-mosaic.many {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    justify-content: stretch;
  }

  .media-set-video .media-mosaic.single {
    grid-template-columns: minmax(0, min(360px, 92vw));
    justify-content: center;
  }

  .detail-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-summary-grid > div.wide {
    grid-column: auto;
  }

  .media-menu-popover {
    right: -2px;
  }

  .actions {
    justify-content: stretch;
  }

  .actions > button {
    flex: 1 1 140px;
  }

  .modal-actions > button {
    flex: 1;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
}

@media (display-mode: standalone) {
  body {
    overscroll-behavior-y: none;
  }
}

@media (display-mode: standalone) and (max-width: 900px) {
  .topbar {
    background: rgba(255, 255, 255, 0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile app layout: compact records, scoped filters, and contained reports. */
.reports-panel,
.reports-stack,
.report-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.report-section {
  overflow: hidden;
}

.report-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

@media (max-width: 560px) {
  #logsView .list-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    overflow: visible;
    scroll-snap-type: none;
  }

  #logsView .list-tabs button {
    width: 100%;
    min-width: 0;
    flex: none;
    padding-inline: 5px;
    font-size: 0.8rem;
  }

  .list-filter-toolbar {
    flex-wrap: wrap;
    overflow: visible;
  }

  .list-query-bar {
    width: 100%;
    flex: 1 0 100%;
  }

  #logsView .list-search {
    width: auto;
    flex: 1 1 auto;
  }

  .filter-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.82rem;
  }

  #clearListFiltersBtn {
    flex: 0 0 auto;
  }

  #logsView:not(.filters-open) .filters {
    display: none;
  }

  #logsView.filters-open .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 0 100%;
    width: 100%;
    padding: 8px;
    overflow: visible;
    background: #f3f8f9;
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  #logsView.filters-open .filters > * {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
  }

  .teaching-list-table tbody tr.log-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teaching-list-table tbody tr.log-row td,
  .video-list-table tbody tr.video-summary-row td {
    display: block;
    min-height: 50px;
    padding: 8px 10px;
    line-height: 1.32;
  }

  .teaching-list-table tbody tr.log-row td::before,
  .video-list-table tbody tr.video-summary-row td::before {
    display: block;
    margin-bottom: 3px;
    line-height: 1.15;
  }

  .teaching-list-table .log-row td:nth-child(3),
  .teaching-list-table .log-row td:nth-child(8),
  .video-list-office .video-summary-row td:nth-child(6) {
    display: none;
  }

  .teaching-list-table .log-row .actions-cell,
  .video-list-table .video-summary-row .actions-cell {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 7px 10px;
  }

  .teaching-list-table .log-row .actions-cell::before,
  .video-list-table .video-summary-row .actions-cell::before {
    display: none;
    content: none;
  }

  .teaching-list-table .log-row .table-action,
  .video-list-table .video-summary-row .table-action {
    width: auto;
    min-width: 108px;
    min-height: 36px;
    padding: 6px 12px;
  }

  .video-list-table tbody tr.data-table-detail-row,
  .video-list-table .data-table-detail-row > td,
  .video-list-table .table-detail-panel {
    width: 100%;
    max-width: 100%;
  }

  .video-list-table tbody tr.data-table-detail-row {
    margin-top: -4px;
  }

  .video-list-table .table-detail-panel {
    padding: 8px 0 0;
    overflow: hidden;
  }

  #teachingSubjectChoices {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }

  #teachingSubjectChoices button {
    flex: 0 0 104px;
    width: 104px;
    scroll-snap-align: start;
  }

  #createView .form-grid,
  #video-trendView .form-grid,
  #professionalView .form-grid {
    gap: 11px;
  }

  #createView input,
  #createView select,
  #video-trendView input,
  #video-trendView select,
  #professionalView input,
  #professionalView select {
    min-block-size: 42px;
    padding: 9px 11px;
  }

  .reports-panel {
    padding: 12px 10px;
    overflow: hidden;
  }

  .report-cutoff-note {
    max-width: 100%;
    padding: 8px 9px;
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .report-section h3 {
    text-align: left;
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .report-section-meta {
    justify-content: flex-start;
    gap: 5px;
    font-size: 0.75rem;
  }

  .report-section-meta span {
    padding: 4px 7px;
  }

  .report-table-wrap {
    display: block;
    overflow-x: auto;
  }

  .report-table {
    width: max-content;
    min-width: 640px;
    font-size: 0.78rem;
  }

  .report-table th,
  .report-table td {
    min-width: 56px;
    padding: 6px;
  }

  .report-table tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 112px;
  }

  .report-table thead tr > :first-child {
    z-index: 3;
  }

  .report-cell span {
    width: 20px;
    height: 20px;
  }
}
