* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0e17;
  --surface: #111827;
  --surface-2: #1a2332;
  --border: #1e2d3d;
  --text: #e2e8f0;
  --text-dim: #8892a4;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Navigation ─────────────────────────────────────────── */

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.nav-logo svg { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--accent); background: var(--accent-glow); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { background: #2563eb; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 6px 10px;
}

.btn-ghost:hover { color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: transparent;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-small { font-size: 12px; padding: 5px 10px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.form-group input:not([type="radio"]),
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:not([type="radio"]):focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group select option {
  background: var(--surface);
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

.form-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 1.3em;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.form-details summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.form-details[open] summary {
  margin-bottom: 12px;
  color: var(--text);
}

/* Radio group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.radio-option:hover { border-color: var(--accent); }

.radio-option input[type="radio"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--accent);
}

.radio-label {
  font-size: 14px;
  font-weight: 500;
  display: block;
}

.radio-desc {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* ── Login ──────────────────────────────────────────────── */

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header svg {
  color: var(--accent);
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Sites ──────────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.page-actions {
  display: flex;
  gap: 8px;
}

.sites-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 40px;
}

.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.site-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.site-card-info { flex: 1; min-width: 0; }

.site-card-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.site-card-domain {
  font-size: 15px;
  font-weight: 600;
}

.site-card-name {
  font-size: 13px;
  color: var(--text-dim);
}

.site-card-url {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }

.site-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.meta-tag-dim {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 8px;
}

/* Readiness badges */
.readiness-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.readiness-badge.ready { background: var(--green-dim); color: var(--green); }
.readiness-badge.needs_setup { background: var(--yellow-dim); color: var(--yellow); }
.readiness-badge.unchecked { background: var(--blue-dim); color: var(--blue); }
.readiness-badge.unreachable { background: var(--red-dim); color: var(--red); }

/* Site card header right */
.site-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Site card border accents */
.site-card.border-warning { border-left: 3px solid var(--yellow); }
.site-card.border-danger { border-left: 3px solid var(--red); }

/* Guidance messages */
.site-card-guidance {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.site-card-guidance.warning {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.site-card-guidance.info {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.site-card-guidance.danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.site-card-guidance a {
  color: inherit;
  text-decoration: underline;
}

/* Dropdown overflow menu */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  padding: 4px 6px !important;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 160px;
  padding: 4px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--surface);
}

.dropdown-item.danger {
  color: var(--red);
}

.dropdown-item.danger:hover {
  background: var(--red-dim);
}

.site-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-card-actions .dropdown {
  margin-left: auto;
}

.add-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.add-form-card h3 {
  font-size: 15px;
  margin-bottom: 16px;
}

/* ── Connect ────────────────────────────────────────────── */

.connect-container {
  display: flex;
  justify-content: center;
  padding-top: 40px;
}

.connect-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 500px;
}

.connect-card h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.connect-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.5;
}

.connect-info {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.connect-info h4 {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.connect-info ol {
  font-size: 13px;
  color: var(--text-dim);
  padding-left: 20px;
  line-height: 1.8;
}

/* ── Migrate ────────────────────────────────────────────── */

.migrate-container {
  display: flex;
  justify-content: center;
  padding-top: 20px;
}

.migrate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 700px;
}

.migrate-card h2 {
  font-size: 18px;
  margin-bottom: 24px;
}

.flow-arrow-container {
  flex: 0 0 auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
}

.flow-arrow-large {
  color: var(--accent);
  font-size: 24px;
}

.overwrite-warning {
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 20px;
  line-height: 1.5;
}

.overwrite-warning strong {
  color: var(--red);
}

/* Migrate page: info card + phases overview */
.migrate-info-card {
  width: 100%;
  max-width: 700px;
  margin: 20px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.migrate-info-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.migrate-phases-overview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phase-overview-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.phase-overview-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.phase-overview-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.phase-overview-item span {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.migrate-details-toggle {
  margin-top: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.migrate-details-toggle summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.migrate-details-toggle[open] summary {
  margin-bottom: 12px;
  color: var(--text);
}

.migrate-considerations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.consideration-item {
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.consideration-item strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.consideration-item span {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Notification ───────────────────────────────────────── */

.notification {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.notification.success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.notification.error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.notification.info {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.notification.warning {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.notification a {
  color: inherit;
  text-decoration: underline;
}

/* ── Legacy header (kept for backward compat, replaced by nav) ── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.header-left { display: flex; flex-direction: column; gap: 4px; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-left: 38px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.poll-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-dim);
  padding: 4px 10px;
  border-radius: 20px;
}

.pulse {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.last-updated {
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Stats bar ──────────────────────────────────────────── */

.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 6px;
}

.stat-card.completed .stat-value { color: var(--green); }
.stat-card.in-progress .stat-value { color: var(--yellow); }
.stat-card.failed .stat-value { color: var(--red); }
.stat-card.total .stat-value { color: var(--accent); }

/* ── Migration cards ────────────────────────────────────── */

.migrations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 40px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
}

.migration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.migration-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.migration-card.status-in_progress { border-left: 3px solid var(--yellow); }
.migration-card.status-completed { border-left: 3px solid var(--green); }
.migration-card.status-failed { border-left: 3px solid var(--red); }

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

.card-sites { flex: 1; min-width: 0; }

.site-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-url {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-arrow {
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

a.site-url-link {
  text-decoration: none;
  color: var(--text);
  transition: color 0.2s;
}

a.site-url-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.status-badge.completed { background: var(--green-dim); color: var(--green); }
.status-badge.in_progress { background: var(--yellow-dim); color: var(--yellow); }
.status-badge.failed { background: var(--red-dim); color: var(--red); }
.status-badge.pending { background: var(--blue-dim); color: var(--blue); }

.status-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.in_progress .badge-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

.card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}

.cost-tag {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(34, 197, 94, 0.2);
  font-weight: 600;
}

.cost-value {
  color: var(--green);
  font-weight: 600;
}

/* Phase progress */
.phases-bar {
  display: flex;
  gap: 3px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.phase-segment {
  flex: 1;
  border-radius: 3px;
  transition: background 0.3s;
}

.phase-segment.completed { background: var(--green); }
.phase-segment.in_progress { background: var(--yellow); animation: phaseGlow 1.5s ease-in-out infinite; }
.phase-segment.pending { background: var(--border); }
.phase-segment.failed { background: var(--red); }

@keyframes phaseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.spin {
  animation: spin 1s linear infinite;
}

.phases-labels {
  display: flex;
  justify-content: space-between;
}

.phase-label {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  flex: 1;
}

.phase-label.completed { color: var(--green); }
.phase-label.in_progress { color: var(--yellow); }

.card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal h2 {
  font-size: 18px;
  margin-bottom: 20px;
  padding-right: 40px;
}

.modal .site-flow { margin-bottom: 20px; }

.detail-section { margin-bottom: 20px; }

.detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-item .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.detail-item .value {
  font-size: 13px;
  word-break: break-all;
}

.phase-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phase-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.phase-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.phase-icon.completed { background: var(--green-dim); color: var(--green); }
.phase-icon.in_progress { background: var(--yellow-dim); color: var(--yellow); }
.phase-icon.pending { background: rgba(100,116,139,0.1); color: var(--text-dim); }
.phase-icon.failed { background: var(--red-dim); color: var(--red); }

.phase-info { flex: 1; min-width: 0; }

.phase-name { font-size: 13px; font-weight: 500; }

.phase-details {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-desc-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
  opacity: 0.7;
  font-style: italic;
}

.phase-status-text {
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.phase-status-text.completed { color: var(--green); }
.phase-status-text.in_progress { color: var(--yellow); }
.phase-status-text.pending { color: var(--text-dim); }

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.note-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.note-item .note-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.note-item .note-value {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── Docs ──────────────────────────────────────────────── */

.app:has(.docs-container) {
  max-width: 1100px;
}

.docs-container {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.docs-nav {
  position: sticky;
  top: 20px;
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-nav h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-left: 10px;
}

.docs-nav-link {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.docs-nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.docs-nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.docs-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 60px;
}

.docs-content section {
  margin-bottom: 40px;
  scroll-margin-top: 20px;
}

.docs-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
}

.docs-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.docs-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
}

.docs-content ul,
.docs-content ol {
  font-size: 14px;
  line-height: 1.6;
  padding-left: 22px;
  margin-bottom: 12px;
  color: var(--text);
}

.docs-content li {
  margin-bottom: 4px;
}

.docs-content code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

.docs-content a {
  color: var(--accent);
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}

.docs-card h4 {
  margin-bottom: 8px;
}

.docs-card ol,
.docs-card ul {
  margin-bottom: 0;
}

.docs-warning {
  background: var(--yellow-dim);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--yellow);
  margin: 12px 0;
  line-height: 1.5;
}

.docs-warning strong {
  color: var(--yellow);
}

.docs-pre {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  color: var(--text-dim);
  margin: 8px 0;
  white-space: pre;
}

.docs-ssh-key-block {
  position: relative;
  margin: 12px 0;
}

.docs-ssh-key-block .docs-pre {
  word-break: break-all;
  white-space: pre-wrap;
  padding-right: 16px;
  margin-bottom: 8px;
  user-select: all;
  -webkit-user-select: all;
}

.docs-copy-btn {
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.docs-copy-btn-success {
  border-color: var(--green) !important;
  color: var(--green) !important;
}

.docs-table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.docs-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.docs-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table td code {
  font-size: 11px;
}

/* ── Migration Detail Page ──────────────────────────────── */

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.detail-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.detail-breadcrumb a:hover { color: var(--accent); }

.breadcrumb-sep { color: var(--border); }

.detail-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.detail-page-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-progress-bar {
  margin-bottom: 24px;
}

.detail-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.detail-progress-label { font-weight: 500; }

.phase-details-full {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

.notes-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

/* ── Logs & Files download section ─────────────────────── */

.logs-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.log-file-item:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.log-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  flex-shrink: 0;
}

.log-file-item:hover .log-file-icon {
  color: var(--accent);
}

.log-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.log-file-name {
  font-size: 13px;
  font-weight: 500;
}

.log-file-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.log-file-download {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

.log-file-item:hover .log-file-download {
  color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 640px) {
  .nav-left { flex-direction: column; align-items: flex-start; gap: 8px; }
  .nav-links { margin-left: 0; }
  .stats-bar { flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - 6px); }
  .site-flow { flex-direction: column; align-items: flex-start; gap: 4px; }
  .flow-arrow { transform: rotate(90deg); }
  .detail-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; gap: 10px; }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .form-row { flex-direction: column; gap: 0; }
  .flow-arrow-container { display: none !important; }
  .docs-container { flex-direction: column; }
  .docs-nav { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
  .docs-nav h3 { display: none; }
  .docs-nav-link { border-left: none; border-bottom: 2px solid transparent; font-size: 12px; padding: 4px 8px; }
  .docs-nav-link.active { border-left-color: transparent; border-bottom-color: var(--accent); }
}
