/* Styles people can choose on their Profile page (<html data-theme="…">).
   "system" follows the computer's light/dark setting. Sizes are in rem, so
   the text size setting (<html style="font-size: …%">) scales the whole page. */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --fg: #1d1d1f; --bg: #fafafa; --panel: #ffffff; --muted: #6e6e73;
  --line: #d9d9de; --accent: #2557a7; --on-accent: #ffffff; --ok: #1f7a3a; --err: #b3261e;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #f5f5f7; --bg: #161618; --panel: #1f1f22; --muted: #a1a1a6;
  --line: #3a3a3f; --accent: #7aa7ff; --on-accent: #0b1a33; --ok: #6fd08c; --err: #ff8a80;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --fg: #f5f5f7; --bg: #161618; --panel: #1f1f22; --muted: #a1a1a6;
    --line: #3a3a3f; --accent: #7aa7ff; --on-accent: #0b1a33; --ok: #6fd08c; --err: #ff8a80;
  }
}
:root[data-theme="contrast"] {
  color-scheme: light;
  --fg: #000000; --bg: #ffffff; --panel: #ffffff; --muted: #2b2b2b;
  --line: #000000; --accent: #003a9e; --on-accent: #ffffff; --ok: #005a14; --err: #a00000;
}
:root[data-theme="contrast"] a { text-decoration: underline; }
:root[data-theme="contrast"] button:focus-visible, :root[data-theme="contrast"] a:focus-visible,
:root[data-theme="contrast"] input:focus-visible { outline: 3px solid #000; outline-offset: 2px; }
:root[data-theme="sepia"] {
  color-scheme: light;
  --fg: #3b2f22; --bg: #f4ecd8; --panel: #fbf6ea; --muted: #7a6a55;
  --line: #d8c9a8; --accent: #8a4b16; --on-accent: #ffffff; --ok: #4f6b1f; --err: #a3301e;
}
/* Text styles (``[text]{.red}`` in outline items and wiki pages: wiki/markdown.py). */
:root {
  --fmt-red: #b42318; --fmt-orange: #a64b00; --fmt-green: #17703a; --fmt-blue: #1d5fbf;
  --fmt-purple: #7339ac; --fmt-gray: #6e6e73; --fmt-highlight: #fff1a6;
}
:root[data-theme="dark"] {
  --fmt-red: #ff8a80; --fmt-orange: #ffb366; --fmt-green: #7ddc9a; --fmt-blue: #8ab4ff;
  --fmt-purple: #d0a8ff; --fmt-gray: #a1a1a6; --fmt-highlight: #5c4f00;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --fmt-red: #ff8a80; --fmt-orange: #ffb366; --fmt-green: #7ddc9a; --fmt-blue: #8ab4ff;
    --fmt-purple: #d0a8ff; --fmt-gray: #a1a1a6; --fmt-highlight: #5c4f00;
  }
}
.fmt-red { color: var(--fmt-red); } .fmt-orange { color: var(--fmt-orange); }
.fmt-green { color: var(--fmt-green); } .fmt-blue { color: var(--fmt-blue); }
.fmt-purple { color: var(--fmt-purple); } .fmt-gray { color: var(--fmt-gray); }
.fmt-highlight { background: var(--fmt-highlight); border-radius: 2px; padding: 0 .1em; }
* { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.5 system-ui, sans-serif; color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
header { border-bottom: 1px solid var(--line); background: var(--panel); }
nav { padding: .6rem clamp(1rem, 2vw, 2rem); display: flex; gap: 1rem;
      align-items: center; flex-wrap: wrap; }
nav .brand { font-weight: 600; color: var(--fg); text-decoration: none; margin-right: auto; }
nav form { margin: 0; }
main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
/* Project pages: full width, starting near the left edge. */
main.wide { max-width: none; margin: 0; padding: 1.25rem clamp(1rem, 2vw, 2rem) 3rem; }
.muted { color: var(--muted); }
.messages { list-style: none; padding: 0; }
.messages li { padding: .6rem .8rem; border-radius: 6px; border: 1px solid var(--line);
               background: var(--panel); margin-bottom: .5rem; }
.messages .success { border-color: var(--ok); }
.messages .error { border-color: var(--err); }
input[type=text], input[type=email], input[type=password], select, textarea {
  font: inherit; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--fg); max-width: 100%; }
