/* ==========================================================================
   MM Projects Hub – Designsystem
   Dark-first, Anthrazit-Flächen mit sparsamem Lime-Akzent. Mobile zuerst.

   Zwei Regeln, die überall gelten:
     1. Auf Lime steht NIE weiße Schrift (1.2:1). Lime-Flächen bekommen
        --on-lime, das sind 14.2:1.
     2. Pro Bildschirm trägt genau ein Element Lime – der primäre Knopf ODER
        der aktive Tab ODER die eine Kennzahl. Sonst zeigt die Farbe nirgends
        mehr hin.
   ========================================================================== */

:root {
    /* Flächen – Tiefe entsteht durch Abstufung, nicht durch Schlagschatten */
    --bg:         #16181d;   /* Seitenhintergrund, dunkler als die Karten     */
    --bg-2:       #1b1e25;   /* Kopfzeile, Tableiste                          */
    --surface:    #22252e;   /* Karten – die Markenfarbe                      */
    --surface-2:  #2b2f3a;   /* Eingabefelder, hervorgehobene Flächen         */
    --surface-3:  #343947;   /* Hover auf --surface-2                         */
    --border:     #363b47;
    --border-soft: #2a2e38;

    /* Text */
    --text:       #eef1f5;   /* 13.4:1 auf --surface                          */
    --muted:      #9aa3b2;   /*  6.0:1 auf --surface                          */
    --faint:      #6b7383;   /* nur für Deko, nie für lesbaren Text           */

    /* Marke */
    --lime:       #b4fe2e;   /* 12.5:1 auf --surface                          */
    --lime-dim:   #8fd117;   /* Hover/Press auf Lime-Flächen                  */
    --lime-deep:  #6ea30d;
    --on-lime:    #16181d;   /* 14.2:1 – die einzige Schriftfarbe auf Lime    */
    --lime-ghost: rgba(180, 254, 46, .12);
    --lime-edge:  rgba(180, 254, 46, .28);

    /* Status – Erfolg trägt bewusst kein zweites Grün, sondern das Lime */
    --danger:     #ff6b6b;
    --danger-bg:  rgba(255, 107, 107, .12);
    --warn:       #ffb020;
    --warn-bg:    rgba(255, 176, 32, .12);
    --info:       #56b0ff;
    --info-bg:    rgba(86, 176, 255, .12);

    /* Form */
    --radius-lg: 20px;
    --radius:    14px;
    --radius-sm: 10px;
    --radius-pill: 999px;

    /* Abstände (4er-Raster) */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

    --tap: 44px;                       /* kleinstes Tippziel */
    --shell-max: 1120px;
    --sidebar: 248px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    --ring: 0 0 0 3px rgba(180, 254, 46, .35);
    --shadow: 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .42);
    --glow: 0 0 24px rgba(180, 254, 46, .14);

    --ease: cubic-bezier(.16, 1, .3, 1);
    --dur: 200ms;

    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;              /* verhindert iOS-Autozoom in Formularen */
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

/* Alle Icons kommen aus Icon::svg() mit viewBox 0 0 24 24 und ohne eigene
   Maße – ohne Vorgabe füllen sie den ganzen verfügbaren Platz. Die Regeln
   weiter unten (.btn svg, .tab svg, …) gewinnen über die Spezifität; diese
   hier fängt nur die freistehenden Fälle ab. */
svg { width: 20px; height: 20px; flex: none; }

button, input, select, textarea { font: inherit; color: inherit; }

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

:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--radius-sm);
}

::selection { background: var(--lime); color: var(--on-lime); }

/* --------------------------------------------------------------------------
   Typografie
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 { line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 1.15rem + .7vw, 1.7rem); }
h3 { font-size: 1.1rem; font-weight: 700; }
h4 { font-size: .95rem; font-weight: 700; }

p { text-wrap: pretty; }

.lead      { font-size: 1.05rem; color: var(--muted); max-width: 56ch; }
.muted     { color: var(--muted); }
.small     { font-size: .875rem; }
.tiny      { font-size: .8rem; }
.strong    { font-weight: 700; }
.mono      { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num       { font-variant-numeric: tabular-nums; }
.accent    { color: var(--lime); }

/* Abschnittsüberschrift über Listen und Kartengruppen */
.eyebrow {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   App-Shell
   -------------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
}

