:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap { padding: 24px 28px 40px; }
.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.brand { font-weight: 800; font-size: 28px; }
.tag {
  font-size: 13px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.big { font-size: 30px; font-weight: 850; line-height: 1.1; }
.sub { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); }
.pill.ok .dot { background: var(--ok); }
.pill.bad .dot { background: var(--bad); }

select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}

.tableWrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 650; font-size: 12px; }

.muted { color: var(--muted); }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding: 16px; }
  .grid { grid-template-columns: repeat(1, 1fr); }
}


/* ---- settings helpers (v0.4) ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lbl { display: block; font-size: 12px; opacity: 0.75; margin-bottom: 4px; }
.chk { display: inline-flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0; }
textarea[readonly], input[readonly] { opacity: 0.85; }
button { cursor: pointer; }

.cat-pill {
  display: inline-block;
  padding: 6px 10px;
  margin: 4px;
  border-radius: 999px;
  border: 1px solid #555;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.cat-pill.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}
.pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  margin: 4px;
}

.pill--ok {
  background: #1d4ed8;      /* stronger blue */
  color: white;
  border-color: #1d4ed8;
  font-weight: 600;
}

.pill--bad {
  background: #b91c1c;
  color: white;
  border-color: #b91c1c;
  font-weight: 600;
}

.pill--muted {
  background: #e5e7eb;
  color: #6b7280;
}

.pill--disabled {
  background: #f1f5f9;
  color: #94a3b8;
  border-style: dashed;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Settings: toast + persistent error banner */
.error-banner {
  display: none;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  border-radius: 12px;
  font-size: 13px;
}

.error-banner.show {
  display: block;
}

.toast-host {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(15, 23, 42, 0.95);
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  font-size: 13px;
}

.toast.ok { border-color: rgba(34, 197, 94, 0.45); }
.toast.warn { border-color: rgba(245, 158, 11, 0.55); }
.toast.bad { border-color: rgba(239, 68, 68, 0.55); }

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: rgba(226, 232, 240, 0.85);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.info:hover {
  border-color: rgba(226, 232, 240, 0.6);
  color: rgba(255, 255, 255, 0.95);
}

.tooltip {
  position: absolute;
  z-index: 99999;
  max-width: 360px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.95);
  color: rgba(248, 250, 252, 0.95);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  font-size: 12px;
  line-height: 1.25;
}
#session-ratio.good {
  color: #22c55e; /* green */
  font-weight: 600;
}

#session-ratio.bad {
  color: #ef4444; /* red */
  font-weight: 600;
}
