@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/open-sans-latin-ext-400.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/open-sans-latin-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/open-sans-latin-ext-700.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/open-sans-latin-700.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --ink: #333333;
    --muted: #666666;
    --paper: #f7f6f2;
    --panel: #ffffff;
    --line: #d9d5c8;
    --brand: #7a7655;
    --brand-dark: #5e5b40;
    --accent: #8a4b2e;
    --ok: #2f6b3a;
    --ok-bg: #e4f0e6;
    --danger: #a32020;
    --shadow: 0 10px 30px rgba(55, 50, 30, 0.08);
    --radius: 10px;
    --font: "Open Sans", Geneva, sans-serif;
    --topbar-h: 5.5rem;
}
/* Farsi (rtl): Pfeile zeigen in Leserichtung */
:root[dir="rtl"] #back-btn,
:root[dir="rtl"] #group-left svg,
:root[dir="rtl"] #group-right svg { transform: scaleX(-1); }
/* Farsi: Open Sans hat keine arabische Schrift – gängige Systemschriften davor */
:root:lang(fa) {
    --font: "Open Sans", "Vazirmatn", "Segoe UI", Tahoma, "Geeza Pro", sans-serif;
}
/* Japanisch: Open Sans hat keine japanischen Zeichen – gängige Systemschriften davor */
:root:lang(ja) {
    --font: "Open Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    /* iOS: Schrift nicht eigenmächtig vergrößern (z. B. im Querformat) */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
html, body {
    margin: 0;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(122, 118, 85, 0.12), transparent 40%),
        linear-gradient(180deg, #fbfaf7 0%, var(--paper) 45%, #efece3 100%);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--brand-dark); }

.topbar {
    padding: 1.25rem 1.25rem 0.75rem;
    display: grid;
    gap: 0.35rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    min-width: 0;
}

.brand-icon {
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
    border-radius: 0.55rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.help-toggle {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.brand {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
    letter-spacing: 0.02em;
    animation: brandIn 0.6s ease-out;
    line-height: 1.05;
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.25;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.nav a {
    text-decoration: none;
    color: var(--ink);
    border-bottom: 2px solid transparent;
    padding-bottom: 0.1rem;
}
.nav a:hover { border-color: var(--brand); }

.lang { display: flex; gap: 0.4rem; align-items: center; margin-inline-start: auto; font-size: 0.9rem; }

.app {
    flex: 1;
    width: min(1100px, 100%);
    max-width: 100%;
    margin: 0 auto;
    padding: 1.25rem;
    min-width: 0;
    overflow-x: hidden;
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.help-panel {
    display: none;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-width: 0;
}

body.help-open .help-panel {
    display: flex;
}

.help-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    background: #f4f3ee;
    flex-shrink: 0;
}

.help-panel-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.help-close {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.help-body {
    padding: 0.9rem 1rem 1.25rem;
    overflow: auto;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ink);
}

.help-body h2 {
    font-size: 1.05rem;
    margin: 1rem 0 0.45rem;
}

.help-body h2:first-child { margin-top: 0; }

.help-body ol {
    margin: 0 0 0.75rem;
    padding-inline-start: 1.25rem;
}

.help-body li { margin: 0.25rem 0; }

.help-tip {
    margin: 1rem 0 0;
    padding: 0.65rem 0.75rem;
    background: var(--ok-bg);
    border-radius: 8px;
    color: var(--ok);
    font-size: 0.88rem;
}

.help-body kbd {
    font-family: var(--font);
    font-size: 0.85em;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
    background: #fff;
}

/* Narrow: fullscreen help, must close before working */
@media (max-width: 899px) {
    body.help-open .help-panel {
        position: fixed;
        inset: 0;
        z-index: 45;
        border-radius: 0;
        border: 0;
        max-height: none;
    }

    body.help-open .help-body {
        flex: 1;
    }

    body.help-open .app,
    body.help-open .footer {
        visibility: hidden;
        pointer-events: none;
    }
}

/* Medium: 1/3 help + 2/3 main instead of centered column */
@media (min-width: 900px) and (max-width: 1299px) {
    body.help-open .workspace {
        display: grid;
        grid-template-columns: 1fr 2fr;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    body.help-open .help-panel {
        border-radius: 0;
        border-inline-start: 0;
        border-top: 0;
        border-bottom: 0;
        max-height: calc(100vh - 5.5rem);
        position: sticky;
        top: 4.5rem;
    }

    body.help-open .app {
        width: 100%;
        max-width: none;
        margin: 0;
    }
}

/* Wide: help beside the main pane in parallel */
@media (min-width: 1300px) {
    body.help-open .workspace {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 1.25rem;
        width: 100%;
        padding: 0 1.25rem;
        box-sizing: border-box;
    }

    body.help-open .help-panel {
        width: min(380px, 30%);
        flex: 0 0 min(380px, 30%);
        max-height: calc(100vh - 5.5rem);
        position: sticky;
        top: 4.5rem;
        margin-top: 1.25rem;
        order: -1;
    }

    body.help-open .app {
        flex: 1 1 auto;
        width: min(1100px, calc(100% - 400px));
        max-width: 1100px;
        margin: 0;
    }
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
}

.footer-left {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    align-items: baseline;
    min-width: 0;
}

.footer-center {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
}

.footer-center a {
    color: inherit;
}

.footer .cfi {
    margin-inline-start: 0;
    text-align: end;
}

.register-copy {
    display: grid;
    gap: 0.75rem;
}
.register-copy .register-intro p,
.register-copy .register-summary p {
    margin: 0.35rem 0;
}
.register-copy .register-summary ul {
    margin: 0.35rem 0 0.35rem 1.1rem;
    padding: 0;
}
.register-consent {
    margin-top: 0.35rem;
}
.register-consent-text {
    margin: 0 0 0.65rem;
    font-size: 0.92rem;
    color: var(--muted);
}
.org-optout-confirm {
    border: 1px solid var(--danger, #a32020);
    background: #fbf2f2;
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    display: grid;
    gap: 0.5rem;
}
.org-optout-confirm p {
    margin: 0;
    color: var(--danger, #a32020);
    font-weight: 600;
}
.name-conflict-confirm {
    border: 1px solid var(--brand, #2f6b3a);
    background: #f3f7f4;
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    display: grid;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.name-conflict-confirm p {
    margin: 0;
    font-weight: 600;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    animation: rise 0.35s ease-out;
}

h1, h2, h3 {
    color: var(--brand);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.75rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

.stack { display: grid; gap: 0.75rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; min-width: 0; }
.grow { flex: 1 1 12rem; min-width: 0; }
.row > label { min-width: 0; max-width: 100%; }

label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.9rem;
    color: var(--muted);
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    background: #fff;
    color: var(--ink);
}

.password-field {
    position: relative;
    display: block;
    width: 100%;
}
.password-field input {
    padding-inline-end: 2.55rem;
}
.password-field .password-toggle {
    position: absolute;
    inset-inline-end: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.password-field .password-toggle:hover,
.password-field .password-toggle[aria-pressed="true"] {
    color: var(--brand-dark);
    background: rgba(122, 118, 85, 0.1);
}
.password-field .eye-icon {
    display: block;
}

textarea { min-height: 110px; resize: vertical; }

button, .btn {
    appearance: none;
    border: 0;
    border-radius: 8px;
    padding: 0.6rem 0.95rem;
    background: linear-gradient(180deg, #f89d0e 0%, #fedd03 100%);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: transform 0.15s ease, filter 0.15s ease;
}
button:hover, .btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
button.tab:hover,
button.tab-add:hover {
    filter: none;
    transform: none;
}
.tab:hover:not(.active) {
    background: #ebe8df;
}
button.secondary, .btn.secondary {
    background: #fff;
    color: var(--brand-dark);
    border: 1px solid var(--line);
}
button.danger { background: linear-gradient(180deg, #c43a3a, var(--danger)); }
button.btn-muted,
#save-claims:not(.is-dirty) {
    background: #ebe7db;
    color: var(--brand-dark);
    border: 1px solid var(--line);
}
#save-claims.is-dirty {
    background: linear-gradient(180deg, #f89d0e 0%, #fedd03 100%);
    color: #fff;
    border: 0;
}
/* Aktiver Speichern-Knopf außerhalb des Viewports: schwebt unten am Zeilenende der Artikelliste
   (Abstand 0,5em; auf dem iPhone zusätzlich über der Home-Leiste) */
.save-claims-slot { display: inline-flex; }
#save-claims.is-floating {
    position: fixed;
    bottom: calc(0.5em + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.notify-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1.4fr) repeat(3, minmax(5rem, 1fr));
    gap: 0.35rem 0.6rem;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
}
.notify-row label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
}
.notify-row input[type="checkbox"] {
    width: auto;
}
.magic-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.magic-row pre {
    flex: 1 1 auto;
    margin: 0;
}

.tabs-bar {
    position: sticky;
    top: var(--topbar-h);
    z-index: 15;
    margin: 0 0 0.85rem;
    padding-top: 0.35rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    scroll-margin-top: var(--topbar-h);
}
.tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-bottom: -1px;
    padding: 0 0.1rem;
}
.tab {
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #f3f1ea;
    color: var(--ink);
    border-radius: 10px 10px 0 0;
    padding: 0.5rem 0.95rem;
    white-space: nowrap;
    flex: 0 0 auto;
    font-weight: 500;
    position: relative;
    box-shadow: inset 0 -1px 0 var(--line);
}
.tab.active {
    background: var(--panel);
    color: var(--brand-dark);
    font-weight: 700;
    border-bottom-color: var(--panel);
    box-shadow:
      inset 0 2px 0 #fff,
      0 -1px 0 rgba(0,0,0,0.04);
    z-index: 1;
}
/* Aktiver Reiter des Organisators mit Werkzeugen: ◀ Name ✎ 🗑 ▶ */
.tab.tab-tools {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.3rem 0.4rem;
}
.tab-tools .tab-label {
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
}
.tab-icon,
.icon-plain {
    background: none;
    border: 0;
    color: var(--brand-dark);
    padding: 0.3rem;
    border-radius: 6px;
    line-height: 0;
}
.tab-tools .tab-label:hover,
.tab-icon:hover,
.icon-plain:hover {
    background: #ebe8df;
    filter: none;
    transform: none;
}
.icon-plain--danger:hover { color: var(--danger); }
.item-title .icon-plain { vertical-align: middle; }
.tab-add {
    border-style: dashed;
    background: transparent;
    color: var(--brand-dark);
    box-shadow: none;
    min-width: 2.4rem;
    padding-inline-start: 0.65rem;
    padding-inline-end: 0.65rem;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}
.title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.title-row h1 {
    margin: 0;
    flex: 1 1 auto;
}
.archive-fold {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
}
.fold-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: transparent;
    color: var(--brand-dark);
    border: 0;
    padding: 0.35rem 0;
    font-weight: 700;
}
.fold-tri {
    display: inline-block;
    width: 1rem;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}
.archive-fold-body {
    margin-top: 0.5rem;
}

.item {
    display: grid;
    /* minmax(0, …): lange Namen dürfen die Spalte nicht über den Bildschirm hinaus aufweiten */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: calc(var(--topbar-h) + 3.5rem);
}
.item-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: start;
}
.item-head > div { min-width: 0; }
/* Lange Namen umbrechen (auch ohne Leerzeichen, z. B. iPhone/Safari), Werkzeuge bleiben zusammen */
.item-title {
    font-weight: 700;
    color: var(--ink);
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    hyphens: auto;
}
.item-tools { display: inline-flex; gap: 0.1rem; white-space: nowrap; vertical-align: middle; }
@media (max-width: 480px) {
    .item-title { font-size: 0.95rem; }
}
.item-size { color: var(--muted); font-size: 0.92rem; }
.packages { display: flex; flex-wrap: wrap; gap: 0.22rem; }
.packages--variants {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.45rem;
}
.pkg-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.variant-input {
    flex: 1 1 8rem;
    min-width: 0;
    max-width: 28rem;
    margin: 0;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}
.variant-input.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(196, 58, 58, 0.2);
}
.variant-taken {
    color: var(--muted);
    font-size: 0.92rem;
    font-style: italic;
}
.pkg {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 5px;
    border: 2px solid #9e9a8c;
    background: #fff;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.15s ease, transform 0.12s ease;
}
.pkg.available,
.pkg.mine,
.pkg.taken {
    border-width: 2px;
    border-color: #9e9a8c;
    background: #fff;
}
.pkg.taken {
    cursor: not-allowed;
}
.pkg.no-claim,
.pkg.no-claim:disabled {
    cursor: default;
}
.pkg.no-claim:hover {
    transform: none;
}
.pkg-check {
    width: 1.55rem;
    height: 1.55rem;
    display: block;
}
.name-check {
    display: inline-flex;
    align-items: center;
    vertical-align: -0.15em;
    margin-inline-start: 0.35rem;
}
.name-check .pkg-check {
    width: 1em;
    height: 1em;
    display: block;
}
.name-check .pkg-check path {
    stroke: var(--claim-color, #2f6b3a);
    stroke-width: 3.8;
}
.pkg-check path {
    fill: none;
    stroke: var(--claim-color, #2f6b3a);
    stroke-width: 3.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.pkg.taken .pkg-check path,
.pkg.mine .pkg-check path {
    stroke: var(--claim-color, #2f6b3a);
}
.pkg.dirty {
    box-shadow: 0 0 0 2px var(--claim-glow, rgba(62, 207, 90, 0.45)),
        0 0 10px var(--claim-glow-soft, rgba(62, 207, 90, 0.38));
}
.pkg:not(:disabled):not(.no-claim):hover {
    transform: scale(1.06);
}
.pkg:focus-visible {
    outline: 2px solid var(--claim-color, #2f6b3a);
    outline-offset: 2px;
}

.home-section-title {
    margin-top: 1.5rem;
}
.home-section-title:first-of-type {
    margin-top: 0.85rem;
}

.btn-plus {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    padding: 0.15rem 0.7rem 0.3rem;
    min-width: 2.5rem;
}
.home-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    margin-bottom: 0.55rem;
}
.home-card-main {
    min-width: 0;
    flex: 1 1 10rem;
}
.invite-row {
    flex: 1 1 10rem;
    min-width: 0;
}
.home-card-main a {
    color: inherit;
    text-decoration: none;
}
.home-card-main a:hover strong {
    text-decoration: underline;
}
.home-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.home-next {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}
.home-goal {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.1rem;
}

/* Statistik-Grafik (SVG ohne style-Attribute: Farben nur über Klassen) */
.stats-chart { overflow-x: auto; }
.stats-chart svg { width: 100%; min-width: 520px; height: auto; display: block; }
.stats-axis { font-size: 11px; fill: var(--muted); }
.stats-axis-title { font-size: 11px; fill: var(--muted); }
.stats-grid { stroke: var(--line); stroke-width: 1; }
.stats-tick { stroke: var(--muted); stroke-width: 1; }
.stats-frame { fill: none; stroke: var(--line); stroke-width: 1; }
/* Element plus Klasse: schlägt die Farbklassen, die auch fill setzen */
polyline.stats-line, line.stats-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.stats-marker { stroke-width: 2; }
.stats-claims { stroke: var(--brand); fill: var(--brand); }
.stats-people { stroke: #2b6cb0; fill: #2b6cb0; }
circle.stats-dot { stroke: none; }
.stats-joins { fill: #2b6cb0; stroke: #2b6cb0; }
.stats-new-claims { fill: #d69e2e; stroke: #d69e2e; }
.stats-leaves { fill: #718096; stroke: #718096; }
.stats-today { stroke: #d32f2f; }
.stats-rsvp { stroke: #000000; }
.stats-event { stroke: #2e7d32; }
.stats-purge { stroke: #7b1fa2; }
.stats-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.5rem; font-size: 0.85rem; }
.stats-legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }

.notes-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f4f3ee;
    padding: 0.7rem;
    line-height: 1.35;
}
.notes-box .notes-text {
    margin: 0;
    white-space: pre-wrap;
}
.notes-box .planned-line {
    margin: 0.7rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.archive-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 0.35rem;
}
.archive-filter-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 10rem;
    min-width: 0;
    margin: 0;
}

.dlg-inline-error {
    color: #a31818;
    font-size: 0.9rem;
    margin: 0.35rem 0 0;
}
.dlg-field-invalid {
    border-color: #a31818 !important;
    outline-color: #a31818;
}

.nav-proxy-end {
    font-weight: 700;
    color: var(--accent) !important;
    border-bottom: 0 !important;
}
button.linkish {
    display: inline;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: var(--brand-dark);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}
button.linkish:hover {
    filter: none;
    transform: none;
}
.ac-wrap { position: relative; }
.ac-menu {
    position: absolute;
    z-index: 40;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 220px;
    overflow: auto;
    padding: 0.25rem;
}
.ac-option {
    display: block;
    width: 100%;
    text-align: start;
    background: transparent;
    color: var(--ink);
    border: 0;
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
}
.ac-option:hover,
.ac-option.active {
    background: rgba(122, 118, 85, 0.12);
    filter: none;
    transform: none;
}
#bm-dialog-ok.is-dirty,
button.is-dirty {
    background: linear-gradient(180deg, #f89d0e 0%, #fedd03 100%);
    color: #fff;
    border: 0;
}
.info-btn {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand);
    font-weight: 700;
    padding: 0;
}
.popover {
    background: #fff8e8;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

.progress {
    height: 0.55rem;
    background: #ebe7db;
    border-radius: 999px;
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f89d0e 0%, #fedd03 100%);
    transition: width 0.4s ease;
}

.list-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}
.list-card:hover { background: rgba(122,118,85,0.06); }

.search-hits {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 0.35rem;
}
.search-hits button {
    width: 100%;
    background: transparent;
    color: var(--ink);
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    justify-content: flex-start;
}
.search-hits button:last-child { border-bottom: 0; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    background: #2c2a22;
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    z-index: 50;
    max-width: min(90vw, 420px);
}
.toast.toast-ok {
    background: #2f6b3a;
}
.toast.toast-error {
    background: #8b2e2e;
}
.email-status-ok { color: #2f6b3a; }
.email-status-error { color: #8b2e2e; }
.participant-lines {
    margin: 0.4rem 0 0;
    padding-inline-start: 1.1rem;
    font-size: 0.9rem;
    color: var(--muted, #666);
}

.invite-panel .invite-row,
.invite-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.invite-link {
    word-break: break-all;
    flex: 1 1 auto;
}
.invite-qr-row {
    align-items: flex-start;
}
.invite-qr-row img {
    max-width: 220px;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.copy-icon { display: block; }

.fav-color-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
input[type="color"].fav-color-swatch {
    -webkit-appearance: none;
    appearance: none;
    width: 1em;
    height: 1em;
    min-width: 1em;
    min-height: 1em;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}
input[type="color"].fav-color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"].fav-color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 1px;
}
input[type="color"].fav-color-swatch::-moz-color-swatch {
    border: none;
    border-radius: 1px;
}
a.btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button, .btn { width: auto; max-width: 100%; }
.btn-inline { width: auto !important; flex: 0 0 auto; }
.btn-tiny { padding: 0.2rem 0.45rem; font-size: 0.8rem; }
.actions { gap: 0.5rem; flex-wrap: wrap; }
.icon-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 8px;
    background: #fff;
    color: var(--brand-dark);
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn.is-busy .refresh-icon {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.progress-box { margin: 0.5rem 0 0.75rem; }
.visitors-line { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.92rem; }

.lang-dropdown {
    position: relative;
    display: inline-block;
}
.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
}
.lang-caret {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1;
}
.lang-menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.3rem);
    min-width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.25rem;
    z-index: 40;
    display: grid;
    gap: 0.15rem;
}
.lang-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    color: var(--ink);
    border: 0;
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
}
.lang-option:hover,
.lang-option.active {
    background: rgba(122, 118, 85, 0.12);
}
.flag {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-style: normal;
}
.flag-img {
    display: inline-block;
    width: 1.25em;
    height: 0.9em;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    vertical-align: middle;
}
.lang-label { font-size: 0.85rem; white-space: nowrap; }
.lang-flag-only .lang-label { display: none; }
.lang-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.lang-check .flag-img { width: 1.35em; height: 0.95em; }
#dlg-lang-box {
    display: grid;
    gap: 0.35rem;
    padding: 0.35rem 0 0.15rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}
.data-table th,
.data-table td {
    border: 1px solid var(--line);
    padding: 0.45rem 0.55rem;
    text-align: start;
}
.data-table th { background: #f4f3ee; }
.data-table .num { text-align: end; }
.data-table .section-row td {
    background: #ebe7db;
    border-top: 2px solid #cfc9b8;
}

.bm-dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0;
    /* Nie breiter als der Viewport (100vw ohne Scrollbalken-Probleme auf iOS) */
    max-width: min(560px, 94vw, 100%);
    width: 100%;
    box-shadow: var(--shadow);
}
.bm-dialog--wide {
    max-width: min(80vw, 100%);
    width: 80vw;
}
.date-time-row { align-items: flex-end; flex-wrap: wrap; }
.date-time-row input[type="time"] { min-width: 7.5rem; }
.lost-claims { margin: 0.25rem 0 0.5rem; padding-inline-start: 1.2rem; }
.invite-editor { min-height: 14rem; font-family: inherit; }
.invite-placeholders ul { margin: 0.35rem 0; padding-inline-start: 1.2rem; }
.invite-placeholders code { font-weight: 700; }
.bm-dialog::backdrop { background: rgba(40, 36, 28, 0.45); }
/* Meldung über einem offenen Dialog */
.bm-alert { max-width: min(26rem, calc(100vw - 2rem)); }
.bm-alert p { margin: 0; white-space: pre-line; }
.bm-dialog-inner { padding: 1rem 1.1rem 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.85rem; }
/* Grid-Elemente schrumpfen sonst nicht unter die Breite breiter Tabellen/langer Wörter */
.bm-dialog-inner > * { min-width: 0; }
#bm-dialog-body { position: relative; overflow-wrap: anywhere; }
.bm-dialog--wide #bm-dialog-body {
    max-height: min(70vh, 720px);
    overflow: auto;
}
.dialog-actions {
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.dialog-actions-spacer { flex: 1 1 auto; min-width: 0.5rem; }
#bm-dialog-extra:not([hidden]) { order: -1; }
#bm-dialog-ok:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
    transform: none;
}
.i18n-fields {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    display: grid;
    gap: 0.45rem;
}
.i18n-fields label { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem; align-items: center; }
.i18n-fields .lang-check--top { align-items: start; }
.i18n-fields .lang-check--top .flag-img { margin-block-start: 0.6rem; }
.i18n-fields input.is-suggestion,
.i18n-fields textarea.is-suggestion { font-style: italic; border-style: dashed; background: #fbfaf4; }
.translate-hint { margin: 0; font-size: 0.85rem; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.translate-hint .translate-trigger { font-weight: 600; text-align: start; }
/* Admin: Übersetzungs-Cache */
.tc-translations { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1rem 0.5rem; margin: 0; }
.tc-translations dt { font-weight: 600; }
.tc-translations dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
td.tc-text { min-width: 8rem; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; margin: 0.75rem 0 1.25rem; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 0.4rem 0.5rem; text-align: start; }
table.data th { background: #f4f3ee; }
.privacy-doc h2 { margin-top: 1.2rem; }
.privacy-doc h4 { margin: 1rem 0 0.4rem; font-size: 1rem; color: var(--brand); }
.privacy-doc table { width: 100%; border-collapse: collapse; margin: 0.6rem 0 1rem; font-size: 0.9rem; }
.privacy-doc th, .privacy-doc td {
    border: 1px solid var(--line);
    padding: 0.4rem 0.5rem;
    vertical-align: top;
    /* Lange Namen (z. B. bm_group_*, bringmit_progress_mode) umbrechen statt die Tabelle zu verbreitern */
    overflow-wrap: anywhere;
    word-break: break-word;
}
.proxy-banner {
    margin: 0;
    padding: 0.55rem 0.75rem;
    background: var(--ok-bg);
    color: var(--ok);
    border-radius: 8px;
    font-size: 0.92rem;
}
.proxy-block h2 { margin-bottom: 0.25rem; }
/* Countdown bis zum Zusageschluss (ab 5 Tagen vorher) */
.rsvp-countdown-banner {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid #c77700;
    border-radius: 8px;
    color: #8a4b00;
    background: #fff4dd;
    font-weight: 600;
}
/* Zusageschluss vorbei: roter Hinweis über der Artikelliste */
.rsvp-closed-banner {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    background: #fdecec;
    font-weight: 600;
}
.proxy-block .list-card {
    margin-bottom: 0.4rem;
    padding: 0.55rem 0.7rem;
}

@media (max-width: 640px) {
    .topbar { padding: 1rem; }
    .app { padding: 1rem; }
    .lang { margin-inline-start: 0; width: 100%; }
    .lang-label { display: none; }
    .grow { flex-basis: 100%; }
    .home-card-main,
    .archive-filter-row label,
    .invite-row { flex-basis: 100%; }
    .pkg-row { flex-wrap: wrap; }
    .variant-input { flex-basis: 100%; max-width: none; }
    .bm-dialog--wide {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
    .bm-dialog--wide .bm-dialog-inner { padding: 0.75rem; }
    /* Datenschutz auf schmalen Bildschirmen: kleinere Schrift, Tabellen passen in die Breite */
    .privacy-doc { font-size: 0.9rem; }
    .privacy-doc table { table-layout: fixed; font-size: 0.78rem; }
    .privacy-doc th, .privacy-doc td { padding: 0.3rem; hyphens: auto; }
}

@keyframes brandIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* Utility-Klassen statt style-Attributen (CSP: style-src 'self' ohne 'unsafe-inline').
   !important, weil sie bisherige Inline-Styles mit höchster Priorität ersetzen. */
.u-ai-center { align-items: center !important; }
.u-ai-stretch { align-items: stretch !important; }
.u-col { flex-direction: column !important; }
.u-wrap { flex-wrap: wrap !important; }
.u-minw-0 { min-width: 0; overflow-wrap: anywhere; }
.u-between { justify-content: space-between !important; }
.u-gap-xs { gap: 0.35rem !important; }
.u-gap-sm { gap: 0.5rem !important; }
.u-gap-md { gap: 1rem !important; }
.u-m0 { margin: 0 !important; }
.u-mt-xs { margin-top: 0.25rem !important; }
.u-mt-sm { margin-top: 0.75rem !important; }
.u-w-auto { width: auto !important; }
.u-w-full { width: 100% !important; }
.u-maxw-420 { max-width: 420px !important; }
.u-grow-shrink { flex: 1 !important; min-width: 0 !important; }
.u-pre-line { white-space: pre-line !important; }
.u-pre-wrap { white-space: pre-wrap !important; word-break: break-all !important; }
.u-head-row { font-weight: 600 !important; border-bottom: 2px solid var(--line) !important; }
.u-swatch-sm { width: 2.4rem !important; height: 1.8rem !important; padding: 0 !important; }
