/**
 * AHG CRM – Stylesheet
 * Design System: "The Tactile Community"
 */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Be+Vietnam+Pro:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ── Design Tokens ── */
:root {
    --green: #06852e; --green-dark: #006922; --green-light: #ecffe6; --green-muted: #f0f7f0;
    --orange: #EF8220; --orange-light: #fff4ea; --orange-gradient: linear-gradient(135deg, #EF8220, #f5a623);
    --blue: #2496cf; --blue-light: #e6f3fa; --red: #ba1a1a; --red-light: #fdf0ef;
    --surface: #f5fbf0; --surface-low: #eff6ea; --surface-card: #ffffff; --surface-hover: #eaf0e4;
    --text: #171d16; --text-secondary: #3f4a3d; --text-muted: #6b7280; --text-faint: #9e9e9e;
    --outline: #becab9;
    --shadow-color: rgba(23, 29, 22, 0.06);
    --shadow-sm: 0 2px 8px var(--shadow-color); --shadow-md: 0 8px 32px var(--shadow-color);
    --shadow-lg: 0 16px 48px rgba(23, 29, 22, 0.1);
    --shadow-glow-green: 0 8px 24px rgba(6, 133, 46, 0.15);
    --shadow-glow-orange: 0 8px 24px rgba(239, 130, 32, 0.15);
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px; --radius-pill: 40px;
    --font-display: 'Plus Jakarta Sans', sans-serif; --font-body: 'Be Vietnam Pro', sans-serif;
    --sidebar-width: 260px; --header-height: 64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-body); color: var(--text); background: var(--surface); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-decoration: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; line-height: 1; }

/* ═══════ LOGIN ═══════ */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--green-dark), var(--green)); padding: 20px; }
.login-card { background: var(--surface-card); border-radius: var(--radius-xl); padding: 48px 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; color: var(--green); margin-top: 12px; }
.login-logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.login-logo .logo-emoji { font-size: 3rem; display: block; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 12px 16px; border: 2px solid transparent; border-radius: var(--radius-md); background: var(--surface-low); color: var(--text); font-size: 1rem; transition: all 0.2s ease; outline: none; }
.form-input:focus { border-color: var(--green); background: var(--surface-card); box-shadow: 0 0 0 4px rgba(6, 133, 46, 0.1); }
.login-error { color: var(--red); font-size: 0.85rem; font-weight: 600; min-height: 20px; margin-bottom: 8px; }

/* ═══════ BUTTONS ═══════ */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 28px; border: none; border-radius: var(--radius-md); background: var(--orange); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; transition: all 0.3s ease; width: 100%; }
.btn-primary:hover { background: var(--green); box-shadow: var(--shadow-glow-green); transform: translateY(-1px); }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius-md); background: var(--green-muted); color: var(--green); font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease; }
.btn-secondary:hover { background: var(--green); color: #fff; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.2s ease; }
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger-ghost:hover { background: var(--red-light); color: var(--red); }
.btn-danger { background: var(--red); color: #fff; border: none; padding: 10px 20px; border-radius: var(--radius-md); font-weight: 700; cursor: pointer; transition: all 0.2s ease; }
.btn-danger:hover { opacity: 0.9; }

/* ═══════ APP LAYOUT ═══════ */
#app-screen { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--surface-card); box-shadow: var(--shadow-md); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-header { padding: 24px 20px; background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; }
.sidebar-header h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; }
.sidebar-header p { font-size: 0.8rem; opacity: 0.7; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.2s ease; margin-bottom: 4px; border: none; background: none; width: 100%; text-align: left; font-size: 0.95rem; }
.nav-item:hover { background: var(--surface-low); color: var(--text); }
.nav-item.active { background: var(--green-light); color: var(--green); font-weight: 700; }
.nav-item .material-symbols-outlined { font-size: 22px; }
.sidebar-footer { padding: 16px 12px; background: var(--surface-low); }
.user-info { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; }
.user-info .user-name { font-weight: 600; font-size: 0.9rem; }
.role-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: 0.5px; }
.role-superadmin { background: var(--orange-light); color: var(--orange); }
.role-verwaltung { background: var(--green-light); color: var(--green); }
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 32px; min-height: 100vh; }