button, .button { font: inherit; padding: .4rem .9rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); text-decoration: none; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
form p, form > div { margin: 0 0 .8rem; }
label { display: block; font-weight: 500; }
.errorlist { color: var(--err); padding-left: 1rem; }
.table-wrap { overflow-x: auto; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: .3rem 0; }
.details .table-tools input[type=search] { width: auto; flex: 1 1 14rem; max-width: 24rem; }
.details .field [data-set-all] input[type=text] { width: 7rem; }
table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line);
         vertical-align: middle; white-space: nowrap; }
th { font-weight: 600; }
td form { display: flex; gap: .4rem; margin: 0; }
.tabs { display: flex; gap: 1rem; margin-bottom: 1rem; }
.tabs .active { font-weight: 600; text-decoration: none; color: var(--fg); }
.badge { font-size: .8rem; padding: .1rem .45rem; border-radius: 999px; border: 1px solid var(--line); }

/* Pages, wiki and projects */
.wiki-bar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.wiki-bar .spacer { margin-right: auto; }
.crumbs { font-size: .9rem; color: var(--muted); }
.prose { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; overflow-wrap: anywhere; }
.prose img { max-width: 100%; height: auto; }
.prose pre { overflow-x: auto; background: var(--bg); padding: .75rem; border-radius: 6px; }
.prose table { width: auto; }
.prose a.missing { color: var(--err); }
.tree, .tree ul { list-style: none; padding-left: 1rem; margin: .2rem 0; }
.tree { padding-left: 0; }
.inline-form { display: inline; margin: 0; }
.danger { background: var(--err); border-color: var(--err); }
.notice { border: 1px solid var(--err); border-radius: 6px; padding: .6rem .8rem; margin-bottom: 1rem; }
.diff { font: .8125rem/1.4 ui-monospace, monospace; white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .75rem; overflow-x: auto; }
.diff .add { color: var(--ok); } .diff .del { color: var(--err); } .diff .meta { color: var(--muted); }

