/* KNXConfiguration – gemeinsame Styles für Web und App.
   Vorgaben: große Touch-Ziele (min. 44px), hoher Kontrast, auf dem Handy einspaltig. */
:root {
    --bg: #eef1f4;
    --card: #ffffff;
    --text: #15191d;
    --muted: #55606b;
    --line: #cfd6dd;
    --head: #12202e;
    --head-text: #ffffff;
    --primary: #0a57a4;
    --primary-text: #ffffff;
    --ok: #17713a;
    --warn: #9a5200;
    --danger: #a8231c;
    --chip: #e3ebf3;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

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

.kc-header {
    background: var(--head);
    color: var(--head-text);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 6px 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.kc-brand { font-weight: 700; font-size: 1.1rem; margin-right: 8px; color: var(--head-text); text-decoration: none; }

.kc-nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }

.kc-nav a {
    color: var(--head-text);
    text-decoration: none;
    padding: 0 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
}

.kc-nav a.active { background: #2b4764; font-weight: 600; }
.kc-nav a:hover { background: #22384f; }

.kc-bus {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 22px;
    background: #22384f;
    color: var(--head-text);
    text-decoration: none;
    font-size: .92rem;
}

.kc-dot { width: 12px; height: 12px; border-radius: 50%; background: #9aa5b1; flex: none; }
.kc-dot.on { background: #3ddc84; }
.kc-dot.busy { background: #ffc24b; }
.kc-dot.err { background: #ff6b60; }

.kc-main { max-width: 1280px; margin: 0 auto; padding: 14px 12px 60px; }

h1 { font-size: 1.45rem; margin: 6px 0 12px; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }

.kc-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.kc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.kc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kc-row.end { justify-content: flex-end; }
.kc-grow { flex: 1; min-width: 160px; }
.kc-muted { color: var(--muted); font-size: .9rem; }
.kc-mono { font-family: Consolas, "Roboto Mono", monospace; }
.kc-right { text-align: right; }

button, .kc-btn {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--primary-text);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

button.sec, .kc-btn.sec { background: #fff; color: var(--primary); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.small { min-height: 36px; padding: 0 10px; font-size: .92rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=number], input[type=password], select, textarea {
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid #8b97a3;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    color: var(--text);
    max-width: 100%;
}

input[type=checkbox] { width: 22px; height: 22px; vertical-align: middle; }
label.kc-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
label.kc-field { display: flex; flex-direction: column; gap: 3px; font-size: .9rem; color: var(--muted); }
label.kc-field > input, label.kc-field > select { color: var(--text); }

.kc-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin: 8px 0 12px; }

.kc-tabs a {
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
}

.kc-tabs a.active { background: var(--card); border-color: var(--line); font-weight: 600; color: var(--primary); margin-bottom: -2px; border-bottom: 2px solid var(--card); }

table.kc-table { width: 100%; border-collapse: collapse; background: var(--card); }
table.kc-table th { text-align: left; font-size: .85rem; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.kc-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.kc-table tr.click { cursor: pointer; }
table.kc-table tr.click:hover td { background: #f1f6fb; }
.kc-scroll { overflow-x: auto; }

.kc-badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.kc-badge.ok { background: #d8f0e0; color: #0f5a2b; }
.kc-badge.warn { background: #ffe7c7; color: #7a4100; }
.kc-badge.err { background: #fbdcd9; color: #8a1c15; }
.kc-badge.info { background: var(--chip); color: #1c3b5a; }

.kc-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 16px; padding: 3px 4px 3px 10px; margin: 2px 4px 2px 0; font-size: .92rem; }
.kc-chip button { min-height: 30px; padding: 0 8px; border-radius: 14px; background: transparent; color: var(--danger); border: none; font-weight: 700; }
.kc-chip.send { background: #d8f0e0; }

.kc-alert { border-radius: 8px; padding: 10px 12px; margin: 8px 0; border: 1px solid; }
.kc-alert.err { background: #fbdcd9; border-color: #e3958f; color: #6e1711; }
.kc-alert.ok { background: #d8f0e0; border-color: #8ac8a1; color: #0d4b24; }
.kc-alert.warn { background: #ffe7c7; border-color: #e0b070; color: #663600; }
.kc-alert.info { background: #e3ebf3; border-color: #a9bdd2; color: #16324e; }

.kc-progress { height: 14px; background: #d5dce3; border-radius: 7px; overflow: hidden; margin: 8px 0; }
.kc-progress > div { height: 100%; background: var(--primary); transition: width .2s; }

.kc-log { background: #10161c; color: #dbe7f3; font-family: Consolas, "Roboto Mono", monospace; font-size: .85rem; padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; white-space: pre-wrap; }

.kc-split { display: grid; grid-template-columns: 260px 1fr; gap: 12px; align-items: start; }
.kc-side { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; position: sticky; top: 66px; max-height: calc(100vh - 80px); overflow: auto; }
.kc-side .grp { font-size: .82rem; color: var(--muted); padding: 8px 8px 2px; font-weight: 600; }
.kc-side a { display: flex; align-items: center; min-height: 40px; padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--text); cursor: pointer; }
.kc-side a.active { background: var(--primary); color: #fff; }
.kc-side a.lvl1 { padding-left: 24px; }

.kc-param { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.2fr); gap: 6px 14px; align-items: center; padding: 6px 0; border-bottom: 1px solid #e6ebf0; }
.kc-param .lbl { font-size: .95rem; }
.kc-param.changed .lbl { font-weight: 700; }
.kc-param select, .kc-param input { width: 100%; }
.kc-sep { border-top: 2px solid var(--line); margin: 10px 0 4px; padding-top: 4px; font-weight: 600; color: var(--muted); }

/* Gebäudebaum */
.kc-node { display: flex; align-items: center; gap: 8px; min-height: 44px; padding-right: 6px; border-bottom: 1px solid #edf0f3; cursor: pointer; }
.kc-node:hover { background: #f1f6fb; }
.kc-node.dev { font-size: .97rem; }
.kc-tw { width: 18px; flex: none; text-align: center; color: var(--muted); }
.kc-ico { width: 24px; flex: none; text-align: center; color: #24405c; }

/* Gruppenadress-Auswahl: Vorschlagsliste und Baum */
.kc-gapick { position: relative; }
.kc-suggest { border: 1px solid #8b97a3; border-radius: 8px; background: #fff; max-height: 320px; overflow-y: auto; margin-top: 4px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.kc-suggest > a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 10px; border-bottom: 1px solid #edf0f3; cursor: pointer; color: var(--text); text-decoration: none; }
.kc-suggest > a:hover { background: #e3ebf3; }
.kc-node.sel { background: #d8f0e0; }

/* Umschalter für Ansichten */
.kc-seg { display: inline-flex; border: 1px solid var(--primary); border-radius: 8px; overflow: hidden; }
.kc-seg button { border: none; border-radius: 0; background: #fff; color: var(--primary); min-height: 44px; }
.kc-seg button.on { background: var(--primary); color: #fff; font-weight: 600; }

.kc-user { color: #fff; font-weight: 600; margin-left: 10px; }
/* Aufgeklappte Szenenliste an einem Szenennummer-Parameter */
.kc-scenebox { grid-column: 1 / -1; border: 1px solid var(--primary); border-radius: 8px; padding: 10px; margin-top: 6px; background: #fff; }
.kc-scenebox select, .kc-scenebox input { width: auto; }
.kc-scenebox td input, .kc-scenebox .kc-grow > input, .kc-scenebox .kc-grow > select { width: 100%; }
tr.kc-rowsel td { background: #e3f0fb; }
/* Baum in der Dokumentation (Gebäude, Topologie) */
.kc-doctree { margin: 0; padding-left: 20px; list-style: none; border-left: 1px solid #c9d3dd; }
.kc-doctree.root { padding-left: 0; border-left: none; }
.kc-doctree li { margin: 2px 0; }
.kc-doctree .dev { color: #24405c; }

.kc-tree-main { font-weight: 700; margin-top: 14px; }
.kc-tree-mid { font-weight: 600; margin: 10px 0 4px 8px; color: #24405c; }

/* Dokumentation: beim Drucken nur den Inhalt, ohne Kopfzeile, Reiter und Bedienelemente */
.kc-doc-device { break-inside: avoid; margin-top: 12px; }
@media print {
    .kc-header, .kc-tabs, .kc-noprint { display: none !important; }
    html, body { background: #fff; font-size: 11px; }
    .kc-main { max-width: none; padding: 0; }
    table.kc-table th, table.kc-table td { padding: 3px 5px; }
}

@media (max-width: 760px) {
    .kc-split { grid-template-columns: 1fr; }
    .kc-side { position: static; max-height: 240px; }
    .kc-param { grid-template-columns: 1fr; }
    .kc-hide-sm { display: none; }
    h1 { font-size: 1.25rem; }
}
