:root {
    --tiefblau: #2C3E4A;
    --tiefblau-2: #24343e;
    --salbei: #8FA88F;
    --salbei-2: #7d987d;
    --creme: #F4F0E8;
    --card: #ffffff;
    --ink: #1c2830;
    --muted: #5c6b73;
    --line: #e4ddd3;
    --ok: #2f7d4a;
    --ok-bg: #e8f4ec;
    --warn: #b5791a;
    --warn-bg: #fbf3e4;
    --err: #b42318;
    --err-bg: #fdecea;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(44, 62, 74, .06);
    --nav: 72px;
    --sidebar: 248px;
    --topbar: 72px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Lato, ui-sans-serif, system-ui, sans-serif;
    background: var(--creme);
    color: var(--ink);
    line-height: 1.45;
    font-size: 16px;
    font-weight: 400;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
.app { flex: 1; min-height: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: .45rem 1rem;
    min-height: var(--topbar);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar img { height: 52px; width: auto; max-width: min(100%, 420px); }
.sidebar {
    display: none;
    background: var(--tiefblau);
    color: #e8eeef;
    flex-direction: column;
    padding: 1.25rem 1rem 1rem;
}
.brand {
    display: flex;
    justify-content: center;
    text-decoration: none;
    padding: .1rem .15rem 1.05rem;
}
.brand-mark { width: 88px; height: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem .8rem;
    border-radius: 10px;
    text-decoration: none;
    color: #d5dee2;
    font-weight: 500;
    min-height: 44px;
}
.nav-link:hover, .nav-link.is-active { background: rgba(255,255,255,.08); color: #fff; }
.nav-link svg { width: 20px; height: 20px; flex: 0 0 auto; opacity: .9; }
.sidebar-user {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: .9rem;
    margin-top: .6rem;
}
.sidebar-user .who { font-weight: 600; font-size: .92rem; }
.sidebar-user .meta { color: #afbdbf; font-size: .8rem; margin: .15rem 0 .55rem; }
.main {
    padding: 1.25rem 1.15rem calc(var(--nav) + 1.4rem);
    max-width: 920px;
    margin: 0 auto;
}
.page-head { margin-bottom: 1.15rem; }
.page-head h1 {
    margin: 0 0 .2rem;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.lede { margin: 0; color: var(--muted); }
.grid-3, .grid-2 { display: grid; gap: .85rem; }
.grid-3 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.15rem 1.15rem;
    margin-bottom: .85rem;
}
.card h2 { margin: 0 0 .25rem; font-size: 1.05rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 .85rem; }
.status-card {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    margin-bottom: 0;
}
.status-card strong { display: block; font-size: .82rem; color: var(--muted); font-weight: 600; }
.status-card .val { font-weight: 700; font-size: 1.02rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; background: #c4b8aa; margin-top: .35rem; flex: 0 0 auto; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: .65rem 1.1rem;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    background: var(--tiefblau);
}
.btn:hover { background: var(--tiefblau-2); }
.btn:disabled { opacity: .65; cursor: wait; }
.sync-hero {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.sync-hero img {
    width: 72px;
    height: auto;
    flex: 0 0 auto;
}
.btn-primary { width: 100%; }
.btn-secondary { background: transparent; color: var(--tiefblau); border: 1px solid var(--line); }
.btn-secondary:hover { background: #f3eee7; }
.btn-ghost { background: transparent; color: #afbdbf; border: 1px solid rgba(255,255,255,.18); min-height: 40px; font-weight: 600; font-size: .88rem; }
.btn-sm { min-height: 40px; padding: .45rem .85rem; font-size: .9rem; width: auto; }
.ok, .err, .warn {
    border-radius: 12px;
    padding: .8rem .9rem;
    margin: 0 0 .85rem;
}
.ok { background: var(--ok-bg); color: var(--ok); }
.err { background: var(--err-bg); color: var(--err); }
.warn { background: var(--warn-bg); color: var(--warn); }
.details-tech { margin: .4rem 0 0; }
.details-tech summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
.option {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .8rem .85rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: .55rem;
}
.option:has(input:checked) { border-color: var(--salbei); background: #f4f7f4; }
.option label { cursor: pointer; flex: 1; }
.option .meta { display: block; color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.option input[type="text"] {
    margin-top: .5rem;
    width: min(100%, 18rem);
    font: inherit;
    padding: .5rem .65rem;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.option input[type="text"]:disabled { opacity: .45; }
.row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--line);
    min-height: 52px;
}
.row-item:last-child { border-bottom: 0; }
.row-item .name { font-weight: 600; }
.row-item .sub { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; }
.pill {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--ok);
    background: var(--ok-bg);
    border-radius: 999px;
    padding: .18rem .55rem;
}
.pill.off { color: var(--muted); background: #f3eee7; }
.sync-result { margin: .75rem 0 0; padding: 0; list-style: none; color: var(--muted); }
.sync-result li { margin: .2rem 0; }
.event { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.event .when { color: var(--muted); font-size: .8rem; font-weight: 600; }
.event .title { font-weight: 700; margin-top: .15rem; }
.event .detail { color: var(--muted); font-size: .88rem; white-space: pre-wrap; }
.event.is-ok .title { color: var(--ok); }
.event.is-err .title { color: var(--err); }
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--nav);
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-around;
    padding: .25rem .3rem calc(.25rem + env(safe-area-inset-bottom));
    z-index: 20;
}
.bottom-nav a, .bottom-nav .more {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    text-decoration: none;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 600;
    min-height: 44px;
    background: none;
    border: 0;
    font-family: inherit;
}
.bottom-nav a.is-active, .bottom-nav .more.is-active { color: var(--tiefblau); }
.bottom-nav svg { width: 22px; height: 22px; }
.more-sheet {
    display: none;
    position: fixed;
    left: .75rem; right: .75rem; bottom: calc(var(--nav) + .5rem);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: .4rem;
    z-index: 21;
}
.more-sheet.is-open { display: block; }
.more-sheet a { display: block; padding: .85rem .9rem; text-decoration: none; font-weight: 600; border-radius: 10px; }
.more-sheet a:hover { background: #f4f0e8; }
.savebar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid var(--line);
}
.savebar label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); font-weight: 600; }
input[type="password"],
input[type="file"] {
    font: inherit;
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    min-width: 14rem;
    background: #fff;
}
input[type="file"] { min-width: 18rem; max-width: 100%; }
.import-log { white-space: pre-wrap; font-size: .88rem; line-height: 1.45; }
.format-help { margin-top: .8rem; }
.format-help summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.format-sample {
    margin: .7rem 0 0;
    padding: .8rem .9rem;
    background: #f7f4ee;
    border-radius: 10px;
    overflow: auto;
    font-size: .78rem;
    line-height: 1.4;
}
.empty { color: var(--muted); padding: .4rem 0; }
@media (min-width: 1024px) {
    .topbar { justify-content: flex-start; padding: .5rem 1.25rem .5rem 1.1rem; }
    .topbar img { height: 56px; }
    .app { display: flex; }
    .sidebar { display: flex; width: var(--sidebar); position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); flex: 0 0 var(--sidebar); }
    .bottom-nav, .more-sheet { display: none !important; }
    .main { flex: 1; padding: 1.75rem 2rem 2.5rem; margin: 0; max-width: none; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .btn-primary { width: auto; min-width: 16rem; }
}
