/* ── Mitarbeiter-App Design System ───────────────────────────────────── */
:root {
    --primary: #00A7B7;
    --primary-dark: #008fa0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1a2332;
    --text: #2d3748;
    --gray: #6b7280;
    --light: #f4f8fb;
    --border: #e2e8f0;
    --white: #ffffff;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: all 0.22s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--light);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.app-shell {
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow);
    position: relative;
}

.topbar {
    position: sticky; top: 0; z-index: 100;
    background: var(--primary);
    color: var(--white);
    padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.topbar h1 { font-size: 1.05rem; font-weight: 700; flex: 1; }
.topbar .back-btn {
    background: rgba(255,255,255,0.15); color: white; border: none;
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 700;
}
.topbar .lang-select {
    background: rgba(255,255,255,0.15); color: white; border: none;
    padding: 6px 10px; border-radius: 8px; font-size: 0.85rem;
}
.topbar .lang-select option { color: var(--dark); }

.container { padding: 20px; }

/* ── Login / Invite ──────────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px; max-width: 440px; margin: 0 auto;
}
.auth-logo {
    font-size: 2.2rem; font-weight: 800; color: var(--primary);
    margin-bottom: 8px;
}
.auth-sub { color: var(--gray); margin-bottom: 32px; text-align: center; }
.auth-card {
    width: 100%;
    background: var(--white);
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin-bottom: 20px; font-size: 1.25rem; font-weight: 700; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 0.88rem; font-weight: 600;
    color: var(--dark); margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 14px;
    font-size: 0.95rem; font-family: inherit;
    border: 1.5px solid var(--border); border-radius: var(--radius);
    background: var(--white); color: var(--text);
    transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,167,183,0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.form-error {
    background: rgba(239,68,68,0.1); color: var(--danger);
    padding: 10px 14px; border-radius: var(--radius); font-size: 0.88rem;
    margin-bottom: 16px;
}
.form-info {
    background: rgba(0,167,183,0.08); color: var(--primary-dark);
    padding: 10px 14px; border-radius: var(--radius); font-size: 0.88rem;
    margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border: none; border-radius: var(--radius);
    font-size: 0.95rem; font-weight: 600;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--gray); cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-ghost { background: transparent; color: var(--gray); }
.btn-ghost:hover { background: var(--light); color: var(--dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { filter: brightness(0.92); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { filter: brightness(0.92); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

/* ── Tiles (Mitarbeiter-Home) ────────────────────────────────────────── */
.tile-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-bottom: 20px;
}
.tile {
    background: var(--white); border: 1.5px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 16px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 10px; transition: var(--transition); cursor: pointer;
}
.tile:hover {
    border-color: var(--primary); transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.tile-icon {
    width: 48px; height: 48px; border-radius: 14px;
    background: rgba(0,167,183,0.12); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.tile-label { font-size: 0.9rem; font-weight: 600; color: var(--dark); }
.tile-badge {
    position: absolute; top: 8px; right: 8px;
    background: var(--danger); color: var(--white);
    font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 100px;
}

/* ── Cards / Lists ───────────────────────────────────────────────────── */
.section-title {
    font-size: 1rem; font-weight: 700; color: var(--dark);
    margin: 4px 0 12px; display: flex; align-items: center; gap: 8px;
}
.card {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
    margin-bottom: 10px;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 6px;
}
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--dark); }
.card-meta { font-size: 0.8rem; color: var(--gray); }
.card-body { font-size: 0.9rem; color: var(--text); }

