:root {
    --bg: #f4f7f2;
    --surface: #ffffff;
    --text: #1b2e24;
    --muted: #5c6f64;
    --primary: #2d6a4f;
    --primary-dark: #1f4d39;
    --accent: #d8f3dc;
    --border: #d7e3db;
    --error: #9b2226;
    --error-bg: #fde8e8;
    --success: #1b4332;
    --success-bg: #e7f5ec;
    --shadow: 0 10px 30px rgba(27, 46, 36, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #edf5ef 0%, var(--bg) 220px);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.5rem;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.link-quiet {
    color: var(--muted);
    font-size: 0.95rem;
}

.main {
    padding: 1.25rem 1rem 2rem;
}

.site-footer {
    padding: 1.5rem 1rem 2rem;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.hero,
.page-head,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: 1.6rem;
    line-height: 1.2;
}

.lede {
    margin: 0;
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.field {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
}

.field input[type="password"],
.field input[type="text"] {
    width: 100%;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
}

.file-field input[type="file"] {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.85rem;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: #fafcfa;
    font-size: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.1rem;
    padding: 0.85rem 1.2rem;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #eef4ef;
    color: var(--text);
    border: 1px solid var(--border);
}

.action-grid {
    display: grid;
    gap: 1rem;
}

.action-card {
    display: grid;
    gap: 0.35rem;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    min-height: 7rem;
}

.action-primary {
    background: linear-gradient(135deg, #2d6a4f, #40916c);
    color: #fff;
    border: none;
}

.action-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.action-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.action-sub {
    color: inherit;
    opacity: 0.85;
}

.flash {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.flash-error {
    background: var(--error-bg);
    color: var(--error);
}

.flash-success {
    background: var(--success-bg);
    color: var(--success);
}

.hint,
.fund-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.nav-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-row .btn {
    flex: 1 1 10rem;
}

.funde-list {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.fund-card {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0.9rem;
    padding: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.fund-thumb-wrap {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: #eef2ee;
    aspect-ratio: 1;
}

.fund-thumb-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #eef2ee;
    aspect-ratio: 1;
    cursor: pointer;
}

.fund-thumb-btn-large {
    aspect-ratio: auto;
    margin-bottom: 0.75rem;
}

.fund-thumb-btn-large .preview-image {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.fund-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.fund-line-open {
    color: #9a6700;
    font-style: italic;
    font-weight: 500;
}

.btn-small {
    min-height: 2.5rem;
    padding: 0 0.85rem;
    font-size: 0.92rem;
}

.btn-danger {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #f0c4c4;
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 20, 15, 0.96);
    display: flex;
    flex-direction: column;
}

.lightbox-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    padding-top: max(0.85rem, env(safe-area-inset-top));
}

.lightbox-title {
    color: #fff;
    font-weight: 600;
}

.lightbox-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem 1.5rem;
    min-height: 0;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    flex-shrink: 0;
}

.fund-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fund-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.fund-line {
    margin: 0.35rem 0;
    font-weight: 600;
}

.fund-meta {
    margin: 0.15rem 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-neu {
    background: #fff3cd;
    color: #7a5d00;
}

.badge-gemeldet {
    background: #d8f3dc;
    color: #1b4332;
}

.empty-state {
    text-align: center;
}

.empty-state .btn {
    margin-top: 1rem;
    width: 100%;
}

.upload-choices {
    display: grid;
    gap: 1rem;
}

.upload-choices .action-card {
    width: 100%;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.upload-preview {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafcfa;
}

.preview-image {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 10px;
    background: #eef2ee;
}

.preview-name {
    margin: 0.75rem 0 0.35rem;
    font-weight: 600;
    word-break: break-all;
}

.preview-gps {
    margin: 0;
    font-size: 0.95rem;
    white-space: pre-line;
}

.preview-ok {
    color: var(--success);
}

.preview-warn {
    color: #9a6700;
}

.hint-box {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #fff8e6;
    border: 1px solid #f0dfa8;
    color: #5c4a00;
    font-size: 0.92rem;
}

.hint-box p {
    margin: 0.35rem 0;
}

.hint-warn {
    background: #fff0f0;
    border-color: #f0c4c4;
    color: #6b2020;
}

.arten-picker {
    margin-top: 1rem;
}

.arten-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.arten-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}

.arten-results {
    margin-top: 0.35rem;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.arten-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.9rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.arten-result:last-child {
    border-bottom: 0;
}

.arten-result:active,
.arten-result:hover {
    background: var(--accent);
}

.arten-result-label {
    display: block;
    font-weight: 600;
}

.arten-result-group {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.arten-hint {
    margin: 0;
    padding: 0.75rem 0.9rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.arten-error {
    color: var(--error);
}

.arten-selected {
    margin: 0.6rem 0 0;
}

.arten-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 0.92rem;
}

.arten-chip-clear {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.15rem;
}

.steps {
    margin: 1rem 0 0;
    padding-left: 1.2rem;
}

.steps li {
    margin-bottom: 0.6rem;
}

.status-list {
    margin: 0;
    padding-left: 1.1rem;
}

.status-list li {
    margin-bottom: 0.45rem;
}

.pwa-status {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.pwa-ok {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #b7e4c7;
}

.pwa-warn {
    background: #fff8e6;
    color: #5c4a00;
    border: 1px solid #f0dfa8;
}

@media (min-width: 640px) {
    .action-grid {
        grid-template-columns: 1fr 1fr;
    }

    h1 {
        font-size: 1.85rem;
    }
}