.main {
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: var(--sp-5) var(--sp-4);
    /* Platz für die fixierte Tableiste, sonst verschwindet der letzte Eintrag */
    padding-bottom: calc(var(--tap) + var(--sp-8) + env(safe-area-inset-bottom));
}

.stack     { display: grid; gap: var(--sp-4); }
.stack-lg  { display: grid; gap: var(--sp-6); }
.stack-sm  { display: grid; gap: var(--sp-2); }
.row       { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.row-wrap  { flex-wrap: wrap; }
.grow      { flex: 1; min-width: 0; }

.page-head { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-5); }

/* --------------------------------------------------------------------------
   Kopfzeile
   -------------------------------------------------------------------------- */

/* Rückweg in ein Projekt, aus dem der Nutzer hergeschickt wurde.
   Steht bewusst über der Kopfzeile und in Signalfarbe: Wer aus einer
   installierten App kommt, sucht als Erstes den Weg zurück. */
.return-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    padding-top: calc(var(--sp-2) + env(safe-area-inset-top));
    background: var(--lime-ghost);
    border-bottom: 1px solid var(--lime-edge);
    font-size: .92rem;
}

.return-back {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.return-back svg { width: 18px; height: 18px; flex: none; }
.return-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.return-dismiss {
    display: inline-flex;
    color: var(--muted);
    flex: none;
    padding: 4px;
}

.return-dismiss svg { width: 18px; height: 18px; }

.return-dismiss:hover { color: var(--text); }

/* Die Kopfzeile klebt sonst unter der Leiste fest und verdeckt sie beim
   Scrollen – hier soll die Leiste einfach mit hochwandern. */
/* Der Sicherheitsabstand oben gehört dann der Leiste, nicht mehr der Kopfzeile. */
.return-bar ~ .shell .topbar { position: static; padding-top: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg-2) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: var(--sp-3) var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 56px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
    text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--lime);
    color: var(--on-lime);
    font-size: .8rem;
    font-weight: 900;
    letter-spacing: -.04em;
    flex: none;
}

.brand-name { font-size: 1rem; }
.brand-name span { color: var(--muted); font-weight: 600; }

/* --------------------------------------------------------------------------
   Navigation: Tableiste unten (mobil), Seitenleiste ab 900px
   -------------------------------------------------------------------------- */

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    background: color-mix(in srgb, var(--bg-2) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-soft);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1;
    min-height: var(--tap);
    padding: var(--sp-2) var(--sp-1) var(--sp-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    position: relative;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--dur) var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { text-decoration: none; }
.tab svg { width: 21px; height: 21px; stroke-width: 2; }

.tab[aria-current="page"] { color: var(--lime); }

/* Der aktive Tab bekommt eine Lime-Kappe – das ist auf dieser Seite das
   eine Lime-Element, deshalb sind Knöpfe in Listenansichten neutral. */
.tab[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    width: 26px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--lime);
}

.tab-badge {
    position: absolute;
    top: 4px;
    left: 50%;
    margin-left: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.sidebar { display: none; }

/* --------------------------------------------------------------------------
   Karten
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
}

.card-tight { padding: var(--sp-4); }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.card-head h2, .card-head h3 { margin: 0; }

/* Zeilen innerhalb einer Karte, z. B. Geräteliste */
.list { display: grid; }
.list-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border-soft);
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }

/* Anklickbare Zeile, die zu einer Unterseite führt */
.link-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: var(--tap);
    padding: var(--sp-3);
    margin: 0 calc(var(--sp-3) * -1);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: background var(--dur) var(--ease);
}
.link-row:hover { background: var(--surface-2); text-decoration: none; }
.link-row svg { width: 18px; height: 18px; flex: none; }
.link-row .chevron { margin-left: auto; color: var(--muted); }

