html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
}

#logo { 
  position:fixed;
  bottom:0px;
  right:0px;
  padding:25px;
  z-index: -1;
}

canvas {
  height:100%;
}

#waveforms .active { 
  background:#ff0;
}

#wrapper { 
  display:flex;
  height:100vh;
}

#wrapper nav  {
  display:flex;
  flex-direction:column;
  width:200px;
  min-width:200px;
  overflow-y:auto;
  font-size: smaller;
}

#content-wrapper { 
  width:100%;
  height:100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#content { 
  width:100%;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

#audios { 
  flex-shrink:2;
  flex-direction:column;
  overflow-y:auto;
  overflow-x:clip;
  font-size:small;
  padding-top:1em;
}

#waveforms { 
  display:flex;
  flex-direction: column;
  overflow-y:auto;
  height: 100%;
}

/* WaveSurfer v7: wave height is set via the `height` option (128 px).
   Hide progress bar and cursor on non-active waveforms via shadow-DOM parts. */
#waveforms .waveform:not(.active) *::part(progress),
#waveforms .waveform:not(.active) *::part(cursor) {
  display: none !important;
}

/* Custom marker lines (replaces WaveSurfer v4 markers plugin) */
.ws-marker {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  border-left: 2px solid currentColor;
  z-index: 3;
  cursor: pointer;
  pointer-events: auto;
}

.ws-marker-label {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 9px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 1px 4px;
  border-radius: 4px;
}

.renditionName { 
  cursor: pointer;
}

.renditionName:hover { 
  text-decoration:underline;
}

ul { 
  list-style-type: none;
  padding-left:0px;
  margin-left:0px;
}

label { 
  color:gray;
  font-size:smaller;
  cursor:pointer;
}

label.ready { 
  color:green;
}

label.loading { 
  color:black;
}


details { 
  cursor:pointer;
}

.listSelectors { 
  font-size: smaller;
  text-decoration:underline;
}

.listSelectors .all { 
  padding-right:1em;
}

.listSelectors .none{ 
  padding-left:1em;
}

/* Per-waveform resize overlay */
.waveform {
  position: relative;
  margin-bottom: .2em;
  border: 1px solid black;
  border-top:0px;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
}

.wf-resize-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: inherit;
  gap: 0.4em;
}

.wf-overlay-status {
  font-size: 0.8em;
  color: #64748b;
}

.resize-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: resize-spin 0.7s linear infinite;
}

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

/* --- Solid session restore overlay --- */

@keyframes spinning {
  from { transform: rotate(0deg); }
  to { transform: rotate(359deg); }
}

.clockwise {
  animation: spinning 1s linear infinite;
}

#solidOverlay {
  position: fixed;
  display: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(215, 227, 244, 0.8);
  z-index: 9999;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

#solidOverlay.active {
  display: flex;
  cursor: pointer;
}

#solidLoadingIndicator {
  border-radius: 32px;
  background-color: rgba(255, 255, 255, 0.7);
  width: 200px;
  text-align: center;
  padding-bottom: 0.5em;
}

#solidLoadingIndicator:hover {
  text-decoration: underline;
}

#solidLoadingIndicator svg {
  width: 200px;
}

#solidOverlayCancel {
  margin: 0 1em;
  font-size: 0.85em;
  color: #334155;
}

#solidOverlayCancel span {
  font-family: monospace;
}

/* Alt-mode waveform number badges */
.wf-alt-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.8em;
  font-weight: bold;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
  user-select: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#waveforms .waveform { 
  border-top: 1px solid black;
  border-radius: 5px;
}

/* wave marker rules removed (WaveSurfer v4 only) */

.timerValueContainer { 
  display: flex;
  justify-content: center;
}
.timerValueContainer span { 
  position:relative;
  top:2em;
  font-size:small;
}


#maoExtracts { 
  display: flex;
  overflow-x: auto;
  gap: 1em;
  padding: 1em;
  flex-shrink: 0;
}

.maoExtract { 
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  border-radius: 8px;
  min-width: 250px;
  max-width: 300px;
  padding: 1em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.maoExtract-label {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.extractTools { 
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

#fetchExternal { 
  min-width: 120px;
}

/* Solid Drawer */
#solid-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: #f8fafc;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 1.5em;
  box-sizing: border-box;
}

#solid-drawer.closed {
  transform: translateX(100%);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2em;
  padding-bottom: 1em;
  border-bottom: 1px solid #e2e8f0;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25em;
  color: #1e293b;
}

