body.app-body {
  position: relative;
  isolation: isolate;
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 10%, rgba(19, 91, 236, 0.11), transparent 24%),
    radial-gradient(circle at 88% 16%, rgba(94, 140, 255, 0.09), transparent 22%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--content-width), calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.page-shell.is-piece-view {
  width: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-bottom: 8px;
  min-height: 60px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line-soft);
  color: var(--text-base);
  min-width: 0;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  max-width: min(100%, 340px);
}

.user-pill strong,
.user-pill span {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill strong {
  font-size: 14px;
}

.user-pill span {
  font-size: 12px;
  color: var(--text-muted);
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.app-layout.is-single-pane {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0;
}

.app-sidebar,
.app-main {
  min-width: 0;
}

.app-sidebar-card,
.surface-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  background: var(--bg-panel);
  box-shadow: var(--shadow-md);
}

.app-sidebar-card {
  padding: 20px;
  position: sticky;
  top: 24px;
}

.nav-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  border: 1px solid transparent;
  color: var(--text-base);
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.84);
  border-color: var(--line-soft);
}

.nav-link.is-active {
  background: linear-gradient(180deg, rgba(19, 91, 236, 0.14), rgba(19, 91, 236, 0.08));
  border-color: rgba(19, 91, 236, 0.2);
  color: var(--accent);
}

.nav-link strong {
  font-size: 15px;
}

.nav-link span {
  font-size: 13px;
  color: var(--text-muted);
}

.nav-link.is-active span {
  color: rgba(19, 91, 236, 0.85);
}

.app-main {
  display: grid;
  gap: 20px;
}

.app-main.is-full-width {
  gap: 0;
}

.hero-card {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0;
  font-size: clamp(32px, 4.8vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 64ch;
  color: var(--text-base);
  font-size: 17px;
  line-height: 1.6;
}

.hero-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button,
.ghost-button,
.subtle-button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, filter 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.button {
  background: linear-gradient(135deg, var(--accent), #4f86ff);
  color: #fff;
  box-shadow: 0 14px 30px rgba(19, 91, 236, 0.24);
  font-weight: 700;
}

.button:hover,
.ghost-button:hover,
.subtle-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.button:disabled,
.ghost-button:disabled,
.subtle-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.ghost-button {
  background: var(--bg-panel-strong);
  border: 1px solid var(--line-base);
  color: var(--text-strong);
  font-weight: 600;
}

.subtle-button {
  background: rgba(19, 91, 236, 0.08);
  color: var(--accent);
  font-weight: 700;
}

.text-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

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

.feature-card,
.placeholder-card {
  padding: 22px;
}

.feature-card h3,
.placeholder-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.feature-card p,
.placeholder-card p,
.muted-copy {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.stack {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-title {
  margin: 0;
  font-size: 21px;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-base);
}

.field,
.textarea,
.select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line-base);
  background: #fff;
  color: var(--text-strong);
  padding: 14px 15px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input[list].field {
  background: #fff;
}

.textarea {
  min-height: 112px;
  resize: vertical;
}

.field:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(19, 91, 236, 0.42);
  box-shadow: 0 0 0 4px rgba(19, 91, 236, 0.12);
}

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

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--bg-accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.status-note {
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.status-note.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.status-note.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-note.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  padding: 34px 22px;
  border: 1px dashed var(--line-base);
  border-radius: 20px;
  text-align: center;
  color: var(--text-muted);
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.toolbar-row > .label {
  flex: 1 1 260px;
}

.toolbar-row > .label.is-compact {
  flex: 0 1 220px;
}

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

.list-item-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line-soft);
}

.list-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.list-item-title {
  margin: 0;
  font-size: 19px;
}

