/* PKL Control Center — derived from pkm.cleaner.engine */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,600&display=swap");

:root {
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Source Serif 4", ui-serif, Georgia, serif;
  --lfiq-surface-high: #1e2338;
  --lfiq-ink-strong: #e4e8f7;
  --lfiq-radius-panel: 18px;
  --lfiq-radius-card: 14px;
  --lfiq-shadow-elevated:
    0 1px 0 rgba(173, 198, 255, 0.04) inset,
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 20px 48px -12px rgba(0, 0, 0, 0.5);
  --lfiq-shadow-card:
    0 1px 0 rgba(173, 198, 255, 0.03) inset,
    0 1px 3px rgba(0, 0, 0, 0.25),
    0 10px 28px -8px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--lfiq-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(77, 124, 255, 0.08), transparent 52%),
    linear-gradient(175deg, var(--surface) 0%, var(--surface-container-low) 38%, var(--surface-container-lowest) 100%);
  color: var(--lfiq-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--lfiq-ink-strong);
}

code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  font-size: 0.85em;
  color: var(--lfiq-text);
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 1.35rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(173, 198, 255, 0.1);
}

.topnav-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--lfiq-ink-strong);
  text-decoration: none;
}

.topnav-by {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lfiq-text-secondary);
}

.hero {
  position: relative;
  padding: 2rem 2rem 2.15rem;
  margin-bottom: 2.75rem;
  background: linear-gradient(180deg, var(--surface-container-lowest) 0%, var(--surface-container-low) 100%);
  border: 1px solid rgba(173, 198, 255, 0.1);
  border-radius: var(--lfiq-radius-panel);
  box-shadow: var(--lfiq-shadow-elevated);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--lfiq-primary) 0%, #6b93ff 42%, rgba(77, 124, 255, 0.2) 100%);
}

.kicker {
  margin: 0 0 0.4rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lfiq-primary);
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  line-height: 1.15;
}

.lede {
  max-width: 62ch;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--lfiq-text);
  margin: 0;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 1.65rem 0 0;
}

.hero-stat {
  padding: 1rem 1.15rem;
  background: var(--lfiq-surface-muted);
  border: 1px solid var(--lfiq-border);
  border-radius: 12px;
}

.hero-stat dt {
  margin: 0 0 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lfiq-text-secondary);
}

.hero-stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--lfiq-primary);
  line-height: 1.2;
  word-break: break-word;
}

.hero-stat dd.warn { color: #f87171; }
.hero-stat dd.muted { color: var(--lfiq-text-secondary); font-size: 1rem; }

.section {
  margin-bottom: 2rem;
  padding: 1.75rem 1.85rem 2rem;
  background: var(--lfiq-surface);
  border: 1px solid var(--lfiq-border);
  border-radius: var(--lfiq-radius-panel);
  box-shadow: var(--lfiq-shadow-card);
}

.tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(173, 198, 255, 0.12);
}

.tabs button {
  position: relative;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--lfiq-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

.tabs button:hover {
  color: var(--lfiq-text);
  background: rgba(173, 198, 255, 0.06);
}

.tabs button[aria-selected="true"] {
  color: var(--lfiq-primary);
  background: rgba(173, 198, 255, 0.08);
}

.tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0.5rem;
  right: 0.5rem;
  height: 2px;
  background: var(--lfiq-primary);
  border-radius: 2px 2px 0 0;
}

.panel[hidden] { display: none !important; }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.35rem;
  background: linear-gradient(180deg, var(--surface-container-lowest) 0%, var(--surface-container-low) 100%);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--lfiq-radius-card);
  box-shadow: var(--lfiq-shadow-card);
}

.card h3, .card h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
}

.muted { color: var(--lfiq-text-secondary); font-size: 0.875rem; }
.small { font-size: 0.75rem; }
.warn { color: #fca5a5; }
.ok { color: #4ade80; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pkm-primary-container) 0%, var(--pkm-primary) 100%);
  color: #fff;
  border: 1px solid rgba(77, 124, 255, 0.45);
}

.btn-primary:hover { box-shadow: 0 2px 12px rgba(77, 124, 255, 0.3); }

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

.btn-secondary:hover {
  border-color: rgba(173, 198, 255, 0.35);
  background: var(--surface-container);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.field { margin-bottom: 1rem; }

.input {
  width: 100%;
  max-width: 36rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--lfiq-border);
  border-radius: 10px;
  background: var(--lfiq-surface-muted);
  font: inherit;
  font-size: 0.9rem;
  color: var(--lfiq-text);
}

.input::placeholder { color: var(--pkm-text-secondary); opacity: 0.7; }
.input:focus { outline: 2px solid var(--lfiq-primary-muted); border-color: var(--lfiq-primary); }

/* Health rows */
.health-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(173, 198, 255, 0.08);
}
.health-row:last-child { border-bottom: none; }

.dot {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 3px;
}
.dot--ok { background: #4ade80; box-shadow: 0 0 6px rgba(74, 222, 128, 0.4); }
.dot--fail { background: #f87171; box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
.dot--warn { background: #fbbf24; }
.dot--info { background: #60a5fa; }

.health-info { flex: 1; min-width: 0; }
.health-name { font-size: 0.9rem; font-weight: 600; color: var(--lfiq-ink-strong); }
.health-loc {
  display: block;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.7rem;
  color: rgba(173, 198, 255, 0.7);
  margin-top: 0.15rem;
  word-break: break-all;
}
.health-fix {
  margin-top: 0.4rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.15);
  border-radius: 8px;
}
.health-fix code { font-size: 0.7rem; color: #fca5a5; }

/* Tables */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(173, 198, 255, 0.08);
}
table.data th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lfiq-text-secondary);
}
table.data tr:hover td { background: rgba(173, 198, 255, 0.03); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .stale { color: #fca5a5; }
table.data code { font-size: 0.75rem; }

/* Inbox lanes */
.lane-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.lane-card .lane-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.lane-count {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--lfiq-primary);
}
.lane-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow: auto;
  font-size: 0.8rem;
}
.lane-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(173, 198, 255, 0.06);
  word-break: break-all;
}
.lane-list li.stale { color: #fca5a5; }

/* Run history / job output */
.job-log {
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(173, 198, 255, 0.12);
  background: var(--surface-container-low);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
  color: var(--lfiq-text-secondary);
}

.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  background: rgba(251, 191, 36, 0.06);
}
.alert-row.info { border-color: rgba(96, 165, 250, 0.18); background: rgba(96, 165, 250, 0.06); }
.alert-row .alert-title { font-weight: 600; color: var(--lfiq-ink-strong); margin-bottom: 0.15rem; }
.alert-row .alert-detail { font-size: 0.8rem; color: var(--lfiq-text-secondary); }

.footer {
  margin-top: 2.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--lfiq-radius-card);
  border: 1px dashed rgba(173, 198, 255, 0.12);
  background: var(--surface-container);
  font-size: 0.8125rem;
  color: var(--lfiq-text-secondary);
}
.footer p { margin: 0; max-width: 75ch; }
