/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
    --bg:         #f0f2f5;
    --surface:    #ffffff;
    --surface2:   #f4f6f9;
    --surface3:   #eef0f4;
    --border:     #e2e6ed;
    --text:       #0f172a;
    --text-2:     #374151;
    --muted:      #6b7280;
    --accent:     #EF7F1A;
    --accent-h:   #d06b10;
    --accent-bg:  #fff7ed;
    --accent-dim: rgba(239,127,26,.12);
    --danger:     #dc2626;
    --danger-bg:  #fef2f2;
    --success:    #16a34a;
    --success-bg: #f0fdf4;
    --warn:       #d97706;
    --warn-bg:    #fffbeb;
    --ok:         #16a34a;
    --info:       #0ea5e9;
    --info-bg:    #f0f9ff;
    --radius:     12px;
    --radius-sm:  8px;
    --radius-xs:  5px;
    --shadow:     0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 20px rgba(0,0,0,.10);
    --shadow-lg:  0 12px 36px rgba(0,0,0,.15);
    --sidebar-w:  224px;
    --sidebar-w-collapsed: 56px;
    --topbar-h:   56px;
    --mobile-nav-h: 60px;
    --tr: .15s ease;
}
.theme-dark {
    --bg:         #0d1117;
    --surface:    #161b22;
    --surface2:   #1c2128;
    --surface3:   #21262d;
    --border:     #30363d;
    --text:       #e6edf3;
    --text-2:     #c9d1d9;
    --muted:      #8b949e;
    --accent-dim: rgba(239,127,26,.18);
    --accent-bg:  #2d1a05;
    --danger-bg:  #2d0d0d;
    --success-bg: #0d2318;
    --warn-bg:    #2d1f06;
    --info-bg:    #071e2e;
    --shadow:     0 1px 4px rgba(0,0,0,.3);
    --shadow-md:  0 4px 20px rgba(0,0,0,.4);
    --shadow-lg:  0 12px 36px rgba(0,0,0,.5);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh;
    font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.1rem; border-radius: var(--radius-sm); border: none;
    font-size: .875rem; font-weight: 600; cursor: pointer;
    transition: all var(--tr); white-space: nowrap; line-height: 1.2;
    font-family: inherit;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-h); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { filter: brightness(1.08); }
.btn-ok       { background: var(--success); color: #fff; }
.btn-ok:hover { filter: brightness(1.08); }
.btn-ghost    { background: transparent; border: 1.5px solid var(--border); color: var(--text-2); }
.btn-ghost:hover    { background: var(--surface2); }
.btn-sm       { padding: .3rem .65rem; font-size: .78rem; border-radius: var(--radius-xs); }
.btn-xs       { padding: .18rem .42rem; font-size: .72rem; border-radius: var(--radius-xs); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-block    { width: 100%; }
.btn-icon     { padding: .4rem; border-radius: var(--radius-sm); aspect-ratio: 1; line-height: 1; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
label {
    display: block; font-size: .72rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .4px; margin-bottom: .35rem;
}
.input, input[type="email"], input[type="password"], input[type="text"],
input[type="number"], input[type="time"], textarea, select {
    padding: .52rem .8rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
    font-size: .875rem; transition: border-color var(--tr), box-shadow var(--tr);
    font-family: inherit; width: 100%;
}
.input:focus, input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 80px; }
.input-row  { display: grid; gap: .75rem; }
.input-2col { grid-template-columns: 1fr 1fr; }
.input-3col { grid-template-columns: 1fr 1fr 1fr; }
.err-msg    { color: var(--danger); font-size: .82rem; margin-top: .4rem; min-height: 1.1rem; }
.form-hint  { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* ─── Login ─────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { height: 48px; display: block; margin: 0 auto .75rem; }
.login-subtitle { color: var(--muted); font-size: .82rem; text-align: center; }
.login-field { margin-bottom: 1rem; }
.login-field label { margin-bottom: .4rem; }
.login-field input { width: 100%; }
.login-remember { margin-bottom: 1.25rem; }
.login-checkbox { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .85rem; color: var(--muted); }
.login-checkbox input { width: auto; }

/* ─── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 150; overflow-y: auto; overflow-x: hidden;
    transition: width .2s ease, transform .22s ease, box-shadow .22s ease;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar-brand {
    padding: 1rem .85rem .85rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .6rem;
    flex-shrink: 0; min-height: var(--topbar-h);
    overflow: hidden;
}
.sidebar-brand img { height: 30px; flex-shrink: 0; }
.sidebar-brand-text { font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; opacity: 1; transition: opacity .15s; }

/* Scrollbare Nav-Container */
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .5rem .25rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.nav-section { padding: .1rem 0 .25rem; }
.nav-section-label {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; border: none; background: none; text-align: left;
    font-size: .6rem; font-weight: 800; color: var(--muted);
    text-transform: uppercase; letter-spacing: .7px;
    padding: .55rem .65rem .25rem; white-space: nowrap; overflow: hidden;
    opacity: 1; transition: opacity .15s; cursor: pointer;
    border-radius: var(--radius-sm);
}
.nav-section-label:hover { color: var(--text); }
.nav-section-chevron {
    font-size: .65rem; opacity: .6; flex-shrink: 0;
    transform: rotate(-90deg); transition: transform .2s ease;
    display: inline-block;
}
.nav-section.sec-collapsed .nav-section-chevron { transform: rotate(0deg); }
.nav-section-items {
    display: grid; grid-template-rows: 1fr;
    transition: grid-template-rows .2s ease;
}
.nav-section.sec-collapsed .nav-section-items { grid-template-rows: 0fr; }
.nav-section-items > div { overflow: hidden; min-height: 0; }
.nav-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .52rem .65rem;
    border-radius: var(--radius-sm);
    cursor: pointer; font-size: .855rem; font-weight: 500;
    color: var(--muted);
    transition: all var(--tr);
    border: none; background: none; width: 100%; text-align: left;
    margin-bottom: .15rem; position: relative; white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 700; border-left: 2px solid var(--accent); padding-left: calc(.65rem - 2px); }
.nav-item-archived { opacity: .55; }
.nav-icon        { font-size: .9rem; width: 20px; text-align: center; flex-shrink: 0; }

.nav-archived-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .3rem .75rem; cursor: pointer; gap: .4rem;
    font-size: .72rem; color: var(--muted); user-select: none;
    margin-top: .15rem;
}
.nav-archived-header:hover { color: var(--text); }
.nav-archived-chevron { flex-shrink: 0; }

.nav-sub-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: .35rem .75rem .2rem;
    font-size: .72rem; color: var(--muted);
    margin-top: .4rem; border-top: 1px solid var(--border);
}
.nav-sub-new-btn {
    background: none; border: 1px solid var(--border); color: var(--muted);
    border-radius: 4px; padding: 0 .4rem; font-size: .78rem; cursor: pointer;
    line-height: 1.5;
}
.nav-sub-new-btn:hover { color: var(--text); border-color: var(--accent); }
.nav-label       { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; }
.nav-badge {
    margin-left: auto; min-width: 18px; height: 18px;
    background: var(--danger); color: #fff;
    font-size: .63rem; font-weight: 800; border-radius: 99px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 .32rem; flex-shrink: 0;
    transition: opacity .15s;
}
.nav-badge.warn { background: var(--warn); }
.nav-badge:empty { display: none; }