.list-item-copy {
  margin: 6px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.list-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.library-index-wrap {
  margin-top: 14px;
}

.library-index-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-index-button {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.library-index-button.is-active {
  border-color: rgba(19, 91, 236, 0.18);
  background: rgba(19, 91, 236, 0.08);
  color: var(--accent);
}

.library-index-button.is-active:hover {
  border-color: rgba(19, 91, 236, 0.26);
  color: var(--accent);
}

.library-index-button:disabled {
  opacity: 0.34;
  cursor: default;
}

.library-sections {
  display: grid;
  gap: 10px;
}

.library-list-stack {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: transparent;
}

.library-section {
  display: grid;
  gap: 0;
}

.library-section-header {
  position: sticky;
  top: 12px;
  z-index: 2;
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: rgba(243, 245, 248, 0.95);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.meta-pill.is-favorite {
  background: rgba(19, 91, 236, 0.1);
  color: var(--accent);
}

.meta-pill.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.meta-pill.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.meta-pill.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 13px 14px;
  background: transparent;
}

.library-row + .library-row {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.library-row-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.library-row-open {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.library-row-open:hover .library-row-title {
  color: var(--accent);
}

.library-row-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.library-row-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.library-inline-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 14px;
  line-height: 1;
}

.library-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.library-status-icon.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.library-status-icon.is-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.library-status-icon.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.library-row-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
}

.library-row-notes {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.library-row-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.library-row-action {
  appearance: none;
  border: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.library-row-action-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.library-row-action.is-danger {
  color: var(--danger);
}

.ghost-button.is-danger,
.button.is-danger,
.subtle-button.is-danger {
  border-color: rgba(220, 38, 38, 0.22);
  color: var(--danger);
}

.button.is-danger {
  background: rgba(220, 38, 38, 0.1);
}

.library-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 28px;
}

.library-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.48);
  cursor: pointer;
}

.library-dialog {
  position: relative;
  z-index: 1;
  width: min(840px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.22);
}

.library-flat-panel {
  border-radius: 18px;
  box-shadow: none;
}

.library-flat-panel .toolbar-row {
  padding: 0;
}

.library-flat-panel .field,
.library-flat-panel .select {
  border-radius: 10px;
  background: rgba(243, 245, 248, 0.95);
}

.piece-page {
  display: grid;
  gap: 0;
}

.piece-viewer-panel {
  padding: 0;
  overflow: hidden;
  min-height: 100vh;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.piece-loading-state,
.piece-stage-message {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
}

.piece-viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 322px;
  min-height: 100vh;
}

.piece-viewer-layout.is-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.piece-viewer-main {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  background: #fff;
  position: relative;
}

.piece-viewer-layout.is-sidebar-collapsed .piece-viewer-main {
  border-right: 0;
}

.piece-stage {
  position: relative;
  display: block;
  min-width: 0;
  overflow: auto;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  background: #fff;
}

.piece-stage.is-paging {
  overflow-x: hidden;
  overflow-y: auto;
}

.piece-canvas-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 18px;
  padding: 84px 18px 24px;
}

.piece-stage.is-width .piece-canvas-shell {
  justify-items: stretch;
}

.piece-stage.is-height .piece-canvas-shell {
  justify-items: center;
}

.piece-stage.is-paging .piece-canvas-shell {
  min-height: 100%;
  padding-bottom: 20px;
  align-content: start;
}

.piece-canvas-frame {
  display: inline-block;
  vertical-align: top;
  background: #fff;
}

.piece-rendered-page {
  display: block;
  width: 100%;
}

.piece-stage.is-width .piece-rendered-page {
  width: 100%;
}

.piece-stage.is-height .piece-rendered-page {
  width: auto;
}

.piece-rendered-page-track {
  display: inline-flex;
  align-items: flex-start;
  gap: 14px;
}

.piece-stage.is-width .piece-rendered-page-track {
  width: 100%;
  justify-content: center;
}

.piece-rendered-page-frame {
  display: inline-block;
  vertical-align: top;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.piece-pdf-canvas {
  display: block;
  background: #fff;
}

.piece-floating-toolbar {
  position: sticky;
  top: 14px;
  left: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  opacity: 1;
  pointer-events: auto;
}

.piece-floating-toolbar.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.piece-floating-toolbar-right {
  display: flex;
  gap: 10px;
}

.piece-floating-button {
  appearance: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(92, 92, 92, 0.86);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.piece-display-menu {
  position: absolute;
  top: 62px;
  right: 0;
  width: min(292px, calc(100vw - 64px));
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.24);
}

.piece-display-menu-item {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 12px;
  border-radius: 12px;
  color: var(--text-strong);
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.piece-display-menu-item.is-selected {
  background: rgba(15, 23, 42, 0.05);
}

.piece-display-menu-item.is-disabled {
  opacity: 0.38;
  cursor: default;
}

.piece-display-menu-item strong {
  color: #94627d;
}

.piece-display-menu-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.25);
  margin: 4px 0;
}

.piece-page-arrow-rail {
  position: sticky;
  top: calc(50vh - 26px);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  margin-top: -8px;
  pointer-events: none;
}

.piece-page-arrow {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(196, 224, 255, 0.82);
  color: #234a87;
  font-size: 30px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.piece-page-arrow-placeholder {
  width: 52px;
  height: 52px;
  display: block;
}

.piece-page-pill {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.78);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.piece-sidebar {
  display: grid;
  align-content: start;
  gap: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.98);
}

.piece-viewer-layout.is-sidebar-collapsed .piece-sidebar {
  display: none;
}

