/* oneline bot-net Terminal – Konzept A (80er-Terminal). Schrift VT323 (OFL 1.1), lokal. */
@font-face {
  font-family: 'VT323';
  src: url('../fonts/VT323-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #3ff2c8;      /* türkis-grün */
  --hi: #b6fff0;      /* hell */
  --dim: #22a386;     /* gedimmt, Kontrast > 6:1 auf Schwarz */
  --line: #145c4c;
  --warn: #ffb000;
  --err: #ff7a66;
  --fs: 22px;
  --pad: 14px 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  font-family: 'VT323', ui-monospace, 'DejaVu Sans Mono', monospace;
  font-size: var(--fs);
  line-height: 1.2;
  text-transform: uppercase;            /* Oberflächenelemente in Großbuchstaben */
  text-shadow: 0 0 4px rgba(63, 242, 200, .45);
  -webkit-font-smoothing: none;
}
/* Scanlines (dezent, rein dekorativ) */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .2) 0 2px, transparent 2px 4px);
}

/* Inhalte in normaler Schreibweise: Nachrichtentext, Eingaben, Namen von Dateien, Themen */
.msg-text, .free, input, textarea, select option { text-transform: none; }
body.caps .msg-text, body.caps .order-title { text-transform: uppercase; }

a { color: var(--fg); }
a:hover { color: var(--hi); }
.link { color: var(--hi); text-decoration: underline; word-break: break-all; }
.mention { color: var(--hi); }
.dim { color: var(--dim); }
.warn { color: var(--warn); }
.mono { font-family: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--fg); color: #000; padding: 4px 8px; z-index: 200; }
.skip:focus { left: 8px; }
hr { border: 0; border-top: 2px solid var(--fg); margin: 8px 0; opacity: .8; }
h1, h2 { font-weight: normal; margin: 0; font-size: 1em; }

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