.badge {
    font-size: 0.73rem; font-weight: 700; padding: 3px 9px; border-radius: 100px;
    display: inline-block; white-space: nowrap;
}
.badge-neu { background: rgba(59,130,246,0.12); color: var(--info); }
.badge-in_bearbeitung { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-bestaetigt { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-abgelehnt { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-zurueckgefragt { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.badge-erledigt { background: rgba(16,185,129,0.12); color: var(--success); }

/* ── Bottom Navigation (Mitarbeiter/Vorgesetzter) ─────────────────────── */
.bottom-nav {
    position: sticky; bottom: 0; z-index: 90;
    background: var(--white); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; padding: 6px 0;
}
.bottom-nav a {
    flex: 1; text-align: center; padding: 8px; color: var(--gray);
    font-size: 0.72rem; font-weight: 600; text-decoration: none;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    position: relative;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav .nav-icon { font-size: 1.25rem; }
.bottom-nav .nav-badge {
    position: absolute; top: 4px; right: calc(50% - 20px);
    background: var(--danger); color: var(--white);
    font-size: 0.65rem; font-weight: 700; padding: 1px 6px; border-radius: 100px;
    min-width: 16px; text-align: center;
}

/* ── Inbox ───────────────────────────────────────────────────────────── */
.anliegen-detail {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 18px; border: 1px solid var(--border);
    margin-bottom: 12px;
}
.anliegen-detail dl { margin: 12px 0; }
.anliegen-detail dt { font-size: 0.8rem; color: var(--gray); font-weight: 600; }
.anliegen-detail dd {
    margin: 0 0 10px 0; font-size: 0.92rem; color: var(--text);
}
.anliegen-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty {
    text-align: center; padding: 60px 20px; color: var(--gray);
    font-size: 0.95rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }

.loading {
    text-align: center; padding: 40px; color: var(--gray);
    font-size: 0.95rem;
}

/* ── Benachrichtigung-Liste ──────────────────────────────────────────── */
.notif-item {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    display: flex; gap: 10px; align-items: flex-start;
}
.notif-item.unread { background: rgba(0,167,183,0.04); border-left: 3px solid var(--primary); }
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary); margin-top: 7px; flex-shrink: 0;
}
.notif-item.read .notif-dot { background: var(--border); }
.notif-content { flex: 1; }
.notif-title { font-size: 0.88rem; font-weight: 600; color: var(--dark); }
.notif-text { font-size: 0.82rem; color: var(--gray); margin-top: 2px; }
.notif-time { font-size: 0.72rem; color: var(--gray); margin-top: 4px; }

/* ── Chat ───────────────────────────────────────────────────────────── */
.chat-partner-list { display: flex; flex-direction: column; gap: 8px; }
.chat-partner {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px; display: flex;
    align-items: center; gap: 12px; cursor: pointer; transition: var(--transition);
}
.chat-partner:hover { border-color: var(--primary); background: var(--light); }
.chat-avatar {
    width: 42px; height: 42px; border-radius: 50%; background: rgba(0,167,183,0.15);
    color: var(--primary); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem; flex-shrink: 0;
}
.chat-partner-main { flex: 1; min-width: 0; }
.chat-partner-name { font-weight: 600; color: var(--dark); font-size: 0.95rem; }
.chat-partner-preview {
    font-size: 0.82rem; color: var(--gray);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.chat-partner-meta { text-align: right; flex-shrink: 0; }
.chat-partner-time { font-size: 0.72rem; color: var(--gray); }
.chat-partner-badge {
    display: inline-block; min-width: 20px; margin-top: 4px; padding: 2px 7px;
    background: var(--primary); color: var(--white); border-radius: 100px;
    font-size: 0.7rem; font-weight: 700; text-align: center;
}

/* Konversation */
.chat-thread {
    display: flex; flex-direction: column;
    height: calc(100vh - 72px - 62px); /* topbar + bottomnav */
    max-height: calc(100vh - 72px - 62px);
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex;
    flex-direction: column; gap: 8px; background: var(--light);
}
.chat-bubble {
    max-width: 78%; padding: 9px 13px; border-radius: 14px;
    font-size: 0.92rem; line-height: 1.4; word-wrap: break-word;
    white-space: pre-wrap;
}
.chat-bubble.mine {
    align-self: flex-end; background: var(--primary); color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
    align-self: flex-start; background: var(--white); color: var(--text);
    border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-bubble-time {
    font-size: 0.68rem; opacity: 0.7; margin-top: 4px; display: block;
}
.chat-input-row {
    display: flex; gap: 8px; padding: 12px; background: var(--white);
    border-top: 1px solid var(--border);
}
.chat-input-row textarea {
    flex: 1; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius); resize: none; font-family: inherit;
    font-size: 0.92rem; max-height: 100px;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--primary); }
.chat-input-row .btn { flex-shrink: 0; padding: 10px 18px; }

/* ── Utility ─────────────────────────────────────────────────────────── */
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mt-md { margin-top: 16px; }
.text-center { text-align: center; }
.text-gray { color: var(--gray); }
.text-small { font-size: 0.85rem; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════
   Reklamationen (Phase 4b — Andockung an Reklamationsmanagement-System)
   ══════════════════════════════════════════════════════════════════════ */

.rekl-list { display: flex; flex-direction: column; gap: 10px; }

.rekl-item {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.rekl-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.rekl-prio {
    width: 36px; height: 36px;
    border-radius: 50%;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem;
    flex-shrink: 0;
}

.rekl-main { min-width: 0; }
.rekl-titel { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.rekl-meta { font-size: 0.8rem; color: var(--gray); }

.rekl-status {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Detail-Ansicht ──────────────────────────────────────────────────── */
.rekl-detail { display: flex; flex-direction: column; gap: 12px; }

.rekl-detail-head {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 4px;
}
.rekl-detail-ref {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.rekl-detail-status {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.rekl-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.rekl-card-label {
    font-size: 0.7rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}
.rekl-card-value {
    font-size: 0.95rem;
    line-height: 1.45;
}
.rekl-card-value a { color: var(--primary); text-decoration: none; }
.rekl-card-meta {
    font-size: 0.82rem;
    color: var(--gray);
    margin-top: 4px;
}

.rekl-foto-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}
.rekl-foto-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.rekl-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════════════════
   Voice-Modal fuer Bearbeitungsdokumentation
   ══════════════════════════════════════════════════════════════════════ */

.voice-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 200;
    animation: voice-fade 0.2s ease-out;
}
@keyframes voice-fade { from { opacity: 0; } to { opacity: 1; } }

.voice-modal {
    background: white;
    width: 100%; max-width: 520px;
    border-radius: 16px 16px 0 0;
    padding: 24px 20px 20px;
    max-height: 90vh;
    overflow-y: auto;
    animation: voice-slide 0.25s ease-out;
}
@keyframes voice-slide { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (min-width: 640px) {
    .voice-overlay { align-items: center; }
    .voice-modal { border-radius: 16px; }
}

.voice-rec-area {
    text-align: center;
    padding: 20px 0;
}
.voice-mic {
    width: 96px; height: 96px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 167, 183, 0.3);
}
.voice-mic:hover { transform: scale(1.05); }
.voice-mic.recording {
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    animation: voice-pulse 1.4s infinite;
}
@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); }
}

.voice-status {
    margin-top: 14px;
    font-weight: 500;
    font-size: 0.95rem;
    min-height: 22px;
}
.voice-timer {
    margin-top: 4px;
    color: var(--gray);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}

.voice-text-box {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.voice-text-box label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 6px;
}
.voice-text-box textarea {
    width: 100%;
    min-height: 80px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.45;
    background: transparent;
}

.voice-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.voice-actions .btn { flex: 1; }

.rekl-sla { font-variant-numeric: tabular-nums; }
.rekl-sla.warn { color: #f59e0b; font-weight: 600; }
.rekl-sla.error { color: #ef4444; font-weight: 600; }
.rekl-card-danger { background: #fef2f2 !important; border-color: #fecaca !important; }
