body {
  background: var(--workspace-bg);
}

body.admin-locked > :not(.admin-access-page) {
  visibility: hidden;
}

.admin-access-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fbfcfc;
}

.admin-page-access-card {
  width: min(360px, 100%);
  border: 1px solid var(--workspace-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(23, 32, 38, 0.14);
}

html[data-theme="dark"] .admin-page-access-card {
  border-color: rgba(91, 107, 116, 0.5);
  background: rgba(18, 28, 34, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.admin-topline {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  background: var(--workspace-bg);
}

.admin-topline h1 {
  font-size: 22px;
  line-height: 1.04;
  font-weight: 760;
}

.admin-back-link {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.08);
  color: #6f7a83;
  text-decoration: none;
}

.admin-back-link::before {
  content: "";
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 340px;
  gap: 10px;
  padding: 0 14px 16px;
}

.admin-shell .sidebar,
.admin-shell .fixlist {
  display: grid;
  align-content: start;
  gap: 10px;
}

.admin-shell .panel,
.admin-shell .fixlist,
.admin-shell .workspace {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.admin-shell .panel,
.admin-shell .fixlist {
  padding: 0;
}

.admin-section-title,
.fixlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 0 8px;
  border-bottom: 1px solid #eef1f3;
}

.admin-section-title h2,
.fixlist-head h2 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.12;
  font-weight: 720;
}

.admin-section-title .ghost,
.admin-actions .ghost {
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: #f4f7f8;
  color: #53606a;
  font-size: 12px;
  font-weight: 750;
}

.admin-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.danger {
  color: var(--red) !important;
}

.sample-grid {
  margin: 8px 0 6px;
}

.admin-shell .upload-zone {
  display: inline-flex;
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #e5ebee;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #65707a;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.05);
}

.admin-shell .upload-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--teal);
  font-size: 18px;
  line-height: 1;
}

#adminPhotoInput {
  display: none;
}

.admin-canvas-frame {
  position: relative;
  min-height: calc(100vh - 132px);
  padding: 8px 0;
}

#trainingCanvas {
  cursor: crosshair;
}

.floating-issue-select {
  position: absolute;
  display: none;
  width: 150px;
  max-width: min(150px, calc(100% - 24px));
  min-height: 32px;
  padding: 0 26px 0 8px;
  border: 2px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(23, 32, 38, 0.16);
  z-index: 2;
}

.floating-issue-select[data-level="medium"] {
  border-color: var(--amber);
  color: var(--amber);
}

.floating-issue-select[data-level="low"] {
  border-color: var(--teal);
  color: var(--teal);
}

.admin-shell .field {
  display: grid;
  gap: 4px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.admin-shell select,
.admin-shell textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  resize: vertical;
}

.admin-shell textarea {
  line-height: 1.35;
}

.quick-tags {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 10px;
  overflow: hidden;
  background: transparent;
}

.quick-tag {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid #eceef0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.quick-tag.active {
  background: #f0f7f6;
  box-shadow: inset 3px 0 0 var(--teal);
}

.admin-shell .primary {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

#trainingList {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.training-card {
  padding: 10px 10px 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  background: transparent;
}

.training-card[data-level="critical"] {
  box-shadow: inset 3px 0 0 var(--red);
}

.training-card[data-level="warning"],
.training-card[data-level="medium"] {
  box-shadow: inset 3px 0 0 var(--amber);
}

.training-card[data-level="low"] {
  box-shadow: inset 3px 0 0 var(--teal);
}

.training-card strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.18;
}

.training-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.training-card p + p {
  margin-top: 3px;
}

.empty-state {
  padding: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-bottom-nav {
  display: none;
}

html[data-theme="dark"] .admin-topline,
html[data-theme="dark"] .admin-shell {
  background: var(--workspace-bg);
}

html[data-theme="dark"] .admin-section-title,
html[data-theme="dark"] .fixlist-head,
html[data-theme="dark"] .training-card,
html[data-theme="dark"] .admin-shell select,
html[data-theme="dark"] .admin-shell textarea,
html[data-theme="dark"] .quick-tag {
  border-color: var(--workspace-line);
}

html[data-theme="dark"] .admin-back-link,
html[data-theme="dark"] .admin-section-title .ghost,
html[data-theme="dark"] .admin-actions .ghost,
html[data-theme="dark"] .admin-shell .upload-zone {
  background: rgba(23, 33, 38, 0.92);
  color: #aab5bd;
}

@media (max-width: 1120px) {
  .admin-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .admin-shell .fixlist {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .admin-topline {
    padding: 8px 12px 6px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    padding: 0 12px 18px;
  }

  .admin-shell .sidebar {
    display: contents;
  }

  .training-photo-panel {
    order: 1;
  }

  .admin-shell .workspace {
    order: 2;
  }

  .issue-note-panel {
    order: 3;
  }

  .store-notes-panel {
    order: 4;
  }

  .admin-shell .fixlist {
    order: 5;
  }

  .admin-canvas-frame {
    min-height: 0;
    padding: 4px 0;
    place-items: start center;
  }

  .admin-canvas-frame canvas {
    max-height: none;
  }
}
