:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-900);
    color: white;
    padding: 0 1.5rem;
    height: 56px;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: 0.5rem; }
.nav-link {
    color: var(--gray-300);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
}
.card-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.card-value {
    font-size: 2rem;
    font-weight: 700;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}
th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-neu { background: #dbeafe; color: #1e40af; }
.badge-kontaktiert { background: #fef3c7; color: #92400e; }
.badge-interesse { background: #fef9c3; color: #854d0e; }
.badge-vorlaeufiges_angebot { background: #ffedd5; color: #9a3412; }
.badge-termin_vereinbart { background: #e0e7ff; color: #3730a3; }
.badge-techniker_termin { background: #ede9fe; color: #5b21b6; }
.badge-angebot_erstellt { background: #fce7f3; color: #9d174d; }
.badge-gewonnen { background: #dcfce7; color: #166534; }
.badge-verloren { background: #fee2e2; color: #991b1b; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    transition: all 0.15s;
}
.btn:hover { background: var(--gray-100); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }

/* Login */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-100);
}
.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 380px;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.error-msg { background: #fee2e2; color: #991b1b; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }

/* Pipeline Kanban */
.pipeline-board {
    display: grid;
    grid-template-columns: repeat(9, minmax(180px, 1fr));
    gap: 0.75rem;
    overflow-x: auto;
}
.pipeline-column {
    background: var(--gray-100);
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 180px;
}
.pipeline-column-header {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pipeline-column-count {
    background: var(--gray-300);
    color: var(--gray-700);
    padding: 0.1rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
}
.pipeline-card {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--gray-200);
    cursor: grab;
    font-size: 0.85rem;
}
.pipeline-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.pipeline-card .firm { font-weight: 600; }
.pipeline-card .contact { color: var(--gray-500); font-size: 0.8rem; }

/* Detail page */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.detail-section { margin-bottom: 1.5rem; }
.detail-section h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.detail-row { display: flex; padding: 0.4rem 0; border-bottom: 1px solid var(--gray-100); }
.detail-label { width: 160px; font-weight: 500; color: var(--gray-500); font-size: 0.9rem; }
.detail-value { flex: 1; font-size: 0.9rem; }

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
}
.activity-type { font-weight: 600; min-width: 120px; }
.activity-date { color: var(--gray-500); min-width: 140px; }

/* Section titles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }

/* Filter tabs */
.filter-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-tab {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.filter-tab:hover { background: var(--gray-100); }
.filter-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
    .pipeline-board { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar { flex-wrap: wrap; height: auto; padding: 0.75rem; gap: 0.5rem; }
}
