/* CSB Dashboard – Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f0f2f5;
    --white: #ffffff;
    --primary: #1565c0;
    --primary-dark: #0d47a1;
    --text: #1a1a2e;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --angelegt: #78909c;
    --disponiert: #1976d2;
    --verwiegt: #ef6c00;
    --abgerechnet: #2e7d32;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--primary);
    color: #fff;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 56px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.kw-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-btn-heute {
    background: rgba(255, 255, 255, 0.25);
    font-size: 13px;
}

.kw-label {
    font-size: 16px;
    font-weight: 700;
    min-width: 120px;
    text-align: center;
}

.datum-bereich {
    font-size: 13px;
    opacity: 0.85;
    margin-left: auto;
}

/* Summary Cards */
.summary {
    max-width: 1440px;
    margin: 20px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.card-value-green {
    color: var(--abgerechnet);
}

.card-value-orange {
    color: var(--verwiegt);
}

.card-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 15px;
}

.error {
    max-width: 1440px;
    margin: 20px auto;
    padding: 16px 24px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    color: #991b1b;
}

/* Tage-Container */
.tage-container {
    max-width: 1440px;
    margin: 0 auto 40px;
    padding: 0 24px;
}

/* Tag-Sektion */
.tag-section {
    margin-bottom: 16px;
}

.tag-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    cursor: pointer;
    user-select: none;
    border-left: 4px solid var(--primary);
    transition: background 0.15s;
}

.tag-header:hover {
    background: #f8f9fa;
}

.tag-header.collapsed {
    border-radius: var(--radius);
}

.tag-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.tag-header.collapsed .tag-arrow {
    transform: rotate(-90deg);
}

.tag-title {
    font-weight: 700;
    font-size: 15px;
}

.tag-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.tag-stats {
    margin-left: auto;
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-stat-value {
    font-weight: 600;
    color: var(--text);
}

/* Tabelle */
.tag-body {
    overflow-x: auto;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: var(--shadow);
    font-size: 13px;
}

.order-table thead {
    background: #f8f9fa;
}

.order-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.order-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.order-table tr {
    cursor: pointer;
    transition: background 0.1s;
}

.order-table tbody tr:hover {
    background: #e8f0fe;
}

.order-table tr:last-child td {
    border-bottom: none;
}

.order-table .col-right {
    text-align: right;
}

/* Status-Badge */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-angelegt {
    background: #eceff1;
    color: var(--angelegt);
}

.status-disponiert {
    background: #e3f2fd;
    color: var(--disponiert);
}

.status-verwiegt {
    background: #fff3e0;
    color: var(--verwiegt);
}

.status-abgerechnet {
    background: #e8f5e9;
    color: var(--abgerechnet);
}

/* Verlaufs-Indikator */
.verlauf {
    display: flex;
    align-items: center;
    gap: 3px;
}

.verlauf-step {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e0e0e0;
}

.verlauf-step.active {
    background: var(--primary);
}

.verlauf-step.step-angelegt.active { background: var(--angelegt); }
.verlauf-step.step-disponiert.active { background: var(--disponiert); }
.verlauf-step.step-verwiegt.active { background: var(--verwiegt); }
.verlauf-step.step-abgerechnet.active { background: var(--abgerechnet); }

.verlauf-line {
    width: 6px;
    height: 2px;
    background: #e0e0e0;
}

.verlauf-line.active {
    background: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.pos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pos-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    background: #f8f9fa;
}

.pos-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.pos-table .col-right {
    text-align: right;
}

/* Kein-Daten */
.keine-daten {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.keine-daten-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

    .datum-bereich {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    .summary {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 12px;
    }

    .tage-container {
        padding: 0 12px;
    }

    .tag-stats {
        display: none;
    }
}