.sidebar-footer {
    border-top: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-footer-actions {
    padding: .35rem .5rem .5rem; display: flex; flex-direction: column; gap: .15rem;
}
.theme-btn {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .65rem; border-radius: var(--radius-sm);
    border: none; background: none;
    color: var(--muted); font-size: .82rem; cursor: pointer; width: 100%;
    transition: background var(--tr); white-space: nowrap; overflow: hidden;
    font-family: inherit;
}
.theme-btn:hover { background: var(--surface2); color: var(--text); }
.theme-btn-label { transition: opacity .15s; }

/* Sidebar collapsed (icon-only, desktop) */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .theme-btn-label { opacity: 0; pointer-events: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: .52rem; }
.sidebar.collapsed .nav-item.active { border-left: none; padding-left: .52rem; }
.sidebar.collapsed .nav-item.active::after {
    content: ''; position: absolute; right: 0; top: 20%; bottom: 20%;
    width: 3px; background: var(--accent); border-radius: 3px 0 0 3px;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: .85rem .5rem; }
.sidebar.collapsed .sidebar-footer { align-items: center; }
.sidebar.collapsed .nav-section-items { grid-template-rows: 1fr !important; }
.sidebar.collapsed .nav-section-chevron { display: none; }
.sidebar.collapsed .theme-btn { padding: .45rem; justify-content: center; width: 36px; height: 36px; }

/* Sidebar collapse toggle button — absolut positioniert damit das Logo-Layout keinen Einfluss hat */
.sidebar-collapse-btn {
    display: none;
    position: absolute;
    top: calc((var(--topbar-h) - 26px) / 2);
    right: 8px;
    width: 26px; height: 26px;
    align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--muted); border-radius: var(--radius-sm);
    font-size: .9rem; line-height: 1;
    transition: color var(--tr), background var(--tr);
    z-index: 1;
}
.sidebar-collapse-btn:hover { background: var(--surface2); color: var(--text); }

/* ─── Sidebar overlay (mobile) ──────────────────────────────────────────── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 149; opacity: 0; transition: opacity .22s; pointer-events: none;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* ─── Main wrap ─────────────────────────────────────────────────────────── */
.main-wrap {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column; min-height: 100vh;
    transition: margin-left .2s ease;
}
.main-wrap.sidebar-collapsed { margin-left: var(--sidebar-w-collapsed); }

.topbar {
    height: var(--topbar-h); background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 100; gap: .65rem; flex-shrink: 0;
}
.topbar-hamburger {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--muted); padding: .3rem; border-radius: var(--radius-sm);
    font-size: 1.25rem; line-height: 1; flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--surface2); color: var(--text); }
