/* The NIS app (nis.nuclida.com). An engineering-drawing look: graph paper, ink frames,
   numbered sections and monospace numbers. No external fonts or scripts. */

:root {
  --bg: #eef1f3;
  --grid: #e0e6ea;
  --paper: #ffffff;
  --paper-2: #f6f8f9;
  --head: #e6ebef;
  --ink: #14202b;
  --ink-2: #243444;
  --text: #14202b;
  --muted: #5b6b78;
  --line: #e1e6ea;
  --line-2: #c3ccd3;
  --field: #9aa8b3;
  --blue: #0050b3;
  --orange: #ff5a1f;
  --orange-ink: #c2410c;
  --green: #1b7f4b;
  --amber: #b26a00;
  --red: #c62828;
  --violet: #6a3fb5;
  --on-ink: #9fb3c4;
  --max: 1240px;
  --font: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0 0 1em; }
sup, sub { line-height: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 12px; }
[hidden] { display: none !important; }

/* ---- navigation ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: stretch; gap: 28px;
  min-height: 48px;
  padding: 0 clamp(16px, 3vw, 28px);
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand > span:not(.brand-tag) { font-weight: 600; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.brand-mark { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.6; }
.brand-mark circle { fill: var(--orange); stroke: none; }
.brand-tag {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em;
  color: var(--on-ink); border-left: 1px solid #3d4f5f; padding-left: 10px;
}
.nav nav { display: flex; gap: 2px; }
.nav nav a {
  display: flex; align-items: center; padding: 0 14px;
  text-decoration: none; color: var(--on-ink); font-size: 0.9rem;
}
.nav nav a:hover { color: #fff; background: var(--ink-2); }
.nav nav a.active { color: #fff; background: var(--ink-2); box-shadow: inset 0 -3px 0 var(--orange); }
.nav-user { display: flex; align-items: center; gap: 10px; margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--on-ink); }
.nav-user img { border-radius: 50%; border: 1px solid #3d4f5f; }
.nav-user .btn { background: transparent; color: #fff; border-color: #3d4f5f; }
.nav-user .btn:hover { border-color: #fff; background: var(--ink-2); }
@media (max-width: 760px) {
  .nav { flex-wrap: wrap; gap: 0 18px; padding-top: 8px; }
  .nav nav { order: 3; width: 100%; overflow-x: auto; min-height: 40px; }
  #nav-login { display: none; }
}

/* ---- layout ---- */
main { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 24px clamp(16px, 3vw, 28px) 56px; outline: none; counter-reset: sec; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 12px 16px; background: var(--paper); border: 1px solid var(--ink);
}
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* A card is a framed sheet. Its first heading is a title strip with a section number. */
.card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 10px; height: 10px; pointer-events: none;
  border: 2px solid var(--orange);
}
.card::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.card > h2:first-child, .card > .card-head:first-child {
  margin: -18px -20px 16px; padding: 10px 20px;
  background: var(--paper-2); border-bottom: 1px solid var(--line-2);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card > h2:first-child, .card > .card-head:first-child > h2 { display: flex; align-items: center; gap: 10px; }
.card > h2:first-child::before, .card > .card-head:first-child > h2::before {
  counter-increment: sec; content: "§" counter(sec);
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em;
  color: #fff; background: var(--blue); padding: 1px 6px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.stack-20 > * + * { margin-top: 20px; }
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 28px); background: var(--paper); border-top: 1px solid var(--ink);
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
}
.foot a { color: var(--muted); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 14px; border-radius: 0; border: 1px solid var(--ink);
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 500; font-size: 0.88rem; text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--head); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, button:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); }
.btn-big { padding: 11px 22px; font-size: 0.98rem; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { color: #fff; background: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--head); border-color: var(--line-2); color: var(--ink); }
.btn-ghost.btn-danger { color: var(--muted); border-color: transparent; }
.btn-ghost.btn-danger:hover { color: var(--red); background: #fdf0f0; border-color: var(--red); }
.nav-user .btn-ghost { color: var(--on-ink); border-color: transparent; }
.btn-group { display: inline-flex; align-items: center; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:hover, .btn-group .btn:focus-visible { position: relative; z-index: 1; }
.actions-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.btn-link { background: none; border: none; color: var(--blue); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 0;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--paper-2); }
.icon-btn.icon-danger:hover { color: var(--red); border-color: var(--red); background: #fdf0f0; }

/* ---- forms ---- */
label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--paper); border: 1px solid var(--field); border-radius: 0;
  padding: 7px 9px;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[type="number"], input.num, input[inputmode="decimal"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input[type="checkbox"] { width: auto; accent-color: var(--blue); }
input.invalid, textarea.invalid { border-color: var(--red); background: #fdf3f3; }
textarea { resize: vertical; min-height: 80px; font-family: var(--mono); font-size: 0.85rem; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.row-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.row-fields.align-end { align-items: end; margin-bottom: 16px; }
.row-fields.align-end .field { margin-bottom: 0; }
.rows { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.rows th { text-align: left; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 8px 2px 0; }
.rows td { padding: 0 8px 0 0; vertical-align: middle; }
.rows td:last-child { width: 40px; padding: 0; }
.rows .num { width: 38px; color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.rows .kind-irr input, .rows .kind-irr select { border-left: 3px solid var(--orange); }
.rows .kind-cool input, .rows .kind-cool select { border-left: 3px solid var(--blue); }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.errors {
  border: 1px solid var(--red); border-left-width: 4px; background: #fdf3f3;
  padding: 10px 14px; margin-bottom: 16px; color: #8e1b1b;
}
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.notice {
  border: 1px solid var(--line-2); border-left: 4px solid var(--blue); background: #f2f6fb;
  padding: 10px 14px; margin-bottom: 16px;
}
.notice.warn { border-left-color: var(--amber); background: #fdf7ec; }
details > summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
details[open] > summary { margin-bottom: 12px; }
.submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sum-line { font-size: 0.84rem; color: var(--muted); }
.sum-line.mono, .submit-bar .sum-line { font-family: var(--mono); font-size: 0.8rem; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 10px; background: var(--head); border-bottom: 1px solid var(--ink); white-space: nowrap;
}
table.data td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th + th, table.data td + td { border-left: 1px solid var(--line); }
table.data tr:hover td { background: var(--paper-2); }
table.data td.r, table.data th.r { text-align: right; }
table.data td.r { font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
table.data a { color: var(--blue); text-decoration: none; font-weight: 500; }
table.data a:hover { text-decoration: underline; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty .btn { margin-top: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

/* ---- status ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 0; border: 1px solid currentColor; white-space: nowrap; background: var(--paper);
}
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; }
.badge.queued { color: var(--muted); }
.badge.running { color: var(--amber); }
.badge.running::before { animation: pulse 1.1s ease-in-out infinite; }
.badge.done { color: #fff; background: var(--green); border-color: var(--green); }
.badge.failed { color: #fff; background: var(--red); border-color: var(--red); }
.badge.pending { color: var(--amber); }
.badge.denied { color: var(--red); }
@keyframes pulse { 50% { opacity: 0.25; } }
.spinner {
  width: 16px; height: 16px; display: inline-block; vertical-align: middle;
  border: 2px solid var(--line-2); border-top-color: var(--orange); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 40px 0; font-family: var(--mono); font-size: 0.85rem; }

/* ---- stats and usage ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; margin-bottom: 20px; border: 1px solid var(--ink); background: var(--paper); }
.stat { padding: 10px 14px; border-right: 1px solid var(--line-2); }
.stat:last-child { border-right: 0; }
.stat .k { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat .v { font-family: var(--mono); font-size: 1.25rem; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .u { font-size: 0.8rem; color: var(--muted); }
.meter { margin-bottom: 14px; }
.meter-top { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 6px; font-family: var(--mono); }
.meter-bar {
  height: 10px; background: var(--paper-2); border: 1px solid var(--ink); overflow: hidden;
  background-image: repeating-linear-gradient(90deg, transparent 0 9.9%, var(--line-2) 9.9% 10%);
}
.meter-bar > span { display: block; height: 100%; background: var(--blue); }
.meter-bar.high > span { background: var(--orange); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; font-size: 0.88rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

/* ---- login and access ---- */
.center-card { max-width: 560px; margin: 6vh auto 0; text-align: center; padding: 36px 32px; }
.center-card .lead { color: var(--muted); font-size: 1rem; }
.center-card .btn-big { margin: 10px 0 18px; }
.center-card .small { font-size: 0.85rem; color: var(--muted); }
.gh-icon { width: 18px; height: 18px; fill: currentColor; }
.who { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0; font-family: var(--mono); }
.who img { border-radius: 50%; border: 1px solid var(--line-2); }
.center-card textarea { font-family: var(--font); font-size: 0.92rem; text-align: left; min-height: 110px; }

/* ---- keys ---- */
.token-box {
  display: flex; gap: 8px; align-items: center; margin: 10px 0;
  background: #eef8f2; border: 1px solid var(--green); border-left-width: 4px; padding: 8px 10px;
}
.token-box code { flex: 1; overflow-x: auto; white-space: nowrap; font-family: var(--mono); font-size: 0.85rem; }
pre.code {
  background: var(--ink); color: #dce6ee; border: 1px solid var(--ink);
  padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 0.82rem; margin: 8px 0 0;
}

/* ---- plots ---- */
.plot { position: relative; }
.plot svg { width: 100%; height: auto; display: block; overflow: visible; user-select: none; }
.plot .axis line, .plot .axis path { stroke: var(--ink); }
.plot .grid line { stroke: #e3e8ec; }
.plot text { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.plot .axis-label { fill: var(--ink); font-size: 11px; }
.plot .series { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.plot .band { fill: rgba(255, 90, 31, 0.08); }
.plot .cursor { stroke: var(--ink); stroke-dasharray: 3 3; }
.plot-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-family: var(--mono); font-size: 0.78rem; margin-top: 8px; color: var(--muted); }
.plot-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plot-legend i { width: 16px; height: 2px; display: inline-block; }
.plot-legend .band-key { width: 14px; height: 10px; background: rgba(255, 90, 31, 0.25); border: 1px solid var(--orange); }
.plot-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--paper); border: 1px solid var(--ink);
  padding: 6px 10px; font-family: var(--mono); font-size: 0.76rem; white-space: nowrap; box-shadow: 3px 3px 0 rgba(20, 32, 43, 0.15);
}
.plot-tip .t { color: var(--muted); margin-bottom: 4px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.plot-tip div { display: flex; align-items: center; gap: 7px; }
.plot-tip i { width: 8px; height: 8px; display: inline-block; }
.plot-tip b { font-weight: 500; font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 12px; }
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg button { background: var(--paper); border: none; color: var(--muted); padding: 4px 10px; font-family: var(--mono); font-size: 0.75rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button:hover { color: var(--ink); background: var(--paper-2); }
.seg button.on { background: var(--ink); color: #fff; }
.swatch { width: 12px; height: 3px; display: inline-block; margin-right: 8px; vertical-align: middle; }
tr.picked td { background: #eef4fb; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; border: 1px solid var(--ink); border-left: 4px solid var(--green);
  padding: 9px 16px; box-shadow: 4px 4px 0 rgba(20, 32, 43, 0.2); font-size: 0.88rem;
}
.toast.error { border-left-color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
.left { text-align: left; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 20px; }
dl.meta + p { margin-top: 14px; }
table.data td:first-child a { display: inline-block; min-width: 120px; }

/* the neutron spectrum: the library (a list and a plot) or your own */
.tabs { display: inline-flex; border: 1px solid var(--ink); }
.tab {
  font: inherit; font-size: 0.82rem; color: var(--muted); background: var(--paper); border: 0;
  padding: 5px 12px; cursor: pointer;
}
.tab + .tab { border-left: 1px solid var(--ink); }
.tab:hover { color: var(--ink); background: var(--paper-2); }
.tab.active { background: var(--ink); color: #fff; }
.spectrum-pick { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 24px; align-items: start; }
.spectrum-pick .field { margin-bottom: 0; }
.spectrum-pick input[type="search"] { margin-bottom: 8px; }
select.spectrum-list { height: auto; padding: 2px; font-size: 0.86rem; }
select.spectrum-list optgroup { color: var(--muted); font-style: normal; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
select.spectrum-list option { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 0.86rem; padding: 3px 8px; }
select.spectrum-list option:checked { background: #dbe7f6; }
.spectrum-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.spectrum-name .badge { color: var(--violet); }
.spectrum-view dl.meta { margin-top: 12px; font-size: 0.84rem; }
.spectrum-detail .add-row { align-items: center; }
.spectrum-detail > p.muted { margin: 16px 0 0; }
.input-spectrum { margin: 14px 0; max-width: 620px; }
.input-spectrum h3 { font-size: 0.9rem; margin: 0 0 8px; }
p.note {
  margin: 16px 0 0; padding: 9px 12px; font-size: 0.86rem;
  background: #fdf7ec; border: 1px solid #e9c98f; border-left: 4px solid var(--amber); color: #6b4300;
}
@media (max-width: 760px) { .spectrum-pick { grid-template-columns: 1fr; } }
.own-preview { max-width: 620px; margin-top: 18px; }
.add-row .hint { font-size: 0.78rem; color: var(--muted); align-self: center; }

/* ---- the irradiation schedule ---- */
.sched-plot { overflow-x: auto; margin: 0 0 18px; padding: 8px 6px 0; background: var(--paper-2); border: 1px solid var(--line-2); }
.sched { display: block; width: 100%; min-width: 640px; height: auto; }
.sched text { fill: var(--muted); font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.sched .sched-title { fill: var(--ink); font-size: 10.5px; letter-spacing: 0.08em; }
.sched .sched-axis { stroke: var(--ink); }
.sched .sched-tick { stroke: var(--ink); }
.sched .sched-grid { stroke: #e1e6ea; }
.sched .sched-irr { fill: rgba(255, 90, 31, 0.14); stroke: var(--orange-ink); stroke-width: 1; }
.sched .sched-irr.absolute { fill: rgba(255, 90, 31, 0.05); stroke-dasharray: 3 2; }
.sched .sched-stem { stroke: rgba(0, 80, 179, 0.35); }
.sched .sched-pt { fill: var(--blue); }
.sched .sched-shutdown { stroke: var(--red); stroke-dasharray: 4 3; }
.sched-empty { margin: 4px 0 14px; font-size: 0.85rem; }
.sched-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line-2); }
.sched-grid-2 > .sched-part { padding: 12px 14px; }
.sched-grid-2 > .sched-part + .sched-part { border-left: 1px solid var(--line-2); }
.sched-grid-2.one { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) {
  .sched-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .sched-grid-2 > .sched-part + .sched-part { border-left: 0; border-top: 1px solid var(--line-2); }
}
.sched-part { min-width: 0; }
.sched-part .part-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sched-part h3 { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding-left: 8px; }
.sched-part.irr h3 { border-left: 3px solid var(--orange); }
.sched-part.decay h3 { border-left: 3px solid var(--blue); }
.sched-part .hint { font-size: 0.78rem; color: var(--muted); }
.sched-part > .hint { margin-top: 6px; }
.sched-part p.hint { margin: 10px 0 0; }
.sched-part .presets { width: auto; padding: 4px 8px; font-size: 0.82rem; }
.sched-part input, .sched-part select, .sched-part textarea { font-family: var(--mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.sched-part input { padding: 6px 8px; }
.history-table th { white-space: nowrap; }
.history-table .num { width: 26px; }
.history-table .dur { width: 30%; }
.history-table .flux { width: 34%; }
.history-table .fluence { font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; color: var(--muted); }
.history-table tr input { border-left: 3px solid var(--orange); }
.rows td.step-actions { white-space: nowrap; width: 1%; }
.rows .step-actions .icon-btn { display: inline-grid; width: 26px; height: 26px; font-size: 0.92rem; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn:disabled:hover { color: var(--muted); border-color: transparent; background: none; }
.decay-list { border-left: 3px solid var(--blue); min-height: 64px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 8px; font-size: 0.72rem; }
input.short { width: 84px; }
.gen { display: grid; grid-template-columns: 70px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 14px 0 0; padding: 8px 10px 10px; border: 1px dashed var(--field); background: var(--paper-2); }
.gen legend { padding: 0 6px; font-size: 0.68rem; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; background: var(--paper); }
.gen label { margin: 0; font-size: 0.68rem; }
.gen input, .gen select { margin-top: 4px; padding: 5px 7px; }
@media (max-width: 520px) {
  .gen { grid-template-columns: 70px minmax(0, 1fr); }
  .history-table .fluence, .history-table th:nth-child(4) { display: none; }
}
.sched-part .add-row { align-items: center; }
.sum-line.over { color: var(--red); }
.actions select { width: auto; }
/* the material rows: narrow fields (a nuclide name and a number are short); on a phone they share the width */
.material-table { table-layout: fixed; width: auto; }
.material-table th:nth-child(1), .material-table th:nth-child(2) { width: 200px; }
.material-table th:nth-child(3) { width: 96px; }
.material-table th:nth-child(4) { width: 36px; }
.material-table td { vertical-align: top; }
.material-table .nuc input { font-family: var(--mono); }
@media (max-width: 560px) {
  .material-table { width: 100%; }
  .material-table th:nth-child(1), .material-table th:nth-child(2) { width: auto; }
  .material-table th:nth-child(3) { width: 80px; }
}
.field-msg { color: var(--red); font-size: 0.78rem; line-height: 1.3; margin-top: 3px; }
.field-msg:empty { display: none; }
/* the suggestions below a nuclide field */
.combo { position: relative; }
.suggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none;
  max-height: 248px; overflow-y: auto; background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(20, 32, 43, 0.12); font-family: var(--mono); font-size: 0.9rem;
}
.suggest li { padding: 5px 9px; cursor: pointer; }
.suggest li:hover { background: var(--paper-2); }
.suggest li[aria-selected="true"] { background: var(--blue); color: #fff; }

/* the sections of the new-run form: a head that opens and closes the section, and a box that is ticked when it is complete */
.sec-head { justify-content: flex-start; cursor: pointer; user-select: none; }
.sec-head .sum-line { margin-left: auto; text-align: right; }
.sec-head .sec-extra:empty { display: none; }
.sec-toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
}
.check {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 18px; height: 18px; border: 1.5px solid var(--field); background: var(--paper);
  font-size: 0.8rem; font-weight: 700; line-height: 1; letter-spacing: 0;
}
.sec.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.chev { flex: none; width: 8px; height: 8px; margin: 0 4px 3px 6px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sec.closed { padding-bottom: 0; }
.sec.closed > .card-head { margin-bottom: 0; border-bottom: 0; }
.sec.closed .chev { transform: rotate(-45deg); margin-bottom: 0; }
.sec.closed .sec-extra { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the list of runs: a click on a row opens the run */
table.data tr.link-row { cursor: pointer; }
@media (max-width: 760px) {
  .sec-head .chev { order: 1; margin-left: auto; }
  .sec-head .sum-line { order: 2; flex-basis: 100%; margin-left: 0; text-align: left; }
  .sec-head .sum-line:empty { display: none; }
  .sec-head .sec-extra { order: 3; }
}

/* the material: the table on the left, the chart of the composition on the right */
.mat-layout { display: grid; grid-template-columns: auto minmax(260px, 1fr); gap: 28px; align-items: start; }
.mat-main { min-width: 0; }
@media (max-width: 960px) { .mat-layout { grid-template-columns: 1fr; } }
.mat-mode { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.mat-opt { display: inline-flex; align-items: center; gap: 8px; }
.mat-opt-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.mat-total { display: inline-flex; gap: 6px; }
.mat-total input { width: 110px; }
.mat-total select { width: 84px; }
.pct-unit { display: inline-block; padding-top: 9px; font-family: var(--mono); color: var(--muted); }
.material-table.rows tfoot td { border-top: 1px solid var(--line-2); padding-top: 8px; vertical-align: middle; line-height: 1.4; }
.material-table .sum-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.sum-ok { color: var(--green); font-weight: 600; }
.sum-bad { color: var(--red); font-weight: 600; }
.suggest-note { color: var(--muted); font-family: var(--font); font-size: 0.8rem; }
.suggest li[aria-selected="true"] .suggest-note { color: #dbe7f5; }

.comp { border: 1px solid var(--line-2); background: var(--paper-2); padding: 12px 14px 10px; }
.comp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.comp-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--muted); }
.comp-list { list-style: none; margin: 0; padding: 0; }
.comp-row { display: grid; grid-template-columns: 74px 1fr 64px; gap: 8px; align-items: center; padding: 3px 4px; font-family: var(--mono); font-size: 0.82rem; }
.comp-row:hover { background: var(--paper); }
.comp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-other .comp-name { color: var(--muted); }
.comp-track { position: relative; height: 10px; border-left: 1px solid var(--ink); }
.comp-bar { display: block; height: 100%; background: var(--blue); border-radius: 0 4px 4px 0; }
.comp-other .comp-bar { background: var(--field); }
.comp-val { text-align: right; color: var(--ink-2); }
.comp-empty { color: var(--muted); font-size: 0.85rem; padding: 6px 0; }
.comp-foot { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.comp-foot:empty { display: none; }