/* Project files */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.tile { display: flex; flex-direction: column; gap: .3rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-decoration: none; color: var(--fg); }
.tile img { width: 100%; height: 140px; object-fit: contain; background: var(--bg); border-radius: 4px; }
.tile-kind { height: 140px; display: grid; place-items: center; background: var(--bg); border-radius: 4px; color: var(--muted); }
.tile-name { font-size: .85rem; overflow-wrap: anywhere; }
img.preview { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.preview-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.slatsim-preview { height: 60vh; min-height: 22rem; }

/* Project settings */
.settings-table td { vertical-align: top; white-space: normal; }
.setting-value { max-width: 48rem; overflow-wrap: anywhere; }
.setting-value summary { cursor: pointer; }
.setting-value code { white-space: pre-wrap; }
.setting-value .setting-form { display: block; margin: .4rem 0; }
.setting-full { white-space: pre-wrap; background: var(--bg); padding: .5rem; border-radius: 6px; max-height: 24rem; overflow: auto; }
.setting-form textarea { width: 100%; box-sizing: border-box; font: .8125rem/1.4 ui-monospace, monospace; }
.setting-mode { display: flex; gap: 1rem; margin: .4rem 0; }

/* Outline */
.outline-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
/* Item details: a wide panel against the right edge of the window. */
@media (min-width: 900px) {
  .outline-layout.with-details { grid-template-columns: minmax(18rem, 1fr) var(--details-width, clamp(30rem, 55vw, 70rem)); }
}
.outline ul { list-style: none; margin: 0; padding-left: 1.4rem; }
.outline > ul { padding-left: 0; }
.o-row { display: flex; align-items: flex-start; gap: .35rem; padding: .15rem .25rem; border-radius: 4px; position: relative; }
.o-row:hover, .o-row.selected { background: var(--panel); }
.o-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.o-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.o-row.drop-inside { outline: 2px dashed var(--accent); }
/* A file from the computer dragged over an item: it will become a sub-item. */
.o-row.drop-file { outline: 2px solid var(--accent); outline-offset: -1px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); }
.o-toggle { width: 1rem; flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font: inherit; }
.o-bullet { flex: none; width: 1rem; text-align: center; color: var(--muted); cursor: grab; user-select: none; }
.o-type { flex: none; font-size: .8rem; padding: 0 .4rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.o-text { flex: 0 1 auto; min-width: 4rem; overflow-wrap: anywhere; cursor: text; min-height: 1.5em; }
.o-text img { max-height: 160px; max-width: 100%; vertical-align: middle; }
.o-text img, .o-notebook-body img { cursor: zoom-in; }
/* Double-clicked image, shown larger */
.image-viewer { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); max-width: 96vw; max-height: 96vh; overflow: hidden; }
.image-viewer::backdrop { background: rgb(0 0 0 / .65); }
.image-viewer figure { margin: 0; display: flex; flex-direction: column; }
.image-viewer img { display: block; width: min(92vw, 1600px); height: calc(92vh - 2.75rem); object-fit: contain; background: var(--bg); cursor: zoom-out; }
.image-viewer figcaption { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; padding: .45rem .75rem; font-size: .9rem; }
.image-viewer-close { margin-left: auto; }
.o-text p { margin: 0; }
.o-text.empty::before { content: "(empty)"; color: var(--muted); }
.o-format { position: absolute; bottom: 100%; left: 1.5rem; z-index: 5; display: inline-flex; gap: 2px;
  padding: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.o-format-btn { min-width: 1.6rem; padding: 0 .3rem; font: inherit; font-size: .85rem; line-height: 1.5;
  border: 0; border-radius: 4px; background: transparent; color: var(--fg); cursor: pointer; }
.o-format-btn:hover { background: var(--bg); }
.o-format-btn.fmt-b { font-weight: 700; } .o-format-btn.fmt-i { font-style: italic; }
.o-format-btn.fmt-s { text-decoration: line-through; }
.o-format-btn.o-format-color { font-weight: 700; }
.o-edit { flex: 1 1 auto; font: inherit; padding: 0 .2rem; border: 1px solid var(--accent); border-radius: 4px; background: var(--bg); color: var(--fg); resize: none; overflow: hidden; }
.o-summary { flex: none; margin-left: auto; padding-left: 1rem; font-size: .8rem; color: var(--muted); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-actions { flex: none; display: none; gap: .3rem; }
.o-row.selected .o-actions, .o-row:focus .o-actions, .o-row:focus-within .o-actions { display: inline-flex; }
/* (Only where there's a real hover: a tablet "hovers" whatever was last tapped.) */
@media (hover: hover) { .o-row:hover .o-actions { display: inline-flex; } }
/* The selected item (clicked once): highlighted; Return adds an item below it. */
.o-row:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -1px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.o-actions button { font-size: .8rem; padding: 0 .4rem; }
.o-deleted > .o-row .o-text { text-decoration: line-through; color: var(--muted); }
.o-row.o-cut { opacity: .55; outline: 1px dashed var(--muted); outline-offset: -1px; }
.outline-notice:empty { display: none; }
.o-missing { color: var(--err); font-size: .8rem; }
.o-add { margin: .3rem 0 0 1.4rem; font-size: .85rem; }
.outline-help kbd { font-size: .8em; border: 1px solid var(--line); border-radius: 3px; padding: 0 .25em; }
.details { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); align-self: start; position: sticky; top: .5rem; }
.details-body { max-height: calc(100vh - 1rem); overflow-y: auto; padding: 0 .75rem .75rem; border-radius: 8px; }
/* The header (and its Close button) stays at the top while the panel scrolls. */
.details-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 2;
  background: var(--panel); padding: .6rem 0 .4rem; margin-bottom: .4rem; border-bottom: 1px solid var(--line); }