.topbar-title-wrap { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: .02rem; }
.topbar-section { font-size: .6rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title { font-size: .92rem; font-weight: 700; color: var(--text); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.topbar-clock { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 5.5rem; text-align: right; }
.topbar-sysstats { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.topbar-status {
    width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
    background: var(--muted); transition: background .5s;
}
.topbar-status.ok   { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.topbar-status.warn { background: var(--warn);    box-shadow: 0 0 0 2px var(--warn-bg);    }
.topbar-status.err  { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger-bg);  }
.topbar-status.pulse { animation: pulse-dot 2s infinite; }

.main { padding: 1.25rem 1.5rem; flex: 1; }
.main.fullpage { display: flex; flex-direction: column; overflow: hidden; padding: 1.25rem; }

/* ─── Section title ─────────────────────────────────────────────────────── */
.section-title {
    font-size: .68rem; font-weight: 800; color: var(--muted);
    text-transform: uppercase; letter-spacing: .65px;
    margin: 1.5rem 0 .75rem; display: flex; align-items: center; gap: .6rem;
}
.section-title:first-child { margin-top: 0; }
.section-title-action { margin-left: auto; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow);
    transition: box-shadow var(--tr), border-color var(--tr);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-icon  { font-size: 1.25rem; margin-bottom: .4rem; }
.card-label { font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .3rem; }
.card-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.card-sub   { font-size: .73rem; color: var(--muted); margin-top: .25rem; }

/* Metric card (home overview) */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.metric-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.1rem;
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem;
    transition: box-shadow var(--tr);
}
.metric-card:hover { box-shadow: var(--shadow-md); }
.metric-card.ok   { border-top: 3px solid var(--success); }
.metric-card.warn { border-top: 3px solid var(--warn); }
.metric-card.err  { border-top: 3px solid var(--danger); }
.metric-label { font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.metric-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -.4px; }
.metric-sub   { font-size: .72rem; color: var(--muted); }

/* ─── Progress bars ─────────────────────────────────────────────────────── */
.progress-bar  { height: 5px; background: var(--border); border-radius: 3px; margin-top: .5rem; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .5s ease; }
.progress-fill.warn   { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }
.progress-fill.ok     { background: var(--success); }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: .15rem .5rem; border-radius: 99px; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.badge-ok     { background: var(--success-bg); color: var(--success); }
.badge-err    { background: var(--danger-bg);  color: var(--danger); }
.badge-danger { background: var(--danger-bg);  color: var(--danger); }
.badge-warn   { background: var(--warn-bg);    color: var(--warn); }
.badge-muted  { background: var(--surface2);   color: var(--muted); }
.badge-info   { background: var(--info-bg);    color: var(--info); }
.badge-accent { background: var(--accent-bg);  color: var(--accent); }

/* ─── Status dot ────────────────────────────────────────────────────────── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.ok    { background: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.status-dot.warn  { background: var(--warn);    box-shadow: 0 0 0 2px var(--warn-bg); }
.status-dot.err   { background: var(--danger);  box-shadow: 0 0 0 2px var(--danger-bg); }
.status-dot.muted { background: var(--muted); }
.status-dot.pulse { animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1}50%{opacity:.35} }

/* ─── Services ──────────────────────────────────────────────────────────── */
.service-list { display: flex; flex-direction: column; gap: .55rem; }
.service-row {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .9rem 1.1rem;
    display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
    box-shadow: var(--shadow); transition: box-shadow var(--tr);
}
.service-row:hover { box-shadow: var(--shadow-md); }
.service-info   { flex: 1; min-width: 0; }
.service-name   { font-weight: 700; font-size: .9rem; }
.service-unit   { font-size: .72rem; color: var(--muted); margin-top: .1rem; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-res    { font-size: .7rem; color: var(--muted); margin-top: .1rem; font-family: monospace; }
.service-actions { display: flex; gap: .35rem; align-items: center; flex-shrink: 0; }

/* ─── Log box ───────────────────────────────────────────────────────────── */
.log-box {
    background: #0d1117; color: #c9d1d9;
    font-family: "SF Mono", Consolas, "Cascadia Code", monospace;
    font-size: .73rem; padding: .85rem 1rem; border-radius: var(--radius);
    height: 320px; overflow-y: scroll; white-space: pre-wrap; word-break: break-all;
    border: 1px solid var(--border); line-height: 1.7;
    scrollbar-width: thin; scrollbar-color: #30363d transparent;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
}

/* ─── Tables ────────────────────────────────────────────────────────────── */
.log-table { display: flex; flex-direction: column; gap: .3rem; }
.log-row {
    display: flex; align-items: center; gap: .6rem;
    padding: .48rem .75rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .78rem;
    overflow: hidden;
}
.log-ts     { color: var(--muted); font-family: monospace; white-space: nowrap; flex-shrink: 0; font-size: .72rem; }
.log-unit   { font-family: monospace; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-detail { color: var(--muted); font-size: .72rem; white-space: nowrap; flex-shrink: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table th {
    text-align: left; padding: .45rem .65rem;
    font-size: .66rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: .5rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ─── IP cards / DNS ────────────────────────────────────────────────────── */
.ip-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.ip-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .95rem 1.1rem; box-shadow: var(--shadow); }
.ip-label { font-size: .67rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: .25rem; }
.ip-value { font-family: monospace; font-size: .88rem; word-break: break-all; }
.dns-result { font-family: monospace; font-size: .82rem; margin-top: .65rem; padding: .5rem .8rem; border-radius: var(--radius-sm); background: var(--surface2); border: 1px solid var(--border); }

/* ─── Alerts ────────────────────────────────────────────────────────────── */
.alert { padding: .6rem .9rem; border-radius: var(--radius-sm); font-size: .83rem; font-weight: 600; margin-bottom: .85rem; display: flex; align-items: center; gap: .5rem; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(217,119,6,.3); }
.alert-err  { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,.3); }
.alert-ok   { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,.3); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(14,165,233,.3); }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    animation: fade-in .12s ease;
}
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); width: 100%; max-width: 540px;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: modal-in .15s ease;
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-xl { max-width: 900px; }
.modal-header {
    display: flex; align-items: center; gap: .75rem;
    padding: .9rem 1.15rem; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.modal-header span { flex: 1; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); padding: .2rem .35rem; border-radius: var(--radius-xs); line-height: 1; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body   { flex: 1; overflow-y: auto; padding: 1rem 1.15rem; }
.modal-footer { padding: .75rem 1.15rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; flex-shrink: 0; }
.modal-close-btn { color: var(--muted); }

.confirm-modal { max-width: 380px; }
.confirm-msg   { font-size: .9rem; color: var(--text-2); line-height: 1.6; }

/* ─── Toasts ─────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 500;
    display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
    align-items: flex-end;
}
.toast {
    display: flex; align-items: center; gap: .65rem;
    padding: .7rem 1rem; border-radius: var(--radius-sm);
    background: var(--surface); border: 1.5px solid var(--border);
    box-shadow: var(--shadow-lg); font-size: .84rem; font-weight: 600;
    min-width: 220px; max-width: 340px; pointer-events: auto;
    animation: toast-in .2s ease;
}
.toast.ok   { border-color: var(--success); }
.toast.err  { border-color: var(--danger); }
.toast.warn { border-color: var(--warn); }
.toast.info { border-color: var(--info); }
.toast.out  { animation: toast-out .2s ease forwards; }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-text { flex: 1; }
@keyframes toast-in  { from { opacity:0; transform: translateX(16px) scale(.96); } }
@keyframes toast-out { to   { opacity:0; transform: translateX(16px) scale(.96); } }
@keyframes fade-in   { from { opacity:0; } }
@keyframes modal-in  { from { opacity:0; transform: translateY(-10px) scale(.98); } }

/* ─── Charts ────────────────────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.chart-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .9rem 1.1rem;
    box-shadow: var(--shadow); cursor: pointer;
    transition: border-color var(--tr), box-shadow var(--tr);
}
.chart-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.chart-meta   { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .45rem; }
.chart-label  { font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.chart-val    { font-size: 1rem; font-weight: 800; }
.chart-svg    { display: block; width: 100%; height: 56px; overflow: visible; }
.chart-range  { display: flex; gap: .3rem; margin-bottom: .65rem; }
.chart-range button {
    padding: .2rem .6rem; font-size: .72rem; font-weight: 700;
    border-radius: var(--radius-xs); border: 1.5px solid var(--border);
    background: none; color: var(--muted); cursor: pointer; transition: all var(--tr);
    font-family: inherit;
}
.chart-range button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.chart-range button:hover:not(.active) { background: var(--surface2); }
.detail-chart-legend-item { display: flex; align-items: center; gap: .35rem; cursor: pointer; white-space: nowrap; font-size: .8rem; }

/* ─── LCD Display ───────────────────────────────────────────────────────── */
.lcd-display { background: #0f1e0f; border: 3px solid #2a4a2a; border-radius: 8px; padding: 10px 14px; display: inline-block; box-shadow: 0 2px 12px rgba(0,0,0,.4); }
.lcd-body { display: flex; flex-direction: column; gap: 2px; }
.lcd-row { font-family: "Courier New", Courier, monospace; font-size: 1rem; color: #7fff7f; white-space: pre; letter-spacing: .07em; line-height: 1.55; text-shadow: 0 0 6px rgba(100,255,100,.4); }
.lcd-screen-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .65rem; }
.lcd-screen-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .55rem; gap: .5rem; }
.lcd-line-row { display: flex; align-items: center; gap: .5rem; padding: .22rem 0; border-top: 1px solid var(--border); }
.lcd-line-num { font-size: .66rem; font-weight: 700; color: var(--muted); width: 20px; text-align: center; flex-shrink: 0; }

/* ─── File browser ──────────────────────────────────────────────────────── */
.browser-path { font-family: monospace; font-size: .75rem; color: var(--muted); padding: .28rem .5rem; background: var(--surface2); border-radius: var(--radius-xs); margin-bottom: .65rem; word-break: break-all; }
.browser-list { display: flex; flex-direction: column; gap: .22rem; }
.browser-item { display: flex; align-items: center; gap: .5rem; padding: .38rem .55rem; border-radius: var(--radius-sm); cursor: pointer; font-size: .85rem; transition: background var(--tr); }
.browser-item:hover { background: var(--surface2); }
.browser-item-icon { font-size: .88rem; flex-shrink: 0; }
.browser-item-name { flex: 1; }
.browser-item-arrow { color: var(--muted); font-size: .75rem; }
.browser-item.up { color: var(--muted); }

/* ─── Tags ──────────────────────────────────────────────────────────────── */
.ignore-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.ignore-tag { display: flex; align-items: center; gap: .3rem; padding: .18rem .5rem; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); font-size: .73rem; font-family: monospace; }
.ignore-tag button { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .85rem; line-height: 1; padding: 0 .1rem; }
.ignore-tag button:hover { color: var(--danger); }

/* ─── Day picker ────────────────────────────────────────────────────────── */
.day-picker { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; }
.day-picker label {
    display: flex; align-items: center; gap: .3rem; padding: .28rem .5rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    cursor: pointer; font-size: .75rem; font-weight: 600; color: var(--muted);
    text-transform: none; letter-spacing: 0; margin-bottom: 0;
}
.day-picker label:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.day-picker input { display: none; }

/* ─── Overview / Home ───────────────────────────────────────────────────── */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .85rem; margin-bottom: 1.5rem; }
.overview-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .9rem 1.1rem;
    box-shadow: var(--shadow); cursor: pointer;
    transition: box-shadow var(--tr), border-color var(--tr);
    display: flex; flex-direction: column; gap: .35rem;
}
.overview-card:hover { box-shadow: var(--shadow-md); }
.overview-card.alert-border { border-left: 3px solid var(--danger); }
.overview-card.warn-border  { border-left: 3px solid var(--warn); }
.overview-card.ok-border    { border-left: 3px solid var(--success); }
.overview-card-header { display: flex; align-items: center; justify-content: space-between; }
.overview-card-title  { font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.overview-card-value  { font-size: 1.1rem; font-weight: 800; line-height: 1.2; }
.overview-card-sub    { font-size: .73rem; color: var(--muted); }

/* Action required list */
.action-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.5rem; }
.action-item {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--danger); border-radius: var(--radius-sm);
    padding: .65rem .85rem; display: flex; align-items: center; gap: .7rem;
    cursor: pointer; transition: box-shadow var(--tr);
}
.action-item:hover { box-shadow: var(--shadow-md); }
.action-item.warn  { border-left-color: var(--warn); }
.action-item-body  { flex: 1; min-width: 0; }
.action-item-title { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-item-meta  { font-size: .73rem; color: var(--muted); margin-top: .1rem; }
.action-item-btns  { display: flex; gap: .3rem; flex-shrink: 0; }

.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* Sub-tabs (used in email, backup etc.) */
.subtab-bar { display: flex; gap: .2rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.subtab-bar::-webkit-scrollbar { display: none; }
.subtab-btn {
    padding: .5rem .9rem; font-size: .82rem; font-weight: 600;
    border: none; background: none; color: var(--muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    white-space: nowrap; transition: color var(--tr), border-color var(--tr);
    font-family: inherit;
}
.subtab-btn:hover { color: var(--text); }
.subtab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.subtab-badge { display: inline-flex; margin-left: .3rem; min-width: 16px; height: 16px; background: var(--danger); color: #fff; font-size: .6rem; font-weight: 800; border-radius: 99px; align-items: center; justify-content: center; padding: 0 .28rem; }

/* ─── Fan cards ─────────────────────────────────────────────────────────── */
.fan-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow); margin-bottom: .85rem;
}
.fan-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: .85rem;
}
.fan-title   { display: flex; align-items: center; gap: .55rem; }
.fan-icon    { font-size: 1.2rem; }
.fan-name    { font-size: .95rem; font-weight: 700; }
.fan-live-vals {
    display: flex; align-items: center; gap: .4rem;
    font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.fan-dot { color: var(--border); }
.fan-rpm, .fan-spd { font-weight: 600; color: var(--text-2); }

.fan-mode-group {
    display: flex; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
    width: fit-content;
}
.fan-mode-btn {
    padding: .4rem .9rem; font-size: .78rem; font-weight: 700;
    border: none; background: transparent; color: var(--muted);
    cursor: pointer; transition: all var(--tr); letter-spacing: .3px;
    font-family: inherit;
}
.fan-mode-btn + .fan-mode-btn { border-left: 1.5px solid var(--border); }
.fan-mode-btn:hover  { background: var(--surface2); color: var(--text); }
.fan-mode-btn.active { background: var(--accent); color: #fff; }

.fan-panel { margin-top: .85rem; }
.fan-speed-row {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.fan-slider {
    flex: 1; min-width: 120px; accent-color: var(--accent);
    height: 4px; cursor: pointer;
}
.fan-slider-val {
    min-width: 2.8rem; text-align: right;
    font-weight: 700; font-size: .88rem;
}

.fan-auto-inner { padding-top: .1rem; }
.fan-source-row {
    display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem;
}
.fan-source-row select { width: auto; }

.curve-label {
    font-size: .72rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .4px; margin-bottom: .45rem;
}
.curve-list  { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }
.curve-point {
    display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
}
.curve-point input[type="number"] {
    width: 62px; padding: .3rem .5rem; font-size: .82rem; text-align: center;
}
.curve-unit  { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.curve-arrow { font-size: .85rem; color: var(--muted); }

/* ─── Mobile bottom nav ──────────────────────────────────────────────────── */
.mobile-nav { display: none; }

/* ─── Misc utilities ────────────────────────────────────────────────────── */
.text-muted  { color: var(--muted); font-size: .83rem; }
.text-ok     { color: var(--success); }
.text-err    { color: var(--danger); }
.text-warn   { color: var(--warn); }
.text-mono   { font-family: monospace; }
.flex-center  { display: flex; align-items: center; gap: .5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.flex-wrap   { flex-wrap: wrap; }
.gap-sm      { gap: .4rem; }
.gap-md      { gap: .75rem; }
.mt-1        { margin-top: .75rem; }
.mt-2        { margin-top: 1.25rem; }
.mb-1        { margin-bottom: .75rem; }
.mb-2        { margin-bottom: 1.25rem; }
.w-full      { width: 100%; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: skeleton 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes skeleton { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.skeleton-card { height: 90px; border-radius: var(--radius); }
.skeleton-row  { height: 42px; }
.skeleton-line { height: 14px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .85rem; }

/* Stat row */
.stat-row { display: flex; flex-direction: column; gap: .55rem; }
.stat-item {
    display: flex; align-items: center; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .65rem .9rem; box-shadow: var(--shadow);
}
.stat-icon  { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.stat-body  { flex: 1; min-width: 0; }
.stat-label { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 1rem; font-weight: 800; }
.stat-bar   { width: 120px; flex-shrink: 0; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (min-width: 821px) {
    .sidebar-collapse-btn { display: flex; }
}

@media (max-width: 820px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w)));
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-overlay { display: block; }
    .main-wrap { margin-left: 0 !important; }
    .topbar-hamburger { display: block; }
    .topbar-clock { display: none; }
    .topbar-sysstats { display: none; }
    .main { padding: 1rem 1rem calc(var(--mobile-nav-h) + 1rem + env(safe-area-inset-bottom)); }
    .topbar { padding: 0 .85rem; }
    .card-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .card { padding: .85rem; }
    .card-value { font-size: 1.5rem; }
    .ip-grid { grid-template-columns: 1fr; }
    .input-2col, .input-3col { grid-template-columns: 1fr; }
    .overview-grid { grid-template-columns: 1fr 1fr; }
    .chart-grid { grid-template-columns: 1fr; }
    .stat-bar { display: none; }

    /* Mobile bottom nav */
    .mobile-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--surface); border-top: 1px solid var(--border);
        z-index: 200; height: var(--mobile-nav-h);
        padding-bottom: env(safe-area-inset-bottom);
        justify-content: space-around; align-items: stretch;
    }
    .mobile-nav-btn {
        flex: 1; display: flex; flex-direction: column; align-items: center;
        justify-content: center; gap: .2rem; border: none; background: none;
        color: var(--muted); font-size: .65rem; font-weight: 600;
        cursor: pointer; padding: .5rem .2rem;
        transition: color var(--tr); position: relative;
        font-family: inherit; text-transform: uppercase; letter-spacing: .2px;
    }
    .mobile-nav-btn:hover, .mobile-nav-btn.active { color: var(--accent); }
    .mobile-nav-btn .nav-icon { font-size: 1.35rem; width: auto; }
    .mobile-nav-badge {
        position: absolute; top: .25rem; right: calc(50% - 16px);
        min-width: 16px; height: 16px; background: var(--danger); color: #fff;
        font-size: .6rem; font-weight: 800; border-radius: 99px;
        display: flex; align-items: center; justify-content: center; padding: 0 .28rem;
    }

    /* Mobile more drawer */
    .mobile-drawer-backdrop {
        position: fixed; inset: 0; background: rgba(0,0,0,.45);
        z-index: 190; animation: fade-in .15s ease;
    }
    .mobile-drawer {
        position: fixed; bottom: var(--mobile-nav-h); left: 0; right: 0;
        max-height: 75vh; overflow-y: auto;
        background: var(--surface); border-top: 1px solid var(--border);
        border-radius: var(--radius) var(--radius) 0 0;
        z-index: 195; padding: .75rem .85rem .85rem;
        animation: drawer-in .2s ease;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-drawer-title {
        font-size: .65rem; font-weight: 800; color: var(--muted);
        text-transform: uppercase; letter-spacing: .6px;
        padding: .1rem .1rem .6rem; border-bottom: 1px solid var(--border);
        margin-bottom: .65rem;
    }
    .mobile-drawer-group { margin-bottom: .9rem; }
    .mobile-drawer-group-label {
        font-size: .58rem; font-weight: 800; color: var(--muted);
        text-transform: uppercase; letter-spacing: .5px;
        padding: 0 .1rem .4rem;
    }
    .mobile-drawer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
    .mobile-drawer-item {
        display: flex; flex-direction: column; align-items: center; gap: .25rem;
        padding: .65rem .25rem .55rem; border-radius: var(--radius-sm); border: none;
        background: var(--surface2); color: var(--text-2); cursor: pointer;
        transition: background var(--tr), color var(--tr);
        font-family: inherit; touch-action: manipulation;
    }
    .mobile-drawer-item.active { background: var(--accent-dim); color: var(--accent); }
    .mobile-drawer-icon { font-size: 1.3rem; }
    .mobile-drawer-label {
        font-size: .58rem; font-weight: 600; text-align: center;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%;
        text-transform: uppercase; letter-spacing: .2px;
    }
    @keyframes drawer-in { from { transform: translateY(20px); opacity: 0; } }
}

@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .overview-grid { grid-template-columns: 1fr; }
    .service-row { padding: .65rem .75rem; gap: .55rem; }
    .service-res { display: none; }
    .log-detail { display: none; }
    .log-box { font-size: .68rem; padding: .65rem .75rem; height: 260px; }
    #toast-container { bottom: calc(var(--mobile-nav-h) + .75rem); right: .75rem; left: .75rem; align-items: stretch; }
    .toast { min-width: unset; max-width: unset; }
}

/* ─── Claude ─────────────────────────────────────────────────────────────── */
.cl-layout {
    display: flex; flex-direction: column; height: 100%;
    gap: 0;
}

/* Projekt-Leiste */
.cl-projects-bar {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1.5px solid var(--border);
    background: var(--surface);
}
.cl-proj-card {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .45rem .9rem; border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--surface2); color: var(--text);
    font-size: .85rem; font-weight: 600; cursor: pointer;
    transition: all var(--tr); font-family: inherit;
}
.cl-proj-card:hover { border-color: var(--proj-color); background: var(--surface); }
.cl-proj-card.active {
    border-color: var(--proj-color);
    background: var(--surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--proj-color) 18%, transparent);
}
.cl-proj-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--proj-color); flex-shrink: 0;
}
.cl-proj-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-proj-add {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: var(--radius-sm);
    border: 1.5px dashed var(--border); background: transparent;
    color: var(--muted); font-size: 1.1rem; cursor: pointer;
    transition: all var(--tr); flex-shrink: 0;
}
.cl-proj-add:hover { border-color: var(--accent); color: var(--accent); }

/* Workspace */
.cl-workspace {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg);
}
.cl-ws-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 1.25rem; background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.cl-tabs { display: flex; gap: .25rem; }
.cl-tab {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .35rem .8rem; border-radius: var(--radius-xs);
    border: none; background: transparent; color: var(--muted);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    transition: all var(--tr); font-family: inherit;
}
.cl-tab:hover { background: var(--surface2); color: var(--text); }
.cl-tab.active { background: var(--accent-dim); color: var(--accent); }
.cl-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem;
    border-radius: 999px; background: var(--accent); color: #fff;
    font-size: .65rem; font-weight: 700; line-height: 1;
}

