/* wasmdrop — one small design system: tokens, type, surfaces, controls, then the pages. */
:root { color-scheme: light dark;
  --bg: #f5f6f8; --fg: #15181d; --muted: #66707d; --faint: #98a1ab; --card: #ffffff; --border: #e4e7eb; --line: #eef0f3; --accent: #2f6df6; --accent-fg: #fff;
  --test: #0891b2; --prod: #d97706; --ok: #16a34a; --bad: #dc2626; --warn: #d97706; --sleep: #7c3aed;
  --radius: 12px; --radius-s: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06); --shadow-l: 0 12px 32px rgba(16, 24, 40, 0.14);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@media (prefers-color-scheme: dark) { :root { --bg: #0f1115; --fg: #e7e9ee; --muted: #9aa3ae; --faint: #6b7480; --card: #171a20; --border: #262b34; --line: #1f242c; --accent: #6b9cff; --accent-fg: #0b1220; --shadow: 0 1px 2px rgba(0,0,0,0.4); --shadow-l: 0 16px 40px rgba(0,0,0,0.55); } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; font-feature-settings: "tnum", "cv11"; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--line); padding: 0.1em 0.4em; border-radius: 5px; }
h1 { margin: 0; font-size: 1.55rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
h2 { margin: 0; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
h3 { margin: 0; font-size: 1rem; font-weight: 600; }
p { margin: 0.4rem 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 0.83rem; } .tiny { font-size: 0.74rem; } .error { color: var(--bad); } .ok { color: var(--ok); font-weight: 600; } .bad { color: var(--bad); font-weight: 600; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap { gap: 0.5rem; } .end { justify-content: flex-end; } .wrap { flex-wrap: wrap; }
[hidden] { display: none !important; }

/* ---- header */
.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 1.5rem; height: 54px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.brand { font-weight: 750; font-size: 1.15rem; color: var(--fg); letter-spacing: -0.03em; } .brand span { color: var(--accent); } .brand:hover { text-decoration: none; }
.top nav { display: flex; gap: 0.15rem; align-items: center; font-size: 0.9rem; }
.top nav a, .top nav button.link { color: var(--muted); padding: 0.35rem 0.6rem; border-radius: var(--radius-s); font: inherit; } .top nav a:hover { color: var(--fg); background: var(--line); text-decoration: none; }
.top nav a.active { color: var(--fg); font-weight: 600; } .top nav .who { color: var(--faint); font-size: 0.82rem; padding: 0 0.4rem 0 0.8rem; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top nav .adminlink { color: var(--accent); font-weight: 600; }
.page { max-width: 1240px; margin: 1.6rem auto 3rem; padding: 0 1.5rem; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pagehead .sub { color: var(--muted); margin: 0.2rem 0 0; font-size: 0.9rem; }
.crumb { font-size: 0.83rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.25rem; margin-bottom: 0.3rem; } .crumb:hover { color: var(--fg); text-decoration: none; }

/* ---- surfaces */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card h2 { margin-bottom: 0.6rem; }
.auth { max-width: 400px; margin: 5rem auto; padding: 1.6rem; } .auth h1 { margin-bottom: 0.8rem; } .auth form { display: flex; flex-direction: column; gap: 0.8rem; } .auth p { font-size: 0.9rem; }
details > summary { cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; }
details > summary h2::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--faint); } details[open] > summary h2::before { content: "▾"; }

/* ---- controls */
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input, textarea, select { padding: 0.55rem 0.75rem; font: inherit; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--card); color: var(--fg); min-width: 0; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: auto; }
button { padding: 0.5rem 0.95rem; font: inherit; font-weight: 500; border: 0; border-radius: var(--radius-s); background: var(--accent); color: var(--accent-fg); cursor: pointer; white-space: nowrap; line-height: 1.2; }
button:hover:not(:disabled) { filter: brightness(1.06); } button:disabled { opacity: 0.45; cursor: default; }
button.secondary, .btn.secondary { background: var(--line); color: var(--fg); } button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); } button.danger { background: var(--bad); color: #fff; } button.link { background: none; color: var(--accent); padding: 0; font-weight: 500; } button.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
form.inline { display: inline; } .inline-form { display: flex; gap: 0.5rem; margin: 0.8rem 0; flex-wrap: wrap; } .inline-form input { flex: 1; min-width: 12ch; }
.ib { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.38rem 0.6rem; border-radius: var(--radius-s); background: var(--line); color: var(--fg); font-size: 0.82rem; font-weight: 500; line-height: 1; border: 1px solid transparent; }
.ib span { padding-right: 0.1rem; } .ib.primary { background: var(--accent); color: var(--accent-fg); } button.ib.danger, .ib.danger { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); } .ib.quiet { background: transparent; color: var(--muted); }
.ib:hover:not(:disabled) { filter: none; background: color-mix(in srgb, var(--fg) 9%, var(--line)); } .ib.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); } .ib.danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
.ib svg, .meta svg, .hostlink svg, .slothead svg, .instinfo svg, .chip svg, .crumb svg, .tab svg, .mfoot svg, .mmeta svg, .empty svg, .instance svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex-shrink: 0; }
.toolbar { display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0; flex-wrap: wrap; } .toolbar a { display: inline-flex; }
.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; background: var(--ok); color: #fff; vertical-align: middle; margin-left: 0.35rem; text-transform: uppercase; }
.badge.warn { background: var(--warn); } .badge.err { background: var(--bad); } .badge.role { background: var(--line); color: var(--muted); text-transform: none; font-weight: 600; letter-spacing: 0; } .badge.role.developer { background: color-mix(in srgb, var(--test) 18%, transparent); color: var(--test); } .badge.role.owner { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); } .badge.role.admin { background: color-mix(in srgb, var(--prod) 18%, transparent); color: var(--prod); } .badge.role.tester { background: var(--line); }
.tag { font-weight: 700; letter-spacing: 0.1em; font-size: 0.68rem; text-transform: uppercase; } .tag.test { color: var(--test); } .tag.prod { color: var(--prod); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; display: inline-block; } .dot.running { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); } .dot.starting, .dot.waking, .dot.scheduled { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; } .dot.failed, .dot.crashed { background: var(--bad); } .dot.sleeping, .dot.frozen { background: var(--sleep); }
@keyframes pulse { 50% { opacity: 0.35; } }
.state { font-weight: 600; font-size: 0.86rem; } .state.running { color: var(--ok); } .state.failed, .state.crashed { color: var(--bad); } .state.starting, .state.waking, .state.scheduled { color: var(--warn); } .state.sleeping, .state.frozen { color: var(--sleep); } .state svg { width: 0.9em; height: 0.9em; vertical-align: -0.1em; fill: none; stroke: currentColor; stroke-width: 2; }
.progress { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 0.4rem; } .progress div { height: 100%; background: var(--accent); width: 0; transition: width 0.15s; }
.empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 2.2rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty b { color: var(--fg); display: block; font-size: 1rem; margin-bottom: 0.2rem; }
#toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 0.6rem 1rem; border-radius: 10px; z-index: 60; max-width: 80vw; font-size: 0.9rem; box-shadow: var(--shadow-l); }
dialog { border: 0; border-radius: 14px; padding: 0; background: transparent; max-width: 580px; width: min(92vw, 580px); } dialog::backdrop { background: rgba(10, 12, 16, 0.45); backdrop-filter: blur(2px); }
dialog .card { box-shadow: var(--shadow-l); padding: 1.3rem 1.4rem; } dialog form { display: flex; flex-direction: column; gap: 0.85rem; } dialog h2 { font-size: 1.05rem; text-transform: none; letter-spacing: -0.01em; color: var(--fg); margin-bottom: 0.2rem; }
dialog.wide { max-width: 940px; width: min(94vw, 940px); }
/* a label is a column (caption above its field); a tickbox is the exception, its caption sits beside it */
dialog form label.row { flex-direction: row; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--fg); } dialog form label.row input { flex: none; }
.tablewrap { overflow-x: auto; margin-top: 0.4rem; } .tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; } .tbl th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0.35rem 0.55rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.tbl td { padding: 0.5rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl tr:last-child td { border-bottom: 0; } .tbl tr:hover td { background: color-mix(in srgb, var(--line) 55%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; } .grid2 label { display: flex; flex-direction: column; font-size: 0.85rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.6rem 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; margin: 0; } legend { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0.3rem; font-weight: 700; }
fieldset.storage textarea { font-family: var(--mono); font-size: 0.82rem; }
input.ovr { width: 6.5rem; }
kbd { font: 0.75em var(--mono); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.3em; color: var(--muted); }

/* ---- list controls: search + count + pager (projects, images, rollback points) */
.listctl { display: flex; align-items: center; gap: 0.5rem; margin: 0.2rem 0 0.7rem; flex-wrap: wrap; }
.listctl .search { position: relative; flex: 1; min-width: 12ch; } .listctl .search svg { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: var(--faint); fill: none; stroke-width: 2; }
.listctl .search input { width: 100%; padding-left: 1.9rem; padding-top: 0.42rem; padding-bottom: 0.42rem; font-size: 0.88rem; }
.listctl .count { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.pager { display: inline-flex; align-items: center; gap: 0.15rem; } .pager button { background: transparent; color: var(--muted); padding: 0.25rem 0.45rem; font-size: 0.95rem; border: 1px solid var(--border); } .pager button:hover:not(:disabled) { color: var(--fg); background: var(--line); } .pager .pn { font-size: 0.8rem; color: var(--muted); padding: 0 0.4rem; min-width: 4.5ch; text-align: center; }
.listctl.compact { margin: 0 0 0.5rem; } .listctl.compact .search input { padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: 0.82rem; }

/* ---- projects list */
.projects { display: flex; flex-direction: column; gap: 0.6rem; }
.prow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.6rem 1.2rem; align-items: center; padding: 0.8rem 1.1rem; position: relative; }
.prow:hover { border-color: color-mix(in srgb, var(--fg) 18%, var(--border)); }
.prow .pinfo { min-width: 0; } .prow .pinfo .pname { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; } .prow .pinfo h3 a { color: var(--fg); } .prow .pinfo .slug { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); }
.prow .pinfo .pdesc { color: var(--muted); font-size: 0.86rem; margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slotchip { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.5rem 0.7rem; border-radius: var(--radius-s); background: var(--line); min-width: 0; border: 1px solid transparent; }
.slotchip .sc1 { display: flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; min-width: 0; } .slotchip .sc1 .state { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slotchip .sc2 { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.76rem; color: var(--muted); min-width: 0; } .slotchip .sc2 a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 0.72rem; min-width: 0; } .slotchip .sc2 span { white-space: nowrap; flex-shrink: 0; }
.slotchip .ib { padding: 0.2rem 0.4rem; font-size: 0.74rem; }
.prow.over-test .slotchip.test, .prow.over-prod .slotchip.prod { box-shadow: inset 0 0 0 2px var(--test); background: color-mix(in srgb, var(--test) 12%, transparent); } .prow.over-prod .slotchip.prod { box-shadow: inset 0 0 0 2px var(--prod); background: color-mix(in srgb, var(--prod) 12%, transparent); }
@media (max-width: 900px) { .prow { grid-template-columns: 1fr 1fr; } .prow .pinfo, .prow .pacts { grid-column: 1 / -1; } }

/* ---- project page */
.phead { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.phead .ptitle { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; } .phead .ptitle .slug { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); }
.tabs { display: flex; gap: 0.15rem; margin: 1.1rem 0 1rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: transparent; color: var(--muted); padding: 0.55rem 0.85rem; border-radius: var(--radius-s) var(--radius-s) 0 0; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 0.4rem; }
.tab:hover:not(:disabled) { color: var(--fg); background: var(--line); filter: none; } .tab[aria-selected="true"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.tab .n { font-size: 0.72rem; background: var(--line); color: var(--muted); padding: 0 0.4rem; border-radius: 999px; } .tab[aria-selected="true"] .n { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.tab .live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1.2s ease-in-out infinite; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.column { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; min-height: 420px; }
.column .colhead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); border-top: 3px solid var(--test); }
.column.prod .colhead { border-top-color: var(--prod); }
.colhead h2 { color: var(--test); } .column.prod .colhead h2 { color: var(--prod); }
.colhead a { font-size: 0.8rem; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column .colbody { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.9rem 1rem; flex: 1; }
.column.over { box-shadow: inset 0 0 0 3px var(--test); } .column.prod.over { box-shadow: inset 0 0 0 3px var(--prod); }
.instance { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.7rem 0.85rem; font-size: 0.88rem; background: color-mix(in srgb, var(--line) 50%, transparent); }
.instance.up { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok) 5%, transparent); }
.instrow { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.instinfo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; min-width: 0; flex: 1; } .instinfo .iname { font-weight: 600; overflow-wrap: anywhere; }
.memmeter { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; color: var(--muted); } .memmeter .mmbar { width: 64px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; } .memmeter .mmbar span { display: block; height: 100%; background: var(--ok); } .memmeter.warm .mmbar span { background: var(--warn); } .memmeter.hot .mmbar span { background: var(--bad); }
.images { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.image { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 0.86rem; }
.image:hover { border-color: var(--border); background: color-mix(in srgb, var(--line) 40%, transparent); }
.image.current { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.image .imgicon { color: var(--faint); display: flex; } .image .imgicon svg { width: 18px; height: 18px; } .image.current .imgicon { color: var(--ok); }
.image .body { flex: 1; min-width: 0; } .image .name { font-weight: 600; overflow-wrap: anywhere; }
.image .meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.65rem; color: var(--muted); font-size: 0.75rem; margin-top: 0.1rem; } .image .meta span { white-space: nowrap; }
.image .toolbar { opacity: 0.75; } .image:hover .toolbar { opacity: 1; } .image .toolbar .ib { padding: 0.3rem 0.45rem; }
@media (max-width: 1100px) { .image { flex-wrap: wrap; } .image .toolbar { width: 100%; justify-content: flex-end; } }
.dropnote { text-align: center; color: var(--faint); font-size: 0.78rem; padding: 0.5rem; border: 1px dashed var(--border); border-radius: var(--radius-s); }
.frozen { background: color-mix(in srgb, var(--sleep) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--sleep) 40%, var(--border)); border-radius: var(--radius-s); padding: 0.6rem 0.8rem; font-size: 0.9rem; } .frozen svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; vertical-align: -3px; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } }
.readonly .toolbar button, .readonly .dropnote, .readonly .composer, .readonly #chat-clear { display: none !important; }
#people h3, .panel h3.sub { margin: 0.9rem 0 0.2rem; font-size: 0.85rem; color: var(--muted); }

