/* ── QA Crawler — Styles ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:         #0e0f11;
  --surface:    #161719;
  --surface2:   #1e2023;
  --border:     #2a2c30;
  --text:       #e8e9ea;
  --text-muted: #7a7d85;
  --accent:     #e63946;
  --accent-dim: rgba(230,57,70,.12);
  --green:      #2dc653;
  --yellow:     #f4a261;
  --mono:       'DM Mono', monospace;
  --sans:       'DM Sans', sans-serif;
  --radius:     8px;
  --shadow:     0 2px 16px rgba(0,0,0,.4);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.3px;
}

.sidebar-logo .dot {
  color: var(--accent);
}

.sidebar-logo .version {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-label {
  padding: 6px 20px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all .15s;
  border-left: 3px solid transparent;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--text); border-left-color: var(--accent); background: var(--accent-dim); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.sidebar-footer .user-name { color: var(--text); font-weight: 500; }
.sidebar-footer a { color: var(--text-muted); text-decoration: none; font-size: 12px; }
.sidebar-footer a:hover { color: var(--accent); }

.main {
  margin-left: 220px;
  flex: 1;
  padding: 36px 40px;
  max-width: 1400px;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.5px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

/* ── Stat grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 4px;
  font-family: var(--mono);
  letter-spacing: -1px;
}

.stat-value.ok     { color: var(--green); }
.stat-value.warn   { color: var(--yellow); }
.stat-value.error  { color: var(--accent); }
.stat-value.neutral{ color: var(--text); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}

.badge-ok      { background: rgba(45,198,83,.12);  color: var(--green); }
.badge-warn    { background: rgba(244,162,97,.12);  color: var(--yellow); }
.badge-error   { background: rgba(230,57,70,.12);   color: var(--accent); }
.badge-info    { background: rgba(120,150,255,.12); color: #789bff; }
.badge-neutral { background: var(--surface2); color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all .15s;
}

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c9303c; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-danger    { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }

/* ── Forms ── */
.form-group  { margin-bottom: 20px; }
.form-label  { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; }
.alert-error   { background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); }
.alert-success { background: rgba(45,198,83,.1); border: 1px solid var(--green); color: var(--green); }
.alert-info    { background: rgba(120,150,255,.1); border: 1px solid #789bff; color: #789bff; }

/* ── Progress ── */
.progress-wrap { background: var(--surface2); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }

/* ── Live log ── */
.live-log {
  background: #0a0a0c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  height: 260px;
  overflow-y: auto;
  margin-top: 16px;
}

.live-log .log-line { padding: 1px 0; }
.live-log .log-ok   { color: var(--green); }
.live-log .log-err  { color: var(--accent); }
.live-log .log-info { color: #789bff; }

/* ── URL cell ── */
.url-cell {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-cell a { color: var(--text-muted); text-decoration: none; }
.url-cell a:hover { color: var(--accent); }

/* ── Auth pages ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

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

.auth-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 8px;
}

.auth-logo .dot { color: var(--accent); }

.auth-tagline {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* ── Misc ── */
.text-muted  { color: var(--text-muted); }
.text-ok     { color: var(--green); }
.text-error  { color: var(--accent); }
.text-warn   { color: var(--yellow); }
.text-mono   { font-family: var(--mono); }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mt-32       { margin-top: 32px; }
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-16      { gap: 16px; }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3      { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main    { margin-left: 0; padding: 24px 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
