/* ==========================================================================
   Meine Pflanzen — Designsystem

   Übernommen vom Wine Tracker: eine Akzentfarbe, ruhige Neutraltöne, Karten
   mit Rahmen statt Schlagschatten. Farbe bedeutet etwas — gefüllt ist die
   eine Hauptaktion einer Ansicht, alles andere tritt zurück. Der Akzent
   bleibt Grün, nur dunkler und weniger grell als vorher.

   Aufbau: 1 Tokens · 2 Grundlagen · 3 Layout · 4 Bausteine · 5 Seiten
   · 6 Hilfsklassen · 7 Schmale Bildschirme
   ========================================================================== */

/* ---------------------------------------------------------------- 1 Tokens */
:root {
    --plant: #276236;
    --plant-dark: #1d4a29;
    --plant-ink: #1b4426;         /* Überschriften */
    --plant-tint: #f0f6f1;        /* getönte Flächen */
    --plant-tint-strong: #dceadf;

    --ink: #232a25;               /* Fließtext */
    --ink-muted: #626b64;         /* Zweitrangiges */
    --ink-faint: #8e968f;         /* Beschriftungen, Hinweise */

    --surface: #ffffff;
    --surface-sunken: #f8faf8;    /* Seitenhintergrund */
    --surface-raised: #eef2ef;    /* Chips, Bildbühne */

    --border: #e1e7e2;
    --border-strong: #c9d2cb;

    /* Fälligkeit: überfällig rot, bald fällig bernstein, aktuell grün.
       Die Farbe steht nie allein — daneben steht immer der Text. */
    --danger: #b3261e;
    --danger-tint: #fdf3f2;
    --danger-border: #f0cdc9;
    --due: #8a5d00;
    --due-tint: #fdf7ea;
    --due-border: #eddfbc;
    --ok-tint: #eaf3ec;
    --ok-border: #cfe2d4;
    --info: #23508a;
    --info-tint: #eef3fa;
    --info-border: #cddcef;

    /* Abstände: 4er-Raster, überall dieselben Stufen */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;

    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-pill: 999px;

    --shadow-pop: 0 6px 24px rgba(35, 42, 37, 0.12);
    --shadow-nav: 0 1px 0 var(--border);

    --focus: 0 0 0 3px rgba(39, 98, 54, 0.26);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
            'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --content-width: 940px;
}

/* ----------------------------------------------------------- 2 Grundlagen */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Listen sind hier durchweg Bausteine — Karten, Knöpfe, Zeilen —, keine
   Aufzählungen. Die Punkte stünden davor und säßen wegen padding:0 sogar
   links außerhalb. Bisher schaltete jede Klasse sie einzeln ab, vier hatten
   es vergessen (u. a. der Gieß-Rundgang). */
ul,
ol {
    list-style: none;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--surface-sunken);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    color: var(--plant-ink);
    line-height: 1.25;
    font-weight: 600;
}

h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a {
    color: var(--plant);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

img {
    max-width: 100%;
}

code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--surface-raised);
    border-radius: var(--r-sm);
    padding: 0.1rem 0.35rem;
}

:focus-visible {
    outline: 2px solid var(--plant);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* ------------------------------------------------------------- 3 Layout */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow-nav);
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: env(safe-area-inset-top);
}

.nav-container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--s-3) var(--s-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
}

.nav-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--plant-ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    min-width: 0;
}

.nav-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-logo {
    height: 1.75rem;
    width: 1.75rem;
    border-radius: var(--r-sm);
    display: block;
    flex: 0 0 auto;
}

.nav-menu {
    display: flex;
    gap: var(--s-1);
    align-items: center;
}

.nav-link {
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 0.94rem;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--plant-tint);
    color: var(--plant-ink);
}

.nav-link[aria-current="page"] {
    color: var(--plant);
    background: var(--plant-tint);
    font-weight: 500;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--s-2);
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: var(--s-6) max(var(--s-4), env(safe-area-inset-left))
             max(var(--s-6), env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-right));
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
}

.container-narrow {
    max-width: 620px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}

.page-header.is-tight {
    margin-bottom: var(--s-2);
}

