@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/roboto-latin-400-normal.woff2') format('woff2'),
         url('/assets/fonts/roboto-latin-400-normal.woff') format('woff');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/roboto-latin-500-normal.woff2') format('woff2'),
         url('/assets/fonts/roboto-latin-500-normal.woff') format('woff');
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/roboto-latin-700-normal.woff2') format('woff2'),
         url('/assets/fonts/roboto-latin-700-normal.woff') format('woff');
}

:root {
    --brand: #4f2772;
    --brand-dark: #3a1c57;
    --brand-light: #dcc9ec;
    --text: #212529;
    --bg: #ffffff;
    --bg-muted: #f7f4fa;
    --border: #e3d9ee;
    --danger: #b3261e;
    --success: #1b7a3d;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(79, 39, 114, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: var(--text);
    background: var(--bg-muted);
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--brand); }

h1, h2, h3 { color: var(--brand-dark); margin-top: 0; }

button, input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ---------- Besucher-Kiosk-Layout ---------- */

.visitor-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px 56px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-logo {
    height: 64px;
    margin: 8px 0 24px;
}

.lang-switch {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    box-shadow: var(--shadow);
    z-index: 10;
}

@media (max-width: 480px) {
    .lang-switch {
        position: static;
        justify-content: center;
        width: fit-content;
        margin: 0 auto 12px;
    }
}

.lang-switch a {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.lang-switch a.active {
    background: var(--brand);
    color: #fff;
}

.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 28px;
    width: 100%;
}

.kiosk-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.kiosk-subtitle {
    text-align: center;
    color: #555;
    margin-bottom: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 16px 24px;
    border-radius: var(--radius);
    border: none;
    background: var(--brand);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s ease;
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--brand);
    border: 2px solid var(--brand);
}

.btn-secondary:hover { background: var(--brand-light); }

.btn-stack { display: flex; flex-direction: column; gap: 16px; }

.btn-small {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 0.95rem;
    width: auto;
}

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group { flex: 1; }

.error-box {
    background: #fbeaea;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.success-box {
    background: #eaf6ee;
    border: 1px solid var(--success);
    color: var(--success);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.briefing-content {
    max-height: 40vh;
    overflow-y: auto;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    line-height: 1.55;
}

.briefing-content img,
.rich-editor-surface img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 20px 0;
}

.checkbox-row input {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-top: 2px;
}

.quiz-question {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.quiz-question-text {
    font-weight: 500;
    margin-top: 0;
}

.quiz-question .checkbox-row { margin: 10px 0; }

.signature-pad-wrap { margin-bottom: 20px; }

#signature-pad {
    width: 100%;
    height: 180px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    touch-action: none;
    background: #fff;
}

.text-center { text-align: center; }
.text-muted { color: #666; font-size: 0.9rem; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

.result-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
}

.result-item form { margin: 0; }

/* ---------- Portal ---------- */

.portal-body { background: var(--bg-muted); }

.portal-topbar {
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
}

.portal-topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.portal-topbar img { height: 32px; }
.portal-topbar form { margin: 0; }
.portal-topbar button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.portal-nav {
    display: flex;
    gap: 4px;
    background: var(--brand-dark);
    padding: 0 24px;
    overflow-x: auto;
}

.portal-nav a {
    color: #f1e9f8;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 0.95rem;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.portal-nav a.active {
    border-bottom-color: #fff;
    color: #fff;
    font-weight: 500;
}

.portal-content { max-width: 1100px; margin: 0 auto; padding: 24px; }

.portal-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.portal-table th, .portal-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.portal-table th {
    background: var(--bg-muted);
    color: var(--brand-dark);
    font-weight: 600;
}

.portal-table input[type="text"],
.portal-table input[type="email"] {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
}

.portal-table input[type="text"]:hover,
.portal-table input[type="email"]:hover {
    border-color: var(--border);
}

.portal-table input[type="text"]:focus,
.portal-table input[type="email"]:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg);
}

.portal-table input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.host-status,
.question-status {
    font-size: 0.8rem;
    white-space: nowrap;
    width: 90px;
}

.text-danger { color: var(--danger); }

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-present { background: #eaf6ee; color: var(--success); }
.tag-absent { background: #eee; color: #666; }
.tag-besucher { background: var(--brand-light); color: var(--brand-dark); }
.tag-fremdfirma { background: #fdecd2; color: #8a5a00; }

.portal-card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-row .form-group { margin-bottom: 0; min-width: 160px; }
.filter-row .form-group input,
.filter-row .form-group select { min-height: 42px; }

.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
}

.rich-editor-wrap {
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rich-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
}

.rich-editor-toolbar button.rich-editor-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 6px;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.rich-editor-toolbar button.rich-editor-icon-btn:hover {
    background: var(--brand-light);
}

.rich-editor-toolbar button.rich-editor-icon-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.rich-editor-dropdown {
    position: relative;
}

.rich-editor-dropdown-menu {
    display: none;
    position: absolute;
    top: 36px;
    left: 0;
    flex-direction: column;
    min-width: 72px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
    z-index: 20;
    overflow: hidden;
}

.rich-editor-dropdown-menu.open {
    display: flex;
}

.rich-editor-dropdown-menu button {
    border: none;
    background: var(--bg);
    text-align: left;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.rich-editor-dropdown-menu button:hover {
    background: var(--brand-light);
}

.rich-editor-surface {
    min-height: 200px;
    padding: 12px;
    outline: none;
    line-height: 1.5;
}

.rich-editor-surface ul {
    padding-left: 24px;
}

.autosave-status {
    margin-top: 6px;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .form-row { flex-direction: column; }
    .portal-content { padding: 16px; }
}
