/* ConformerLab app styles, from the "ConformerLab Screens" design.
 *
 * Tokens and components are the design's own, carried over verbatim so the
 * pages and the canvas cannot drift apart. Two things are added around them:
 * the theme is chosen on <html> (OS preference by default, the toggle wins
 * both ways), and the older token names that structure-view.js and viewer.js
 * read are mapped onto the design's, so those modules follow the theme too.
 */

:root {
  --ground:#F5F2EC;
  --panel:#FFFDFA;
  --raised:#EFEAE1;
  --rail:#F1EDE5;
  --tint:#FBF9F5;
  --rule:#DDD5C8;
  --rule2:#C3B8A6;
  --rulesoft:#E6DFD3;
  --track:#EAE3D7;
  --rulefaint:#EFE9DF;
  --toolrule:#E2DACD;
  --text:#1E2422;
  --text2:#2A3230;
  --text3:#3A4442;
  --text4:#4F5956;
  --muted:#5C6663;
  --placeholder:#6B7572;
  --dim:#8A928E;
  --accent:#1F6C9A;
  --accenthover:#185A82;
  --accentdeep:#154E70;
  --accenttext:#1A5E87;
  --accentink:#1A4A68;
  --accentsoft:#E3EEF5;
  --accentline:#C9DCEA;
  --opthover:#F6F9FB;
  --onaccent:#FFFFFF;
  --ok:#1F7A50;
  --oktext:#1B6B46;
  --oksoft:#E1F0E7;
  --warn:#96620C;
  --warntext:#7F530A;
  --warnink:#6B4708;
  --warnsoft:#F7EBD6;
  --block:#A93B2C;
  --blocksoft:#F8E4E0;
  --live:#4A56B8;
  --livesoft:#E7E9F7;
  --rep2:#D0822E;
  --occlow:#7FA8C6;
  --bubble:#1E2423;
  --onbubble:#F5F2ED;
  --bubblechip:#2F3836;
  --avatarbg:#1E2421;
  --vp:#0D171A;
  color-scheme: light;
}