/* Kopf ohne sichtbare Ueberschrift: die Knopfreihe bleibt trotzdem rechts.
   Ein sr-only-h1 ist absolut positioniert und damit kein Flex-Element mehr —
   space-between wuerde die Knoepfe sonst nach links ziehen. */
.page-header.is-end {
    justify-content: flex-end;
}

.page-header.is-inline {
    justify-content: flex-start;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.lead {
    color: var(--ink-muted);
    margin-bottom: var(--s-5);
}

.back-link {
    display: inline-block;
    margin-bottom: var(--s-3);
    color: var(--ink-muted);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--plant-ink);
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: var(--s-5) var(--s-4);
    text-align: center;
    color: var(--ink-faint);
    font-size: 0.85rem;
}

/* Fußzeile: nur der Weg zur Rückmeldung, bewusst leise. */
.app-footer {
    text-align: center;
    padding: var(--s-5) var(--s-4) max(var(--s-5), env(safe-area-inset-bottom));
    font-size: 0.85rem;
}

.app-footer a { color: var(--ink-muted); text-decoration-color: var(--border-strong); }
.app-footer a:hover { color: var(--accent-ink); }

/* ---------------------------------------------------------- 4 Bausteine */

/* --- Knöpfe ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: 0 var(--s-4);
    min-height: 40px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn-primary {
    background: var(--plant);
    color: #fff;
}

.btn-primary:hover {
    background: var(--plant-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--plant-ink);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--plant-tint);
    border-color: var(--plant);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    border-color: transparent;
    padding: 0 var(--s-3);
}

.btn-ghost:hover {
    background: var(--surface-raised);
    color: var(--plant-ink);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: #e8c9c6;
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-sm {
    min-height: 32px;
    padding: 0 var(--s-3);
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn-icon {
    width: 1.05em;
    height: 1.05em;
    flex: 0 0 auto;
}

/* Kleiner Knopf direkt an einem Text (Eintrag löschen, Chat entfernen) */
.icon-btn {
    background: none;
    border: none;
    padding: 0 var(--s-1);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--ink-faint);
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--danger);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.85rem;
    color: var(--plant);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

/* --- Flächen ----------------------------------------------------------- */
.card,
.empty-state,
.prose {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.card {
    padding: var(--s-5);
}

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

.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.card-header h2,
.card-header h3 {
    margin: 0;
}

.card-note {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-bottom: var(--s-4);
}

.card-section {
    margin-top: var(--s-5);
    padding-top: var(--s-5);
    border-top: 1px solid var(--border);
}

.empty-state {
    text-align: center;
    padding: var(--s-7) var(--s-4);
}

.empty-state h2 {
    color: var(--ink-muted);
    margin-bottom: var(--s-2);
}

.empty-state p {
    color: var(--ink-faint);
    margin-bottom: var(--s-4);
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.stack-top {
    margin-top: var(--s-5);
}

/* --- Chips, Statusmarken ------------------------------------------------ */
.chip {
    display: inline-block;
    background: var(--surface-raised);
    color: var(--ink-muted);
    border-radius: var(--r-pill);
    padding: 0.1rem 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

.chip-accent {
    background: var(--plant-tint);
    color: var(--plant-ink);
}

.status {
    display: inline-block;
    border-radius: var(--r-pill);
    padding: 0.1rem 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-red    { background: var(--danger-tint); color: var(--danger);    border-color: var(--danger-border); }
.status-yellow { background: var(--due-tint);    color: var(--due);       border-color: var(--due-border); }
.status-green  { background: var(--ok-tint);     color: var(--plant);     border-color: var(--ok-border); }
.status-off,
.status-gray   { background: var(--surface-raised); color: var(--ink-muted); border-color: var(--border); }

/* --- Meldungen ---------------------------------------------------------- */
.alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r);
    margin-bottom: var(--s-4);
    font-size: 0.94rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--ok-tint);     color: var(--plant-ink); border-color: var(--ok-border); }
.alert-warning { background: var(--due-tint);    color: var(--due);       border-color: var(--due-border); }
.alert-error   { background: var(--danger-tint); color: var(--danger);    border-color: var(--danger-border); }
.alert-info    { background: var(--info-tint);   color: var(--info);      border-color: var(--info-border); }

/* --- Leiser Hinweis ------------------------------------------------------ */
/* Für Dinge, die man wissen sollte, aber nicht in diesem Moment tun muss.
   Bewusst kein .alert: ein Farbfeld über der Pflanzenliste liest sich wie ein
   Problem, und wer die App täglich öffnet, sieht es täglich. Eine Zeile in
   gedämpfter Schrift mit einer Linie darunter reicht. */
.soft-note {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--s-2) var(--s-3);
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--ink-muted);
}