/* ---- page-wide drag veil */
#dropveil { position: fixed; inset: 0; z-index: 50; display: flex; pointer-events: none; }
#dropveil .half { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; text-align: center; opacity: 0.5; transition: opacity 0.1s; }
#dropveil .half div { display: flex; flex-direction: column; gap: 0.2rem; } #dropveil .half span { font-size: 0.95rem; font-weight: 500; opacity: 0.85; }
#dropveil .test { background: color-mix(in srgb, var(--test) 12%, transparent); box-shadow: inset 0 0 0 4px var(--test); color: var(--test); }
#dropveil .prod { background: color-mix(in srgb, var(--prod) 12%, transparent); box-shadow: inset 0 0 0 4px var(--prod); color: var(--prod); }
#dropveil .half.active { opacity: 1; background-color: color-mix(in srgb, currentColor 20%, transparent); }
#dropveil .veilcard { margin: auto; text-align: center; color: var(--accent); }
body.landing #dropveil { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 5px var(--accent); backdrop-filter: blur(2px); }
body.landing #dropveil b { font-size: 2rem; display: block; } body.landing #dropveil span { opacity: 0.8; }

/* ---- AI chat: a real chat panel */
.chatpanel { display: flex; flex-direction: column; height: calc(100vh - 108px); min-height: 560px; padding: 0; overflow: hidden; border-radius: 0; border-width: 1px 0 0; box-shadow: none; }
body.chat-workspace { overflow: hidden; }
body.chat-workspace .page { max-width: none; margin: 0; padding: 0; }
body.chat-workspace .page > .crumb, body.chat-workspace .page > .phead { display: none; }
body.chat-workspace .tabs { height: 54px; margin: 0; padding: 0 1rem; align-items: end; background: var(--card); }
.chathead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chathead .cs { display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; color: var(--muted); min-width: 0; } .chathead .cs .dot { flex-shrink: 0; }
.chathead select { padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.messages { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.9rem; scroll-behavior: smooth; overscroll-behavior: contain; }
.messages .empty { margin: auto; max-width: 520px; border: 0; }
.messages .empty .sugg { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.8rem; } .messages .empty .sugg button { background: var(--line); color: var(--fg); font-size: 0.82rem; padding: 0.35rem 0.7rem; }
.msg { display: flex; gap: 0.7rem; max-width: 100%; position: relative; }
.msg .avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; margin-top: 0.15rem; }
.msg.user { flex-direction: row-reverse; } .msg.user .avatar { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); } .msg.assistant .avatar { background: var(--line); color: var(--muted); } .msg.assistant .avatar svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.msg .bubble { max-width: min(78%, 880px); min-width: 0; border-radius: 14px; padding: 0.65rem 0.9rem; font-size: 0.92rem; line-height: 1.5; }
.msg.user .bubble { background: var(--accent); color: var(--accent-fg); white-space: pre-wrap; overflow-wrap: anywhere; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: var(--shadow); width: min(88%, 880px); }
@media (prefers-color-scheme: dark) { .msg.user .bubble { color: #fff; } }
.msg .mmeta { font-size: 0.72rem; color: var(--faint); margin: 0.25rem 0.2rem 0; display: flex; gap: 0.6rem; flex-wrap: wrap; } .msg.user .mmeta { justify-content: flex-end; }
.msg .text { overflow-wrap: anywhere; } .msg .text p { margin: 0 0 0.5rem; } .msg .text p:last-child { margin-bottom: 0; }
.msg .text pre { background: var(--line); padding: 0.6rem 0.8rem; border-radius: 8px; overflow-x: auto; font-size: 0.8rem; margin: 0.4rem 0; } .msg .text pre code { background: none; padding: 0; font-size: inherit; }
.msg .text ul, .msg .text ol { margin: 0.2rem 0 0.5rem; padding-left: 1.3rem; } .msg .text li { margin: 0.1rem 0; } .msg .text h4 { margin: 0.5rem 0 0.2rem; font-size: 0.95rem; }
.msg .attach { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; } .msg .attach .chip { background: color-mix(in srgb, #fff 18%, transparent); color: inherit; }
.mtools { display: flex; flex-direction: column; gap: 0.2rem; margin: 0 0 0.5rem; font-family: var(--mono); font-size: 0.76rem; color: var(--muted); border-left: 2px solid var(--line); padding-left: 0.6rem; }
.mtools div { display: flex; gap: 0.45rem; align-items: baseline; min-width: 0; } .mtools .ti { width: 0.9em; text-align: center; flex-shrink: 0; } .mtools .ti.ok { color: var(--ok); } .mtools .ti.bad { color: var(--bad); } .mtools .ti.run { color: var(--warn); }
.mtools .tn { font-weight: 700; color: var(--fg); flex-shrink: 0; } .mtools .ta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .mtools .bad { color: var(--bad); }
.mfoot { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--line); font-size: 0.76rem; color: var(--muted); align-items: center; }
.mfoot .badge { margin: 0; }
.macts { position: absolute; top: -0.4rem; right: 2.4rem; display: none; gap: 0.2rem; } .msg.user:hover .macts { display: flex; } .macts .ib { padding: 0.2rem 0.35rem; font-size: 0.72rem; box-shadow: var(--shadow); background: var(--card); border-color: var(--border); }
.msg.streaming .text::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; } @keyframes blink { to { opacity: 0; } }
.working { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); padding: 0 1.2rem 0.4rem; } .working .spinner { width: 14px; height: 14px; border-width: 2px; }
.jump { position: sticky; bottom: 0.4rem; align-self: center; background: var(--fg); color: var(--bg); font-size: 0.78rem; padding: 0.3rem 0.8rem; border-radius: 999px; box-shadow: var(--shadow-l); }
.composer { border-top: 1px solid var(--line); padding: 0.7rem 1rem 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; background: color-mix(in srgb, var(--line) 35%, var(--card)); position: relative; }
.composer .attachments { display: flex; flex-wrap: wrap; gap: 0.35rem; } .composer .attachments:empty { display: none; }
.capture-shelf { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 0.45rem; }
.capture-head { display: flex; gap: 0.5rem; align-items: baseline; padding: 0 0.2rem 0.35rem; font-size: 0.75rem; } .capture-head span { color: var(--faint); }
.capture-list { display: flex; gap: 0.45rem; overflow-x: auto; padding-bottom: 0.1rem; }
.capture { width: 132px; flex: 0 0 132px; position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--line); }
.capture img { display: block; width: 100%; height: 72px; object-fit: cover; background: #fff; cursor: zoom-in; }
.capture .capmeta { display: flex; align-items: center; gap: 0.2rem; padding: 0.25rem; }
.capture .capmeta button { flex: 1; padding: 0.25rem 0.35rem; font-size: 0.7rem; } .capture .capmeta button.on { background: var(--accent); color: var(--accent-fg); }
.capture .capmeta button[data-cap-delete] { flex: 0; background: transparent; color: var(--muted); font-size: 0.9rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.35rem 0.15rem 0.55rem; border-radius: 999px; background: var(--line); font-size: 0.76rem; max-width: 30ch; } .chip .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .chip .cs { color: var(--faint); } .chip button { background: transparent; color: var(--muted); padding: 0 0.25rem; font-size: 0.9rem; line-height: 1; } .chip.uploading { opacity: 0.6; }
.composer .cin { display: flex; gap: 0.5rem; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 40vh; padding: 0.6rem 0.8rem; border-radius: 12px; font-size: 0.92rem; line-height: 1.45; }
.composer .cacts { display: flex; gap: 0.35rem; align-items: center; } .composer .cacts .ib { padding: 0.55rem 0.6rem; } .composer .cacts #send { padding: 0.55rem 1rem; }
.composer .chint { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.72rem; color: var(--faint); flex-wrap: wrap; }
.chatdrop { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, var(--card)); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 600; pointer-events: none; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }

