/* RadioButler Vertrieb: gleiche Farbwelt wie radiobutler.com (Orange-Akzent, dunkle Seitenleiste). */
:root {
    --accent: #fe6e01;
    --accent-dark: #d85d00;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --border: #e3e6eb;
    --sidebar: #1b1f2a;
    --sidebar-text: #c9ced8;
    --danger: #c62828;
    --warn-bg: #fff6e5;
    --warn-border: #f5c26b;
    --ok-bg: #e8f6ec;
    --ok-border: #8fd1a2;
    --err-bg: #fdecec;
    --err-border: #f1a5a5;
    --radius: 10px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151c;
        --surface: #1b1f2a;
        --text: #e6e8ee;
        --muted: #9aa1ae;
        --border: #2c3240;
        --sidebar: #0c0e13;
        --warn-bg: #3a2c12;
        --warn-border: #7a5a1e;
        --ok-bg: #143021;
        --ok-border: #2d6b45;
        --err-bg: #3a1717;
        --err-border: #7a2d2d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

body.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 1.2rem; color: #fff; }
.brand span { color: var(--accent); }
.brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--sidebar-text); letter-spacing: .08em; text-transform: uppercase; }
.brand-large { font-size: 1.6rem; color: var(--text); text-align: center; margin-bottom: 1rem; }
.brand-large small { color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { color: var(--sidebar-text); padding: .5rem .7rem; border-radius: 8px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.nav-section { margin-top: 1rem; padding: 0 .7rem; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }
.sidebar-user { font-size: .85rem; display: flex; flex-direction: column; gap: .2rem; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1rem; }
.sidebar-user div { color: #fff; font-weight: 600; }
.sidebar-user a, .sidebar-user .link { color: var(--sidebar-text); }

.content { padding: 1.6rem 2rem; max-width: 1300px; width: 100%; }
body.public .content { max-width: 420px; margin: 8vh auto; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-header p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.card.narrow { max-width: 460px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-header h2 { margin: 0; }
.table-card { padding: 0; overflow-x: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.grid-2 > .card { margin-bottom: 1.2rem; }
.grid-detail { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-alert { border-color: var(--accent); }
.stat-alert .stat-value { color: var(--accent); }

.pipeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; margin-bottom: 1.2rem; }
.pipeline-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem; display: flex; justify-content: space-between; align-items: center; color: var(--text); }
.pipeline-step strong { font-size: 1.3rem; }

.list, .feed { list-style: none; margin: 0; padding: 0; }
.list li, .feed li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child, .feed li:last-child { border-bottom: 0; }
.feed-meta { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.feed-text { white-space: pre-line; margin-top: .2rem; }
.description { white-space: pre-line; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.empty { color: var(--muted); font-style: italic; margin: .3rem 0; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--border); color: var(--text); white-space: nowrap; vertical-align: middle; }
.status-neu { background: #e3ecfb; color: #1f4f9c; }
.status-kontaktiert { background: #e9e4fb; color: #4b2f9c; }
.status-interessiert { background: #fff0d9; color: #8a4b00; }
.status-angebot { background: #ffe1c7; color: #a24400; }
.status-gewonnen { background: #dcf3e3; color: #1d6b37; }
.status-verloren { background: #eceef1; color: #5f6672; }
.kind-anruf, .kind-email, .kind-termin, .kind-notiz { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.due { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .45rem; border-radius: 6px; margin-right: .3rem; }
.due-overdue { background: var(--err-bg); color: var(--danger); }
.due-today { background: var(--warn-bg); color: #a24400; }
.due-later { background: var(--border); color: var(--muted); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tr.inactive { opacity: .55; }
.table tr.selected td { background: var(--warn-bg); }
.table input:not([type=checkbox]) { width: 100%; min-width: 120px; }

.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .8rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; padding: .8rem; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.inline-form { display: flex; gap: .4rem; }
form.inline { display: inline; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: var(--err-border); }
.btn-small { padding: .3rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.actions { display: flex; gap: .6rem; margin-top: .4rem; }
.danger-zone { text-align: right; margin-bottom: 1.2rem; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented a { padding: .35rem .8rem; color: var(--text); font-size: .9rem; }
.segmented a.active { background: var(--accent); color: #fff; }
.segmented a:hover { text-decoration: none; }

.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert ul { margin: .4rem 0; }
.alert-success { background: var(--ok-bg); border-color: var(--ok-border); }
.alert-error { background: var(--err-bg); border-color: var(--err-border); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.validation:empty, .validation.validation-summary-valid { display: none; }
.validation ul { margin: 0; padding-left: 1.1rem; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.login-card { padding: 2rem; }

@media (max-width: 900px) {
    body.app { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .8rem 1rem; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
    .sidebar .nav-section { display: none; }
    .sidebar-user { flex-direction: row; gap: .8rem; border: 0; padding: 0; align-items: center; }
    .content { padding: 1rem; }
    .grid-2, .grid-detail { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .pipeline { grid-template-columns: repeat(3, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
}