.soft-note-text {
    flex: 1;
    min-width: 14rem;
}

.soft-note a {
    color: var(--plant);
}

.soft-note button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: var(--ink-faint);
    text-decoration: underline;
}

.alert a {
    color: inherit;
    font-weight: 500;
}

/* --- Formulare ---------------------------------------------------------- */
.form-group {
    margin-bottom: var(--s-4);
}

.form-label {
    display: block;
    margin-bottom: var(--s-1);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--ink);
}

.form-label .optional {
    font-weight: 400;
    color: var(--ink-faint);
}

.form-label .required {
    color: var(--danger);
}

.form-control,
.form-select {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 0 var(--s-3);
    min-height: 40px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.form-control {
    padding: var(--s-2) var(--s-3);
    line-height: 1.5;
    min-height: 0;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--plant);
    box-shadow: var(--focus);
}

.form-control-sm {
    min-height: 32px;
    font-size: 0.88rem;
    padding: 0 var(--s-2);
}

.form-help {
    display: block;
    margin-top: var(--s-1);
    font-size: 0.85rem;
    color: var(--ink-faint);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-4);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 0.9rem;
    color: var(--ink-muted);
    cursor: pointer;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2);
}

.form-actions {
    display: flex;
    gap: var(--s-2);
    margin-top: var(--s-5);
}

.form-actions > * {
    flex: 1;
}

.code-input {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* Intervall-Auswahl: Radios als Kacheln. Der echte Radio bleibt im Baum
   (Tastatur, Screenreader), sichtbar ist die Kachel dahinter. */
.tile-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--s-2);
}

.tile {
    position: relative;
    display: block;
    cursor: pointer;
}

.tile input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tile span {
    display: block;
    text-align: center;
    padding: var(--s-2) var(--s-3);
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    font-size: 0.94rem;
    color: var(--ink);
    background: var(--surface);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tile:hover span {
    background: var(--plant-tint);
}

.tile input:checked + span {
    border-color: var(--plant);
    background: var(--plant-tint);
    color: var(--plant-ink);
    font-weight: 500;
}

.tile input:focus-visible + span {
    box-shadow: var(--focus);
}

/* --- Bildauswahl -------------------------------------------------------- */
.pick-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
}

.pick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: var(--s-3);
    min-height: 56px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.94rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.pick-btn:hover,
.pick-btn.is-dragover {
    border-color: var(--plant);
    background: var(--plant-tint);
    color: var(--plant-ink);
}

/* Strich-Icon statt Emoji: ein 📷 rendert iOS bunt und in Systemfarbe mitten
   in eine Fläche, die sonst ganz in --ink-muted gehalten ist. */
.pick-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.pick-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-top: var(--s-2);
}

.pick-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

/* Läuft-gerade-Streifen: ruhig und textlich, kein Spinner — die Aussage ist
   nicht "gleich fertig", sondern "dauert bis zu 15 Sekunden". */
.working {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-top: var(--s-3);
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.working-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--plant);
    animation: puls 1.6s ease-in-out infinite;
}

@keyframes puls {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
    .working-dot { animation: none; }
    * { transition-duration: 0.01ms !important; }
}

/* Ablegen darf auf der ganzen Uploader-Flaeche passieren, nicht nur auf dem Knopf */
.uploader.is-dragover .pick-btn {
    border-color: var(--plant);
    background: var(--plant-tint);
    color: var(--plant-ink);
}

/* Warteschlange des Foto-Uploads: eine Zeile je Bild, Vorschau aus der lokalen
   Datei — so ist sofort etwas zu sehen, noch bevor der Server geantwortet hat. */
.upload-queue {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-top: var(--s-3);
}

.upload-item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.upload-item > img {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

.upload-text {
    flex: 1;
    min-width: 0;
}

.upload-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.upload-bar {
    height: 4px;
    margin-top: var(--s-1);
    background: var(--surface-raised);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.upload-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--plant);
    transition: width 0.15s linear;
}