/* ---- download menus (per snapshot: the .wasmdrop, its database, source, external files, everything) */
.dlmenu { position: relative; display: inline-block; } .dlmenu > summary { list-style: none; cursor: pointer; } .dlmenu > summary::-webkit-details-marker { display: none; }
.dlmenu .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 15; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-l); display: flex; flex-direction: column; min-width: 15rem; padding: 0.3rem; }
.dlmenu .menu a { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.42rem 0.6rem; border-radius: 6px; font-size: 0.84rem; color: var(--fg); white-space: nowrap; } .dlmenu .menu a:hover { background: var(--line); text-decoration: none; } .dlmenu .menu a small { color: var(--faint); font-family: var(--mono); font-size: 0.72rem; }
.dlmenu .menu .mh { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 0.3rem 0.6rem 0.1rem; }
.quick { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; padding: 0 0.5rem; border-radius: 999px; background: color-mix(in srgb, var(--sleep) 14%, transparent); color: var(--sleep); font-weight: 600; white-space: nowrap; line-height: 1.5; } .quick svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; } .quick:hover { text-decoration: none; background: color-mix(in srgb, var(--sleep) 24%, transparent); }

/* ---- chat | preview split, and the transcript's tool entries */
.chatsplit { display: grid; grid-template-columns: minmax(280px, var(--chat-width, 50%)) 9px minmax(280px, 1fr); flex: 1; min-height: 0; }
.chatpanel.nopreview .chatsplit { grid-template-columns: 1fr; } .chatpanel.nopreview #preview, .chatpanel.nopreview .splitter { display: none; }
.chatmain { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chatpanel.nopreview .chatmain { width: min(100%, 1040px); justify-self: center; border-inline: 1px solid var(--line); }
.splitter { cursor: col-resize; display: grid; place-items: center; background: var(--line); touch-action: none; outline: 0; }
.splitter span { width: 3px; height: 38px; border-radius: 3px; background: var(--faint); opacity: 0.45; } .splitter:hover, .splitter.dragging { background: color-mix(in srgb, var(--accent) 16%, var(--line)); } .splitter:hover span, .splitter:focus-visible span, .splitter.dragging span { background: var(--accent); opacity: 1; }
#preview { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); container-type: inline-size; }
.pvbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line); background: var(--card); font-size: 0.82rem; } .pvbar a.mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
.pvbar .toolbar { min-width: 0; justify-content: flex-end; }
.capture-sharing { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); } .capture-sharing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
@container (max-width: 680px) { .pvbar .ib span { display: none; } }
#preview iframe { flex: 1; width: 100%; border: 0; background: #fff; } #preview .empty { margin: auto; border: 0; }
.pvtools { flex: 0 0 min(34%, 300px); min-height: 150px; display: flex; flex-direction: column; border-top: 1px solid var(--border); background: var(--card); }
.pvtools-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 42px; padding: 0.35rem 0.55rem; border-bottom: 1px solid var(--line); }
.pvtools-head .tabs { border: 0; padding: 0; gap: 0.15rem; overflow: visible; } .pvtools-head .tabs button { border: 0; border-radius: 6px; padding: 0.32rem 0.5rem; background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem; cursor: pointer; } .pvtools-head .tabs button.on { background: var(--line); color: var(--fg); font-weight: 650; }
.pvtools-head .tabs span { display: inline-block; min-width: 1.2em; margin-left: 0.18rem; color: var(--faint); font-size: 0.68rem; }
.pvtools-head .toolbar { flex-wrap: nowrap; } .pvtools-head .ib { padding: 0.3rem 0.45rem; font-size: 0.72rem; white-space: nowrap; }
.pvtools-body { flex: 1; min-height: 0; overflow: auto; font: 0.72rem/1.45 var(--mono); }
.pvrow { display: grid; grid-template-columns: 5rem minmax(0,1fr); gap: 0.55rem; padding: 0.28rem 0.55rem; border-bottom: 1px solid var(--line); } .pvrow:hover { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.pvrow .pvt { color: var(--faint); white-space: nowrap; } .pvrow .pvv { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; } .pvrow.error .pvv, .pvrow.warn .pvv { color: var(--bad); } .pvrow.warn .pvv { color: var(--warn); }
.pvnet { display: grid; grid-template-columns: 4rem 3.5rem minmax(10rem,1fr) 5rem 5rem 5rem; gap: 0.5rem; align-items: baseline; padding: 0.28rem 0.55rem; border-bottom: 1px solid var(--line); } .pvnet.head { position: sticky; top: 0; z-index: 1; background: var(--card); color: var(--faint); font-size: 0.66rem; text-transform: uppercase; } .pvnet:not(.head):hover { background: color-mix(in srgb, var(--fg) 3%, transparent); } .pvnet .url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pvnet .bad { color: var(--bad); } .pvnet .cache { color: var(--warn); }
.pvshow { position: absolute; right: 1rem; top: 0.55rem; } .chatpanel { position: relative; }
#preview.maximized { position: fixed; inset: 0; z-index: 80; background: var(--bg); }
#preview.maximized .pvbar { min-height: 52px; box-shadow: var(--shadow); } #preview.maximized #pv-max { background: var(--accent); color: var(--accent-fg); }
.annotate-dialog { max-width: none; width: min(96vw, 1500px); } .annotate-dialog .card { height: min(94vh, 1000px); display: flex; flex-direction: column; gap: 0.7rem; }
.annotation-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; } .dialog-x { background: transparent; color: var(--muted); font-size: 1.45rem; padding: 0.15rem 0.45rem; line-height: 1; }
.annotation-toolbar { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; padding: 0.45rem; border: 1px solid var(--border); border-radius: 10px; background: var(--line); }
.annotation-toolbar .toolgroup { display: inline-flex; gap: 0.2rem; align-items: center; padding-right: 0.45rem; border-right: 1px solid var(--border); } .annotation-toolbar .toolgroup:last-child { border: 0; padding: 0; margin-left: auto; }
.annotation-toolbar .ib { width: 34px; height: 32px; justify-content: center; padding: 0.3rem; background: var(--card); } .annotation-toolbar .ib.on { background: var(--accent); color: var(--accent-fg); }
.annotation-toolbar .text-tool { font: 700 1rem Georgia, serif; }
.annotation-toolbar .palette { gap: 0.28rem; }
.annotation-toolbar .swatch { width: 20px; height: 20px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 20%, transparent); } .annotation-toolbar .swatch.on { border-color: var(--card); outline: 2px solid var(--accent); } .annotation-toolbar .swatch.light { box-shadow: 0 0 0 1px var(--faint); }
.annotation-toolbar .custom-color { display: inline-flex; } .annotation-toolbar input[type="color"] { width: 26px; height: 26px; padding: 1px; border-radius: 50%; }
.annotation-toolbar select { padding: 0.35rem 0.45rem; height: 32px; }
.annotation-toolbar .annotation-option { width: 10rem; height: 32px; padding: 0.35rem 0.5rem; } .annotation-toolbar select.annotation-option { width: 3.5rem; }
.annotation-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; position: relative; border: 1px solid var(--border); border-radius: 10px; background: repeating-conic-gradient(#ddd 0 25%, #eee 0 50%) 50% / 16px 16px; }
.annotation-stage canvas { display: block; max-width: 100%; max-height: 100%; cursor: crosshair; touch-action: none; box-shadow: var(--shadow-l); }
.annotation-stage #annotation-inline-text { position: absolute; z-index: 2; width: min(26rem, 65%); min-width: 8rem; margin: 0; padding: 0.12em 0.25em; border: 1px dashed currentColor; border-radius: 3px; outline: 2px solid rgba(255,255,255,.9); background: rgba(17,24,39,.72); color: #ef4444; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; font-weight: 700; line-height: 1.25; transform-origin: top left; box-shadow: var(--shadow); }
.capture-preview-dialog { max-width: none; width: min(94vw, 1400px); } .capture-preview-dialog .card { height: min(92vh, 960px); display: flex; flex-direction: column; gap: 0.8rem; }
.capture-preview-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: repeating-conic-gradient(#ddd 0 25%, #eee 0 50%) 50% / 16px 16px; }
.capture-preview-stage img { display: block; max-width: 100%; max-height: 100%; box-shadow: var(--shadow-l); }
@media (max-width: 700px) { .annotation-toolbar .toolgroup { padding-right: 0.25rem; } .annotation-toolbar .palette { order: 3; width: 100%; border: 0; } .annotation-toolbar .history-tools { margin-left: 0; } }
@media (max-width: 760px) { body.chat-workspace { overflow: auto; } .chatpanel { height: calc(100vh - 108px); min-height: 540px; } .chatsplit { grid-template-columns: 1fr; } #preview:not(.maximized), .splitter { display: none; } .pvshow { display: inline-flex !important; } .pvbar .ib span { display: none; } }
@media (max-width: 760px) { .pvtools-head { align-items: flex-start; } .pvtools-head .toolbar { flex-wrap: wrap; } .pvnet { grid-template-columns: 3.5rem 3rem minmax(8rem,1fr) 4rem; } .pvnet > :nth-child(5), .pvnet > :nth-child(6) { display: none; } }
details.tool { border-left: 2px solid var(--line); margin: 0.15rem 0; font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
details.tool > summary { list-style: none; cursor: pointer; display: flex; gap: 0.45rem; align-items: baseline; padding: 0.1rem 0.5rem; border-radius: 6px; min-width: 0; } details.tool > summary::-webkit-details-marker { display: none; } details.tool > summary:hover { background: var(--line); }
details.tool .ti { width: 0.9em; text-align: center; flex-shrink: 0; } details.tool.ok .ti { color: var(--ok); } details.tool.bad .ti { color: var(--bad); } details.tool.run .ti { color: var(--warn); }
details.tool .tn { font-weight: 700; color: var(--fg); flex-shrink: 0; } details.tool .ta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; } details.tool .bad { color: var(--bad); }
details.tool .tbody { padding: 0.2rem 0.5rem 0.4rem 1.6rem; } details.tool .tl { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin: 0.3rem 0 0.1rem; }
details.tool pre { margin: 0; background: var(--line); padding: 0.45rem 0.6rem; border-radius: 6px; max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.74rem; color: var(--fg); }
.msg .text + details.tool, details.tool + .msg .text { margin-top: 0.4rem; } .msg .part { margin: 0.35rem 0; } .msg .part:first-child { margin-top: 0; }

/* ---- file browser */
.files { display: flex; flex-direction: column; gap: 0.6rem; min-height: 40vh; }
.crumbs { font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.2rem; } .crumbs a { cursor: pointer; } .crumbs span { color: var(--faint); }
.filelist { display: flex; flex-direction: column; gap: 0.1rem; max-height: 55vh; overflow: auto; }
.fe { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem; border-radius: var(--radius-s); font-size: 0.88rem; } .fe:hover { background: var(--line); }
.fe .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fe .fn a { cursor: pointer; }
.fe .fw { font-size: 0.7rem; padding: 0 0.4rem; border-radius: 999px; background: var(--line); color: var(--muted); } .fe .fw.sharefiles { background: color-mix(in srgb, var(--prod) 22%, transparent); color: var(--fg); } .fe .fw.local { background: color-mix(in srgb, var(--test) 20%, transparent); color: var(--fg); } .fe .fw.s3 { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--fg); } .fe .fw.inside { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--fg); }
.fe .fs { color: var(--muted); font-size: 0.8rem; min-width: 5em; text-align: right; } .fe .toolbar .ib { padding: 0.25rem 0.4rem; }
.fe svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); }

