:root {
    --bg: #0b0d10;
    --surface: #12151a;
    --surface-2: #181c23;
    --border: #262b34;
    --text: #e8eaed;
    --text-muted: #8b93a1;
    --accent: #34d399;
    --accent-dim: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, 0.12);
    --radius: 8px;
}

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

html {
    background: var(--bg);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

.container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

h1 {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 2px;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 550;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 9px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #08110d;
}

.btn-primary:hover {
    background: #4ade9f;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #1f242d;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12.5px;
    border-radius: 6px;
}

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

.btn-danger:hover {
    color: var(--danger);
    background: var(--danger-dim);
    border-color: rgba(248, 113, 113, 0.3);
}

.btn-danger-solid {
    background: var(--danger);
    color: #190808;
}

.btn-danger-solid:hover {
    background: #fb8f8f;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-accent {
    color: var(--accent);
}

.revenue-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.revenue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.revenue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.revenue-heading {
    color: var(--text-muted);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.revenue-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.revenue-row:last-child {
    border-bottom: none;
}

.revenue-row span {
    color: var(--text-muted);
}

.revenue-row strong {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.toolbar {
    margin-bottom: 14px;
}

.toolbar-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.input {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s ease;
}

.input:focus {
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--text-muted);
}

select.input {
    cursor: pointer;
}

.search-input {
    flex: 1;
    min-width: 220px;
}

.table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1080px;
}

.leads-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.leads-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}

.leads-table tbody tr:last-child td {
    border-bottom: none;
}

.leads-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.sort-link {
    color: inherit;
    text-decoration: none;
}

.sort-link:hover {
    color: var(--text);
}

.cell-strong {
    font-weight: 600;
}

.cell-muted {
    color: var(--text-muted);
}

.cell-revenue {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.table-link {
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
}

.table-link:hover {
    color: var(--accent);
}

.reason-other {
    color: var(--text-muted);
    font-size: 12.5px;
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 14px !important;
}

.status-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 550;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
}

.badge-neu {
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.1);
    border-color: rgba(147, 197, 253, 0.25);
}

.badge-kontaktiert {
    color: #fcd34d;
    background: rgba(252, 211, 77, 0.08);
    border-color: rgba(252, 211, 77, 0.22);
}

.badge-gesprach {
    color: #c4b5fd;
    background: rgba(196, 181, 253, 0.08);
    border-color: rgba(196, 181, 253, 0.22);
}

.badge-angebot {
    color: #fdba74;
    background: rgba(253, 186, 116, 0.08);
    border-color: rgba(253, 186, 116, 0.22);
}

.badge-erfolgreich {
    color: var(--accent);
    background: var(--accent-dim);
    border-color: rgba(52, 211, 153, 0.3);
}

.badge-verloren {
    color: var(--danger);
    background: var(--danger-dim);
    border-color: rgba(248, 113, 113, 0.25);
}

.status-select {
    font: inherit;
    font-size: 12.5px;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 6px;
    cursor: pointer;
    outline: none;
}

.status-select:focus {
    border-color: var(--accent);
}

.actions-cell {
    display: flex;
    gap: 6px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 8, 0.72);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px;
    overflow-y: auto;
    z-index: 50;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    width: 100%;
    max-width: 560px;
}

.modal-sm {
    max-width: 400px;
}

.modal h2 {
    margin-bottom: 16px;
}

.modal-text {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.form-field label {
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-muted);
}

.form-error {
    color: var(--danger);
    margin-top: 14px;
    font-size: 13px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

#product-modal-select {
    width: 100%;
}

@media (max-width: 720px) {
    .revenue-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