/* Panel */
.cl-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* Chat */
.cl-messages {
    flex: 1; overflow-y: auto; padding: 1rem 1.25rem;
    display: flex; flex-direction: column; gap: .75rem;
}
.cl-msg { display: flex; }
.cl-msg-user { justify-content: flex-end; }
.cl-msg-ai   { justify-content: flex-start; }
.cl-bubble {
    max-width: 72%; padding: .65rem 1rem;
    border-radius: var(--radius); font-size: .875rem; line-height: 1.6;
    word-break: break-word;
}
.cl-msg-user .cl-bubble { background: var(--accent); color: #fff; border-radius: var(--radius) var(--radius) 4px var(--radius); }
.cl-msg-ai   .cl-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) var(--radius) 4px; }
.cl-input-wrap {
    border-top: 1.5px solid var(--border); background: var(--surface);
    padding: .75rem 1.25rem;
}
.cl-input {
    width: 100%; resize: none; padding: .6rem .8rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface2); color: var(--text); font-size: .875rem;
    font-family: inherit; transition: border-color var(--tr);
}
.cl-input:focus { outline: none; border-color: var(--accent); }
.cl-input-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }
.cl-token-info { font-size: .72rem; color: var(--muted); }
.cl-typing { display: flex; gap: .3rem; padding: .4rem .2rem; }
.cl-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
    animation: cl-bounce .9s infinite ease-in-out;
}
.cl-typing span:nth-child(2) { animation-delay: .15s; }
.cl-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes cl-bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

