/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0f1419;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --bg-input: #151d2b;
  --border: #2a3a4e;
  --accent: #6393ff;
  --accent-hover: #7fa8ff;
  --accent-dim: rgba(99, 147, 255, 0.15);
  --text-primary: #e6edf5;
  --text-secondary: #8899aa;
  --text-muted: #5c6d7e;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --purple: #a78bfa;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

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

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

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, #1a2332 0%, #1e2d42 50%, #1a2332 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-brand {
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
}
.nav-brand:hover { color: var(--text-primary); }

.brand-try {
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 1.1rem;
}
.brand-try-lg {
  font-size: 1.8rem;
}
.brand-desk {
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  font-size: 1.1rem;
}
.brand-desk-lg {
  font-size: 1.8rem;
}
.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.6rem;
}
.brand-admin {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 110;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

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

.nav-link {
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-link svg {
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}
.nav-link:hover svg {
  opacity: 1;
}
.nav-link-active {
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}
.nav-link-active svg {
  opacity: 1 !important;
}
.nav-link-logout {
  color: var(--danger);
}
.nav-link-logout:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ── Main Content ────────────────────────────────────── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  background-image:
    linear-gradient(rgba(42, 58, 78, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 58, 78, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  min-height: calc(100vh - 56px);
}

/* ── Page Header ─────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Stats Row ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  border-color: rgba(99, 147, 255, 0.3);
  box-shadow: var(--shadow-sm);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon-blue {
  background: rgba(99, 147, 255, 0.12);
  color: var(--accent);
}
.stat-card-icon-green {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}
.stat-card-icon-red {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}
.stat-card-icon-purple {
  background: rgba(167, 139, 250, 0.12);
  color: var(--purple);
}
.stat-card-icon-yellow {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.stat-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.stat-card-value-sm {
  font-size: 0.95rem;
  font-weight: 600;
}
.stat-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title svg {
  color: var(--accent);
  flex-shrink: 0;
}
.card-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* ── Grid ────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: 1.25rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* ── Tables ──────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  position: relative;
}
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, var(--bg-card));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.table-wrapper.scrollable::after {
  opacity: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(42, 58, 78, 0.4);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}

.table-row-hover {
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.table-row-hover:hover {
  background: var(--bg-card-hover);
  border-left: 3px solid var(--accent);
}
.table-row-hover:hover td:first-child {
  padding-left: calc(1rem - 3px);
}

.client-name {
  font-weight: 600;
  display: block;
}
.client-slug {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Consolas', monospace;
}

.domain-link {
  color: var(--accent);
}

.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 0.375rem;
}

.msg-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Tabs ────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}
.tab-active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}
.tab-panel {
  display: none;
}
.tab-panel-active {
  display: block;
}

/* ── Status Badges ───────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-active .status-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
.status-active {
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
}
.status-inactive .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.status-inactive {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
  50% { opacity: 0.6; box-shadow: 0 0 12px var(--success); }
}

/* ── Stat Grid ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Commits ─────────────────────────────────────────── */
.commit-list {
  max-height: 500px;
  overflow-y: auto;
}
.commit-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(42, 58, 78, 0.3);
  font-size: 0.82rem;
}
.commit-item:last-child { border-bottom: none; }
.commit-hash {
  color: var(--accent);
  font-size: 0.75rem;
  flex-shrink: 0;
  background: var(--accent-dim);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
}
.commit-msg {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.commit-date {
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

/* ── Code Blocks ─────────────────────────────────────── */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  color: var(--text-secondary);
}
.log-block {
  max-height: 600px;
  font-size: 0.72rem;
}
.disk-block {
  max-height: 250px;
  font-size: 0.78rem;
}

/* Log line colorization (applied by JS) */
.log-line-error {
  color: var(--danger);
}
.log-line-warn {
  color: var(--warning);
}
.log-line-success {
  color: var(--success);
}
.log-line-info {
  color: var(--accent);
}
.log-line-dim {
  color: var(--text-muted);
}

/* ── Template Editor ─────────────────────────────────── */
.template-editor {
  width: 100%;
  min-height: 350px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
  resize: vertical;
  transition: border-color 0.15s;
}
.template-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 147, 255, 0.15);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.4;
}
.btn svg {
  flex-shrink: 0;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 147, 255, 0.3);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(99, 147, 255, 0.3);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(99, 147, 255, 0.25);
}
.btn-warning {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.3);
}
.btn-warning:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.22);
}
.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}
.btn-full {
  width: 100%;
}