.upload-item.is-error {
    background: var(--danger-tint);
    border-color: var(--danger-border);
}

.upload-error {
    margin-top: var(--s-1);
    font-size: 0.85rem;
    color: var(--danger);
}

/* --- Tabellen ----------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--surface);
}

.table th,
.table td {
    text-align: left;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    font-weight: 600;
    background: var(--surface-sunken);
    white-space: nowrap;
}

.table .name-cell {
    font-weight: 500;
}

.table .muted-cell {
    color: var(--ink-muted);
}

.table .right {
    text-align: right;
}

.table tr.is-inactive {
    opacity: 0.55;
}

/* --- Listen mit Trennlinien --------------------------------------------- */
.line-list {
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.line-list li {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    font-size: 0.9rem;
}

.line-list li + li {
    border-top: 1px solid var(--border);
}

.line-list .grow {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Logliste ohne Rahmen (Pflege-Einträge in der Aufgabenkarte) */
.log-list {
    list-style: none;
    font-size: 0.9rem;
}

.log-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding: var(--s-2) 0;
    border-bottom: 1px solid var(--border);
}

.log-list li:last-child {
    border-bottom: none;
}

/* --- Aufklapper --------------------------------------------------------- */
.disclosure {
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--border);
}

.disclosure > summary,
.plain-summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.88rem;
    color: var(--ink-muted);
}

.disclosure > summary::-webkit-details-marker,
.plain-summary::-webkit-details-marker {
    display: none;
}

.disclosure > summary:hover,
.plain-summary:hover {
    color: var(--plant-ink);
}

.disclosure-body {
    margin-top: var(--s-3);
}

/* ------------------------------------------------------------- 5 Seiten */

/* --- Anmeldeseite ------------------------------------------------------- */
.login-wrap {
    max-width: 360px;
    margin: 10vh auto;
    padding: var(--s-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--s-3);
}

.login-logo img {
    height: 72px;
    width: 72px;
    border-radius: var(--r-lg);
}

.login-wrap h1 {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: var(--s-1);
}

.login-sub {
    text-align: center;
    color: var(--ink-faint);
    font-size: 0.88rem;
    margin-bottom: var(--s-5);
}

.login-oder {
    text-align: center;
    color: var(--ink-muted);
    margin: var(--s-4) 0;
}

/* --- Pflanzenliste ------------------------------------------------------ */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    margin-bottom: var(--s-5);
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1);
}

.chip-link {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--r-pill);
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--ink-muted);
    background: var(--surface-raised);
    transition: background 0.15s ease, color 0.15s ease;
}

.chip-link:hover {
    background: var(--plant-tint);
    color: var(--plant-ink);
}

.chip-link.is-active {
    background: var(--plant);
    color: #fff;
}

.group-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--s-2);
}

.group-title.is-red    { color: var(--danger); }
.group-title.is-yellow { color: var(--due); }
.group-title.is-green  { color: var(--plant); }

.plant-group + .plant-group {
    margin-top: var(--s-6);
}

.plant-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.plant-card {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.plant-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-pop);
}

.plant-thumb {
    flex: 0 0 auto;
    display: block;
    width: 64px;
    height: 64px;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-raised);
    border: 1px solid var(--border);
}

.plant-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Platzhalter ohne Foto: Blatt als Strichzeichnung, nicht als Emoji */
.plant-thumb .leaf {
    width: 100%;
    height: 100%;
    padding: var(--s-3);
    color: var(--border-strong);
}

.plant-body {
    flex: 1;
    min-width: 0;
}

.plant-name {
    font-weight: 600;
    color: var(--plant-ink);
    text-decoration: none;
}

.plant-name:hover {
    color: var(--plant);
}

