/* Plain CSS, no framework. Readable at a laptop width and on a phone; nothing here
   needs a grid system. */

:root {
  --fg: #1b1b1b;
  --dim: #5c5c5c;
  --bg: #fbfbf9;
  --panel: #ffffff;
  --line: #d8d6d0;
  --accent: #2d5d7b;
  --bad: #8b2f2f;
  --ok: #2f6b3a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e4df;
    --dim: #a3a099;
    --bg: #16181a;
    --panel: #1e2124;
    --line: #34383c;
    --accent: #7fb2d4;
    --bad: #e08b8b;
    --ok: #8fd0a0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  max-width: 60rem;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 0.95rem; margin: 1.2rem 0 0.4rem; color: var(--dim); }

.sub, .hint { color: var(--dim); font-size: 0.9rem; }
.hint { margin: 0.4rem 0 0; }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }

/* The accent in both themes: the browser's own blue is unreadable on the dark background. */
a, a:visited { color: var(--accent); }

section { margin-top: 1.25rem; }

#auth, .panel, #options, #status, #results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
}
/* a panel's heading at its top, where the panel's own padding is the space above it */
#status h2, #results h2 { margin-top: 0; }

label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }

.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row > input[type=text], .row > input[type=password] { flex: 1 1 12rem; min-width: 0; }

input[type=text], input[type=password], textarea, input[type=file], select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.55rem;
}

/* The mode is three radios, one per line, so every choice is visible at once and
   none is truncated on a narrow window; the legend carries the heading weight
   and the choices do not. */
#licenseref { border: 0; padding: 0; margin: 0; }
#licenseref legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; padding: 0; }
#licenseref label {
  display: flex; align-items: baseline; gap: 0.45rem;
  font-weight: 400; margin-bottom: 0.3rem; cursor: pointer;
}
#licenseref input[type=radio] { margin: 0; position: relative; top: 0.1rem; }
#licenseref code { opacity: 0.75; }

/* The two scans (2026-10-13): each a box on a line of its own -- Licenses, Copyrights -- and its
   options under it, behind a rule, greyed out while the scan is left out. The ScanCode mode's two
   switches stand under that mode, shown only while it is chosen; the window cache under the tagger. */
#options .scan + .scan { margin-top: 0.9rem; }
#options label.check {
  display: flex; align-items: baseline; gap: 0.45rem;
  font-weight: 400; margin: 0.3rem 0 0; cursor: pointer;
}
#options label.check input { margin: 0; position: relative; top: 0.1rem; }
#options label.check code { opacity: 0.75; }
#options label.check.off { opacity: 0.5; cursor: default; }
#options label.toggle { margin: 0; font-size: 0.95rem; }
#options .scan-options {
  margin: 0.35rem 0 0 0.35rem; padding: 0.1rem 0 0.1rem 1.1rem; border-left: 2px solid var(--line);
}
#options .scan-options.off { opacity: 0.5; }
#options .mode-options { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin: -0.1rem 0 0.35rem 1.45rem; }
#options .mode-options[hidden] { display: none; }
#options .mode-options label.check { margin-top: 0; }
#options label.check.nested { margin-left: 1.45rem; }

/* What each mode answers, and what the copyright scan reads, folded away under the options. */
#options details.about { margin-top: 0.5rem; }
#options details.about summary { cursor: pointer; color: var(--dim); font-size: 0.9rem; }
#options details.about p { margin: 0.45rem 0 0; }
#options .applies { margin-top: 0.9rem; }

textarea {
  width: 100%;
  margin-top: 0.6rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }
button.quiet { background: transparent; color: var(--dim); border-color: var(--line); }

.tabs { display: flex; gap: 0.25rem; margin-top: 1.5rem; border-bottom: 1px solid var(--line); }
.tabs button {
  background: transparent;
  color: var(--dim);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
}
.tabs button.active {
  color: var(--fg);
  background: var(--panel);
  border-color: var(--line);
}
.panel { border-top-left-radius: 0; margin-top: 0; }

/* The job's line under "Scan": its facts wrap between one another, as the result's do below. */
.meta {
  display: flex; flex-wrap: wrap; gap: 0 1rem;
  color: var(--dim); font-size: 0.85rem; margin-bottom: 0.5rem;
}
.meta span { overflow-wrap: anywhere; }

/* The result's facts, a row each -- files, spans, the tagger, time, settings -- with a label
   and its values. It was one line of spans with no break between them, each kept whole, so a
   scan with its timings ran past the panel's border (2026-10-08). The values wrap between
   facts first, and inside one only where it is wider than the row, on a phone. */
.facts {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.2rem 0.9rem;
  margin: 0 0 0.75rem; color: var(--dim); font-size: 0.85rem;
}
.facts dt { font-weight: 600; }
.facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 0 1rem; min-width: 0; }
.facts dd span { overflow-wrap: anywhere; }

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.3rem 0.6rem 0.3rem 0; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }

.id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.score { color: var(--dim); font-size: 0.85em; }
.category { color: var(--dim); font-size: 0.85em; }
.exceptions { color: var(--dim); font-size: 0.85em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.state { font-weight: 600; }
.state.failed { color: var(--bad); }
.state.succeeded { color: var(--ok); }

.spin::after {
  content: "";
  display: inline-block;
  width: 0.7em; height: 0.7em;
  margin-left: 0.5em;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: baseline;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin::after { animation: none; } }

#error {
  margin-top: 1.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--bad);
  border-radius: 6px;
  color: var(--bad);
  background: var(--panel);
}

.note { margin-top: 0.75rem; padding-left: 0.8rem; border-left: 3px solid var(--line); color: var(--dim); font-size: 0.9rem; }
.empty { color: var(--dim); font-style: italic; }

/* The per-file table: a filter and its pages above it, and a path that opens its licences' evidence (2026-10-09). */
.file-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0 0 0.5rem;
}
.file-filter { flex: 1 1 16rem; min-width: 0; font: inherit; padding: 0.3rem 0.5rem; }
.pager { display: flex; align-items: center; gap: 0.5rem; color: var(--dim); font-size: 0.85rem; }
.pager-button { font: inherit; font-size: 0.85rem; }
.file-toggle {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0; margin: 0;
  text-align: left; cursor: pointer; word-break: break-all;
}
.file-toggle::before { content: "\25B8\00A0"; color: var(--dim); }
.file-toggle[aria-expanded="true"]::before { content: "\25BE\00A0"; }
.evidence-row td { padding: 0.2rem 0 0.8rem 1.2rem; }
.evidence-head { display: flex; flex-wrap: wrap; gap: 0 0.8rem; margin-top: 0.4rem; font-size: 0.85rem; }
.evidence-where { color: var(--dim); overflow-wrap: anywhere; }
pre.matched {
  margin: 0.25rem 0 0; padding: 0.4rem 0.6rem; max-height: 16rem; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem;
  background: var(--panel); border-left: 3px solid var(--line);
}
pre.matched.located { border-left-color: var(--accent); }

/* The copyright scan's parts (2026-10-10): the holders across the tree, a file's holders in its row, and its
   statements in its evidence, below its licences' where both were read. */
td.holder, span.holder { overflow-wrap: anywhere; }
td.years { color: var(--dim); font-variant-numeric: tabular-nums; }
.evidence-section { margin-top: 0.9rem; font-size: 0.85rem; font-weight: 600; color: var(--dim); }
.holders-line { margin: 0.2rem 0 0.4rem; font-size: 0.85rem; color: var(--dim); overflow-wrap: anywhere; }
pre.matched.statement { border-left-color: var(--ok); }