/* Bedienelemente */
button, .btn {
  font: inherit; color: var(--fg); background: transparent; text-transform: uppercase; text-shadow: inherit;
  border: 2px solid var(--fg); padding: 0 10px; cursor: pointer; min-height: 32px; line-height: 1.1;
}
button:hover:not(:disabled) { background: var(--fg); color: #000; text-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-hi { color: var(--hi); border-color: var(--hi); }
.btn-warn { color: var(--warn); border-color: var(--warn); }
.btn-warn:hover:not(:disabled) { background: var(--warn); color: #000; }
.mini { font-size: .85em; min-height: 28px; padding: 0 8px; border-width: 1px; }
.link-btn { border: 0; padding: 2px 0; color: var(--dim); min-height: 28px; text-align: left; }
.link-btn:hover:not(:disabled) { background: transparent; color: var(--hi); }
input, textarea, select {
  font: inherit; color: var(--hi); background: #000; border: 0; border-bottom: 2px solid var(--line);
  padding: 2px 4px; min-height: 32px; border-radius: 0; text-shadow: inherit;
}
input:focus, textarea:focus, select:focus { border-bottom-color: var(--fg); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 1px dashed var(--hi); outline-offset: 1px; }
select option:disabled { color: #5d6e69; }
::placeholder { color: var(--dim); opacity: 1; }
.tag { font-size: .8em; border: 1px solid currentColor; padding: 0 4px; margin-left: 6px; }

.boot { padding: 24px; }
.demo-banner { background: var(--warn); color: #000; text-shadow: none; text-align: center; padding: 2px 8px; font-size: .85em; }

/* Layout */
.app { height: 100%; }
.demo-banner:not([hidden]) + .app { height: calc(100% - 28px); }
.wrap { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; height: 100%; padding: var(--pad); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--hi); }
.brand { color: var(--hi); }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-a { text-decoration: none; color: var(--dim); }
.nav-a.on, .nav-a:hover { color: var(--hi); }
.nav-a.on { text-decoration: underline; text-underline-offset: 4px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn.c-getrennt, .c-getrennt { color: var(--warn); }
.conn.c-verbinde, .c-verbinde { color: var(--dim); }
.menu-btn { display: none; }
.caps-short, .brand-short { display: none; }

.main { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 26px; min-height: 0; }
.ch { border-right: 2px solid var(--line); padding-right: 14px; overflow: auto; min-height: 0; }
.side-h { color: var(--dim); margin: 4px 0 6px; }
.side-h ~ .side-h { margin-top: 16px; }
.ch-list, .bot-list { list-style: none; margin: 0; padding: 0; }
.ch-item { display: block; padding: 2px 6px 2px 0; text-decoration: none; }
.ch-item.on { background: var(--fg); color: #000; text-shadow: none; padding-left: 6px; }
.ch-item .unread { color: var(--warn); font-size: .9em; }
.ch-item.on .unread { color: #000; }
.bot { display: flex; padding: 2px 0; }
.bot .dots { color: var(--dim); flex: 1; overflow: hidden; }
.bot.st-busy .st, .bot.st-working .st, .bot.st-arbeitet .st { color: var(--warn); }
.bot.st-offline .st { color: var(--dim); }
.archive { margin-top: 12px; color: var(--dim); }
.archive summary { cursor: pointer; }
.scrim { display: none; }

.content { min-height: 0; min-width: 0; display: grid; }
.view { min-height: 0; min-width: 0; display: grid; }

/* Chat */
.chat { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-height: 0; }
.chan-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.chan-name { color: var(--hi); }
.topic { color: var(--dim); flex: 1; min-width: 120px; }
.chan-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.log { overflow: auto; min-height: 0; padding-right: 6px; overscroll-behavior: contain; }
.log:focus-visible { outline-offset: -2px; }
.older { display: block; margin: 0 auto 8px; }
.day { color: var(--dim); text-align: center; margin: 8px 0; font-size: .85em; }
.m { margin: 0 0 10px; }
.m .line { overflow-wrap: anywhere; }
.m .t { color: var(--dim); }
.m .who { color: var(--hi); }
.m .chn { color: var(--dim); }
.m .msg-text { white-space: pre-wrap; }
.m.own .who { color: var(--warn); }
.m.sys .who, .m.sys .msg-text { color: var(--dim); }
.m.local { font-size: .9em; }
.m.order { border: 2px solid var(--fg); padding: 4px 10px 6px; margin: 12px 0; }
.m.order.verified { border-color: var(--hi); box-shadow: 0 0 6px rgba(182, 255, 240, .35) inset; }
.m.order.unverified { border-color: var(--warn); border-style: dashed; }
.order-head { display: flex; flex-wrap: wrap; gap: 0 4px; }
.order-badge { background: var(--hi); color: #000; text-shadow: none; padding: 0 6px; }
.m.order.unverified .order-badge { background: var(--warn); }
.order-meta { color: var(--hi); }
.order-title { color: var(--hi); margin: 2px 0 4px; font-size: 1.05em; }
.att { display: flex; gap: 10px; align-items: center; margin: 4px 0 0 86px; border: 2px dashed var(--fg); padding: 2px 10px; width: fit-content; max-width: calc(100% - 86px); }
.att-link { text-decoration: none; overflow-wrap: anywhere; }
.att-link:hover { text-decoration: underline; }
.att-thumb img { display: block; width: 160px; height: 100px; object-fit: contain; background: #000; border: 1px solid var(--line); }
.alert { color: var(--warn); min-height: 0; margin: 4px 0 0; }
.alert:empty { display: none; }
.empty { padding: 20px; color: var(--dim); }

/* Eingabezeile */
.composer { border-top: 2px solid var(--fg); padding-top: 8px; margin-top: 6px; }
.composer.is-order { border-top-color: var(--hi); }
.in { display: flex; gap: 8px 10px; align-items: flex-start; flex-wrap: wrap; }
.in .p, .p { color: var(--hi); white-space: nowrap; padding-top: 3px; }
.modes { display: flex; }
.mode { border-width: 1px; font-size: .85em; min-height: 32px; color: var(--dim); border-color: var(--line); }
.mode + .mode { border-left: 0; }
.mode.on { background: var(--fg); color: #000; text-shadow: none; border-color: var(--fg); }
.ta-wrap { position: relative; flex: 1 1 260px; min-width: 0; display: flex; }
.btns { margin-left: auto; }
.cmd { flex: 1; resize: none; border-bottom-color: transparent; caret-color: var(--fg); caret-shape: block; line-height: 1.2; overflow-y: auto; max-height: 220px; }
.cmd:focus { border-bottom-color: var(--line); }
.cur { display: inline-block; width: .6em; height: 1em; background: var(--fg); vertical-align: -3px; animation: blink 1s steps(1) infinite; box-shadow: 0 0 6px rgba(63, 242, 200, .6); }
.ta-wrap .cur { position: absolute; left: 6px; top: 7px; pointer-events: none; display: none; }
.cmd:placeholder-shown:not(:focus) + .cur { display: inline-block; }
.cmd:placeholder-shown:not(:focus)::placeholder { color: transparent; text-shadow: none; }
@keyframes blink { 50% { opacity: 0; } }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.counter { color: var(--dim); font-size: .8em; }
.counter:empty { display: none; }
.order-fields { border: 2px solid var(--hi); padding: 6px 10px; margin-bottom: 8px; }
.order-row { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.order-row input { flex: 1; min-width: 180px; }
.order-row .lbl { color: var(--dim); }
.order-hint { margin: 2px 0 0; font-size: .9em; }
.pending { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 4px; }
.pend { display: flex; align-items: center; gap: 10px; border: 2px dashed var(--fg); padding: 2px 8px; flex-wrap: wrap; }
.pend.st-err { border-color: var(--warn); }
.pend .pv { width: 48px; height: 36px; object-fit: cover; border: 1px solid var(--line); }
.pend-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bar { display: inline-block; width: 120px; height: 10px; border: 1px solid var(--fg); }
.bar .fill { display: block; height: 100%; width: 0; background: var(--fg); }
.dropzone { display: none; position: absolute; inset: 0; border: 3px dashed var(--hi); background: rgba(0, 0, 0, .85); color: var(--hi); align-items: center; justify-content: center; font-size: 1.4em; z-index: 20; }
.chat.dragging .dropzone { display: flex; }

/* Statuszeile */
.status { display: flex; justify-content: space-between; gap: 4px 18px; flex-wrap: wrap; color: var(--dim); font-size: .9em; }
.note { color: var(--dim); font-size: .8em; text-align: center; }
.toast { position: fixed; right: 20px; top: 56px; pointer-events: none; max-width: min(520px, 90vw); background: #000; border: 2px solid var(--fg); padding: 6px 12px; z-index: 90; }
.toast.warn { border-color: var(--warn); color: var(--warn); }

/* Seiten */
.page { overflow: auto; min-height: 0; padding-right: 6px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.page-h { color: var(--hi); margin-bottom: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { border: 2px solid var(--line); padding: 8px 12px; }
.pcard.revoked { opacity: .6; border-style: dashed; }
.pc-name { color: var(--hi); margin-bottom: 4px; }
.pc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.box { border: 2px solid var(--line); padding: 8px 12px; min-width: 0; }
.box.wide { grid-column: 1 / -1; }
.box-h { color: var(--hi); margin-bottom: 6px; }
.box .field.row { flex-wrap: nowrap; }
.box .field.row .lbl { flex: 1; }
.box .field.row input { flex: 0 0 110px; min-width: 0; }
.big { font-size: 1.3em; margin: 4px 0 10px; }
.table-wrap { overflow: auto; max-height: 340px; }
.tbl { border-collapse: collapse; width: 100%; font-size: .9em; }
.tbl th { color: var(--dim); text-align: left; border-bottom: 1px solid var(--fg); padding: 2px 10px 2px 0; font-weight: normal; position: sticky; top: 0; background: #000; }
.tbl td { padding: 2px 10px 2px 0; border-bottom: 1px dashed var(--line); white-space: nowrap; }
.tbl tr.ws-failed td, .tbl tr.ws-blocked td, .tbl tr.ws-dropped td { color: var(--warn); }
.search-form { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search-form input { flex: 1; min-width: 200px; }
.hit { display: block; text-decoration: none; color: inherit; border-left: 2px solid transparent; padding-left: 8px; }
.hit:hover, .hit:focus-visible { border-left-color: var(--hi); }

/* Formulare und Dialoge */
.form { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 2px; }
.field.row { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.field.row input { flex: 1; min-width: 120px; }
.lbl { color: var(--dim); }
.hint { color: var(--dim); font-size: .8em; }
.form-err { color: var(--warn); min-height: 1.2em; margin: 4px 0; }
.checks { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--fg); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.dlg { background: #000; color: var(--fg); border: 2px solid var(--fg); padding: 14px 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; font: inherit; text-shadow: inherit; }
.dlg.danger { border-color: var(--warn); }
.dlg::backdrop { background: rgba(0, 0, 0, .8); }
.dlg-title { color: var(--hi); margin-bottom: 8px; }
.dlg-text { margin: 0 0 10px; text-transform: none; }
.token { width: 100%; color: var(--warn); border: 1px dashed var(--warn); padding: 6px; }

/* Anmeldung */
.login { max-width: 640px; margin: 8vh auto 0; padding: 0 20px; }
.login .brand { font-size: 1.6em; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-form .p { min-width: 130px; }
.login-cur { color: var(--dim); margin-top: 30px; }

/* Mobil (ab 360 px) */
@media (max-width: 760px) {
  :root { --fs: 20px; --pad: 8px 10px; }
  .menu-btn { display: inline-block; font-size: .85em; min-height: 36px; }
  .top { gap: 4px 10px; }
  .top .brand { font-size: .95em; }
  .nav { order: 5; width: 100%; gap: 8px; font-size: .9em; overflow-x: auto; flex-wrap: nowrap; }
  .top-right { gap: 6px; font-size: .9em; }
  .top-right .mini { min-height: 32px; }
  .main { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ch {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 330px); z-index: 60; background: #000;
    padding: 14px; border-right: 2px solid var(--fg); transform: translateX(-105%); transition: transform .18s ease-out; visibility: hidden;
  }
  .ch.open { transform: none; visibility: visible; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50; }
  .ch-item { padding: 6px 6px 6px 0; }
  .in { flex-wrap: wrap; }
  .in .p { order: 1; flex: 1; padding-top: 0; overflow: hidden; text-overflow: ellipsis; }
  .modes { order: 2; }
  .ta-wrap { flex-basis: 100%; order: 3; }
  .btns { order: 4; margin-left: auto; }
  .top .conn { display: none; }
  .brand-long { display: none; }
  .brand-short { display: inline; }
  .top-right { margin-left: auto; }
  .nav { order: 5; width: 100%; }
  .caps-long { display: none; }
  .caps-short { display: inline; }
  .chan-head { gap: 2px 10px; }
  .chan-actions .mini { min-height: 30px; }
  .att { margin-left: 0; max-width: 100%; }
  .status { font-size: .8em; gap: 0 12px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 4px; }
  .login { margin-top: 4vh; }
  .login .brand { font-size: 1.25em; }
  .toast { left: 10px; right: 10px; top: 48px; }
  button { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .cur { animation: none; }
  .ch { transition: none; }
  * { scroll-behavior: auto !important; }
}

@media (prefers-contrast: more) {
  body::after { display: none; }
  :root { --dim: #5fd8bb; --line: #3ff2c8; }
}