#close-solid-drawer {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #64748b;
  padding: 0 0.2em;
}

#close-solid-drawer:hover {
  color: #0f172a;
}

#solidTab {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
}

#solidTab a {
  color: #3b82f6;
  cursor: pointer;
  text-decoration: underline;
}

#solidTab input[type="text"] {
  width: 100%;
  padding: 0.5em;
  margin-bottom: 0.5em;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

#splash {
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
  color: #2d3748;
  letter-spacing: 0.01em;
}

#splash #logo {
  margin-bottom: 0.5em;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.08));
}

#splash-card {
  background: rgba(255,255,255,0.9);
  border-radius: 16px;
  padding: 2em 2.5em;
  max-width: 720px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  text-align: center;
}

#splash-card h1 {
  margin: 0 0 0.1em;
  font-size: 1.8em;
  color: #1e293b;
}

#splash-card h1 .version {
  font-size: 0.45em;
  color: #94a3b8;
  font-weight: 400;
  vertical-align: middle;
}

#splash-card .tagline {
  margin: 0 0 1em;
  font-size: 1em;
  color: #64748b;
  font-style: italic;
  background: none;
  box-shadow: none;
  padding: 0;
}

#splash-card .usage-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.5em 1em;
  margin: 0.8em 0;
  font-size: 1.05em;
}

#splash-card .usage-box code {
  color: #7c3aed;
  font-weight: 600;
}

#splash-card p {
  text-align: center;
  font-size: 0.95em;
  line-height: 1.6;
  margin: 0.8em 0;
  background: none;
  box-shadow: none;
  padding: 0;
  max-width: none;
}

#splash-card p.help-text {
  font-size: 0.85em;
  color: #64748b;
  margin-top: 0.4em;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75em;
  margin: 1em 0 0.5em;
}

#splash .action-card {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.9em 1.1em;
  text-align: left;
  color: #1e293b;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
}

#splash .action-card:hover {
  background: #e8eef6;
  border-color: #2563eb;
  box-shadow: 0 2px 10px rgba(37,99,235,0.12);
  color: #1e293b;
}

#splash .action-card strong {
  font-size: 1em;
  color: #2563eb;
  font-weight: 600;
}

#splash .action-card span {
  font-size: 0.83em;
  color: #64748b;
  line-height: 1.4;
}

#splash-card footer {
  margin-top: 1.2em;
  padding-top: 0.8em;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8em;
  color: #94a3b8;
  line-height: 1.8;
}

#splash a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px dotted #2563eb;
  transition: color 0.2s, border-bottom 0.2s;
}

#splash a:hover {
  color: #1e40af;
  border-bottom: 1px solid #1e40af;
}

#error-banner {
  background: #fce4e4;
  border: 1px solid #c0392b;
  border-radius: 8px;
  padding: 0.8em 1.2em;
  margin: 0 auto 1em;
  max-width: 720px;
  color: #721c24;
  font-size: 0.95em;
  text-align: left;
}

/* --- File picker overlay --- */
#file-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
}

#file-picker-card {
  background: #fff;
  border-radius: 16px;
  padding: 2em 2.5em;
  max-width: 560px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
}

#file-picker-card h2 {
  margin: 0 0 0.4em;
  font-size: 1.4em;
  color: #1e293b;
}

.file-picker-hint {
  color: #64748b;
  font-size: 0.9em;
  margin: 0 0 1.2em;
  line-height: 1.5;
}

#file-picker-actions {
  display: flex;
  gap: 0.8em;
  justify-content: center;
  margin-bottom: 1em;
}

#file-picker-actions button {
  padding: 0.6em 1.4em;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#file-picker-actions button:hover {
  background: #e0e7ef;
  border-color: #94a3b8;
}

#file-picker-card {
  transition: border-color 0.2s, background 0.2s;
  border: 2px solid transparent;
}

#file-picker-card.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.file-picker-drop-hint {
  color: #94a3b8;
  font-size: 0.85em;
  margin: 0 0 1em;
}

#file-picker-json-status {
  margin-bottom: 0.8em;
  font-size: 0.9em;
}

.json-status-ok {
  color: #16a34a;
  font-weight: 500;
}

