/* clowder UI — components: public pages, tiles, tables, pills, bars, hero, tabs, chips,
   the tree outline, the trace strip, the master–detail split. */

/* ── Public pages (landing, login, denied, problem) ─────── */
.centered { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.centered-inner { max-width: 640px; text-align: center; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted);
}
.display-title {
  font-family: var(--font-display); font-style: italic; font-weight: 800; text-transform: uppercase;
  font-size: clamp(40px, 6vw, 72px); line-height: 0.95; margin: 8px 0; color: var(--dark);
}
.display-title.sm { font-size: 26px; line-height: 1.1; margin: 0; }
.display-title .accent {
  background: linear-gradient(135deg, #FFDE00 0%, #F5C800 40%, #0BE5C1 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.tagline { font-size: 17px; line-height: 1.6; color: var(--text-secondary); margin: 24px auto 32px; max-width: 480px; }
.points { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 0 36px; padding: 0; list-style: none; }
.points li {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card);
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}
.card.narrow { width: 100%; max-width: 400px; padding: 36px 32px; }
.card.center { text-align: center; }
.field { margin: 0 0 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin: 0 0 6px; }

/* ── Cards, panels, sections ────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  min-width: 0;
}
.card.is-warn { border-color: rgba(245, 158, 11, 0.4); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--dark); display: flex; align-items: baseline; gap: 8px; }
.card-subtitle { margin: 16px 0 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.count { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.hint { margin: 0 0 12px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.note { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--violet); background: var(--violet-muted); border-radius: 6px; font-size: 12px; }
.prose { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.pre {
  margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-elevated);
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  max-height: 360px; overflow: auto;
}
.examples { margin: 0; padding-left: 18px; }
.examples li { margin: 2px 0; }
.issues { margin: 6px 0 0; padding-left: 18px; }
.issues li { margin: 2px 0; }

.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
.section { margin: 0 0 24px; min-width: 0; }
.section-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 20px; }
@media (max-width: 1200px) { .three-col { grid-template-columns: 1fr; } }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.alert { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); margin: 0 0 16px; font-size: 13px; }
.alert.is-bad { border-color: rgba(239, 68, 68, 0.4); background: var(--red-muted); }
.alert.is-warn { border-color: rgba(245, 158, 11, 0.4); background: var(--amber-muted); }

.tech { margin: 8px 0 0; font-size: 12px; }
.tech summary { cursor: pointer; color: var(--text-secondary); font-weight: 600; }
.tech .kv { margin-top: 10px; }

/* ── Key / value ────────────────────────────────────────── */
.kv { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 12px; }
.kv > div { display: contents; }
.kv dt { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ── Tiles (home) ───────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 28px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  text-decoration: none; display: block; border-left: 4px solid var(--border);
}
.tile.is-live { border-left-color: var(--amber); }
.tile.is-attn { border-left-color: var(--red); }
.tile.is-clear .tile-num { color: var(--text-muted); }
.tile-num { font-size: 26px; line-height: 1.1; font-weight: 600; color: var(--dark); }
.tile-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 4px; }
.chip { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--bg-elevated); font-family: var(--font-mono); font-size: 10px; text-transform: none; letter-spacing: 0; }

/* ── Tables ─────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 12px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border);
  background: var(--bg-card); position: sticky; top: 0; white-space: nowrap;
}
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl .w-bar { width: 160px; min-width: 120px; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: var(--bg-elevated); }
.tbl a { text-decoration: none; }
.tbl a:hover { text-decoration: underline; }
.tbl.compact td, .tbl.compact th { padding: 6px 10px; }
.tbl td.wrap { white-space: normal; max-width: 420px; }
.tbl td.src { white-space: normal; }
/* Row tints: a faint wash per state, so trouble shows in a long list. */
.tbl tr.row-error td, .tbl tr.row-missing td { background: rgba(239, 68, 68, 0.045); }
.tbl tr.row-partial td, .tbl tr.row-running td, .tbl tr.row-no_fit td, .tbl tr.row-low td { background: rgba(245, 158, 11, 0.045); }
.tbl tr.row-insufficient_info td { background: rgba(107, 114, 128, 0.06); }
.tbl tr.is-excluded td { color: var(--text-muted); }
.tbl tr.is-highlight td { box-shadow: inset 3px 0 0 var(--accent); }
.empty { padding: 28px 12px; text-align: center; color: var(--text-muted); font-size: 12px; white-space: normal; }

/* Expandable rows: .xp-row toggles the .xp-body row that follows it. */
.xp-cell { width: 28px; padding-right: 0 !important; }
.xp-toggle { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; width: 20px; height: 20px; border-radius: 5px; }
.xp-toggle:hover { background: var(--bg-elevated); color: var(--dark); }
.xp-row.is-open td { border-bottom-color: transparent; background: var(--bg-elevated); }
.xp-body td { white-space: normal; background: var(--bg); padding: 12px 16px 16px 44px; }