/* ── Login Page ──────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #0c1018 0%, #131b2a 30%, #16243a 60%, #0f1922 100%);
}
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
}
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo {
  margin-bottom: 0.5rem;
}
.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 147, 255, 0.15);
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.alert-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 350px;
  box-shadow: var(--shadow-md);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}
.toast-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

/* ── Error Page ──────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}
.error-code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.05em;
}
.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.error-text {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ── Utilities ───────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.78rem; }
.text-nowrap { white-space: nowrap; }
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

/* ── Nav Overlay (hidden on desktop) ────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 56px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.nav-overlay.nav-overlay-show {
  display: block;
  opacity: 1;
}

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

/* -- Tablet (768-1024) -------------------------------- */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -- Mobile (<=768) ----------------------------------- */
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }

  /* Hamburger visible */
  .hamburger {
    display: flex;
  }

  /* Nav drawer: slide down from top */
  .nav-links {
    display: flex;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 99;
    gap: 0.25rem;
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .nav-links.nav-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-link {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    min-height: 44px;
  }
  .nav-link svg {
    width: 18px;
    height: 18px;
  }
  .nav-link-logout {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  }

  /* Main content: consistent padding */
  .main-content {
    padding: 1.25rem 1rem;
  }

  /* Page header */
  .page-header {
    margin-bottom: 1.25rem;
  }
  .page-header h1 {
    font-size: 1.35rem;
  }
  .page-header-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1;
    min-height: 42px;
    font-size: 0.82rem;
  }

  /* Navbar compact */
  .navbar {
    padding: 0 1rem;
  }

  /* Stats 2-col */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
  }
  .stat-card {
    padding: 0.85rem;
    gap: 0.65rem;
  }
  .stat-card-icon {
    width: 38px;
    height: 38px;
  }
  .stat-card-icon svg {
    width: 18px;
    height: 18px;
  }
  .stat-card-value {
    font-size: 1.3rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Tables: tighter */
  .table th, .table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
  }

  /* Stat grid */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Commit items wrap */
  .commit-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .commit-date {
    width: 100%;
  }

  /* Tab buttons */
  .tab-btn {
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    min-height: 42px;
  }

  /* Toast: full width on mobile */
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }

  /* Footer */
  .dash-footer {
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    padding-top: 1.25rem;
    margin-top: 1.5rem;
  }
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Timeline ───────────────────────────────────────── */
.timeline-row {
  display: flex;
  gap: 1px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 300px;
}
.tl-block {
  display: inline-block;
  width: 5px;
  height: 18px;
  border-radius: 1px;
  flex-shrink: 0;
}
.tl-up {
  background: var(--success);
  opacity: 0.8;
}
.tl-down {
  background: var(--danger);
  opacity: 0.9;
}

/* ── Uptime Percentage ──────────────────────────────── */
.uptime-pct {
  font-weight: 600;
  font-size: 0.9rem;
}
.uptime-good { color: var(--success); }
.uptime-warn { color: var(--warning); }
.uptime-bad { color: var(--danger); }

/* ── Health List ────────────────────────────────────── */
.health-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.health-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(42, 58, 78, 0.3);
}
.health-row:last-child { border-bottom: none; }
.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-dot-up {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.health-dot-down {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.health-name {
  flex: 1;
  font-size: 0.85rem;
}
.health-pct {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Activating Status ──────────────────────────────── */
.status-activating .status-dot {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
  animation: pulse-dot-warn 1.5s ease-in-out infinite;
}
.status-activating {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}
@keyframes pulse-dot-warn {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--warning); }
  50% { opacity: 0.6; box-shadow: 0 0 12px var(--warning); }
}

/* ── Onboard Form ──────────────────────────────────── */
.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  transition: color 0.15s;
}
.field-hint.hint-error {
  color: var(--danger);
}
.field-hint.hint-ok {
  color: var(--success);
}
.form-group input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15);
}
.form-group input.input-ok {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15);
}

.onboard-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: onboard-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes onboard-spin {
  to { transform: rotate(360deg); }
}

.onboard-result {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}
.onboard-result-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}
.onboard-result-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

.step-line {
  padding: 0.1rem 0;
}
.step-line-ok {
  color: var(--success);
}
.step-line-fail {
  color: var(--danger);
}
.step-line-info {
  color: var(--accent);
}

/* ── Log Toolbar ────────────────────────────────────── */
.log-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.log-search-input {
  flex: 1;
  min-width: 150px;
  padding: 0.45rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
.log-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 147, 255, 0.15);
}
.log-search-input::placeholder {
  color: var(--text-muted);
}
.log-level-select {
  padding: 0.45rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}
.log-level-select:focus {
  outline: none;
  border-color: var(--accent);
}
.log-match-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Live Tail ─────────────────────────────────────── */
.log-tail-btn {
  white-space: nowrap;
}
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 0.25rem;
  transition: background 0.3s;
}
.live-dot-active {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-live 1.5s ease-in-out infinite;
}
.live-active {
  border-color: var(--success) !important;
  color: var(--success) !important;
  background: rgba(52, 211, 153, 0.1) !important;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
  50% { opacity: 0.4; box-shadow: 0 0 12px var(--success); }
}

/* ── Commit Badge ──────────────────────────────────── */
.commit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: middle;
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* ── Dashboard Footer ───────────────────────────────── */
.dash-footer {
  display: flex;
  justify-content: space-between;
  padding: 2rem 0 0.5rem;
  border-top: 1px solid rgba(42, 58, 78, 0.3);
  margin-top: 2rem;
}

