:root {
    color-scheme: light;
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --text: #142033;
    --muted: #667085;
    --line: #d8e0e8;
    --primary: #145a18;
    --primary-hover: #0f4713;
    --danger: #a32626;
    --danger-hover: #842020;
    --warning: #996000;
    --warning-hover: #7a4c00;
    --info: #245b91;
    --radius: 14px;
    --shadow: 0 12px 34px rgba(25, 40, 60, 0.08);
    --shadow-soft: 0 4px 16px rgba(25, 40, 60, 0.07);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100%;
    margin: 0;
    padding: 18px;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
}
img { max-width: 100%; }
a { color: var(--info); }
h1, h2, h3 { color: var(--text); }
h1 { margin: 0 0 18px; font-size: clamp(1.6rem, 3vw, 2rem); line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 1.18rem; }
h3 { margin: 0 0 8px; font-size: 1rem; }
p { line-height: 1.55; }
code {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f1f4f7;
    word-break: break-word;
}

.card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.form-card { margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 0.9rem; }
.reference { margin-top: 6px; font-weight: 750; }
.empty { padding: 30px 12px !important; text-align: center; color: var(--muted); }
.hidden, [hidden] { display: none !important; }

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:hover { background: var(--primary-hover); }
.btn:focus-visible { outline: 3px solid rgba(36, 91, 145, 0.25); outline-offset: 2px; }
.btn.secondary { background: #e8edf2; color: var(--text); }
.btn.secondary:hover { background: #dbe3ea; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.warning { background: var(--warning); }
.btn.warning:hover { background: var(--warning-hover); }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: 0.82rem; }
.btn.full { width: 100%; min-height: 46px; }

.alert {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    line-height: 1.45;
}
.alert.success { border-color: #91c291; background: #eaf7ea; color: #174b17; }
.alert.error { border-color: #d99a9a; background: #fff0f0; color: #761d1d; }
.alert.warning { border-color: #ddc06b; background: #fff7dc; color: #664400; }
.alert.info { border-color: #9bbce0; background: #edf5ff; color: #173f69; }

.field, .form-grid label, .filter-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}
.field + .field { margin-top: 13px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5df;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: 0;
}
textarea { min-height: 105px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: #73a6d5;
    box-shadow: 0 0 0 3px rgba(36, 91, 145, 0.13);
}
.invalid { border-color: #c83b3b !important; box-shadow: 0 0 0 3px rgba(200, 59, 59, 0.12) !important; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.checkbox { flex-direction: row !important; align-items: center; justify-content: flex-start; padding-top: 28px; }
.checkbox input { width: auto; }
.help-text { margin: 7px 0 0; color: var(--muted); font-size: 0.82rem; font-weight: 500; line-height: 1.45; }

.submit-area { margin-top: 24px; }
.submit-area .btn {
    min-height: 46px;
    box-shadow: 0 7px 18px rgba(20, 90, 24, 0.18);
}
.submit-area .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 22px rgba(20, 90, 24, 0.24);
}
.submit-area .btn:active { transform: translateY(0); box-shadow: 0 4px 12px rgba(20, 90, 24, 0.16); }
.login-submit-area { margin-top: 26px; }

.public-wrap, .login-wrap, .install-wrap { max-width: 720px; margin: 20px auto; }
.public-card { max-width: 640px; margin: 0 auto; }
.login-card { max-width: 440px; margin: 0 auto; }
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.public-logo, .install-logo { display: block; width: auto; max-width: 240px; height: 42px; object-fit: contain; }
.install-logo { margin-bottom: 18px; }
.language-menu { position: relative; }
.language-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 7px;
    background: #fff;
    cursor: pointer;
}
.language-button img { display: block; width: auto; height: 22px; }
.language-list {
    position: absolute;
    z-index: 20;
    top: calc(100% + 7px);
    right: 0;
    display: none;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.language-menu:hover .language-list, .language-menu:focus-within .language-list { display: block; }
.language-list a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
}
.language-list a:hover { background: #f0f3f6; }
.language-list img { width: 26px; height: 18px; object-fit: cover; }
.site-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}
.site-info > div {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}
.site-info span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 0.8rem; }
.site-info strong { font-size: 1rem; }
.qr-hint { padding: 18px; border: 1px dashed #aeb8c4; border-radius: 12px; background: var(--surface-soft); }
.qr-hint h2 { margin-top: 0; }
.privacy-note { margin: 17px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.status-fields { margin: 14px 0 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.status-fields legend { padding: 0 5px; font-size: 0.9rem; font-weight: 750; }
.status-fields label { display: flex; align-items: center; gap: 9px; margin: 9px 0; }
.status-fields input { width: auto; }

.visit-options { display: grid; gap: 10px; margin: 14px 0; }
.visit-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 11px;
    align-items: start;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    cursor: pointer;
}
.visit-option:hover { border-color: #9fb5ca; background: #f3f7fa; }
.visit-option input { width: auto; margin-top: 4px; }
.visit-option strong, .visit-option span { display: block; }
.visit-option .visit-meta { margin-top: 4px; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.secondary-action { display: block; margin-top: 15px; text-align: center; font-size: 0.88rem; }

.admin-shell { max-width: 1500px; margin: 0 auto; }
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); font-weight: 850; text-decoration: none; }
.brand img { width: auto; max-width: 210px; height: 36px; object-fit: contain; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.admin-nav a { padding: 9px 12px; border-radius: 8px; background: #e8edf2; color: var(--text); font-weight: 700; text-decoration: none; }
.admin-nav a:hover { background: #dce4eb; }
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-main {
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}
.admin-footer { padding: 14px 5px 2px; color: var(--muted); font-size: 0.78rem; text-align: center; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-heading h1 { margin-bottom: 3px; }
.page-heading p { margin: 0 0 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats-grid.compact { max-width: 650px; margin-top: 16px; }
.stat { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.stat span { display: block; color: var(--muted); font-size: 0.82rem; }
.stat strong { font-size: 1.6rem; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.search-form { display: flex; flex: 1; gap: 8px; max-width: 600px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 0.88rem; }
th { background: #f5f7f9; font-size: 0.8rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; }
.action-row form { margin: 0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; white-space: nowrap; }
.badge.green { background: #e2f5e2; color: #175417; }
.badge.red { background: #fde8e8; color: #8b1e1e; }
.badge.blue { background: #e5effc; color: #174e83; }
.badge.gray { background: #eaedf0; color: #4b5563; }
.filter-card { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.filter-grid { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; }
.wide-cell { min-width: 240px; }
.error-detail { max-width: 380px; margin-top: 6px; color: #781c1c; white-space: pre-wrap; }
.events-table details summary { margin-top: 5px; color: #8b1e1e; font-size: 0.78rem; cursor: pointer; }

.qr-print-card { max-width: 560px; margin: 0 auto; padding: 26px; border: 2px solid #111; border-radius: 10px; background: #fff; text-align: center; }
.qr-print-head { display: flex; align-items: center; justify-content: center; gap: 16px; }
.qr-print-head img { width: auto; max-width: 220px; height: 46px; object-fit: contain; }
.qr-print-head h2 { margin: 0 0 4px; }
.qr-large { display: block; width: min(420px, 100%); height: auto; margin: 22px auto; }
.qr-instruction { font-size: 1.12rem; font-weight: 760; line-height: 1.45; }
.qr-url { color: var(--muted); font-size: 0.72rem; word-break: break-all; }

.system-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.system-grid .wide { grid-column: 1 / -1; }
.system-list > div { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.system-list > div:last-child { border-bottom: 0; }
.system-list span { color: var(--muted); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.check { padding: 9px; border-radius: 8px; background: #f3f5f7; }
.check.ok strong { color: #176117; }
.check.bad strong { color: #a02525; }
.logo-preview { display: flex; min-height: 110px; align-items: center; justify-content: center; margin-bottom: 14px; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-soft); }
.logo-preview img { width: auto; max-width: 320px; max-height: 90px; object-fit: contain; }
.explanation-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.explanation-flow div { position: relative; padding: 12px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); text-align: center; font-size: 0.82rem; font-weight: 750; }
.explanation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.explanation-list article { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.explanation-list article p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.translation-block { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.translation-block summary, details summary { cursor: pointer; font-weight: 750; }
.details-grid { margin-top: 13px; }

@media (max-width: 900px) {
    .stats-grid, .filter-grid, .system-grid, .explanation-list { grid-template-columns: 1fr 1fr; }
    .system-grid .wide { grid-column: 1 / -1; }
    .explanation-flow { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    body { padding: 8px; }
    .card, .admin-main { padding: 14px; }
    .form-grid, .site-info, .stats-grid, .filter-grid, .check-grid, .system-grid, .explanation-list { grid-template-columns: 1fr; }
    .form-grid .wide, .system-grid .wide { grid-column: auto; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search-form { max-width: none; }
    .admin-header { padding: 10px; }
    .brand span { display: none; }
    .system-list > div { grid-template-columns: 1fr; gap: 3px; }
    .checkbox { padding-top: 0; }
    .public-logo, .install-logo { max-width: 210px; height: 38px; }
}

@media print {
    body { padding: 0; background: #fff; }
    .admin-header, .admin-nav, .page-heading, .no-print, .alert, .admin-footer { display: none !important; }
    .admin-main, .admin-shell { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
    .qr-print-card { max-width: 100%; border: 2px solid #000; page-break-inside: avoid; }
    .qr-large { width: 110mm; }
    .qr-url { font-size: 8pt; }
}


/* Schildgenerator */
.page-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-section-heading h2 { margin-bottom: 3px; }
.page-section-heading p { margin: 0; }
.sign-fields textarea { min-height: 88px; }
.generator-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.generator-actions .checkbox { padding-top: 0; font-weight: 700; }
.select-col { width: 78px; text-align: center; }
td:first-child input[type="checkbox"] { width: auto; }
.site-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.site-summary > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.site-summary span { display: block; color: var(--muted); font-size: 0.8rem; }
.site-summary strong { display: block; margin-top: 2px; font-size: 1.08rem; }

@media (max-width: 700px) {
    .generator-actions { align-items: stretch; flex-direction: column; }
    .generator-actions .action-row { width: 100%; }
    .generator-actions .btn { flex: 1 1 auto; }
    .site-summary { grid-template-columns: 1fr; }
}
