:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  --background: #10141c;
  --surface: #181f2b;
  --border: #344153;
  --text: #edf2fb;
  --muted: #aeb9ca;
  --accent: #82e1c0;
  --terminal: #0e141e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--background); color: var(--text); margin: 0; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 65px; padding: 0 max(5vw, 20px); border-bottom: 1px solid var(--border); }
.brand { font-weight: 720; letter-spacing: -.025em; }
.brand span { margin-left: .55rem; font-weight: 450; color: var(--muted); }
main { max-width: 1160px; margin: 0 auto; padding: clamp(24px, 5vw, 54px); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3.3vw, 2.45rem); letter-spacing: -.045em; }
h2 { font-size: 1.1rem; letter-spacing: -.015em; overflow-wrap: anywhere; }
button, input, textarea { font: inherit; }
button, .file-link { color: var(--text); background: #232e3e; border: 1px solid var(--border); border-radius: 7px; padding: .5rem .85rem; text-decoration: none; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:hover:enabled, .file-link:hover { border-color: var(--muted); }
button:disabled { opacity: .46; cursor: default; }
.primary { color: #0b271e; background: var(--accent); border-color: var(--accent); font-weight: 650; }
.quiet { background: transparent; }
.muted { color: var(--muted); }
.message { line-height: 1.45; color: var(--accent); }
.message:empty { display: none; }
.error { color: #ffb7af; }
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: clamp(16px, 3.5vw, 28px); }
.login { max-width: 450px; margin: 8vh auto 0; }
.login h1 { font-size: 1.6rem; margin-bottom: 1.35rem; }
.login form { display: grid; gap: .85rem; }
.login label, #command-form label { display: grid; gap: .4rem; font-weight: 600; }
.login button { margin: .45rem 0 .9rem; }
input, textarea { color: var(--text); background: var(--terminal); border: 1px solid var(--border); border-radius: 7px; padding: .55rem .65rem; width: 100%; }
.instance-header, .section-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.instance-header { flex-wrap: wrap; margin-bottom: 1.2rem; }
.state { margin-top: .5rem; color: var(--muted); }
.state[data-active="true"] { color: var(--accent); }
.actions, .file-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.tabs { display: flex; gap: .55rem; margin: 1.25rem 0 .75rem; }
.tabs button { background: transparent; border-color: transparent; }
.tabs button[aria-pressed="true"] { color: var(--accent); border-color: var(--border); background: var(--surface); }
pre, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
pre { padding: .8rem; color: #d3deec; background: var(--terminal); border: 1px solid var(--border); border-radius: 7px; white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; }
#log-output { height: min(45vh, 29rem); min-height: 13rem; overscroll-behavior: contain; font-size: .82rem; }
#command-output { max-height: 12rem; margin-bottom: 0; color: var(--accent); }
.input-row { display: flex; gap: .65rem; margin-top: .4rem; }
.file-tools { align-items: center; margin: 1rem 0 .55rem; }
#path { flex: 1; min-width: 10ch; overflow-wrap: anywhere; }
#files-state { margin: .65rem 0; font-size: .88rem; }
#file-list { list-style: none; margin: .5rem 0; padding: 0; }
#file-list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--border); padding: .55rem 0; }
#file-list .name { flex: 1; text-align: left; background: transparent; border-color: transparent; color: var(--accent); font-weight: 550; }
#file-list .name:hover { text-decoration: underline; }
#file-list .file-name { overflow-wrap: anywhere; min-width: 0; }
#file-list .file-link, #file-list .actions button { font-size: .82rem; padding: .35rem .55rem; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; width: min(94vw, 880px); }
dialog::backdrop { background: #060a10b8; }
dialog textarea { font: .9rem ui-monospace, monospace; min-height: 46vh; margin: .85rem 0; }
dialog .actions { justify-content: end; }
@media (max-width: 520px) {
  .top { min-height: 55px; }
  .file-tools { gap: .4rem; }
  .file-tools #path { flex-basis: calc(100% - 5rem); }
  #file-list .actions { width: 100%; }
}