/* Abschnittswechsel innerhalb einer Seite (Projektverwaltung).
   Echte Links, kein JavaScript: Jeder Abschnitt hat seine eigene Adresse.
   Auf schmalen Geräten scrollt die Leiste seitlich, statt umzubrechen. */
.tabs {
    display: flex;
    gap: var(--sp-1);
    margin-bottom: var(--sp-5);
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-soft);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--lime); border-bottom-color: var(--lime); }

/* --------------------------------------------------------------------------
   Knöpfe
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: var(--tap);
    padding: 0 var(--sp-5);
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--dur) var(--ease),
                transform 120ms var(--ease),
                border-color var(--dur) var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
    background: var(--lime);
    color: var(--on-lime);
    box-shadow: var(--glow);
}
.btn-primary:hover { background: var(--lime-dim); }

.btn-secondary { background: var(--surface-2); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-quiet { background: transparent; color: var(--muted); padding: 0 var(--sp-3); }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: .85rem; }

.btn:disabled, .btn[aria-disabled="true"] {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Nur-Icon-Knopf – braucht immer ein aria-label */
.btn-icon {
    width: var(--tap);
    min-height: var(--tap);
    padding: 0;
    border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */

.form { display: grid; gap: var(--sp-4); }

.field { display: grid; gap: var(--sp-2); }

.field > label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
}
.field .req { color: var(--lime); margin-left: 2px; }

.input,
.select,
.textarea {
    width: 100%;
    min-height: var(--tap);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.textarea { min-height: 96px; padding-top: var(--sp-3); resize: vertical; }

.input::placeholder, .textarea::placeholder { color: var(--faint); }

.input:hover, .select:hover, .textarea:hover { border-color: var(--surface-3); }

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--lime);
    background: var(--surface);
    box-shadow: var(--ring);
}

.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 107, 107, .3); }

/* Fehlermeldung direkt unter dem betroffenen Feld – nicht gesammelt oben */
.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: .85rem;
    color: var(--danger);
}
.field-error svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.field-hint { font-size: .85rem; color: var(--muted); }