/* ---- admin */
.admin { display: flex; flex-direction: column; gap: 1rem; }
.admin .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-top: 0.6rem; }
.stat .sv { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; } .stat .sl { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.68rem; color: var(--muted); font-weight: 700; } .stat .ss { font-size: 0.8rem; }
.role { font-size: 0.72rem; font-weight: 700; padding: 0 0.45rem; border-radius: 999px; border: 1px solid var(--border); } .role.admin { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ---- API keys */
.keyform > label, .keyform .grid2 label { margin: 0.3rem 0; } .keyform fieldset { margin: 0.5rem 0; }
.keyform label.row { flex-direction: row; align-items: flex-start; gap: 0.5rem; margin: 0.2rem 0; font-size: 0.9rem; color: var(--fg); } .keyform label.row input { margin-top: 0.25rem; }
.keyprojects { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; margin: 0.2rem 0 0 1.6rem; font-size: 0.85rem; } .keyprojects label { display: inline-flex; flex-direction: row; gap: 0.3rem; align-items: center; color: var(--fg); }
.token { margin-top: 1rem; padding: 0.8rem 1rem; border: 2px solid var(--ok); border-radius: var(--radius-s); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.token code.secret { display: block; font-size: 1rem; word-break: break-all; padding: 0.5rem; margin: 0.4rem 0; background: var(--card); border: 1px solid var(--border); border-radius: 6px; user-select: all; }
.token pre { margin: 0.4rem 0 0; font-size: 0.8rem; overflow-x: auto; }
.scopes .badge { background: var(--faint); } .scopes .badge.write { background: var(--warn); } .scopes .badge.delete { background: var(--bad); } .scopes .badge.create { background: var(--ok); }
.keystatus.expired, .keystatus.exhausted { color: var(--bad); font-weight: 600; }

/* ---- API docs */
.doc { display: grid; grid-template-columns: 14rem 1fr; gap: 1.5rem; align-items: start; } .doctoc { position: sticky; top: 4.2rem; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; } .doctoc a { color: var(--muted); }
.docbody { min-width: 0; } .docbody h2 { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); text-transform: none; letter-spacing: 0; font-size: 1.2rem; color: var(--fg); } .docbody h3 { margin-top: 1.4rem; font-family: var(--mono); font-size: 0.95rem; }
.docbody pre { background: var(--line); padding: 0.7rem 0.9rem; border-radius: 8px; overflow-x: auto; font-size: 0.8rem; } .docbody pre code { background: none; padding: 0; }
.docbody .tbl { font-size: 0.85rem; } .docbody p { max-width: 70rem; }
@media (max-width: 800px) { .doc { grid-template-columns: 1fr; } .doctoc { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.5rem 0.9rem; } }
.ok-note { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); padding: 0.5rem 0.7rem; border-radius: var(--radius-s); }

