:root {
  --bg: #f6f5f1; --card: #fff; --ink: #1c1b19; --muted: #77736b; --line: #e4e1d9;
  --accent: #2d5bd7; --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b; --code: #f1efe9;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --card: #1e1e1c; --ink: #ecebe6; --muted: #9a968d; --line: #33322f; --accent: #7aa2ff; --code: #262623; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
header { display: flex; align-items: center; gap: 16px; padding: 18px 28px; border-bottom: 1px solid var(--line); }
.logo { font-weight: 750; font-size: 20px; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.tag { color: var(--muted); }
.howlink { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 14.5px; }
.howlink:hover { color: var(--ink); }
#who { margin-left: 16px; display: flex; gap: 10px; align-items: center; }
main { max-width: 1120px; margin: 0 auto; padding: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.card.wide { grid-column: 1 / -1; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 780px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }
/* list rows: dot | name over details | actions, so long details wrap under the name */
ul.list li.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; }
li.item .meta { color: var(--muted); font-size: 13px; }
li.item .acts { display: flex; gap: 6px; align-items: center; }
li.item button.x { margin-left: 0; }
#login-cmd { white-space: pre; word-break: normal; overflow-x: auto; }
h2 { font-size: 15px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 13.5px; }
input[type=text], input:not([type]) { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 0; flex: 1; }
form, .row { display: flex; gap: 8px; align-items: center; }
button, .btn { font: inherit; font-weight: 550; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: .5; cursor: progress; }
.btn.small, button.small { padding: 3px 10px; font-size: 13px; }
button.x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; padding: 0 6px; }
button.x:hover, button.x.armed { color: var(--bad); }
button.x.armed { font-size: 13px; font-weight: 650; }
.pv-head .btn { margin-left: auto; }
button.linkish { background: none; border: none; color: var(--accent); padding: 0; font-weight: 600; }
ul.list { list-style: none; padding: 0; margin: 0 0 14px; }
ul.list li { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.pill { font-size: 12px; font-weight: 650; padding: 2px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
pre { background: var(--code); padding: 12px; border-radius: 8px; overflow: auto; max-height: 360px; margin: 0; white-space: pre-wrap; word-break: break-all; }
#drop { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); margin-bottom: 12px; transition: .15s; }
#drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
#drop label { color: var(--accent); cursor: pointer; font-weight: 600; }
#preview { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
#preview img, #preview video { max-width: 100%; max-height: 420px; border-radius: 8px; display: block; margin-top: 10px; }
#preview pre { margin-top: 10px; }
.pv-head { display: flex; gap: 8px; align-items: baseline; }
#trace { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; font-size: 13px; }
#trace li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
#trace li.key { color: var(--accent); } #trace li.bad { color: var(--bad); }
#trace time { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11.5px; margin-right: 8px; }
.hero { max-width: 640px; margin: 10px auto 26px; text-align: center; }
.hero h1 { font-size: 30px; letter-spacing: -.03em; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0; }
.flow { font-family: ui-monospace, monospace; font-size: 12.5px; background: var(--code); border-radius: 10px; padding: 14px 16px; white-space: pre; overflow: auto; line-height: 1.6; }
details summary { cursor: pointer; color: var(--accent); font-weight: 550; margin: 6px 0 10px; }
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 460px; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
#rc-code { font-size: 19px; letter-spacing: .06em; text-align: center; padding: 16px; margin: 14px 0; user-select: all; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; transition: .2s; max-width: 90vw; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
.stack > * + * { margin-top: 12px; }
.card.pair { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.card.pair .row { flex-wrap: wrap; }
.card.pair .conn + .conn { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.card.pair ul { margin: 8px 0 0; }
.card.pair li .acts { margin-left: auto; display: flex; gap: 6px; }
.dot { background: var(--line); }
#modal { max-width: 560px; width: calc(100vw - 32px); padding: 0; overflow: hidden; }
#modal .m-title { font-size: 19px; margin: 0; padding: 20px 24px 14px; }
#modal .m-body { padding: 0 24px; }
#modal .m-body > * + * { margin-top: 12px; }
#modal .m-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px 20px; flex-wrap: wrap; }
#modal.danger { border: 2px solid var(--bad); }
#modal.danger .m-title { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); border-bottom: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); margin-bottom: 16px; }
#modal.warn { border: 2px solid var(--warn); }
#modal.warn .m-title { background: color-mix(in srgb, var(--warn) 13%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); margin-bottom: 16px; }
#modal.danger::backdrop { background: rgb(60 0 0 / .55); backdrop-filter: blur(3px); }
#modal.warn::backdrop { backdrop-filter: blur(2px); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts .note { color: var(--muted); font-size: 12.5px; }
.facts input { width: 100%; }
.chip { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.chip.good { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.fp { background: var(--code); border-radius: 10px; padding: 12px 14px; text-align: center; }
.fp code { font-size: 20px; letter-spacing: .06em; font-weight: 650; }
#recovery-check { margin: 0 0 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; margin-bottom: 8px; }
.check.good { background: color-mix(in srgb, var(--ok) 10%, transparent); }
.check.warn { background: color-mix(in srgb, var(--warn) 13%, transparent); }
.check .ico { font-size: 15px; line-height: 1.3; }
.check p { margin: 0 0 6px; } .check p:last-child { margin: 0; }
.check details.how summary { color: var(--accent); cursor: pointer; font-size: 13px; margin: 8px 0 0; font-weight: 550; }
.check details.how ul { margin: 6px 0 0; padding-left: 16px; } .check details.how li { margin: 3px 0; }
.tips { margin: 14px 0 0; padding-left: 18px; font-size: 13.5px; } .tips li { margin: 4px 0; }
#server-details > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#server-details > summary::-webkit-details-marker { display: none; }
#server-details > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; display: inline-block; }
#server-details[open] > summary::before { transform: rotate(90deg); }
.sv-title { font-weight: 650; font-size: 15px; }
.legend { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.legend i, .sv i.k { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-left: 6px; }
.k-public { background: var(--ok); } .k-sealed { background: var(--accent); } .k-hash { background: var(--warn); } .k-random { background: var(--muted); } .k-meta { background: transparent; border: 1px solid var(--line); }
.sv h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; font-weight: 650; }
.sv h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sv table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sv th, .sv td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sv th { font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sv td.f { white-space: nowrap; font-family: ui-monospace, monospace; font-size: 12.5px; }
.sv .bytes { font-family: ui-monospace, monospace; font-size: 12px; }
.sv .bytes b { font-weight: 600; color: var(--muted); margin-right: 6px; }
.sv .note { color: var(--muted); font-size: 12.5px; }
.sv .scroll { overflow-x: auto; }
ul.list li.item.vault { grid-template-columns: 22px minmax(0, 1fr) auto; }
li.item .icon { font-size: 16px; text-align: center; }
li.item button.linkish { text-align: left; overflow-wrap: anywhere; }
button.x.edit { font-size: 15px; }
input.rename { font: inherit; font-weight: 600; padding: 2px 6px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); color: var(--ink); width: 100%; }
ul.files { margin: 10px 0 0; max-height: 320px; overflow: auto; }
ul.files li.item { padding: 4px 0; }
.pv-file > * { margin-top: 10px; }
.dbwrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; margin-top: 12px; }
@media (max-width: 700px) { .dbwrap { grid-template-columns: minmax(0, 1fr); } }
ul.dbtables { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); }
ul.dbtables li { padding: 4px 8px; border-radius: 6px; margin-right: 10px; overflow-wrap: anywhere; }
ul.dbtables li.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dbmain { min-width: 0; }
.dbmain > * + * { margin-top: 8px; }
.grid-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 8px; }
table.dbgrid { border-collapse: collapse; font-size: 13px; width: 100%; }
table.dbgrid th { position: sticky; top: 0; background: var(--card); text-align: left; font-weight: 600; color: var(--muted); }
table.dbgrid th, table.dbgrid td { padding: 5px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.dbgrid td { cursor: default; }
table.dbgrid td.rowdel { width: 1%; }
table.dbgrid .null { color: var(--muted); font-style: italic; }
input.cell { font: inherit; width: 100%; min-width: 80px; padding: 2px 4px; border: 1px solid var(--accent); border-radius: 4px; background: var(--bg); color: var(--ink); }
.sqlrow { margin-top: 12px; align-items: flex-end; }
textarea.sql { flex: 1; font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--code); color: var(--ink); resize: vertical; }
pre.err { color: var(--bad); }
.req { font-size: 16px; padding: 10px 12px; background: var(--code); border-radius: 8px; }
.pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

/* Small utilities (no inline styles: the CSP allows only our own stylesheet). */
.col { flex-direction: column; align-items: stretch; }
.push { margin-left: auto; }
.mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; } .mt6 { margin-top: 6px; } .mt-4 { margin-top: -4px; }
.mb12 { margin-bottom: 12px; } .mb4 { margin-bottom: 4px; } .my16 { margin-top: 16px; margin-bottom: 16px; }

/* The disclaimer: not a decoration, so it is never hidden. */
.disclaimer { margin: 0; padding: 10px 16px; background: color-mix(in srgb, var(--warn) 18%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); font-size: 13.5px; line-height: 1.45; text-align: center; }
.disclaimer strong { color: var(--warn); }
.disclaimer a { color: inherit; font-weight: 600; }
