/* CSS only to group things in tables (README). No layout framework. */
:root { --line: #d7dbe0; --muted: #667; --bg2: #f6f7f9; --ok: #1a7f37; --err: #b42318; --chg: #fff4ce; }
body { margin: 0; font: 14px/1.4 system-ui, sans-serif; color: #111; }
nav { display: flex; gap: 14px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); flex-wrap: wrap; }
nav a { color: #1f4e9c; text-decoration: none; }
nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
nav .who { margin-left: auto; color: var(--muted); }
nav .env { padding: 1px 8px; border-radius: 10px; background: #e8eefc; font-size: 12px; }
main { padding: 12px 14px; }
h1 { font-size: 18px; margin: 4px 0 10px; }
p.hint { color: var(--muted); margin: 4px 0 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar label { display: inline-flex; gap: 6px; align-items: center; }
output.status { color: var(--muted); }
output.status.err { color: var(--err); }
output.status.ok { color: var(--ok); }

/* ── tables ── */
table.t { border-collapse: collapse; width: 100%; }
table.t th, table.t td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; vertical-align: top; white-space: nowrap; }
table.t thead th { position: sticky; top: 0; background: var(--bg2); z-index: 1; }
table.t tbody tr:nth-child(even) { background: #fafbfc; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.changed { background: var(--chg); }
table.t td.actions { white-space: nowrap; }
table.t td.msg { color: var(--muted); max-width: 26em; white-space: normal; }
table.t td.msg.err { color: var(--err); }
table.t td.msg.ok { color: var(--ok); }
table.t input, table.t select { font: inherit; width: 100%; box-sizing: border-box; min-width: 6em; }
table.t input[type=number] { width: 8em; }
table.t tr.new td { background: #f0fff4; }
/* column groups: colour the header band so the reader sees which columns belong together */
table.t colgroup.g-id { background: #f3f4f6; }
table.t colgroup.g-pos { background: #eef6ff; }
table.t colgroup.g-meta { background: #fdf7e7; }
table.t colgroup.g-act { background: #f6f0ff; }
/* subtable row: one nested table under the row that opened it */
table.t tr.sub > td { background: #fbfbfd; padding: 6px 10px 10px 28px; white-space: normal; }
table.t tr.sub table.t { width: auto; }
.pager { display: flex; gap: 8px; align-items: center; margin: 8px 0; color: var(--muted); }
button { font: inherit; padding: 2px 8px; }

/* ── searchable dropdown ── */
details.dd { position: relative; display: inline-block; min-width: 8em; max-width: 100%; }
details.dd > summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; background: #fff; max-width: 22em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd > summary::after { content: ' ▾'; color: var(--muted); }
details.dd .dd-pop { position: absolute; z-index: 5; top: 100%; left: 0; min-width: 16em; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.12); padding: 6px; }
details.dd .dd-pop input[type=search] { width: 100%; box-sizing: border-box; margin-bottom: 4px; }
details.dd .dd-tools { display: flex; gap: 6px; margin-bottom: 4px; }
details.dd .dd-list { max-height: 14em; overflow: auto; }
details.dd .dd-list label { display: flex; gap: 6px; align-items: center; padding: 1px 2px; white-space: nowrap; }
details.dd .dd-list label span { flex: 1; }
details.dd .dd-only { font-size: 11px; padding: 0 4px; }

/* ── geometry plot ── */
svg.plot { width: 100%; max-width: 900px; height: auto; border: 1px solid var(--line); background: #fff; }
svg.plot .pt { fill: #1f6feb; }
svg.plot .shape { fill: rgba(31,111,235,.12); stroke: #1f6feb; stroke-width: 1.5; }
svg.plot .lbl { font: 11px system-ui, sans-serif; fill: #333; }

/* ── login ── */
form.login { max-width: 380px; margin: 60px auto; display: grid; gap: 8px; }
form.login input, form.login select, form.login button { font: inherit; padding: 6px 8px; }

/* ── ver como (impersonación de sólo lectura) ─────────────────────────────────────────────────── */
/* The bar is loud ON PURPOSE while active: a screen showing another user's data must never be
   mistakable for your own. Colour here carries that one meaning. */
.viewas { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.viewas.on { background: #fde2e2; border-bottom: 2px solid #b42318; color: #8b1a1a; }
.viewas.on strong { letter-spacing: .02em; }
.viewas input[type=text] { font: inherit; padding: 2px 6px; }
