:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #eef1f9;
  --text: #1f2933;
  --text-muted: #5f6c7b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --border: #d0d7e3;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --workspace-max-width: 1760px;
  --workspace-padding-inline: 1.5rem;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

/* Ensure HTML hidden attribute works regardless of later display rules */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Base safe-area padding so content never sits under the home indicator */
body {
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--workspace-padding-inline);
}

.container--wide {
  max-width: 1480px;
}

.container--mocl-wide,
.container--workspace-wide {
  max-width: var(--workspace-max-width);
}

.container--shell-wide {
  width: 100%;
  max-width: var(--workspace-max-width);
  min-width: 0;
}

.flex {
  display: flex;
}

.between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.site-header {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(208, 215, 227, 0.5);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.site-header .container {
  padding: 1rem var(--workspace-padding-inline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.app-version {
  margin-left: 0.5rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.8;
}

.nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.35rem 0.4rem;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.nav-toggle {
  display: none;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  color: var(--text);
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.nav-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.nav.is-nav-open .nav-toggle {
  background: var(--primary);
  color: #fff;
}

.nav-toggle-icon {
  width: 18px;
  height: 18px;
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after,
.nav-toggle-icon span {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: currentColor;
  left: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-icon::before {
  top: 0;
}

.nav-toggle-icon::after {
  bottom: 0;
}

.nav-toggle-icon span {
  top: 50%;
  transform: translateY(-50%);
}

.nav.is-nav-open .nav-toggle-icon::before {
  transform: translateY(8px) rotate(45deg);
}

.nav.is-nav-open .nav-toggle-icon::after {
  transform: translateY(-8px) rotate(-45deg);
}

.nav.is-nav-open .nav-toggle-icon span {
  opacity: 0;
}

.nav-toggle-label {
  font-size: 0.9rem;
}

.nav-links {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.nav .button {
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.nav-dropdown-trigger {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-right: 1.35rem;
}

.nav-dropdown-trigger::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -0.1rem;
}

.nav-dropdown.is-open .nav-dropdown-trigger::after {
  transform: rotate(-135deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.15);
  padding: 0.5rem;
  display: none;
  z-index: 40;
}

.nav-dropdown.is-open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-dropdown.is-open > .nav-dropdown-trigger {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.nav-dropdown-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-dropdown-link:hover,
.nav-dropdown-link:focus {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  outline: none;
}

.nav-dropdown-link.is-active {
  background: rgba(37, 99, 235, 0.18);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -0.4rem;
  right: 1.35rem;
  width: 0.8rem;
  height: 0.8rem;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: -3px -3px 12px rgba(15, 23, 42, 0.04);
}

.nav .button.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
  box-shadow: none;
}

.nav .button.ghost:hover {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.inline-form {
  display: inline;
  margin: 0;
}

.nav .inline-form .button {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  box-shadow: none;
  transition: all 0.2s ease;
}

.nav .inline-form .button:hover {
  background: var(--primary);
  color: #fff;
}

main.container {
  padding: 2.5rem 1.5rem 4rem;
  flex: 1 0 auto;
}

main.container--mocl-wide,
main.container--workspace-wide {
  width: 100%;
  max-width: var(--workspace-max-width);
  min-width: 0;
}

.site-footer {
  margin-top: auto;
  padding: 1.5rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.muted {
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.card.music-source-highlights {
  margin-bottom: 0.5rem;
}

.card.danger {
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.card-header-flex .card-title + .text-small {
  margin: -0.25rem 0 0;
}

.card-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
}

.page-header {
  margin-bottom: 2rem;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 1.5rem;
  padding: 1.75rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-hero__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.dashboard-hero__copy h1 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.05;
}

.dashboard-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.dashboard-fact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.dashboard-fact__label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard-fact__value {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

@media (max-width: 980px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-hero__copy h1 {
    font-size: 2.25rem;
  }
}

@media (max-width: 640px) {
  .dashboard-hero {
    padding: 1.25rem;
  }

  .dashboard-facts {
    grid-template-columns: 1fr;
  }
}

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  background: var(--surface-muted);
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.button:hover {
  background: #d9def0;
  text-decoration: none;
}

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

.button.primary:hover {
  background: var(--primary-dark);
}

.button.success {
  background: var(--success);
  color: #fff;
}

.button.success:hover {
  background: #15803d; /* darker green */
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.button.danger.ghost {
  background: transparent;
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.4);
}

.button.small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.button:disabled,
.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.button.ghost:disabled,
.button.ghost[disabled],
.button.ghost[aria-disabled="true"] {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

/* Visual hint for disabled generate button when highlights exist */
.button[data-generate-highlight].has-highlights {
  opacity: 1;
  cursor: default;
  pointer-events: auto;
  position: relative;
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--success);
}

.button[data-generate-highlight].has-highlights::before {
  content: '✓';
  margin-right: 0.35rem;
}

.button[data-generate-highlight].has-highlights:hover {
  background: rgba(22, 163, 74, 0.15);
}

.button.full {
  width: 100%;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.annotation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.annotation-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 2rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 1080px) {
  .annotation-grid {
    grid-template-columns: minmax(0, 1040px);
    justify-content: center;
  }
}

/* Match the annotation content width to the item grid on wide screens */
.annotation-content {
  margin: 0 auto;
}
@media (min-width: 960px) {
  .annotation-content {
    max-width: 880px;
  }
}

/* Ensure the Firebase search input expands to full card width */
.annotation-search input[type="search"] {
  width: 100%;
}

/* Suggestions table row states */
.audio-table .audio-suggestion-row.is-unannotated td {
  background: rgba(22, 163, 74, 0.08);
}
.audio-table .audio-suggestion-row.is-annotated td {
  background: var(--surface-muted);
}

/* Badges */
.badge.success {
  background: rgba(22, 163, 74, 0.15);
  color: #166534;
}
.badge.muted {
  background: rgba(95, 108, 123, 0.15);
  color: var(--text);
}
.badge.neutral {
  background: rgba(95, 108, 123, 0.12);
  color: var(--text-muted);
}

/* Suggestions collapsible */
.annotation-suggestions {
  position: relative;
}
.annotation-suggestions-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  cursor: pointer;
  user-select: none;
}
.annotation-suggestions-summary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.annotation-suggestions.is-open .annotation-suggestions-summary {
  background: rgba(37, 99, 235, 0.08);
}
.annotation-suggestions-summary-row {
  display: contents;
}
.annotation-summary-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.annotation-click-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.annotation-caret {
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.annotation-suggestions.is-open .annotation-caret {
  transform: rotate(-135deg);
}
.annotation-suggestions-body {
  margin-top: 1rem;
}

/* Validation panel */
.annotation-validation {
  margin: 0 0 1rem;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}
.annotation-validation.is-valid {
  background: rgba(22, 163, 74, 0.08);
}
.annotation-validation.is-invalid {
  background: rgba(220, 38, 38, 0.08);
}
.annotation-validation-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.annotation-validation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--text-muted);
}
.annotation-validation.is-valid .annotation-validation-badge {
  background: var(--success);
}
.annotation-validation.is-invalid .annotation-validation-badge {
  background: var(--danger);
}
.annotation-validation-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.annotation-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.annotation-chip--info {
  background: var(--primary);
  color: #fff;
}
.annotation-validation-summary {
  color: var(--text-muted);
}
.annotation-validation-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}
.annotation-validation-list li {
  margin: 0.15rem 0;
}

/* Audio matches toggle */
.annotation-audio-matches {
  margin-top: 0.25rem;
}
.annotation-audio-matches > summary {
  cursor: pointer;
  color: var(--primary);
}
.annotation-audio-list {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
}
.annotation-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: var(--surface-muted);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.annotation-chip--muted {
  background: var(--surface-muted);
  color: var(--text);
}

/* Highlights & explore section */
.annotation-explore {
  margin: 0.5rem 0 0.5rem;
  display: grid;
  gap: 0.5rem;
}
.annotation-highlights {
  margin: 0.5rem 0 1rem;
}
.annotation-highlights > summary,
.annotation-audio-matches > summary,
.annotation-suggestions > summary {
  cursor: pointer;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.annotation-highlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.annotation-highlight-item {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.annotation-highlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.annotation-highlight-desc {
  margin-bottom: 0.4rem;
}
.annotation-highlight-audio audio {
  width: 100%;
}

.highlight-register {
  margin-top: 1.25rem;
}

.highlight-register .list-items {
  margin-top: 1.25rem;
}

.music-source-highlights [data-highlight-empty] {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}

.music-source-highlights + section[data-highlight-sync-section] {
  margin-top: 0;
}

.movement-accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.movement-accordion__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.movement-accordion__header-left {
  display: grid;
  gap: 0.2rem;
}

.movement-accordion__meta {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.movement-accordion__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.movement-accordion__label {
  margin: 0;
  font-weight: 600;
}

.movement-accordion__sub {
  margin: 0;
  color: var(--text-muted);
}

.movement-accordion__sub.is-missing {
  color: #c0392b;
}

.movement-accordion__body {
  display: grid;
  gap: 0.6rem;
}

.movement-highlights {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.movement-highlights__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.movement-highlights__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.movement-highlights__list {
  display: grid;
  gap: 0.75rem;
}

.movement-message {
  margin: 0.25rem 0;
}

.movement-actions {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

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

.highlight-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f9fafb;
  overflow-wrap: anywhere;
}

.highlight-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.highlight-card__time {
  margin: 0.15rem 0 0;
  font-weight: 600;
}

.highlight-card__actions {
  display: flex;
  gap: 0.35rem;
}

.highlight-card__body {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.35rem;
}

.highlight-card__body audio {
  width: 100%;
  margin-bottom: 0.1rem;
}

.highlight-card__form {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

section[data-highlight-sync-section] {
  margin-top: 0.1rem;
  margin-bottom: 1.25rem;
}

.highlight-sync-status .alert {
  margin: 0.25rem 0;
}

.highlight-sync-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.highlight-sync-header .icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  align-self: flex-start;
}
/* Inline spinner hook retained for future use */
.spinner--inline {
  display: inline-block;
  margin-left: 0;
  width: 1em;
  height: 1em;
}

/* Divider between explore tools and raw fields */
.annotation-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0 1rem;
}

/* Annotation section headers */
.annotation-section-header,
.annotation-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  margin: 0 0 1rem;
}

/* Canonical: annotation section title; variants must be scoped under their container */
.annotation-section-title {
  margin: 0;
  font-size: 1.1rem;
}
/* Lists of dynamic items */
.list-repeater .list-items {
  display: grid;
  gap: 0.75rem;
}

.list-repeater .list-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.list-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.list-card--muted {
  background: var(--surface-muted);
}

/* Grid modifiers */
.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid--2 {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

/* Wider buttons helper */
.button.wide {
  min-width: 240px;
}

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

.form-grid--stack {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Field blocks for visual division */
.field-block {
  background: var(--surface-muted);
  border: 1px solid rgba(208, 215, 227, 0.7);
  border-radius: 12px;
  padding: 1rem;
}

.deploy-page-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.deploy-page-header h1 {
  margin: 0 0 0.5rem;
}

.deploy-page-header p {
  margin: 0;
}

.deploy-env-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.deploy-env-card {
  flex: 1;
  min-width: 280px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.deploy-env-card.is-warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.deploy-env-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.deploy-env-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.deploy-env-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--text-muted);
  color: #fff;
}

.deploy-env-badge.is-target {
  background: var(--primary);
}

.deploy-env-body {
  padding: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.deploy-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.deploy-info-label {
  color: var(--text-muted);
}

.deploy-info-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.deploy-status-row {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 500;
}

.deploy-status-row.is-warning {
  color: #b45309;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.is-ready {
  background: var(--success);
}

.status-dot.is-warning {
  background: #f59e0b;
}

.deploy-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.5;
}

.info-box {
  display: flex;
  gap: 1rem;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 1rem;
  border-radius: 8px;
  color: #1e3a8a;
}

.info-box-icon {
  font-size: 1.5rem;
}

.info-box-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.info-box-content li {
  margin-bottom: 0.25rem;
}

.deploy-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.deploy-scope-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.deploy-scope-panel--success {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f0fdf4;
}

.deploy-scope-panel--check {
  border-color: rgba(37, 99, 235, 0.25);
  background: #eff6ff;
}

.deploy-scope-panel--muted {
  background: var(--surface-muted);
}

.deploy-scope-panel h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--text);
}

.deploy-scope-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.deploy-scope-panel li + li {
  margin-top: 0.45rem;
}

.deploy-artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.deploy-artifact-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.deploy-artifact-card--current {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f8fefb;
}

.deploy-artifact-card--stale,
.deploy-artifact-card--missing {
  border-color: rgba(217, 119, 6, 0.28);
  background: #fff7ed;
}

.deploy-artifact-card--error {
  border-color: rgba(220, 38, 38, 0.3);
  background: #fef2f2;
}

.deploy-artifact-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.deploy-artifact-card__header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.deploy-operation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.deploy-operation-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.deploy-operation-card--copy {
  border-color: rgba(220, 38, 38, 0.25);
}

.deploy-operation-step {
  width: 2rem;
  height: 1.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.deploy-operation-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.deploy-operation-card p {
  margin: 0;
  min-height: 3.3rem;
}

.deploy-operation-card .button.wide {
  width: 100%;
  min-width: 0;
  margin-top: auto;
}

.deploy-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.deploy-actions .button.wide {
  min-width: 200px;
}

.button .icon {
  margin-right: 0.5rem;
}

.deploy-inline-panel {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.deploy-inline-panel + .deploy-inline-panel {
  margin-top: -1rem;
}

.deploy-progress-wrapper {
  margin: 1.5rem 0;
}

.deploy-phase-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.deploy-step-display {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.deploy-phase-index {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.deploy-phase-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.deploy-phase-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.deploy-count.is-indeterminate {
  color: var(--primary-dark);
}

.deploy-progress-separator[hidden] {
  display: none;
}

.progress-bar-track {
  height: 12px;
  background: var(--surface-muted);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

.deploy-progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.deploy-progress-item {
  display: grid;
  gap: 0.45rem;
}

.deploy-progress-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.deploy-progress-item__header strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-bar-fill--overall {
  background: #16a34a;
}

.progress-bar-fill.is-indeterminate {
  width: 40%;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.18), var(--primary), rgba(37, 99, 235, 0.18));
  background-size: 200% 100%;
  animation: deploy-indeterminate 1.2s linear infinite;
}

@keyframes deploy-indeterminate {
  0% {
    transform: translateX(-120%);
    background-position: 0% 0;
  }
  100% {
    transform: translateX(240%);
    background-position: 100% 0;
  }
}

.deploy-log-container {
  background: #1e293b;
  border-radius: 8px;
  overflow: hidden;
}

.deploy-log-toolbar {
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.75rem 0.6rem 1rem;
}

.deploy-log-container h3 {
  color: #e2e8f0;
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.deploy-log-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.deploy-log-filters {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.15rem;
  border: 1px solid rgba(226, 232, 240, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.4);
}

.deploy-log-filter,
.deploy-log-copy {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.42rem 0.55rem;
}

.deploy-log-filter.is-active,
.deploy-log-copy {
  background: rgba(226, 232, 240, 0.12);
  color: #f8fafc;
}

.deploy-log-copy:hover,
.deploy-log-filter:hover {
  border-color: rgba(226, 232, 240, 0.22);
}

.deploy-log-empty {
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 1rem;
}

.deploy-log {
  background: transparent;
  color: #94a3b8;
  padding: 1rem;
  margin: 0;
  max-height: 380px;
  min-height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.deploy-log-entry {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.deploy-log-entry--grouped {
  border-style: dashed;
}

.deploy-log-entry--warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}

.deploy-log-entry--error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
}

.deploy-log-entry__meta {
  color: #cbd5e1;
  font-weight: 600;
}

.deploy-log-entry__level {
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

.deploy-log-entry--warning .deploy-log-entry__level {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}

.deploy-log-entry--error .deploy-log-entry__level {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.deploy-log-entry__message,
.deploy-log-entry__fields,
.deploy-log-entry__group-count {
  grid-column: 1 / -1;
  line-height: 1.45;
  word-break: break-word;
}

.deploy-log-entry__fields {
  color: #cbd5e1;
  opacity: 0.9;
}

.deploy-log-entry__group-count {
  color: #bfdbfe;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.deploy-copy-prereq {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #155e75;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}

.deploy-copy-prereq.is-warning {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.deploy-copy-prereq.is-success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.deploy-decision {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.deploy-decision__title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

.deploy-decision__detail {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.deploy-decision--success {
  border-color: rgba(22, 163, 74, 0.28);
  background: #f0fdf4;
}

.deploy-decision--success .deploy-decision__title {
  color: #166534;
}

.deploy-decision--warning {
  border-color: rgba(217, 119, 6, 0.3);
  background: #fff7ed;
}

.deploy-decision--warning .deploy-decision__title {
  color: #9a3412;
}

.deploy-decision--danger {
  border-color: rgba(220, 38, 38, 0.32);
  background: #fef2f2;
}

.deploy-decision--danger .deploy-decision__title {
  color: var(--danger);
}

.deploy-result-rows {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.deploy-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 8px;
  background: var(--surface);
}

.deploy-result-row--success {
  border-left-color: var(--success);
}

.deploy-result-row--warning {
  border-left-color: #f59e0b;
}

.deploy-result-row--info {
  border-left-color: var(--primary);
}

.deploy-result-row--danger {
  border-left-color: var(--danger);
}

.deploy-result-row__main {
  min-width: 0;
}

.deploy-result-row__label {
  color: var(--text-muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.deploy-result-row__status {
  color: var(--text);
  display: block;
  font-size: 1rem;
  margin-top: 0.18rem;
}

.deploy-result-row__detail {
  color: var(--text-muted);
  display: block;
  font-size: 0.84rem;
  line-height: 1.4;
  margin-top: 0.18rem;
}

.deploy-result-row__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.deploy-result-row__extra {
  grid-column: 1 / -1;
  min-width: 0;
}

.deploy-result-chip {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 0.4rem;
  line-height: 1;
  padding: 0.42rem 0.58rem;
}

.deploy-result-chip strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.deploy-result-chip--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.deploy-result-chip--warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.deploy-result-chip--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.deploy-result-chip--danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.deploy-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  margin: 0.85rem 0;
}

.deploy-result-meta:empty {
  display: none;
}

.deploy-result-meta strong {
  color: var(--text);
}

.deploy-result-meta--diff {
  margin-top: 1rem;
}

.deploy-result-details {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.deploy-result-details summary {
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  color: var(--text);
}

.deploy-result-details__list {
  display: grid;
  gap: 0.5rem;
  margin: 0.7rem 0 0;
}

.deploy-result-details__list div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.deploy-result-details__list dt {
  color: var(--text-muted);
  font-weight: 700;
}

.deploy-result-details__list dd {
  margin: 0;
  min-width: 0;
}

.deploy-result-details__list code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.deploy-result-details__warnings {
  margin-top: 0.75rem;
}

.deploy-result-details__warnings ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.result-stats--stacked {
  margin-bottom: 0.5rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.text-small {
  font-size: 0.85rem;
}

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

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-4 {
  margin-bottom: 1rem !important;
}

.mt-1 {
  margin-top: 0.25rem !important;
}

.mt-4 {
  margin-top: 1rem !important;
}

.mt-6 {
  margin-top: 1.5rem !important;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.result-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.result-stat {
  padding: 0.75rem 1rem;
  background: var(--surface-muted);
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 140px;
}

.result-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.result-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.result-stat--success .result-stat-value {
  color: var(--success);
}

.result-stat--warning .result-stat-value {
  color: #f59e0b;
}

.result-stat--info .result-stat-value {
  color: var(--primary);
}

.result-stat--danger .result-stat-value {
  color: var(--danger);
}

.deploy-list-container {
  max-height: 300px;
  overflow-y: auto;
  background: var(--surface-muted);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.deploy-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deploy-list li {
  padding: 0.5rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  word-break: break-all;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.deploy-list li:last-child {
  border-bottom: none;
}

.deploy-list li:nth-child(even) {
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 1100px) {
  .deploy-scope-grid,
  .deploy-operation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .deploy-scope-grid,
  .deploy-operation-grid {
    grid-template-columns: 1fr;
  }

  .deploy-operation-card p {
    min-height: 0;
  }

  .deploy-progress-grid,
  .deploy-result-row {
    grid-template-columns: 1fr;
  }

  .deploy-result-row__chips {
    justify-content: flex-start;
  }

  .deploy-result-details__list div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .deploy-log-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .deploy-arrow {
    transform: rotate(90deg);
    margin: 0.5rem 0;
    width: 100%;
  }

  .deploy-env-wrapper {
    flex-direction: column;
    gap: 0.5rem;
  }

  .deploy-env-card {
    width: 100%;
  }
}

.annotation-card-header {
  margin-bottom: 1rem;
}

.annotation-card-title {
  /* Canonical: card title sizing and wrapping */
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.annotation-fields {
  margin: 0;
  display: grid;
  gap: 1rem;
  min-width: 0; /* allow grid children to shrink */
}

.annotation-field {
  display: grid;
  gap: 0.35rem;
}

.annotation-field--inline {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.annotation-field-label {
  font-weight: 600;
  margin: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--text);
  width: fit-content;
}

.annotation-field-label--inline {
  padding: 0;
  background: none;
  color: var(--text-muted);
}

.annotation-field-value {
  margin: 0;
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(208, 215, 227, 0.6);
}

.annotation-field-value--inline {
  padding: 0;
  border: none;
  background: none;
  text-align: right;
  justify-self: end;
  color: var(--text);
}

.annotation-field-value--structured {
  padding: 0;
  border: none;
  background: transparent;
}

.annotation-field-value--structured .annotation-tree-container {
  margin: 0;
}

.annotation-field-text {
  display: inline-block;
  padding: 0;
}

.annotation-tree-container {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--surface-muted);
  border: 1px solid rgba(208, 215, 227, 0.6);
  max-height: 320px;
  overflow: auto;
  max-width: 100%;
}

.annotation-tree-row,
.annotation-tree-branch > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.annotation-tree-branch > summary {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.4rem 0.65rem 0.4rem 1.75rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.annotation-tree-branch[open] > summary {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

.annotation-tree-key {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.annotation-tree-value {
  word-break: break-word;
}

.annotation-tree-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.annotation-tree-children {
  list-style: none;
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  border-left: 1px solid rgba(208, 215, 227, 0.7);
}

.annotation-tree-branch > summary::before {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(-45deg);
  transition: transform 0.2s ease;
}

.annotation-tree-branch[open] > summary::before {
  transform: translateY(-50%) rotate(45deg);
}

.annotation-tree-node {
  margin: 0.35rem 0;
}

.annotation-tree-level-0 {
  margin-left: 0;
}

.annotation-tree-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.annotation-tree-container::-webkit-scrollbar-thumb {
  background: rgba(95, 108, 123, 0.35);
  border-radius: 999px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-field label {
  font-weight: 600;
}

.field-label-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.field-label-title {
  font-weight: 700;
}

.field-label-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-final-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-right: 0.25rem;
}

.card-final-actions .inline-form {
  margin: 0;
}

/* Center and widen actions in IMSLP piece section */
.annotation-imslp-piece .form-actions {
  justify-content: center;
}
.annotation-imslp-piece .form-actions .button {
  min-width: 260px;
}

/* Inline actions in grid rows */
.form-grid.form-grid--inline-actions {
  align-items: end;
}
.form-field.form-field--align-end {
  align-self: end;
}
.form-field.form-field--no-label label {
  display: none;
}

.form-field--full {
  grid-column: 1 / -1;
}

/* Loading spinner and inline progress */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
.inline-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}
.button.is-loading {
  opacity: 0.85;
  pointer-events: none;
}
.button.is-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 0.5rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

/* Non-spinner save states */
.button.is-saving {
  opacity: 0.85;
  pointer-events: none;
}

/* Disabled field styling for better affordance */
.form-field input:disabled,
.form-field textarea:disabled,
.form-field select:disabled,
.form-field input[disabled],
.form-field textarea[disabled],
.form-field select[disabled] {
  background: var(--surface-muted);
  color: var(--text-muted);
  border-color: rgba(208, 215, 227, 0.9);
  cursor: not-allowed;
}

/* Add extra spacing below the filter actions before the table */
.audio-filter-form .form-actions {
  margin-bottom: 1.25rem;
}

/* Add more space around the filter controls */
.audio-filter-form {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}
.audio-filter-form .form-grid {
  gap: 1.75rem;
}
.audio-filter-form .form-field {
  margin-bottom: 1.75rem;
}

.messages {
  margin-bottom: 2rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.alert.success {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.alert.info {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.alert.warning {
  background: rgba(249, 115, 22, 0.15);
  color: #c2410c;
}

.alert.error {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

.error-text {
  color: #b91c1c;
  margin: 0;
  font-size: 0.875rem;
}

.help-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.table-responsive {
  overflow-x: auto;
}

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

.table th,
.table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: var(--surface-muted);
}

.mocl-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.mocl-table {
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}

.mocl-table th,
.mocl-table td {
  background: var(--surface);
  vertical-align: top;
}

.mocl-table thead th {
  background: #f8fafc;
}

.mocl-table tbody tr:hover td {
  background: var(--surface-muted);
}

.mocl-table .mocl-sticky-left,
.mocl-table .mocl-sticky-right {
  position: sticky;
  z-index: 3;
  background-clip: padding-box;
}

.mocl-table thead .mocl-sticky-left,
.mocl-table thead .mocl-sticky-right {
  z-index: 5;
}

.mocl-sticky-left--1 {
  left: 0;
  width: var(--mocl-sticky-1-width, 220px);
  min-width: var(--mocl-sticky-1-width, 220px);
  max-width: var(--mocl-sticky-1-width, 220px);
}

.mocl-sticky-left--2 {
  left: var(--mocl-sticky-1-width, 220px);
  width: var(--mocl-sticky-2-width, 280px);
  min-width: var(--mocl-sticky-2-width, 280px);
  max-width: var(--mocl-sticky-2-width, 280px);
}

.mocl-sticky-left--3 {
  left: calc(var(--mocl-sticky-1-width, 220px) + var(--mocl-sticky-2-width, 280px));
  width: var(--mocl-sticky-3-width, 240px);
  min-width: var(--mocl-sticky-3-width, 240px);
  max-width: var(--mocl-sticky-3-width, 240px);
}

.mocl-sticky-left--last {
  border-right: 0;
}

.mocl-sticky-left--last::after {
  content: '';
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 4px;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      rgba(37, 99, 235, 0.5) 0,
      rgba(37, 99, 235, 0.5) 1px,
      transparent 1px,
      transparent 3px,
      rgba(37, 99, 235, 0.5) 3px,
      rgba(37, 99, 235, 0.5) 4px
    );
}

.mocl-sticky-right {
  right: 0;
  width: var(--mocl-actions-width, 180px);
  min-width: var(--mocl-actions-width, 180px);
  max-width: var(--mocl-actions-width, 180px);
  border-left: 0;
}

.mocl-sticky-right::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  width: 4px;
  pointer-events: none;
  background:
    linear-gradient(
      to right,
      rgba(37, 99, 235, 0.5) 0,
      rgba(37, 99, 235, 0.5) 1px,
      transparent 1px,
      transparent 3px,
      rgba(37, 99, 235, 0.5) 3px,
      rgba(37, 99, 235, 0.5) 4px
    );
}

.mocl-sticky-content {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mocl-table .mocl-sticky-left > strong,
.mocl-table .mocl-sticky-left .annotation-code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.mocl-table .mocl-sticky-left > strong {
  display: block;
}

.mocl-table td.actions {
  display: table-cell;
  vertical-align: middle;
}

.mocl-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.mocl-table-actions .button {
  min-height: 2rem;
  padding: 0.38rem 0.65rem;
  border-radius: 9px;
  font-size: 0.75rem;
  line-height: 1.15;
  white-space: nowrap;
}

.mocl-table-actions .button + .button {
  margin-left: 0;
}

.mocl-table-actions--status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
}

.mocl-table-actions--status .button {
  width: 100%;
  min-width: 0;
  padding-inline: 0.5rem;
}

.mocl-table-actions--status .mocl-table-action-primary {
  grid-column: 1 / -1;
}

.mocl-table-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}

.mocl-table-scroll[hidden] {
  display: none !important;
}

.mocl-table-scroll__rail {
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.mocl-table-scroll__spacer {
  height: 1px;
}

.mocl-table--status-pieces {
  min-width: 2060px;
  --mocl-sticky-1-width: 220px;
  --mocl-sticky-2-width: 320px;
  --mocl-sticky-3-width: 260px;
  --mocl-actions-width: 220px;
}

.mocl-table--composer-profiles {
  min-width: 1320px;
  --mocl-sticky-1-width: 280px;
  --mocl-actions-width: 180px;
}

.mocl-table--composer-orphans {
  min-width: 920px;
  --mocl-sticky-1-width: 280px;
  --mocl-actions-width: 140px;
}

.mocl-table--discovery-index {
  min-width: 1220px;
  --mocl-sticky-1-width: 240px;
  --mocl-sticky-2-width: 360px;
  --mocl-actions-width: 180px;
}

.mocl-table--status-audit {
  min-width: 900px;
}

@media (max-width: 1180px) {
  .mocl-table--status-pieces {
    --mocl-sticky-1-width: 180px;
    --mocl-sticky-2-width: 260px;
    --mocl-sticky-3-width: 220px;
  }

  .mocl-table--composer-profiles,
  .mocl-table--composer-orphans {
    --mocl-sticky-1-width: 240px;
  }

  .mocl-table--discovery-index {
    --mocl-sticky-1-width: 200px;
    --mocl-sticky-2-width: 300px;
  }

  .mocl-table .mocl-sticky-right {
    position: static;
    width: auto;
    min-width: var(--mocl-actions-width, 180px);
    max-width: none;
    border-left: 0;
    box-shadow: none;
  }

  .mocl-table .mocl-sticky-right::before {
    display: none;
  }

  .mocl-table-actions {
    justify-content: flex-start;
  }
}

.legal-documents-table td {
  vertical-align: middle;
}

.composer-images-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.composer-images-table {
  min-width: 2600px;
  table-layout: auto;
}

.composer-images-table th,
.composer-images-table td {
  white-space: nowrap;
  vertical-align: top;
}

.composer-images-table th:nth-child(1),
.composer-images-table td:nth-child(1) {
  min-width: 240px;
}

.composer-images-table th:nth-child(2),
.composer-images-table td:nth-child(2),
.composer-images-table th:nth-child(3),
.composer-images-table td:nth-child(3),
.composer-images-table th:nth-child(4),
.composer-images-table td:nth-child(4) {
  min-width: 560px;
}

.composer-images-table code,
.composer-images-table .annotation-code {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.composer-profiles-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.composer-profiles-table {
  min-width: 1280px;
  table-layout: auto;
}

.composer-profiles-table.mocl-table--composer-profiles {
  min-width: 1320px;
}

.composer-profiles-table.mocl-table--discovery-index {
  min-width: 1280px;
}

.composer-profiles-table th,
.composer-profiles-table td {
  vertical-align: top;
}

.composer-profiles-table code,
.composer-profiles-table .annotation-code {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.composer-detail-page {
  --composer-panel-bg: #f8fafc;
  --composer-panel-border: rgba(148, 163, 184, 0.35);
}

.discovery-detail-main {
  width: 100%;
}

.composer-detail-card {
  padding: 1.75rem;
}

.composer-profile-form-grid,
.composer-story-form-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.composer-profile-catalog {
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--composer-panel-bg);
  padding: 1rem;
}

.discovery-source-piece-card {
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--composer-panel-bg);
  padding: 1rem;
}

.discovery-source-piece-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.discovery-profile-editor-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
}

.discovery-profile-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.discovery-profile-form-grid .i18n-locale-panel {
  border: 0;
  background: transparent;
  padding: 0;
}

.discovery-profile-form-grid .form-field {
  margin-bottom: 0;
}

.discovery-profile-preview-panel {
  width: 100%;
}

.composer-profile-catalog code,
.discovery-source-piece-card code,
.composer-image-path code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.i18n-authoring-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.9rem;
}

.i18n-locale-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  padding-bottom: 0.65rem;
}

.i18n-locale-tabs--inline {
  align-items: center;
  border-bottom: 0;
  padding-bottom: 0;
}

.i18n-locale-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
}

.i18n-locale-tab.is-active {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

.i18n-locale-tab:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.42);
  outline-offset: 2px;
}

.i18n-locale-tab .badge {
  margin-right: 0;
}

.i18n-locale-panel {
  border: 1px solid var(--composer-panel-border);
  border-radius: 12px;
  background: var(--composer-panel-bg);
  padding: 1rem;
}

.i18n-authoring-group.i18n-tabs-ready .i18n-locale-panel:not(.is-active) {
  display: none;
}

.i18n-locale-panel + .i18n-locale-panel {
  margin-top: 0.75rem;
}

.i18n-authoring-group.i18n-tabs-ready .i18n-locale-panel + .i18n-locale-panel {
  margin-top: 0;
}

[data-locale-content][hidden] {
  display: none !important;
}

[data-locale-scope-container]:not(.locale-scope-ready) [data-locale-content]:not([data-locale-content="ko"]) {
  display: none;
}

.i18n-locale-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.i18n-locale-panel__header strong,
.i18n-locale-panel__header span {
  display: block;
}

.i18n-field-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.discovery-source-facts {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.discovery-source-facts--compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.discovery-source-facts div {
  min-width: 0;
}

.discovery-panel-label,
.discovery-source-fact-label {
  display: block;
  margin-bottom: 0.25rem;
}

.discovery-source-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.source-fact-table-wrap {
  overflow-x: auto;
}

.source-fact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.source-fact-table th,
.source-fact-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.source-fact-table thead th {
  background: rgba(241, 245, 249, 0.75);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.source-fact-table tbody th {
  width: 32%;
  color: var(--text);
  font-weight: 650;
}

.source-fact-table td {
  overflow-wrap: anywhere;
}

.discovery-work-section-list,
.discovery-markdown-preview {
  display: grid;
  gap: 1.25rem;
}

.discovery-editor-card,
.discovery-work-section-panel,
.discovery-preview-section {
  border: 1px solid var(--composer-panel-border);
  border-radius: 12px;
  background: var(--composer-panel-bg);
  padding: 1rem;
}

.discovery-editor-card {
  padding: 1.25rem;
}

.discovery-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.discovery-card-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.discovery-card-title {
  margin: 0;
}

.discovery-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  text-align: left;
}

.discovery-card-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.42);
  outline-offset: 3px;
}

.discovery-card-toggle__icon {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.is-collapsed .discovery-card-toggle__icon {
  transform: rotate(-45deg);
}

.discovery-card-body[hidden] {
  display: none !important;
}

.discovery-work-section-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.discovery-work-section-panel__header h3,
.discovery-work-section-panel__header h4,
.discovery-work-section-panel__header p {
  margin: 0;
}

.discovery-work-section-grid {
  display: grid;
  gap: 1rem;
}

.discovery-work-section-card {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  padding: 0;
}

.discovery-work-section-card.is-disabled {
  border-style: dashed;
  background: rgba(248, 250, 252, 0.82);
}

.discovery-work-section-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.92));
  padding: 1rem 1.15rem;
}

.discovery-work-section-card__identity {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  min-width: 0;
}

.discovery-work-section-card__identity > div {
  min-width: 0;
}

.discovery-work-section-card__ordinal {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.07);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
}

.discovery-work-section-card__hint {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 44rem;
  margin-top: 0.2rem;
}

.discovery-work-section-card__header h3,
.discovery-work-section-card__header p {
  margin: 0;
}

.discovery-work-section-card__body {
  display: grid;
  align-items: start;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1.15rem;
}

.discovery-work-section-card__disabled-note {
  display: none;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem 1.15rem;
}

.discovery-work-section-card.is-disabled .discovery-work-section-card__disabled-note {
  display: block;
}

.discovery-work-section-card.is-disabled .discovery-card-body {
  display: none;
}

.discovery-work-section-card__editor {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.discovery-work-section-card__preview {
  align-self: start;
  min-width: 0;
  position: sticky;
  top: 5rem;
}

/* Work Sections use custom slot-style editor controls, scoped away from Understanding the Structure. */
[data-discovery-card="work-sections-root"] .i18n-authoring-group {
  gap: 0.75rem;
}

[data-discovery-card="work-sections-root"] .i18n-locale-panels {
  min-width: 0;
}

[data-discovery-card="work-sections-root"] .i18n-locale-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

[data-discovery-card="work-sections-root"] .i18n-field-grid {
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

[data-discovery-card="work-sections-root"] .form-field {
  gap: 0.55rem;
  margin-bottom: 0;
  min-width: 0;
}

[data-discovery-card="work-sections-root"] .i18n-locale-panel .form-field,
[data-discovery-card="work-sections-root"] .discovery-work-block-locale .form-field {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 0.85rem;
}

[data-discovery-card="work-sections-root"] .i18n-locale-panel .form-field:focus-within,
[data-discovery-card="work-sections-root"] .discovery-work-block-locale .form-field:focus-within {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 0 0 3px rgba(37, 99, 235, 0.1);
}

[data-discovery-card="work-sections-root"] .field-label-title {
  color: #475569;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

[data-discovery-card="work-sections-root"] .form-field input,
[data-discovery-card="work-sections-root"] .form-field textarea,
[data-discovery-card="work-sections-root"] .form-field select {
  min-height: 2.75rem;
  border-color: rgba(148, 163, 184, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  color: #111827;
  font-size: 0.96rem;
  line-height: 1.45;
  padding: 0.7rem 0.8rem;
}

[data-discovery-card="work-sections-root"] .form-field textarea {
  min-height: 7.5rem;
  line-height: 1.55;
}

[data-discovery-card="work-sections-root"] .discovery-order-field {
  max-width: 7.5rem;
}

[data-discovery-card="work-sections-root"] .discovery-work-row-item .i18n-field-grid {
  grid-template-columns: minmax(0, 1fr);
}

[data-discovery-card="work-sections-root"] .discovery-work-row-item > .form-field {
  margin-bottom: 1rem;
}

[data-discovery-card="work-sections-root"] .discovery-work-row-item .i18n-authoring-group {
  margin-top: 0.2rem;
}

[data-discovery-card="work-sections-root"] .discovery-work-row-item .i18n-locale-panel .form-field {
  width: min(100%, 36rem);
}

[data-discovery-card="work-sections-root"] .discovery-repeatable-item {
  border-color: rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.78));
}

[data-discovery-card="work-sections-root"] .discovery-repeatable-item__header {
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
}

.composer-form-actions.discovery-work-section-save-actions {
  margin-top: 0;
  padding: 0.5rem 1.5rem 1.35rem;
}

.composer-form-actions.discovery-structure-understanding-save-actions {
  margin-top: 0;
  padding: 0.5rem 1.5rem 1.35rem;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.035);
  gap: 0.55rem;
  padding: 0.6rem;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input:focus-within {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

[data-discovery-card="work-sections-root"] .discovery-tag-input__chips {
  gap: 0.45rem;
  min-height: 0;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input__chip {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.34rem 0.48rem 0.34rem 0.7rem;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input__entry {
  min-height: 2.1rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0.25rem 0.1rem;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input__entry:focus {
  box-shadow: none;
}

[data-discovery-card="work-sections-root"] .discovery-tag-input__add {
  align-self: stretch;
}

.discovery-work-section-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.discovery-repeatable-empty {
  border: 1px dashed rgba(148, 163, 184, 0.36);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.62);
  margin: 0;
  padding: 0.85rem;
  text-align: center;
}

.discovery-work-block-locale {
  display: grid;
  gap: 0.85rem;
}

.discovery-work-app-preview {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  background: rgba(239, 246, 255, 0.5);
  overflow: hidden;
}

.discovery-work-app-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 800;
  padding: 0.75rem 0.85rem;
}

.discovery-work-app-preview__surface {
  border-top: 1px solid rgba(37, 99, 235, 0.14);
  background: #111;
  padding: 0.75rem;
}

.discovery-work-app-preview .is-hidden {
  display: none !important;
}

.discovery-work-app-card {
  display: grid;
  gap: 2rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 32px;
  background: #242322;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    inset 0 -1px 1px rgba(255, 255, 255, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.18);
  color: #ededed;
  padding: 2rem 1.25rem;
}

.discovery-profile-app-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 1.25rem;
  min-height: 540px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(49, 45, 39, 0.98) 0%, rgba(20, 19, 18, 0.98) 48%, #090909 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.22);
  color: #f7f3ec;
  padding: 1.35rem 1.25rem 1.4rem;
}

.discovery-profile-app-card__back,
.discovery-profile-app-card__down {
  display: block;
  width: 0.7rem;
  height: 0.7rem;
  border-color: currentColor;
  border-style: solid;
  color: rgba(247, 243, 236, 0.86);
}

.discovery-profile-app-card__back {
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}

.discovery-profile-app-card__down {
  justify-self: center;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.discovery-profile-app-card__content {
  display: grid;
  align-content: end;
  gap: 1.1rem;
  min-width: 0;
}

.discovery-profile-app-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #fffaf3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}

.discovery-profile-app-card__composer {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(247, 243, 236, 0.88);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

.discovery-profile-app-card__facts {
  display: grid;
  gap: 0.55rem;
  margin: 0.2rem 0 0;
}

.discovery-profile-app-card__facts div {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: baseline;
}

.discovery-profile-app-card__facts dt,
.discovery-profile-app-card__facts dd {
  margin: 0;
}

.discovery-profile-app-card__facts dt {
  overflow-wrap: anywhere;
  color: rgba(247, 243, 236, 0.62);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.discovery-profile-app-card__facts dd {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #fffaf3;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.45;
}

.discovery-profile-app-card__summary {
  align-self: end;
  width: min(100%, 20.5rem);
  color: #e6e6e6;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-line;
}

.discovery-profile-app-card__summary p {
  margin: 0;
}

.discovery-work-app-card__head {
  display: grid;
  justify-items: center;
  gap: 1.4rem;
  text-align: center;
}

.discovery-work-app-card__prompt {
  color: #ededed;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
}

.discovery-work-app-card__pill {
  width: fit-content;
  border-radius: 999px;
  background: #151514;
  color: #ededed;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.55rem 0.85rem;
}

.discovery-work-app-special {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
}

.discovery-work-app-special strong {
  color: #f7f7f7;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.2;
}

.discovery-work-app-special strong span {
  color: inherit;
  font: inherit;
  line-height: inherit;
}

.discovery-work-app-special > span {
  color: #cdcccb;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.6;
}

.discovery-work-app-block {
  display: grid;
  gap: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: #cdcccb;
  font-size: 0.96rem;
  line-height: 1.6;
  padding-top: 1.45rem;
}

.discovery-work-app-special + .discovery-work-app-block,
.discovery-work-app-tags + .discovery-work-app-block {
  border-top: 0;
  padding-top: 0;
}

[data-work-preview-block-list] {
  display: grid;
  gap: 2rem;
}

[data-work-preview-block-list]:empty {
  display: none;
}

[data-work-preview-block-list] .discovery-work-app-block {
  border-top: 0;
  padding-top: 0;
}

[data-work-preview-block-list] .discovery-work-app-block + .discovery-work-app-block {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 2rem;
}

.discovery-work-app-block > strong {
  color: #ededed;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.6;
}

.discovery-work-app-block p {
  margin: 0;
}

.discovery-work-app-row-list,
.discovery-work-app-family-list {
  display: grid;
  gap: 0.65rem;
}

.discovery-work-app-card--movement_entry_list [data-work-preview-body] {
  border-top: 0;
  padding-top: 0;
}

.discovery-work-app-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: #1a1919;
  padding: 0.75rem 0.65rem;
}

.discovery-work-app-row b {
  flex: 0 0 auto;
  border-radius: 6px;
  background: #050505;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 0.45rem 0.6rem;
  white-space: nowrap;
}

.discovery-work-app-row > div {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.discovery-work-app-row span {
  color: #b4b3b2;
  font-size: 0.82rem;
  line-height: 1.6;
}

.discovery-work-app-row strong {
  color: #ededed;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
}

.discovery-work-app-family-list > div {
  display: grid;
  gap: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 1rem;
}

.discovery-work-app-family-list > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.discovery-work-app-family-list strong {
  color: #ededed;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.6;
}

.discovery-work-app-family-list span {
  color: #cdcccb;
  font-size: 0.96rem;
  line-height: 1.6;
}

.discovery-work-app-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.discovery-work-app-tags > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.discovery-work-app-tags span {
  border-radius: 999px;
  background: #1a1919;
  color: #cdcccb;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.6rem 0.8rem;
}

.discovery-instrument-family-list,
.discovery-repeatable-list {
  display: grid;
  gap: 0.75rem;
}

.discovery-movement-card-list {
  display: grid;
  gap: 1rem;
}

.discovery-movement-card,
.discovery-structure-understanding-section-panel {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 1rem;
}

.discovery-movement-card {
  display: grid;
  gap: 0.85rem;
}

.discovery-structure-understanding-section-panel {
  margin-top: 0.9rem;
}

.discovery-movement-overview-panel__body {
  display: grid;
  align-items: start;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  margin-top: 1rem;
}

.discovery-structure-understanding-section-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  margin-top: 1rem;
  overflow: hidden;
}

.discovery-structure-understanding-section-card.is-disabled {
  border-style: dashed;
  background: rgba(248, 250, 252, 0.82);
}

.discovery-structure-understanding-section-card__disabled-note {
  display: none;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem 1.15rem;
}

.discovery-structure-understanding-section-card.is-disabled .discovery-structure-understanding-section-card__disabled-note {
  display: block;
}

.discovery-structure-understanding-section-card.is-disabled .discovery-structure-understanding-section-card__body {
  display: none;
}

[data-discovery-card="structure-understanding-root"] .i18n-authoring-group {
  gap: 0.75rem;
}

[data-discovery-card="structure-understanding-root"] .i18n-locale-panels {
  min-width: 0;
}

[data-discovery-card="structure-understanding-root"] .i18n-locale-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

[data-discovery-card="structure-understanding-root"] .i18n-field-grid {
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

[data-discovery-card="structure-understanding-root"] .form-field {
  gap: 0.55rem;
  margin-bottom: 0;
  min-width: 0;
}

[data-discovery-card="structure-understanding-root"] .i18n-locale-panel .form-field,
[data-discovery-card="structure-understanding-root"] .discovery-work-block-locale .form-field {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 1px 2px rgba(15, 23, 42, 0.04);
  padding: 0.85rem;
}

[data-discovery-card="structure-understanding-root"] .i18n-locale-panel .form-field:focus-within,
[data-discovery-card="structure-understanding-root"] .discovery-work-block-locale .form-field:focus-within {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 0 0 3px rgba(37, 99, 235, 0.1);
}

[data-discovery-card="structure-understanding-root"] .field-label-title {
  color: #475569;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

[data-discovery-card="structure-understanding-root"] .form-field input,
[data-discovery-card="structure-understanding-root"] .form-field textarea,
[data-discovery-card="structure-understanding-root"] .form-field select {
  min-height: 2.75rem;
  border-color: rgba(148, 163, 184, 0.36);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  color: #111827;
  font-size: 0.96rem;
  line-height: 1.45;
  padding: 0.7rem 0.8rem;
}

[data-discovery-card="structure-understanding-root"] .form-field textarea {
  min-height: 7rem;
  line-height: 1.55;
}

[data-discovery-card="structure-understanding-root"] .discovery-order-field {
  max-width: 7.5rem;
}

[data-discovery-card="structure-understanding-root"] .discovery-repeatable-item {
  border-color: rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.78));
}

[data-discovery-card="structure-understanding-root"] .discovery-repeatable-item__header {
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
}

.discovery-movement-info-card {
  border: 1px dashed rgba(148, 163, 184, 0.42);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.72);
  color: var(--text-muted);
  padding: 1rem;
}

.discovery-movement-info-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.discovery-movement-info-card p {
  margin: 0;
}

.discovery-structure-understanding-app-card {
  width: min(100%, 335px);
  box-sizing: border-box;
  gap: 2rem;
  justify-self: center;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(52, 51, 50, 0.32);
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 1px -1px 1px rgba(255, 255, 255, 0.12),
    0 8px 6px rgba(0, 0, 0, 0.05);
}

.discovery-structure-understanding-app-card .discovery-work-app-card__head {
  gap: 1.5rem;
}

.discovery-structure-understanding-app-card .discovery-work-app-card__pill {
  padding: 0.625rem 0.75rem;
  background: #1a1919;
  color: #e6e6e6;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.discovery-structure-understanding-app-card .discovery-work-app-card__prompt {
  color: #ededed;
  font-size: 1.125rem;
  line-height: 1.2;
}

.discovery-structure-understanding-app-card--piece_character_card {
  gap: 2rem;
}

.discovery-structure-understanding-app-card--everyday_classical_music_card {
  gap: 3rem;
}

.discovery-structure-understanding-app-card--piece_character_card .discovery-work-app-special {
  width: 100%;
  padding: 2rem 0;
}

.discovery-structure-understanding-app-card--piece_character_card .discovery-work-app-special strong {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
}

.discovery-structure-understanding-app-card--everyday_classical_music_card .discovery-work-app-block > strong,
.discovery-structure-understanding-app-card--piece_character_card .discovery-work-app-block > strong {
  color: #e6e6e6;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.6;
}

.discovery-structure-understanding-app-card--everyday_classical_music_card .discovery-work-app-block,
.discovery-structure-understanding-app-card--piece_character_card .discovery-work-app-block {
  gap: 1rem;
  color: #cdcccb;
  font-size: 1rem;
  line-height: 1.6;
}

[data-structure-understanding-preview-block-list] {
  display: grid;
  gap: 1.4rem;
}

[data-structure-understanding-preview-block-list] .discovery-work-app-block {
  border-top: 0;
  padding-top: 0;
}

[data-structure-understanding-preview-block-list] .discovery-work-app-block + .discovery-work-app-block {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 1.55rem;
}

.discovery-structure-understanding-app-card--piece_character_card [data-structure-understanding-preview-block-list] {
  gap: 2rem;
}

.discovery-structure-understanding-app-card--piece_character_card
  [data-structure-understanding-preview-block-list]
  .discovery-work-app-block
  + .discovery-work-app-block {
  padding-top: 2rem;
}

.discovery-structure-understanding-app-card--everyday_classical_music_card [data-structure-understanding-preview-block-list] {
  gap: 0;
}

.discovery-structure-understanding-app-card--everyday_classical_music_card
  [data-structure-understanding-preview-block-list]
  .discovery-work-app-block
  + .discovery-work-app-block {
  margin-top: 2rem;
  padding-top: 2rem;
}

.discovery-structure-understanding-app-card--piece_structure_card .discovery-work-app-block {
  border-top: 0;
  padding-top: 0;
  text-align: center;
}

.discovery-structure-understanding-app-card--listening_guide_card {
  gap: 3rem;
}

.discovery-structure-understanding-app-card--listening_guide_card .discovery-work-app-card__prompt {
  white-space: pre-line;
}

.discovery-listening-guide-app-list {
  display: grid;
  gap: 0.75rem;
  width: 100%;
}

.discovery-listening-guide-app-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #cdcccb;
  font-size: 1rem;
  line-height: 1.6;
  padding: 1rem 0.625rem;
}

.discovery-listening-guide-app-item span:not(.discovery-listening-guide-app-check) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.discovery-listening-guide-app-check {
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  justify-self: center;
  border: 1px solid rgba(52, 51, 50, 0.24);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.32);
}

.discovery-movement-overview-app-card {
  display: grid;
  gap: 3rem;
  width: min(100%, 335px);
  box-sizing: border-box;
  justify-self: center;
  min-height: 420px;
  background: #151514;
  color: #e6e6e6;
  padding: 1.75rem 1.25rem;
}

.discovery-movement-overview-app-card__header {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.discovery-movement-overview-app-card__eyebrow {
  color: #cdcccb;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.discovery-movement-overview-app-card__source-title {
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.discovery-movement-overview-app-card__content {
  display: grid;
  gap: 2rem;
  min-width: 0;
  padding-block: 1rem;
}

.discovery-movement-overview-app-card__title {
  margin: 0;
  color: #e6e6e6;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.discovery-movement-overview-app-card__title span:not(:empty)::before {
  content: "“";
}

.discovery-movement-overview-app-card__title span:not(:empty)::after {
  content: "”";
}

.discovery-movement-overview-app-card__summary {
  color: #e6e6e6;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-line;
  word-break: break-word;
}

.discovery-movement-overview-app-card__summary p {
  margin: 0;
}

.discovery-structure-understanding-section-card[data-structure-understanding-section-render-type="quiz_highlights_card"]
  .discovery-structure-understanding-section-card__body {
  grid-template-columns: minmax(0, 1fr);
}

.discovery-instrument-family,
.discovery-repeatable-item {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.75);
  padding: 0.85rem;
}

.discovery-instrument-family.is-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(255, 251, 235, 0.7);
}

.discovery-instrument-family p {
  margin: 0.35rem 0 0;
  overflow-wrap: anywhere;
}

.discovery-repeatable-item--new {
  border-style: dashed;
}

.discovery-story-block-form {
  display: grid;
  gap: 0.85rem;
}

.discovery-story-block-form__header {
  display: grid;
  align-items: end;
  gap: 0.85rem;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 8rem);
}

.discovery-story-block-form__title {
  align-self: center;
}

.discovery-story-block-form .i18n-locale-panel {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.74);
}

.discovery-repeatable-item__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.discovery-order-field {
  max-width: 8rem;
}

.discovery-readonly-display-label {
  display: grid;
  gap: 0.25rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.06);
  padding: 0.85rem;
}

.discovery-readonly-display-label strong {
  font-size: 1.05rem;
}

.discovery-movement-structure-readonly {
  display: grid;
  gap: 0.45rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.06);
  padding: 0.85rem;
}

.discovery-movement-structure-readonly strong {
  font-size: 1.05rem;
}

.discovery-movement-structure-readonly p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.discovery-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.discovery-tag-input {
  display: grid;
  gap: 0.5rem;
}

.discovery-tag-input__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2rem;
}

.discovery-tag-input__entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.discovery-tag-input__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem 0.25rem 0.65rem;
}

.discovery-tag-input__remove {
  display: inline-grid;
  width: 1.1rem;
  height: 1.1rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}

.discovery-tag-input__entry {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.6rem 0.75rem;
}

.discovery-tag-input__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 2.45rem;
  padding: 0.5rem 0.8rem;
  white-space: nowrap;
}

.discovery-tag-input__add:hover:not(:disabled),
.discovery-tag-input__add:focus-visible {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.42);
}

.discovery-tag-input__add:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.discovery-tag-input__add-icon {
  font-size: 1rem;
  line-height: 1;
}

.discovery-preview-block {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin-top: 0.85rem;
  padding-top: 0.85rem;
}

.discovery-preview-block h6 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.field-label-with-help {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.markdown-help {
  position: relative;
  display: inline-flex;
}

.markdown-help__trigger {
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  cursor: help;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.markdown-help__content {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.45rem);
  left: 0;
  display: none;
  width: min(320px, 80vw);
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.45;
}

.markdown-help__content span,
.markdown-help__content strong {
  display: block;
}

.markdown-help__content span + span {
  margin-top: 0.35rem;
}

.markdown-help:hover .markdown-help__content,
.markdown-help:focus-within .markdown-help__content {
  display: block;
}

.composer-form-actions {
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-right: 0.25rem;
}

.composer-image-layout {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.composer-image-panel {
  min-width: 0;
  border: 1px solid var(--composer-panel-border);
  border-radius: 12px;
  background: var(--composer-panel-bg);
  overflow: hidden;
}

.composer-image-panel.is-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: #fffaf0;
}

.composer-image-panel__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.72);
}

.composer-image-panel__header h3,
.composer-image-panel__header p {
  margin: 0;
}

.composer-image-panel__header h3 {
  font-size: 0.95rem;
}

.composer-image-panel__header p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.composer-image-env-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  padding: 0.32rem 0.52rem;
  border-radius: 8px;
  background: #475569;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.composer-image-env-badge.is-target {
  background: var(--primary);
}

.composer-image-panel__body {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
}

.composer-image-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.composer-image-status.is-warning {
  color: #b45309;
}

.composer-image-meta-grid {
  display: grid;
  gap: 0.55rem 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.composer-image-meta-grid > div {
  min-width: 0;
}

.composer-image-meta-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.composer-image-meta-grid strong {
  display: block;
  margin-top: 0.12rem;
}

.composer-image-path {
  grid-column: 1 / -1;
}

.composer-image-actions {
  display: grid;
  align-items: start;
  gap: 0.9rem;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1.25rem;
}

.composer-image-action-buttons {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.composer-image-action-buttons .button,
.composer-image-upload-form .button {
  height: 3rem;
  min-width: 9.5rem;
  justify-content: center;
  padding: 0 1rem;
  text-align: center;
  white-space: nowrap;
}

.composer-image-action-buttons .inline-form {
  display: contents;
}

.composer-image-variant-viewer {
  position: relative;
}

.composer-image-variant-viewer > summary {
  list-style: none;
}

.composer-image-variant-viewer > summary::-webkit-details-marker {
  display: none;
}

.composer-image-variant-viewer__panel {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 0.5rem);
  display: grid;
  width: min(560px, calc(100vw - 2rem));
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.composer-image-variant-preview {
  display: grid;
  min-width: 0;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}

.composer-image-variant-preview:hover,
.composer-image-variant-preview:focus-visible {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(37, 99, 235, 0.04);
}

.composer-image-variant-preview__media {
  position: relative;
  display: block;
  width: 96px;
  overflow: hidden;
  border-radius: 8px;
  background: #111827;
}

.composer-image-variant-preview__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-image-variant-preview__body {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.composer-image-variant-preview__body strong {
  font-size: 0.85rem;
}

.composer-image-variant-preview__body span {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.composer-image-upload-form {
  display: grid;
  align-items: start;
  gap: 0.7rem;
  justify-content: start;
  grid-template-columns: minmax(260px, 420px) auto;
}

.composer-image-upload-field {
  display: grid;
  min-width: 0;
  gap: 0.3rem;
}

.composer-image-upload-guidance {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.composer-image-upload-form input[type="file"] {
  width: 100%;
  min-height: 48px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.composer-image-upload-form input[type="file"]::file-selector-button {
  margin-right: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
}

.composer-image-adjust-card {
  overflow: visible;
}

.composer-image-adjust-layout {
  display: grid;
  align-items: start;
  gap: 1.25rem;
  grid-template-columns: minmax(420px, 1fr) minmax(300px, 380px);
}

.composer-image-adjust-workbench,
.composer-image-adjust-preview-panel {
  display: grid;
  gap: 1rem;
}

.composer-image-variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.composer-image-variant-tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
}

.composer-image-variant-tab.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.composer-image-crop-frame-shell {
  min-height: 560px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-muted);
}

.composer-image-crop-stage {
  position: relative;
  width: 100%;
  height: clamp(520px, 62vh, 640px);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    #18202e;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
  cursor: grab;
  touch-action: none;
}

.composer-image-crop-stage.is-dragging {
  cursor: grabbing;
}

.composer-image-crop-stage img,
.composer-image-preview-frame img {
  position: absolute;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.composer-image-crop-window {
  position: absolute;
  z-index: 2;
  border: 2px solid #fff;
  border-radius: 12px;
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.52),
    0 14px 36px rgba(15, 23, 42, 0.28);
  outline: 1px solid rgba(37, 99, 235, 0.75);
  pointer-events: none;
}

.composer-image-crop-window::before,
.composer-image-crop-window::after {
  position: absolute;
  inset: 33.333% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.55);
  content: "";
}

.composer-image-crop-window::after {
  inset: 66.666% 0 auto;
}

.composer-image-crop-meta {
  min-height: 1.5rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.composer-image-crop-meta.is-warning {
  color: #b45309;
}

.composer-image-adjust-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.composer-image-zoom-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: min(100%, 320px);
  font-size: 0.9rem;
  font-weight: 700;
}

.composer-image-zoom-control input {
  flex: 1 1 auto;
}

.composer-image-adjust-preview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.composer-image-preview-card {
  display: grid;
  grid-template-rows: 180px auto;
  gap: 0.65rem;
}

.composer-image-preview-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.composer-image-preview-frame {
  position: relative;
  max-width: 100%;
  max-height: 180px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111;
}

.composer-image-preview-footer {
  display: grid;
  gap: 0.2rem;
  min-height: 3.2rem;
}

.composer-image-preview-card strong {
  font-size: 0.85rem;
}

.composer-image-preview-card span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.composer-profile-editor-layout,
.composer-story-editor-layout {
  display: grid;
  align-items: start;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
}

.composer-story-editor-list {
  display: grid;
  gap: 1rem;
}

.composer-story-authoring-toolbar,
.composer-story-registered-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.composer-story-unsaved-list {
  display: grid;
  gap: 1rem;
}

.composer-story-unsaved-list:empty {
  display: none;
}

.composer-story-registered-header {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.composer-story-registered-header h3 {
  margin: 0;
}

.composer-story-empty {
  border: 1px dashed var(--composer-panel-border);
  border-radius: 8px;
  margin: 0;
  padding: 1rem;
  text-align: center;
}

.composer-unsaved-story-card {
  border-style: dashed;
}

.composer-preview-editor-card .discovery-card-header__actions {
  align-items: center;
}

.composer-app-preview-panel {
  min-width: 0;
  position: sticky;
  top: 5rem;
}

.composer-app-preview {
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.9);
}

.composer-app-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0.75rem 0.85rem;
}

.composer-app-preview__surface {
  background: #0f0f10;
  padding: 0.85rem;
}

.composer-registered-story-preview {
  margin-top: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 8px;
  background: #0f0f10;
  padding: 0.85rem;
}

.composer-profile-app-screen,
.composer-story-app-card {
  max-width: 390px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 50% 0%, rgba(126, 95, 65, 0.34), transparent 34%),
    linear-gradient(180deg, #27231f 0%, #171514 44%, #080808 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.28);
  color: #f7f2eb;
}

.composer-profile-app-screen {
  display: grid;
  gap: 2rem;
  max-width: 335px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.composer-profile-app-hero {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1rem;
  min-width: 0;
  text-align: center;
}

.composer-profile-app-portrait,
.composer-story-app-avatar {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 242, 235, 0.68);
  text-align: center;
}

.composer-profile-app-portrait {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.composer-profile-app-portrait img,
.composer-story-app-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-profile-app-screen h3 {
  display: grid;
  gap: 0.625rem;
  justify-items: center;
  margin: 0;
  color: #fffaf3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.composer-profile-app-name__group {
  display: grid;
  gap: 0.625rem;
  justify-items: center;
  max-width: 100%;
  min-width: 0;
}

.composer-profile-app-name__line {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.composer-profile-app-name__line--secondary {
  color: rgba(255, 250, 243, 0.92);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

.composer-profile-app-name__line--primary {
  color: #fffaf3;
}

.composer-profile-app-quote {
  max-width: 100%;
  margin: 0;
  color: #e6e6e6;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: pre-line;
}

.composer-profile-app-stats {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-radius: 16px;
  background: #343332;
  padding: 0.75rem 0;
}

.composer-profile-app-stats div {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  min-width: 0;
  min-height: 3rem;
  padding: 0 0.65rem;
  text-align: center;
}

.composer-profile-app-stats div:not(:last-child)::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  content: "";
}

.composer-profile-app-stats dt {
  margin: 0 0 0.5rem;
  color: #cdcccb;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
}

.composer-profile-app-stats dd {
  margin: 0;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.composer-story-app-card {
  display: grid;
  gap: 1rem;
  border-radius: 24px;
  padding: 1rem;
}

.composer-story-app-card__header {
  display: grid;
  align-items: center;
  gap: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr);
}

.composer-story-app-avatar {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  font-size: 0.62rem;
  font-weight: 800;
}

.composer-story-app-card__header strong,
.composer-story-app-card__header p {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

.composer-story-app-card__header strong {
  color: #fffaf3;
  font-size: 0.96rem;
  line-height: 1.25;
}

.composer-story-app-card__header p {
  margin-top: 0.2rem;
  color: rgba(247, 242, 235, 0.58);
  font-size: 0.76rem;
  font-weight: 700;
}

.composer-story-app-body p {
  margin: 0;
  color: rgba(247, 242, 235, 0.88);
  font-size: 0.94rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.composer-story-app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 1.8rem;
}

.composer-story-app-tags span {
  border: 1px solid rgba(224, 169, 94, 0.2);
  border-radius: 999px;
  background: rgba(166, 104, 45, 0.28);
  color: #f9dfbd;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.42rem 0.58rem;
}

.composer-story-app-tags .composer-story-app-tags__empty {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(247, 242, 235, 0.58);
}

@media (max-width: 520px) {
  .composer-profile-app-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .composer-profile-app-stats div {
    padding: 0 0.45rem;
  }
}

@media (max-width: 1040px) {
  .composer-profile-form-grid,
  .composer-profile-editor-layout,
  .discovery-profile-editor-layout,
  .composer-story-form-grid,
  .composer-story-editor-layout,
  .discovery-source-facts,
  .composer-image-layout,
  .composer-image-adjust-layout,
  .composer-image-actions,
  .composer-image-upload-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .composer-image-variant-viewer__panel {
    position: static;
    width: 100%;
    margin-top: 0.6rem;
    grid-template-columns: minmax(0, 1fr);
  }

  .composer-image-action-buttons {
    justify-content: flex-start;
  }

  .composer-image-upload-form {
    justify-content: stretch;
  }

  .composer-profile-catalog,
  .discovery-source-piece-card {
    grid-column: 1 / -1;
  }

  .discovery-card-header,
  .discovery-work-section-card__header,
  .discovery-source-piece-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .discovery-card-header__actions {
    justify-content: flex-start;
  }

  .discovery-profile-preview-panel,
  .composer-app-preview-panel {
    position: static;
    top: auto;
  }

  .composer-image-crop-frame-shell {
    min-height: 360px;
  }

  .composer-image-crop-stage {
    height: 420px;
  }

  .composer-image-adjust-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .discovery-repeatable-item__header,
  .discovery-story-block-form__header,
  .discovery-movement-overview-panel__body,
  .discovery-work-section-card__body {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .discovery-work-section-card__preview {
    position: static;
  }

  .discovery-order-field {
    max-width: none;
  }

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

  [data-discovery-card="work-sections-root"] .i18n-field-grid,
  [data-discovery-card="work-sections-root"] .discovery-work-row-item .i18n-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.legal-documents-meta-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.legal-documents-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.legal-documents-meta-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legal-documents-guidance {
  height: 100%;
}

.legal-documents-guidance-list {
  margin: 0;
  padding-left: 1.25rem;
}

.legal-documents-guidance-list li + li {
  margin-top: 0.5rem;
}

.legal-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 1.25rem;
}

.legal-preview-body > :first-child {
  margin-top: 0;
}

.legal-preview-body > :last-child {
  margin-bottom: 0;
}

.legal-preview-body h1,
.legal-preview-body h2,
.legal-preview-body h3,
.legal-preview-body h4,
.legal-preview-body h5,
.legal-preview-body h6 {
  margin: 1.25rem 0 0.75rem;
}

.legal-preview-body p,
.legal-preview-body ul,
.legal-preview-body ol {
  margin: 0 0 0.9rem;
}

.legal-preview-body ul,
.legal-preview-body ol {
  padding-left: 1.5rem;
}

.legal-preview-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 0.9rem;
}

.legal-preview-body th,
.legal-preview-body td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.legal-preview-body thead th {
  background: var(--surface-muted);
  font-weight: 700;
}

.legal-preview-body li + li {
  margin-top: 0.35rem;
}

.legal-preview-body a {
  color: var(--primary);
  text-decoration: underline;
}

.table td.actions {
  display: flex;
  gap: 0.5rem;
}

.composer-profiles-table td.actions {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}

.composer-profiles-table td.actions .button {
  min-width: 4.5rem;
}

.composer-profiles-table .mocl-table-actions .button {
  min-width: 0;
}

.composer-profiles-table td.actions .button + .button {
  margin-left: 0.5rem;
}

.composer-profiles-table .mocl-table-actions .button + .button {
  margin-left: 0;
}

.mocl-table td.actions {
  display: table-cell;
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.badge.warning {
  background: rgba(249, 115, 22, 0.15);
  color: #c2410c;
}

.badge.danger {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

/* Stats grid for status pages */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.15));
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
  text-align: center;
  min-width: 160px;
  flex: 0 0 auto;
}

.stat-tile--warning {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.2));
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.1);
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.1;
}

.stat-tile--warning .stat-value {
  color: #c2410c;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 640px) {
  .card {
    padding: 1.25rem;
  }

  .stat-tile {
    flex: 1 1 100%;
  }
}

/* Status page table with horizontal scroll and no text wrapping */
.status-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
  display: block;
}

.status-table {
  white-space: nowrap;
  width: 100%;
  min-width: 600px; /* Force table to be wide enough to trigger scroll */
}

.status-table.mocl-table--status-pieces {
  min-width: 2060px;
}

.status-table.mocl-table--status-audit {
  min-width: 900px;
}

.status-table th,
.status-table td {
  white-space: nowrap;
}

.status-table .annotation-code {
  white-space: nowrap;
}

/* Status table: actions column */
.status-table td.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-table.mocl-table td.actions {
  display: table-cell;
}

/* Status table: totals row */
.status-table__totals {
  background: var(--surface-muted);
  border-top: 2px solid var(--border);
}

.status-table__totals td {
  font-weight: 600;
}

/* Mobile scroll hint - hidden by default on desktop */
.status-scroll-hint {
  display: none;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.admin-users-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-users-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.admin-users-table__row--selected {
  background: rgba(37, 99, 235, 0.08);
}

.admin-user-detail-card {
  position: static;
}

.admin-user-detail-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.admin-user-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.admin-user-detail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.admin-user-detail__label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-user-detail-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.admin-user-detail-section h3 {
  margin: 0 0 0.5rem;
}

.admin-user-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-user-action-group form {
  margin: 0;
}

.admin-user-empty-state {
  margin: 0;
}

.status-lazy-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.status-lazy-note {
  margin-top: 0.8rem;
}

.status-lazy-note--error {
  color: var(--danger);
}

.annotation-results {
  display: grid;
  gap: 1.75rem;
  margin-top: 1.5rem;
}

.annotation-result {
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

/* Highlight existing results with a green-tinted background */
.annotation-result--exists {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.3);
}

.annotation-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.annotation-result-title {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0; /* allow wrapping within flex container */
  word-break: break-word;
}

.annotation-result-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0; /* keep actions from shrinking too much */
}

/* Ensure consistent button widths in the actions area */
.annotation-result-actions .button {
  min-width: 140px;
  white-space: nowrap;
  min-height: 44px; /* equalize vertical size across link and form button */
}

/* Wide mode: make anchor and form occupy equal widths */
.annotation-result-actions > a.button,
.annotation-result-actions > .annotation-select-form {
  flex: 1 1 0;
}
/* Make the form fill its flex area so the inner button can match the link size */
.annotation-result-actions > .annotation-select-form {
  display: flex;
}
.annotation-result-actions > .annotation-select-form .button {
  width: 100%;
}

.annotation-result h2 {
  font-size: 1.1rem;
  margin: 0;
}

.annotation-select-form {
  margin: 0;
  display: inline-flex;
}

.annotation-empty {
  margin-top: 1.5rem;
}

.annotation-selection .form-actions {
  margin-top: 0.5rem;
}

.annotation-selection h2 {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.annotation-audio-field select {
  width: 100%;
}


.audio-card {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.audio-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.audio-page-header-text {
  flex: 1 1 240px;
}

.audio-toolbar-card {
  margin-bottom: 2rem;
}

.audio-toolbar {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.audio-toolbar-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.audio-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.audio-input,
.audio-select {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  min-width: 220px;
}

.audio-select {
  min-width: 200px;
}

.audio-input:focus,
.audio-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

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

.audio-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.audio-summary-note {
  margin: 0;
  font-size: 0.85rem;
}

.audio-summary-stat {
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.15));
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-summary-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.audio-summary-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.audio-collections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.audio-collection-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
}

.audio-collection-pill.muted {
  background: rgba(95, 108, 123, 0.1);
  color: var(--text-muted);
}

.audio-table-wrapper {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(208, 215, 227, 0.6);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.audio-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.audio-table thead {
  background: rgba(15, 23, 42, 0.04);
}

.audio-table th {
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(208, 215, 227, 0.6);
}

.audio-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(208, 215, 227, 0.35);
  vertical-align: middle;
  background: #fff;
}

.audio-row:last-child td {
  border-bottom: none;
}

.audio-row:hover td {
  background: rgba(37, 99, 235, 0.06);
}

.audio-row.is-playing td {
  background: rgba(37, 99, 235, 0.08);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.audio-control-cell {
  width: 72px;
}

.audio-control {
  --audio-icon-color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(37, 99, 235, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.audio-control:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.audio-control:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.audio-control.is-playing {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  --audio-icon-color: #fff;
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.35);
}

.audio-control-icon {
  position: relative;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.audio-control-icon::before,
.audio-control-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.2s ease;
  background: var(--audio-icon-color);
  border-radius: 1px;
}

.audio-control-icon::before {
  left: 6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent var(--audio-icon-color);
  background: transparent;
}

.audio-control-icon::after {
  left: 12px;
  width: 0;
  height: 0;
  opacity: 0;
}

.audio-control.is-playing .audio-control-icon::before {
  border-width: 0;
  border-color: transparent;
  width: 4px;
  height: 14px;
  left: 6px;
  background: var(--audio-icon-color);
}

.audio-control.is-playing .audio-control-icon::after {
  opacity: 1;
  width: 4px;
  height: 14px;
}

.audio-title {
  font-weight: 600;
  color: var(--text);
}

.audio-collection {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(95, 108, 123, 0.12);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.audio-size {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.audio-path {
  max-width: 480px;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: var(--surface-muted);
  overflow-x: auto;
  white-space: nowrap;
  border: 1px solid rgba(208, 215, 227, 0.6);
}

.audio-path:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.audio-path code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.audio-element {
  display: none;
}

.audio-empty-state {
  text-align: center;
  padding: 2rem 1rem;
}

.audio-empty-state h2 {
  margin-bottom: 0.5rem;
}

.audio-pagination,
.annotation-pagination {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.audio-pagination-links,
.annotation-pagination-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.audio-pagination-status,
.annotation-pagination-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.audio-pagination-buttons,
.annotation-pagination-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.audio-page-link,
.annotation-page-link,
.audio-page-ellipsis,
.annotation-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(208, 215, 227, 0.9);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.audio-page-link:hover,
.annotation-page-link:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--primary);
}

.audio-page-link.is-active,
.annotation-page-link.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
  color: #fff;
  cursor: default;
}

.audio-page-ellipsis {
  border: none;
  background: transparent;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .site-header .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  /* Ensure code and links wrap on small screens within annotation area */
  .annotation-grid code,
  .annotation-grid a,
  .annotation-grid .annotation-card-subtitle {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .annotation-grid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .nav {
    position: relative;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.6rem;
    width: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    -webkit-tap-highlight-color: transparent;
  }

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

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--header-height, 72px));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 0;
    padding: 1rem var(--workspace-padding-inline);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    z-index: 100;
    border-bottom: 1px solid rgba(208, 215, 227, 0.5);
  }

  .nav.is-nav-open .nav-links {
    display: flex;
  }

  .nav-link,
  .nav-dropdown,
  .nav .button,
  .nav .inline-form {
    width: 100%;
  }

  .nav-link {
    justify-content: center;
    padding: 0.65rem 1rem;
    border-radius: 12px;
  }

  .nav-dropdown {
    flex-direction: column;
  }

  .nav-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    border-radius: 12px;
  }

  .nav-dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 0.4rem;
    box-shadow: none;
    padding: 0.2rem 0.35rem;
  }

  .nav-dropdown-menu::before {
    display: none;
  }

  .nav .button {
    box-shadow: none;
  }

  .nav .inline-form {
    display: flex;
  }

  .nav .inline-form .button {
    width: 100%;
  }

  .table td.actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .mocl-table--status-pieces {
    --mocl-sticky-1-width: 180px;
    --mocl-sticky-2-width: 260px;
    --mocl-sticky-3-width: 220px;
  }

  .mocl-table .mocl-sticky-right {
    position: static;
    width: auto;
    min-width: var(--mocl-actions-width, 180px);
    max-width: none;
    border-left: 0;
    box-shadow: none;
  }

  .mocl-table .mocl-sticky-right::before {
    display: none;
  }

  .mocl-table-actions {
    justify-content: flex-start;
  }

  /* Status table mobile improvements */
  .status-scroll-hint {
    display: block;
  }

  .status-table__composer,
  .status-table__title {
    white-space: normal;
    min-width: 120px;
    max-width: 200px;
  }

  .mocl-table .mocl-sticky-left--1,
  .mocl-table .mocl-sticky-left--2,
  .mocl-table .mocl-sticky-left--3 {
    max-width: var(--mocl-sticky-1-width, 220px);
    white-space: nowrap;
  }

  .mocl-table .mocl-sticky-left--2 {
    max-width: var(--mocl-sticky-2-width, 280px);
  }

  .mocl-table .mocl-sticky-left--3 {
    max-width: var(--mocl-sticky-3-width, 240px);
  }

  .status-table td.actions {
    display: table-cell;
  }

  .status-table .mocl-table-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
  }

  .status-table .mocl-table-actions .button {
    width: 100%;
    justify-content: center;
  }

  .admin-users-heading,
  .admin-user-detail-card__header {
    flex-direction: column;
  }

  .admin-user-detail-card {
    position: static;
  }

  .admin-user-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-user-action-group {
    flex-direction: column;
  }

  .admin-user-action-group form,
  .admin-user-action-group .button {
    width: 100%;
  }

  .audio-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .audio-toolbar-fields {
    width: 100%;
  }

  .audio-input,
  .audio-select {
    width: 100%;
    min-width: 0;
  }

  .audio-pagination {
    justify-content: center;
  }

  .audio-pagination-links {
    align-items: center;
  }
}

@media (max-width: 640px) {
  .mocl-table .mocl-sticky-left,
  .mocl-table .mocl-sticky-right {
    position: static;
    width: auto;
    min-width: 0;
    max-width: none;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .mocl-table .mocl-sticky-left--last::after,
  .mocl-table .mocl-sticky-right::before {
    display: none;
  }

  .mocl-sticky-content {
    white-space: normal;
  }

  .mocl-table-scroll {
    align-items: stretch;
  }
}

/* Sticky annotation audio player */
.annotation-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #111;
  color: #fff;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.5rem 1rem;
  /* Ensure controls sit above the iOS home indicator */
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}
.annotation-player__button {
  appearance: none;
  border: none;
  background: #fff;
  color: #111;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  font-weight: 700;
  cursor: pointer;
}
.annotation-player__button.is-playing {
  background: #f33;
  color: #fff;
}
.annotation-player__track {
  position: relative;
  flex: 1 1 auto;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
}
.annotation-player__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: #0bd;
  border-radius: 4px;
}
.annotation-player__time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  min-width: 120px;
  text-align: right;
}

/* Volume controls */
.annotation-player__volume {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 160px;
}
.annotation-player__mute {
  appearance: none;
  border: none;
  background: #fff;
  color: #111;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 0.9rem;
  cursor: pointer;
}
.annotation-player__mute.is-muted {
  background: #666;
  color: #fff;
}
.annotation-player__vol-range {
  width: 120px;
  height: 6px;
}

/* Mobile: single-row layout for audio player */
@media (max-width: 768px) {

  /* Play/Pause button (left) */
  .annotation-player__button {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 16px;
  }

  /* Playbar (flexible width) */
  .annotation-player__track {
    flex: 1 1 auto;
    display: flex !important;
    min-width: 0;
    height: 8px;
  }

  /* Time display */
  .annotation-player__time {
    flex: 0 0 auto;
    display: block !important;
    font-variant-numeric: tabular-nums;
    font-size: 0.7rem;
    opacity: 0.85;
    white-space: nowrap;
    min-width: 105px;
    text-align: right;
    padding-right: 0.25rem;
  }

  /* Mute button only (hide volume slider) */
  .annotation-player__volume {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    margin-left: -0.2rem;
    min-width: 0;
    gap: 0;
    width: auto;
  }

  .annotation-player__vol-range {
    display: none !important;
    width: 0 !important;
  }

  .annotation-player__mute {
    flex: 0 0 auto;
  }
}

/* =========================================================
 * Mobile overflow fixes for Annotation pages (≤768px)
 * - Prevent page-level horizontal scroll
 * - Wrap long code, IDs, paths, and field values
 * - Contain tables and tree views within their containers
 * ========================================================= */

/* Global safeguard: prevent entire page from scrolling horizontally */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Wrap long code blocks, IDs, and identifiers */
.annotation-code,
.annotation-code pre,
.annotation-code code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Wrap annotation field values and text */
.annotation-field-value,
.annotation-field-text {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.annotation-field-value a,
.annotation-field-text a {
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* Wrap long audio paths */
.annotation-audio-path,
.annotation-audio-path code,
.annotation-audio-path a {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* Ensure tree container scrolls horizontally without expanding page */
.annotation-tree-container {
  max-width: 100%;
  min-width: 0;
}

/* Ensure table wrapper contains wide tables without page overflow */
.audio-table-wrapper {
  max-width: 100%;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
  /* Prevent horizontal scroll on the entire page */
  main.container {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Constrain annotation cards and ensure children don't overflow */
  .annotation-card {
    max-width: 100%;
    overflow-x: hidden;
  }

  .annotation-card * {
    max-width: 100%;
  }

  /* Ensure annotation card containers allow wrapping */
  .annotation-card,
  .annotation-card .card-body,
  .annotation-card .card-content {
    min-width: 0;
  }

  /* Force normal wrapping for code and text in cards */
  .annotation-card pre,
  .annotation-card code,
  .annotation-card .annotation-field-value,
  .annotation-card .annotation-field-text {
    white-space: normal;
  }

  /* Fix inline field values (like ID) to wrap downward instead of overlapping */
  .annotation-field--inline {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.5rem;
  }

  .annotation-field-value--inline {
    text-align: left;
    justify-self: start;
    margin-top: 0.25rem;
  }

  /* Keep label styling consistent on mobile */
  .annotation-field--inline .annotation-field-label {
    width: fit-content;
  }

  /* Ensure audio table wrapper has proper margins on mobile and forces scroll */
  .audio-table-wrapper,
  .status-table-wrapper {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: calc(100vw - 2rem); /* Account for container padding */
    display: block;
    overflow-x: auto;
  }

}


/* Make ID field bold and prominent in Firebase Annotations */
.annotation-card .annotation-field:first-child .annotation-field-label,
.annotation-card .annotation-field:first-child .annotation-field-value {
  font-weight: 700;
  font-size: 1.1rem;
}

.annotation-card .annotation-field:first-child .annotation-field-label {
  background: rgba(37, 99, 235, 0.18);
}

.annotation-card .annotation-field:first-child .annotation-field-value {
  color: var(--primary-dark);
}

/* ==============================================
 * Mobile-specific tweaks for Annotation page
 * - Hide Annotated + MSID columns in audio table
 * - Compact table layout and wrap long paths
 * - Stack IMSLP result actions and make them full-width
 * ============================================== */
@media (max-width: 768px) {
  /* Audio sources table: hide Annotated (2) and Music Source ID (5) */
  .audio-table th:nth-child(2),
  .audio-table td:nth-child(2),
  .audio-table th:nth-child(5),
  .audio-table td:nth-child(5) {
    display: none;
  }

  /* Make table more compact and allow smaller width */
  .audio-table {
    min-width: 520px; /* allow tighter fit on mobile than the desktop 720px */
    table-layout: fixed;
    font-size: 0.9rem;
  }

  .audio-table th,
  .audio-table td {
    padding: 0.6rem 0.7rem;
    vertical-align: middle;
  }

  /* Column widths using original indices:
     1=Select, 3=Preview, 4=Audio path (flex) */
  .audio-table th:nth-child(1),
  .audio-table td:nth-child(1) {
    width: 84px; /* widen to avoid overlap with Select button */
  }

  .audio-table th:nth-child(3),
  .audio-table td:nth-child(3) {
    width: 140px;
  }

  .audio-table th:nth-child(4),
  .audio-table td:nth-child(4) {
    width: auto;
  }

  /* Constrain audio player in Preview column (minimal controls look) */
  .audio-table td:nth-child(3) audio {
    width: 120px;
    max-width: 40vw; /* ensure it fits narrow screens */
    height: 28px;
    display: inline-block;
    overflow: hidden;
  }
  /* Hide timeline and less-crucial controls in WebKit-based browsers */
  .audio-table td:nth-child(3) audio::-webkit-media-controls-timeline,
  .audio-table td:nth-child(3) audio::-webkit-media-controls-current-time-display,
  .audio-table td:nth-child(3) audio::-webkit-media-controls-time-remaining-display,
  .audio-table td:nth-child(3) audio::-webkit-media-controls-seek-back-button,
  .audio-table td:nth-child(3) audio::-webkit-media-controls-seek-forward-button,
  .audio-table td:nth-child(3) audio::-webkit-media-controls-volume-slider {
    display: none !important;
  }

  /* Wrap long audio paths */
  .audio-table td:nth-child(4),
  .audio-table td:nth-child(4) code {
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    display: block;
  }

  /* Slightly smaller small buttons inside the table */
  .audio-table .button.small {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
  }

  /* Keep horizontal scroll available if still needed */
  .audio-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* IMSLP results: stack title and actions; make buttons full-width */
  .annotation-result-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .annotation-result-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .annotation-result-actions .button {
    width: 100%;
    min-width: 0;
  }

  /* Ensure the form wrapper doesn't shrink to content so its button can fill width */
  .annotation-result-actions .annotation-select-form {
    display: block;
    width: 100%;
  }
  .annotation-result-actions .annotation-select-form .button {
    width: 100%;
  }
}

/* Music source register */
.music-source-card {
  display: grid;
  gap: 1rem;
}

.music-source-results {
  display: grid;
  gap: 1.25rem;
}

.music-source-results__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.music-source-results__ids {
  display: grid;
  gap: 0.75rem;
  min-width: 240px;
}

.music-source-results__ids .annotation-code {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.id-row {
  display: grid;
  gap: 0.25rem;
}

.music-source-results__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.meta-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--surface-muted);
  min-height: 110px;
}

.meta-label {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta-value {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.music-source-results__movements {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.music-source-results__movements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.movement-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.movement-list {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 0.75rem;
}

.movement-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.movement-row__info {
  display: grid;
  gap: 0.5rem;
}

.movement-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.movement-row__label {
  margin: 0;
  font-weight: 700;
  color: var(--text-muted);
}

.movement-row__fields {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: minmax(120px, 160px) minmax(220px, 1fr);
}

.movement-field {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(208, 215, 227, 0.8);
}

.movement-field-input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.movement-field-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.movement-field-value {
  font-weight: 700;
  color: var(--text);
}

.movement-upload-field {
  align-self: stretch;
}

.movement-upload-row {
  width: 100%;
}

.movement-upload-controls {
  display: grid;
  gap: 0.35rem;
}

.movement-upload.is-uploaded {
  background: #f9e79f;
  border-color: #f1c40f;
  color: #5d4b00;
}

.movement-upload.is-disabled {
  background: #fff;
  border-color: var(--border);
  color: var(--text-muted);
  pointer-events: none;
  cursor: not-allowed;
}

.movement-upload.is-pending {
  background: #e8f7ec;
  border-color: #2ecc71;
  color: #1b5e20;
}

.movement-upload__name {
  font-size: 0.9rem;
  color: var(--text-muted);
  word-break: break-word;
}

.movement-upload__status {
  font-size: 0.9rem;
  color: var(--text-muted);
  word-break: break-word;
}

.movement-upload__audio-id {
  display: grid;
  gap: 0.25rem;
  align-items: center;
}

.movement-upload__audio-duration {
  display: grid;
  gap: 0.25rem;
  align-items: center;
}

.movement-upload__audio-id-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.movement-upload__audio-id-value {
  max-width: 100%;
  overflow-wrap: anywhere;
  display: inline-block;
}

.movement-upload__audio-duration-value {
  font-weight: 700;
  color: var(--text);
}

.movement-audio {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(208, 215, 227, 0.8);
}

.movement-audio__label {
  margin: 0;
  font-weight: 700;
  color: var(--text-muted);
}

.movement-audio__player {
  width: 100%;
}

.movement-audio__clip {
  display: grid;
  gap: 0.35rem;
}

.movement-audio__clip-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.movement-audio__clip-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.movement-audio__clip-input {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  width: 8.5rem;
}

.movement-audio__clip-sep {
  color: var(--text-muted);
  font-weight: 600;
}

.movement-audio__clip-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.movement-audio__hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.movement-upload__status.is-error {
  color: var(--danger, #b91c1c);
  font-weight: 700;
}

.movement-upload__status.is-pending {
  color: var(--primary, #2563eb);
  font-weight: 500;
}

.movement-upload-meta {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed rgba(37, 99, 235, 0.3);
}

.movement-upload-meta__field {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text);
}

.movement-upload-meta__field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.movement-upload-meta__copy-btn {
  margin-left: auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

.movement-upload-meta__input {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  width: 100%;
}

.movement-upload-meta__textarea {
  min-height: 110px;
  resize: vertical;
}

@media (max-width: 640px) {
  .movement-row__fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .movement-upload-row {
    grid-column: 1 / -1;
  }
  .movement-upload-controls .button {
    width: 100%;
  }
}

.sticky-audio {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(135deg, #0f172a, #13274b 45%, #0b224b);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -12px 32px rgba(6, 14, 26, 0.35);
}

.sticky-audio__inner {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  gap: 0.75rem;
}

.sticky-audio__controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.sticky-audio__controls select {
  flex: 1 1 260px;
  min-width: 200px;
  max-width: 420px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  backdrop-filter: blur(10px);
}

.sticky-audio__controls select:disabled {
  opacity: 0.7;
}

.sticky-audio__status {
  margin: 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  max-width: 640px;
}

.sticky-audio__status.is-error {
  color: #fecaca;
}

.sticky-audio__status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.4);
}

.sticky-audio__status-dot.is-ready {
  background: #22c55e;
}

.sticky-audio__status-dot.is-loading {
  background: #fbbf24;
}

.sticky-audio__status-dot.is-missing {
  background: #f87171;
}

.sticky-audio__player {
  width: 100%;
  display: flex;
}

.sticky-audio__player audio {
  width: 100%;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.25rem;
}

.sticky-audio-spacer {
  height: 30px;
  pointer-events: none;
}

@media (max-width: 640px) {
  /* Mobile: music source register tweaks */
  main.container {
    padding: 1.5rem 1rem 4rem;
  }

  .card.music-source-card,
  .card.music-source-results {
    padding: 1.25rem;
  }

  .music-source-results__header {
    flex-direction: column;
    align-items: stretch;
  }

  .music-source-results__ids {
    width: 100%;
    min-width: 0;
  }

  .music-source-results__grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .music-source-results__movements-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .movement-accordion {
    padding: 0.9rem;
    overflow: hidden;
  }

  .movement-accordion__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .movement-accordion__actions .button {
    flex: 1 1 140px;
  }

  .movement-highlights__actions {
    width: 100%;
  }

  .movement-highlights__actions .button {
    flex: 1 1 140px;
    min-width: 0;
  }

  .highlight-card__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .highlight-card__actions {
    width: 100%;
  }

  .highlight-card__actions .button {
    flex: 1 1 140px;
  }

  .movement-upload-meta__field-head {
    align-items: flex-start;
  }

  .movement-upload-meta__copy-btn {
    margin-left: 0;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .button {
    width: 100%;
  }

  .card-final-actions {
    justify-content: stretch;
    padding-right: 0;
  }

  .card-final-actions .inline-form {
    width: 100%;
  }

  .card-final-actions .button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .sticky-audio__inner {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sticky-audio-spacer {
    height: 40px;
  }
  .sticky-audio__status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