/* ================= landing page ================= */
body.landing { display: flex; flex-direction: column; min-height: 100vh; }
.cta-link { font-weight: 600; }
.hero { flex: 1; max-width: 1040px; margin: 0 auto; padding: 4rem 1.5rem 3rem; width: 100%; display: flex; flex-direction: column; gap: 3rem; }
.hero-inner { text-align: center; display: flex; flex-direction: column; gap: 1.1rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 750; letter-spacing: -0.035em; margin: 0; line-height: 1.1; }
.hero .mono, .step .mono { font-family: var(--mono); color: var(--accent); font-size: 0.85em; background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 0.05em 0.35em; border-radius: 6px; white-space: nowrap; }
.tagline { max-width: 640px; color: var(--muted); font-size: 1.1rem; line-height: 1.55; margin: 0; } .tagline b { color: var(--fg); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; width: 100%; max-width: 680px; padding: 3rem 2rem; border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 22px; background: color-mix(in srgb, var(--accent) 5%, var(--card)); cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s; box-shadow: var(--shadow); }
.dropzone:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); transform: translateY(-1px); }
.dropzone.busy { pointer-events: none; opacity: 0.8; }
.dz-icon svg { width: 46px; height: 46px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dz-title { font-size: 1.25rem; font-weight: 650; } .dz-sub { color: var(--muted); font-size: 0.95rem; } .dz-sub u { color: var(--accent); cursor: pointer; }
.dropzone .progress { width: 70%; margin-top: 0.6rem; }
.signup-cta { color: var(--muted); font-size: 0.98rem; margin: 0.2rem 0 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; } @media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.step .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 0.85rem; }
.step b { display: block; margin: 0.55rem 0 0.3rem; font-size: 1.05rem; } .step p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

