:root {
  --bg: #f4f6f3; --grid: rgba(35, 54, 196, .075);
  --panel: #fff; --head: #eef1ee; --field: #fbfcfb;
  --ink: #1b2330; --muted: #5a6573; --faint: #9aa4b0; --line: #d6dce2; --line-strong: #b9c2cc;
  --accent: #2336c4; --on-accent: #fff; --accent-soft: #e5e9ff; --link: #2336c4;
  --mark: #ffe45c; --mark-band: #ffe45c;
  --danger: #c02f28; --on-danger: #fff; --warn: #b26a00; --ok: #1d7a4c; --bad-bg: #fbeae8; --ok-bg: #e4f3ea;
  --term: #131b25; --term-ink: #dbe4ee;
  --shadow: 0 20px 44px -26px rgba(22, 36, 110, .45);
  --sans: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  --code-size: 15px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141c19; --grid: rgba(220, 240, 230, .04);
  --panel: #1b2521; --head: #222e29; --field: #17201c;
  --ink: #e6ede8; --muted: #9dada4; --faint: #6f7f77; --line: #2f3d37; --line-strong: #46574f;
  --accent: #6f8cff; --on-accent: #0c1433; --accent-soft: #25305a; --link: #a3b6ff;
  --mark: #ffe45c; --mark-band: rgba(255, 228, 92, .32);
  --danger: #ff8b7f; --on-danger: #2a0d0a; --warn: #f2c46d; --ok: #5fd19a; --bad-bg: #3a211e; --ok-bg: #16332a;
  --term: #0e1512; --term-ink: #dbe4ee;
  --shadow: 0 20px 44px -24px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.55 var(--sans); font-optical-sizing: auto;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body:not(.editor) {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
::selection { background: var(--mark); color: #1b2330; }
a { color: var(--link); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; }
h1 { font-size: 2.25rem; font-weight: 750; margin: 0 0 6px; letter-spacing: -.025em; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 1.0625rem; font-weight: 700; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.code, .mono { font-family: var(--mono); font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 18px; height: 18px; flex: none; }

.btn {
  font: inherit; font-weight: 600; font-size: .9375rem; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--head); }
.btn.small { padding: 5px 11px; font-size: .8125rem; border-radius: 8px; }
.btn.small .ico { width: 15px; height: 15px; }
.btn.big { padding: 13px 22px; font-size: 1.0625rem; font-weight: 700; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--link); }
.btn[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn[role="tab"][aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--link); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.danger { color: var(--muted); border-color: transparent; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); background: var(--bad-bg); }
#theme .to-light { display: none; }
[data-theme="dark"] #theme .to-light { display: inline; }
[data-theme="dark"] #theme .to-dark { display: none; }
#theme span { display: inline-grid; }

input, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--field); color: var(--ink); max-width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; resize: vertical; line-height: 1.6; }
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9375rem; }
label input, label textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; font-size: 1rem; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; vertical-align: middle; }
.msg { padding: 11px 15px; border-radius: 10px; margin: 0 0 16px; }
.msg.bad { background: var(--bad-bg); color: var(--danger); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }

.switch {
  position: relative; width: 44px; height: 26px; padding: 0; border: 0; border-radius: 999px;
  background: var(--line-strong); cursor: pointer; flex: none;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .16s ease;
}
.switch[aria-pressed="true"] { background: var(--accent); }
.switch[aria-pressed="true"] .knob { transform: translateX(18px); }
.switch.login[aria-pressed="false"] { background: var(--danger); }

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px; padding: 10px clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.0625rem; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; color: var(--accent); flex: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  background: linear-gradient(transparent 58%, var(--mark-band) 58%, var(--mark-band) 88%, transparent 88%);
}
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bar-end form { margin: 0; }
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--link); font-weight: 750; font-size: .875rem;
}
.avatar.big { width: 60px; height: 60px; font-size: 1.625rem; }