.plant-title-row {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* Die Marke nennt hier alle Aufgaben desselben Tages ("Düngen + Gießen: heute
   fällig") und wird damit lang genug, um auf schmalen Bildschirmen umbrechen
   zu müssen — anders als die kurzen Marken sonst. */
.plant-title-row .status {
    white-space: normal;
}

.plant-meta {
    margin-top: 0.15rem;
    font-size: 0.88rem;
    color: var(--ink-muted);
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-1) var(--s-4);
}

.plant-actions {
    flex: 0 0 auto;
    display: flex;
    gap: var(--s-2);
}

/* --- Pflanzenseite ------------------------------------------------------ */
.hero {
    display: flex;
    gap: var(--s-5);
}

.hero-image {
    flex: 0 0 11rem;
    display: block;
    width: 11rem;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-raised);
    cursor: zoom-in;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-body {
    flex: 1;
    min-width: 0;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--s-4);
    margin-top: var(--s-4);
}

.spec-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.spec-value {
    color: var(--ink);
    font-weight: 500;
}

.plant-notes {
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--border);
    color: var(--ink-muted);
    font-size: 0.94rem;
}

/* Pflegeinfos als Beschreibungsliste */
.care-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.care-list dt {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.care-list dd {
    color: var(--ink);
    font-size: 0.94rem;
}

/* Aufgabenkarte */

/* Die Aufgabe, die jetzt ansteht, steht ganz oben und bekommt einen Streifen in
   der Akzentfarbe. Die Farbe steht nicht allein: darüber die Marke "Jetzt dran",
   daneben weiterhin die Statusmarke mit dem Fälligkeitstext. */
.card.is-acute {
    border-left: 3px solid var(--plant);
    padding-left: calc(var(--s-5) - 2px);
}

.acute-flag {
    margin: 0 0 var(--s-2);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--plant);
}

.task-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.task-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-4);
    flex-wrap: wrap;
    margin-bottom: var(--s-4);
}

.task-facts {
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.task-facts .is-snoozed { color: var(--due); }
.task-facts .is-paused  { color: var(--info); }

.task-buttons {
    display: flex;
    gap: var(--s-2);
    flex: 0 0 auto;
}

/* Vorschlag, das Intervall an die tatsächlichen Abstände anzupassen */
.suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
    padding: var(--s-3);
    margin-bottom: var(--s-4);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-left: 3px solid var(--plant);
    border-radius: var(--r);
    font-size: 0.9rem;
    color: var(--ink-muted);
}

/* Verlauf der Krankheits-Checks: ein Punkt je Check, alt nach neu */
.dot-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-1);
    margin-bottom: var(--s-4);
    font-size: 0.8rem;
    color: var(--ink-faint);
}

.hc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.hc-dot.is-ok       { background: var(--plant); }
.hc-dot.is-warning  { background: #d9a441; }
.hc-dot.is-critical { background: var(--danger); }
.hc-dot.is-unknown  { background: var(--border-strong); }

/* Ein Check in der Liste */
.check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.check-item {
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.check-summary {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    cursor: pointer;
    list-style: none;
}

.check-summary::-webkit-details-marker {
    display: none;
}

.check-summary:hover {
    background: var(--surface-sunken);
}

.check-mark {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.check-text {
    flex: 1;
    min-width: 0;
}

.check-text p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--ink);
}

.check-body {
    padding: var(--s-3);
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    font-size: 0.9rem;
}

/* Rahmen sitzt am Knopf, nicht am Bild — sonst stehen im Lichtkasten-Auslöser
   zwei Rahmen ineinander. align-self, weil .check-body eine Flex-Spalte ist und
   der Knopf sonst auf die volle Breite zieht. */
.check-photo {
    align-self: flex-start;
    max-width: 220px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-raised);
    cursor: zoom-in;
}

.check-photo img {
    display: block;
    width: 100%;
}

.check-body ul {
    margin-left: var(--s-4);
}

/* Bildergalerie */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--s-3);
}

.gallery figure {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
}

.gallery-frame {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--surface-raised);
}