/* Code blocks */
.cl-code-wrap { position: relative; margin: .5rem 0; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.cl-code-lang { padding: .25rem .65rem; background: var(--surface3); font-size: .72rem; color: var(--muted); font-weight: 600; }
.cl-copy {
    position: absolute; top: .25rem; right: .5rem;
    background: var(--surface3); border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-size: .7rem; padding: .15rem .45rem; cursor: pointer; color: var(--text-2);
}
.cl-copy:hover { background: var(--surface2); }
.cl-code { padding: .75rem 1rem; overflow-x: auto; font-size: .82rem; line-height: 1.55; background: var(--surface2); margin: 0; }
.cl-inline { background: var(--surface3); padding: .1rem .35rem; border-radius: var(--radius-xs); font-size: .85em; }

/* TODO & Regeln */
.cl-list-wrap { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0; }
.cl-list-head { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
.cl-group-label { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: .75rem 0 .4rem; }
.cl-todo {
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: .4rem;
}
.cl-todo-top { display: flex; align-items: center; gap: .5rem; }
.cl-todo-title { flex: 1; font-weight: 600; font-size: .875rem; }
.cl-todo-desc { font-size: .8rem; color: var(--muted); margin-top: .3rem; padding-left: 1.6rem; }
.cl-todo-actions { display: flex; gap: .3rem; margin-top: .5rem; padding-left: 1.4rem; }
.cl-rule {
    display: flex; align-items: flex-start; gap: .75rem;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: .4rem;
    font-size: .875rem;
}
.cl-rule span:first-child { flex: 1; line-height: 1.5; }
.cl-del-btn {
    border: none; background: transparent; color: var(--muted);
    cursor: pointer; font-size: .8rem; padding: .1rem .3rem;
    border-radius: var(--radius-xs); transition: all var(--tr); flex-shrink: 0;
}
.cl-del-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Terminal ─────────────────────────────────────────────────────────────── */

/* Zero padding + fixed height when terminal is active */
.main:has(.term-wrap) {
    padding: 0 !important; overflow: hidden;
    height: calc(100dvh - var(--topbar-h));
    width: 100%; flex: none;
}

/* Fullscreen mode */
body.term-fullscreen-mode .sidebar,
body.term-fullscreen-mode .topbar,
body.term-fullscreen-mode .mobile-nav,
body.term-fullscreen-mode .sidebar-overlay { display: none !important; }
body.term-fullscreen-mode .main-wrap { margin-left: 0 !important; width: 100% !important; }
body.term-fullscreen-mode .main { height: 100dvh !important; padding: 0 !important; }

.term-wrap {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
    background: #0d1117;
}

/* Tab bar */
.term-tabs {
    display: flex; align-items: center; flex-shrink: 0;
    height: 40px; padding: 0 5px; gap: 3px;
    background: #161b22; border-bottom: 1px solid #30363d;
}
.term-tab-list {
    display: flex; align-items: center; gap: 2px;
    overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0;
}
.term-tab-list::-webkit-scrollbar { height: 3px; }
.term-tab-list::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

.term-tab {
    display: flex; align-items: center; gap: 5px;
    padding: 0 6px 0 8px; height: 30px; min-width: 80px; max-width: 160px;
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    color: #8b949e; font-size: .78rem; cursor: pointer; white-space: nowrap;
    font-family: inherit; transition: background .1s, color .1s; flex-shrink: 0;
}
.term-tab:hover  { background: #21262d; color: #c9d1d9; }
.term-tab.active { background: #21262d; border-color: #30363d; color: #e6edf3; }
.term-tab-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.term-tab-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.term-tab-close {
    width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
    border-radius: 3px; color: #6e7681; font-size: .9rem; line-height: 1; flex-shrink: 0;
    transition: background .1s, color .1s;
}
.term-tab-close:hover { background: #30363d; color: #ff7b72; }

.term-new-btn {
    width: 28px; height: 28px; flex-shrink: 0;
    background: transparent; border: 1px solid #30363d; border-radius: 6px;
    color: #8b949e; font-size: 1.1rem; cursor: pointer; line-height: 1;
    transition: background .1s, color .1s;
}
.term-new-btn:hover { background: #21262d; color: #e6edf3; }
.term-tabs-gap { flex: 1; min-width: 4px; }
.term-icon-btn {
    width: 28px; height: 28px; flex-shrink: 0;
    background: transparent; border: 1px solid #30363d; border-radius: 6px;
    color: #8b949e; font-size: 1rem; cursor: pointer; line-height: 1;
    transition: background .1s, color .1s;
}
.term-icon-btn:hover { background: #21262d; color: #e6edf3; }

/* Terminal panels */
.term-panels { flex: 1; position: relative; overflow: hidden; background: #0d1117; min-height: 0; }
.term-panel  { display: none; position: absolute; inset: 0; overflow: hidden; }
.term-panel.active { display: block; }
/* width+height 100% → FitAddon kann korrekte Dimensionen messen */
.term-panel .xterm { width: 100% !important; height: 100% !important; overflow: hidden; }
/* native xterm-scrollbar verstecken – wir nutzen unsere eigene */
.xterm .xterm-viewport::-webkit-scrollbar { display: none; }
.xterm .xterm-viewport { scrollbar-width: none; }

/* Claude shortcuts */
.term-shortcuts {
    display: flex; align-items: center; gap: 5px; flex-shrink: 0; flex-wrap: wrap;
    padding: 5px 8px; background: #161b22; border-top: 1px solid #30363d;
}
.term-sc {
    padding: 5px 11px; border-radius: 5px; border: 1px solid #30363d;
    background: #21262d; color: #8b949e; font-size: .76rem; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap;
    transition: background .1s, color .1s, border-color .1s;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.term-sc:hover  { background: #2d333b; color: #c9d1d9; border-color: #484f58; }
.term-sc-auto   { color: #d97706; border-color: #3d2e15; }
.term-sc-auto:hover { border-color: #d97706; color: #f59e0b; }
.term-sc-auto-on { background: #2d1a05 !important; border-color: #d97706 !important; color: #f59e0b !important; }
.term-sc-danger { color: #ff7b72; border-color: #3d1515; }
.term-sc-danger:hover { border-color: #ff7b72; background: #2d0d0d; color: #ffa198; }
.term-sc-scroll { color: #79c0ff; border-color: #1c3a5e; }
.term-sc-scroll:hover { border-color: #79c0ff; background: #0d2137; color: #a8d8ff; }
.term-sc-divider { width: 1px; height: 20px; background: #30363d; flex-shrink: 0; margin: 0 2px; }

/* New session dialog */
.term-dialog-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.term-dialog {
    background: #161b22; border: 1px solid #30363d; border-radius: 12px;
    padding: 1.2rem 1.4rem; width: min(380px, 90vw);
    display: flex; flex-direction: column; gap: .65rem;
}
.term-dialog-title { font-weight: 700; color: #e6edf3; font-size: .95rem; margin-bottom: .1rem; }
.term-dialog label { font-size: .7rem; font-weight: 700; color: #6e7681;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 0; }
.term-dialog .input { background: #21262d; border-color: #30363d; color: #e6edf3; }
.term-dialog .input:focus { border-color: #58a6ff; outline: none; box-shadow: none; }
.term-dialog-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.term-clr-btn {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent;
    cursor: pointer; transition: border-color .1s, transform .1s;
}
.term-clr-btn.active { border-color: #e6edf3; transform: scale(1.2); }
.term-dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .2rem; }

/* Custom scrollbar */
.term-sb-track {
    position: absolute;
    top: 4px; right: 2px; bottom: 4px;
    width: 8px;
    z-index: 15;
    cursor: pointer;
    border-radius: 4px;
}
.term-sb-thumb {
    position: absolute;
    left: 0; right: 0;
    background: #484f58;
    border-radius: 4px;
    cursor: grab;
    min-height: 24px;
    display: none;
    transition: background .1s;
}
.term-sb-thumb:hover  { background: #6e7681; }
.term-sb-thumb:active { background: #8b949e; cursor: grabbing; }
.term-sb-track:hover .term-sb-thumb { background: #6e7681; }

/* Error state */
.term-err { color: #ff7b72; padding: 1.5rem; font-family: monospace; font-size: .85rem; }

/* Mobile */
@media (max-width: 820px) {
    .main:has(.term-wrap) {
        height: calc(100dvh - var(--topbar-h) - var(--mobile-nav-h) - env(safe-area-inset-bottom));
        max-width: 100vw; overflow-x: hidden;
    }
    .term-wrap  { max-width: 100%; }
    .term-panels { overflow: hidden; }
    .term-tabs  { height: 44px; }
    .term-tab   { min-width: 70px; font-size: .75rem; height: 34px; }
    .term-sc    { padding: 5px 9px; font-size: .73rem; }
    .term-shortcuts {
        padding: 5px 8px; gap: 5px;
        flex-wrap: wrap;
    }
    .term-sc-divider { display: none; }
}

/* ── Mobile Terminal (mterm) ─────────────────────────────────────────────────── */

.main:has(.mterm-wrap) {
    padding: 0 !important; overflow: hidden;
    height: calc(100dvh - var(--topbar-h) - var(--mobile-nav-h) - env(safe-area-inset-bottom));
    width: 100%; flex: none;
}

body.mterm-fullscreen-mode .sidebar,
body.mterm-fullscreen-mode .topbar,
body.mterm-fullscreen-mode .mobile-nav,
body.mterm-fullscreen-mode .sidebar-overlay { display: none !important; }
body.mterm-fullscreen-mode .main-wrap { margin-left: 0 !important; width: 100% !important; }
body.mterm-fullscreen-mode .main { height: 100dvh !important; padding: 0 !important; }

.mterm-wrap {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
    background: #0d1117;
}

/* Topbar: scrollable tabs + icon buttons */
.mterm-topbar {
    display: flex; align-items: center; gap: 4px;
    height: 44px; padding: 0 6px; flex-shrink: 0;
    background: #161b22; border-bottom: 1px solid #30363d;
}
.mterm-tabs {
    display: flex; align-items: center; gap: 3px;
    flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
}
.mterm-tabs::-webkit-scrollbar { display: none; }
.mterm-tab {
    display: flex; align-items: center; gap: 5px;
    padding: 0 7px 0 8px; height: 32px; flex-shrink: 0;
    min-width: 60px; max-width: 130px;
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    color: #6e7681; font-size: .76rem; cursor: pointer; white-space: nowrap;
    font-family: inherit; transition: background .1s, color .1s;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.mterm-tab:active, .mterm-tab.active { background: #21262d; border-color: #30363d; color: #e6edf3; }
.mterm-tab-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mterm-tab-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mterm-tab-close {
    width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
    border-radius: 3px; color: #484f58; font-size: .9rem; flex-shrink: 0;
    transition: background .1s, color .1s;
}
.mterm-tab-close:active { background: #30363d; color: #ff7b72; }

.mterm-topbar-btns { display: flex; gap: 3px; flex-shrink: 0; }
.mterm-tbtn {
    width: 32px; height: 32px; background: transparent;
    border: 1px solid #30363d; border-radius: 6px;
    color: #8b949e; font-size: 1rem; cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .1s, color .1s;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.mterm-tbtn:active { background: #21262d; color: #e6edf3; }

/* Terminal panels container + panels */
.mterm-panels {
    flex: 1; min-height: 0; position: relative; overflow: hidden;
    background: #0d1117;
}
.mterm-panel {
    display: none; position: absolute; inset: 0; overflow: hidden;
}
.mterm-panel.active { display: block; }
.mterm-panel .xterm { width: 100% !important; height: 100% !important; overflow: hidden; }
.mterm-panel .xterm-viewport::-webkit-scrollbar { display: none; }
.mterm-panel .xterm-viewport { scrollbar-width: none; }

/* Two-row button grid */
.mterm-keys {
    flex-shrink: 0; background: #161b22; border-top: 1px solid #30363d;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 5px;
}
.mterm-row {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px;
}
.mterm-key {
    height: 46px; border-radius: 8px; border: 1px solid #30363d;
    background: #21262d; color: #c9d1d9;
    font-size: .78rem; font-weight: 600; font-family: inherit;
    cursor: pointer; white-space: nowrap; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    transition: background .1s, color .1s, border-color .1s;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    user-select: none; -webkit-user-select: none;
}
.mterm-key:active { background: #2d333b; border-color: #484f58; color: #e6edf3; }

.mterm-key-danger          { color: #ff7b72; border-color: #3d1515; background: #1a0d0d; }
.mterm-key-danger:active   { background: #2d0d0d; border-color: #ff7b72; }
.mterm-key-auto            { color: #d97706; border-color: #3d2e15; background: #1a1305; }
.mterm-key-auto:active     { border-color: #d97706; }
.mterm-key-auto-on         { background: #2d1a05 !important; border-color: #d97706 !important; color: #f59e0b !important; }
.mterm-key-scroll          { color: #79c0ff; border-color: #1c3a5e; background: #0a1520; }
.mterm-key-scroll:active   { background: #0d2137; border-color: #79c0ff; }

.mterm-err { color: #ff7b72; padding: 1.5rem; font-family: monospace; font-size: .85rem; }

/* ─── Dashboard (home) ──────────────────────────────────────────────────────── */
.dash-quick-bar {
    display: flex; gap: .45rem; flex-wrap: wrap; align-items: center;
    margin-bottom: 1.25rem; padding: .75rem 1rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.dash-qa-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .35rem .8rem; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border); background: transparent;
    color: var(--text-2); font-size: .8rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all var(--tr);
    white-space: nowrap; touch-action: manipulation;
}
.dash-qa-btn:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.dash-qa-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.dash-qa-result { font-size: .78rem; color: var(--muted); margin-left: auto; }

.dash-grid-3 {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.1rem; margin-bottom: 1.25rem;
}
.dash-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow);
    min-height: 0;
}
.dash-panel-hd {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .66rem; font-weight: 800; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: .85rem; padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}

.dash-services-grid { display: flex; flex-direction: column; gap: .35rem; }
.dash-svc-row {
    display: flex; align-items: center; gap: .65rem;
    padding: .45rem .6rem; border-radius: var(--radius-sm);
    background: var(--surface2);
    transition: background var(--tr);
}
.dash-svc-row:hover { background: var(--surface3); }
.dash-svc-name { flex: 1; font-size: .83rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dash-infra-list { display: flex; flex-direction: column; gap: .45rem; }
.dash-infra-item {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .6rem .75rem; border-radius: var(--radius-sm);
    background: var(--surface2); border-left: 3px solid var(--border);
    transition: background var(--tr), box-shadow var(--tr);
    cursor: pointer;
}
.dash-infra-item:hover { background: var(--surface3); box-shadow: var(--shadow); }
.dash-infra-item.ok-border    { border-left-color: var(--success); }
.dash-infra-item.warn-border  { border-left-color: var(--warn); }
.dash-infra-item.alert-border { border-left-color: var(--danger); }
.dash-infra-item.muted        { border-left-color: var(--border); }
.dash-infra-icon  { font-size: .95rem; flex-shrink: 0; width: 20px; text-align: center; margin-top: .1rem; }
.dash-infra-body  { flex: 1; min-width: 0; }
.dash-infra-label { font-size: .62rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.dash-infra-value { font-size: .83rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-infra-sub   { font-size: .7rem; color: var(--muted); }

@media (max-width: 960px) {
    .dash-grid-3 { grid-template-columns: 1fr 1fr; }
    .dash-qa-result { display: none; }
}
@media (max-width: 580px) {
    .dash-grid-3 { grid-template-columns: 1fr; }
}

/* ─── GPIO view ─────────────────────────────────────────────────────────────── */
.gpio-wrap { max-width: 100%; }
.gpio-legend { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 1rem; }
.gpio-legend-item { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--text-2); white-space: nowrap; }
.gpio-legend-dot  { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }

.gpio-pinout-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .5rem; }
.gpio-pinout {
    display: grid; grid-template-rows: repeat(20, auto);
    gap: .35rem; width: fit-content; min-width: 100%;
}
.gpio-pin-row { display: flex; align-items: center; gap: .55rem; }
.gpio-pin-label-left  { width: 90px; text-align: right; font-size: .68rem; color: var(--text-2); line-height: 1.2; flex-shrink: 0; }
.gpio-pin-label-right { width: 90px; text-align: left;  font-size: .68rem; color: var(--text-2); line-height: 1.2; flex-shrink: 0; }
.gpio-pin-label-sub   { font-size: .6rem; color: var(--muted); display: block; }
.gpio-pin {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: .62rem; font-weight: 800; cursor: pointer;
    border: 2px solid transparent; transition: all var(--tr);
    position: relative; line-height: 1.1; text-align: center;
    touch-action: manipulation;
}
.gpio-pin:hover { transform: scale(1.15); box-shadow: var(--shadow-md); z-index: 5; }
.gpio-pin.power5v  { background: #dc2626; color: #fff; border-color: #b91c1c; }
.gpio-pin.power3v3 { background: #ea580c; color: #fff; border-color: #c2410c; }
.gpio-pin.gnd      { background: #374151; color: #9ca3af; border-color: #4b5563; }
.gpio-pin.gpio-free{ background: var(--success-bg); color: var(--success); border-color: var(--success); }
.gpio-pin.i2c      { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.gpio-pin.spi      { background: #ede9fe; color: #7c3aed; border-color: #a78bfa; }
.gpio-pin.uart     { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.gpio-pin.pwm      { background: #fce7f3; color: #db2777; border-color: #f472b6; }
.gpio-pin.eeprom   { background: var(--surface2); color: var(--muted); border-color: var(--border); }
.gpio-pin.active-hi { box-shadow: 0 0 0 3px rgba(22,163,74,.4); }
.gpio-pin.active-lo { opacity: .7; }
.theme-dark .gpio-pin.spi   { background: #2e1065; color: #a78bfa; border-color: #7c3aed; }
.theme-dark .gpio-pin.pwm   { background: #500724; color: #f9a8d4; border-color: #db2777; }
.gpio-pin-phys { font-size: .5rem; position: absolute; bottom: 2px; right: 3px; opacity: .55; font-weight: 600; }

.gpio-tooltip {
    position: fixed; z-index: 999; pointer-events: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .55rem .8rem;
    box-shadow: var(--shadow-lg); font-size: .78rem; max-width: 200px;
    opacity: 0; transition: opacity .1s;
}
.gpio-tooltip.visible { opacity: 1; }
.gpio-tooltip-title { font-weight: 700; margin-bottom: .25rem; color: var(--text); }
.gpio-tooltip-row   { display: flex; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .72rem; }
.gpio-tooltip-conn  { color: var(--accent); font-weight: 600; margin-top: .2rem; font-size: .72rem; }

.gpio-conn-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.gpio-conn-table th { text-align: left; padding: .45rem .65rem; font-size: .63rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.gpio-conn-table td { padding: .45rem .65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.gpio-conn-table tr:last-child td { border-bottom: none; }
.gpio-conn-table tr:hover td { background: var(--surface2); }
.gpio-conn-input {
    padding: .28rem .55rem; border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--surface); color: var(--text); font-size: .82rem; width: 100%;
    font-family: inherit; transition: border-color var(--tr);
}
.gpio-conn-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.gpio-pin-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: .63rem; font-weight: 800; flex-shrink: 0;
}
.gpio-diag-item {
    display: flex; align-items: center; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .6rem .9rem;
    margin-bottom: .4rem; font-size: .83rem;
}
.gpio-diag-pin  { font-weight: 800; width: 50px; flex-shrink: 0; font-family: monospace; }
.gpio-diag-func { color: var(--muted); font-size: .75rem; width: 70px; flex-shrink: 0; }
.gpio-diag-val  { font-weight: 700; width: 40px; flex-shrink: 0; }
.gpio-diag-conn { flex: 1; color: var(--accent); font-size: .78rem; }
.gpio-diag-warn { background: var(--warn-bg); border-color: var(--warn); }

@media (max-width: 820px) {
    .gpio-pin-label-left, .gpio-pin-label-right { width: 70px; font-size: .62rem; }
    .gpio-pin { width: 36px; height: 36px; font-size: .58rem; }
    .gpio-pinout { gap: .28rem; }
}
@media (max-width: 480px) {
    .gpio-pin-label-left, .gpio-pin-label-right { width: 55px; font-size: .58rem; }
    .gpio-pin-label-sub { display: none; }
    .gpio-pin { width: 32px; height: 32px; }
}

.spinner-sm {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Topbar mobile: section label ausblenden */
@media (max-width: 820px) {
    .topbar-section { display: none; }
    .topbar-title { font-size: .88rem; }
}

/* ── Git-Browser ─────────────────────────────────────────────────────────── */
.git-layout        { display: flex; height: 100%; gap: 0; min-height: 0; }
.git-sidebar       { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border);
                     overflow-y: auto; display: flex; flex-direction: column; }
.git-sidebar-header{ padding: .6rem .75rem; font-size: .7rem; font-weight: 700;
                     text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
                     display: flex; align-items: center; justify-content: space-between;
                     border-bottom: 1px solid var(--border); }
.git-repo-item     { padding: .6rem .75rem; cursor: pointer; border-bottom: 1px solid var(--border);
                     transition: background .1s; }
.git-repo-item:hover   { background: var(--surface2); }
.git-repo-item.active  { background: var(--accent-bg); }
.git-repo-name     { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.git-repo-meta     { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.git-branch        { font-size: .7rem; color: var(--muted); }

.git-main          { flex: 1; overflow-y: auto; padding: 1.25rem; min-width: 0; }
.git-repo-header   { display: flex; align-items: flex-start; justify-content: space-between;
                     gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.git-repo-header h2  { margin: 0 0 .2rem; font-size: 1.1rem; }
.git-branch-label  { font-size: .78rem; color: var(--accent); font-weight: 600; }
.git-last-commit   { font-size: .75rem; text-align: right; max-width: 300px; }

.git-tabs          { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); }
.git-tab           { background: none; border: none; border-bottom: 2px solid transparent;
                     padding: .45rem .85rem; font-size: .82rem; cursor: pointer;
                     color: var(--muted); transition: color .15s; display: flex; align-items: center; gap: .35rem; }
.git-tab:hover     { color: var(--fg); }
.git-tab.active    { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.git-log           { display: flex; flex-direction: column; gap: 0; }
.git-commit        { padding: .65rem 0; border-bottom: 1px solid var(--border); display: grid;
                     grid-template-columns: 5rem 1fr; grid-template-rows: auto auto; gap: .1rem .75rem; }
.git-commit-hash   { font-family: monospace; font-size: .78rem; color: var(--accent);
                     grid-row: 1 / 3; align-self: center; }
.git-commit-msg    { font-size: .85rem; font-weight: 500; }
.git-commit-meta   { font-size: .73rem; }

.git-status-list   { display: flex; flex-direction: column; gap: .35rem; }
.git-status-row    { display: flex; align-items: center; gap: .6rem; font-size: .82rem; }
.git-state-badge   { font-family: monospace; font-size: .72rem; font-weight: 700;
                     padding: .1rem .35rem; border-radius: 3px; min-width: 1.6rem; text-align: center; }
.git-state-m       { background: var(--warn-bg); color: var(--warn); }
.git-state-a       { background: var(--success-bg); color: var(--success); }
.git-state-d       { background: var(--danger-bg); color: var(--danger); }
.git-state-u       { background: var(--surface2); color: var(--muted); }
.git-status-file   { font-family: monospace; font-size: .8rem; word-break: break-all; }

.git-diff-stat     { font-size: .78rem; margin: 0 0 1rem; padding: .75rem;
                     background: var(--surface2); border-radius: var(--radius-sm);
                     border: 1px solid var(--border); white-space: pre-wrap; }
.git-diff          { font-size: .75rem; line-height: 1.6; font-family: monospace;
                     background: var(--surface2); border: 1px solid var(--border);
                     border-radius: var(--radius-sm); padding: .75rem; overflow-x: auto;
                     white-space: pre; margin: 0; }
.diff-add          { color: var(--success); }
.diff-del          { color: var(--danger); }
.diff-hunk         { color: var(--accent); font-weight: 600; }

.git-commit-box    { margin-top: 1.5rem; padding: 1rem; background: var(--surface2);
                     border: 1px solid var(--border); border-radius: var(--radius-sm);
                     display: flex; gap: .75rem; align-items: flex-start; }
.git-commit-box textarea { flex: 1; min-height: 56px; resize: vertical; }

@media (max-width: 820px) {
    .git-layout  { flex-direction: column; }
    .git-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 180px; }
}

/* ── Projekt-Views ─────────────────────────────────────────────────────────── */
.proj-header        { display: flex; align-items: center; gap: .85rem; padding: .75rem 0 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.proj-icon          { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.proj-header-info   { min-width: 0; }
.proj-title         { font-size: 1.15rem; font-weight: 700; }
.proj-desc          { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

.proj-placeholder   { padding: 2.5rem 1.5rem; text-align: center; margin-top: 1rem; }
.proj-placeholder-icon  { font-size: 2.5rem; margin-bottom: .6rem; }
.proj-placeholder-label { font-size: 1rem; font-weight: 600; color: var(--text); }
.proj-placeholder-desc  { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.proj-placeholder-hint  { font-size: .8rem; color: var(--muted); margin-top: 1rem; }

.proj-git-statusbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
                      padding: .6rem .9rem; background: var(--surface2); border-radius: 8px;
                      margin-bottom: 1rem; font-size: .85rem; }

/* ── Web-Projekte ──────────────────────────────────────────────────────────── */
.web-layout        { display: flex; height: 100%; gap: 0; min-height: 0; }
.web-sidebar       { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border);
                     display: flex; flex-direction: column; overflow: hidden; }
.web-sidebar-hd    { padding: .6rem .75rem; display: flex; align-items: center;
                     justify-content: space-between; border-bottom: 1px solid var(--border);
                     flex-shrink: 0; }
.web-sidebar-title { font-size: .7rem; font-weight: 700; color: var(--muted);
                     text-transform: uppercase; letter-spacing: .5px; }
.web-item          { padding: .6rem .75rem; cursor: pointer; border-bottom: 1px solid var(--border);
                     transition: background var(--tr); }
.web-item:hover    { background: var(--surface2); }
.web-item.active   { background: var(--accent-bg); }
.web-item-name     { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.web-item-meta     { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.web-item-url      { font-size: .7rem; color: var(--muted); }
.web-main          { flex: 1; overflow-y: auto; padding: 1.25rem; min-width: 0; }
.web-detail        { max-width: 720px; }
.web-empty         { display: flex; flex-direction: column; align-items: center;
                     justify-content: center; height: 100%; gap: .5rem; color: var(--muted);
                     font-size: .9rem; }
.web-empty-icon    { font-size: 2.5rem; }
.web-empty-hint    { padding: .75rem; color: var(--muted); font-size: .82rem; }
.web-meta-box      { margin-top: 1.25rem; font-size: .8rem; color: var(--muted);
                     background: var(--surface2); border-radius: 6px; padding: .75rem 1rem;
                     display: flex; flex-direction: column; gap: .3rem; text-align: left; }
.web-sftp-box      { background: var(--surface2); border-radius: 6px; padding: .75rem 1rem;
                     margin: .5rem 0; font-size: .82rem; line-height: 1.7; }

/* FTP directory browser */
.ftpb-row          { display: flex; align-items: center; gap: .5rem; padding: .45rem 1rem;
                     font-size: .88rem; cursor: pointer; border-radius: 0; transition: background .12s; }
.ftpb-row:hover    { background: var(--surface2); }
.ftpb-row span     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftpb-up           { color: var(--muted); }

/* Credentials */
.cred-grid         { display: flex; flex-direction: column; gap: .4rem; }
.cred-row          { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: .5rem; }
.cred-label        { font-size: .78rem; color: var(--muted); }
.cred-value        { font-size: .8rem; padding: .2rem .4rem; background: var(--surface2);
                     border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-secret       { filter: blur(5px); cursor: pointer; user-select: none; transition: filter .2s; }
.cred-secret.revealed { filter: none; }

/* field-label helper */
.field-label       { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }

@media (max-width: 820px) {
    .web-layout  { flex-direction: column; }
    .web-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border);
                   max-height: 200px; overflow-y: auto; }
}

/* ── Projekte: Disk-Bar & Info-Grid ──────────────────────────────────────── */
.proj-disk-bar  { height: 8px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.proj-disk-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.proj-disk-fill.warn { background: var(--warn); }
.proj-disk-fill.crit { background: var(--danger); }

.proj-info-grid { display: flex; flex-direction: column; gap: .6rem; font-size: .85rem; }
.proj-info-row  { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.proj-info-label { min-width: 110px; color: var(--muted); font-size: .78rem; flex-shrink: 0; }

/* ── Logbuch ─────────────────────────────────────────────────────────────── */
.logbuch-entry  { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.logbuch-entry:last-child { border-bottom: none; }
.logbuch-meta   { display: flex; align-items: center; gap: .4rem; margin-bottom: .25rem; }
.logbuch-msg    { font-size: .88rem; white-space: pre-wrap; word-break: break-word; }
.logbuch-add    { border-bottom: 1px solid var(--border); padding-bottom: 1rem; }

/* ── RAM-Limits ──────────────────────────────────────────────────────────── */
.memlimit-row {
    display: grid;
    grid-template-columns: 140px 1fr auto auto;
    align-items: center;
    gap: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .9rem;
    box-shadow: var(--shadow);
}
.memlimit-label  { display: flex; align-items: center; gap: .4rem; min-width: 0; overflow: hidden; }
.memlimit-bar-wrap { flex: 1; min-width: 80px; }
.memlimit-stats  { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.memlimit-action { flex-shrink: 0; }

@media (max-width: 600px) {
    .memlimit-row { grid-template-columns: 1fr auto; grid-template-rows: auto auto; }
    .memlimit-bar-wrap { grid-column: 1 / -1; }
    .memlimit-stats { display: none; }
}
