:root {
  --ink: #0a0f1a;
  --muted: #5a6270;
  --accent: #0d9488;
  --accent-muted: rgba(13, 148, 136, 0.12);
  --surface: #ffffff;
  --bg: #f0f4f5;
  --border: #d8e0e4;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(10, 15, 26, 0.06);
  --max: 1280px;
  --font: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  font-size: 15px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header.shell {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

header.shell .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

header.shell h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header.shell nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.92rem;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 960px) {
  .grid-main {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

label.row {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  align-items: center;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.primary:hover {
  filter: brightness(1.05);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.stat {
  background: var(--accent-muted);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.stat .k {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat .v {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.stat .v.ok {
  color: var(--accent);
}

.stat .v.bad {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.data th,
table.data td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data th {
  background: #f8fafb;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

table.data tbody tr {
  cursor: pointer;
}

table.data tbody tr:hover {
  background: rgba(13, 148, 136, 0.06);
}

table.data tbody tr.selected {
  background: var(--accent-muted);
}

.mono {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.82rem;
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.pending {
  background: #e0e7ff;
  color: #3730a3;
}

.badge.running {
  background: #fef3c7;
  color: #92400e;
}

.badge.completed {
  background: #d1fae5;
  color: #065f46;
}

.badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.charts {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .charts {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.chart-box {
  position: relative;
  min-height: 220px;
}

.chart-box canvas {
  max-height: 260px;
}

.detail-meta {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.detail-meta strong {
  color: var(--ink);
}

.links-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}

#detailPanel h2 {
  margin-bottom: 0.5rem;
}

.detail-subh {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
}

@media (max-width: 520px) {
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi-item {
  background: linear-gradient(180deg, #f8fafb 0%, #f0f4f5 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  text-align: center;
}

.kpi-item .kpi-n {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.kpi-item .kpi-l {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 0.2rem;
}

.kpi-item.kpi-accent .kpi-n {
  color: var(--accent);
}

.detail-callout {
  margin: 0.5rem 0 0.75rem;
  padding: 0.55rem 0.7rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.86rem;
  color: #78350f;
}

.detail-callout.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.artifact-block {
  margin: 0.75rem 0;
}

.artifact-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.86rem;
  color: var(--ink);
}

.json-block {
  margin: 0.5rem 0;
  font-size: 0.88rem;
}

.json-block summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem 0;
}

.json-pre {
  margin: 0.35rem 0 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
  overflow-x: auto;
  max-height: 200px;
}

.deck-block {
  margin: 0.85rem 0;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.deck-pre {
  margin: 0.5rem 0 0;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.deck-pre-de {
  margin-top: 0.65rem;
  border-left: 3px solid var(--accent);
}

.banner-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 1rem 0;
}

footer.note {
  max-width: var(--max);
  margin: 2rem auto 1.5rem;
  padding: 0 1.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}
