/* Trizona Panel: dunkle Oberfläche in den Trizona-Farben, ohne Schatten, ohne Glow, Ecken höchstens 4 px. */

:root {
  --bg: #0d1310;
  --surface: #141c17;
  --surface-raised: #18231c;
  --line: #1b7a3a;
  --line-dim: #223128;
  --text: #ffffff;
  --body: #b4c0b8;
  --label: #9be7a5;
  --accent: #3ddc84;
  --dim: #5f8f6a;
  --error: #ff5555;
  --brand-from: #00c853;
  --brand-to: #b2ff59;
  --radius: 3px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  min-width: 320px;
}

a {
  color: var(--label);
}

a:hover {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
  color: var(--label);
}

p {
  margin: 0 0 12px;
}

code,
pre,
textarea.code {
  font-family: var(--mono);
  font-size: 13px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Schriftzug */

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark-brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wordmark-product {
  color: var(--body);
  font-weight: 500;
}

/* Kopfzeile und Navigation */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px var(--gap);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar .wordmark {
  font-size: 18px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 auto;
}

.nav a {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--body);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
  border-color: var(--line-dim);
}

.nav a[aria-current="page"] {
  color: var(--text);
  border-color: var(--line);
}

.account-box {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-size: 13px;
}

.account-box .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

/* Seitenaufbau */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--gap);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.page-head h1 {
  margin: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}

.muted {
  color: var(--dim);
}

.body-text {
  color: var(--body);
}

.label {
  color: var(--label);
}

.mono {
  font-family: var(--mono);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.spread {
  justify-content: space-between;
}

/* Meldungen */

.banner {
  border: 1px solid var(--error);
  border-radius: var(--radius);
  color: var(--error);
  padding: 10px 12px;
  margin-bottom: var(--gap);
}

.banner .muted {
  display: block;
  margin-top: 2px;
}

.hint {
  border-left: 2px solid var(--line);
  padding: 4px 0 4px 10px;
  color: var(--body);
  margin-bottom: var(--gap);
}

.hint.warning {
  border-left-color: var(--error);
}

.message {
  min-height: 1.45em;
  margin: 8px 0 0;
  font-size: 14px;
}

.message.error {
  color: var(--error);
}

.message.ok {
  color: var(--accent);
}

.notice {
  position: fixed;
  right: var(--gap);
  bottom: var(--gap);
  left: var(--gap);
  margin: 0 auto;
  max-width: 480px;
  padding: 10px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  z-index: 10;
}

.notice.error {
  border-color: var(--error);
  color: var(--error);
}

/* Formulare und Knöpfe */

label {
  display: block;
  color: var(--label);
  font-size: 13px;
  margin-bottom: 4px;
}

.field {
  margin-bottom: 12px;
}

/* Passwortfeld mit Auge rechts im Feld. */
.password-wrap {
  position: relative;
}

.password-wrap input[type] {
  padding-right: 38px;
}

/* Edge bringt ein eigenes Auge mit; sonst stünden zwei im Feld. */
.password-wrap input::-ms-reveal {
  display: none;
}

.password-wrap .reveal {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.password-wrap .reveal:hover,
.password-wrap .reveal[aria-pressed="true"] {
  color: var(--label);
}

.password-wrap .reveal:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: -3px;
}

.field-hint {
  color: var(--dim);
  font-size: 13px;
  margin-top: 4px;
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--dim);
}

.button {
  display: inline-block;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.35;
}

.button:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

.button.danger {
  border-color: var(--error);
  color: var(--error);
}

.button.danger:hover {
  background: #2a1414;
}

.button.small {
  padding: 3px 8px;
  font-size: 13px;
}

.button.link {
  border-color: transparent;
  background: transparent;
  color: var(--label);
  padding-left: 0;
  padding-right: 0;
}

.button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--line-dim);
  color: var(--dim);
  cursor: default;
  background: var(--surface);
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input {
  flex: 1 1 auto;
  min-width: 0;
}

/* Login */

.login-page {
  display: flex;
  justify-content: center;
  padding: 48px var(--gap);
}

.login-box {
  width: 100%;
  max-width: 380px;
}

.login-box .wordmark {
  font-size: 22px;
  margin-bottom: 20px;
}

.login-box .button.primary {
  width: 100%;
  margin-top: 4px;
}

.qr {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  margin: 8px 0 12px;
  border-radius: var(--radius);
}

.secret {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 12px;
}

input.code-input {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.3em;
}

/* Tabellen */

.table-wrap {
  overflow-x: auto;
}

table.list {
  width: 100%;
  border-collapse: collapse;
}

table.list th {
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--label);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.list td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-dim);
  vertical-align: middle;
}

table.list tbody tr:hover {
  background: var(--surface-raised);
}

table.list tr.clickable {
  cursor: pointer;
}

table.list td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.list td.actions {
  text-align: right;
}

table.list td.actions .row {
  justify-content: flex-end;
}

table.list td.wrap {
  word-break: break-word;
}

.empty {
  color: var(--dim);
  padding: 12px 10px;
}