/* ═══════ CONTACTS VIEW ═══════ */
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.view-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--text); }
.contacts-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Search Bar */
.search-bar { position: relative; max-width: 400px; width: 100%; }
.search-bar .material-symbols-outlined { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 20px; }
.search-bar input { width: 100%; padding: 12px 16px 12px 44px; border: 2px solid transparent; border-radius: var(--radius-lg); background: var(--surface-card); box-shadow: var(--shadow-sm); font-size: 0.95rem; transition: all 0.2s ease; outline: none; }
.search-bar input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(6, 133, 46, 0.08); }

/* Label Filter */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px; }
.label-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-pill); border: none; background: var(--surface-card); box-shadow: var(--shadow-sm); font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; }
.label-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.label-chip.active { color: #fff; background: var(--label-color, var(--green)); box-shadow: 0 4px 12px color-mix(in srgb, var(--label-color, var(--green)) 30%, transparent); }
.label-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.label-chip.active .label-dot { background: rgba(255,255,255,0.6) !important; }
.label-toggle { font-size: 0.75rem; opacity: 0.6; margin-left: 2px; }
.filter-mode-btn { padding: 5px 12px; border-radius: var(--radius-pill); border: 2px solid var(--outline); background: transparent; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-mode-btn:hover { border-color: var(--green); color: var(--green); }

/* Data Table */
.data-table-wrapper { background: var(--surface-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { padding: 14px 18px; text-align: left; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; background: var(--surface-low); }
.data-table tbody tr { transition: background 0.15s ease; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody td { padding: 14px 18px; font-size: 0.92rem; color: var(--text-secondary); vertical-align: middle; }
.data-table .cell-name strong { color: var(--text); font-weight: 600; }
.data-table .cell-email { color: var(--text-muted); font-size: 0.88rem; }
.data-table .cell-company { color: var(--text-muted); font-size: 0.88rem; }

/* Checkbox Column */
.cell-checkbox { width: 44px; text-align: center; padding: 10px 8px !important; }
.cell-checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--green); border-radius: 4px; }

/* Label Tags & Source Badges */
.label-tag { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; margin: 1px 3px; white-space: nowrap; }
.source-badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 600; }
.source-manual { background: var(--surface-low); color: var(--text-muted); }
.source-webhook_um { background: var(--blue-light); color: var(--blue); }
.source-webhook_cf7 { background: var(--orange-light); color: var(--orange); }
.source-wordpress { background: var(--blue-light); color: var(--blue); }
.source-crm { background: var(--green-light); color: var(--green); }
.empty-state { text-align: center; padding: 60px 20px !important; color: var(--text-muted); }
.empty-state .material-symbols-outlined { font-size: 48px; opacity: 0.3; display: block; margin-bottom: 12px; }
.empty-hint { color: var(--text-faint); font-style: italic; font-size: 0.9rem; padding: 12px 0; }

/* Status Badges */
.status-badge { display: inline-block; padding: 3px 12px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.status-aktiv { background: var(--green-light); color: var(--green); }
.status-passiv { background: var(--surface-low); color: var(--text-muted); }
.status-gesperrt { background: var(--red-light); color: var(--red); }
.status-interessent { background: var(--orange-light); color: var(--orange); }

/* ═══════ DETAIL VIEW ═══════ */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.detail-header h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.detail-meta { display: flex; gap: 12px; align-items: center; }
.detail-meta span { font-size: 0.85rem; color: var(--text-muted); }
.btn-detail-action { margin-left: 8px; white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-card { background: var(--surface-card); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-sm); }
.detail-card h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.detail-card h3 .material-symbols-outlined { font-size: 20px; color: var(--green); }
.detail-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-form-grid .form-group { margin-bottom: 0; }
.detail-form-grid .full-width { grid-column: 1 / -1; }

/* Form Section Titles */
.form-section-title { font-family: var(--font-display); font-size: 0.8rem; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: 0.8px; margin: 20px 0 10px 0; padding-bottom: 6px; background: linear-gradient(to right, var(--green-light), transparent); padding: 6px 10px; border-radius: var(--radius-sm); }
.form-section-title:first-of-type { margin-top: 0; }

.form-input-sm { width: 100%; padding: 10px 14px; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--surface-low); font-size: 0.9rem; transition: all 0.2s ease; outline: none; }
.form-input-sm:focus { border-color: var(--green); background: #fff; }
select.form-input-sm { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-input-sm { min-height: 120px; resize: vertical; line-height: 1.6; }

/* DSGVO Checkbox */
.form-checkbox-group { display: flex; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); user-select: none; padding: 10px 0; }
.checkbox-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.checkbox-custom { display: none; }

/* ═══════ TIMELINE ═══════ */
.timeline-container { max-height: 400px; overflow-y: auto; padding-right: 8px; }
.timeline-container::-webkit-scrollbar { width: 4px; }
.timeline-container::-webkit-scrollbar-track { background: transparent; }
.timeline-container::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 4px; }
.timeline-item { display: flex; gap: 12px; padding: 12px 0; transition: background 0.15s ease; }
.timeline-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.timeline-content { flex: 1; min-width: 0; }
.timeline-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.4; }
.timeline-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 0.78rem; color: var(--text-faint); }
.timeline-add { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; }
.timeline-add input { flex: 1; padding: 10px 14px; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--surface-low); font-size: 0.9rem; outline: none; transition: all 0.2s ease; }
.timeline-add input:focus { border-color: var(--green); background: #fff; }

/* Snapshot Toggle Button */
.btn-snapshot-toggle { display: inline-block; margin-top: 6px; padding: 4px 12px; border: 1px solid var(--outline); border-radius: var(--radius-pill); background: var(--surface-low); color: var(--text-muted); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.btn-snapshot-toggle:hover { background: var(--green-light); color: var(--green); border-color: var(--green); }

/* Snapshot Content */
.timeline-snapshot { margin-top: 8px; padding: 12px; background: var(--surface-low); border-radius: var(--radius-sm); }
.snapshot-row { display: flex; gap: 8px; padding: 3px 0; font-size: 0.82rem; }
.snapshot-label { font-weight: 600; color: var(--text-muted); min-width: 120px; flex-shrink: 0; }
.snapshot-value { color: var(--text); }

/* Delta Entries */
.timeline-delta .timeline-text { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta-field { font-weight: 700; color: var(--text); font-size: 0.85rem; }
.delta-old { color: var(--red); text-decoration: line-through; font-size: 0.85rem; opacity: 0.8; }
.delta-arrow { color: var(--text-muted); font-weight: 700; font-size: 0.9rem; }
.delta-new { color: var(--green); font-weight: 600; font-size: 0.85rem; }

/* ═══════ RELATIONS ═══════ */
.relation-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s ease; }
.relation-item:hover { background: var(--surface-low); }
.relation-item .material-symbols-outlined { color: var(--blue); font-size: 20px; }
.relation-type { font-size: 0.78rem; color: var(--text-muted); display: block; }

/* ═══════ LABEL MANAGER ═══════ */
.label-manager-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-md); transition: background 0.15s ease; }
.label-manager-item:hover { background: var(--surface-low); }
.label-dot-lg { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.label-manager-name { font-weight: 600; flex: 1; }
.label-manager-count { font-size: 0.82rem; color: var(--text-muted); margin-right: 8px; }
.color-picker { width: 32px; height: 32px; border: none; border-radius: var(--radius-sm); cursor: pointer; background: none; padding: 0; }
.new-label-form { display: flex; gap: 10px; align-items: center; padding: 16px; background: var(--surface-low); border-radius: var(--radius-md); margin-top: 16px; }
.new-label-form input[type="text"] { flex: 1; padding: 10px 14px; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--surface-card); outline: none; font-size: 0.9rem; transition: border 0.2s ease; }
.new-label-form input[type="text"]:focus { border-color: var(--green); }

