* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, sans-serif; color: #1e293b; background: #f1f5f9; }
button, input, select, textarea { font: inherit; }
.hidden { display: none; }

.login { max-width: 340px; margin: 12vh auto; padding: 24px; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px #0002; }
.login h1 { margin: 0 0 16px; font-size: 20px; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0f172a; color: #cbd5e1; padding: 12px 0; }
.side h1 { margin: 0 16px 12px; font-size: 16px; color: #fff; }
.side .group { margin: 14px 16px 4px; font-size: 11px; text-transform: uppercase; color: #64748b; }
.side a { display: block; padding: 6px 16px; color: inherit; text-decoration: none; cursor: pointer; }
.side a:hover { background: #1e293b; }
.side a.active { background: #2563eb; color: #fff; }

.main { padding: 16px 24px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.top h2 { margin: 0; }
.bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }

.btn { padding: 6px 12px; border: 1px solid #cbd5e1; background: #fff; border-radius: 4px; cursor: pointer; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.small { padding: 2px 8px; font-size: 12px; }

input[type=text], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
    width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff;
}
.bar input[type=search] { width: 260px; }
textarea { min-height: 90px; font-family: ui-monospace, monospace; }

.tablewrap { overflow-x: auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 3px #0001; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
th { background: #f8fafc; font-weight: 600; }
.actions { display: flex; gap: 4px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e2e8f0; }
.badge.healthy { background: #bbf7d0; color: #166534; }
.badge.starting { background: #fef08a; color: #854d0e; }
.badge.error { background: #fecaca; color: #991b1b; }
.badge.off { background: #cbd5e1; color: #334155; }
.badge.yes { background: #bbf7d0; color: #166534; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.msg { padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; background: #fecaca; color: #7f1d1d; }
.msg.ok { background: #bbf7d0; color: #14532d; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.card { background: #fff; padding: 14px; border-radius: 6px; box-shadow: 0 1px 3px #0001; }
.card .n { font-size: 26px; font-weight: 700; }
.card .l { color: #64748b; }

dialog { border: 0; border-radius: 8px; padding: 20px; width: min(640px, 94vw); box-shadow: 0 10px 40px #0005; }
dialog::backdrop { background: #0006; }
dialog h3 { margin-top: 0; }
.field { margin-bottom: 10px; }
.field label { display: block; font-weight: 600; margin-bottom: 3px; }
.dlgbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; background: #dbeafe; border-radius: 12px; }

.tsection { margin-bottom: 14px; }
.tsection h3 { margin: 0 0 10px; }
.hint { color: #64748b; margin-top: 0; }
.code { font-family: ui-monospace, monospace; white-space: pre; min-height: 120px; }
.code.tall { min-height: 340px; }
.filesplit { display: grid; grid-template-columns: 240px 1fr; gap: 12px; margin-top: 8px; }
.filelist { border: 1px solid #e2e8f0; border-radius: 4px; max-height: 460px; overflow: auto; }
.fileitem { display: block; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; word-break: break-all; }
.fileitem:hover { background: #f1f5f9; }
.fileitem.active { background: #dbeafe; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.phbox { line-height: 2; }
.btn.ph { margin: 0 3px 0 0; font-family: ui-monospace, monospace; }

/* Syntax-Highlighting: farbige Kopie (pre) unter transparenter Textarea */
.hl { position: relative; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; }
.hl-pre, .hl textarea.hl-area {
    margin: 0; padding: 8px; border: 0; border-radius: 4px; font: 13px/1.5 ui-monospace, Consolas, monospace;
    white-space: pre; tab-size: 4; letter-spacing: 0; word-spacing: 0;
}
.hl-pre { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: #1e293b; }
.hl textarea.hl-area { position: relative; display: block; width: 100%; min-height: 140px; overflow: auto; resize: vertical; background: transparent; color: transparent; caret-color: #1e293b; }
.hl textarea.hl-area.tall { min-height: 340px; }
.hl textarea.hl-area::selection { background: #2563eb55; color: transparent; }
.tok-c { color: #6b7280; font-style: italic; }
.tok-s { color: #047857; }
.tok-k { color: #1d4ed8; }
.tok-v { color: #b45309; }
.tok-n { color: #7c3aed; }
.tok-p { color: #be185d; font-weight: 600; }

/* Darkmode */
html[data-theme=dark] { color-scheme: dark; }
html[data-theme=dark] body { color: #e2e8f0; background: #0b1220; }
html[data-theme=dark] .login, html[data-theme=dark] .card, html[data-theme=dark] .tablewrap, html[data-theme=dark] dialog { background: #1e293b; color: #e2e8f0; }
html[data-theme=dark] .btn { background: #1e293b; border-color: #475569; color: #e2e8f0; }
html[data-theme=dark] .btn:hover { background: #334155; }
html[data-theme=dark] .btn.primary { background: #2563eb; border-color: #2563eb; }
html[data-theme=dark] .btn.danger { color: #fca5a5; border-color: #7f1d1d; }
html[data-theme=dark] input[type=text], html[data-theme=dark] input[type=password], html[data-theme=dark] input[type=search],
html[data-theme=dark] input[type=date], html[data-theme=dark] input[type=datetime-local], html[data-theme=dark] input[type=number],
html[data-theme=dark] select, html[data-theme=dark] textarea { background: #0f172a; color: #e2e8f0; border-color: #475569; }
html[data-theme=dark] th { background: #0f172a; }
html[data-theme=dark] th, html[data-theme=dark] td { border-color: #334155; }
html[data-theme=dark] .badge { background: #334155; color: #e2e8f0; }
html[data-theme=dark] .badge.healthy, html[data-theme=dark] .badge.yes { background: #14532d; color: #bbf7d0; }
html[data-theme=dark] .badge.starting { background: #713f12; color: #fef08a; }
html[data-theme=dark] .badge.error { background: #7f1d1d; color: #fecaca; }
html[data-theme=dark] .msg { background: #7f1d1d; color: #fecaca; }
html[data-theme=dark] .msg.ok { background: #14532d; color: #bbf7d0; }
html[data-theme=dark] .card .l, html[data-theme=dark] .hint { color: #94a3b8; }
html[data-theme=dark] .chip { background: #1e3a8a; }
html[data-theme=dark] .filelist { border-color: #334155; }
html[data-theme=dark] .fileitem { border-color: #334155; }
html[data-theme=dark] .fileitem:hover { background: #334155; }
html[data-theme=dark] .fileitem.active { background: #1e3a8a; }
html[data-theme=dark] .hl { background: #0f172a; border-color: #475569; }
html[data-theme=dark] .hl-pre { color: #e2e8f0; }
html[data-theme=dark] .hl textarea.hl-area { background: transparent; color: transparent; caret-color: #e2e8f0; }
html[data-theme=dark] .tok-c { color: #94a3b8; }
html[data-theme=dark] .tok-s { color: #6ee7b7; }
html[data-theme=dark] .tok-k { color: #93c5fd; }
html[data-theme=dark] .tok-v { color: #fcd34d; }
html[data-theme=dark] .tok-n { color: #c4b5fd; }
html[data-theme=dark] .tok-p { color: #f9a8d4; }

.bars { width: 100%; height: 100px; display: block; }
.bars rect { fill: #2563eb; }
html[data-theme=dark] .bars rect { fill: #60a5fa; }

/* Abstaende zwischen Karten, Tabellen und Ueberschriften */
.cards { margin-bottom: 14px; }
.tablewrap { margin-bottom: 14px; }
.main > h3 { margin: 18px 0 8px; }
.gap { height: 14px; }