/* Passwortfeld mit Sichtbarkeits-Schalter */
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 52px; }
.input-group .input-action {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.input-group .input-action:hover { color: var(--text); background: var(--surface-3); }
.input-group .input-action svg { width: 18px; height: 18px; }

/* Auswahl per Karte statt Radio-Punkt (Privatsphäre-Einstellungen) */
.choice {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.choice:hover { background: var(--surface-3); }
.choice input { margin-top: 3px; accent-color: var(--lime); width: 18px; height: 18px; flex: none; }
.choice:has(input:checked) { border-color: var(--lime-edge); background: var(--lime-ghost); }
.choice-text { display: grid; gap: 2px; }
.choice-text strong { font-size: .95rem; }
.choice-text span { font-size: .85rem; color: var(--muted); }

/* Kontrollkästchen in einer Zeile */
.check { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: var(--tap); }
.check input { accent-color: var(--lime); width: 18px; height: 18px; flex: none; }

/* --------------------------------------------------------------------------
   Meldungen
   -------------------------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .92rem;
}
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }

.alert-success { background: var(--lime-ghost); border-color: var(--lime-edge); color: var(--text); }
.alert-success svg { color: var(--lime); }
.alert-error   { background: var(--danger-bg); border-color: rgba(255,107,107,.35); }
.alert-error svg { color: var(--danger); }
.alert-info    { background: var(--info-bg); border-color: rgba(86,176,255,.3); }
.alert-info svg { color: var(--info); }
.alert-warn    { background: var(--warn-bg); border-color: rgba(255,176,32,.3); }
.alert-warn svg { color: var(--warn); }

.flash-stack { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5); }

/* --------------------------------------------------------------------------
   Avatar, Abzeichen, Chips
   -------------------------------------------------------------------------- */

.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    object-fit: cover;
    flex: none;
    display: grid;
    place-items: center;
    font-size: .85rem;
    font-weight: 700;
    color: var(--muted);
    overflow: hidden;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.9rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-lime   { background: var(--lime-ghost); color: var(--lime); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn   { background: var(--warn-bg); color: var(--warn); }
.badge svg { width: 13px; height: 13px; }

/* Veröffentlichungsphase. Test ist der lauteste Zustand (unfertig, nur für
   Eingeladene), Beta ein ruhiger Hinweis, Archiviert bewusst blass. Release
   bekommt gar kein Abzeichen – das ist der Normalfall. */
.badge-phase-test       { background: var(--warn-bg); color: var(--warn); }
.badge-phase-beta       { background: var(--lime-ghost); color: var(--lime); }
.badge-phase-archiviert { background: var(--surface-2); color: var(--faint); }

/* Freundescode – tabellarische Ziffern, damit nichts springt */
.code-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px dashed var(--lime-edge);
    border-radius: var(--radius);
    background: var(--lime-ghost);
    font-family: var(--mono);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .18em;
    color: var(--lime);
    cursor: pointer;
}
.code-chip svg { width: 17px; height: 17px; opacity: .75; }

/* --------------------------------------------------------------------------
   Leerzustände
   -------------------------------------------------------------------------- */

.empty {
    display: grid;
    justify-items: center;
    gap: var(--sp-3);
    padding: var(--sp-10) var(--sp-5);
    text-align: center;
}
.empty-icon {
    width: 52px; height: 52px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 1.05rem; }
.empty p { color: var(--muted); font-size: .92rem; max-width: 40ch; }

/* --------------------------------------------------------------------------
   Startseite (öffentlich)
   -------------------------------------------------------------------------- */

.landing { padding-bottom: var(--sp-12); }

.hero {
    display: grid;
    gap: var(--sp-5);
    padding: var(--sp-10) 0 var(--sp-8);
}
.hero h1 { max-width: 16ch; }
.hero h1 em { font-style: normal; color: var(--lime); }
.hero .lead { max-width: 48ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }

/* Sanfter Lime-Schein hinter dem Titel – die einzige Dekoration der Seite */
.hero-glow {
    position: absolute;
    inset: -20% -30% auto -30%;
    height: 420px;
    background: radial-gradient(closest-side, rgba(180,254,46,.10), transparent 72%);
    pointer-events: none;
    z-index: -1;
}
.landing { position: relative; }

.feature-grid { display: grid; gap: var(--sp-4); }
.feature {
    display: grid;
    gap: var(--sp-2);
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
}
.feature-icon {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    background: var(--lime-ghost);
    color: var(--lime);
    margin-bottom: var(--sp-1);
}
.feature-icon svg { width: 19px; height: 19px; }
.feature h3 { font-size: 1rem; }
.feature p { color: var(--muted); font-size: .92rem; }

/* --------------------------------------------------------------------------
   Anmeldeseiten
   -------------------------------------------------------------------------- */

.auth-wrap {
    min-height: 100dvh;
    display: grid;
    align-content: start;
    justify-items: center;
    padding: var(--sp-6) var(--sp-4) var(--sp-12);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
}

.auth-head { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.auth-head h1 { font-size: 1.5rem; }
.auth-head p { color: var(--muted); font-size: .92rem; }

.auth-foot {
    margin-top: var(--sp-5);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border-soft);
    text-align: center;
    font-size: .9rem;
    color: var(--muted);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-6);
    font-weight: 800;
    color: var(--text);
}
.auth-brand:hover { text-decoration: none; }

/* --------------------------------------------------------------------------
   Projektkacheln (Dashboard)
   -------------------------------------------------------------------------- */

.project-grid { display: grid; gap: var(--sp-4); }

.project-card {
    position: relative;
    display: grid;
    gap: var(--sp-4);
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--dur) var(--ease), transform 120ms var(--ease);
}
.project-card:active { transform: scale(.99); }

