:root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #e6e6e6;
    --muted: #9aa3b2;
    --primary: #3aa3ff;
    --danger: #ff5a5a;
    --radius: 14px;

    /* Typo-+Rhythmus-Feinschliff */
    --fs-body: 17px;
    --fs-label: 15px;
    --fs-small: 14px;
    --lh: 1.6;

    --tap: 44px;         /* min. Touch-Größe */
    --gap: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: var(--fs-body)/var(--lh) system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    letter-spacing: .2px;
}

/* ===== Topbar (mobilfreundlich) ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    padding: 12px 16px;
    background: #11141aee;
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #222833;
    flex-wrap: wrap;           /* mobile: Elemente umbrechen */
}

.topbar h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
    letter-spacing: .3px;
    flex: 1 1 100%;            /* mobile: Überschrift volle Breite */
}

/* Nav: horizontal scroll auf Mobile, normal auf Desktop */
.topbar nav {
    display: flex;
    gap: 8px;
    width: 100%;
    overflow-x: auto;          /* mobile: wischen */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 2px;       /* Platz für Scrollbar */
}

.topbar nav a {
    color: var(--text);
    text-decoration: none;
    padding: 10px 12px;        /* größere Tap Targets */
    border-radius: 999px;      /* Pill-Buttons */
    border: 1px solid transparent;
    background: #1a2230;
    white-space: nowrap;       /* nicht umbrechen innerhalb des Pills */
    min-height: var(--tap);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
    flex: 0 0 auto;            /* Breite folgt Inhalt (für Scroll) */
}

.topbar nav a:hover { background: #222b3a; border-color: #2a3340; }
.topbar nav a:active { transform: translateY(1px); }
.topbar nav a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ab ~Tablet: klassische, einzeilige Topbar */
@media (min-width: 700px) {
    .topbar { flex-wrap: nowrap; }
    .topbar h1 { flex: 0 0 auto; }
    .topbar nav { width: auto; overflow: visible; }
}

/* ===== Layout ===== */
.container {
    max-width: 980px;
    margin: 24px auto;
    padding: 0 16px;
}

.card {
    background: var(--card);
    border: 1px solid #222833;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 10px 30px #00000040, inset 0 1px 0 #252a34;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #2a3340;
    background: #1c2330;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    min-height: var(--tap);
    min-width: 180px;
}

.btn.primary {
    background: var(--primary);
    color: #0a0f16;
    border-color: transparent;
}

.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Inputs / Labels ===== */
.input {
    width: 100%;
    padding: 12px 14px;              /* etwas größer für Touch */
    border-radius: 12px;
    border: 1px solid #2a3340;
    background: #11161f;
    color: var(--text);
    min-height: var(--tap);
}

.label {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
    font-size: var(--fs-label);
}

textarea.input {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, "Noto Sans";
    font-size: var(--fs-small);
    line-height: 1.5;
    overflow: auto;
    resize: vertical;
}

/* ===== Listen ===== */
.list { margin: 0; padding: 0; list-style: none; }

.item {
    padding: 12px 8px;
    border-bottom: 1px solid #222833;
}

.item h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
}

.item p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #233044;
    color: #9ac7ff;
    font-size: 12px;
    margin-left: 8px;
}

/* ===== Signature Pad ===== */
.sig-wrap {
    border: 1px solid #2a3340;
    border-radius: 10px;
    background: #11161f;
}

.sig-wrap canvas {
    width: 100%;
    height: 180px;
    display: block;
    background: #11161f; /* nur visuell */
}

/* ===== Helper ===== */
.help {
    color: var(--muted);
    font-size: var(--fs-small);
    margin-top: 6px;
}