.gallery-frame > button.lightbox-trigger {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.gallery-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Leere Galerie: der Hinweis nimmt die ganze Zeile ein, nicht eine Kachelspalte */
.gallery-empty {
    grid-column: 1 / -1;
}

/* Über dem Bild schwebende Marken: dunkler Grund, damit sie auf jedem Foto
   lesbar bleiben */
.on-image {
    position: absolute;
    top: var(--s-1);
    z-index: 2;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(35, 42, 37, 0.65);
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(3px);
    transition: background 0.15s ease;
}

.on-image.at-left  { left: var(--s-1); }
.on-image.at-right { right: var(--s-1); }
.on-image.is-primary { background: rgba(35, 42, 37, 0.65); color: #e9c46a; cursor: default; }
.on-image.at-left:hover:not(.is-primary) { background: rgba(35, 42, 37, 0.9); color: #e9c46a; }
.on-image.at-right:hover { background: var(--danger); }

.gallery figcaption {
    text-align: center;
    font-size: 0.78rem;
    color: var(--ink-faint);
}

/* Sortierbare Liste (Raumfolge des Rundgangs) */
.sort-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
}

.sort-list li {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
}

.sort-list li + li {
    border-top: 1px solid var(--border);
}

.sort-nr {
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--plant-tint);
    color: var(--plant-ink);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.sort-list .grow {
    flex: 1;
    min-width: 0;
}

/* Der Griff ist der einzige Ort zum Anfassen: touch-action: none gilt nur hier,
   damit die Liste als Ganzes weiter scrollbar bleibt. Das Tap-Ziel ist groesser
   als das Symbol, die negativen Raender holen den Platz aus der Zeilenhoehe. */
.sort-grip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: calc(var(--s-3) * -1) calc(var(--s-2) * -1) calc(var(--s-3) * -1) 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--ink-faint);
    cursor: grab;
    touch-action: none;          /* sonst scrollt iOS, statt die Zeile mitzunehmen */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none; /* kein Auswahlmenue beim langen Druecken */
}

.sort-grip:hover { color: var(--plant); }
.sort-grip:active { cursor: grabbing; }

.sort-grip .grip {
    width: 1.5rem;
    height: 1.5rem;
}

/* Die gezogene Zeile liegt ueber den anderen. Rahmen statt Schlagschatten, wie
   ueberall sonst auch. */
.sort-list li.is-dragging {
    position: relative;
    z-index: 2;
    background: var(--plant-tint);
    box-shadow: 0 0 0 1px var(--ok-border);
}

.sort-list.is-sorting {
    user-select: none;
    -webkit-user-select: none;
}

/* --- Gieß-Rundgang ------------------------------------------------------ */
/* Eine Pflanze pro Bildschirm: grosses Foto, grosse Knoepfe, sonst nichts.
   Die Seite wird im Gehen bedient, mit einer Hand und oft mit nassen Fingern. */
.tour {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.tour-head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.tour-count {
    font-size: 0.85rem;
    color: var(--ink-muted);
    white-space: nowrap;
}

.tour-bar {
    flex: 1;
    height: 4px;
    background: var(--surface-raised);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.tour-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--plant);
    transition: width 0.25s ease;
}

.tour-step {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

/* Muss explizit sein: display:flex wuerde das hidden-Attribut sonst aushebeln */
.tour-step[hidden] {
    display: none;
}

.tour-place {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.tour-name {
    margin: 0;
}

.tour-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    max-height: 46vh;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.tour-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tour-leaf {
    width: 4rem;
    height: 4rem;
    color: var(--ink-faint);
}

.tour-tasks {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.tour-task {
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
}

.tour-task.is-answered {
    background: var(--ok-tint);
    border-color: var(--ok-border);
}

.tour-task-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.tour-task-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.tour-task-buttons {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--s-2);
}

.tour-task-buttons .btn {
    width: 100%;
    min-height: 48px;
}

.tour-task-done {
    font-size: 0.9rem;
    color: var(--plant-ink);
}

.tour-task-error {
    margin-top: var(--s-2);
    font-size: 0.9rem;
    color: var(--danger);
}

.tour-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--s-2);
}

.tour-summary {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.tour-summary[hidden] {
    display: none;
}

.tour-tally {
    color: var(--ink-muted);
}

.tour-log {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    font-size: 0.94rem;
    color: var(--ink-muted);
}

/* --- Verlauf ------------------------------------------------------------ */
.timeline {
    border-left: 2px solid var(--border);
    margin-left: 5px;
    padding-left: var(--s-5);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.timeline-entry {
    position: relative;
}

.timeline-dot {
    position: absolute;
    left: calc(var(--s-5) * -1 - 5px);
    top: 1.1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ink-faint);
    box-shadow: 0 0 0 4px var(--surface-sunken);
}

.timeline-dot.is-watering    { background: #2a78d6; }
.timeline-dot.is-fertilizing { background: var(--plant); }
.timeline-dot.is-repotting   { background: #a1650b; }
.timeline-dot.is-showering   { background: #2a78d6; }
.timeline-dot.is-photo       { background: var(--border-strong); }

.timeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--s-3) var(--s-4);
}

.timeline-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-3);
}

