.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  color: #475569;
  transition: all 150ms ease;
}

.dark .nav-link {
  color: #94a3b8;
}

.nav-link:hover {
  color: #1e293b;
  background-color: rgba(226, 232, 240, 0.6);
}

.dark .nav-link:hover {
  color: #e2e8f0;
  background-color: rgba(51, 65, 85, 0.5);
}

.nav-active {
  color: #1e293b;
  background-color: rgba(226, 232, 240, 0.8);
}

.dark .nav-active {
  color: #e2e8f0;
  background-color: rgba(51, 65, 85, 0.7);
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  vertical-align: middle;
}

.status-badge {
  --status-badge-text-width: 7ch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: calc(var(--status-badge-text-width) + 1.25rem);
  min-width: calc(var(--status-badge-text-width) + 1.25rem);
  padding: 0.25rem 0.625rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-transform: lowercase;
}

.status-badge-full,
.status-badge-short {
  display: inline-block;
}

.status-badge-short {
  display: none;
}

@keyframes pulse {
  50% { opacity: .5; }
}

.status-badge-running {
  background: #dbeafe;
  color: #2563eb;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dark .status-badge-running {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.status-badge-success {
  background: #d1fae5;
  color: #059669;
}

.dark .status-badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.status-badge-failed {
  background: #fee2e2;
  color: #dc2626;
}

.dark .status-badge-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.status-badge-cleaned {
  background: #f3f4f6;
  color: #4b5563;
}

.dark .status-badge-cleaned {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.status-badge-other {
  background: #fef3c7;
  color: #b45309;
}

.dark .status-badge-other {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

@media (max-width: 640px) {
  .status-badge {
    width: 1.75rem;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border-radius: 9999px;
  }

  .status-badge-full {
    display: none;
  }

  .status-badge-short {
    display: inline-block;
    text-transform: uppercase;
  }
}

.tt {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}
.tt:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 6px;
}
.dark .tt:focus-visible {
  outline-color: #818cf8;
}
.tt-body {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 340px;
  white-space: normal;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  background: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.tt:hover .tt-body,
.tt:focus .tt-body,
.tt:focus-within .tt-body {
  visibility: visible;
  opacity: 1;
}

.branch-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.branch-tag-editor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  min-height: 2.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.75rem;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: text;
}

.dark .branch-tag-editor {
  background: #1e293b;
  border-color: #334155;
}

.branch-tag-editor:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.dark .branch-tag-editor:focus-within {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.18);
}

.branch-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  max-width: 100%;
}

.dark .branch-tag {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
  color: #fbbf24;
}

.branch-tag-editable {
  padding-right: 0.3rem;
}

.branch-tag-label {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.6875rem;
  line-height: 1;
  padding: 0;
}

.branch-tag-remove:hover {
  background: rgba(180, 83, 9, 0.12);
}

.dark .branch-tag-remove:hover {
  background: rgba(251, 191, 36, 0.12);
}

.branch-tag-input {
  flex: 1 1 240px;
  min-width: 220px;
  padding: 0.25rem 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #111827;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.dark .branch-tag-input {
  color: #f8fafc;
}

.branch-tag-input::placeholder {
  color: #9ca3af;
}

.dark .branch-tag-input::placeholder {
  color: #64748b;
}

/* ─── Toggle switch ────────────────────────────────── */
.toggle-switch {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 9999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.dark .toggle-switch { background: #475569; }
.toggle-switch.active { background: #6366f1; }
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 1rem; height: 1rem;
  border-radius: 9999px;
  background: #fff;
  transition: transform 0.2s;
}
.toggle-switch.active::after { transform: translateX(1.125rem); }

/* ─── Accordion ────────────────────────────────────── */
.svc-accordion .svc-header {
  cursor: pointer;
  user-select: none;
}
.svc-accordion .svc-chevron {
  transition: transform 0.2s ease;
}
.svc-accordion .svc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.svc-accordion[data-expanded="true"] .svc-chevron {
  transform: rotate(90deg);
}
.svc-accordion[data-expanded="true"] .svc-body {
  max-height: 5000px;
}

/* ─── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
}
.modal-overlay.modal-visible {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
.modal-overlay.modal-overlay-form {
  align-items: center;
  padding: 2.5rem 1rem;
  overflow-y: auto;
}
.modal-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.75rem;
  max-width: 28rem;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.modal-visible .modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.dark .modal-card {
  background: #0f172a;
  border: 1px solid #1e293b;
}
.form-modal-card {
  max-width: 40rem;
  margin: auto;
}
.modal-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}
.modal-icon-wrap.modal-icon-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.dark .modal-icon-wrap.modal-icon-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.modal-icon-wrap.modal-icon-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}
.dark .modal-icon-wrap.modal-icon-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.modal-icon-wrap.modal-icon-info {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.dark .modal-icon-wrap.modal-icon-info {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

/* ─── Autocomplete dropdown ───────────────────────── */
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin-top: 4px;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  max-height: 280px;
  overflow-y: auto;
}
.dark .ac-dropdown {
  background: #0f172a;
  border-color: #1e293b;
}
.ac-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
}
.ac-item:hover {
  background: #f1f5f9;
}
.dark .ac-item:hover {
  background: #1e293b;
}