/* ================= run page ================= */
body.runpage { margin: 0; height: 100vh; display: flex; flex-direction: column; }
.runbar { display: flex; align-items: center; gap: 1rem; padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); background: var(--card); }
.brand.small { font-size: 1rem; }
.runinfo { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; } .runname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livedot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); flex-shrink: 0; }
.runacts { display: flex; gap: 0.4rem; } .runacts .ib { text-decoration: none; }
.runstage { flex: 1; position: relative; background: var(--bg); }
.runstage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.bootscreen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem; color: var(--muted); }
.upsell { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: center; justify-content: space-between; padding: 0.7rem 1.2rem; background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-top: 1px solid var(--border); font-size: 0.92rem; }
.upsell .cta-link { white-space: nowrap; }

/* ancestry: what an image / rollback point / running slot was taken from, back to the beginning (newest parent first) */
.lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.35rem; font-size: 0.76rem; color: var(--muted); margin-top: 0.25rem; line-height: 1.5; }
.lineage .lk { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--fg); white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
.lineage .lk svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.lineage .lk.base { background: color-mix(in srgb, var(--ok) 14%, transparent); } .lineage .lk.autosnap { background: color-mix(in srgb, var(--warn) 16%, transparent); } .lineage .lk.sleep { background: color-mix(in srgb, var(--sleep) 16%, transparent); }
.lineage .lk.root { background: transparent; color: var(--muted); } .lineage .arrow { color: var(--faint); } .lineage .gone { color: var(--bad); text-decoration: none; margin-left: 0.15rem; }
.instance .lineage { padding: 0 0.2rem 0.35rem; }