/* -- Small Mobile (<=480px, targeting 360-430px) ----- */
@media (max-width: 480px) {
  /* Main content: snug but not cramped */
  .main-content {
    padding: 1rem 0.875rem;
  }

  /* Page header */
  .page-header h1 {
    font-size: 1.2rem;
  }
  .page-header {
    margin-bottom: 1rem;
  }
  .page-subtitle {
    font-size: 0.8rem;
  }

  /* ── Stat cards: keep row layout, compact ── */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .stat-card {
    padding: 0.75rem;
    gap: 0.6rem;
    /* Keep horizontal icon+text on small screens */
    flex-direction: row;
    align-items: center;
  }
  .stat-card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
  }
  .stat-card-icon svg {
    width: 16px;
    height: 16px;
  }
  .stat-card-value {
    font-size: 1.15rem;
  }
  .stat-card-value-sm {
    font-size: 0.8rem;
  }
  .stat-card-label {
    font-size: 0.65rem;
  }

  /* ── Cards: proper padding, not zero ── */
  .card {
    padding: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.875rem;
  }
  .card-title {
    padding: 0.75rem 0.875rem 0;
    margin-bottom: 0.5rem;
  }
  .card-actions {
    padding: 0 0.875rem 0.75rem;
  }

  /* ── Table → Card layout on mobile ── */
  .table thead {
    display: none;
  }
  .table,
  .table tbody {
    display: block;
    width: 100%;
  }
  .table-wrapper {
    overflow-x: visible;
  }
  .table-wrapper::after {
    display: none;
  }

  .table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 0.875rem;
    border-bottom: 1px solid var(--border);
    gap: 0.2rem 0.5rem;
    align-items: center;
    position: relative;
  }
  .table tbody tr:last-child {
    border-bottom: none;
  }

  .table td {
    padding: 0;
    border-bottom: none;
    font-size: 0.82rem;
  }

  /* Client name: full width, first row */
  .table td:nth-child(1) {
    width: 100%;
    order: 1;
    margin-bottom: 0.1rem;
  }
  .client-name {
    font-size: 0.88rem;
  }
  .client-slug {
    font-size: 0.7rem;
  }

  /* Domain: full width, second row */
  .table td:nth-child(2) {
    order: 2;
    width: 100%;
    margin-bottom: 0.35rem;
  }
  .domain-link {
    font-size: 0.75rem;
    word-break: break-all;
  }

  /* Bot name, status, activity: inline row */
  .table td:nth-child(3) {
    order: 3;
    font-size: 0.75rem;
    color: var(--text-muted);
  }
  .table td:nth-child(4) {
    order: 4;
  }
  .table td:nth-child(5) {
    order: 5;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
  }

  /* Actions: full width at bottom */
  .table td:nth-child(6) {
    order: 6;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(42, 58, 78, 0.25);
  }
  .actions-cell {
    display: flex;
    gap: 0.5rem;
  }
  .actions-cell .btn {
    flex: 1;
    justify-content: center;
  }

  /* Disable hover border trick on mobile */
  .table-row-hover {
    border-left: none;
  }
  .table-row-hover:hover {
    border-left: none;
  }
  .table-row-hover:hover td:first-child {
    padding-left: 0;
  }

  /* ── Buttons: touch-friendly ── */
  .btn {
    min-height: 42px;
    padding: 0.5rem 0.9rem;
  }
  .btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    min-height: 36px;
  }
  .page-actions .btn {
    flex: 1;
    min-height: 42px;
    font-size: 0.82rem;
  }

  /* ── Tab buttons ── */
  .tab-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    min-height: 40px;
  }
  .tab-nav {
    gap: 0;
    margin-bottom: 1rem;
  }

  /* ── Commits ── */
  .commit-item {
    padding: 0.4rem 0;
    font-size: 0.78rem;
    gap: 0.5rem;
  }

  /* ── Code/log blocks ── */
  .code-block {
    font-size: 0.72rem;
    padding: 0.75rem;
  }

  /* ── Log toolbar: stack on narrow ── */
  .log-toolbar {
    gap: 0.375rem;
  }
  .log-search-input {
    min-width: 0;
    width: 100%;
    flex: unset;
  }

  /* ── Grid-2 already 1fr from 768, just tighten gap ── */
  .grid-2 {
    gap: 0.875rem;
  }

  /* ── Health rows: slightly smaller ── */
  .health-name {
    font-size: 0.8rem;
  }
  .health-pct {
    font-size: 0.75rem;
  }

  /* ── Template editor ── */
  .template-editor {
    min-height: 250px;
    font-size: 0.75rem;
  }

  /* ── Form inputs ── */
  .form-group input {
    font-size: 0.9rem;
    padding: 0.65rem 0.8rem;
  }
  .form-group label {
    font-size: 0.72rem;
  }

  /* ── Onboard result ── */
  .onboard-result {
    font-size: 0.8rem;
    padding: 0.65rem 0.85rem;
  }
}
