/* ============================================================
   GSC Dashboard – Light Corporate Theme
   Inspired by heise regioconcept: Navy + Green, clean & airy
   ============================================================ */

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

:root {
  /* Palette */
  --navy:          #1a2e4a;
  --navy-mid:      #243a5e;
  --navy-light:    #2e4a78;
  --green:         #2eb87a;
  --green-dark:    #25996a;
  --green-muted:   rgba(46,184,122,0.12);
  --amber:         #f59e0b;
  --amber-muted:   rgba(245,158,11,0.12);
  --red:           #e53e3e;
  --red-muted:     rgba(229,62,62,0.1);

  /* Neutrals */
  --bg:            #f5f7fa;
  --bg-white:      #ffffff;
  --bg-hover:      #eef1f6;
  --border:        #dde3ed;
  --border-light:  #eaeff6;

  /* Text */
  --text:          #1a2e4a;
  --text-muted:    #5a6e8a;
  --text-dim:      #8fa3ba;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(26,46,74,0.08);
  --shadow:    0 2px 8px rgba(26,46,74,0.10);
  --shadow-md: 0 4px 16px rgba(26,46,74,0.12);
}

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

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(26,46,74,0.18);
}
.nav-brand {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: #fff;
  display: flex;
  align-items: center;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.nav-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-link--active { color: #fff; background: rgba(255,255,255,0.12); }
.nav-link--export { color: var(--green); font-weight: 600; }
.nav-link--export:hover { color: #fff; background: var(--green); }
.nav-user {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  padding: 0 0.75rem;
  border-left: 1px solid rgba(255,255,255,0.15);
  margin-left: 0.5rem;
}

/* ── Main ────────────────────────────────────────────────── */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.page-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── Quota Bar ───────────────────────────────────────────── */
.quota-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.65rem 1rem;
  box-shadow: var(--shadow-sm);
}
.quota-label { font-weight: 600; color: var(--text-muted); }
.quota-track {
  flex: 1;
  max-width: 200px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.quota-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.quota-num { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ── KPI Grid ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--border);
  transition: box-shadow 0.15s;
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-card--green { border-top-color: var(--green); }
.kpi-card--red   { border-top-color: var(--red); }
.kpi-card--navy  { border-top-color: var(--navy); }
.kpi-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.3rem;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.kpi-card--green .kpi-value { color: var(--green-dark); }
.kpi-card--red   .kpi-value { color: var(--red); }
.kpi-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ── Section ─────────────────────────────────────────────── */
.section { margin-bottom: 2rem; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.section-header .section-title { margin-bottom: 0; }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--navy); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap, .progress-table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table thead th {
  text-align: left;
  padding: 0.8rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody td { padding: 0.7rem 1rem; vertical-align: middle; }
.tr--locked { opacity: 0.55; }
.tr--stale  { background: rgba(229,62,62,0.03); }

.td--url { font-family: var(--font-mono); font-size: 0.78rem; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td--url a { color: var(--navy-light); text-decoration: none; }
.td--url a:hover { color: var(--green-dark); text-decoration: underline; }
.td--property { font-size: 0.8rem; color: var(--text-muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td--coverage { font-size: 0.78rem; color: var(--text-muted); max-width: 280px; }
.td--date { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }
.td--actions { white-space: nowrap; }
.td--empty { text-align: center; color: var(--text-dim); padding: 3rem; font-size: 0.875rem; }
.td--na { color: var(--text-dim); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--indexed      { background: rgba(46,184,122,0.12); color: var(--green-dark); }
.badge--not_indexed  { background: var(--red-muted); color: var(--red); }
.badge--unknown      { background: rgba(245,158,11,0.12); color: #b45309; }
.badge--error        { background: var(--red-muted); color: var(--red); }
.badge--warn         { background: rgba(245,158,11,0.12); color: #b45309; }
.badge--done         { background: rgba(46,184,122,0.12); color: var(--green-dark); }
.badge--running      { background: rgba(26,46,74,0.08); color: var(--navy); }
.badge--pending      { background: rgba(90,110,138,0.1); color: var(--text-muted); }
.badge--limit_reached { background: rgba(245,158,11,0.12); color: #b45309; }
.badge--locked       { background: var(--red-muted); color: var(--red); }
.badge--active       { background: rgba(46,184,122,0.12); color: var(--green-dark); }
.badge--self         { background: rgba(26,46,74,0.1); color: var(--navy); margin-left: 0.4rem; }
.badge--role-admin   { background: rgba(26,46,74,0.1); color: var(--navy); }
.badge--role-user    { background: rgba(90,110,138,0.1); color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary  { background: var(--green); color: #fff; box-shadow: 0 1px 4px rgba(46,184,122,0.3); }
.btn--primary:hover:not(:disabled) { background: var(--green-dark); box-shadow: 0 2px 8px rgba(46,184,122,0.4); }
.btn--navy     { background: var(--navy); color: #fff; }
.btn--navy:hover:not(:disabled) { background: var(--navy-mid); }
.btn--danger   { background: var(--red-muted); color: var(--red); border: 1px solid rgba(229,62,62,0.25); }
.btn--danger:hover:not(:disabled) { background: rgba(229,62,62,0.18); }
.btn--warning  { background: rgba(245,158,11,0.1); color: #b45309; border: 1px solid rgba(245,158,11,0.25); }
.btn--success  { background: var(--green-muted); color: var(--green-dark); border: 1px solid rgba(46,184,122,0.25); }
.btn--ghost    { background: #fff; color: var(--text-muted); border: 1px solid var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.btn--sm  { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn--xs  { padding: 0.2rem 0.55rem; font-size: 0.72rem; }
.btn--full { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.field--sm { max-width: 140px; }
.field-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.input {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--navy-light); box-shadow: 0 0 0 3px rgba(46,122,184,0.1); }
.input--otp {
  font-size: 1.8rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-family: var(--font-mono);
  padding: 0.75rem;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border-left: 3px solid transparent;
}
.alert--error   { background: var(--red-muted); color: var(--red); border-left-color: var(--red); }
.alert--success { background: var(--green-muted); color: var(--green-dark); border-left-color: var(--green); }
.alert--warning { background: rgba(245,158,11,0.1); color: #b45309; border-left-color: var(--amber); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}
.pagination-info { color: var(--text-muted); }

/* ── Auth Layout ─────────────────────────────────────────── */
.body--auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-wrap { width: 100%; max-width: 420px; padding: 1rem; }
.auth-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
}
.auth-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--navy);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-logo-icon::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
}
.auth-logo-text { font-weight: 800; font-size: 1rem; color: var(--navy); letter-spacing: 0.01em; }
.auth-title { font-size: 1.5rem; font-weight: 800; color: var(--navy); margin-bottom: 0.4rem; }
.auth-sub   { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.75rem; }
.auth-form .field { margin-bottom: 1.25rem; }
.auth-back  { display: block; margin-top: 1rem; text-align: center; font-size: 0.8rem; color: var(--text-muted); text-decoration: none; }
.auth-back:hover { color: var(--navy); }

/* ── Admin form ──────────────────────────────────────────── */
.admin-form .field-row { align-items: flex-end; }

/* ── Live Log Panel ──────────────────────────────────────── */
.log-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--navy);
  border-top: 2px solid var(--green);
}
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.log-header:hover { background: var(--navy-mid); }
.log-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
}
.log-status { font-size: 0.72rem; color: var(--amber); }
.log-body { border-top: 1px solid rgba(255,255,255,0.1); }
.log-entries {
  height: 200px;
  overflow-y: auto;
  padding: 0.4rem 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: #0f1929;
}
.log-line {
  display: flex;
  gap: 0.75rem;
  padding: 0.18rem 1.5rem;
  line-height: 1.5;
}
.log-line:hover { background: rgba(255,255,255,0.03); }
.log-ts  { color: rgba(255,255,255,0.3); white-space: nowrap; flex-shrink: 0; }
.log-msg { color: rgba(255,255,255,0.65); }
.log-line--info    .log-msg { color: rgba(255,255,255,0.65); }
.log-line--success .log-msg { color: #4ade80; }
.log-line--warn    .log-msg { color: #fbbf24; }
.log-line--error   .log-msg { color: #f87171; }

/* Offset main content so log panel doesn't overlap */
.main { padding-bottom: 5rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .nav-user { display: none; }
  .td--coverage { display: none; }
  .main { padding: 1.25rem 1rem 5rem; }
  .nav { padding: 0 1rem; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; }
  .field--sm { max-width: 100%; }
}
.badge--own { background: rgba(26,46,74,0.1); color: var(--navy); border: 1px solid rgba(26,46,74,0.2); }

/* ---- KPI Delta ---- */
.kpi-delta {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.kpi-delta-prev { color: var(--text-dim); }
.kpi-delta-diff { font-weight: 700; }
.delta--up   .kpi-delta-diff { color: var(--green-dark); }
.delta--down .kpi-delta-diff { color: var(--red); }
.delta--flat .kpi-delta-diff { color: var(--text-muted); }

/* ---- Nav brand link ---- */
.nav-brand-link {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
}
.nav-brand-link:hover { color: rgba(255,255,255,0.85); }

/* ---- Config rows ---- */
.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}
.config-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}
.config-key {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
}
.config-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.config-control { flex-shrink: 0; }

/* ---- Toggle switch ---- */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
