/* Compact layer over Pico: dense like instrument software, readable on a phone. */
:root {
  --pico-font-size: 93.75%;            /* Pico scales up to 131 % on wide screens; keep it fixed */
  --pico-line-height: 1.45;
  --pico-spacing: .75rem;
  --pico-typography-spacing-vertical: .6rem;
  --pico-form-element-spacing-vertical: .32rem;
  --pico-form-element-spacing-horizontal: .55rem;
  --pico-border-radius: .4rem;
  --bg: #f5f6f8;
  --line: #e2e5ea;
  --muted: #6b7280;
  --ink: #1f2933;
  --warn-bg: #fff8e6;
  --warn-line: #f0b400;
  --changed: #fff2a8;
}
body { background: var(--bg); color: var(--ink); }
main.container { padding-top: .5rem; padding-bottom: 3rem; }
header.container nav { padding: .25rem 0; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1rem; margin: 0; }
h3 { font-size: .95rem; margin: 0; }
p { margin-bottom: .5rem; }
a { text-underline-offset: 2px; }
.muted { color: var(--muted); font-size: .85rem; }
.err { color: #b3261e; }
.small { font-size: .8rem; }

/* page header: title left, actions right */
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: .9rem; }
.page-head .sub { margin: .15rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
form.inline { display: inline; margin: 0; }

/* buttons: one compact size everywhere */
/* Pico makes form buttons full width; nothing here wants that */
button, [role=button], [type=submit], [type=button], [type=reset] { width: auto !important; margin: 0; padding: .3rem .7rem; font-size: .82rem; line-height: 1.3; }
.actions { flex-wrap: wrap; }
.actions > form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.actions details { display: flex; flex-direction: column; margin: 0; }
.actions details > summary[role=button], .card-head details > summary[role=button] { margin: 0; line-height: 1.3; padding: .3rem .7rem; font-size: .82rem; }
.actions input { width: auto; }
button.icon { padding: .15rem .45rem; }
button.link { background: none; border: 0; color: var(--pico-primary); padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: .5rem; padding: .85rem 1rem; margin-bottom: 1rem; }
.card-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.card > :last-child { margin-bottom: 0; }

/* forms: labels always above inputs, laid out on a grid */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { margin-bottom: 0; font-size: .88rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 2.1rem; }
input[type=file] { margin-bottom: 0; font-size: .82rem; padding: .3rem; }
textarea { min-height: 2.1rem; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .55rem .75rem; align-items: end; margin: 0; }
.fgrid label, label.f { display: flex; flex-direction: column; gap: .15rem; margin: 0; font-size: .78rem; color: var(--muted); }
.fgrid .wide { grid-column: 1 / -1; }
.fgrid .span2 { grid-column: span 2; }
.fgrid .btns { display: flex; gap: .35rem; align-items: center; }
@media (max-width: 480px) { .fgrid .span2 { grid-column: 1 / -1; } }
details > summary { font-size: .82rem; color: var(--pico-primary); }
details[open] > summary { margin-bottom: .5rem; }
details.inline-form { margin: .4rem 0 0; }
details.inline-form > summary { list-style: none; display: inline; cursor: pointer; }
details.inline-form > summary::-webkit-details-marker { display: none; }
details.inline-form > summary::after { display: none; }
.form-box { border: 1px solid var(--line); border-radius: .4rem; padding: .7rem; margin-top: .4rem; background: #fafbfc; }
/* an opened inline form takes its own full-width row */
.actions details[open], .card-head details[open], .comp .links details[open] { flex-basis: 100%; order: 99; }
.actions details[open] > summary, .card-head details[open] > summary { display: inline-block; }

/* tables */
.table-wrap { overflow-x: auto; }
table { font-size: .84rem; margin-bottom: 0; }
th { font-size: .74rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td, th { padding: .32rem .5rem; vertical-align: middle; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.clip { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrap { white-space: normal; }
table input:not([type=checkbox]), table select { height: 1.9rem !important; padding: .15rem .4rem; }
table input[type=checkbox] { margin: 0; }
table input.num { width: 5.5rem; text-align: right; }
.changed { background: var(--changed); font-weight: 600; }
tr.sub td { color: var(--muted); font-size: .78rem; padding-top: 0; }

/* badges, swatches, chips */
.badge { display: inline-block; font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; background: #eef1f5; color: var(--muted); font-weight: 500; vertical-align: middle; }
.badge.low { background: #fde8e8; color: #b3261e; }
.badge.medium { background: var(--warn-bg); color: #8a6100; }
.badge.high { background: #e6f4ea; color: #1e7e34; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .45rem 0 0; }
.chip { display: inline-flex; align-items: center; border: 1.5px solid #ccd2da; border-radius: 999px; font-size: .76rem; background: #fff; line-height: 1.2; }
.chip.used { font-weight: 600; }
.chip > span, .chip > button:first-child { padding: .15rem .1rem .15rem .55rem; }
.chip button { background: none; border: 0; color: inherit; margin: 0; font-size: .76rem; }
.chip form { margin: 0; display: inline; }
.chip form button { padding: .15rem .5rem .15rem .3rem; color: #9aa3ad; }
.chip form button:hover { color: #b3261e; }

/* review box (warnings) */
.review { background: var(--warn-bg); border: 1px solid #f3dc9a; border-left: 4px solid var(--warn-line); border-radius: .4rem; padding: .55rem .8rem; margin-bottom: 1rem; font-size: .84rem; }
.review ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.review li { margin: 0; list-style: disc; }
.warn { background: var(--warn-bg); border-left: 4px solid var(--warn-line); padding: .45rem .7rem; margin: .5rem 0; font-size: .84rem; }

/* headline numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.stats > div { background: #fff; border: 1px solid var(--line); border-radius: .5rem; padding: .45rem .7rem; }
.stats span { display: block; font-size: .72rem; color: var(--muted); }
.big { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* components (reaction page) */
.comp { display: grid; grid-template-columns: 92px 1fr; gap: .9rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.comp:first-of-type { border-top: 0; padding-top: .2rem; }
.comp .struct svg { width: 92px; height: auto; }
.comp .meta { color: var(--muted); font-size: .8rem; margin: .1rem 0 0; }
.comp .links { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .45rem; font-size: .8rem; }
@media (max-width: 520px) { .comp { grid-template-columns: 56px 1fr; } .comp .struct svg { width: 56px; } }

/* spectrum view */
img.spectrum { width: 100%; border: 1px solid var(--line); background: #fff; }
.spectrum-plot { width: 100%; min-height: 400px; background: #fff; touch-action: none; }
.spec-tools { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .3rem; }
.spec-tools .modes, .spec-tools .modes[role=group] { display: inline-flex; width: auto; gap: .25rem; margin: 0 .4rem 0 0; box-shadow: none; }
.spec-tools .modes > button { flex: none; border-radius: var(--pico-border-radius) !important; }
.spec-hint { font-size: .74rem; color: var(--muted); margin: 0 0 .3rem; }
@media (hover: none) { .spec-hint { display: none; } }
#assign-panel { margin-top: .75rem; border-left: 4px solid var(--pico-primary); }
#assign-panel p { margin-bottom: .5rem; }