.json-status-missing {
  color: #dc2626;
  font-weight: 500;
}

/* Global drop overlay for JSON replacement */
#json-drop-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(37, 99, 235, 0.12);
  border: 3px dashed #2563eb;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#json-drop-overlay .drop-label {
  background: #2563eb;
  color: #fff;
  padding: 1em 2em;
  border-radius: 12px;
  font-size: 1.2em;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

#file-picker-status {
  text-align: left;
  max-height: 40vh;
  overflow-y: auto;
}

#file-picker-progress {
  font-size: 0.85em;
  color: #475569;
  margin-bottom: 0.5em;
  text-align: center;
}

#file-picker-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#file-picker-list li {
  padding: 0.3em 0.5em;
  border-radius: 4px;
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

/* Subset Selection Solid Button */
.renditionName {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

/* Full-coverage waveform selection overlay — hidden until selection mode */
.wf-select-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none; /* hidden until selection mode */
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.25);  /* subtle grey tint */
  cursor: pointer;
  transition: background 0.2s;
}

.wf-select-overlay.visible {
  display: flex;
}

.wf-select-overlay:hover {
  background: rgba(148, 163, 184, 0.35);
}

/* RDF icon inside the overlay */
.wf-overlay-icon {
  width: 48px;
  height: 48px;
  opacity: 0.35;
  filter: grayscale(100%);
  transition: opacity 0.2s, filter 0.2s, transform 0.15s;
  pointer-events: none; /* clicks pass through to the overlay div */
}

.wf-select-overlay:hover .wf-overlay-icon {
  opacity: 0.55;
}

/* Staged (selected) state */
.wf-select-overlay.staged {
  background: rgba(59, 130, 246, 0.18);
}

.wf-select-overlay.staged .wf-overlay-icon {
  opacity: 0.9;
  filter: grayscale(0%);
  transform: scale(1.05);
}

.wf-select-overlay.staged::after {
  content: '\2713';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 16px;
  font-weight: bold;
  color: white;
  background: #3b82f6;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Annotation card styles --- */
.maoExtract-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.maoExtract-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1.2em;
  padding: 0;
  line-height: 1;
}

.maoExtract-dismiss:hover {
  color: #ef4444;
}

.maoExtract.selecting {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.extract-play-btn,
.extract-select-btn {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.3em 0.6em;
  cursor: pointer;
  font-size: 0.85em;
  transition: background 0.15s, color 0.15s;
}

.extract-play-btn:hover,
.extract-select-btn:hover {
  background: #cbd5e1;
}

.extract-play-btn.playing {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

.maoExtract.selecting .extract-select-btn {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

.staged-area {
  display: none;
  flex-direction: column;
  gap: 0.4em;
  font-size: 0.85em;
}

.maoExtract.selecting .staged-area {
  display: flex;
}

.staged-count {
  color: #475569;
  font-weight: 500;
}

.staged-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85em;
  color: #64748b;
}

.staged-list li {
  padding: 0.15em 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.include-peaks-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8em;
  color: #475569;
  margin-top: 0.3em;
  cursor: pointer;
}

.post-to-solid-btn {
  background: #16a34a;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.4em 0.8em;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
  margin-top: 0.3em;
}

.post-to-solid-btn:hover:not(:disabled) {
  background: #15803d;
}

.post-to-solid-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* --- Describe / Open in Primal --- */

.describe-area {
  margin-top: 0.5em;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5em;
}

.describe-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.35em 0.5em;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  min-height: 2.4em;
}

.describe-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.describe-btn-row {
  display: flex;
  gap: 0.5em;
  margin-top: 0.3em;
  align-items: center;
}

.describe-btn {
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.35em 0.75em;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85em;
  transition: background 0.15s;
}

.describe-btn:hover:not(:disabled) {
  background: #4f46e5;
}

.describe-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.primal-btn {
  display: inline-block;
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.35em 0.75em;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85em;
  text-decoration: none;
  transition: background 0.15s;
}

.primal-btn:hover {
  background: #0284c7;
}

#file-picker-list li.matched {
  color: #16a34a;
}

#file-picker-list li.missing {
  color: #94a3b8;
}

#file-picker-list li .status-icon::before {
  content: '\2610'; /* empty checkbox */
}

#file-picker-list li.matched .status-icon::before {
  content: '\2611'; /* checked checkbox */
}

