
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--text);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
#app { height: 100vh; height: 100dvh; }
#view {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "bar bar" "tabs tabs" "cell cell" "path path" "content content" "readout readout" "foot foot";
}

@media (min-width: 1201px) {
  #view {
    grid-template-columns: max-content minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: "bar bar bar" "tabs cell cell" "path path path" "content content content" "readout readout readout" "foot foot foot";
  }
}
.dim { color: var(--dim); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.bar {
  grid-area: bar; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.bar .brand {
  font-weight: 700; color: var(--on-accent); background: var(--accent);
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}
.bar .back { color: var(--link); text-decoration: none; white-space: nowrap; }
.bar .title { font-size: 16px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .sha { color: var(--dim); font-family: ui-monospace, monospace; white-space: nowrap; }

button.sha {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: copy; user-select: text; text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}
.bar button.sha {
  color: var(--dim); font-family: ui-monospace, monospace;
  border: 0; border-radius: 0; padding: 0; background: none; cursor: copy;
}
button.sha:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.sha.copied::after { content: " copied"; color: var(--accent); }
.bar .grow { flex: 1; }
.bar button {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 10px; font: inherit; cursor: pointer; white-space: nowrap;
}

.tabs {
  grid-area: tabs; display: flex; gap: 4px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.tab {
  padding: 6px 12px; color: var(--link); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.cell {
  grid-area: cell; display: flex; align-items: flex-start; gap: 8px; min-width: 0;
  padding: 4px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.cell:empty { padding: 0; }
.cell-label { flex: none; padding-top: 3px; font-size: 12px; line-height: 1.4; color: var(--dim); white-space: nowrap; }

.cell-text {
  flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 2px 6px; font: 12px/1.4 ui-monospace, monospace; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
}
.cell .ui-version { flex: none; padding-top: 3px; font-size: 12px; line-height: 1.4; color: var(--dim); white-space: nowrap; }

.path {
  grid-area: path; padding: 8px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.col-search { flex: none; height: 34px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.col-search input {
  display: block; width: 100%; height: 25px; padding: 2px 8px; font: inherit;
  background: var(--page); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
}
.col-search input::placeholder { color: var(--dim); }
.col-search input:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; }
.col-search.filter input { border-color: var(--accent); }

.content { grid-area: content; min-height: 0; overflow: hidden; }
.loading { padding: 24px; color: var(--dim); }

.cards {
  list-style: none; margin: 0; padding: 24px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
}
.card {
  display: block; width: 100%; height: 100%; text-align: left; padding: 16px;
  font: inherit; color: var(--text); text-decoration: none; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.card.focused { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card .facts { margin: 0; color: var(--dim); }
.stores-h {
  margin: 0; padding: 0 24px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim);
}
.cards.stores { padding-top: 8px; }
.units, .core { margin: 0; padding: 0 24px; color: var(--dim); }
.units { padding-bottom: 8px; }


.strip {
  position: relative; display: flex; align-items: stretch; height: 100%;
  padding: 8px 16px; overflow-x: auto; touch-action: pan-x;
}
.col {
  position: relative; display: flex; flex-direction: column;
  flex: 1 1 0; min-width: 240px; max-width: 460px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}

.col.input, .col.files { flex: 2 1 0; min-width: 280px; max-width: 920px; }
.col.focused { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.col-head {
  margin: 0; padding: 6px 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--dim); border-bottom: 1px solid var(--line); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.col.focused .col-head { color: var(--accent); }

section.col > .col-head { display: flex; }
.col-head .name { flex: 0 1000 auto; min-width: 4ch; overflow: hidden; text-overflow: ellipsis; }
.col-head .counts { flex: 0 0 auto; display: flex; white-space: pre; font-weight: 400; }
.col-head .group { flex: 0 0 auto; white-space: pre; }
.col-head .counts.cut::after { content: "…"; }
.rows {
  flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; list-style: none;
  overflow: hidden; touch-action: none;
}
.row {
  display: flex; gap: 6px; height: 24px; line-height: 24px; padding: 0 14px 0 8px;
  white-space: nowrap; cursor: default;
}
.row .mark { flex: 0 0 1ch; color: var(--accent); }
.row .label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.row .dir { color: var(--dim); }
.row.event .label, .row.image .label { font-weight: 600; }
.row.fact .label { color: var(--dim); }
.row.pending { color: var(--dim); }

.row.child .label { padding-left: 1.5ch; }

.row .label a.ext { color: var(--link); }

.row .swh-link { flex: none; }
.col:has(.row .swh-link) { min-width: 24em; }
.row .swh-link a.swh { color: var(--link); }
.col.focused .row.sel .swh-link a.swh { color: inherit; }
.col.focused .row.sel .label a.ext { color: inherit; }
.row.out-package .label, .row.source .label { font-weight: 600; }
.row.opens { cursor: pointer; }
.row .opens { flex: 0 0 1.5ch; text-align: center; color: var(--dim); }
.row.failed { color: var(--trust-failed); }
.row.empty { color: var(--dim); }

.col.focused .row.sel { height: auto; min-height: 24px; white-space: normal; }
.col.focused .row.sel .label {
  min-width: 0; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
}
.row:hover { background: var(--panel); }
.row.sel { background: var(--selected-idle); }
.col.focused .row.sel { background: var(--accent); color: var(--on-accent); }
.col.focused .row.sel .dir, .col.focused .row.sel .mark,
.col.focused .row.sel .trust, .col.focused .row.sel .label { color: inherit; }
.trust { flex: 0 0 1.5ch; text-align: center; }

.rebuild { flex: 0 0 1.5ch; text-align: center; }
.col.focused .row.sel .rebuild { color: inherit; }
.rebuild-faithful { color: var(--rebuild-faithful); }
.rebuild-deviation { color: var(--rebuild-deviation); }
.rebuild-hermit { color: var(--rebuild-hermit); }
.rebuild-not-reproduced { color: var(--rebuild-not-reproduced); }
.trust-verified { color: var(--trust-verified); }
.trust-signed { color: var(--trust-signed); }
.trust-claimed { color: var(--trust-claimed); }
.trust-unknown { color: var(--trust-unknown); }
.trust-failed { color: var(--trust-failed); }
.trust-not-reproduced { color: var(--trust-not-reproduced); }
.trust-not-evaluated { color: var(--trust-not-evaluated); }
.strip.wide .col { max-width: none; }


.analysis {
  height: 100%; overflow-y: auto; padding: 8px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px; align-content: start;
}

.analysis .lead { grid-column: 1 / -1; margin: 0; }
.facts-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}

.facts-block dl {
  display: grid; grid-template-columns: minmax(auto, max-content) 1fr;
  gap: 2px 16px; margin: 0; padding: 8px 12px;
}
.facts-block dt { color: var(--dim); }
.facts-block dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.flow { flex: 0 0 auto; align-self: flex-start; margin-top: 30px; padding: 0 6px; color: var(--dim); user-select: none; }
.track { position: absolute; right: 3px; top: 36px; bottom: 4px; width: 4px; }

.legend {
  margin: 0; padding: 0 12px; height: 25px; line-height: 24px; font-size: 12px;
  color: var(--dim); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.col.with-legend .track { top: 61px; }

.col.with-marks .track { top: 86px; }

.col.with-search .track { top: 70px; }
.col.with-search.with-legend .track { top: 95px; }
.col.with-search.with-marks .track { top: 120px; }
.thumb { position: absolute; left: 0; right: 0; min-height: 8px; border-radius: 2px; background: var(--line); }


.readout {
  grid-area: readout; margin: 0; padding: 6px 16px 0;
  border-bottom: 6px solid var(--panel);
  font-family: ui-monospace, monospace; font-size: 13px; line-height: 1.4;
  height: calc(2.8em + 13px);
  overflow-x: hidden; overflow-y: auto; overflow-wrap: anywhere;
  background: var(--panel); border-top: 1px solid var(--line);
}
.foot {
  grid-area: foot; display: flex; justify-content: space-between; gap: 16px;
  padding: 4px 16px; font-size: 12px; color: var(--dim); background: var(--panel);
}
.foot .error { color: var(--trust-failed); }
.foot .notice { color: var(--connector); }
.foot .version { white-space: nowrap; }

.help {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 10;
  width: min(640px, 92vw); padding: 12px 20px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px;
}
.help[hidden] { display: none; }
.help h2 { margin: 0 0 8px; font-size: 14px; color: var(--accent); }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.help dt { font-family: ui-monospace, monospace; color: var(--accent); }
.help dd { margin: 0; }


.terminal {
  height: calc(100% - 16px); margin: 8px 16px; padding: 0; overflow: hidden; line-height: 1.2;
  font-family: ui-monospace, "DejaVu Sans Mono", Menlo, monospace; font-size: 14px;
}
.terminal pre { margin: 0; }

.terminal pre > span { display: inline-block; width: 1ch; overflow: hidden; vertical-align: top; }

@media (max-width: 720px) {
  #view {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "bar" "tabs" "cell" "path" "content" "readout" "foot";
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
  }
  .bar .sha { display: none; }
  
  .foot .release { display: none; }
  
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .tab[data-short] > .long { display: none; }
  .tab[data-short]::after { content: attr(data-short); }
}
