:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e7ecf3;
  --muted: #8b98a8;
  --accent: #5b8def;
  --border: #2a3647;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.top {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.top h1 { margin: 0.25rem 0 0; font-size: 1.35rem; font-weight: 650; }

.crumb { margin: 0 0 0.5rem; font-size: 0.9rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.meta code {
  overflow-wrap: anywhere;
  word-break: break-all;
  max-width: min(100%, 36rem);
}

main { padding: 1.25rem 1.5rem 2rem; max-width: 1100px; }

main.detail { max-width: 1100px; }

.banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.banner-warn {
  background: #2a2410;
  color: #f0e6c8;
}
.banner-err {
  background: #2a1518;
  color: #f5d0d4;
}

.ai-block h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}
.ai-block h3:first-child { margin-top: 0; }
.ai-summary { margin: 0 0 0.5rem; white-space: pre-wrap; }
.ai-list { margin: 0.25rem 0 0.75rem 1.1rem; }
.small { font-size: 0.82rem; }
.inline-form { display: inline-block; margin-top: 0.5rem; }

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

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #111822;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

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

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

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

td.title { font-weight: 500; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 650;
}

.row-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #0b1020;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
}

button.secondary {
  background: transparent;
  color: var(--text);
}

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

pre.json {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  max-height: 52vh;
  background: #111822;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  border: 1px solid var(--border);
}

pre.log-journal {
  max-height: 70vh;
  white-space: pre-wrap;
  word-break: break-word;
}

.grid-dl {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0;
}

.grid-dl dt { color: var(--muted); margin: 0; }
.grid-dl dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-side .grid-dl dd code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.35;
}

.detail-split .detail-split-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1.25rem 1.75rem;
  align-items: start;
}

.split-col {
  min-width: 0;
}

.ai-side {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

@media (max-width: 820px) {
  .detail-split .detail-split-inner {
    grid-template-columns: 1fr;
  }
}

.split-col h2 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 650;
}

.ai-side h2 { margin-bottom: 0.35rem; }

.ai-footnote {
  margin: 0 0 0.85rem;
}

.ai-state-block {
  margin-top: 0.25rem;
}

.ai-state-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.ai-inline-banner {
  margin-bottom: 0.75rem;
}

.progress {
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  margin: 0.35rem 0 0.5rem;
}

.progress-indeterminate {
  position: relative;
}

.progress-indeterminate > span {
  display: block;
  height: 100%;
  width: 42%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #7eb0ff);
  animation: ai-indet 1.1s ease-in-out infinite;
}

@keyframes ai-indet {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(240%); }
}

.ai-list-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 6.5rem;
}

.ai-list-progress-wrap .progress {
  margin: 0;
  max-width: 8rem;
}

.ai-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.ai-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ai-badge-ok {
  color: #b8e0c8;
  background: #152a1f;
  border-color: #2a4a38;
}

.ai-badge-err {
  color: #f5c4c8;
  background: #2a1518;
  border-color: #5a3036;
}

.ai-badge-off {
  color: var(--muted);
  background: #111822;
  border-color: var(--border);
}

a.ai-cell-link {
  font-size: 0.85rem;
  font-weight: 600;
}

td.ai-status-cell {
  vertical-align: middle;
  max-width: 9rem;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.ai-monitor-table code.mono-tiny {
  font-size: 0.68rem;
  word-break: break-all;
}

.ai-monitor-table .err-cell {
  max-width: 14rem;
  overflow-wrap: anywhere;
}

tr.ai-row-active td {
  background: rgba(91, 141, 239, 0.08);
}

td.ai-status-cell .ai-list-progress-wrap {
  white-space: nowrap;
}