#file-picker-continue {
  margin-top: 1em;
  padding: 0.7em 2em;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

#file-picker-continue:hover {
  background: #1e40af;
}

#wrapper nav button,
#wrapper nav a#back {
  margin: 0.3em 0;
  padding: 0.4em 0.8em;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.85em;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  color: inherit;
  display: block;
}

#wrapper nav button:hover,
#wrapper nav a#back:hover {
  background: #e0e7ef;
  border-color: #94a3b8;
}

/* Close-listening mode badge */
#close-listening-badge {
  display: block;
  margin: 0.3em 0;
  padding: 0.4em 0.8em;
  border: 2px solid #8b0000;
  border-radius: 6px;
  background: #8b0000;
  color: #fff;
  font-size: 0.85em;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.03em;
  box-sizing: border-box;
  width: 100%;
}

/* === Alignment panel (embedded in listen page) === */

#align-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
  color: #2d3748;
  overflow-y: auto;
}

/* Legacy standalone page (align.html) */
#align-page {
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ef 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
  color: #2d3748;
}

#align-panel #align-logo {
  margin-bottom: 0.3em;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.08));
  text-align: center;
}

#align-card {
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: 2em 2.5em;
  max-width: 600px;
  width: 90vw;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  text-align: center;
}

#align-card #logo {
  margin-bottom: 0.3em;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.08));
}

#align-card h1 {
  margin: 0 0 0.2em;
  font-size: 1.6em;
  color: #1e293b;
}

.align-hint {
  color: #64748b;
  font-size: 0.9em;
  line-height: 1.5;
  margin: 0 0 1.2em;
}

.align-hint a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px dotted #2563eb;
}

.align-hint a:hover {
  color: #1e40af;
  border-bottom-style: solid;
}

#align-file-actions {
  display: flex;
  gap: 0.8em;
  justify-content: center;
  margin-bottom: 0.8em;
}

#align-file-actions button {
  padding: 0.55em 1.3em;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#align-file-actions button:hover {
  background: #e0e7ef;
  border-color: #94a3b8;
}

#align-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 1.2em;
  color: #94a3b8;
  font-size: 0.85em;
  margin-bottom: 1.2em;
  transition: border-color 0.2s, background 0.2s;
}

#align-drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}

/* Optional MEI URI input */
#align-mei-section {
  margin-bottom: 1.2em;
}

#align-mei-section label {
  display: block;
  font-size: 0.9em;
  color: #475569;
  margin-bottom: 0.4em;
}

.align-mei-hint {
  font-weight: normal;
  color: #94a3b8;
  font-size: 0.85em;
  margin-left: 0.4em;
}

#align-mei-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5em 0.7em;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9em;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s;
}

#align-mei-input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

/* File table */
#align-file-list-container h3 {
  margin: 0.8em 0 0.4em;
  font-size: 1em;
  color: #1e293b;
}

#align-file-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
  font-size: 0.9em;
}

#align-file-table th {
  text-align: left;
  padding: 0.4em 0.6em;
  border-bottom: 2px solid #e2e8f0;
  color: #64748b;
  font-weight: 600;
}

#align-file-table th:last-child {
  text-align: center;
  width: 3em;
}

#align-file-table td {
  padding: 0.35em 0.6em;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

#align-start-btn {
  padding: 0.7em 2em;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

#align-start-btn:hover {
  background: #1e40af;
}

/* Progress */
#align-progress-bar-container {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.6em;
}

#align-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 6px;
  transition: width 0.3s ease;
}

#align-progress-elapsed {
  color: #2563eb;
  font-size: 0.85em;
  font-weight: 600;
  margin: 0.3em 0;
  min-height: 1.3em;
}

#align-step-list-container {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 0.6em;
}

#align-step-list {
  list-style: none;
  margin: 0;
  padding: 0.3em 0;
}

#align-step-list li {
  padding: 0.25em 0.8em;
  font-size: 0.82em;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

#align-step-list li .step-icon {
  flex-shrink: 0;
  width: 1.2em;
  text-align: center;
}

#align-step-list li.running {
  color: #2563eb;
  font-weight: 500;
}

#align-step-list li.done {
  color: #16a34a;
}

#align-step-list li.done .step-icon {
  color: #16a34a;
  font-weight: 700;
}

.step-time {
  margin-left: auto;
  font-size: 0.9em;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

#align-progress-text {
  color: #475569;
  font-size: 0.85em;
  min-height: 1.6em;
}