/* ── Pills, chips, legend ───────────────────────────────── */
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; line-height: 1.6;
  background: var(--bg-elevated); color: var(--text-secondary);
}
.pill.is-ok { background: var(--emerald-muted); color: #047857; }
.pill.is-warn { background: var(--amber-muted); color: #B45309; }
.pill.is-bad { background: var(--red); color: #fff; }
.pill.is-muted { background: var(--bg-elevated); color: var(--text-muted); }
.pill.is-neutral { background: var(--bg-elevated); color: var(--text-secondary); }
.pill.is-teal { background: var(--teal-muted); color: #0F766E; }
.pill.is-violet { background: var(--violet-muted); color: #6D28D9; }

.toolbar { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; flex-wrap: wrap; }
.toolbar.wrap { row-gap: 8px; }
.chips { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chips-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-right: 4px; }
.chip-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card); font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-decoration: none; cursor: pointer; font-family: inherit; line-height: 1.3;
}
.chip-link:hover { border-color: #D1D5DB; color: var(--dark); }
.chip-link.is-active { background: var(--dark); color: #fff; border-color: var(--dark); }
.chip-link.is-active .path-leaf, .chip-link.is-active .path-anc { color: #fff; }
.chip-link.is-active .path-anc { opacity: 0.7; }
.chip-link.is-attn:not(.is-active) { border-color: rgba(245, 158, 11, 0.6); }
.chip-link .mono { font-size: 11px; opacity: 0.8; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--text-secondary); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.live { font-size: 11px; color: var(--amber); font-weight: 700; margin-right: 4px; }

/* ── Bars ───────────────────────────────────────────────── */
.stack { display: flex; width: 100%; border-radius: 4px; overflow: hidden; background: var(--bg-elevated); }
.stack .seg { display: block; height: 100%; }
.tone-ok { background: var(--emerald); }
.tone-warn { background: var(--amber); }
.tone-bad { background: var(--red); }
.tone-muted { background: #9CA3AF; }
.tone-open { background: repeating-linear-gradient(45deg, #D1D5DB 0 4px, #E5E7EB 4px 8px); }

.minibar { display: inline-flex; width: 44px; height: 6px; border-radius: 2px; overflow: hidden; background: var(--bg-elevated); vertical-align: middle; }
.minibar i { display: block; height: 100%; }

.hbar { display: block; width: 100%; height: 8px; border-radius: 3px; background: var(--bg-elevated); overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent-dark); }

/* Fit bars: name | bar | value, best row emphasised. */
.fitbars { display: flex; flex-direction: column; gap: 3px; }
.fitbar {
  display: grid; grid-template-columns: minmax(140px, 2fr) minmax(80px, 1.4fr) max-content; gap: 10px; align-items: center;
  font-size: 12px; padding: 2px 6px; border-radius: 6px; text-decoration: none; min-width: 0;
}
.fitbar.is-link:hover { background: var(--bg-elevated); }
.fitbar.is-chosen { background: var(--emerald-muted); }
.fitbar.is-chosen .fitbar-name { font-weight: 700; }
.fitbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fitbar-bar { display: block; height: 7px; border-radius: 3px; background: var(--bg-elevated); overflow: hidden; }
.fitbar-bar i { display: block; height: 100%; background: var(--accent-dark); }
.fitbar-bar.is-warn i { background: var(--amber); }
.fitbar-bar.is-bad i { background: var(--red); }
.fitbar-val { font-size: 11.5px; white-space: nowrap; }
.fitbar-more { font-size: 11px; color: var(--text-muted); padding: 2px 6px; }

/* ── Paths ──────────────────────────────────────────────── */
.path { display: inline; min-width: 0; }
.path-anc { color: var(--text-muted); font-size: 11.5px; margin-right: 4px; }
.path-leaf { font-weight: 600; color: var(--dark); text-decoration: none; }
.path-leaf.is-root { font-style: italic; color: var(--text-secondary); }
a.path-leaf:hover { text-decoration: underline; }
.idchip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.copy { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.copy:hover { color: var(--dark); }
.copy.is-done { color: var(--emerald); }

/* ── Hero, stats, tabs ──────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1fr minmax(240px, 320px); gap: 24px; margin: 0 0 16px; align-items: start; }
@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } }
.hero-main { min-width: 0; }
.hero-side { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.hero-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hero-bar { margin-top: 12px; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin: 6px 0; }
.stat b { color: var(--dark); font-weight: 600; }
.stat.is-warn b { color: var(--amber); }
.stat.is-bad b { color: var(--red); }
.jobstrip { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; margin: 6px 0; }
.jobstrip-item { display: inline-flex; gap: 6px; align-items: baseline; }
.jobstrip-item .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 16px; }
.tab { padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: baseline; }
.tab:hover { color: var(--dark); }
.tab.is-active { color: var(--dark); border-bottom-color: var(--accent); }

.failure-banner {
  background: var(--red-muted); border: 1px solid rgba(239, 68, 68, 0.35); border-left: 4px solid var(--red);
  border-radius: 10px; padding: 8px 12px; margin: 8px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.failure-banner-cls { padding: 2px 8px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--font-mono); font-size: 11px; }
.failure-banner-msg { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

/* ── Pager ──────────────────────────────────────────────── */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; }
.pager-meta { font-size: 11.5px; color: var(--text-muted); }
.pager-links { display: flex; gap: 6px; }

/* ── Master–detail split: tree left, content right ──────── */
.split { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.split-tree {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 8px 12px;
  position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; min-width: 0;
}
.split-head { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 8px; border-bottom: 1px solid var(--border-light); margin-bottom: 6px; }
.split-meta { font-size: 11px; color: var(--text-muted); padding: 0 6px 6px; }
.split-main { min-width: 0; }
.search { margin: 0; }

/* ── Tree outline ───────────────────────────────────────── */
.tree, .tn-children { list-style: none; margin: 0; padding: 0; }
.tn-row {
  display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px calc(6px + var(--depth, 0) * 16px);
  border-radius: 6px; min-height: 24px; font-size: 12.5px;
}
.tn-row:hover { background: var(--bg-elevated); }
.tn.is-selected > .tn-row { background: var(--accent-muted); box-shadow: inset 3px 0 0 var(--accent-dark); }
.tn.is-match > .tn-row .tn-name { background: var(--yellow-muted); border-radius: 3px; }
.tn.is-excluded > .tn-row .tn-name { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.tn.is-issue > .tn-row { background: var(--red-muted); }
.tn-toggle {
  flex: 0 0 18px; width: 18px; height: 18px; border: 0; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 11px; border-radius: 4px; padding: 0; line-height: 18px; text-align: center;
}
.tn-toggle:hover { background: var(--bg-hover); color: var(--dark); }
.tn-toggle.is-leafmark { cursor: default; color: var(--border); }
.tn-toggle.is-leafmark:hover { background: transparent; }
.tn-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: var(--dark); }
.tn-name:hover { text-decoration: underline; }
.tn-name.is-root { font-style: italic; color: var(--text-secondary); }
.tn.is-leaf > .tn-row .tn-name { font-weight: 500; }
.tn:not(.is-leaf) > .tn-row .tn-name { font-weight: 600; }
.tn-tag { font-family: var(--font-mono); font-size: 9.5px; padding: 0 5px; border-radius: 4px; background: var(--bg-elevated); color: var(--text-muted); white-space: nowrap; }
.tn-tag.is-bad { background: var(--red); color: #fff; }
.tn-figs { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tn-bar { display: inline-block; width: 56px; height: 6px; border-radius: 2px; background: var(--bg-elevated); overflow: hidden; }
.tn-bar i { display: block; height: 100%; background: var(--accent-dark); min-width: 1px; }
.tn-count { font-size: 11.5px; min-width: 28px; text-align: right; color: var(--dark); }
.tn-count.is-zero { color: var(--text-muted); }
.tn-stop { font-family: var(--font-mono); font-size: 10px; padding: 0 6px; border-radius: 999px; background: var(--amber-muted); color: #B45309; white-space: nowrap; }
.tn-muted { color: var(--text-muted); font-size: 11.5px; font-style: italic; }
.tn-hidden .tn-row { padding-left: calc(6px + var(--depth, 0) * 16px); }

/* ── Trace strip ────────────────────────────────────────── */
.trace { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; align-items: stretch; }
.trace-step {
  flex: 0 0 auto; width: 300px; max-width: 360px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.trace-step.is-nofit { border-color: rgba(245, 158, 11, 0.5); }
.trace-step.is-forced { border-style: dashed; }
.trace-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.trace-no { width: 18px; height: 18px; border-radius: 50%; background: var(--dark); color: #fff; font-size: 10px; display: inline-grid; place-items: center; }
.trace-at { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.trace-chosen { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.trace-verdict { font-weight: 700; color: var(--dark); }
.trace-verdict a { text-decoration: none; }
.trace-verdict a:hover { text-decoration: underline; }
.trace-verdict.is-nofit { color: var(--amber); }
.trace-score { color: var(--text-secondary); font-size: 12px; }
.trace-arrow { align-self: center; color: var(--text-muted); font-size: 18px; flex: 0 0 auto; }
.trace-empty { color: var(--text-muted); font-size: 12px; }
.secondary { margin: 6px 0 10px; padding-left: 10px; border-left: 2px solid var(--border); }
.secondary-head { font-size: 12.5px; margin-bottom: 4px; display: flex; gap: 8px; }

/* Mapping table source indent */
.tbl.mapping td.src .indent { display: inline-block; width: calc(var(--depth, 0) * 14px); }
