:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --card-strong: #111827;
    --text: #101828;
    --muted: #667085;
    --line: #e4e7ec;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success-bg: #ecfdf3;
    --success-text: #027a48;
    --warning-bg: #fffaeb;
    --warning-text: #b54708;
    --shadow: 0 14px 40px rgba(16, 24, 40, 0.08);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34rem),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(100%, 720px);
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 14px 18px;
    backdrop-filter: blur(18px);
    background: rgba(244, 246, 251, 0.82);
    border-bottom: 1px solid rgba(228, 231, 236, 0.8);
}

.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #111827, #2563eb);
    box-shadow: var(--shadow);
}

.content {
    padding: 18px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.flash {
    padding: 12px 14px;
    border-radius: 16px;
    font-weight: 650;
    border: 1px solid var(--line);
    background: var(--card);
}

.flash-success {
    color: var(--success-text);
    background: var(--success-bg);
}

.flash-danger {
    color: #b42318;
    background: #fef3f2;
}

.flash-warning {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.login-card {
    display: grid;
    gap: 16px;
    width: 100%;
    max-width: 430px;
    margin: 12vh auto 0;
    padding: 28px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    border: 1px solid rgba(228, 231, 236, 0.9);
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    color: #ffffff;
    font-weight: 900;
    background: linear-gradient(135deg, #111827, #2563eb);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: clamp(2rem, 9vw, 3.2rem);
    line-height: 0.95;
    letter-spacing: -0.07em;
}

h2 {
    margin-bottom: 10px;
    font-size: 1.16rem;
    letter-spacing: -0.03em;
}

h3 {
    margin-bottom: 6px;
}

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

.eyebrow {
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.page-head,
.detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head.compact {
    margin-bottom: 14px;
}

.circle-action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    font-weight: 500;
    background: var(--primary);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.search-bar input {
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 12px 10px;
    background: transparent;
}

.search-bar button {
    border: 0;
    border-radius: 14px;
    padding: 0 14px;
    color: #ffffff;
    font-weight: 800;
    background: var(--card-strong);
}

.filter-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 22px;
    background: var(--card);
    box-shadow: var(--shadow);
    border: 1px solid rgba(228, 231, 236, 0.96);
}

.compact-stack {
    gap: 7px;
}

.filter-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
}

.status-uninteressiert {
    color: #b42318;
    background: #fef3f2;
    border-color: #fecaca;
}

.status-unbekannt {
    color: #475467;
    background: #f2f4f7;
    border-color: #e4e7ec;
}

.status-interessiert {
    color: #175cd3;
    background: #eff8ff;
    border-color: #b2ddff;
}

.status-kunde {
    color: #027a48;
    background: #ecfdf3;
    border-color: #abefc6;
}

.card-list {
    display: grid;
    gap: 12px;
}

.customer-card,
.panel,
.note-card,
.empty-state {
    border: 1px solid rgba(228, 231, 236, 0.96);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.customer-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.customer-card:active {
    transform: scale(0.985);
    border-color: var(--primary);
}

.customer-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.customer-main h2 {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.customer-number {
    flex: 0 0 auto;
    align-self: flex-start;
    padding: 6px 8px;
    border-radius: 999px;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 850;
    background: rgba(37, 99, 235, 0.09);
}

.customer-meta {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-stack label {
    color: #344054;
    font-size: 0.92rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 14px;
    color: var(--text);
    background: #ffffff;
    outline: none;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #667085 50%),
        linear-gradient(135deg, #667085 50%, transparent 50%);
    background-position:
        calc(100% - 21px) 50%,
        calc(100% - 15px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 42px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.panel {
    padding: 16px;
    margin-bottom: 14px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 0;
    border-radius: 16px;
    padding: 0 16px;
    font-weight: 850;
}

.primary-button {
    color: #ffffff;
    background: var(--primary);
}

.primary-button:active {
    background: var(--primary-dark);
}

.secondary-button {
    color: #111827;
    background: #eef2ff;
}

.secondary-button.small {
    min-height: 42px;
    border-radius: 14px;
    white-space: nowrap;
}

.ghost-button {
    min-height: 42px;
    color: #344054;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--line);
}

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

.full {
    width: 100%;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sticky-actions {
    position: sticky;
    bottom: max(14px, env(safe-area-inset-bottom));
    margin-top: 8px;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.readonly-box {
    display: grid;
    gap: 5px;
    padding: 14px;
    border-radius: 16px;
    background: #f9fafb;
    border: 1px solid var(--line);
}

.readonly-box span,
.info-grid span,
.note-footer time {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.detail-hero {
    margin-bottom: 14px;
}

.back-link {
    display: inline-flex;
    margin-bottom: 16px;
    color: var(--muted);
    font-weight: 800;
}

.info-grid {
    display: grid;
    gap: 14px;
}

.info-grid div {
    display: grid;
    gap: 4px;
}

.info-grid strong {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.danger-panel {
    background: var(--danger-bg);
    border-color: #fecaca;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 12px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading span {
    min-width: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    text-align: center;
    color: var(--primary);
    font-weight: 900;
    background: rgba(37, 99, 235, 0.09);
}

.note-list {
    display: grid;
    gap: 12px;
}

.note-card {
    padding: 15px;
}

.note-card p {
    margin-bottom: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.text-danger {
    border: 0;
    color: var(--danger);
    font-weight: 850;
    background: transparent;
}

.empty-state {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 24px;
}

.empty-state p {
    margin-bottom: 6px;
    color: var(--muted);
}

.small-empty {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 420px) {
    .content {
        padding: 14px;
    }

    .login-card {
        margin-top: 8vh;
        padding: 22px;
        border-radius: 26px;
    }

    .search-bar,
    .filter-actions {
        grid-template-columns: 1fr;
    }

    .search-bar button {
        min-height: 44px;
    }

    .detail-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-button.small {
        width: 100%;
    }
}
