:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eef4fb;
    --text: #172033;
    --muted: #667085;
    --line: #d8e1ec;
    --primary: #1b4d89;
    --primary-dark: #153d6d;
    --success: #027a48;
    --warning: #b54708;
    --danger: #b42318;
    --radius: 18px;
    --shadow: 0 20px 45px rgba(27, 77, 137, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f2742;
    color: #fff;
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #58a6ff, #c8e2ff);
    color: #08223d;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    color: rgba(255, 255, 255, 0.82);
    padding: 12px 14px;
    border-radius: 14px;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-decoration: none;
}

.userbox {
    margin-top: auto;
    padding: 16px;
    background: rgba(255, 255, 255, 0.09);
    border-radius: 18px;
}

.userbox strong,
.userbox span,
.userbox a {
    display: block;
}

.userbox span {
    color: rgba(255, 255, 255, 0.68);
    margin: 3px 0 12px;
}

.userbox a {
    color: #c8e2ff;
}

.main {
    padding: 30px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.topbar p,
.muted,
.hint,
small {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card,
.card,
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 20px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2.2rem;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.two-columns {
    grid-template-columns: minmax(0, 1.2fr) minmax(330px, 0.8fr);
}

.align-start {
    align-items: start;
}

.card {
    padding: 22px;
}

.wide-card {
    grid-column: span 1;
}

.card-header,
.post-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}

td small {
    display: block;
    margin-top: 4px;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox input {
    width: auto;
}

.button {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.button.small {
    padding: 8px 11px;
    font-size: 0.88rem;
}

.button.secondary {
    background: #e5edf7;
    color: var(--primary);
}

.button.danger {
    background: var(--danger);
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.badge-success {
    background: #dcfae6;
    color: var(--success);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning);
}

.badge-danger {
    background: #fee4e2;
    color: var(--danger);
}

.alert {
    padding: 13px 15px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert-success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: var(--success);
}

.alert-error {
    border-color: #fecdca;
    background: #fef3f2;
    color: var(--danger);
}

.empty {
    background: var(--surface-2);
    padding: 16px;
    border-radius: 14px;
    color: var(--muted);
}

.list,
.post-list,
.user-list {
    display: grid;
    gap: 12px;
}

.list-item,
.post,
.user-row {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 15px;
    background: #fff;
}

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.list-item-block {
    display: block;
}

.list-item p,
.post p {
    margin: 8px 0;
    color: #344054;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.user-row {
    display: grid;
    grid-template-columns: 170px repeat(4, minmax(150px, 1fr)) auto auto;
    gap: 12px;
    align-items: end;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 10% 10%, rgba(88, 166, 255, 0.26), transparent 26%),
        radial-gradient(circle at 90% 10%, rgba(27, 77, 137, 0.18), transparent 28%),
        var(--bg);
}

.login-card {
    width: min(450px, 100%);
    padding: 34px;
}

.brand-login {
    color: var(--text);
    margin-bottom: 24px;
}

.brand-login span {
    color: var(--muted);
}

.login-card h1 {
    margin: 0 0 8px;
}

.demo-login {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }

    .two-columns {
        grid-template-columns: 1fr;
    }

    .user-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        border-radius: 0 0 24px 24px;
    }

    .main {
        padding: 20px;
    }

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

    .list-item,
    .card-header,
    .post-head {
        display: grid;
    }
}

.room-list {
    display: grid;
    gap: 14px;
}

.room-row {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 15px;
    background: #fff;
    display: grid;
    grid-template-columns: 160px repeat(4, minmax(120px, 1fr));
    gap: 12px;
    align-items: end;
}

.room-title strong,
.room-title small {
    display: block;
}

.room-actions {
    justify-content: flex-start;
}

.room-delete {
    display: flex;
    justify-content: flex-end;
    margin-top: -8px;
    margin-bottom: 12px;
}

@media (max-width: 1200px) {
    .room-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .room-row {
        grid-template-columns: 1fr;
    }

    .room-delete {
        justify-content: stretch;
    }

    .room-delete .button {
        width: 100%;
    }
}

/* Horizon Gäste / Rechnungen / Rewards Update */
.login-card-wide { max-width: 520px; }
.login-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 18px 0;
    padding: 6px;
    background: #eef2ff;
    border-radius: 16px;
}
.login-switch a {
    text-align: center;
    text-decoration: none;
    color: #334155;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 700;
}
.login-switch a.active {
    background: #fff;
    color: #1e3a8a;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.alert-blocked {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
    font-weight: 800;
}
.form-section-title {
    margin: 12px 0 0;
    color: #0f172a;
    font-size: 1rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
}
.table-wrap {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}
.data-table th,
.data-table td {
    text-align: left;
    vertical-align: top;
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
}
.data-table th {
    color: #475569;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.copy-input {
    width: 160px;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    font-weight: 700;
}
.button.tiny {
    padding: 7px 10px;
    font-size: .78rem;
    border-radius: 10px;
    margin-top: 6px;
}
.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.points-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #a5f3fc;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
}
.info-box {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    color: #334155;
}
.blocked-user {
    border: 2px solid #ef4444 !important;
    background: #fff1f2;
}
.guest-shell {
    min-height: 100vh;
    background: #f8fafc;
}
.guest-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 32px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.guest-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.guest-nav a {
    text-decoration: none;
    color: #334155;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 12px;
}
.guest-nav a.active,
.guest-nav a:hover {
    background: #eef2ff;
    color: #1e3a8a;
}
.guest-main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}
.page-hero {
    margin-bottom: 22px;
}
.page-hero h1 {
    margin: 0 0 6px;
    font-size: 2rem;
}
.detail-list {
    display: grid;
    gap: 12px;
}
.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}
.detail-list span {
    color: #64748b;
}
.big-number {
    font-size: 2.8rem;
    font-weight: 900;
    margin: 8px 0 20px;
    color: #0f172a;
}
.invoice-page {
    background: #e2e8f0;
    padding: 28px;
}
.invoice-document {
    background: #ffffff;
    max-width: 960px;
    margin: 0 auto;
    border-radius: 24px;
    padding: 36px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}
.invoice-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 24px;
    margin-bottom: 24px;
}
.invoice-meta {
    text-align: right;
}
.invoice-meta h1 {
    margin: 0 0 8px;
}
.invoice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.invoice-grid article,
.invoice-box {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    background: #f8fafc;
}
.invoice-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}
.invoice-row:last-child { border-bottom: 0; }
.invoice-note {
    margin-top: 14px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
}
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}
.invoice-table th,
.invoice-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}
.invoice-table tfoot th {
    font-size: 1.05rem;
}
.invoice-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}
@media print {
    .invoice-page { background: #fff; padding: 0; }
    .invoice-document { box-shadow: none; max-width: none; border-radius: 0; }
    .invoice-footer { display: none; }
}
@media (max-width: 760px) {
    .guest-topbar, .invoice-header, .invoice-grid, .detail-list div {
        display: block;
    }
    .invoice-meta { text-align: left; margin-top: 18px; }
    .invoice-page { padding: 0; }
    .invoice-document { border-radius: 0; padding: 20px; }
}
