/* =====================================================================
   WebFriends – Design (Dusk)
   Modern, dunkel, eigenstaendig. Farben zentral als Variablen.
   ===================================================================== */

:root {
    --bg:       #0f1220;
    --bg2:      #151932;
    --surface:  #1c2140;
    --surface2: #232a4f;
    --text:     #e9ebf6;
    --muted:    #9aa1c4;
    --accent:   #6c8cff;
    --accent2:  #b57bff;
    --danger:   #ff6b7d;
    --ok:       #4ad6a0;
    --line:     rgba(255,255,255,.09);
    --radius:   16px;
    --shadow:   0 18px 50px rgba(0,0,0,.45);
    --ff-disp:  "Space Grotesk", system-ui, sans-serif;
    --ff-body:  "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--ff-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(1100px 600px at 15% -10%, rgba(108,140,255,.20), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(181,123,255,.16), transparent 55%),
        var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Wortmarke --- */
.brand {
    font-family: var(--ff-disp);
    font-weight: 700;
    letter-spacing: -.02em;
    font-size: 1.5rem;
}
.brand .b1 { color: var(--text); }
.brand .b2 {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Auth-Layout (Login / Registrierung / Install) --- */
.auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 18px 48px;
}
.card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, var(--surface), var(--bg2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 26px;
}
.card .brand { display: block; text-align: center; margin-bottom: 6px; }
.card h1 {
    font-family: var(--ff-disp);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    margin: 4px 0 4px;
    letter-spacing: -.01em;
}
.card .sub {
    text-align: center;
    color: var(--muted);
    font-size: .93rem;
    margin: 0 0 22px;
}

/* --- Formular --- */
label {
    display: block;
    font-size: .82rem;
    color: var(--muted);
    margin: 14px 0 6px;
    letter-spacing: .01em;
}
input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 13px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--ff-body);
    font-size: 1rem;
    transition: border-color .15s, box-shadow .15s;
}
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,140,255,.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 22px;
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #fff;
    font-family: var(--ff-disp);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--line);
}
.btn.small { width: auto; margin-top: 0; padding: 9px 14px; font-size: .88rem; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }

.msg {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .9rem;
    margin-bottom: 8px;
}
.msg.error { background: rgba(255,107,125,.12); border: 1px solid rgba(255,107,125,.4); color: #ffd0d6; }
.msg.ok    { background: rgba(74,214,160,.12); border: 1px solid rgba(74,214,160,.4); color: #c4f5e4; }
.msg.info  { background: rgba(108,140,255,.10); border: 1px solid rgba(108,140,255,.3); color: #d6def9; }

.foot-links { text-align: center; margin-top: 20px; font-size: .9rem; color: var(--muted); }

/* --- Avatar-Auswahl --- */
.avatar-pick {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}
.avatar-preview {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
    border: 2px dashed var(--line);
    flex: 0 0 auto;
}
.avatar-pick .hint { color: var(--muted); font-size: .82rem; }
input[type="file"] { display: none; }

/* --- App-Layout --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(15,18,32,.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .right { display: flex; align-items: center; gap: 10px; }
.wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 18px 60px;
}

.avatar-sm {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; border: 1px solid var(--line);
}
.avatar-md {
    width: 64px; height: 64px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--line);
}

.panel {
    background: linear-gradient(180deg, var(--surface), var(--bg2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.panel h2 {
    font-family: var(--ff-disp);
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0 0 4px;
}
.panel .sub { color: var(--muted); font-size: .88rem; margin: 0 0 14px; }

.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-row .name { font-family: var(--ff-disp); font-weight: 600; font-size: 1.1rem; }
.profile-row .role { color: var(--muted); font-size: .82rem; }

/* --- Einladungslink --- */
.invite-box {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.invite-box input {
    flex: 1;
    background: var(--bg);
    font-size: .86rem;
    color: var(--muted);
}

/* --- Kontaktliste --- */
.contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 6px;
    border-bottom: 1px solid var(--line);
}
.contact:last-child { border-bottom: none; }
.contact .cname { font-weight: 500; }
.empty {
    text-align: center;
    color: var(--muted);
    padding: 26px 10px;
    font-size: .92rem;
}

/* --- Tabelle (Admin) --- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
    background: linear-gradient(180deg, var(--surface), var(--bg2));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}
.stat .num { font-family: var(--ff-disp); font-size: 1.7rem; font-weight: 700; }
.stat .lab { color: var(--muted); font-size: .8rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    min-width: 560px;
}
table.data th, table.data td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data th { color: var(--muted); font-weight: 500; font-size: .78rem; }
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .74rem;
    border: 1px solid var(--line);
}
.badge.admin { background: rgba(181,123,255,.15); color: #d9c4ff; border-color: rgba(181,123,255,.4); }
.badge.on   { background: rgba(74,214,160,.14); color: #c4f5e4; border-color: rgba(74,214,160,.4); }
.badge.off  { background: rgba(255,107,125,.12); color: #ffd0d6; border-color: rgba(255,107,125,.4); }

.pill-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--surface2); border: 1px solid var(--line);
    color: var(--text); font-size: .84rem;
}

.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

@media (max-width: 460px) {
    .stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* =====================================================================
   Eingangsseite (Landing) + Installations-Anleitung
   ===================================================================== */
.landing { align-items: flex-start; }
.landing-inner {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}
.landing-inner .card,
.landing-inner .install-zone { margin-bottom: 16px; }

/* Marke / Logo */
.brand-zone { text-align: center; margin: 8px 0 22px; }
.brand-logo {
    max-width: 260px;
    max-height: 120px;
    width: auto;
    height: auto;
    display: inline-block;
}
.brand-big { font-size: 2.1rem; }
.tagline {
    color: var(--muted);
    font-size: .95rem;
    margin: 12px 0 0;
}

/* Installations-Bereich */
.install-zone .steps {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
.install-zone .steps li {
    position: relative;
    padding: 8px 0 8px 40px;
    border-bottom: 1px solid var(--line);
    font-size: .92rem;
    line-height: 1.45;
}
.install-zone .steps li:last-child { border-bottom: none; }
.install-zone .steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    font-family: var(--ff-disp);
    font-weight: 600;
    font-size: .82rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.install-zone #installBtn { margin: 4px 0 14px; }
.install-zone .inst[hidden] { display: none; }

.landing-foot {
    text-align: center;
    color: var(--muted);
    font-family: var(--ff-disp);
    font-size: .85rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 8px 0 0;
    opacity: .6;
}