/* Dark is its own set of steps, chosen for the dark ground -- not an
   inversion. Declared twice: once for the OS preference, once for the
   toggle, which must win in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:#0D171A;
    --panel:#132328;
    --raised:#1A2E34;
    --rail:#0F1C20;
    --tint:#16292E;
    --rule:#2B454C;
    --rule2:#3D5F69;
    --rulesoft:#22393F;
    --track:#1F353B;
    --rulefaint:#1C3036;
    --toolrule:#24393F;
    --text:#E2EDEB;
    --text2:#D3E0DE;
    --text3:#C3D3D1;
    --text4:#A9BDBB;
    --muted:#8CA5A3;
    --placeholder:#7F9896;
    --dim:#6E8886;
    --accent:#58ACDF;
    --accenthover:#7BBFE8;
    --accentdeep:#8CC8EE;
    --accenttext:#8CC8EE;
    --accentink:#A9D6F2;
    --accentsoft:#17323F;
    --accentline:#24506A;
    --opthover:#16303A;
    --onaccent:#0B1A20;
    --ok:#6BC496;
    --oktext:#7FD1A6;
    --oksoft:#14301F;
    --warn:#E0A44A;
    --warntext:#E8B866;
    --warnink:#F0C98A;
    --warnsoft:#33280F;
    --block:#E56B60;
    --blocksoft:#3A1A17;
    --live:#7E8DEA;
    --livesoft:#1B2040;
    --rep2:#E0A44A;
    --occlow:#3E6F90;
    --bubble:#2A4148;
    --onbubble:#E2EDEB;
    --bubblechip:#36525C;
    --avatarbg:#243A40;
    --vp:#060D10;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground:#0D171A;
  --panel:#132328;
  --raised:#1A2E34;
  --rail:#0F1C20;
  --tint:#16292E;
  --rule:#2B454C;
  --rule2:#3D5F69;
  --rulesoft:#22393F;
  --track:#1F353B;
  --rulefaint:#1C3036;
  --toolrule:#24393F;
  --text:#E2EDEB;
  --text2:#D3E0DE;
  --text3:#C3D3D1;
  --text4:#A9BDBB;
  --muted:#8CA5A3;
  --placeholder:#7F9896;
  --dim:#6E8886;
  --accent:#58ACDF;
  --accenthover:#7BBFE8;
  --accentdeep:#8CC8EE;
  --accenttext:#8CC8EE;
  --accentink:#A9D6F2;
  --accentsoft:#17323F;
  --accentline:#24506A;
  --opthover:#16303A;
  --onaccent:#0B1A20;
  --ok:#6BC496;
  --oktext:#7FD1A6;
  --oksoft:#14301F;
  --warn:#E0A44A;
  --warntext:#E8B866;
  --warnink:#F0C98A;
  --warnsoft:#33280F;
  --block:#E56B60;
  --blocksoft:#3A1A17;
  --live:#7E8DEA;
  --livesoft:#1B2040;
  --rep2:#E0A44A;
  --occlow:#3E6F90;
  --bubble:#2A4148;
  --onbubble:#E2EDEB;
  --bubblechip:#36525C;
  --avatarbg:#243A40;
  --vp:#060D10;
  color-scheme: dark;
}

/* Older token names, read by structure-view.js and viewer.js. */
:root {
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --panel-solid: var(--panel);
  --rule-strong: var(--rule2);
  --accent-soft: var(--accentsoft);
  --ok-soft: var(--oksoft);
  --warn-soft: var(--warnsoft);
  --block-soft: var(--blocksoft);
  --live-soft: var(--livesoft);
  --protein: #4E8FD0; --rna: #6FAE7A; --dna: #B584C9; --peptide: #7FBBD6;
  --other: #9AA5AB; --ligandc: #D89440; --metalc: #C96A5B;

  /* Replica identity in charts. Validated with the dataviz validator against
     --panel in each theme: all eight pass on adjacent pairs, and the first
     three on all pairs. The design's third colour (indigo) sat 9
     normal-vision units from the blue and is replaced by aqua. Light-mode
     slots 2-5 fall under 3:1 on the panel, so every chart also labels its
     lines and offers a table view. */
  --s1: #1F6C9A; --s2: #D0822E; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948; --s-other: #8A928E;
  /* Element labels in the 2D map: the chemist's convention, readable on
     each ground. The letter itself names the element. */
  --elO: #B8382B; --elN: #1F5FA8; --elS: #8A6400; --elX: #2E7D32;
  /* Kinds of residue in the 2D map: the ring in a series colour, a soft
     fill of it behind the residue's written name. Validated as a set (all
     pairs, each theme): red and green sit in the colour-blind floor band,
     legal because every circle names its residue and the charged carry
     their sign; the polar amber is under 3:1 in light, likewise labelled.
     Glycine is neutral, outside the set; a ligand, ion or anything else
     not an amino acid is a dashed ring of it on the panel. */
  --rc-hyd: #DDEFD9; --rc-hyd-line: #008300; --rc-pol: #F8EDCF; --rc-pol-line: #C29200;
  --rc-pos: #E6E2F6; --rc-pos-line: #4A3AA7; --rc-neg: #FBE0DF; --rc-neg-line: #E34948;
  --rc-oth: #F1EEE8; --rc-oth-line: #9A958C;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #6E8886;
    --elO: #FF8E80; --elN: #86B8F2; --elS: #E3C35E; --elX: #8FD493;
    --rc-hyd: #173A1C; --rc-hyd-line: #008300; --rc-pol: #3A3410; --rc-pol-line: #A89000;
    --rc-pos: #2A2752; --rc-pos-line: #9085E9; --rc-neg: #4A2022; --rc-neg-line: #E66767;
    --rc-oth: #22302F; --rc-oth-line: #6E8886;
  }
}
:root[data-theme="dark"] {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #6E8886;
  --elO: #FF8E80; --elN: #86B8F2; --elS: #E3C35E; --elX: #8FD493;
  --rc-hyd: #173A1C; --rc-hyd-line: #008300; --rc-pol: #3A3410; --rc-pol-line: #A89000;
  --rc-pos: #2A2752; --rc-pos-line: #9085E9; --rc-neg: #4A2022; --rc-neg-line: #E66767;
  --rc-oth: #22302F; --rc-oth-line: #6E8886;
}

html, body { margin: 0; background: var(--ground); }