.piece-side-section + .piece-side-section {
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.piece-side-section {
  display: grid;
  gap: 14px;
  padding: 22px 18px;
}

.piece-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.piece-side-header h3 {
  margin: 0;
  font-size: 22px;
}

.piece-side-header span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.piece-side-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.piece-part-list {
  display: grid;
  gap: 8px;
  padding: 6px 0 0;
}

.piece-part-drop-hint {
  padding: 12px 14px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.piece-part-list.is-drop-active {
  outline: 2px dashed rgba(19, 91, 236, 0.34);
  outline-offset: 8px;
  border-radius: 18px;
}

.piece-part-insert-slot {
  position: relative;
  display: grid;
  place-items: center;
  height: 14px;
  margin: -2px 0;
  pointer-events: auto;
}

.piece-part-insert-line {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 160ms ease, transform 160ms ease;
}

.piece-part-insert-label {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  pointer-events: none;
  transition: background 160ms ease, color 160ms ease;
}

.piece-part-insert-slot.is-active .piece-part-insert-line {
  background: rgba(19, 91, 236, 0.48);
  transform: scaleY(1.5);
}

.piece-part-insert-slot.is-active.is-file .piece-part-insert-line {
  background: rgba(16, 185, 129, 0.5);
}

.piece-part-insert-slot.is-active .piece-part-insert-label {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-base);
}

.piece-part-button {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: transparent;
  color: var(--text-base);
  text-align: left;
  padding: 12px 14px;
  cursor: grab;
}

.piece-part-button.is-active {
  border-color: rgba(19, 91, 236, 0.25);
  background: rgba(19, 91, 236, 0.1);
}

.piece-part-button.is-replace-target {
  border-color: rgba(19, 91, 236, 0.42);
  background: rgba(19, 91, 236, 0.14);
  box-shadow: 0 0 0 3px rgba(19, 91, 236, 0.12);
}

.piece-part-button.is-dragging {
  opacity: 0.44;
  cursor: grabbing;
}

.piece-part-button-name,
.piece-part-button-meta {
  display: block;
}

.piece-part-button-name {
  font-size: 15px;
  font-weight: 700;
}

.piece-part-button-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.piece-inline-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(243, 245, 248, 0.75);
}

.piece-dropzone {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px dashed rgba(19, 91, 236, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-muted);
}

.piece-dropzone strong {
  color: var(--text-strong);
}

.piece-dropzone.is-active {
  border-color: rgba(19, 91, 236, 0.58);
  background: rgba(19, 91, 236, 0.08);
}

.piece-draft-list {
  display: grid;
  gap: 10px;
}

.piece-draft-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.piece-draft-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.piece-inline-form-actions,
.piece-inline-form-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.piece-inline-file-name {
  color: var(--text-muted);
  font-size: 13px;
}

.piece-inline-progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.piece-inline-spinner {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid rgba(19, 91, 236, 0.18);
  border-top-color: rgba(19, 91, 236, 0.88);
  animation: piece-inline-spin 0.8s linear infinite;
}

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

.piece-media-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(243, 245, 248, 0.72);
}

.piece-media-card strong,
.piece-media-card p {
  margin: 0;
}

.piece-media-card p,
.piece-empty-copy {
  color: var(--text-muted);
  line-height: 1.45;
}

.piece-media-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.library-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.library-title-count {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.library-dialog.is-compact {
  width: min(560px, calc(100vw - 40px));
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 440px);
  gap: 28px;
  align-items: center;
  padding: 24px 0;
}

.login-showcase,
.login-card {
  border: 1px solid var(--line-soft);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-lg);
}

.login-showcase {
  padding: 34px;
  min-height: 720px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
}

.login-card {
  padding: 28px;
}

