:root {
    --color-primary:     #003d7a;
    --color-accent:      #00b4d8;
    --color-accent-dark: #0096b4;
    --color-bg:          #ffffff;
    --color-bg-light:    #f4f7fb;
    --color-text:        #1a1a2e;
    --color-text-muted:  #6b7a99;
    --color-border:      #dce3ef;
    --color-success:     #28a745;
    --color-warning:     #ffc107;
    --color-danger:      #dc3545;
    --shadow-card:       0 2px 8px rgba(0,61,122,0.08);
    --radius:            6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg-light);
}

a { color: var(--color-accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo span {
    display: block;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.sidebar-logo small {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav a.active { border-left: 3px solid var(--color-accent); }
.sidebar-nav .nav-icon { width: 18px; text-align: center; opacity: 0.8; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}
.sidebar-footer a { color: rgba(255,255,255,0.5); }
.sidebar-footer a:hover { color: #fff; }

.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h1 { font-size: 20px; color: var(--color-primary); font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.page-body { padding: 28px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--color-primary); }
.card-body { padding: 20px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    line-height: 1.4;
    white-space: nowrap;
}
.btn-primary   { background: var(--color-accent);   color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }
.btn-secondary { background: var(--color-bg-light); color: var(--color-primary); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-danger    { background: var(--color-danger);   color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 6px 8px; background: transparent; color: var(--color-text-muted); }
.btn-icon:hover { color: var(--color-primary); background: var(--color-bg-light); }

/* ── Badges / Status ─────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-zu_kontaktieren      { background: #e8f0fe; color: #1a56db; }
.badge-besucherakquise      { background: #fff3e0; color: #e65100; }
.badge-sehr_interessiert    { background: #e8f5e9; color: #2e7d32; }
.badge-weniger_interessiert { background: #f3e5f5; color: #6a1b9a; }
.badge-won                  { background: #e8f5e9; color: #1b5e20; }
.badge-lost                 { background: #ffebee; color: #b71c1c; }
.badge-reaktivierung        { background: #e3f2fd; color: #0d47a1; }
.badge-relevance-hoch       { background: #ffebee; color: #b71c1c; }
.badge-relevance-mittel     { background: #fff3e0; color: #e65100; }
.badge-relevance-niedrig    { background: #f4f7fb; color: #6b7a99; }
.badge-role-admin           { background: #e3f2fd; color: #0d47a1; }
.badge-role-user            { background: #f4f7fb; color: #6b7a99; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0,180,216,0.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Table ───────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-bg-light);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
th a { color: var(--color-text-muted); display: flex; align-items: center; gap: 4px; }
th a:hover { color: var(--color-primary); text-decoration: none; }
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-bg-light); }

/* ── Tabs ────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: 24px; }
.tab-nav {
    padding: 10px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s;
}
.tab-nav:hover { color: var(--color-primary); }
.tab-nav.active { color: var(--color-accent-dark); border-bottom-color: var(--color-accent); }
.tab { display: none; }
.tab.active { display: block; }

/* ── Timeline ────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 10px; top: 0; bottom: 0;
    width: 2px;
    background: var(--color-border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
    position: absolute;
    left: -23px;
    top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-bg);
}
.timeline-dot.dot-phone   { background: var(--color-primary); }
.timeline-dot.dot-status  { background: var(--color-text-muted); }
.timeline-dot.dot-email   { background: var(--color-accent); }
.timeline-dot.dot-note    { background: var(--color-warning); }
.timeline-meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 3px; }
.timeline-body {
    background: var(--color-bg-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    font-size: 14px;
}

/* ── Stat Cards ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    padding: 20px;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--color-primary); line-height: 1.1; }
.stat-card .stat-label { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
.stat-card.accent .stat-value { color: var(--color-accent-dark); }
.stat-card.success .stat-value { color: var(--color-success); }
.stat-card.danger .stat-value { color: var(--color-danger); }

/* ── Filter Bar ──────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar .form-control { width: auto; }
.filter-search { min-width: 220px; }

/* ── Dialog / Modal ──────────────────────────────────── */
.nxdialog_backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}
.nxdialog {
    position: fixed;
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,61,122,0.18);
    z-index: 201;
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.nxdialog.hidden { display: none; }
.dialog-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dialog-header h3 { font-size: 16px; color: var(--color-primary); }
.dialog-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--color-text-muted); line-height: 1; }
.dialog-body { padding: 20px; }
.dialog-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Contact Person Cards ────────────────────────────── */
.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-card {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.contact-card.primary { border-left: 3px solid var(--color-accent); }
.contact-info { flex: 1; }
.contact-name { font-weight: 600; font-size: 14px; color: var(--color-primary); }
.contact-position { font-size: 13px; color: var(--color-text-muted); }
.contact-details { font-size: 13px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }
.contact-actions { display: flex; gap: 4px; }

/* ── Followup Items ──────────────────────────────────── */
.followup-list { display: flex; flex-direction: column; gap: 8px; }
.followup-item {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.followup-item.overdue { border-left: 3px solid var(--color-danger); }
.followup-item.done    { opacity: 0.55; }
.followup-date { font-weight: 600; font-size: 14px; white-space: nowrap; }
.followup-date.overdue { color: var(--color-danger); }
.followup-notes { font-size: 14px; color: var(--color-text); flex: 1; }
.followup-result { font-size: 13px; color: var(--color-success); margin-top: 4px; }

/* ── Alert / Flash ───────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-danger  { background: #ffebee; color: #b71c1c; border-color: #ef9a9a; }
.alert-success { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }

/* ── Login Page ──────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-light);
}
.login-card {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    padding: 40px;
    width: 380px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-name { font-size: 22px; font-weight: 700; color: var(--color-primary); display: block; }
.login-logo .logo-sub  { font-size: 13px; color: var(--color-text-muted); }

/* ── Misc ────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-sm    { font-size: 13px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.empty-state { text-align: center; padding: 40px; color: var(--color-text-muted); font-size: 14px; }

/* ── Lead detail header ──────────────────────────────── */
.lead-header {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.lead-header-title h2 { font-size: 22px; color: var(--color-primary); font-weight: 700; }
.lead-header-title .lead-meta { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; display: flex; gap: 16px; }
.lead-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Calendar ─────────────────────────────────────────── */
#calendar { background: var(--color-bg); border-radius: var(--radius); }
.fc-event { cursor: pointer; font-size: 12px !important; }
.fc-toolbar-title { color: var(--color-primary) !important; font-size: 16px !important; }
.fc-button-primary {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}
.fc-button-primary:hover { background: var(--color-accent-dark) !important; border-color: var(--color-accent-dark) !important; }