.wrap { max-width: 1220px; margin: 0 auto; padding: 36px clamp(16px, 3vw, 32px) 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--ink); }
.who-head { display: flex; align-items: center; gap: 16px; }
.newform { display: flex; gap: 8px; }
.newform input { flex: 1; min-width: 0; }
.newform.compact input { width: 260px; flex: none; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.pcard:hover { border-color: var(--tone); }
.pcard:has(.pname:focus-visible) { outline: 2px solid var(--link); outline-offset: 2px; }
.pcode {
  position: relative; margin: 0; height: 9.4em; overflow: hidden; counter-reset: ln;
  padding: 14px 14px 0 12px; background: var(--field); border-bottom: 1px solid var(--line);
  font: 12.5px/1.55 var(--mono); color: var(--ink);
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
          mask-image: linear-gradient(#000 70%, transparent);
}
.pcode span { display: block; min-height: 1.55em; white-space: pre; overflow: hidden; text-overflow: ellipsis; padding-left: 4.2ch; position: relative; }
.pcode span::before {
  counter-increment: ln; content: counter(ln);
  position: absolute; left: 0; width: 2ch; text-align: right; color: var(--faint);
}
.pcode::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(12px + 3ch); width: 1.5px; background: var(--tone); opacity: .6;
}
.pcode.empty { display: grid; place-items: center; color: var(--faint); font-family: var(--sans); font-size: .9375rem; padding: 0; }
.pcode.empty::after { display: none; }
.pmeta { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; }
.ptext { flex: 1; min-width: 0; }
.pname { display: block; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname::after { content: ""; position: absolute; inset: 0; }
.pname:focus-visible { outline: none; }
.ptime { display: block; color: var(--muted); font-size: .8125rem; }
.pmeta form { position: relative; z-index: 1; margin: 0; }
.tone-0 { --tone: #d6453d; } .tone-1 { --tone: #2336c4; } .tone-2 { --tone: #1d7a4c; }
.tone-3 { --tone: #c28a00; } .tone-4 { --tone: #8a3aa8; }
[data-theme="dark"] .tone-0 { --tone: #ff8b7f; } [data-theme="dark"] .tone-1 { --tone: #8fa6ff; }
[data-theme="dark"] .tone-2 { --tone: #5fd19a; } [data-theme="dark"] .tone-3 { --tone: #f2c46d; }
[data-theme="dark"] .tone-4 { --tone: #d49cf0; }

.empty { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 5vw, 72px); align-items: center; margin: 12px 0 64px; }
.display { font-size: clamp(2.5rem, 5.2vw, 4rem); line-height: 1; font-weight: 800; letter-spacing: -.025em; font-variation-settings: "opsz" 32; margin: 0 0 20px; max-width: 12ch; }
.lead { font-size: 1.125rem; line-height: 1.6; max-width: 46ch; margin-bottom: 26px; }
.empty .newform { max-width: 520px; }
.wrap-center { min-height: calc(100vh - 58px); display: flex; align-items: center; padding-top: 32px; padding-bottom: 48px; }
.wrap-center .empty { width: 100%; margin: 0; }
.mock {
  margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); transform: rotate(-1.4deg);
}
.mock-top { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--head); border-bottom: 1px solid var(--line); font-size: .8125rem; font-weight: 600; color: var(--muted); }
.mock-top b { font-weight: 700; color: var(--on-accent); background: var(--accent); padding: 3px 10px; border-radius: 7px; }
.mock-code { display: grid; grid-template-columns: 3ch 1fr; column-gap: 12px; row-gap: 2px; padding: 20px 18px 26px; font: 15px/1.6 var(--mono); }
.mock-code .ln { color: var(--faint); text-align: right; }
.c-com { color: var(--muted); } .c-prop { color: var(--accent); } .c-str { color: #1d7a4c; }
[data-theme="dark"] .c-str { color: #c3e88d; } [data-theme="dark"] .c-prop { color: #82aaff; }
.typed {
  justify-self: start; overflow: hidden; white-space: nowrap; width: 33ch;
  border-right: 2px solid var(--mark);
  animation: typing 1.5s steps(32, end) .5s both, caret .8s step-end 2s 4 both;
}
.mock-console { padding: 14px 18px 18px; background: var(--term); color: var(--term-ink); font: 14px/1.5 var(--mono); }
.mock-console::before { content: "Konsole"; display: block; color: #7d8b99; font: 600 12px var(--sans); margin-bottom: 6px; }
.mock-console .out::before { content: "› "; color: #7d8b99; }
.mock-console .out { animation: appear .3s ease 2.1s both; }
@keyframes typing { from { width: 0; } to { width: 33ch; } }
@keyframes caret { 50% { border-color: transparent; } 100% { border-color: transparent; } }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.auth-wrap {
  min-height: 100vh; max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 420px); align-items: center;
  gap: clamp(32px, 6vw, 104px); padding: clamp(24px, 5vw, 72px);
}
.auth-brand .logo { width: 58px; height: 58px; }
.giant { font-size: clamp(3.25rem, 8.5vw, 7rem); line-height: .95; font-weight: 800; letter-spacing: -.028em; font-variation-settings: "opsz" 32; margin: 28px 0 22px; max-width: 8ch; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: clamp(24px, 3vw, 34px); }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 18px; }
.auth-card form { margin-bottom: 18px; }
.auth-card .btn.wide { margin-top: 6px; }
.auth-card > p:last-child { margin: 0; }

.access {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  padding: 20px 24px; margin-bottom: 24px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel);
}
.access h2 { margin: 0 0 3px; font-size: 1.1875rem; }
.access p { margin: 0; color: var(--muted); max-width: 60ch; }
.access form { margin: 0; }
.access-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.access-ico .ico { width: 22px; height: 22px; }
.access.is-closed { background: var(--bad-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.access.is-closed .access-ico { background: var(--danger); color: var(--on-danger); }
.access.is-closed h2 { color: var(--danger); }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.roster-card, .add-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; }
.add-card { position: sticky; top: 76px; }
.add-card textarea { margin-bottom: 12px; font-size: .9375rem; }
.add-card p { overflow-wrap: anywhere; }
.add-card > p:last-child { margin: 12px 0 0; }
.table-scroll { margin: 0 -8px; }
.roster { width: 100%; border-collapse: collapse; }
.roster th { text-align: left; font-size: .8125rem; font-weight: 600; color: var(--muted); padding: 6px 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.roster td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.roster tbody tr:last-child td { border-bottom: 0; }
.roster tr.blocked .person { opacity: .55; }
.person { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.sname { font-weight: 700; }
.person:hover .sname { color: var(--link); }
.person .sub { display: block; font-size: .8125rem; color: var(--muted); }
.roster td:first-child { min-width: 210px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 42px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px;
  font-size: .75rem; font-weight: 700; line-height: 1.2; white-space: nowrap; text-decoration: none;
}
.badge .ico { width: 12px; height: 12px; }
.badge.bad { background: var(--bad-bg); color: var(--danger); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
a.badge.warn:hover { background: color-mix(in srgb, var(--warn) 25%, transparent); }
.roster .actions { text-align: right; white-space: nowrap; }
.roster .actions > * { vertical-align: middle; }
details.pw { position: relative; display: inline-block; }
details.pw summary { list-style: none; }
details.pw summary::-webkit-details-marker { display: none; }
details.pw[open] summary { background: var(--accent-soft); border-color: var(--accent); color: var(--link); }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: 270px;
  padding: 14px; text-align: left; white-space: normal;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.pop label { font-size: .875rem; margin-bottom: 10px; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .875rem; }

.flash { background: var(--panel); border: 2px solid var(--ok); border-radius: 16px; padding: 20px 22px; margin-bottom: 24px; }
.flash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.flash-head h2 { margin-bottom: 4px; }
.flash-head p { margin: 0; }
.pwlist { border-collapse: collapse; min-width: 320px; }
.pwlist th { text-align: left; font-size: .8125rem; color: var(--muted); padding: 6px 24px 6px 0; }
.pwlist td { padding: 7px 24px 7px 0; border-top: 1px solid var(--line); font-weight: 600; }
.pwlist td.code { font-size: 1.0625rem; }
.flash .msg { margin: 14px 0 0; }

body.editor { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
  min-height: 58px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.tb-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tb-sep { flex: none; width: 1px; height: 26px; background: var(--line); }
.tb-title { display: flex; min-width: 0; flex: 1; }
.toolbar .title {
  width: 100%; max-width: 440px; margin-left: -8px; padding: 2px 8px;
  font-weight: 750; font-size: 1.0625rem; letter-spacing: 0;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
}
.toolbar .title:hover { border-color: var(--line); }
.toolbar .title:focus { border-color: var(--accent); background: var(--field); box-shadow: 0 0 0 3px var(--accent-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 1.3em; font-size: .75rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status:empty::before { display: none; }
.status.busy { color: var(--warn); }
.status.ok { color: var(--ok); }
.status.bad { color: var(--danger); }
.status.ro { color: var(--muted); }

.tb-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); color: var(--ink);
  font: 600 .9375rem/1 var(--sans); white-space: nowrap; text-decoration: none; cursor: pointer;
}
.tb-btn:hover { border-color: var(--ink); }
.tb-btn .ico { width: 17px; height: 17px; }
.tb-btn.ghost { padding: 0 10px 0 6px; border-color: transparent; background: transparent; color: var(--muted); }
.tb-btn.ghost:hover { background: var(--head); color: var(--ink); }
.tb-btn.primary { padding: 0 8px 0 13px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tb-btn.primary:hover { filter: brightness(1.08); }
.tb-btn kbd { margin-left: 2px; padding: 3px 6px; border-radius: 5px; background: rgba(255, 255, 255, .2); font: 600 .6875rem/1 var(--sans); }
.tb-run { display: flex; gap: 6px; }
#stop .ico { width: 13px; height: 13px; }

.segmented {
  display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--field);
}
.segmented button {
  height: 28px; min-width: 36px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font: 700 .8125rem/1 var(--sans); cursor: pointer;
}
.segmented button:hover { color: var(--ink); background: var(--head); }
.segmented button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20, 30, 40, .12); }
[data-theme="dark"] .segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--link); box-shadow: none; }
.segmented button[aria-disabled="true"] { cursor: not-allowed; }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }
.toolbar .icon-btn { width: 36px; height: 36px; }
.work { flex: 1; min-height: 0; display: flex; background: var(--line); }
.col { flex: 1 1 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--line); }
.pane { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--panel); }
.split { flex: none; height: 7px; background: var(--line); cursor: row-resize; touch-action: none; }
.vsplit { flex: none; width: 7px; background: var(--line); cursor: col-resize; touch-action: none; }
.split:hover, .split.active, .split:focus-visible,
.vsplit:hover, .vsplit.active, .vsplit:focus-visible { background: var(--accent); outline: none; }
.pane h2 { margin: 0; padding: 4px 8px 4px 12px; font-size: .8125rem; font-weight: 650; letter-spacing: 0; color: var(--muted); background: var(--head);
           display: flex; justify-content: space-between; align-items: center; min-height: 30px; }
.pane .body { flex: 1; min-height: 0; position: relative; }
.body .CodeMirror { position: absolute; inset: 0; height: auto; font: var(--code-size)/1.55 var(--mono); }
#frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; color-scheme: light; }
.console { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px; background: var(--term); color: var(--term-ink); font: calc(var(--code-size) - 1px)/1.5 var(--mono); }
.console:empty::before { content: "Šeit parādīsies console.log() izvade"; color: #6c7a89; font-family: var(--sans); }
.console .line { white-space: pre-wrap; word-break: break-word; padding: 1px 0; }
.console .warn { color: #f2c46d; }
.console .error { color: #ff8b7f; }

[data-theme="dark"] .CodeMirror { background: var(--panel); color: var(--ink); }
[data-theme="dark"] .CodeMirror-gutters { background: var(--head); border-right: 1px solid var(--line); }
[data-theme="dark"] .CodeMirror-linenumber { color: #6f7d8c; }
[data-theme="dark"] .CodeMirror-cursor { border-left-color: var(--ink); }
[data-theme="dark"] .CodeMirror-selected { background: #2b3850; }
[data-theme="dark"] .CodeMirror-focused .CodeMirror-selected { background: #33466b; }
[data-theme="dark"] .cm-s-default .cm-keyword { color: #c792ea; }
[data-theme="dark"] .cm-s-default .cm-atom,
[data-theme="dark"] .cm-s-default .cm-number,
[data-theme="dark"] .cm-s-default .cm-string-2 { color: #f78c6c; }
[data-theme="dark"] .cm-s-default .cm-def,
[data-theme="dark"] .cm-s-default .cm-builtin,
[data-theme="dark"] .cm-s-default .cm-property { color: #82aaff; }
[data-theme="dark"] .cm-s-default .cm-variable-2 { color: #7fdbca; }
[data-theme="dark"] .cm-s-default .cm-variable-3,
[data-theme="dark"] .cm-s-default .cm-type,
[data-theme="dark"] .cm-s-default .cm-meta,
[data-theme="dark"] .cm-s-default .cm-qualifier,
[data-theme="dark"] .cm-s-default .cm-attribute { color: #ffcb6b; }
[data-theme="dark"] .cm-s-default .cm-comment { color: #7f8ea3; }
[data-theme="dark"] .cm-s-default .cm-string { color: #c3e88d; }
[data-theme="dark"] .cm-s-default .cm-bracket { color: #9aa7b5; }
[data-theme="dark"] .cm-s-default .cm-tag { color: #ff8b9a; }
[data-theme="dark"] .cm-s-default .cm-operator { color: #89ddff; }

.trash-block { margin-bottom: 20px; }
.trash-block .sname, .trash-block .sub { display: block; }
.trash-block .sub { font-size: .8125rem; color: var(--muted); }

.dlg {
  width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
}
.dlg::backdrop { background: rgba(15, 22, 32, .45); backdrop-filter: blur(2px); }
.dlg h2 { font-size: 1.25rem; margin: 0 0 8px; }
.dlg-text { color: var(--muted); margin: 0 0 22px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dlg[open] { animation: dlg-in .16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px; border-radius: 12px; background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow); animation: toast-in .2s ease-out;
}
.toast form { margin: 0; }
.toast .btn.small { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 45%, transparent); }
.toast .toast-x { width: 30px; height: 30px; background: transparent; border: 0; color: var(--bg); font-size: 1.25rem; }
.toast.out { opacity: 0; transition: opacity .2s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }

.fsize button { min-width: 30px; padding: 0 7px; }
.fs-val { min-width: 2.6ch; text-align: center; font: 700 .8125rem/1 var(--sans); font-variant-numeric: tabular-nums; }

.groups { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9375rem; cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip span { color: var(--muted); font-weight: 500; font-size: .8125rem; }
.chip .ico { width: 15px; height: 15px; }
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-current="page"] span { color: inherit; opacity: .7; }
.chip.ghost { border-style: dashed; color: var(--muted); background: transparent; }
.pop.left { left: 0; right: auto; }
.group-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.group-head h2 { margin: 0; }
.group-tools { display: flex; align-items: center; gap: 8px; }
.gsel {
  font: inherit; font-size: .875rem; padding: 5px 8px; max-width: 150px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); color: var(--ink);
}
.gsel.wide { display: block; width: 100%; max-width: none; margin-top: 6px; padding: 9px 10px; font-size: 1rem; font-weight: 400; }

.hist {
  width: min(980px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px)); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
}
.hist[open] { display: flex; flex-direction: column; }
.hist::backdrop { background: rgba(15, 22, 32, .45); }
.hist-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.hist-head > div { flex: 1; min-width: 0; }
.hist-head h2 { margin: 0 0 2px; font-size: 1.25rem; }
.hist-head p { margin: 0; }
.hist-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.hist-list { list-style: none; margin: 0; padding: 10px; overflow: auto; border-right: 1px solid var(--line); }
.hist-list li.muted { padding: 10px; font-size: .9375rem; }
.hist-list button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 2px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; cursor: pointer;
}
.hist-list button:hover { background: var(--head); }
.hist-list button[aria-current] { background: var(--accent-soft); color: var(--link); }
.hist-list strong { display: block; font-size: .9375rem; }
.hist-list span { display: block; font-size: .8125rem; color: var(--muted); }
.hist-view { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; padding: 14px 16px 16px; }
.hist-tabs { display: flex; gap: 6px; }
.hist-code {
  flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 12px 14px; tab-size: 2;
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  font: calc(var(--code-size) - 1px)/1.55 var(--mono); white-space: pre;
}
#hist-restore { align-self: flex-end; }

.log-filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 14px; align-items: end;
  padding: 16px 18px; margin-bottom: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.log-filters label { margin: 0; font-size: .8125rem; }
.log-filters input, .log-filters .gsel.wide { margin-top: 5px; padding: 8px 10px; font-size: .9375rem; }
.log-filters label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; padding-bottom: 9px; }
.log-filters label.check input { width: auto; margin: 0; }
.log-filter-actions { display: flex; gap: 8px; }
.log-count { margin: 0 0 8px; }
.logtable { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.logtable th { text-align: left; font-size: .8125rem; font-weight: 600; color: var(--muted); padding: 6px 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.logtable td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.logtable tbody tr:last-child td { border-bottom: 0; }
.logtable tr.is-bad td { background: color-mix(in srgb, var(--bad-bg) 70%, transparent); }
.logtable a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.logtable a:hover { color: var(--link); }
.logtable .sub { display: block; font-size: .8125rem; color: var(--muted); }
.logtable .obj { min-width: 160px; }
.nowrap { white-space: nowrap; }
.ev { display: inline-flex; align-items: baseline; gap: 7px; }
.ev::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transform: translateY(-1px); }
.ev.ok::before { background: var(--ok); }
.ev.warn::before { background: var(--warn); }
.ev.bad::before { background: var(--danger); }
.ev.bad { color: var(--danger); font-weight: 600; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.table-scroll:has(.logtable) { overflow-x: auto; }

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 24px; margin: -8px 0 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.setting-row h2 { margin: 0 0 2px; font-size: 1.0625rem; }
.setting-row p { margin: 0; }
.setting-row form { gap: 10px; flex: none; }
.state-lbl { font-weight: 700; font-size: .875rem; }

.ftabs-wrap { display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 6px; background: var(--head); border-bottom: 1px solid var(--line); }
.ftabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.ftab {
  flex: none; height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font: 600 .8125rem/1 var(--mono); cursor: pointer; white-space: nowrap;
}
.ftab:hover { color: var(--ink); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.ftab[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.ftab.dirty::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.ftools { display: flex; gap: 2px; flex: none; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.small .ico { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.navpath { margin-left: 6px; font: 600 .75rem var(--mono); color: var(--ink); }
.navpath:empty { display: none; }
.pane h2 .btn.small { padding: 3px 9px; }
.frame-msg { margin: 0; padding: 18px; color: var(--muted); font-size: .9375rem; }
.ptag {
  position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--link); font-size: .75rem; font-weight: 700;
}
.type-sel { flex: none; width: auto; max-width: none; padding: 9px 10px; font-size: .9375rem; }
.code, .mono, .pcode, .mock-code, .console, .CodeMirror, .body .CodeMirror, textarea.code, .hist-code, .ftab {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

@media (max-width: 1180px) {
  .toolbar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .toolbar kbd { display: none; }
  .tb-btn { padding: 0 10px; }
  .tb-btn.primary { padding: 0 13px; }
  .tb-btn.ghost { padding: 0 8px; }
}

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .add-card { position: static; }
  .empty { grid-template-columns: 1fr; }
  .mock { transform: none; max-width: 520px; }
  .auth-wrap { grid-template-columns: 1fr; align-content: center; min-height: auto; padding-top: 48px; }
  .giant { font-size: clamp(2.75rem, 13vw, 4.5rem); margin: 18px 0 12px; }
}
@media (max-width: 800px) {
  .work { flex-direction: column; }
  .vsplit { display: none; }
}
@media (max-width: 640px) {
  .bar { gap: 12px; }
  .brand span, .who { display: none; }
  .newform, .newform.compact { width: 100%; }
  .newform.compact input { flex: 1; width: auto; }
  .empty .newform { flex-direction: column; }
  .bar { gap: 8px; padding-left: 12px; padding-right: 12px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav a { padding: 6px 8px; }
  .bar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bar .btn.ghost { padding: 9px; }
  .wrap { padding-top: 24px; }
  .roster-card, .add-card { padding: 16px; }
  .table-scroll { margin: 0; }
  .roster thead { display: none; }
  .roster, .roster tbody, .roster tr, .roster td { display: block; }
  .roster tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .roster tbody tr:last-child { border-bottom: 0; }
  .roster td { padding: 5px 0; border: 0; }
  .roster td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .roster td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .875rem; }
  .roster .actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; padding-top: 8px; }
  details.pw { flex: 1; }
  .pop { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .pgrid { grid-template-columns: 1fr; }
  .empty { margin-bottom: 40px; }
  .hist-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .hist-list { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .gsel { max-width: 60vw; }
  .access { grid-template-columns: auto 1fr; }
  .access form { grid-column: 1 / -1; }
  .access .btn.big { width: 100%; }
  h1 { font-size: 1.875rem; }
}
@media (prefers-reduced-motion: reduce) {
  .typed { animation: none; width: 33ch; border-right-color: transparent; }
  .mock-console .out { animation: none; }
  .switch .knob { transition: none; }
  .dlg[open], .toast { animation: none; }
}
@media print {
  body { background: #fff !important; color: #000; }
  body * { visibility: hidden; }
  .flash, .flash * { visibility: visible; }
  .flash { position: absolute; inset: 0 auto auto 0; border: 0; padding: 0; }
  .flash .btn, .flash .muted { display: none; }
}
