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

body.panel-workspace-open {
  overflow: hidden;
}

.panel-workspace {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.panel-workspace[hidden] {
  display: none;
}

.panel-workspace-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.48);
  cursor: default;
}

.panel-layer-stage {
  position: absolute;
  inset: 0 0 0 220px;
  overflow: hidden;
  pointer-events: none;
}

.panel-layer {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  padding: 18px;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.panel-layer.is-background {
  transform: translateX(var(--layer-offset, -24px)) scale(var(--layer-scale, 0.982));
  opacity: var(--layer-opacity, 0.48);
  filter: saturate(0.72);
}

.panel-layer.is-active {
  pointer-events: auto;
}

.panel-layer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 6px 2px;
  overflow: hidden;
}

.panel-surface {
  position: relative;
  display: flex;
  flex: 0 1 760px;
  width: min(760px, calc(100vw - 36px));
  min-width: 0;
  max-width: min(760px, calc(100vw - 36px));
  height: auto;
  max-height: calc(100vh - 36px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  animation: panel-enter 180ms ease-out;
}

.panel-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #dbe3ec;
  background: #fff;
}

.panel-title-group {
  min-width: 0;
  margin-right: auto;
}

.panel-header-title {
  margin: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-kind-label {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.panel-close:hover {
  background: #f1f5f9;
}

.panel-header-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.panel-header-controls:empty {
  display: none;
}

.panel-header-meta {
  display: block;
  min-width: 0;
  color: #475569;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.panel-header-controls .panel-header-action {
  display: inline-flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.panel-header-controls .panel-header-action.action-button {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.panel-header-controls .panel-header-action.danger-button {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.panel-header-controls .panel-header-action:hover {
  filter: brightness(0.97);
}

.panel-body {
  flex: 1;
  min-height: 0;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}

.panel-body .page-header h1 {
  font-size: 22px;
}

.panel-body > .page-header:first-child {
  display: none;
}

.panel-body .toolbar.is-empty,
.panel-body .form-actions.is-empty {
  display: none;
}

.panel-body .form-card,
.panel-body .detail-card,
.panel-body .table-card,
.panel-body .table-wrapper {
  max-width: none;
}

.panel-body .detail-value a.detail-link-card {
  display: flex;
  width: 100%;
  max-width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1e3a8a;
  font-weight: 600;
  text-decoration: none;
  transition: color 120ms ease;
}

.panel-layer[data-layer-kind="exploration"] .panel-body {
  padding: 18px;
}

.panel-layer[data-layer-kind="exploration"] .detail-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 0;
  background: transparent;
  overflow: visible;
}

.panel-layer[data-layer-kind="exploration"] .detail-row {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.panel-layer[data-layer-kind="exploration"] .detail-row:has(a.detail-link-card) {
  position: relative;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.panel-layer[data-layer-kind="exploration"] .detail-row:has(a.detail-link-card):hover {
  border-color: #93b4ec;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.panel-layer[data-layer-kind="exploration"] .detail-row:has(a.detail-link-card:focus-visible) {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.panel-layer[data-layer-kind="exploration"] .detail-row:has(a.detail-link-card[aria-expanded="true"]) {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb, 0 5px 14px rgba(37, 99, 235, 0.14);
  transform: translateY(1px);
}

.panel-layer[data-layer-kind="exploration"] .detail-row:last-child {
  border-bottom: 1px solid #dbe3ec;
}

.panel-layer[data-layer-kind="exploration"] .detail-row.detail-row-wide {
  grid-column: 1 / -1;
}

.panel-layer[data-layer-kind="exploration"] .panel-detail-pair {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.panel-layer[data-layer-kind="exploration"] .panel-detail-pair .detail-row {
  border: 0;
  border-radius: 0;
}

.panel-layer[data-layer-kind="exploration"] .panel-detail-pair .detail-row + .detail-row {
  border-left: 1px solid #dbe3ec;
}

.panel-layer[data-layer-kind="exploration"] .detail-label,
.panel-layer[data-layer-kind="exploration"] .detail-value {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.panel-layer[data-layer-kind="exploration"] .detail-label {
  padding: 10px 12px 4px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-layer[data-layer-kind="exploration"] .detail-value {
  flex: 1;
  padding: 4px 12px 12px;
  background: #fff;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.4;
}

.panel-layer[data-layer-kind="exploration"] .detail-value a.detail-link-card {
  width: 100%;
}

.panel-body .detail-value a.detail-link-card::after {
  flex: 0 0 auto;
  color: #64748b;
  content: "›";
  font-size: 19px;
  line-height: 1;
}

.panel-body .detail-value a.detail-link-card::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
}

.panel-body .detail-value a.detail-link-card:hover {
  color: #2563eb;
}

.panel-loading,
.panel-load-error {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  color: #64748b;
  text-align: center;
}

.panel-loading::before {
  width: 28px;
  height: 28px;
  border: 3px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  content: "";
  animation: panel-spin 700ms linear infinite;
}

.panel-layer[data-layer-kind="action"] .panel-surface {
  flex-basis: 820px;
  width: min(820px, calc(100vw - 36px));
  max-width: min(820px, calc(100vw - 36px));
  border-color: #93a4b8;
}

.panel-layer[data-layer-kind="action"] .form-card {
  padding: 18px;
}

.panel-layer[data-layer-kind="action"] .form-card > form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .form-row {
  min-width: 0;
  margin: 0;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .class-log-temporal-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) minmax(150px, 0.8fr) 112px;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .form-row.form-row-toggle {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 13px;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  background: #f8fafc;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .assignment-schedule-option {
  grid-column: 1 / -1;
  min-height: 92px;
  padding: 16px 18px;
}

.assignment-schedule-option > div > label {
  font-size: 18px;
}

.panel-layer[data-layer-kind="action"] .form-row-toggle label {
  margin: 0;
}

.panel-layer[data-layer-kind="action"] .form-row-toggle input[type="checkbox"] {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  appearance: none;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.panel-layer[data-layer-kind="action"] .form-row-toggle input[type="checkbox"]::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  content: "";
  transition: transform 140ms ease;
}

.panel-layer[data-layer-kind="action"] .form-row-toggle input[type="checkbox"]:checked {
  border-color: #2563eb;
  background: #2563eb;
}

.panel-layer[data-layer-kind="action"] .form-row-toggle input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.panel-layer[data-layer-kind="action"] .form-row-toggle input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.panel-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.panel-status-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.panel-status-badge.is-positive {
  background: #ecfdf5;
  color: #047857;
}

.panel-status-badge.is-muted {
  background: #f1f5f9;
  color: #64748b;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .form-errors,
.panel-layer[data-layer-kind="action"] .form-card > form > .form-actions,
.panel-layer[data-layer-kind="action"] .form-card > form > .form-row:has(textarea),
.panel-layer[data-layer-kind="action"] .form-card > form > .form-row:has([name="assignment"]) {
  grid-column: 1 / -1;
}

.panel-layer[data-layer-kind="action"] .form-card > form > .form-actions {
  margin-top: 4px;
}

.panel-layer[data-layer-kind="confirmation"] .panel-surface {
  flex-basis: min(520px, 92vw);
  height: auto;
  max-height: min(640px, calc(100vh - 72px));
  margin: 0;
}

.panel-toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  display: grid;
  width: min(420px, calc(100vw - 40px));
  gap: 8px;
  pointer-events: none;
}

.panel-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.2);
  color: #1e3a8a;
  font-size: 15px;
  font-weight: 700;
}

.panel-toast.is-success {
  border-color: #6ee7b7;
  background: #ecfdf5;
  color: #065f46;
}

.panel-toast.is-success::before {
  content: "✓";
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #059669;
  color: #ffffff;
  font-size: 17px;
  line-height: 1;
}

.panel-toast.is-error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.main.is-async-loading {
  opacity: 0.58;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.data-view-row {
  cursor: pointer;
}

.data-view-row td {
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.data-view-row:hover td,
.data-view-row:focus-within td {
  background-color: #eff6ff;
}

.data-view-row:hover td:first-child,
.data-view-row:focus-within td:first-child {
  box-shadow: inset 3px 0 #2563eb;
}

.row-primary-link {
  color: #0f172a;
  font-weight: 650;
  text-decoration: none;
}

.row-primary-link:hover,
.row-primary-link:focus-visible {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes panel-enter {
  from { transform: translateX(22px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

@media (max-width: 980px) {
  .panel-layer-stage { left: 0; }
  .panel-layer { padding: 10px; }
}

@media (max-width: 680px) {
  .panel-layer[data-layer-kind="exploration"] .detail-card,
  .panel-layer[data-layer-kind="action"] .form-card > form {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-layer[data-layer-kind="exploration"] .detail-row.detail-row-wide,
  .panel-layer[data-layer-kind="action"] .form-card > form > .form-row {
    grid-column: 1;
  }

  .panel-layer[data-layer-kind="action"] .form-card > form > .class-log-temporal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .panel-layer[data-layer-kind="action"] .class-log-date-control {
    grid-column: 1 / -1;
  }

  .panel-header-controls .panel-header-action {
    padding-inline: 8px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .panel-layer[data-layer-kind="exploration"] .panel-detail-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-layer[data-layer-kind="exploration"] .panel-detail-pair .detail-row + .detail-row {
    border-top: 1px solid #dbe3ec;
    border-left: 0;
  }
}

@media (max-width: 720px) {
  .panel-layer-row { justify-content: flex-start; }

  .panel-layer-row .panel-surface {
    flex-basis: min(86vw, 400px);
  }
}

@media (max-width: 560px) {
  .panel-layer { padding: 8px; }

  .panel-surface,
  .panel-layer[data-layer-kind] .panel-surface {
    max-height: calc(100vh - 16px);
    border-radius: 12px;
  }

  .panel-body { padding: 16px 14px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel-surface,
  .panel-layer,
  .panel-workspace-backdrop {
    animation: none;
    transition: none;
  }
}