.badge.approle { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* the lineage tree */
.lineage .lk { max-width: none; white-space: normal; cursor: pointer; } .lineage .lk:hover { outline: 1px solid var(--accent); }
.lscroll { overflow: auto; max-width: 100%; padding-bottom: 0.4rem; }
.lsvg { display: block; font-size: 0.8rem; min-width: 100%; }
.ledge { fill: none; stroke: var(--border); stroke-width: 2; } .ledge.hl { stroke: var(--accent); stroke-width: 3; }
.lnode { cursor: pointer; } .lnode rect { fill: var(--card); stroke: var(--border); stroke-width: 1.5; }
.lnode:hover rect { stroke: var(--accent); } .lnode.test rect { stroke: var(--test); } .lnode.prod rect { stroke: var(--prod); }
.lnode.base rect { fill: color-mix(in srgb, var(--ok) 10%, var(--card)); } .lnode.autosnap rect { fill: color-mix(in srgb, var(--warn) 10%, var(--card)); }
.lnode.gone rect { stroke-dasharray: 5 4; fill: color-mix(in srgb, var(--fg) 4%, var(--card)); }
.lnode.cur rect { stroke-width: 3; } .lnode.hl rect { stroke: var(--accent); stroke-width: 3; } .lnode.sel rect { fill: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.lcard { padding: 0.5rem 0.6rem; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 0.3rem; color: var(--fg); font-family: inherit; overflow: hidden; }
.lname { display: flex; gap: 0.35rem; align-items: flex-start; font-weight: 600; line-height: 1.2; word-break: break-all; font-size: 0.82rem; }
.lname svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2; }
.lmeta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; font-size: 0.72rem; color: var(--muted); }
.lmeta .env { font-weight: 700; } .lmeta .env.test { color: var(--test); } .lmeta .env.prod { color: var(--prod); } .lmeta .curb { color: var(--ok); font-weight: 700; } .lmeta .goneb { color: var(--bad); }
.lmeta svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; vertical-align: -1px; }
.ldetail { margin-top: 0.7rem; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-s); } .ldetail .lname { font-size: 0.95rem; } .ldetail .lmeta { margin-top: 0.3rem; font-size: 0.8rem; } .ldetail .toolbar { margin-top: 0.6rem; }

