/* RG Vertrieb Dashboard – Corporate Design */
:root {
    --rg-navy: #1a3a5c;
    --rg-red: #D0101C;
    --rg-light: #f2f7fc;
    --rg-green: #28a745;
    --rg-yellow: #ffc107;
    --rg-orange: #fd7e14;
    --rg-gray: #6c757d;
    --rg-white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--rg-light);
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Header ── */
.navbar {
    background: var(--rg-navy);
    color: white;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar h1 { font-size: 18px; font-weight: 600; }
.navbar a { color: rgba(255,255,255,0.8); text-decoration: none; margin-left: 16px; }
.navbar a:hover { color: white; }
.navbar .user-info { font-size: 13px; }

/* ── Cards ── */
.container { max-width: 1400px; margin: 0 auto; padding: 16px 24px; }

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.summary-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.summary-card .value { font-size: 28px; font-weight: 700; color: var(--rg-navy); }
.summary-card .label { font-size: 12px; color: var(--rg-gray); text-transform: uppercase; }
.summary-card .delta { font-size: 13px; font-weight: 600; }
.delta.positive { color: var(--rg-green); }
.delta.negative { color: var(--rg-red); }

/* ── Alerts ── */
.alert-bar { margin-bottom: 16px; }
.alert {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.alert a { text-decoration: none; color: inherit; }
.alert-red { background: #fde8e8; border-left: 4px solid var(--rg-red); color: #721c24; }
.alert-yellow { background: #fff8e1; border-left: 4px solid var(--rg-yellow); color: #856404; }
.alert-success { background: #d4edda; border-left: 4px solid var(--rg-green); color: #155724; padding: 10px 16px; border-radius: 6px; margin: 8px 0; }
.alert-danger { background: #fde8e8; border-left: 4px solid var(--rg-red); color: #721c24; padding: 10px 16px; border-radius: 6px; margin: 8px 0; }
.alert-info { background: #d1ecf1; border-left: 4px solid #17a2b8; color: #0c5460; padding: 10px 16px; border-radius: 6px; margin: 8px 0; }

/* ── Event Table ── */
.events-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.events-table th {
    background: var(--rg-navy);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}
.events-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
.events-table tr:hover { background: var(--rg-light); }
.events-table tr { cursor: pointer; }
.events-table tr.alert-row-red { border-left: 4px solid var(--rg-red); }
.events-table tr.alert-row-yellow { border-left: 4px solid var(--rg-yellow); }

/* Coverage bar */
.coverage-bar {
    width: 100px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.coverage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.coverage-fill.green { background: var(--rg-green); }
.coverage-fill.yellow { background: var(--rg-yellow); }
.coverage-fill.red { background: var(--rg-red); }

/* ── Kanban Board ── */
.kanban-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 16px 0;
}
.kanban-column {
    background: var(--rg-light);
    border-radius: 8px;
    padding: 12px;
    min-height: 200px;
}
.kanban-header {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    display: flex;
    justify-content: space-between;
}
.col-open .kanban-header { border-color: var(--rg-gray); color: var(--rg-gray); }
.col-contacted .kanban-header { border-color: #17a2b8; color: #17a2b8; }
.col-offer .kanban-header { border-color: var(--rg-orange); color: var(--rg-orange); }
.col-won .kanban-header { border-color: var(--rg-green); color: var(--rg-green); }

.vc-card {
    background: white;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: box-shadow 0.2s;
    border-left: 3px solid transparent;
}
.vc-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.vc-card.stale { border-left-color: var(--rg-red); }
.vc-card .firm { font-weight: 600; font-size: 13px; }
.vc-card .value { color: var(--rg-navy); font-weight: 600; }
.vc-card .bucht-wegen { font-size: 11px; color: var(--rg-gray); font-style: italic; }
.vc-card .stale-badge { font-size: 11px; color: var(--rg-red); }
.vc-card .score-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
}
.score-high { background: var(--rg-green); }
.score-mid { background: var(--rg-yellow); color: #333 !important; }
.score-low { background: var(--rg-red); }

/* Lost counter */
.lost-counter {
    background: #f8d7da;
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    font-size: 13px;
    color: #721c24;
    margin-top: 12px;
}

/* ── Event Header ── */
.event-header {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.event-header h2 { color: var(--rg-navy); margin-bottom: 4px; }
.event-meta { color: var(--rg-gray); font-size: 13px; }
.event-meta span { margin-right: 16px; }
.l4l-badge { font-size: 14px; font-weight: 600; }

/* ── Detail Panel ── */
.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 16px rgba(0,0,0,0.15);
    z-index: 200;
    overflow-y: auto;
    padding: 20px;
}
.detail-panel .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--rg-gray);
}
.detail-panel h3 { color: var(--rg-navy); margin-bottom: 12px; }
.detail-panel .field { margin-bottom: 8px; }
.detail-panel .field-label { font-size: 11px; color: var(--rg-gray); text-transform: uppercase; }
.detail-panel .field-value { font-size: 14px; }

.timeline { margin-top: 16px; }
.timeline-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}
.timeline-date { color: var(--rg-gray); font-size: 11px; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--rg-navy); color: white; }
.btn-danger { background: var(--rg-red); color: white; }
.btn-success { background: var(--rg-green); color: white; }
.btn-outline { background: white; border: 1px solid var(--rg-navy); color: var(--rg-navy); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Forms ── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--rg-gray); margin-bottom: 4px; text-transform: uppercase; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-group textarea { min-height: 200px; resize: vertical; }

/* ── Login ── */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.login-container h2 { color: var(--rg-navy); margin-bottom: 24px; }
.login-container .btn { width: 100%; margin-top: 8px; }
.login-error { color: var(--rg-red); font-size: 13px; margin-bottom: 12px; }

/* ── Section headers ── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 12px;
}
.section-header h3 { color: var(--rg-navy); font-size: 15px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .kanban-container { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
    .detail-panel { width: 100%; }
}