.timeline-label {
    font-weight: 500;
    color: var(--ink);
    font-size: 0.94rem;
}

.timeline-time {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--ink-faint);
}

.timeline-photo {
    margin-top: var(--s-2);
    width: 96px;
    height: 96px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-raised);
    cursor: zoom-in;
}

.timeline-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-note {
    margin-top: var(--s-1);
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.timeline-group + .timeline-group {
    margin-top: var(--s-6);
}

/* --- Haushalt ----------------------------------------------------------- */
.avatar {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--plant-tint);
    color: var(--plant-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.code-box {
    padding: var(--s-4);
    margin-bottom: var(--s-4);
    background: var(--plant-tint);
    border: 1px solid var(--plant-tint-strong);
    border-radius: var(--r);
}

.code-value {
    font-family: var(--mono);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--plant-ink);
}

/* --- Lichtkasten -------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--s-4);
    background: rgba(20, 24, 21, 0.92);
    cursor: zoom-out;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--r);
}

.lightbox p {
    margin-top: var(--s-3);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.lightbox-close {
    position: absolute;
    top: var(--s-4);
    right: var(--s-4);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Kurzmeldung (HTMX-Toast) und Foto-Nachfrage ------------------------ */
.toast-stack {
    position: fixed;
    top: max(var(--s-4), env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    pointer-events: none;
}

.toast {
    padding: var(--s-2) var(--s-4);
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-pop);
    opacity: 0;
    transition: opacity 0.2s ease;
    border: 1px solid transparent;
}

.toast.is-shown {
    opacity: 1;
}

.toast-success { background: var(--plant);      color: #fff; }
.toast-error   { background: var(--danger);     color: #fff; }
.toast-info    { background: var(--ink);        color: #fff; }

.photo-prompt-slot {
    position: fixed;
    bottom: max(var(--s-4), env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: calc(100% - 2rem);
    max-width: 380px;
}

.photo-prompt {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
    padding: var(--s-4);
}

.photo-prompt p {
    font-size: 0.9rem;
    color: var(--ink);
    margin-bottom: var(--s-3);
}

.photo-prompt .btn-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-2);
}

/* -------------------------------------------------------- 6 Hilfsklassen */
.muted {
    color: var(--ink-muted);
}

.faint {
    color: var(--ink-faint);
    font-size: 0.85rem;
}

.mono {
    font-family: var(--mono);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.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;
}

[hidden] {
    display: none !important;
}

/* ------------------------------------------- 7 Schmale Bildschirme */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--s-2);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-pop);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu form {
        display: block;
    }

    .nav-menu .btn {
        width: 100%;
        justify-content: flex-start;
    }

    .nav-link {
        padding: var(--s-3);
    }

    .nav-toggle {
        display: flex;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .hero {
        flex-direction: column;
    }

    .hero-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 260px;
    }

    .plant-card {
        flex-wrap: wrap;
    }

    .plant-body {
        flex: 1 1 60%;
    }

    .plant-actions {
        flex: 1 1 100%;
    }

    .plant-actions > * {
        flex: 1;
    }

    .plant-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding-top: var(--s-4);
        padding-left: max(var(--s-3), env(safe-area-inset-left));
        padding-right: max(var(--s-3), env(safe-area-inset-right));
    }

    h1 { font-size: 1.4rem; }

    .card,
    .prose {
        padding: var(--s-4);
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .task-buttons {
        flex: 1 1 100%;
    }

    .task-buttons > * {
        flex: 1;
    }

    .task-buttons .btn {
        width: 100%;
    }

    /* Zwei Knoepfe neben der Ueberschrift passen schmal nicht mehr in eine Zeile */
    .page-header {
        flex-wrap: wrap;
    }

    .page-header .btn-row {
        width: 100%;
    }

    .page-header .btn-row .btn {
        flex: 1;
        justify-content: center;
    }
}