.close-details { font-size: .95rem; }
/* Drag handle on the panel's left edge. */
.details-resizer { position: absolute; left: -6px; top: 0; bottom: 0; width: 12px; cursor: col-resize; z-index: 3; border-radius: 6px; }
.details-resizer:hover, .details-resizer:focus-visible { background: color-mix(in srgb, var(--accent) 35%, transparent); outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
@media (max-width: 899px) {
  .details-resizer { display: none; }
  /* A narrow window (a tablet held upright): the details slide over the
     outline from the right, rather than going below the whole outline. */
  .details { position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 42rem); z-index: 40;
    border-radius: 0; box-shadow: -6px 0 18px rgba(0,0,0,.25); }
  .details-body { max-height: 100dvh; height: 100%; }
}
.details-resizer { touch-action: none; }
.details-title { font-weight: 500; overflow-wrap: anywhere; }
.details .field { margin-bottom: .7rem; }
.details .field input[type=text], .details .field textarea, .details .field select { width: 100%; }
.details .field .inline { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.details .field .inline input { width: auto; }
.details .has-error input, .details .has-error textarea, .details .has-error select { border-color: var(--err); }
.details .check { display: inline-flex; gap: .25rem; font-weight: normal; margin-right: .6rem; }
.details-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.details .table-import { margin: .5rem 0; font-size: .9rem; }
.details .link-files input[type=search], .details .link-files select[multiple] { display: block; width: 100%; box-sizing: border-box; margin-bottom: .25rem; }
.details .field .field-table input { width: auto; max-width: none; padding: .15rem .3rem; } /* sized to content by outline.js */
/* Data tables (strands, components, …) are dense: a little smaller than the
   panel's text, still following the person's text-size setting. */
.details .field-table, .import-table { font-size: .9em; }
.field-table td, .field-table th { padding: .2rem .3rem; }
.field-table td.row-buttons { white-space: nowrap; }
.field-table td.row-buttons button { padding: 0 .2rem; }
.small { font-size: .85rem; }
.small-heading { font-size: .95rem; margin: 1rem 0 .3rem; }
.history { padding-left: 1rem; color: var(--muted); }
.mono { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.ok-text { color: var(--ok); } .err-text { color: var(--err); }
td.actions { display: flex; gap: .5rem; align-items: center; }

/* Fields side by side in the wide details panel; tables and long text span it. */
.details .node-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); column-gap: 1.25rem; align-items: start; }
.details .node-form > .field-wide, .details .node-form > button, .details .node-form > input[type=hidden] { grid-column: 1 / -1; }
.details .node-form > button { justify-self: start; }

/* Asking before a change (core/confirm.js) */
.confirm-dialog { width: min(28rem, 92vw); padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); }
.confirm-dialog::backdrop { background: rgb(0 0 0 / .45); }
.confirm-message { margin: 0 0 1rem; white-space: pre-line; overflow-wrap: anywhere; }
.confirm-buttons { display: flex; gap: .75rem; align-items: center; }

