:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --hover: #f8fafc;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121a2b;
  --surface-2: #0e1526;
  --text: #e6e9ef;
  --text-muted: #9aa4b2;
  --text-light: #748094;
  --accent: #4c7cf5;
  --accent-hover: #7a5cff;
  --success: #34d399;
  --success-bg: #0f2921;
  --error: #ff7b86;
  --error-bg: #2b1620;
  --warning: #f59e0b;
  --warning-bg: #2a1f0a;
  --border: #1f2a44;
  --border-light: #162038;
  --hover: #0e1526;
  --shadow: 0 1px 3px 0 rgba(0,0,0,.6), 0 1px 2px 0 rgba(0,0,0,.4);
  --shadow-md: 0 6px 10px -2px rgba(0,0,0,.55), 0 3px 6px -2px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 20px -3px rgba(0,0,0,.6), 0 6px 10px -3px rgba(0,0,0,.45);
}

* { 
  box-sizing: border-box; 
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  min-height: 100vh;
}

/* Nice theme transition */
* {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

a { 
  color: var(--accent); 
  text-decoration: none; 
  transition: all 0.2s ease;
}
a:hover { 
  text-decoration: underline; 
  color: var(--accent-hover);
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

/* Ambient animated background (shared) */
.scene { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.blob { position: absolute; width: 680px; height: 680px; border-radius: 50%; filter: blur(60px); opacity: .28; mix-blend-mode: multiply; animation: float 18s ease-in-out infinite; }
.blob:nth-child(1) { left: -160px; top: -180px; background: radial-gradient(closest-side, var(--accent), transparent 70%); animation-delay: -2s; }
.blob:nth-child(2) { right: -200px; bottom: -220px; background: radial-gradient(closest-side, #8b5cf6, transparent 70%); animation-delay: -8s; }
.blob:nth-child(3) { left: 35%; top: 55%; background: radial-gradient(closest-side, #22c55e, transparent 70%); animation-delay: -12s; }
@keyframes float { 0%,100% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-24px) translateX(12px) scale(1.03); } }

/* Glass effects */
.glass { position: sticky; top: 0; background: color-mix(in oklab, var(--surface) 78%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent); z-index: 2; }
[data-theme="dark"] .glass { background: rgba(24,24,27,.55); border-bottom-color: rgba(255,255,255,.08); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.glass-panel { background: color-mix(in oklab, var(--surface) 85%, transparent); border: 1px solid color-mix(in oklab, var(--border) 70%, transparent); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); position: relative; z-index: 1; }
[data-theme="dark"] .glass-panel { background: rgba(24,24,27,.5); border-color: rgba(255,255,255,.08); box-shadow: 0 20px 50px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.35); }

.topbar h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
}

.meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta::before {
  content: '🔄';
  font-size: 0.75rem;
}

.topbar__left { 
  display: flex; 
  flex-direction: column; 
}

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

/* Brand area */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__title {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.topbar__search { flex: 1 1 auto; }

.topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--accent);
  background: transparent;
}
.icon-btn:active {
  transform: translateY(0);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Search Bar */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px 12px 44px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  width: 320px;
  transition: all 0.2s ease;
  width: 800px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--surface);
}

.search-input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-light);
  font-size: 0.875rem;
}

/* Buttons */
.button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.button:hover::before {
  left: 100%;
}

.button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button[disabled] { 
  opacity: 0.6; 
  cursor: not-allowed; 
  transform: none;
}

.button--secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Remove boxes around icon actions; keep color cues only */
.button--ghost, .button--danger { border: none; background: transparent; padding: 0; }

/* Theme toggle */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle:hover {
  background: var(--surface-2);
}

/* Stats Cards */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

.stat-card--success::before {
  background: var(--success);
}

.stat-card--error::before {
  background: var(--error);
}

.stat-card--warning::before {
  background: var(--warning);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1;
}

.stat-card--success .stat-number {
  color: var(--success);
}

.stat-card--error .stat-number {
  color: var(--error);
}