/* ── the design's components ─────────────────────────────────────────── */
:root[data-theme="dark"] .card{box-shadow:0 1px 2px rgba(0,0,0,.35),0 10px 30px rgba(0,0,0,.25)}
:root[data-theme="dark"] .vp{box-shadow:inset 0 0 0 1px #1C3036}
a{color:var(--accent);text-decoration:none}
a:hover{color:var(--accentdeep)}
.cl{font-family:"Source Sans 3",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased;background:var(--ground)}
.cl *{box-sizing:border-box}
.serif{font-family:"Newsreader",Georgia,serif}
.mono{font-family:"IBM Plex Mono",ui-monospace,Menlo,monospace;font-variant-numeric:tabular-nums}
.shell{display:grid;grid-template-columns:260px minmax(0,1fr);min-height:100vh}
.side{background:var(--raised);border-right:1px solid var(--rule);padding:22px 16px;display:flex;flex-direction:column;gap:22px}
.main{min-width:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:16px 32px;border-bottom:1px solid var(--rule);background:var(--ground);flex-wrap:wrap}
.card{background:var(--panel);border:1px solid var(--rule);border-radius:16px;box-shadow:0 1px 2px rgba(30,36,34,.04),0 10px 30px rgba(30,36,34,.05)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:11px;border:1px solid var(--rule2);background:var(--panel);color:var(--text);font-family:inherit;font-size:15px;font-weight:600;cursor:pointer;white-space:nowrap}
.btn:hover{background:var(--raised);color:var(--text)}
.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--onaccent)}
.btn-primary:hover{background:var(--accenthover);border-color:var(--accenthover);color:var(--onaccent)}
.btn-lg{min-height:52px;padding:0 24px;font-size:16px;border-radius:13px}
.btn-quiet{background:transparent;border-color:transparent;color:var(--accent)}
.btn-quiet:hover{background:var(--accentsoft);color:var(--accentdeep)}
.chip{display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:6px 14px;border-radius:999px;border:1px solid var(--rule);background:var(--panel);color:var(--text);font-family:inherit;font-size:14px;cursor:pointer;text-align:left}
.chip:hover{border-color:var(--accent);color:var(--accent)}
.tag{display:inline-flex;align-items:center;gap:5px;padding:1px 9px;border-radius:999px;font-size:12.5px;font-weight:600;line-height:21px;white-space:nowrap}
.t-ok{background:var(--oksoft);color:var(--oktext)}
.t-warn{background:var(--warnsoft);color:var(--warntext)}
.t-block{background:var(--blocksoft);color:var(--block)}
.t-live{background:var(--livesoft);color:var(--live)}
.t-accent{background:var(--accentsoft);color:var(--accenttext)}
.t-plain{background:var(--raised);color:var(--text4)}
.label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.muted{color:var(--muted)}
.h1{font-family:"Newsreader",Georgia,serif;font-weight:500;font-size:38px;line-height:1.12;letter-spacing:-.015em;margin:0}
.h2{font-family:"Newsreader",Georgia,serif;font-weight:500;font-size:25px;line-height:1.2;letter-spacing:-.01em;margin:0}
.h3{font-size:16.5px;font-weight:700;margin:0;line-height:1.3}
.vp{background:var(--vp);border-radius:12px;position:relative;overflow:hidden}
.vp-cap{position:absolute;left:12px;bottom:10px;font-size:12px;color:#A9BDBB}
.vp-tools{position:absolute;right:10px;top:10px;display:flex;gap:6px}
.vp-btn{width:32px;height:32px;border-radius:8px;border:1px solid #2B454C;background:#132328;color:#C9D8D6;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.row{display:flex;align-items:center;gap:10px}
.kbd{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;border:1px solid var(--rule2);background:var(--ground);font-family:"IBM Plex Mono",monospace;font-size:13px;font-weight:500;color:var(--text);flex:none}
.opts{display:flex;flex-direction:column;gap:8px}
.opt{display:flex;align-items:flex-start;gap:12px;width:100%;text-align:left;padding:12px 14px;border-radius:12px;border:1px solid var(--rule);background:var(--panel);font-family:inherit;font-size:15px;color:var(--text);cursor:pointer;line-height:1.4}
.opt:hover{border-color:var(--accent);background:var(--opthover)}
.opt-sub{display:block;font-size:13.5px;color:var(--muted);margin-top:2px}
.opt-on{border-color:var(--accent);background:var(--accentsoft);box-shadow:inset 0 0 0 1px var(--accent)}
.opt-on .kbd{background:var(--accent);border-color:var(--accent);color:var(--onaccent)}
.opt-dim{opacity:.55}
.hint{font-size:13px;color:var(--muted)}
.thread{display:flex;flex-direction:column;gap:26px}
.turn-user{align-self:flex-end;max-width:600px;background:var(--bubble);color:var(--onbubble);padding:12px 16px;border-radius:18px 18px 5px 18px;font-size:15.5px}
.turn-ai{display:grid;grid-template-columns:36px minmax(0,1fr);gap:14px}
.turn-body{display:flex;flex-direction:column;gap:12px;min-width:0;font-size:15.5px}
.turn-body p{margin:0}
.avatar{width:36px;height:36px;border-radius:11px;background:var(--avatarbg);display:flex;align-items:center;justify-content:center;flex:none}
.tool{display:flex;flex-direction:column;gap:10px;padding:12px 14px;border-radius:12px;background:var(--raised);border:1px solid var(--toolrule)}
.tool-head{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:600}
.stepper{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.step{display:inline-flex;align-items:center;gap:8px;padding:5px 12px 5px 5px;border-radius:999px;font-size:13.5px;font-weight:600;color:var(--muted)}
.step-dot{width:22px;height:22px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;font-size:12px;background:var(--raised);color:var(--muted);border:1px solid var(--rule)}
.step-done{color:var(--text)}
.step-done .step-dot{background:var(--ok);border-color:var(--ok);color:var(--onaccent)}
.step-now{background:var(--accentsoft);color:var(--accenttext)}
.step-now .step-dot{background:var(--accent);border-color:var(--accent);color:var(--onaccent)}
.step-sep{width:14px;height:1px;background:var(--rule2)}
.navitem{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:10px;color:var(--text);font-size:14.5px;line-height:1.3}
.navitem:hover{background:var(--rulesoft);color:var(--text)}
.nav-on{background:var(--panel);box-shadow:0 1px 2px rgba(30,36,34,.08)}
.dot{width:9px;height:9px;border-radius:999px;flex:none}
.bar{height:8px;border-radius:999px;background:var(--track);overflow:hidden}
.bar-fill{height:100%;border-radius:999px}
.divider{height:1px;background:var(--rulesoft)}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.grid4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.stat{padding:16px 18px;display:flex;flex-direction:column;gap:4px}
.stat-v{font-family:"Newsreader",Georgia,serif;font-size:32px;line-height:1.05;letter-spacing:-.01em}
.composer{display:flex;align-items:flex-end;gap:8px;padding:10px 10px 10px 14px;border:1px solid var(--rule2);border-radius:18px;background:var(--panel);box-shadow:0 10px 30px rgba(30,36,34,.08)}
.composer textarea{flex:1;border:0;outline:0;resize:none;background:transparent;font-family:inherit;font-size:15.5px;color:var(--text);min-height:44px;padding:11px 0;line-height:1.45}
.composer textarea::placeholder{color:var(--placeholder)}
.icon-btn{width:44px;height:44px;border-radius:11px;border:1px solid transparent;background:transparent;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);cursor:pointer;flex:none}
.icon-btn:hover{background:var(--raised);color:var(--text)}
.send{background:var(--accent);color:var(--onaccent)}
.send:hover{background:var(--accenthover);color:var(--onaccent)}
.kv{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 16px;font-size:14.5px;align-items:center}
.prov{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--muted);white-space:nowrap}
.pdot{width:7px;height:7px;border-radius:999px;display:inline-block}
.field{display:flex;flex-direction:column;gap:5px;min-width:0}
.field-l{font-size:12.5px;color:var(--muted);font-weight:600}
.select{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px;padding:0 12px;border:1px solid var(--rule);border-radius:10px;background:var(--panel);font-size:14.5px;color:var(--text);font-family:inherit;cursor:pointer;width:100%;text-align:left}
.select:hover{border-color:var(--accent)}
.why{display:flex;gap:8px;font-size:14px;color:var(--text4);background:var(--ground);border-radius:10px;padding:9px 12px;line-height:1.45}
table.t{width:100%;border-collapse:collapse;font-size:14.5px}
table.t th{text-align:left;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:10px 14px;border-bottom:1px solid var(--rule)}
table.t td{padding:12px 14px;border-bottom:1px solid var(--rulefaint);vertical-align:middle}
table.t tr:last-child td{border-bottom:0}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:13px;color:var(--text4)}
.sw{width:14px;height:3px;border-radius:2px;display:inline-block;margin-right:6px;vertical-align:middle}
.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--rule);border-radius:999px;background:var(--raised)}
.seg-b{display:inline-flex;align-items:center;gap:6px;min-height:38px;padding:0 13px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-family:inherit;font-size:13.5px;font-weight:600;cursor:pointer}
.seg-b:hover{color:var(--text)}
.seg-on{background:var(--panel);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,.14)}
.occ{display:grid;grid-template-columns:150px minmax(0,1fr) 48px;gap:12px;align-items:center;font-size:14.5px}
.pill-num{font-family:"IBM Plex Mono",monospace;font-size:13px}
@media (max-width: 1100px){
 .rail{display:none !important}
 .cols{grid-template-columns:minmax(0,1fr) !important}
}
@media (max-width: 900px){
 .shell{grid-template-columns:minmax(0,1fr)}
 .side{display:none}
 .grid3,.grid4{grid-template-columns:repeat(2,minmax(0,1fr))}
 .topbar{padding:12px 16px}
 .pad{padding-left:16px !important;padding-right:16px !important}
 .hide-sm{display:none !important}
 .h1{font-size:30px}
}
@media (max-width: 560px){
 .grid2,.grid3,.grid4{grid-template-columns:minmax(0,1fr)}
 .occ{grid-template-columns:110px minmax(0,1fr) 44px}
 .h1{font-size:27px}
}