/* Import review dialog */
.import-dialog { width: min(1200px, 95vw); max-height: 88vh; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); }
.import-dialog::backdrop { background: rgb(0 0 0 / .45); }
.import-dialog form { display: flex; flex-direction: column; max-height: 88vh; margin: 0; }
.import-head { padding: .9rem 1rem .5rem; border-bottom: 1px solid var(--line); }
.import-head h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.import-controls { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-top: .5rem; }
.import-controls .spacer { flex: 1; }
.import-controls input[type=search] { flex: 1 1 18rem; max-width: 28rem; font: inherit; padding: .35rem .5rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.import-controls .check { display: inline-flex; gap: .3rem; font-weight: normal; }
.import-body { overflow: auto; flex: 1; }
.import-table { font-size: .85rem; }
.import-table thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.import-table td.mono { white-space: normal; overflow-wrap: anywhere; min-width: 16rem; }
.paste-dialog { width: min(900px, 95vw); }
.paste-dialog h3 { margin: .75rem 0 .25rem; font-size: 1rem; }
.paste-table { width: 100%; table-layout: fixed; }
.paste-table th:nth-child(1) { width: 40%; }
.paste-table th:nth-child(3), .paste-table th:nth-child(4) { width: 9rem; }
.paste-table td { overflow-wrap: anywhere; }
.paste-table td:nth-child(3), .paste-table td:nth-child(4),
.paste-table th:nth-child(3), .paste-table th:nth-child(4) { text-align: center; white-space: nowrap; }
.import-foot { display: flex; gap: 1rem; align-items: center; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Computed sequence lengths in strand tables (read-only, kept up to date). */
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.seq-length { color: var(--muted); min-width: 3.5rem; }

/* Outline search, zoom and live editing */
.outline-search { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: 0 0 .6rem; }
.outline-search input[type=search] { flex: 1 1 18rem; max-width: 30rem; font: inherit; padding: .35rem .5rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.outline-search label { display: inline-flex; gap: .3rem; align-items: center; font-weight: normal; }
.outline-search input[type=date] { font: inherit; padding: .2rem .3rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--fg); }
.outline-help { margin-bottom: .5rem; }
#breadcrumbs { margin: 0 0 .5rem; }
.o-row.o-match .o-text { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 3px; }
.o-bullet { cursor: pointer; }
.o-lock { flex: none; font-size: .8rem; padding: 0 .4rem; border-radius: 999px; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); white-space: nowrap; }
#live-status { white-space: nowrap; }
/* Touch screens can't hover: the tapped row's buttons show (and moving ones,
   as there's no keyboard or dragging), big enough for a finger. A double-tap
   edits rather than zooms. */
.o-touch-only { display: none; }
.outline { touch-action: manipulation; }
@media (hover: none) {
  .o-row.current .o-actions, .o-row:focus-within .o-actions { display: inline-flex; }
}
@media (pointer: coarse) {
  .o-touch-only { display: inline-block; }
  /* The tapped row's bigger buttons can't push its summary off the screen. */
  .o-row { flex-wrap: wrap; }
  .o-summary { min-width: 0; overflow-wrap: anywhere; }
  .o-actions { gap: .35rem; flex-wrap: wrap; }
  .o-actions button { min-width: 2.25rem; min-height: 2.25rem; font-size: 1rem; }
  .o-toggle, .o-bullet { min-width: 1.75rem; min-height: 1.75rem; }
  .o-grid-toggle, .o-notebooks { min-width: 2rem; min-height: 2rem; }
  .o-format-btn { min-width: 2.25rem; min-height: 2.25rem; font-size: 1rem; }
  .details-resizer { width: 20px; left: -10px; }
}

.o-notebooks { flex: none; font-size: .85rem; border: 0; background: none; padding: 0 .2rem; cursor: pointer; border-radius: 4px; }
.o-notebooks:hover, .o-notebooks.open { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.o-grid-toggle { flex: none; font-size: .95rem; line-height: 1; border: 0; background: none; color: var(--accent); padding: 0 .2rem; cursor: pointer; border-radius: 4px; }
.o-grid-toggle:hover, .o-grid-toggle.open { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.o-grid-view { margin: .2rem 0 .6rem 2.6rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.o-grid-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .35rem .6rem; background: var(--bg); font-size: .85rem; }
.o-grid-actions { margin-left: auto; display: flex; gap: .4rem; }
/* The sheet is always light, so its cell editors must be too (in dark mode
   they would otherwise type white text on the white sheet). */
.o-grid-host { padding: .3rem; font-size: .82rem; color: #1d1d1f; background: #fff; color-scheme: light; }
.o-grid-host input, .o-grid-host textarea { color: #1d1d1f; background: #fff; }
.o-mix-bar, .o-mix-summary { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; padding: .35rem .6rem; font-size: .85rem; }
.o-mix-bar input { width: 6rem; }
.o-mix-links { flex: 1 1 100%; }
.o-mix-links button { padding: 0 .4rem; font-size: .75rem; }
.o-mix-picker { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .5rem; background: var(--panel); }
.o-mix-pick-top, .o-mix-pick-controls { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.o-mix-pick-top select { max-width: 32rem; }
.o-mix-picker input[type=search] { width: 14rem; font: inherit; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.o-mix-pick-list { max-height: 16rem; overflow: auto; border-top: 1px solid var(--line); padding-top: .25rem; }
.o-mix-pick-row { display: flex; gap: .5rem; align-items: baseline; padding: .05rem 0; }
.o-mix-pick-row[hidden] { display: none; }
.o-mix-pick-row input { width: auto; }
.o-mix-pick-controls select + input { width: 12rem; }
.mix-strands { margin: .3rem 0; }
.mix-strands summary { cursor: pointer; }
.mix-strands .table-wrap { max-height: 24rem; overflow: auto; }
.o-mix-strands { flex: 1 1 100%; max-height: 24rem; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.o-mix-strands table { font-size: .85rem; }
.o-mix-plates { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .5rem; background: var(--panel); overflow-x: auto; }
.o-plate-block { display: inline-block; vertical-align: top; margin: 0 1.2rem .6rem 0; }
.o-plate-title { margin: .2rem 0; }
.o-plate { border-collapse: collapse; font-size: .7rem; }
.o-plate th { color: var(--muted); font-weight: 400; padding: 0 .2rem; text-align: center; }
.o-plate td { width: 1.1rem; height: 1.1rem; border: 1px solid var(--line); border-radius: 50%; }
.o-plate td.on { background: var(--well); }
.o-plate td.off { background: color-mix(in srgb, var(--well) 22%, transparent); }
.o-mix-pick-name { font-family: ui-monospace, monospace; font-size: .8rem; }
.o-mix-summary { display: block; border-top: 1px solid var(--line); background: var(--bg); font-variant-numeric: tabular-nums; }
.o-mix-summary div { margin: .1rem 0; }
.mix-errors { border: 2px solid var(--err); border-radius: 6px; padding: .45rem .7rem; margin: .3rem 0 .5rem;
  background: color-mix(in srgb, var(--err) 10%, var(--panel)); color: var(--err); }
.mix-errors ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.mix-print table { border-collapse: collapse; margin: .4rem 0 1.2rem; font-variant-numeric: tabular-nums; }
.mix-print th, .mix-print td { border: 1px solid var(--line); padding: .2rem .5rem; text-align: left; }
.mix-print table.plate { table-layout: fixed; width: 100%; font-size: .72em; }
.mix-print table.plate th { text-align: center; width: 1.6rem; }
.mix-print table.plate td { height: 2.1rem; overflow-wrap: anywhere; padding: .1rem .2rem; }
.mix-print table.plate td.well { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mix-print .plate-wrap { overflow-x: auto; }
.mix-print .p384 table.plate { min-width: 64rem; font-size: .6em; }
.mix-print .p384 table.plate td { height: 1.8rem; padding: .05rem .12rem; }
@media print { .no-print, header, nav, footer { display: none !important; }
  .mix-print .plate-block { break-inside: avoid; } .mix-print .p384 table.plate { min-width: 0; font-size: 4.6pt; }
  .mix-print th, .mix-print td { border-color: #000; } body { background: #fff; color: #000; } }
.mix-errors:empty { display: none; }
.o-mix-cant, input.o-mix-cant { outline: 2px solid var(--err); outline-offset: -2px;
  background: color-mix(in srgb, var(--err) 12%, transparent) !important; }
.o-pairing-view { margin: .2rem 0 .6rem 2.6rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.o-pairing-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .35rem .6rem; background: var(--bg); font-size: .85rem; }
.o-pairing-body { padding: .5rem .7rem .7rem; font-size: .85rem; }
.pm-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.pm-bar input { width: 4.2em; font: .8rem ui-monospace, monospace; }
.pm-notes p { margin: 0 0 .3rem; }
/* The matrix column fits the matrix; the details take the rest of the width. */
.pm-body { display: grid; grid-template-columns: minmax(0, max-content) minmax(18rem, 1fr); gap: .8rem 1.2rem; align-items: start; }
.pm-matrix { overflow: auto; max-height: 48rem; min-width: 0; }
.pm-matrix svg { display: block; }
.pm-matrix text { fill: var(--fg); font: 10px ui-monospace, monospace; cursor: pointer; }
.pm-matrix text.sel { fill: var(--accent); font-weight: 600; }
.pm-cell { cursor: pointer; }
.pm-cell:hover, .pm-cell.sel { stroke: var(--fg); stroke-width: 1.5; }
.pm-frame { fill: none; stroke: var(--line); }
.pm-complex { fill: none; stroke: var(--muted); stroke-width: 1; }
.pm-lost { fill: none; stroke: var(--fg); stroke-width: .8; stroke-dasharray: 2 2; pointer-events: none; }
.pm-legend { display: flex; gap: .5rem; align-items: center; margin-bottom: .3rem; }
.pm-scale { width: 7rem; height: .6rem; border: 1px solid var(--line); border-radius: 2px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 20%, var(--panel)), var(--accent)); }
.pm-detail { min-width: 0; display: grid; gap: .4rem; align-content: start; }
.pm-detail h3 { margin: 0; font-size: .95rem; overflow-wrap: anywhere; }
.pm-detail p { margin: 0; }
.pm-detail pre { margin: 0; overflow-x: auto; background: var(--bg); padding: .4rem .5rem; border-radius: 6px; font: .78rem/1.35 ui-monospace, monospace; }
.pm-detail pre b { color: var(--ok); }
.pm-seq { font: .78rem ui-monospace, monospace; overflow-wrap: anywhere; }
.pm-partners { border-collapse: collapse; font-size: .8rem; width: 100%; }
.pm-partners th, .pm-partners td { text-align: left; padding: .15rem .35rem; border-bottom: 1px solid var(--line); }
.pm-partners th { color: var(--muted); font-weight: 500; }
.pm-complexes { display: grid; gap: .35rem; margin-top: .3rem; }
.pm-group { font-size: .75rem; color: var(--muted); margin-right: .3rem; }
.pm-tag { font: .72rem ui-monospace, monospace; border: 0; border-radius: 3px; padding: .05rem .35rem; margin: .1rem .15rem 0 0; background: var(--bg); color: var(--fg); cursor: pointer; }
.pm-tag:hover { background: var(--accent); color: var(--on-accent); }
.o-pairing-tabs { display: flex; gap: .2rem; }
.o-pairing-tabs button { border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; padding: .1rem .5rem; cursor: pointer; }
.o-pairing-tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.as-bar { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .4rem; }
.as-bar select { max-width: 18rem; }
.as-bar button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.as-help { margin: 0 0 .3rem; max-width: 70rem; }
.as-stats { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-family: ui-monospace, monospace; color: var(--muted); margin-bottom: .3rem; }
.as-helix { display: grid; grid-template-columns: 11rem minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.as-palette { border-right: 1px solid var(--line); max-height: 36rem; overflow: auto; padding: .3rem; }
.as-label { font-size: .72rem; color: var(--muted); padding: .1rem .3rem .3rem; }
.as-chip { display: flex; align-items: center; gap: .4rem; padding: .1rem .3rem; border-radius: 4px; cursor: grab; user-select: none; touch-action: none; font: .75rem ui-monospace, monospace; }
.as-chip:hover { background: var(--bg); }
.as-chip i { width: .6rem; height: .6rem; border-radius: 2px; flex: none; }
.as-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-chip em { font-style: normal; color: var(--muted); }
.as-chip.placed { opacity: .45; }
.as-chip.sel { outline: 1px solid var(--accent); }
.as-board { overflow: auto; max-height: 36rem; outline: none; }
.as-board svg { display: block; touch-action: none; user-select: none; }
.as-track { fill: var(--bg); }
.as-axis { stroke: var(--line); }
.as-ruler { fill: var(--muted); font: 10px ui-monospace, monospace; }
.as-base { fill: var(--fg); font: 9px ui-monospace, monospace; text-anchor: middle; pointer-events: none; }
.as-base.clash { fill: var(--err); font-weight: 600; }
.as-pair { stroke-width: 2; }
.as-pair.ok { stroke: var(--ok); }
.as-pair.bad { stroke: var(--err); }
.as-strand { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.as-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: grab; }
.as-board .sel .as-strand { stroke-width: 4; }
.as-board .ghost { opacity: .6; }
.as-snap { fill: var(--ok); font: 600 11px ui-monospace, monospace; }
.as-floating { position: fixed; z-index: 50; pointer-events: none; font: .75rem ui-monospace, monospace; padding: .1rem .5rem; border-radius: 4px; background: var(--fg); color: var(--bg); }
.as-free { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.as-free canvas { display: block; width: 100%; height: 32rem; touch-action: none; cursor: grab; }
.as-hover { position: absolute; left: .5rem; bottom: .3rem; pointer-events: none; font-family: ui-monospace, monospace; }
@media (max-width: 52rem) {
  .pm-body, .as-helix { grid-template-columns: minmax(0, 1fr); }
  .as-palette { border-right: 0; border-bottom: 1px solid var(--line); max-height: 9rem; }
}
.o-notebook-view { margin: .2rem 0 .6rem 2.6rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.o-notebook-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .35rem .6rem; background: var(--bg); font-size: .85rem; }
.o-notebook-links { margin-left: auto; display: flex; gap: .7rem; align-items: center; }
.o-notebook-links button { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0 .2rem; }
.o-notebook-body { max-height: 32rem; overflow: auto; resize: vertical; padding: .5rem .8rem; font-size: .85rem; }
.o-notebook-body pre { margin: .2rem 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .8rem/1.45 ui-monospace, monospace; }
.o-notebook-body .nb-code { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0 .3rem; margin: .4rem 0; }
.o-notebook-body .nb-prompt { color: var(--muted); font: .75rem ui-monospace, monospace; padding-top: .35rem; }
.o-notebook-body .nb-source { background: var(--bg); padding: .35rem .55rem; border-radius: 6px; }
.o-notebook-body .nb-outputs { grid-column: 2; }
.o-notebook-body .nb-outputs img { max-width: 100%; height: auto; }
.o-notebook-body .nb-error { color: var(--err); }
.o-notebook-body .nb-table { overflow-x: auto; }
.o-notebook-body table { border-collapse: collapse; font-size: .8rem; }
.o-notebook-body td, .o-notebook-body th { border: 1px solid var(--line); padding: .1rem .35rem; }
.notebook-links { padding-left: 1rem; }

/* Profile: appearance settings */
.appearance-grid { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-bottom: 1rem; }
.appearance-grid fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem 1rem .8rem; background: var(--panel); }
.appearance-grid legend { font-weight: 600; padding: 0 .3rem; }
.appearance-grid .choice { display: flex; gap: .45rem; align-items: center; font-weight: normal; margin: .25rem 0; }

/* Site-wide search */
.nav-search input { font: inherit; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); width: 14rem; max-width: 40vw; }
.search-form { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; margin-bottom: 1rem; }
.search-form input[type=search] { flex: 1 1 22rem; max-width: 36rem; font: inherit; padding: .4rem .6rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.search-form label { display: inline-flex; gap: .3rem; align-items: center; font-weight: normal; }
.search-form input[type=date] { font: inherit; padding: .2rem .3rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); }
.search-group h2 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { padding: .55rem .2rem; border-bottom: 1px solid var(--line); }
.search-title { font-weight: 600; margin-right: .4rem; overflow-wrap: anywhere; }
.search-snippet { overflow-wrap: anywhere; margin: .15rem 0; }
.search-snippet mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; }

/* Sequences in tables wrap instead of being cut off. */
.field-table td.seq-cell, .import-table td.seq-cell { white-space: normal; min-width: 18ch; }
.field-table td.seq-cell.mono, .import-table td.seq-cell { word-break: break-all; }
.details .field .field-table textarea.seq-input { width: clamp(22ch, 42ch, 60vw); max-width: none; resize: vertical;
  overflow: hidden; padding: .15rem .3rem; line-height: 1.35; word-break: break-all; }

/* scadnano and SlatSim viewers: the app fills the window below a slim bar. */
.scadnano-bar, .slatsim-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.scadnano-bar .spacer, .slatsim-bar .spacer { margin-right: auto; }
.scadnano-bar form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
#scadnano-status:empty, #slatsim-status:empty { display: none; }
.scadnano-frame, .slatsim-frame { display: block; width: 100%; height: calc(100vh - 11rem); min-height: 28rem;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.save-dialog { width: min(40rem, 95vw); }
.save-dialog .import-head p { margin: .6rem 0; }

/* Spreadsheet preview (file page) */
details.sheet { margin: .6rem 0; }
details.sheet > summary { cursor: pointer; font-weight: 600; }
.sheet-preview { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: .4rem; background: var(--panel); }
.sheet-preview table { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.sheet-preview td, .sheet-preview th { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .15rem .45rem; white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.sheet-preview thead th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-weight: 500; text-align: center; z-index: 1; }
.sheet-preview tbody th { position: sticky; left: 0; background: var(--bg); color: var(--muted); font-weight: 500; text-align: right; }
.sheet-preview thead th:first-child { left: 0; z-index: 2; }

/* Project bookmarks */
.bookmark-form textarea, .bookmark-form input[name=label] { max-width: 100%; }
.bookmark-actions { display: flex; gap: .75rem; align-items: center; margin: .75rem 0; }
.bookmark-tree { padding-left: 1.2rem; }
.bookmark-tree li { margin: .15rem 0; }
.bookmark-tree img { max-height: 120px; }
.bookmark-open { margin-left: .3rem; }
pre.setting-value { margin: 0; white-space: pre-wrap; font-size: .85rem; }
.bookmark-field { margin: 1rem 0; } .bookmark-field h3 { margin-bottom: .3rem; }

/* Files page: dragging files and folders onto folders */
[data-drag-kind] { cursor: grab; }
[data-drag-kind].dragging { opacity: .45; }
[data-drop-folder].drop-target { outline: 2px dashed var(--accent, #4a8cff); outline-offset: -2px; background: color-mix(in srgb, var(--accent, #4a8cff) 14%, transparent); }
[data-drop-folder].drop-busy { opacity: .6; }
[data-upload-zone].drop-zone-active { outline: 2px dashed var(--accent, #4a8cff); outline-offset: 4px; border-radius: 6px; }

/* Notebook API reference (notebooks/docs.py) */
.docs-list li { margin: .5rem 0; }
.docs-list .muted { display: block; }
.docs-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.docs-contents { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; font-size: .875rem; }
.docs-contents p { margin: 0 0 .25rem; }
.docs-contents ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.docs-contents li.level-2 { margin-top: .5rem; font-weight: 600; }
.docs-contents li.level-3 { padding-left: .9rem; }
.docs-body h2 { margin-top: 2rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.docs-body h3 { margin-top: 1.75rem; }
.docs-body [id] { scroll-margin-top: 1rem; }
@media (max-width: 800px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-contents { position: static; max-height: none; }
}

/* Users page: recording NUPACK licences. */
.nupack-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.nupack-form input[type="text"] { width: 16rem; max-width: 100%; }
.nupack-holders { list-style: none; padding-left: 0; }
.nupack-holders li { margin: .2rem 0; }
