/* Error banner */
.error-banner {
  background-color: var(--pico-del-color);
  color: white;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Navigation */
header nav {
  align-items: center;
}
header nav ul {
  align-items: center;
}
.nav-logo {
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* Pipeline trace visualization */
.pipeline {
  position: relative;
  padding-left: 1rem;
}
.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  padding-bottom: 0.5rem;
}
.pipeline-step > .pipeline-indicator,
.pipeline-step > .pipeline-content > details > summary {
  line-height: 1.8rem;
}
.pipeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 2rem;
  bottom: 0;
  width: 2px;
  background: var(--pico-muted-border-color);
}
.pipeline-indicator {
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
  color: white;
  z-index: 1;
}
.pipeline-ok {
  background: var(--pico-ins-color);
}
.pipeline-error {
  background: var(--pico-del-color);
}
.pipeline-content {
  flex: 1;
  min-width: 0;
}
.pipeline-content details {
  margin-bottom: 0;
}
.pipeline-content > details > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
}
/* Detail list (scalar + JSON items) */
.detail-list {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
.detail-item {
  padding: 0.2rem 0;
}
.detail-scalar {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.detail-scalar code,
.detail-block summary code {
  flex-shrink: 0;
  min-width: 10rem;
  display: inline-block;
}
.detail-scalar span {
  word-break: break-all;
}
.detail-item details {
  margin-bottom: 0;
}
.detail-item details summary {
  padding: 0;
  font-size: 0.875rem;
}
.detail-item pre {
  margin: 0.25rem 0 0.5rem 0;
  padding: 0.5rem;
  font-size: 0.8rem;
  max-height: 20rem;
  overflow: auto;
}

/* Clickable table rows */
.clickable-table tbody tr[data-href] {
  cursor: pointer;
}
.clickable-table tbody tr[data-href]:hover {
  background: var(--pico-secondary-focus);
}

/* Nested detail blocks (request/response) — make them look clickable */
.detail-block summary {
  cursor: pointer;
  border-radius: 0.25rem;
  padding: 0.2rem 0.4rem;
}
.detail-block:not([open]) summary code::after {
  content: ' (click to expand)';
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--pico-muted-color);
}
.detail-block summary:hover {
  background: var(--pico-secondary-focus);
}

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
}

/* Enrollment detail page */
.step-elapsed {
  margin-left: auto;
  color: var(--pico-muted-color);
}
.section-summary {
  font-weight: normal;
  color: var(--pico-muted-color);
}
.section-description {
  margin-top: -0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}
.section-ok {
  color: var(--pico-ins-color);
}
.section-error {
  color: var(--pico-del-color);
}
.error-text {
  color: var(--pico-del-color);
}
.step-description {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

/* Enrollment detail metadata grid */
.enrollment-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.meta-item strong {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.meta-item span {
  word-break: break-all;
}

/* Token status */
.token-valid {
  color: var(--pico-ins-color);
}
.token-expired {
  color: var(--pico-del-color);
  font-weight: bold;
}

/* Grade transmission page */
.grade-editor {
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: var(--pico-border-radius);
}
.grade-editor .pce-wrapper {
  min-height: 10rem;
  font-size: 0.875rem;
}
#grade-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#grade-form > [hidden] {
  display: none;
}
.json-error,
.json-warning {
  color: #b45309;
  font-size: 0.875rem;
}
.grade-hint {
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}
.grade-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.grade-page > * {
  margin-top: 0;
  margin-bottom: 0;
}
.grade-notice {
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.grade-notice-error {
  border-left: 4px solid var(--pico-del-color);
  background: #fef2f2;
  color: #991b1b;
}
.grade-notice-warning {
  border-left: 4px solid #b45309;
  background: #fef3c7;
  color: #92400e;
}
.grade-history-entry {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.grade-history-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.grade-history-header time {
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}
.grade-history-header .load-input-btn {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  margin-bottom: 0;
}
.status-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: bold;
  color: white;
}
.status-ok {
  background: var(--pico-ins-color);
}
.status-error {
  background: var(--pico-del-color);
}

/* Success banner */
.success-banner {
  background-color: var(--pico-ins-color);
  color: white;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Success notice (inline, like grade-notice) */
.grade-notice-success {
  border-left: 4px solid var(--pico-ins-color);
  background: #f0fdf4;
  color: #166534;
}

/* Tabs (CSS-only via :target — survives navigation through URL hash) */
.tab-labels {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin-bottom: 1.5rem;
}
.tab-labels a {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  color: var(--pico-muted-color);
  font-weight: 500;
  text-decoration: none;
}
.tab-labels a:hover {
  color: var(--pico-color);
}
.tab-panel {
  display: none;
  scroll-margin-top: 1rem;
}
/* Active panel: whichever is :target, or host by default */
#panel-host:target,
#panel-home:target {
  display: block;
}
.tabs:not(:has(:target)) #panel-host {
  display: block;
}
/* Active tab label */
.tabs:has(#panel-host:target) .tab-labels a[href="#panel-host"],
.tabs:has(#panel-home:target) .tab-labels a[href="#panel-home"],
.tabs:not(:has(:target)) .tab-labels a[href="#panel-host"] {
  color: var(--pico-color);
  border-color: var(--pico-muted-border-color);
  background: var(--pico-background-color);
}

/* Home config section */
.home-config {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}
.home-config-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0;
}
.home-config-item strong {
  font-size: 0.85rem;
}
.home-config-item small {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}
.config-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.config-controls select {
  margin-bottom: 0;
  width: auto;
  min-width: 0;
}
.config-controls button,
.config-controls a[role="button"] {
  margin-bottom: 0;
  white-space: nowrap;
  width: auto;
  padding-inline: 1rem;
}

/* Person data editor form */
#person-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#person-form > [hidden] {
  display: none;
}
.person-actions {
  display: flex;
  gap: 0.75rem;
}
.person-actions button {
  margin-bottom: 0;
}

/* Delete cell in table rows */
.delete-cell {
  width: 1px;
  white-space: nowrap;
}

/* Detail page header with back link + delete */
.detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.detail-header .back-link,
.detail-header h3 {
  margin-bottom: 0;
}
.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}
.delete-link {
  background: none;
  border: none;
  color: var(--pico-del-color);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
  text-decoration: underline;
}
.delete-link:hover {
  opacity: 0.7;
}