/* ── added for the working app ───────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card { box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.25); }
  :root:not([data-theme="light"]) .vp { box-shadow: inset 0 0 0 1px #1C3036; }
}
[hidden] { display: none !important; }
button { font-family: inherit; }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .opt:focus-visible, .select:focus-visible,
.navitem:focus-visible, .seg-b:focus-visible, .icon-btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { text-align: right; }
.danger { color: var(--block); }
.btn-danger { color: var(--block); border-color: var(--rule2); }
.btn-danger:hover { background: var(--blocksoft); color: var(--block); }

/* Mobile: the sidebar becomes a drawer behind a menu button. */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .side.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
               z-index: 60; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
}

/* The sidebar's study list scrolls on its own once it is long. */
.studies { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
/* Desktop: the sidebar stays in the window while the page scrolls, so your
   credits and your account are always at its foot -- not at the bottom of
   the longest page. The study list gives up the room when the window is
   short; the sidebar itself scrolls only when even that is not enough. */
@media (min-width: 901px) {
  .side { position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; overflow-y: auto; }
  .side > nav { min-height: 0; }
  .side .studies { flex: 0 1 auto; min-height: 0; max-height: none; }
}
.navitem .meta { display: flex; flex-direction: column; min-width: 0; }
.navitem .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Attachments under the composer: acknowledged the instant a file lands. */
.attached { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 12px;
       border-radius: 999px; border: 1px solid var(--rule); background: var(--tint);
       font-size: 13.5px; max-width: 100%; }
.att b { font-weight: 600; }
.att .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att.ok { border-color: var(--ok); background: var(--oksoft); }
.att.bad { border-color: var(--block); background: var(--blocksoft); color: var(--block); }
.att button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 16px; line-height: 1; }