.hero-preview {
  margin-top: 26px;
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(19, 91, 236, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(237, 242, 249, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.metric {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  font-size: 24px;
}

.metric span {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.text-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.ghost-button.is-danger,
.subtle-button.is-danger {
  color: #c53030;
  border: 1px solid rgba(197, 48, 48, 0.16);
  background: rgba(255, 255, 255, 0.94);
}

.ensemble-list,
.ensemble-member-list,
.ensemble-managed-list,
.ensemble-summary-stack,
.ensemble-setlist-list,
.ensemble-setlist-entry-list,
.ensemble-selection-list {
  display: grid;
  gap: 14px;
}

.ensemble-row,
.ensemble-member-row,
.ensemble-managed-row,
.ensemble-setlist-row,
.ensemble-entry-row {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
}

.ensemble-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
}

.ensemble-row-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-base);
}

.ensemble-row-meta,
.ensemble-managed-copy span,
.ensemble-managed-copy small,
.ensemble-member-copy span,
.ensemble-mini-row span,
.ensemble-static-role {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.ensemble-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.ensemble-row-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ensemble-inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(19, 91, 236, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.ensemble-chevron {
  font-size: 24px;
  color: var(--text-faint);
}

.ensemble-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.ensemble-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
}

.ensemble-member-row,
.ensemble-managed-row,
.ensemble-setlist-row,
.ensemble-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 18px;
}

.ensemble-member-copy,
.ensemble-managed-copy,
.ensemble-setlist-copy,
.ensemble-entry-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ensemble-member-copy strong,
.ensemble-managed-copy strong,
.ensemble-setlist-copy strong,
.ensemble-entry-copy strong,
.ensemble-mini-row strong {
  font-size: 15px;
  line-height: 1.35;
}

.ensemble-member-copy small {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ensemble-setlist-copy span,
.ensemble-entry-copy span,
.ensemble-entry-copy small {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.ensemble-entry-copy small {
  font-size: 12px;
}

.ensemble-member-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ensemble-role-select {
  min-width: 170px;
}

.ensemble-remove-member {
  width: 40px;
  height: 40px;
  color: #c53030;
}

.ensemble-mini-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}

.ensemble-mini-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.ensemble-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ensemble-mini-head h4 {
  margin: 0;
  font-size: 16px;
}

.ensemble-mini-head span {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 700;
}

.ensemble-mini-list {
  display: grid;
  gap: 10px;
}

.ensemble-mini-row {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(246, 248, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.ensemble-dialog {
  width: min(720px, calc(100vw - 28px));
}

.ensemble-selection-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(246, 248, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.ensemble-selection-row.is-button {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.ensemble-selection-row.is-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.ensemble-selection-row span {
  display: grid;
  gap: 4px;
}

.ensemble-selection-row strong {
  font-size: 15px;
}

.ensemble-selection-row small {
  color: var(--text-muted);
  font-size: 13px;
}

.ensemble-divider-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  color: var(--accent);
  padding: 10px 4px 2px;
}

.ensemble-divider-row span {
  display: block;
  height: 1px;
  background: rgba(19, 91, 236, 0.28);
}

.ensemble-locked-panel {
  padding: 24px;
}

.library-action-delete svg {
  width: 18px;
  height: 18px;
  display: block;
}

@media (max-width: 1120px) {
  .ensemble-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .login-wrap {
    grid-template-columns: 1fr;
  }

  .login-showcase {
    min-height: auto;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .app-sidebar-card {
    position: static;
  }

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

@media (max-width: 760px) {
  .page-shell.is-piece-view {
    width: 100vw;
    padding: 0;
  }

  .page-shell {
    width: min(var(--content-width), calc(100vw - 20px));
    padding-top: 14px;
  }

  .topbar {
    justify-content: stretch;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .hero-card,
  .panel,
  .feature-card,
  .placeholder-card {
    padding: 18px;
  }

  .grid-cards,
  .split-grid,
  .metric-grid,
  .ensemble-detail-grid {
    grid-template-columns: 1fr;
  }

  .ensemble-header-row,
  .ensemble-row,
  .ensemble-member-row,
  .ensemble-managed-row,
  .ensemble-setlist-row,
  .ensemble-entry-row {
    grid-template-columns: 1fr;
  }

  .ensemble-row-side,
  .ensemble-member-actions {
    justify-content: flex-start;
  }

  .ensemble-role-select {
    min-width: 0;
    width: 100%;
  }

  .list-item-head {
    flex-direction: column;
  }

  .library-dialog {
    padding: 18px;
  }

  .library-row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .library-row-head,
  .library-row-actions {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
  }

  .library-row-status {
    justify-content: flex-start;
  }

  .piece-inline-form-actions,
  .piece-inline-form-submit {
    flex-direction: column;
    align-items: flex-start;
  }

  .piece-viewer-layout {
    grid-template-columns: 1fr;
  }

  .piece-viewer-main {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    height: auto;
  }

  .piece-stage {
    min-height: 58vh;
    height: 58vh;
  }

  .piece-canvas-shell {
    min-height: 62vh;
    padding: 72px 12px 18px;
  }

  .piece-sidebar {
    height: auto;
    max-height: none;
  }

  .piece-floating-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .piece-floating-button {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  .piece-display-menu {
    top: 56px;
    width: min(272px, calc(100vw - 48px));
  }

  .piece-page-arrow {
    width: 46px;
    height: 46px;
  }

  .piece-page-arrow-placeholder {
    width: 46px;
    height: 46px;
  }

  .piece-page-arrow-rail {
    top: calc(50vh - 23px);
    padding: 0 12px;
  }

  .login-showcase,
  .login-card {
    border-radius: 26px;
    padding: 20px;
  }
}
