/* Colours: teal accent on cool greys; light, dark and "auto" (system).
   theme.js sets data-theme when the operator picked one. */
:root {
  color-scheme: light;
  --bg: #f2f5f4; --panel: #ffffff; --text: #15211f; --muted: #566763; --line: #d7e0dd;
  --field: #f8faf9; --accent: #0b7366; --accent-hover: #095f55; --accent-text: #ffffff; --accent-soft: #dff1ed;
  --side-bg: #11302b; --side-text: #e1efec; --side-muted: #9dbdb6; --side-current: #1f4b44; --side-line: #24453f;
  --warn-bg: #fff3d6; --warn-text: #6f4500; --bad-bg: #fde7e7; --bad-text: #a11d1d; --ok-bg: #e2f4e9; --ok-text: #136a3f;
  --shadow: 0 1px 2px rgb(16 40 36 / 6%), 0 2px 8px rgb(16 40 36 / 5%);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1413; --panel: #151f1d; --text: #e3edea; --muted: #97aca7; --line: #283734;
  --field: #101917; --accent: #3cc4b2; --accent-hover: #63d5c6; --accent-text: #032420; --accent-soft: #143a35;
  --side-bg: #091010; --side-text: #dcebe7; --side-muted: #86a39c; --side-current: #17352f; --side-line: #1b2c29;
  --warn-bg: #3a2c10; --warn-text: #f3d08e; --bad-bg: #421c1c; --bad-text: #f6b4b4; --ok-bg: #12301f; --ok-text: #7fd8a5;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1413; --panel: #151f1d; --text: #e3edea; --muted: #97aca7; --line: #283734;
    --field: #101917; --accent: #3cc4b2; --accent-hover: #63d5c6; --accent-text: #032420; --accent-soft: #143a35;
    --side-bg: #091010; --side-text: #dcebe7; --side-muted: #86a39c; --side-current: #17352f; --side-line: #1b2c29;
    --warn-bg: #3a2c10; --warn-text: #f3d08e; --bad-bg: #421c1c; --bad-text: #f6b4b4; --ok-bg: #12301f; --ok-text: #7fd8a5;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 0.9375rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
#root { container: app / inline-size; min-height: 100vh; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
/* The page title is a display heading: capped so "Einstellungen" fits at 200 % text on a phone. */
h1 { font-size: min(1.375rem, 30px); margin: 0 0 1rem; hyphens: auto; }
h2 { font-size: 1.0625rem; margin: 0 0 0.75rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App shell: a sidebar from 56em, a top bar below. */
.shell { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); padding: 0.75rem 1rem; display: flex; flex-wrap: wrap; align-items: center; align-content: start; gap: 0.5rem 1rem; }
.brand { font-weight: 700; font-size: 1.0625rem; color: var(--side-text); text-decoration: none; margin-right: auto; display: flex; align-items: center; gap: 0.5rem; }
.brand-mark { display: inline-grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 0.5em; background: var(--accent); color: var(--accent-text); font-size: 0.875rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.15rem; order: 2; flex-basis: 100%; margin: 0 -0.55rem; }
.side-status { display: flex; flex-wrap: wrap; gap: 0.4rem; order: 3; flex-basis: 100%; }
.side-status:empty { display: none; }
.nav a { color: var(--side-text); text-decoration: none; padding: 0.35rem 0.55rem; border-radius: 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.nav a:hover { background: var(--side-current); }
.nav a[aria-current="page"] { background: var(--side-current); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
.badge { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 0 0.5em; font-size: 0.75rem; font-weight: 700; }
.side-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; order: 1; }
.side .chip { background: transparent; border-color: var(--side-line); color: var(--side-muted); }
.side .chip.ok { color: var(--side-text); background: transparent; border-color: var(--accent); }
.side .chip.locked { color: var(--warn-text); background: var(--warn-bg); border-color: transparent; text-decoration: none; }
.side button { background: transparent; color: var(--side-text); border-color: var(--side-line); min-height: 2.25rem; padding: 0.3rem 0.7rem; }
.side button:hover { background: var(--side-current); }
.content { padding: 1rem; min-width: 0; }
.content-inner { max-width: 70rem; margin: 0 auto; }

@container app (min-width: 56em) {
  .shell { grid-template-columns: 15rem 1fr; grid-template-rows: 1fr; }
  .side { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 1.25rem; padding: 1.25rem 0.875rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .brand { margin-right: 0; padding: 0 0.5rem; }
  .nav { flex-direction: column; flex-basis: auto; order: 0; margin: 0; }
  .nav a { padding: 0.5rem 0.75rem; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .side-status { order: 0; flex-basis: auto; flex-direction: column; align-items: stretch; margin-top: auto; }
  .side-status .chip { text-align: center; }
  .side-foot { order: 0; display: grid; grid-template-columns: 1fr 1fr; }
  .side-foot button { justify-content: center; }
  .content { padding: 1.75rem 2rem; }
}

/* Cards and common parts. */
section.card { background: var(--panel); border: 1px solid var(--line); border-radius: 0.75rem; padding: 1rem 1.125rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
section.card.hero { border-color: var(--accent); border-width: 2px; }
/* E-mail addresses, file names and links are single tokens: they may break anywhere. */
section.card { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.8125rem; overflow-wrap: anywhere; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row + .row, form + form, .block { margin-top: 0.75rem; }
.grow { flex: 1 1 11rem; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
label.field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); font-weight: 600; min-width: 0; }
label.field > input, label.field > select { font-weight: 400; color: var(--text); font-size: 0.9375rem; width: 100%; }
label.check { display: inline-flex; gap: 0.4rem; align-items: center; }
button, .button { font: inherit; padding: 0.45rem 0.9rem; border-radius: 0.5rem; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.5rem; }
button:hover, .button:hover { border-color: var(--accent); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--bad-text); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 0.45rem 0.6rem; border-radius: 0.5rem; border: 1px solid var(--line); background: var(--field); color: var(--text); max-width: 100%; min-height: 2.5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
input[type="checkbox"] { min-height: 0; width: 1.1em; height: 1.1em; accent-color: var(--accent); }
textarea { width: 100%; min-height: 4.5rem; }
details > summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 0.25rem 0; }
details[open] > summary { margin-bottom: 0.5rem; }
pre { background: var(--field); border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.5rem; overflow: auto; max-height: 22.5rem; margin: 0.5rem 0 0; font-size: 0.78rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.scroll { overflow-x: auto; }
.chip { display: inline-block; padding: 0.05rem 0.6rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 0.8125rem; }
.chip.ok { color: var(--ok-text); background: var(--ok-bg); border-color: transparent; }
.chip.live { color: var(--accent-text); background: var(--accent); border-color: transparent; }
.note { padding: 0.6rem 0.75rem; border-radius: 0.5rem; margin-top: 0.75rem; background: var(--accent-soft); }
.note.warn { background: var(--warn-bg); color: var(--warn-text); }
.note.bad { background: var(--bad-bg); color: var(--bad-text); }
.big { font-size: 2.5rem; font-weight: 650; letter-spacing: .06em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.error { color: var(--bad-text); margin-top: 0.4rem; }
.error:empty { margin: 0; }
.login { max-width: 24rem; width: calc(100% - 2rem); margin: 12vh auto 0; }
.login input { width: 100%; }

/* Lists of customers, sessions and passkeys: rows that wrap instead of a wide table. */
.list { display: flex; flex-direction: column; }
.item { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0.25rem; }
.item-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.item-head .title { font-weight: 650; flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.item-head .title a { color: inherit; }
.meta { display: flex; flex-wrap: wrap; gap: 0.15rem 1rem; color: var(--muted); font-size: 0.8125rem; }
.options { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.options > .field { flex: 1 1 9rem; }
.quick { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.quick > .field { flex: 1 1 14rem; }
.share { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.share input { flex: 1 1 16rem; min-width: 0; }

/* Session page. */
.action { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.action:last-child { border-bottom: 0; }
.action .title { flex: 1 1 13.75rem; }
.log { max-height: 15rem; overflow: auto; font-size: 0.8125rem; }
.log div { padding: 1px 0; overflow-wrap: anywhere; }
.screen-wrap { margin-top: 0.75rem; background: #000; border-radius: 0.5rem; overflow: hidden; line-height: 0; }
canvas { width: 100%; height: auto; display: block; outline: none; }
canvas.control { cursor: crosshair; }
canvas.control:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.chat { max-height: 16.25rem; overflow: auto; font-size: 0.875rem; border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.4rem 0.5rem; margin-bottom: 0.5rem; }
.chat-line { padding: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-line.theirs { border-left: 3px solid var(--accent); padding-left: 0.4rem; }
/* Terminal panel (tasks/006 B2, B3). */
input.narrow { width: 5em; flex: none; }
pre.terminal { white-space: pre; overflow-wrap: normal; max-height: 30rem; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.8125rem; }