.pdbform { display: flex; gap: 8px; margin-top: 4px; }
.pdbform input, .field input, .field select, .inline-edit input, .inline-edit select, textarea.plain, input.plain {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 14.5px; min-width: 0;
}
textarea.plain { padding: 10px 12px; min-height: 80px; width: 100%; resize: vertical; }
.pdbform input { flex: 1; font-family: "IBM Plex Mono", monospace; text-transform: uppercase; }
/* What the composer is waiting for -- a name, a sequence -- once a way of
   finding the structure is picked, with the way out beside it. */
.mode-pill { display: inline-flex; align-items: center; gap: 2px; align-self: center; flex: none; min-height: 30px;
  padding: 0 3px 0 11px; border-radius: 999px; background: var(--accentsoft); color: var(--accenttext);
  font-size: 13px; font-weight: 600; white-space: nowrap; }
.mode-pill button { border: 0; background: transparent; color: inherit; width: 24px; height: 24px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mode-pill button:hover { background: var(--accentline); }
.pdbform input:focus, .field input:focus, .field select:focus, .inline-edit input:focus,
.inline-edit select:focus, textarea.plain:focus, input.plain:focus { outline: none; border-color: var(--accent); }

.card[aria-disabled="true"] { opacity: .62; cursor: default; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
          border: 1px solid var(--rule); background: var(--panel); font-size: 14.5px; }
.notice.warn { border-color: var(--warn); background: var(--warnsoft); color: var(--warnink); }
.notice.block { border-color: var(--block); background: var(--blocksoft); color: var(--block); }
.notice.ok { border-color: var(--ok); background: var(--oksoft); color: var(--oktext); }

/* The conversation column and its docked composer. */
.study-cols { display: grid; grid-template-columns: minmax(0,1fr) 380px; align-items: start; flex-grow: 1; }
.convo { padding: 36px 48px 28px; display: flex; flex-direction: column; gap: 22px; min-width: 0;
         max-width: 920px; width: 100%; }
/* Sticky, so the composer is always to hand -- on a solid ground, so the
   conversation never shows through behind it. */
.dock { position: sticky; bottom: 0; padding: 12px 0 18px; background: var(--ground);
        border-top: 1px solid var(--rulesoft); display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.chiprow { gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chiprow .chip { flex: none; }
.methods p { margin: 0 0 12px; }
.methods code { font-family: "IBM Plex Mono", monospace; font-size: .85em; background: var(--raised); padding: 1px 5px; border-radius: 5px; }
.rail { border-left: 1px solid var(--rule); background: var(--rail); padding: 28px 24px;
        display: flex; flex-direction: column; gap: 16px; align-self: stretch; }
@media (max-width: 1100px) { .study-cols { grid-template-columns: minmax(0,1fr); } .rail { border-left: 0; } }
@media (max-width: 900px) { .convo { padding: 24px 16px 20px; } }

.turn-body .aside { font-size: 14px; color: var(--muted); margin: 0; }
.cannot { border: 1px solid var(--warn); background: var(--warnsoft); color: var(--warnink);
          border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.finding { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.finding + .finding { border-top: 1px solid var(--rulesoft); padding-top: 10px; }
.ask { border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 12px;
       background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ask.spent { opacity: .5; pointer-events: none; border-left-color: var(--rule); }
.ask .q { margin: 0; font-weight: 600; }
.ask-grid { display: flex; flex-direction: column; gap: 8px; }
.ask-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.ask-row .q { font-weight: 500; font-size: 14.5px; overflow-wrap: anywhere; }
.ask-row small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.ask-row input { width: 96px; text-align: right; }
.ask-row input.smi { flex: 1; width: auto; text-align: left; font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.ask-row.need .q { color: var(--warntext); }
.ask-row.need input, .ask-row.need .seg { border-color: var(--warn); }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--rule);
        border-top-color: var(--accent); border-radius: 50%; animation: clspin .7s linear infinite; vertical-align: -2px; }
@keyframes clspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* Structure viewer: 3Dmol needs a positioned box with a real height. */
.viewer3d { position: relative; height: 230px; background: var(--raised); cursor: pointer; }
.viewer3d canvas { border-radius: 0; }
.viewer3d .empty { color: var(--muted); font-size: 13px; }
.bigview { position: fixed; inset: 0; z-index: 80; background: var(--ground); display: flex;
           align-items: center; justify-content: center; }
.bigview .stage3d { width: min(1100px, 94vw); height: 84vh; position: relative; }
.bigview .close { position: absolute; top: 16px; right: 16px; z-index: 2; }
.veil { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center;
        background: color-mix(in srgb, var(--ground) 92%, transparent); border: 3px dashed var(--accent);
        font-size: 19px; padding: 24px; text-align: center; }
.veil.on { display: flex; }
.provrow { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; font-size: 13.5px; padding: 3px 0; }
.pv { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.pv.read { background: var(--ok); }
.pv.user { background: var(--live); }
.pv.assumed { background: var(--warn); }
.pv.unknown { background: transparent; box-shadow: inset 0 0 0 2px var(--block); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { min-height: 28px; padding: 2px 10px; font-size: 12.5px; cursor: default; }
.chips .dot { width: 8px; height: 8px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13.5px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸ "; }
details.more[open] summary::before { content: "▾ "; }

/* Plan page parameter editing. */
.select.editing { padding: 0; border-color: var(--accent); }
.inline-edit { display: flex; gap: 6px; width: 100%; }
.inline-edit input, .inline-edit select { flex: 1; min-height: 38px; }
.fingerprint { font-family: "IBM Plex Mono", monospace; font-size: 13.5px; letter-spacing: .02em; }

/* Charts. Hairline solid grid, 2px lines, text in text tokens. */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--rulesoft); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: "Source Sans 3", sans-serif; }
.chart .axis .title { fill: var(--muted); font-size: 11px; }
.chart .series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .endlabel { fill: var(--text4); font-size: 11.5px; font-family: "Source Sans 3", sans-serif; }
.chart .enddot { stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--rule2); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:focus { outline: none; }
.chart:focus-within .cross { stroke: var(--accent); }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--rule);
       border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12.5px;
       min-width: 120px; color: var(--text); }
.tip .x { color: var(--muted); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r b { font-family: "IBM Plex Mono", monospace; font-weight: 500; }
.tip .key, .legend .key { width: 14px; height: 2px; border-radius: 2px; display: inline-block; flex: none; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.linkish { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.linkish:hover { text-decoration: underline; }
.tableview { max-height: 260px; overflow: auto; border: 1px solid var(--rulesoft); border-radius: 10px; }
.tableview table.t td, .tableview table.t th { padding: 6px 10px; font-size: 12.5px; }
.tableview td.num { font-family: "IBM Plex Mono", monospace; text-align: right; }

.stat-v { font-variant-numeric: normal; }
.bar.thin { height: 6px; }
.timeline { display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; }
.timeline .row { align-items: flex-start; }
.timeline .todo { color: var(--placeholder); }
.methods { margin: 0; font-size: 17px; line-height: 1.6; color: var(--text2); white-space: pre-wrap; }
.filelist a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rulefaint); color: var(--text); }
.filelist a:last-child { border-bottom: 0; }
.filelist .group { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 10px; }

/* Admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.tab { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted);
       border-bottom: 2px solid transparent; cursor: pointer; min-height: 44px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover { background: var(--opthover); }
table.t tbody tr.row-on, table.t tbody tr.row-on:hover { background: var(--accent-soft); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--ground);
          border-left: 1px solid var(--rule); z-index: 70; overflow-y: auto; padding: 24px;
          box-shadow: -10px 0 40px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 16px; }
.kvs { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 6px 16px; font-size: 14px; }
.kvs dt { color: var(--muted); }
.kvs dd { margin: 0; overflow-wrap: anywhere; }
pre.code { background: var(--raised); border-radius: 10px; padding: 10px 12px; font-size: 12px; overflow: auto; max-height: 240px; margin: 0; }

/* Pills that open what they count. */
button.tag { border: 0; cursor: pointer; font-family: inherit; }
button.tag:hover { text-decoration: underline; text-underline-offset: 2px; }

/* The trajectory player and residue contacts on the results page. */
.movie { overflow: hidden; display: flex; flex-direction: column; }
.movie-view { height: 340px; border-radius: 0; }
.movie-wait { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: #CFD8D6; font-size: 14px; padding: 16px; text-align: center; }
.movie-wait[hidden] { display: none; }
.movie-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 2px; }
.movie-bar input[type=range] { flex: 1 1 auto; min-width: 80px; accent-color: var(--accent); }
.movie-bar select { font: inherit; font-size: 13.5px; border: 1px solid var(--rule); border-radius: 8px; padding: 4px 6px;
  background: var(--panel); color: var(--text); }
.movie-tools { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 6px 8px; }
.movie-tools .btn { min-height: 36px; font-size: 14px; padding: 0 10px; }
.reslink { border: 0; background: none; padding: 0; font: inherit; color: var(--accenttext); cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.reslink:hover { text-decoration-style: solid; }
.contacts { display: flex; flex-direction: column; gap: 2px; }
.reslink.contact-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 44px; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); padding: 4px 0; text-align: left; font-size: 14px; }
.contact-row .bar { height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; }
.contact-row .bar span { display: block; height: 100%; background: var(--accent); }
.contact-row:hover span:first-child { text-decoration: underline; }

/* Finding a structure by name or sequence. */
.lookup { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: none; }
.lk-list { display: flex; flex-direction: column; }
.lk-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--rulefaint); flex-wrap: wrap; }
.lk-list .lk-row:first-child { border-top: 0; }
.lk-id { min-width: 64px; font-size: 13.5px; color: var(--accenttext); }
.lk-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lk-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.lk-actions .btn, .lk-row > .btn { min-height: 36px; font-size: 14px; padding: 0 12px; }

/* Interactions in 2D. */
.ixcard { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ixhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ixtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ixtools .btn { min-height: 36px; font-size: 14px; padding: 0 12px; }
.ixtools .seg-b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ixmin { font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ixmin select, .movie-bar #movieSpeed { font: inherit; font-size: 13.5px; border: 1px solid var(--rule); border-radius: 8px;
  padding: 4px 6px; background: var(--panel); color: var(--text); }
.ixview { overflow: auto; max-height: 760px; border: 1px solid var(--rulefaint); border-radius: 12px; background: var(--panel); padding: 6px; }
.ixsvg { display: block; width: 100%; height: auto; max-height: 620px; margin: 0 auto; }
.ixnode { cursor: pointer; outline: none; }
.ixnode:hover rect, .ixnode:hover circle, .ixnode:focus-visible rect, .ixnode:focus-visible circle { stroke-width: 3px; }
.ixedge { outline: none; }
.ixedge[data-pair] { cursor: pointer; }
.ixedge:hover line:not(.ixhit), .ixedge:focus-visible line:not(.ixhit) { stroke-width: 4px; }
.ixkey { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text3); }
.ixkey-i { display: inline-flex; align-items: center; gap: 6px; }
.ixkey-break { flex-basis: 100%; height: 0; }
.ixpairbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 4px 8px; }
.ixpairs { list-style: none; margin: 4px 0 0; padding: 8px 6px 2px; border-top: 1px solid var(--rulefaint);
  display: grid; gap: 6px; font-size: 13.5px; color: var(--text2); }
.ixpairs li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ixpct { color: var(--muted); font-variant-numeric: tabular-nums; }
.ixhow { font-size: 13px; color: var(--muted); }
.ixhow summary { cursor: pointer; }
.ixhow ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.contact-wrap { display: flex; flex-direction: column; }
.ixtags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 6px 106px; }
.ixtag { font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 999px; border: 1.5px solid var(--k); color: var(--text2); white-space: nowrap; }
@media (max-width: 720px) { .ixtags { padding-left: 0; } }
.ixempty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* Notifications. */
.bell-wrap { position: relative; display: inline-flex; }
.bell-n { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--block); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); z-index: 40;
  display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.bell-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; }
