@import url('fonts.css');
:root {
  --navy: #0F2A3D; --petrol: #0E7C7B; --petrol-dark: #0B6564; --mint: #5FE0EE; --green: #4CAF82;
  --ink: #0F2A3D; --muted: #3D5566; --line: #D3DEE5; --bg: #F4F7F8; --card: #FFFFFF; --danger: #B42318;
  --radius: 12px;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--petrol-dark); } a:hover { color: var(--navy); }
h1, h2, h3 { letter-spacing: -0.02em; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

/* Formulare */
label { font-size: 14px; font-weight: 700; display: block; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid #B9CBD6; border-radius: var(--radius);
  font: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; min-height: 280px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--mint); outline-offset: 1px; border-color: var(--petrol); }
.field { margin-bottom: 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--radius); background: var(--petrol); color: #fff; font: inherit; font-size: 15px;
  font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--petrol-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--ink); border: 1.5px solid #B9CBD6; }
.btn.secondary:hover { border-color: var(--petrol); color: var(--ink); }
.btn.danger { background: #fff; color: var(--danger); border: 1.5px solid #F1B5AE; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }
.error { color: var(--danger); font-size: 14px; margin: 0 0 12px; }
.error:empty { margin: 0; }
.ok { color: var(--petrol-dark); font-size: 14px; }

/* Login & Einladung */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-brand { flex: 1 1 480px; background: var(--navy); color: #fff; padding: 56px 56px 96px; display: flex;
  flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 40px;
  min-height: 420px; position: relative; }
.auth-brand img { width: 100%; max-width: 380px; height: auto; }
.auth-brand h1 { margin: 0; font-size: clamp(32px, 4vw, 44px); line-height: 1.1; font-weight: 800; }
.auth-brand .badge { position: absolute; left: 0; right: 0; bottom: 40px; display: flex; justify-content: center;
  align-items: center; gap: 10px; font-size: 14px; color: #B9CBD6; }
.auth-form { flex: 999 1 520px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-form form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 4px; }
.auth-form h2 { margin: 0; font-size: 32px; font-weight: 800; }
.auth-form .lead { margin: 6px 0 22px; color: var(--muted); }
.auth-form .btn { width: 100%; min-height: 52px; margin-top: 4px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 2px; top: 1px; width: 44px; height: 44px; border: 0; background: transparent;
  cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.auth-foot { text-align: center; font-size: 14px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* App */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 24px;
  min-height: 64px; flex-wrap: wrap; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; text-decoration: none; }
.topbar .brand span { color: var(--mint); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #C9D7E0; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 14px; color: #C9D7E0; }
.topbar button { background: transparent; border: 1.5px solid rgba(255,255,255,.3); color: #fff; border-radius: 10px;
  min-height: 38px; padding: 0 14px; font: inherit; font-size: 14px; cursor: pointer; }
main { max-width: 1320px; margin: 0 auto; padding: 32px 20px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 30px; }
.card { background: var(--card); border-radius: 16px; padding: 24px; box-shadow: 0 1px 2px rgba(15,42,61,.08); margin-bottom: 20px; }
.card h2 { margin: 0 0 16px; font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.bot-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; border: 1.5px solid transparent; }
.bot-card:hover { border-color: var(--petrol); color: inherit; }
.bot-card .name { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #E3F1F1; color: var(--petrol-dark); }
.tag.code { background: #E8EEF6; color: #2A4A6B; }
.tag.off { background: #F5E6E4; color: var(--danger); }
.meta { font-size: 13px; color: var(--muted); }
.notice { background: #FFF6E5; border: 1.5px solid #F2CF8F; color: #6B4A0E; border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px; line-height: 1.5; }
.split { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.split > .left { flex: 3 1 520px; min-width: 0; }
.split > .right { flex: 2 1 340px; min-width: 0; position: sticky; top: 16px; }
.preview-frame { width: 100%; height: 560px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(15,42,61,.12); }
pre.snippet { background: var(--navy); color: #E6F4F7; padding: 14px; border-radius: 12px; font-size: 13px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--petrol); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 10; }

/* ---- Bot-Seite: Reiter, Baukasten, Dokumente, Aussehen, Code ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lead-text { color: var(--muted); margin: -8px 0 18px; }
.tag.doc { background: #EEF0FB; color: #2F3C8F; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 700; border-radius: 10px 10px 0 0; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--ink); background: #fff; }
.tabs a.active { color: var(--petrol-dark); border-bottom-color: var(--petrol); }
.split.wide > .left { flex: 3 1 640px; }
.split.wide > .right { flex: 1 1 320px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; border: 1.5px solid transparent; cursor: pointer; font: inherit; color: inherit; text-decoration: none; }
.choice:hover { border-color: var(--petrol); color: inherit; }
.choice strong { font-size: 20px; }
.choice-icon { font-size: 34px; }
.blocks-card { padding: 16px; }
.blocks-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.blocks-toolbar select { width: auto; min-width: 200px; }
.blockly-area { height: 620px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--line); }
.help-box { margin-top: 12px; background: #E9F5F5; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.55; }
.prompt-view { white-space: pre-wrap; font-size: 13px; line-height: 1.5; background: var(--bg); padding: 14px; border-radius: 10px; max-height: 420px; overflow: auto; margin: 14px 0 0; }
details.card summary { cursor: pointer; }
.upload { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 2px dashed #B9CBD6; border-radius: 14px; cursor: pointer; text-align: center; margin-top: 14px; }
.upload:hover, .upload:focus-within { border-color: var(--petrol); background: #F4FAFA; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { font-size: 26px; }
.doc-list { list-style: none; padding: 0; margin: 0 0 10px; }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-list li > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.doc-icon { font-size: 22px; }
h3.sub { font-size: 15px; margin: 22px 0 12px; color: var(--petrol-dark); text-transform: uppercase; letter-spacing: .05em; }
.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.logo-row img { border-radius: 12px; background: var(--bg); object-fit: contain; border: 1px solid var(--line); }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.color-field input[type=color] { width: 100%; height: 46px; padding: 4px; border: 1.5px solid #B9CBD6; border-radius: 10px; background: #fff; cursor: pointer; }
.code-layout { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.file-list { flex: 1 1 220px; }
.file-list ul { list-style: none; padding: 0; margin: 0; }
.file-list a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.file-list a.active, .file-list a:hover { background: #E3F1F1; }
.code-card { flex: 4 1 560px; min-width: 0; padding: 16px; }
.CodeMirror { border: 1.5px solid var(--line); border-radius: 10px; font-size: 13.5px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.text-dialog { border: 0; border-radius: 16px; padding: 24px; width: min(640px, 92vw); box-shadow: 0 20px 60px rgba(15,42,61,.3); }
.text-dialog::backdrop { background: rgba(15,42,61,.45); }
.text-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.text-dialog textarea { min-height: 220px; }

/* Öffentliche Seiten (Anfrage-Formular, Status, Passwort vergessen) */
body.public { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; }
.public-card { width: 100%; max-width: 640px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 1px 3px rgba(15,42,61,.1); }
.public-card h1 { font-size: 28px; margin: 12px 0 6px; }
.public-card h2 { font-size: 22px; }
.public-foot { margin: 28px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent { align-items: flex-start; font-weight: 500; font-size: 14px; line-height: 1.5; margin: 6px 0 16px; }
.consent input { flex: none; margin-top: 2px; }
.thread { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.thread-msg { border-radius: 14px; padding: 12px 14px; }
.thread-msg.from-me { background: var(--bg); }
.thread-msg.from-team { background: #E3F1F1; border-left: 4px solid var(--petrol); }
.thread-msg.note { background: #FFF6E5; border-left: 4px solid #E8A33D; }
.thread-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; line-height: 1.55; }

/* Tickets */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: #E3F1F1; color: var(--petrol-dark); font-size: 12px; text-align: center; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.filters select, .filters input[type=search] { width: auto; min-width: 200px; flex: 1 1 200px; }
.filters input[type=search] { flex: 2 1 260px; }
.ticket-table td { vertical-align: top; }
.ticket-table tr.is-new td:first-child { box-shadow: inset 4px 0 0 var(--petrol); }
.ticket-table a.subject { font-weight: 700; color: var(--ink); text-decoration: none; }
.ticket-table a.subject:hover { text-decoration: underline; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: #fff; background: var(--chip, #5B6B78); white-space: nowrap; }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #EEF2F5; color: var(--muted); white-space: nowrap; }
.status.s-neu { background: #E3F1F1; color: var(--petrol-dark); }
.status.s-in_arbeit { background: #EEF0FB; color: #2F3C8F; }
.status.s-wartet { background: #FFF6E5; color: #6B4A0E; }
.status.s-erledigt { background: #E8F5EE; color: #1D6B44; }
.prio-high { color: var(--danger); font-weight: 700; font-size: 13px; white-space: nowrap; }
.composer-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.composer-tabs button { border: 0; background: var(--bg); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.composer-tabs button.active { background: var(--navy); color: #fff; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip-btn { border: 1.5px solid #B9CBD6; background: #fff; border-radius: 18px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.chip-btn:hover { border-color: var(--petrol); }
.chip-btn.suggested { border-color: var(--petrol); background: #E3F1F1; font-weight: 700; }
.draft-hint { background: #F4FAFA; border-radius: 8px; padding: 8px 10px; }
.inline-label { margin: 0; font-weight: 700; }
.ticket-side .field { margin-bottom: 12px; }
.cfg-list { display: flex; flex-direction: column; gap: 10px; }
.cfg-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.cfg-row input[type=text] { flex: 1 1 200px; width: auto; }
.cfg-row input[type=color] { width: 52px; height: 42px; padding: 3px; border-radius: 8px; border: 1.5px solid #B9CBD6; }
.cfg-block { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.cfg-block.new, .cfg-row.new { border-style: dashed; background: #FAFCFC; }
.cfg-block label { font-weight: 700; font-size: 13px; }
.cfg-block label input, .cfg-block label select { margin-top: 4px; font-weight: 400; }
.editing { display: inline-block; font-size: 12px; font-weight: 700; color: #6B4A0E; background: #FFF6E5; border-radius: 6px; padding: 3px 8px; }
.lock-notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.thread-system { text-align: center; font-size: 12.5px; color: var(--muted); }
.composer-card :disabled, .ticket-side :disabled { opacity: .55; cursor: not-allowed; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -8px 0 18px; }
.closed-notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #E8F5EE; border-color: #A9D8BE; color: #1D4F36; }
.last-note { font-size: 13px; color: #6B4A0E; background: #FFF6E5; border-radius: 6px; padding: 3px 8px; margin-top: 4px; display: inline-block; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.perm-grid fieldset { border: 1px solid var(--line, #DCE3E8); border-radius: 10px; padding: 10px 14px; margin: 0; }
.perm-grid legend { font-weight: 700; padding: 0 4px; }
.perm-opt { display: flex; gap: 8px; align-items: center; font-weight: 400; padding: 4px 0; cursor: pointer; }
.perm-opt input { width: auto; margin: 0; }
.tag.perm-admin { background: #1D3A4F; color: #fff; }
.tag.perm-none { background: #EEF1F3; color: #6B7780; }
.tag.perm-all, .tag.perm-manage { background: #E3EEFF; color: #1F4E99; }
.tag.perm-handle { background: #E8F5EE; color: #1D4F36; }
/* ---- Ticketsysteme (Schulen) */
.brand-logo { max-height: 56px; max-width: 220px; width: auto; object-fit: contain; }
.brand-name { margin: 6px 0 0; font-weight: 600; }
.space-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.space-title h1 { margin: 0; }
.space-name { font-weight: 600; color: var(--space, var(--petrol)); }
.space-logo { height: 44px; max-width: 120px; object-fit: contain; }
.space-logo-sm { height: 18px; max-width: 60px; object-fit: contain; vertical-align: -3px; margin-right: 6px; }
.space-badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; background: var(--space, var(--petrol)); }
.space-switch { width: auto; min-height: 38px; font-size: 14px; padding: 6px 10px; }
.space-card { border-top: 4px solid var(--space, var(--petrol)); }
.space-card .row { gap: 6px; }
.space-perm { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.space-perm:last-child { border-bottom: 0; }
.space-perm select { width: auto; min-height: 36px; font-size: 14px; padding: 4px 8px; }
.member-list { max-height: 50vh; overflow: auto; }
.logo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.logo-preview { width: 160px; height: 80px; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; }
.logo-preview img { max-width: 140px; max-height: 64px; object-fit: contain; }
.mail-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.mail-way { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.mail-way h3 { margin-top: 0; font-size: 17px; }
.mail-way details { margin: 6px 0 10px; }
.text-dialog .perm-grid { grid-template-columns: 1fr; }
.space-perm label { flex: 1; min-width: 0; }
.space-perm select { flex: 0 1 220px; min-width: 0; }
.share-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.share-row .qr { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.share-link { font-weight: 700; word-break: break-all; }
/* ---- Löschen mit Warnung */
.danger-dialog { max-width: 520px; border-top: 5px solid #B42318; }
.danger-head { display: flex; align-items: center; gap: 10px; }
.danger-head span { font-size: 26px; }
.danger-head h2 { margin: 0; font-size: 20px; }
.danger-list { margin: 8px 0 12px; padding-left: 20px; line-height: 1.5; }
.danger-list li { margin-bottom: 4px; }
.danger-final { background: #FDECEA; color: #8A1C12; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.danger-dialog input { margin-top: 6px; }
.btn.danger-solid { background: #B42318; color: #fff; border-color: #B42318; }
.btn.danger-solid:disabled { opacity: .45; cursor: not-allowed; }
.danger-zone { border: 1.5px solid #F3C4BE; }
.danger-zone h2 { color: #8A1C12; }
/* ---- Experten-Baukasten */
.tag.flow { background: #EDE7FA; color: #4B2E9A; }
.blockly-area.tall { height: 72vh; min-height: 560px; }
.flow-warn:empty { display: none; }
.flow-warn { background: #FFF6E5; border: 1px solid #F1DDB0; color: #5A3E07; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; line-height: 1.5; }
.blocklyTreeRow { min-height: 26px; }
.blocklyToolboxCategory .blocklyTreeLabel { font-size: 13px; }
