:root {
    --color-bg: #f5f6f8;
    --color-text: #1f2430;
    --color-border: #d7dbe0;
    --color-primary: #2b5fb8;
    --color-danger: #c0392b;
    --color-success: #2e7d32;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

.topbar-logo {
    height: 44px;
    padding: 0 0.9rem;
    border-radius: 10px;
    background: #15181f;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.app-shell {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid var(--color-border);
    padding: 1.25rem 1rem;
}

.sidebar-brand { margin-bottom: 1.25rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    margin-bottom: 1.1rem;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidebar-user:hover {
    border-color: #c7cdd6;
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}

.sidebar-user.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(43, 95, 184, 0.12);
}

.sidebar-user-email { color: var(--color-primary); }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9aa4b2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg { width: 20px; height: 20px; }

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.78rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.sidebar-link:hover { background: #f1f2f4; }

.sidebar-link.active {
    background: #e8edf7;
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.sidebar-footer form { margin: 0; }

.content {
    flex: 1;
    min-width: 0;
    padding: 1.75rem 2rem;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; margin-top: 2rem; }

.form-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 420px;
    background: #fff;
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.form-box label { font-size: 0.85rem; font-weight: 600; margin-top: 0.5rem; }

.form-box input,
.form-box select,
.form-box textarea {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-box button,
.button {
    margin-top: 1rem;
    padding: 0.55rem 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
}

.button-danger { background: var(--color-danger); }

.inline-form { display: inline; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    padding: 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.92rem;
}

.data-table a { color: var(--color-primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

tr.row-overdue { background: #fdecea; }
tr.row-today { background: #fff8e1; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    background: #e0e0e0;
}

.tag-pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    margin: 0 0.2rem 0.2rem 0;
    border-radius: 999px;
    font-size: 0.78rem;
    background: #eef0f3;
    color: #4b5563;
}

.badge-neu { background: #dbe7ff; }
.badge-in_kontakt { background: #fff3cd; }
.badge-gewonnen { background: #d4edda; }
.badge-verloren { background: #f8d7da; }

.alert {
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error { background: #f8d7da; color: #611a15; }
.alert-success { background: #d4edda; color: #1e4620; }
.alert-info { background: #dbe7ff; color: #1a3566; }

.lead-detail p { margin: 0.25rem 0; }

.notes-list { list-style: none; padding: 0; }
.notes-list li {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
}

.note-meta { font-size: 0.8rem; color: #666; margin-bottom: 0.25rem; }
.note-text { white-space: pre-wrap; }

.actions { margin: 1rem 0; }

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 16px;
    padding: 2.25rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
}

.auth-logo {
    height: 44px;
    padding: 0 0.9rem;
    border-radius: 10px;
    background: #15181f;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

.auth-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.35rem; }
.auth-subtitle { font-size: 0.92rem; color: #6b7280; margin: 0 0 1.5rem; }

.auth-field { margin-bottom: 0.85rem; }

.auth-field input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.auth-field input:focus {
    outline: none;
    border-color: #9aa4b2;
}

.password-field { position: relative; }
.password-field input { padding-right: 2.6rem; }

.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
}

.password-toggle:hover { color: #1f2430; }
.password-toggle svg { width: 18px; height: 18px; display: block; }

.auth-submit {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.75rem;
    background: #15181f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-submit:hover { background: #000; }

.auth-links {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

.auth-links a { color: #15181f; text-decoration: none; font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