.bell-item { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 14px; border: 0;
  border-top: 1px solid var(--rulefaint); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.bell-item:hover { background: var(--opthover); }
.bell-item.unread { background: var(--accentsoft); }
.bell-t { font-weight: 700; font-size: 14px; }
.bell-b { font-size: 13.5px; color: var(--text3); }
.bell-w { font-size: 12px; color: var(--muted); }
.bell-foot { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 12px; border-top: 1px solid var(--rule); }

/* Short messages, at the foot of the window. */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex;
  flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--bubble); color: var(--onbubble); padding: 11px 16px; border-radius: 12px; font-size: 14.5px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: opacity .5s, transform .5s; pointer-events: auto;
  border-left: 4px solid var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-block { border-left-color: var(--block); }
.toast-out { opacity: 0; transform: translateY(8px); }

/* What a reply cost. */
.usage-note { font-size: 12.5px; color: var(--muted); }
.ans-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ans-tools .btn { min-height: 32px; font-size: 13.5px; padding: 0 10px; }

/* The report card. */
.rep { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.rep-sec { border-top: 1px solid var(--rulefaint); padding-top: 8px; }
.rep-sec > summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
.rep-grid { display: grid; grid-template-columns: 1fr; gap: 2px; margin-top: 6px; }
.rep-opt { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 3px 0; cursor: pointer; }
.rep-opt input, .rep-shot input, .rep-ans input { margin-top: 3px; accent-color: var(--accent); }
.rep-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rep-h { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.rep-none { font-size: 13px; }
.rep-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-chip { min-height: 30px; padding: 2px 4px 2px 10px; font-size: 13px; gap: 4px; cursor: default; }
.rep-chip button { border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 6px; }
.rep-shots { display: flex; flex-direction: column; gap: 6px; }
.rep-shot, .rep-ans { display: grid; grid-template-columns: auto 64px minmax(0,1fr) auto; gap: 8px; align-items: center; font-size: 13px; }
.rep-ans { grid-template-columns: auto minmax(0,1fr) auto; align-items: flex-start; }
.rep-shot img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--vp); }
.rep-shot .btn, .rep-ans .btn { min-height: 30px; font-size: 12.5px; padding: 0 8px; }
.rep-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--rulefaint); padding-top: 8px; }
.rep-price { font-size: 13.5px; color: var(--text3); }

/* The one card that runs it. */
.confirm { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: none; border-color: var(--accentline); }
.cf-rows { display: flex; flex-direction: column; }
.cf-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--rulefaint); font-size: 15px; }
.cf-row:first-child { border-top: 0; }
.cf-k { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.cf-v { min-width: 0; overflow-wrap: anywhere; }
.cf-confirm { display: flex; flex-direction: column; gap: 8px; background: var(--tint); border-radius: 10px; padding: 10px 12px; }
.cf-item { display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.cf-more summary, .readmore summary { cursor: pointer; font-size: 14px; color: var(--accenttext); }
.cf-more ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.cf-fit { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 520px) { .cf-row { grid-template-columns: 1fr; gap: 2px; } }