/* Results */
#align-results h3 {
  color: #16a34a;
  margin: 0.5em 0 0.8em;
}

#align-download-btn,
#align-open-btn {
  padding: 0.65em 1.5em;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  cursor: pointer;
  margin: 0 0.3em;
  transition: background 0.2s;
}

#align-download-btn {
  background: #2563eb;
  color: #fff;
}

#align-download-btn:hover {
  background: #1e40af;
}

#align-open-btn {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

#align-open-btn:hover {
  background: #e0e7ef;
}

#align-card footer {
  margin-top: 1.5em;
  padding-top: 0.8em;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8em;
  color: #94a3b8;
}

#align-card footer a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px dotted #2563eb;
}

#align-card footer a:hover {
  color: #1e40af;
  border-bottom-style: solid;
}

/* ===================================================================
   Group-files modal
   =================================================================== */
.gm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gm-modal {
  background: #fff;
  border-radius: 10px;
  width: min(90vw, 900px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.gm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
}
.gm-header h3 { margin: 0; font-size: 1.1em; }
.gm-close {
  background: none; border: none; font-size: 1.3em; cursor: pointer;
  color: #64748b;
}
.gm-close:hover { color: #0f172a; }

.gm-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.gm-pane {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.gm-pane h4 { margin: 0 0 8px; font-size: 0.95em; color: #334155; }

.gm-left {
  flex: 0 0 260px;
  border-right: 1px solid #e2e8f0;
}
.gm-right {
  flex: 1 1 auto;
}
.gm-right-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gm-right-header h4 { margin: 0; }

.gm-add-group {
  background: #2563eb; color: #fff; border: none; border-radius: 4px;
  padding: 4px 10px; font-size: 0.82em; cursor: pointer;
}
.gm-add-group:hover { background: #1d4ed8; }

.gm-groups-container {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* File items (left pane) */
.gm-file-list {
  list-style: none;
  margin: 0; padding: 0;
}
.gm-file-item {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gm-file-item:hover { background: #f1f5f9; }
.gm-file-item.gm-dragging { opacity: 0.4; }

.gm-empty {
  color: #94a3b8; font-style: italic; font-size: 0.85em;
  padding: 6px 0;
}

/* Group card (right pane) */
.gm-group-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 10px;
  padding: 10px;
  background: #fafbfc;
  transition: box-shadow 0.15s;
}
.gm-group-card.gm-drop-target {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.gm-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.gm-group-name {
  flex: 1 1 auto;
  border: 1px solid #cbd5e1; border-radius: 4px;
  padding: 3px 6px; font-size: 0.9em;
}
.gm-icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.75em; color: #64748b; padding: 2px 4px;
}
.gm-icon-btn:hover { color: #0f172a; }
.gm-icon-btn.gm-delete { color: #ef4444; }
.gm-icon-btn.gm-delete:hover { color: #b91c1c; }

.gm-pattern-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.gm-pattern-row label { font-size: 0.82em; color: #475569; }
.gm-pattern-input {
  flex: 1 1 auto;
  border: 1px solid #cbd5e1; border-radius: 4px;
  padding: 3px 6px; font-size: 0.82em;
  font-family: monospace;
}

.gm-group-files {
  list-style: none; margin: 0; padding: 0;
  min-height: 28px;
}
.gm-group-files .gm-file-item {
  cursor: default;
}
.gm-remove-file {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; font-size: 0.8em; margin-left: 6px;
  padding: 0 3px;
}
.gm-remove-file:hover { color: #ef4444; }

.gm-regex-tag {
  font-size: 0.7em; color: #64748b; margin-left: 6px;
  background: #e2e8f0; border-radius: 3px; padding: 1px 4px;
}

.gm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid #e2e8f0;
}
.gm-footer button {
  padding: 6px 16px; border-radius: 5px; border: 1px solid #cbd5e1;
  cursor: pointer; font-size: 0.9em; background: #fff;
}
.gm-footer button:hover { background: #f1f5f9; }
.gm-apply {
  background: #2563eb !important; color: #fff !important;
  border-color: #2563eb !important;
}
.gm-apply:hover { background: #1d4ed8 !important; }

/* Group files button in nav */
#group-files-btn {
  font-size: 0.85em;
  cursor: pointer;
}