/* Farbkante in der Projektfarbe: die Kachel gehört sichtbar zum Projekt,
   ohne dass Lime seine Bedeutung als Wegweiser verliert. */
.project-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--project-accent, var(--lime));
}

.project-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.project-icon {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--project-accent, var(--lime));
    flex: none;
}
.project-icon svg { width: 22px; height: 22px; }
/* Hochgeladenes Logo statt Icon: füllt den Rahmen, ohne sich zu verzerren.
   Kleine Logos werden dabei nicht aufgeblasen – contain lässt sie in Ruhe. */
.project-icon img {
    width: 100%; height: 100%;
    object-fit: contain;
    border-radius: inherit;
}
.project-title { display: grid; gap: 2px; min-width: 0; }
.project-title h3 { font-size: 1.05rem; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.project-title p { font-size: .875rem; color: var(--muted); }

.project-status {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: .875rem;
    color: var(--muted);
}
.project-status .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--lime);
    flex: none;
}
.project-status.is-quiet .dot { background: var(--faint); }
.project-status.is-down .dot  { background: var(--warn); }

/* --------------------------------------------------------------------------
   Fehlerseite
   -------------------------------------------------------------------------- */

.error-page {
    min-height: 70dvh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--sp-4);
    text-align: center;
    padding: var(--sp-8) var(--sp-4);
}
.error-code {
    font-family: var(--mono);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--lime);
    line-height: 1;
}

/* --------------------------------------------------------------------------
   Hilfsklassen
   -------------------------------------------------------------------------- */

.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border-soft); border: 0; margin: var(--sp-2) 0; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }

/* --------------------------------------------------------------------------
   Ab 640px: mehrspaltige Raster
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
    .main { padding: var(--sp-6) var(--sp-6); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .project-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .hero { padding: var(--sp-12) 0 var(--sp-10); }
}

/* --------------------------------------------------------------------------
   Ab 900px: Seitenleiste statt Tableiste
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
    .shell.has-nav {
        grid-template-columns: var(--sidebar) 1fr;
        grid-template-rows: auto 1fr;
    }
    .shell.has-nav .topbar { grid-column: 1 / -1; }

    .tabbar { display: none; }

    .sidebar {
        display: block;
        padding: var(--sp-5) var(--sp-3);
        border-right: 1px solid var(--border-soft);
        position: sticky;
        top: 57px;                    /* Höhe der Kopfzeile */
        align-self: start;
        height: calc(100dvh - 57px);
    }

    .sidebar-nav { display: grid; gap: 2px; }

    .sidebar-link {
        display: flex;
        align-items: center;
        gap: var(--sp-3);
        min-height: var(--tap);
        padding: 0 var(--sp-3);
        border-radius: var(--radius);
        color: var(--muted);
        font-size: .95rem;
        font-weight: 600;
        text-decoration: none;
        transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
    }
    .sidebar-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
    .sidebar-link svg { width: 19px; height: 19px; flex: none; }

    .sidebar-link[aria-current="page"] {
        background: var(--lime-ghost);
        color: var(--lime);
    }

    .sidebar-badge {
        margin-left: auto;
        min-width: 20px; height: 20px;
        padding: 0 6px;
        border-radius: var(--radius-pill);
        background: var(--danger);
        color: #fff;
        font-size: .7rem;
        font-weight: 700;
        line-height: 20px;
        text-align: center;
    }

    .main { padding: var(--sp-8) var(--sp-6); padding-bottom: var(--sp-12); }
    .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   Bewegung nur, wo sie etwas erklärt
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .btn:active, .project-card:active { transform: none; }
}

/* Hover-Effekte nur auf Geräten, die wirklich hovern können – auf Touch
   bleiben sie sonst nach dem Tippen „kleben“. */
@media (hover: none) {
    .btn:hover { background: var(--surface-2); }
    .btn-primary:hover { background: var(--lime); }
    .link-row:hover, .sidebar-link:hover { background: transparent; }
}