.stat-card--warning .stat-number {
  color: var(--warning);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Container */
.container {
  padding: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

/* Table */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th {
  text-align: left;
  padding: 20px 24px;
  font-weight: 700;
  color: var(--text);
  user-select: none;
  cursor: pointer;
  position: relative;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.table thead th:hover {
  background: var(--hover);
  color: var(--accent);
}

.table thead th.sorted-asc::after,
.table thead th.sorted-desc::after {
  content: '';
  border: 6px solid transparent;
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.table thead th.sorted-asc::after {
  border-bottom-color: var(--accent);
}

.table thead th.sorted-desc::after {
  border-top-color: var(--accent);
}

.table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.table tbody tr:nth-child(even) {
  background: var(--surface-2);
}

.table tbody tr:hover {
  background: var(--hover);
}

.table td {
  padding: 20px 24px;
  font-size: 0.875rem;
  vertical-align: middle;
}

/* Login page specific styles */
.login-page .container { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-page .scene { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.login-page .blob { width: 520px; height: 520px; filter: blur(50px); opacity: .35; animation: float 16s ease-in-out infinite; }
.login-page .blob:nth-child(1) { left: -120px; top: -140px; background: radial-gradient(closest-side, var(--accent), transparent 70%); animation-delay: -2s; }
.login-page .blob:nth-child(2) { right: -160px; bottom: -160px; background: radial-gradient(closest-side, #8b5cf6, transparent 70%); animation-delay: -6s; }
.login-page .blob:nth-child(3) { left: 40%; top: 60%; background: radial-gradient(closest-side, #22c55e, transparent 70%); animation-delay: -10s; }

.login-page .card { width: 100%; max-width: 440px; position: relative; z-index: 1; background: color-mix(in oklab, var(--surface) 82%, transparent); border: 1px solid color-mix(in oklab, var(--border) 70%, transparent); border-radius: 16px; padding: 26px; box-shadow: 0 10px 30px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
[data-theme="dark"] .login-page .card { background: rgba(24,24,27,.55); border-color: rgba(255,255,255,.08); box-shadow: 0 20px 50px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.35); }
.login-page h1 { font-size: 22px; margin: 0 0 8px; color: var(--text); }
.login-page p { margin: 0 0 18px; color: var(--text-muted); }
.login-page .field { margin-bottom: 14px; }
.login-page label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.login-page input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); outline: none; }
.login-page input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.login-page .btn { width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 70%, black)); color: white; font-weight: 700; letter-spacing: .2px; cursor: pointer; transition: transform .06s ease, filter .15s ease, background .2s ease; }
.login-page .btn:hover { background: var(--accent-hover); }
.login-page .btn:active { transform: translateY(1px); filter: brightness(.96); }
.login-page .error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(239,68,68,.35); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; display: none; }
.login-page .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.login-page .brand img { width: 28px; height: 28px; }
.login-page .hint { margin-top: 10px; font-size: 12px; color: var(--text-light); text-align: center; }
.login-page .header-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.login-page .theme-toggle { width: auto; }
.login-theme-toggle { position: fixed; top: 16px; right: 16px; z-index: 1000; }
.login-page .subtitle { margin-top: -4px; margin-bottom: 16px; font-size: 13px; color: var(--text-light); }
.login-page .divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.login-page .divider::before, .login-page .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Client name styling */
.client-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.client-url {
  font-size: 0.75rem;
  color: var(--text-light);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  word-break: break-all;
}

/* Version styling */
.version-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.version-text--na {
  color: var(--text-light);
  font-style: italic;
}

/* HTTP Status Badge */
.http-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.http-status--200 {
  background: var(--success-bg);
  color: var(--success);
}

.http-status--error {
  background: var(--error-bg);
  color: var(--error);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.badge--ok {
  background: var(--success-bg);
  color: var(--success);
}

.badge--error {
  background: var(--error-bg);
  color: var(--error);
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Footer */
.footer {
  color: var(--text-muted);
  text-align: center;
  padding: 32px 20px;
  margin-top: 48px;
 
}

.footer p {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

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

/* Fade animations */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px auto;
}

.loading-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text);
}

.loading-state p {
  font-size: 0.875rem;
  margin: 0;
  color: var(--text-light);
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text);
}

.no-results p {
  font-size: 0.875rem;
  margin: 0;
  color: var(--text-light);
}

/* Responsive design */
@media (max-width: 1024px) {
  .search-input {
    width: 240px;
  }
  
  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .brand__logo { width: 32px; height: 32px; border-radius: 8px; }
  .topbar h1 { font-size: 1.125rem; }
  
  .topbar__right {
    width: 100%;
    justify-content: space-between;
  }
  .brand__sub { flex-wrap: wrap; }
  
  .search-input {
    width: 100%;
    max-width: 300px;
  }
  
  .stats-container {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 20px 16px;
  }
  
  .table thead th,
  .table td {
    padding: 16px 20px;
  }
}

@media (max-width: 640px) {
  .table thead {
    display: none;
  }
  .table, .table tbody, .table tr, .table td {
    display: block;
    width: 100%;
  }
  .table tbody tr {
    border: 1px solid var(--border);
    margin: 12px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .table td {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 8px;
    align-items: center;
  }
  .table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}