/* Status */

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}

.dot.running {
  background: var(--accent);
}

.dot.starting {
  background: transparent;
  border: 1px solid var(--label);
}

.state.stopped {
  color: var(--dim);
}

.tag {
  display: inline-block;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  padding: 0 5px;
  margin-left: 6px;
  white-space: nowrap;
}

.tag.warning {
  color: var(--error);
  border-color: var(--error);
}

.service-name {
  color: var(--text);
  font-weight: 500;
}

/* Logs und Konsole */

.log {
  margin: 0;
  height: 55vh;
  min-height: 240px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  color: var(--body);
  white-space: pre-wrap;
  word-break: break-word;
}

.log .log-line {
  display: block;
}

.log .log-status {
  display: block;
  color: var(--dim);
}

.log .log-status.error {
  color: var(--error);
}

.log .log-own {
  display: block;
  color: var(--label);
}

.console-bar {
  margin-top: 8px;
}

.console-bar input {
  font-family: var(--mono);
}

.console-bar.danger input {
  border-color: #5a2626;
}

.command-area {
  position: relative;
}

/* Vorschläge der Vervollständigung, über der Befehlszeile: Die steht meist am unteren Rand der Seite. */
.completions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  z-index: 5;
  max-height: 220px;
  overflow-y: auto;
  margin: 0 0 2px;
  padding: 4px 0;
  list-style: none;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
}

.completions li {
  padding: 3px 10px;
  color: var(--text);
  cursor: pointer;
}

.completions li:hover,
.completions li[aria-selected="true"] {
  background: var(--line-dim);
}

.completions li[aria-selected="true"] {
  color: var(--label);
}

.completions li.hint {
  color: var(--dim);
  cursor: default;
}

.completions li.hint:hover {
  background: none;
}

.socket-state {
  font-size: 13px;
  color: var(--dim);
}

.socket-state.error {
  color: var(--error);
}

/* Dateien */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar select {
  width: auto;
  min-width: 140px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 12px;
  word-break: break-all;
}

.crumbs .sep {
  color: var(--dim);
}

.crumbs .button.link {
  font-family: var(--mono);
  font-size: 13px;
  padding: 0;
  white-space: normal;
}

.crumbs .current {
  color: var(--text);
}

.dropzone {
  border: 1px dashed var(--line-dim);
  border-radius: var(--radius);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--surface-raised);
}

.drop-hint {
  color: var(--dim);
  font-size: 13px;
  padding: 8px 10px 0;
}

.entry-name {
  word-break: break-word;
}

.entry-name .button.link {
  text-align: left;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
}

.entry-name .button.link:hover {
  color: var(--accent);
}

.upload-state {
  margin-bottom: 12px;
}

progress {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line-dim);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--bg);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

textarea.code {
  display: block;
  min-height: 60vh;
  resize: vertical;
  white-space: pre;
  overflow: auto;
  overflow-wrap: normal;
  tab-size: 4;
  line-height: 1.5;
}

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-path {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

/* Benutzer */

.one-time {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: var(--gap);
}

.one-time .secret {
  margin: 8px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 160px) auto;
  gap: 8px;
  align-items: end;
}

.form-grid .field {
  margin: 0;
}

.form-grid.audit-filter {
  grid-template-columns: minmax(0, 1fr) minmax(0, 240px) minmax(0, 110px) auto;
}

select.compact {
  width: auto;
  padding: 3px 6px;
  font-size: 13px;
}

/* Dialog */

dialog {
  width: calc(100% - 2 * var(--gap));
  max-width: 440px;
  padding: var(--gap);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

dialog.danger {
  border-color: var(--error);
}

dialog::backdrop {
  background: rgba(5, 8, 6, 0.75);
}

dialog .dialog-text {
  color: var(--body);
}

dialog .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: var(--gap);
}

/* Schmale Bildschirme: Tabellen werden zu gestapelten Zeilen. */

@media (max-width: 720px) {
  .page {
    padding: 12px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .account-box {
    width: 100%;
    justify-content: space-between;
  }

  .stack thead {
    display: none;
  }

  .stack,
  .stack tbody,
  .stack tr,
  .stack td {
    display: block;
    width: 100%;
  }

  .stack tr {
    border-bottom: 1px solid var(--line-dim);
    padding: 8px 0;
  }

  table.list.stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 0;
    padding: 3px 4px;
    text-align: right;
  }

  table.list.stack td::before {
    content: attr(data-label);
    color: var(--label);
    font-size: 13px;
    text-align: left;
    flex: none;
  }

  table.list.stack td.actions {
    display: block;
    padding-top: 6px;
  }

  table.list.stack td.actions::before {
    content: none;
  }

  table.list.stack td.actions .row {
    justify-content: flex-start;
  }

  table.list.stack td.lead {
    justify-content: flex-start;
    text-align: left;
  }

  table.list.stack td.lead::before {
    content: none;
  }

  .form-grid,
  .form-grid.audit-filter {
    grid-template-columns: minmax(0, 1fr);
  }

  .log {
    height: 50vh;
  }
}
