:root {
  --bg: #ffffff; --fg: #1d2330; --muted: #5b6475; --line: #d9dee7;
  --accent: #1f5fa8; --accent-fg: #ffffff; --danger: #b3261e; --bar: #e8ecf2;
  --copy-bg: #dcefd9; --copy-fg: #245b2a;
  --st-ok: #1b7a31; --st-low: #8a5a00; --st-none: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e; --fg: #e6e9ef; --muted: #a2aab8; --line: #2c323c;
    --accent: #5b9be0; --accent-fg: #0d1117; --danger: #ef6b62; --bar: #262b34;
    --copy-bg: #22402a; --copy-fg: #b7e3b9;
    --st-ok: #6fd283; --st-low: #f2b84b; --st-none: #ff7b72;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand img { border-radius: 6px; }
.who { color: var(--muted); font-size: 14px; }
.brand-row { display: flex; align-items: center; gap: 18px; }
.doclinks { display: flex; flex-direction: column; font-size: 13px; line-height: 1.35;
  padding-left: 16px; border-left: 1px solid var(--line); }
main { max-width: 640px; margin: 32px 0; padding: 0 24px; }
h1 { font-size: 26px; margin: 0 0 12px; }
h2 { font-size: 19px; margin: 36px 0 8px; }
a { color: var(--accent); }
.button, button { display: inline-block; background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.danger { background: var(--danger); color: #fff; }
.button.unavailable { opacity: .45; cursor: not-allowed; }
.note { color: var(--muted); }
/* Keep my storage sits inside the kept-until note, looking like a link. */
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; margin: 0; box-shadow: none; font: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer; }
.warning, .error { color: var(--danger); font-weight: 600; }
.bar { height: 10px; background: var(--bar); border-radius: 5px; overflow: hidden; margin: 0 0 20px; }
.bar div { height: 100%; background: var(--accent); }
form label { display: block; margin: 16px 0 6px; }
form input[type=text] { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); margin-bottom: 14px; }
form a { margin-left: 14px; }
form.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
form.actions a { margin-left: 0; }
h1.section { margin-top: 28px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin: 0 0 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.pill { font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--bar); color: var(--muted); white-space: nowrap; }
.pill.active, .pill.unknown { background: var(--accent); color: var(--accent-fg); }
.pill.unreachable { background: var(--danger); color: #ffffff; }
.access { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 14px 0; }
.access dt { color: var(--muted); }
.access dd { margin: 0; overflow-wrap: anywhere; }
code { font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bar);
  padding: 2px 6px; border-radius: 4px; }
button.copy { padding: 2px 10px; font-size: 13px; font-weight: 600; flex: none;
  background: var(--copy-bg); color: var(--copy-fg); }
/* The copy button stays beside its value; a long value wraps inside itself. */
.browser-note { font-size: 13px; margin-top: 4px; }
.access dt a.label-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.viewer-hint { font-size: 13px; margin: -6px 0 14px; }
.access dd.copyrow { display: flex; align-items: flex-start; gap: 8px; }
.access dd.copyrow code { min-width: 0; overflow-wrap: anywhere; }
/* The passphrase: dots until Show is pressed (dashboard.html). */
.secret .secret-text, .secret.shown .secret-dots { display: none; }
.secret.shown .secret-text { display: inline; }
.secret-dots { letter-spacing: 1px; }
button.reveal { padding: 2px 10px; font-size: 13px; font-weight: 600; flex: none;
  background: transparent; color: var(--accent); border: 1px solid var(--line); }
.button.slim { padding: 6px 14px; font-size: 15px; }
button.secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
fieldset.flavors { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.flavors legend { font-weight: 600; margin-bottom: 8px; }
label.flavor { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
label.flavor input { margin-top: 5px; }
label.flavor:has(input:checked) { border-color: var(--accent); }
label.flavor.off { opacity: .55; cursor: not-allowed; }
select { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); margin-bottom: 14px; }
@media (max-width: 520px) { .access { grid-template-columns: 1fr; } .access dd { margin-bottom: 6px; } }
ol.progress { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 4px; }
ol.progress li { color: var(--muted); }
ol.progress li.done, ol.progress li.running { color: var(--fg); }
ol.progress li.running { font-weight: 600; }
ol.progress .mark { display: inline-block; width: 1.6em; text-align: center; }
.topline { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: center; justify-content: space-between;
  padding: 6px 20px; font-size: 15px; background: var(--bar); border-bottom: 1px solid var(--line); }
.availability { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
  color: var(--muted); text-decoration: none; }
.availability[hidden] { display: none; }
.availability .flvs { display: contents; }  /* the refresh's wrapper; layout as before */
.funding { margin-left: auto; color: var(--muted); text-decoration: none; white-space: nowrap; }
.funding:hover { text-decoration: underline; }
.availability .lead { font-weight: 600; color: var(--fg); }
.availability .flv { white-space: nowrap; color: var(--fg); }
.availability .flv b { font-weight: 600; }
.availability .grp { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
.availability .grp ~ .grp { margin-left: 12px; padding-left: 14px; border-left: 1px solid var(--line); }
/* The type's name and count carry its status color (availability.py: 5+ ok,
   3-4 low, 0-2 none); a small bullet in the text color separates the types. */
.availability .flv.st-ok { color: var(--st-ok); }
.availability .flv.st-low { color: var(--st-low); }
.availability .flv.st-none { color: var(--st-none); }
.availability .flv.st-unknown { color: var(--muted); }
.availability .sep { color: var(--fg); font-size: 12px; margin: 0 -6px; }
/* The dashboard uses the page's width: each card stays at most 640 px, and the
   Help card (CHATBOT_PLAN.md) spans the page below them. */
main:has(> .dash) { max-width: none; }
.dash > #cards-storage, .dash > #cards-instance { max-width: 640px; }
/* The cart table needs the room: the MorphoSource card fills its column. */
.dash > #cards-morphosource { max-width: 900px; }
/* File browser in a panel to the right of the cards, on windows 700 px and
   wider; narrower ones open it in a new tab instead (dashboard.html). */
.files-panel { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; background: var(--bg); margin: 0; }
.files-panel[hidden] { display: none; }
.files-panel .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.files-panel .panel-head span { display: flex; align-items: center; gap: 12px; }
.files-path { font-weight: 600; overflow-wrap: anywhere; }
.files-path a { color: var(--accent); text-decoration: none; }
.files-path a:hover { text-decoration: underline; }
.panel-close { background: transparent; color: var(--muted); padding: 0 6px; font-size: 22px; line-height: 1; }
.files-panel iframe { border: 0; width: 100%; flex: 1 1 auto; min-height: 0; }
@media (max-width: 699px) { .files-panel { display: none; } }
@media (min-width: 700px) {
  /* Two by two: storage top left, the file panel top right (empty until it is
     opened), the instance bottom left, MorphoSource bottom right; the Help
     card (CHATBOT_PLAN.md) spans both columns below. Without the MorphoSource
     card the panel runs down beside the instance card as before. */
  .dash { display: grid; grid-template-columns: minmax(300px, 640px) minmax(300px, 1fr);
    grid-template-areas: "storage panel" "instance morphosource" "help help";
    gap: 0 24px; align-items: start; }
  .dash:not(:has(> #cards-morphosource)) { grid-template-areas: "storage panel" "instance panel" "help help"; }
  #cards-storage { grid-area: storage; }
  #cards-instance { grid-area: instance; }
  #cards-morphosource { grid-area: morphosource; }
  #chatbot { grid-area: help; }
  .files-panel { grid-area: panel; align-self: stretch; min-height: 460px; }
  .dash:not(:has(> #cards-morphosource)) #cards-instance section.card:last-of-type { margin-bottom: 0; }
}
@media (max-width: 600px) { main { padding: 0 16px; } }
.countdown { font-weight: 600; margin: 4px 0 8px; }
.countdown.soon { color: var(--danger); }
/* A pressed button shows it: dimmed, a progress cursor, and a spinner in
   front of its label until the page has the result. */
button:disabled, .button.disabled { opacity: .6; cursor: progress; }
.working::before { content: ""; display: inline-block; width: .75em; height: .75em; margin-right: 8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -.1em; animation: mc-spin .8s linear infinite; }
@keyframes mc-spin { to { transform: rotate(360deg); } }
/* Team messages above the cards (PORTAL_MESSAGES_PLAN.md): a banner stays,
   a notice has OK. */
.team-msgs { display: flex; flex-direction: column; gap: 10px; margin: 0 0 20px; }
.team-msgs[hidden] { display: none; }
.team-msg { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 6px; background: var(--bar); }
.team-msg.banner { border-left-color: var(--st-low); }
.team-msg p { margin: 0; overflow-wrap: anywhere; }
.team-msg a { margin-left: 4px; white-space: nowrap; }
.team-msg form { margin: 0; flex: none; }
.team-msg button { padding: 4px 14px; }

/* MorphoSource cart card (MORPHOSOURCE_PLAN.md). */
.ms-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 15px; }
.ms-table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); padding: 4px 6px; }
.ms-table td { border-bottom: 1px solid var(--line); padding: 6px; vertical-align: top; overflow-wrap: anywhere; }
.ms-table td:first-child { width: 1.6em; }
.ms-table td.ms-thumb { width: 64px; padding-right: 2px; }
.ms-table td.ms-thumb img { display: block; width: 56px; height: 56px; object-fit: cover; border-radius: 4px;
  background: var(--bar); }
.ms-table .num { text-align: right; white-space: nowrap; }
.ms-table .note { font-size: 13px; }
form .ms-table a, .ms-card .actions a { margin-left: 0; }
.ms-table tr.ms-restricted, .ms-table tr.ms-gone { color: var(--muted); }
.ms-table tr.ms-failed td:last-child { color: var(--danger); }
.ms-tally { margin: 0 0 4px; font-weight: 600; }
.ms-survey { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.ms-survey legend { font-weight: 600; padding: 0 4px; }
.ms-survey textarea { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); }
.ms-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 12px; margin: 8px 0; }
.ms-cats label, label.ms-agree { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; font-size: 15px; }
.ms-cats input, label.ms-agree input { margin-top: 5px; }
.ms-card .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.ms-card input[type=password] { width: 100%; padding: 9px 10px; font: inherit; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); margin-bottom: 8px; }
.ms-go:disabled:not(.working) { cursor: not-allowed; }
.pill.ok { background: var(--copy-bg); color: var(--copy-fg); }
.ms-progress { margin: 10px 0 6px; }
.ms-progress.ms-ok { color: var(--copy-fg); font-weight: 600; }
.ms-progress a { font-weight: 400; margin-left: 6px; }
.ms-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.ms-pager button.slim { padding: 4px 12px; font-size: 14px; }
.ms-table tr.ms-done td:last-child a { color: var(--copy-fg); font-weight: 600; white-space: nowrap; }
/* The finished line, its OK at the right end (like a team notice's). */
.ms-finished { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 10px 0 6px; }
.ms-finished .ms-progress { margin: 0; }
form.ms-ack { margin: 0; flex: none; }
form.ms-ack button.slim { padding: 2px 14px; font-size: 14px; }
/* The MorphoSource cart list folds; the count in the head is the button. The
   tally, survey and buttons below the list stay. */
button.ms-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0;
  margin: 0; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; text-align: left; }
.ms-caret { display: inline-block; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted); transform: rotate(90deg); transition: transform .15s; }
.ms-folded .ms-caret { transform: none; }
.ms-folded .ms-list { display: none; }
.ms-card .card-head { margin-bottom: 4px; }