/* ═══════ MODALS ═══════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(23, 29, 22, 0.4); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; }
.modal-card { background: var(--surface-card); border-radius: var(--radius-xl); padding: 32px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal-card-lg { max-width: 680px; }
.modal-card h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.modal-card h2 .material-symbols-outlined { color: var(--green); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ═══════ TOAST ═══════ */
#toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--green-dark); color: #fff; padding: 12px 28px; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-glow-green); opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 1000; pointer-events: none; }
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════ ESCALATION / ALARM BOX ═══════ */
.escalation-box { background: var(--red-light); border-left: 4px solid var(--red); border-radius: var(--radius-xl); padding: 20px 24px; margin-bottom: 24px; animation: escalation-pulse 0.6s ease-out; }
@keyframes escalation-pulse { 0% { opacity: 0; transform: translateY(-8px); } 100% { opacity: 1; transform: translateY(0); } }
.escalation-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.escalation-icon { font-size: 1.5rem; }
.escalation-header h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 800; color: var(--red); letter-spacing: 0.5px; margin: 0; }
.escalation-details { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.escalation-row { display: flex; gap: 12px; font-size: 0.9rem; }
.escalation-label { font-weight: 700; color: var(--red); min-width: 70px; flex-shrink: 0; }
.escalation-value { color: var(--text); }
.escalation-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════ GESPERRT ROW HIGHLIGHT ═══════ */
.row-gesperrt { background: rgba(186, 26, 26, 0.04) !important; }
.row-gesperrt:hover { background: rgba(186, 26, 26, 0.08) !important; }
.gesperrt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: middle; animation: dot-pulse 2s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ═══════ PROFI-INFOKARTE ═══════ */
.profi-card { background: linear-gradient(135deg, #e8eaf6, #e3f2fd); border-left: 4px solid #227bc3; border-radius: var(--radius-xl); padding: 20px 24px; margin-bottom: 24px; animation: profi-slide 0.5s ease-out; }
@keyframes profi-slide { 0% { opacity: 0; transform: translateY(-6px); } 100% { opacity: 1; transform: translateY(0); } }
.profi-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.profi-card-icon { font-size: 1.4rem; }
.profi-card-header h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 800; color: #227bc3; letter-spacing: 0.5px; margin: 0; flex: 1; }
.profi-model-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); color: #fff; font-size: 0.7rem; font-weight: 800; letter-spacing: 1px; }
.profi-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profi-stat { background: rgba(255,255,255,0.7); border-radius: var(--radius-md); padding: 10px 14px; }
.profi-stat-label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.profi-stat-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ═══════ BILLING MODULE ═══════ */
.billing-tabs { display: flex; gap: 0; margin-bottom: 20px; }
.billing-tab { display: flex; align-items: center; gap: 6px; padding: 12px 20px; background: none; border: none; border-bottom: 3px solid transparent; font-family: var(--font-display); font-size: 0.9rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.billing-tab:hover { color: var(--text); background: rgba(0,0,0,0.02); }
.billing-tab.active { color: var(--green-dark); border-bottom-color: var(--green-dark); }
.billing-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--surface-light); font-size: 0.72rem; font-weight: 800; padding: 0 6px; }
.billing-tab.active .billing-tab-count { background: var(--green-dark); color: #fff; }

.billing-status-chips { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.status-chip { padding: 6px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.status-chip:hover { background: var(--surface-light); }
.status-chip.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

.assignment-badge, .invoice-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px; }
.assignment-offen { background: #fff3e0; color: #e65100; }
.assignment-in_bearbeitung { background: #e3f2fd; color: #1565c0; }
.assignment-abgeschlossen { background: #e8f5e9; color: #2e7d32; }
.assignment-storniert { background: #fce4ec; color: #c62828; }
.invoice-entwurf { background: #f5f5f5; color: #616161; }
.invoice-gesendet { background: #e3f2fd; color: #1565c0; }
.invoice-bezahlt { background: #e8f5e9; color: #2e7d32; }
.invoice-mahnung { background: #fce4ec; color: #c62828; }
.invoice-storniert { background: #f5f5f5; color: #9e9e9e; text-decoration: line-through; }

.billing-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.billing-empty p { margin-top: 8px; font-size: 0.9rem; }

.billing-tab-content { animation: fade-in 0.3s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Typeahead */
.typeahead-wrap { position: relative; }
.typeahead-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 100; max-height: 200px; overflow-y: auto; }
.typeahead-item { padding: 10px 14px; cursor: pointer; font-size: 0.85rem; transition: background 0.15s; }
.typeahead-item:hover { background: var(--surface-light); }
.typeahead-item small { display: block; color: var(--text-muted); font-size: 0.75rem; }

/* Invoice Modal */
.modal-card-xl { max-width: 780px; }
.invoice-number-badge { margin-left: auto; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--green-dark); color: #fff; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.5px; }
.invoice-items-section { margin: 16px 0; }
.invoice-items-section h3 { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 8px; }
.line-items-table { width: 100%; border-collapse: collapse; }
.line-items-table th { font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted); text-align: left; padding: 6px 8px; font-weight: 700; }
.line-items-table td { padding: 4px 8px; }
.line-items-table .form-input-sm { width: 100%; padding: 7px 10px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.line-items-table .form-input-sm:focus { border-color: var(--green-dark); outline: none; }

.invoice-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 16px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.invoice-total-row { display: flex; gap: 24px; font-size: 0.9rem; }
.invoice-total-row span:first-child { color: var(--text-muted); min-width: 80px; text-align: right; }
.invoice-total-gross { font-weight: 800; font-size: 1.1rem; color: var(--green-dark); padding-top: 4px; border-top: 2px solid var(--green-dark); margin-top: 4px; }

/* Unit Combobox */
.unit-combo { position: relative; display: flex; align-items: stretch; }
.unit-combo input { width: 100%; padding-right: 28px; }
.unit-combo-chevron { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); font-size: 18px; border-radius: var(--radius-sm); transition: color 0.15s, background 0.15s; user-select: none; }
.unit-combo-chevron:hover { color: var(--green-dark); background: rgba(0,0,0,0.04); }
.unit-combo-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 200; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); overflow: hidden; margin-top: 2px; }
.unit-combo-dropdown.open { display: block; animation: fade-in 0.15s ease; }
.unit-combo-option { padding: 7px 10px; font-size: 0.83rem; cursor: pointer; transition: background 0.12s; }
.unit-combo-option:hover { background: var(--surface-light); color: var(--green-dark); font-weight: 600; }

/* AHG Discount Toggle */
.ahg-discount-toggle { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-top: 12px; background: linear-gradient(135deg, rgba(6,133,46,0.06), rgba(239,130,32,0.06)); border-radius: var(--radius-md); border: 1px solid rgba(6,133,46,0.15); }
.ahg-discount-label { font-weight: 700; font-size: 0.88rem; color: var(--green-dark); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 24px; transition: background 0.25s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform 0.25s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--green-dark); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.ahg-discount-row { font-weight: 700; }
.ahg-discount-row span:last-child { color: #c0392b !important; }

/* Detail Billing */
.detail-billing-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.04); gap: 8px; flex-wrap: wrap; }
.detail-billing-row:last-child { border-bottom: none; }
.detail-billing-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 0.85rem; }
.detail-billing-actions { display: flex; gap: 6px; align-items: center; }
.btn-xs { padding: 3px 10px; font-size: 0.75rem; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* ═══════ GROUP ACTION MODAL ═══════ */
.group-action-badge { margin-left: auto; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--orange); color: #fff; font-size: 0.78rem; font-weight: 800; }
.group-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.group-action-card { background: var(--surface-low); border-radius: var(--radius-lg); padding: 0; overflow: hidden; border: 1px solid rgba(0,0,0,0.04); transition: box-shadow 0.2s ease; }
.group-action-card:hover { box-shadow: var(--shadow-sm); }
.group-action-card-header { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: linear-gradient(135deg, rgba(6,133,46,0.08), rgba(6,133,46,0.03)); border-bottom: 1px solid rgba(0,0,0,0.04); }
.group-action-card-header .material-symbols-outlined { color: var(--green); font-size: 22px; }
.group-action-card-header h3 { font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--text); margin: 0; flex: 1; }
.group-action-card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.group-action-email-card { grid-column: 1 / -1; }

/* Batch Radio Buttons */
.batch-radio-group { display: flex; gap: 16px; }
.batch-radio { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); }
.batch-radio input[type="radio"] { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }

/* Email Warning */
.batch-email-warning { padding: 10px 14px; background: var(--orange-light); border-radius: var(--radius-sm); font-size: 0.82rem; color: var(--orange); font-weight: 600; border-left: 3px solid var(--orange); }
.group-email-hint { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-left: auto; }

/* ═══════ DOKUMENTENVERWALTUNG ═══════ */
.doc-upload-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; padding: 12px; background: var(--surface-hover); border-radius: var(--radius-md); }
.doc-upload-bar select { flex: 1; }
.doc-category { margin-bottom: 12px; border-radius: var(--radius-md); overflow: hidden; }
.doc-category-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-hover); cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--text); transition: background 0.15s; user-select: none; }
.doc-category-header:hover { background: var(--surface-card); }
.doc-category-header .doc-cat-icon { font-size: 16px; }
.doc-category-header .doc-cat-count { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.doc-category-body { padding: 0 12px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--surface-hover); font-size: 0.82rem; }
.doc-row:last-child { border-bottom: none; }
.doc-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.doc-row-size { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.doc-row-date { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.doc-row-actions { display: flex; gap: 4px; }
.doc-row-actions button { padding: 4px; border: none; background: none; cursor: pointer; border-radius: var(--radius-sm); color: var(--text-muted); transition: all 0.15s; }
.doc-row-actions button:hover { background: var(--surface-hover); color: var(--green); }
.doc-row-actions button.doc-delete:hover { color: var(--status-gesperrt); }
.doc-id-badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-md); font-size: 0.82rem; font-weight: 600; }
.doc-id-badge.verified { background: #ecffe6; color: #06852e; }
.doc-id-badge.unverified { background: #fff7e6; color: #b27300; }
.doc-id-verify-btn { margin-top: 8px; }
.doc-empty { color: var(--text-muted); font-size: 0.8rem; font-style: italic; padding: 6px 0; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1024px) { .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .sidebar { width: 100%; position: relative; flex-direction: row; overflow-x: auto; }
    .sidebar-header { padding: 12px 16px; }
    .sidebar-nav { display: flex; flex-direction: row; padding: 8px; gap: 4px; }
    .nav-item { white-space: nowrap; padding: 8px 14px; margin-bottom: 0; }
    .sidebar-footer { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    #app-screen { flex-direction: column; }
    .detail-form-grid { grid-template-columns: 1fr; }
    .view-header { flex-direction: column; align-items: flex-start; }
    .modal-card-lg { max-width: 100%; }
}

/* ═══════ DIRTY-INDICATOR (Ungespeichert-Badge) ═══════ */
.dirty-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: rgba(239, 130, 32, 0.12);
    border: 1.5px solid rgba(239, 130, 32, 0.35);
    color: var(--orange);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    animation: dirty-pulse 2.5s ease-in-out infinite;
    white-space: nowrap;
    flex-shrink: 0;
}
.dirty-indicator .material-symbols-outlined { font-size: 15px; }
@keyframes dirty-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ═══════ DIRTY-DIALOG OVERLAY ═══════ */
.dirty-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23, 29, 22, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
    animation: dirty-overlay-in 0.2s ease;
}
@keyframes dirty-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.dirty-dialog-card {
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(23, 29, 22, 0.2);
    text-align: center;
    animation: dirty-card-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-top: 4px solid var(--orange);
}
@keyframes dirty-card-in {
    from { opacity: 0; transform: scale(0.93) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.dirty-dialog-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange-light), #fff4d0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 16px rgba(239, 130, 32, 0.2);
}
.dirty-dialog-icon .material-symbols-outlined {
    font-size: 32px;
    color: var(--orange);
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 32;
}
.dirty-dialog-card h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}
.dirty-dialog-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 28px;
}
.dirty-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dirty-dialog-actions .btn-primary {
    background: var(--green);
    box-shadow: var(--shadow-glow-green);
}
.dirty-dialog-actions .btn-primary:hover {
    background: var(--green-dark);
}
.dirty-btn-discard {
    color: var(--red) !important;
    border: 1.5px solid rgba(186, 26, 26, 0.25);
}
.dirty-btn-discard:hover {
    background: var(--red-light) !important;
}

/* ═══════ CONFIRM-DIALOG Variante ═══════ */
.confirm-dialog-icon {
    background: linear-gradient(135deg, #e3f2fd, #e8eaf6) !important;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.15) !important;
}
.confirm-dialog-icon .material-symbols-outlined {
    color: #1565c0 !important;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 32;
}