/* the connect dialog: a searchable list of projects, the chosen one previewed */
.choices { display: flex; flex-direction: column; gap: 0.3rem; max-height: 14rem; overflow: auto; padding: 0.15rem; }
.choices .choice { text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.45rem 0.6rem; cursor: pointer; font: inherit; color: var(--fg); display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.choices .choice:hover { border-color: var(--accent); } .choices .choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.choices .choice > div { flex-basis: 100%; }
.conn-preview { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0.6rem 0.8rem; background: color-mix(in srgb, var(--fg) 3%, var(--card)); }
.conn-preview .pname { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; } .conn-preview h3 { margin: 0; font-size: 1rem; } .conn-preview p { margin: 0.35rem 0 0; }

/* a folded ancestry line: one chip standing in for the rest, and the rest when it is opened */
.lineage .lmore { border: 1px dashed var(--faint); background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.lineage .lmore:hover { color: var(--fg); border-color: var(--accent); }
.lineage .lmore.open { border-style: solid; }
.lineage .lrest { display: contents; }

/* bulk actions over an image list: only there when there is something to act on */
.imgbulk { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.25rem 0.1rem 0.4rem; font-size: 0.76rem; }
.imgbulk .lk { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--faint); background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.imgbulk .lk:hover { color: var(--fg); border-color: var(--accent); }
.imgbulk .lk.danger:hover { color: var(--bad); border-color: var(--bad); }
.image .imgpick { margin-bottom: 0.3rem; cursor: pointer; }
.image.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl .pickcol { width: 1.6rem; text-align: center; }
.tbl tr.picked > td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
/* a run of deleted ancestors, drawn as one node until it is opened */
.lnode.fold rect { fill: color-mix(in srgb, var(--fg) 4%, transparent); stroke-dasharray: 5 4; }
.lnode.fold { cursor: zoom-in; }
.lnode.fold .lname { color: var(--muted); }

/* .lscroll already panned horizontally; what it lacked was a bound on HEIGHT, so a deep tree left a tall
   empty area under its shallow left-hand side and pushed the detail panel off the screen. Bound it there
   rather than wrapping a second scroller around it. */
.lscroll { max-height: min(70vh, 700px); resize: vertical; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 0.4rem; }

/* where files go: every destination is listed, the ones this node does not have are shown greyed with why */
.storage .dests { display: grid; gap: 0.3rem; margin: 0.1rem 0 0.55rem; }
.storage .dest { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.storage .dest span { display: flex; flex-direction: column; gap: 0.1rem; }
.storage .dest:has(:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.storage .dest.off { opacity: 0.55; cursor: not-allowed; }
.storage .soon { opacity: 0.6; }
.storage label:has(input:disabled) { opacity: 0.55; }

/* a fieldset sizes itself to its content by default, which pushed the storage settings off narrow screens */
fieldset.storage{min-width:0}
fieldset.storage span.row{flex-wrap:wrap}
fieldset.storage select[name=evfs_mode],fieldset.storage input[name=evfs_types]{flex:1 1 12em;min-width:0}
@media (max-width:600px){fieldset.storage select[name=evfs_mode],fieldset.storage input[name=evfs_types]{flex:1 1 100%;width:100%}}
/* AuthLock sign-in: the widget's iframe fills the card; the password form is a collapsed break-glass below it */
.auth .authlock { min-height: 120px; margin: .25rem 0 .5rem; }
.auth .authlock iframe { width: 100% !important; border: 0; }
.auth details.fallback { margin-top: 1rem; border-top: 1px solid var(--border, #e5e7eb); padding-top: .75rem; }
.auth details.fallback summary { cursor: pointer; color: var(--muted, #6b7280); font-size: .9rem; }
