/* ============================================================
   Bestform Cockpit — Design System
   Farbpalette: Navy/Gold (CI Bestform)
   ============================================================ */

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    background: #0c1220;
    color: #e0e0e0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
}

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

ul {
    list-style: none;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: #0a0f1a;
    border-right: 1px solid #1a2540;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid #1a2540;
    flex-shrink: 0;
}

.logo-mark {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #c9a227;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.logo-sub {
    display: block;
    font-size: 9px;
    color: #556;
    letter-spacing: 3px;
    margin-top: 3px;
}

/* --- Navigation -------------------------------------------- */
.nav-list {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    margin: 1px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #778;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.nav-link:hover {
    background: #111827;
    color: #c0c8d8;
}

.nav-item.active .nav-link {
    background: #111827;
    color: #c9a227;
    border-left-color: #c9a227;
}

.nav-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13px;
    font-weight: 500;
}

/* --- Sidebar User ------------------------------------------ */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid #1a2540;
    flex-shrink: 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: #1a2540;
    border: 1px solid #c9a227;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #c9a227;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: #c0c8d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: #556;
    margin-top: 1px;
}

.logout-btn {
    font-size: 16px;
    color: #556;
    flex-shrink: 0;
    transition: color 0.15s;
    padding: 4px;
}

.logout-btn:hover {
    color: #e74c3c;
}

/* --- Main Content ------------------------------------------ */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 24px 28px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Flash Messages ---------------------------------------- */
.flash {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid;
}

.flash-error {
    background: rgba(231, 76, 60, 0.12);
    border-color: #e74c3c;
    color: #f08070;
}

.flash-success {
    background: rgba(46, 204, 113, 0.12);
    border-color: #2ecc71;
    color: #70e0a0;
}

.flash-warning {
    background: rgba(243, 156, 18, 0.12);
    border-color: #f39c12;
    color: #f0b050;
}

.flash-info {
    background: rgba(52, 152, 219, 0.12);
    border-color: #3498db;
    color: #70b8e8;
}

/* --- Cards ------------------------------------------------- */
.card {
    background: #111827;
    border: 1px solid #1a2540;
    border-radius: 10px;
    padding: 18px;
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    color: #556;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

/* --- KPI / Ampel Cards ------------------------------------- */
.ampel-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.ampel-card {
    background: #111827;
    border: 1px solid #1a2540;
    border-radius: 10px;
    padding: 16px 18px;
}

.ampel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ampel-label {
    font-size: 11px;
    color: #556;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ampel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green  { background: #2ecc71; box-shadow: 0 0 6px rgba(46,204,113,0.5); }
.dot-yellow { background: #f39c12; box-shadow: 0 0 6px rgba(243,156,18,0.5); }
.dot-red    { background: #e74c3c; box-shadow: 0 0 6px rgba(231,76,60,0.5); }

.ampel-value {
    font-size: 22px;
    font-weight: 700;
    color: #e0e0e0;
    line-height: 1.2;
}

.ampel-meta {
    font-size: 11px;
    color: #556;
    margin-top: 4px;
}

/* --- Two-column grid --------------------------------------- */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* --- Charts ----------------------------------------------- */
.bar-chart {
    position: relative;
    height: 200px;
    margin-top: 8px;
}

/* --- Alert List -------------------------------------------- */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #0c1220;
    border-radius: 6px;
    border-left: 3px solid transparent;
    font-size: 12px;
}

.alert-item.critical { border-color: #e74c3c; }
.alert-item.warning  { border-color: #f39c12; }
.alert-item.info     { border-color: #3498db; }

.alert-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-text { flex: 1; }
.alert-title { font-weight: 600; color: #c0c8d8; margin-bottom: 2px; }
.alert-desc  { color: #778; font-size: 11px; }

/* --- Kunde rows -------------------------------------------- */
.kunde-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #1a2540;
}

.kunde-row:last-child { border-bottom: none; }

.kunde-name {
    width: 140px;
    font-size: 12px;
    color: #c0c8d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.kunde-bar-wrap {
    flex: 1;
    height: 6px;
    background: #1a2540;
    border-radius: 3px;
    overflow: hidden;
}

.kunde-bar {
    height: 100%;
    background: #c9a227;
    border-radius: 3px;
    transition: width 0.3s;
}

.kunde-value {
    font-size: 12px;
    color: #e0e0e0;
    font-weight: 600;
    width: 70px;
    text-align: right;
    flex-shrink: 0;
}

.kunde-pct {
    font-size: 11px;
    color: #556;
    width: 38px;
    text-align: right;
    flex-shrink: 0;
}

/* --- Posten rows ------------------------------------------- */
.posten-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #1a2540;
    font-size: 12px;
}

.posten-row:last-child { border-bottom: none; }

.posten-label { color: #c0c8d8; }
.posten-value { color: #e0e0e0; font-weight: 600; }
.posten-value.negative { color: #e74c3c; }
.posten-value.positive { color: #2ecc71; }

/* --- Bericht cards ----------------------------------------- */
.bericht-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.bericht-card {
    background: #111827;
    border: 1px solid #1a2540;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.bericht-card:hover {
    border-color: #c9a227;
    transform: translateY(-2px);
}

.bericht-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.bericht-title {
    font-size: 13px;
    font-weight: 600;
    color: #c0c8d8;
    margin-bottom: 4px;
}

.bericht-desc {
    font-size: 11px;
    color: #556;
}

/* --- Buttons ----------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, transform 0.1s;
}

.btn:hover   { opacity: 0.88; }
.btn:active  { transform: scale(0.97); }

.btn-primary {
    background: #c9a227;
    color: #0c1220;
}

.btn-secondary {
    background: #1a2540;
    color: #c0c8d8;
    border: 1px solid #2a3560;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* --- Forms ------------------------------------------------- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #778;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: #0c1220;
    border: 1px solid #1a2540;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}

.form-input:focus {
    border-color: #c9a227;
}

.form-input::placeholder {
    color: #445;
}

/* --- Page Header ------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #e0e0e0;
}

.page-subtitle {
    font-size: 12px;
    color: #556;
    margin-top: 2px;
}

/* --- Tables ----------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table th {
    padding: 8px 12px;
    text-align: left;
    color: #556;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #1a2540;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #111827;
    color: #c0c8d8;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(26,37,64,0.4);
}

/* --- Badges ----------------------------------------------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-green  { background: rgba(46,204,113,0.15); color: #2ecc71; }
.badge-yellow { background: rgba(243,156,18,0.15);  color: #f39c12; }
.badge-red    { background: rgba(231,76,60,0.15);   color: #e74c3c; }
.badge-blue   { background: rgba(52,152,219,0.15);  color: #3498db; }
.badge-gray   { background: rgba(100,100,120,0.2);  color: #778; }

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a0f1a; }
::-webkit-scrollbar-thumb { background: #1a2540; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a3560; }

/* --- Login Page -------------------------------------------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0c1220;
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 24px;
}

.login-card {
    background: #111827;
    border: 1px solid #1a2540;
    border-radius: 12px;
    padding: 36px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    font-size: 22px;
    font-weight: 700;
    color: #c9a227;
    letter-spacing: 1px;
}

.login-subtitle {
    font-size: 10px;
    color: #556;
    letter-spacing: 4px;
    margin-top: 4px;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 900px) {
    .ampel-row   { grid-template-columns: repeat(2, 1fr); }
    .bericht-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .sidebar {
        width: 60px;
    }
    .logo-mark, .logo-sub, .nav-label, .user-info, .logout-btn {
        display: none;
    }
    .main-content {
        margin-left: 60px;
        padding: 16px;
    }
    .ampel-row   { grid-template-columns: 1fr 1fr; }
    .grid-2      { grid-template-columns: 1fr; }
    .bericht-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Reports — Berichts-Seiten
   ============================================================ */

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.report-card {
    background: #111827;
    border: 1px solid #1a2540;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .2s;
}

.report-card:hover { border-color: #c9a84c; }
.report-card-icon { font-size: 2rem; }
.report-card-title { font-weight: 700; font-size: 1rem; color: #f0f0f0; }
.report-card-desc { font-size: 0.8rem; color: #888; flex: 1; }

/* Report-Aktionsleiste */
.report-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.email-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
}

.email-form.hidden { display: none; }

.status-text { font-size: 0.85rem; }
.status-ok    { color: #16a34a; }
.status-error { color: #dc2626; }

/* Tabellen für Reports */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 8px;
}

.data-table thead th {
    background: #0a0f1a;
    color: #c9a84c;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #1a2540;
}

.data-table thead th.text-right { text-align: right; }

.data-table tbody tr { border-bottom: 1px solid #1a2540; }
.data-table tbody tr:hover { background: rgba(201, 168, 76, 0.05); }
.data-table tbody td { padding: 7px 12px; }
.data-table tbody td.text-right { text-align: right; }

.data-table tfoot td {
    padding: 8px 12px;
    border-top: 2px solid #1a2540;
}
.data-table tfoot td.text-right { text-align: right; }
.total-row td { font-weight: 700; }

.top5-row { background: rgba(201, 168, 76, 0.07) !important; }

/* Mini-Balken */
.mini-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}
.mini-bar-fill {
    height: 8px;
    background: #c9a84c;
    border-radius: 3px;
    min-width: 3px;
    transition: width .3s;
}
.mini-bar span { font-size: 0.75rem; color: #888; white-space: nowrap; }

/* SWOT */
.swot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.swot-cell {
    padding: 12px 14px;
    border-radius: 6px;
    border: 1px solid #1a2540;
}

.swot-cell h3 { font-size: 0.85rem; margin-bottom: 6px; }
.swot-cell ul { padding-left: 16px; font-size: 0.8rem; color: #ccc; }
.swot-cell li { margin-bottom: 4px; }

.swot-strengths     { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.3); }
.swot-strengths h3  { color: #4ade80; }
.swot-weaknesses    { background: rgba(234, 88, 12, 0.08); border-color: rgba(234, 88, 12, 0.3); }
.swot-weaknesses h3 { color: #fb923c; }
.swot-opportunities { background: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.3); }
.swot-opportunities h3 { color: #60a5fa; }
.swot-threats       { background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.3); }
.swot-threats h3    { color: #f87171; }

/* Empfehlungen */
.recommendations-list { display: flex; flex-direction: column; gap: 8px; }
.recommendation {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 4px solid #555;
    background: #111827;
}
.priority-hoch   { border-left-color: #dc2626; }
.priority-mittel { border-left-color: #d97706; }
.priority-info   { border-left-color: #2563eb; }
.rec-priority {
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 44px;
    padding-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.priority-hoch   .rec-priority { color: #f87171; }
.priority-mittel .rec-priority { color: #fbbf24; }
.priority-info   .rec-priority { color: #60a5fa; }
.rec-content strong { font-size: 0.9rem; color: #f0f0f0; }
.rec-content p      { font-size: 0.8rem; color: #888; margin-top: 3px; }

/* KPI-Karten groß */
.kpi-card-large { padding: 16px 18px; }
.kpi-value-xl   { font-size: 1.6rem; }

/* Abschnitte */
.section-note { font-size: 0.75rem; color: #666; margin-top: 6px; }
.empty-state  { color: #555; font-style: italic; padding: 12px 0; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-paid       { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.badge-open       { background: rgba(201, 168, 76, 0.2); color: #c9a84c; }
.badge-overdue    { background: rgba(220, 38, 38, 0.2); color: #f87171; }
.badge-cancelled  { background: rgba(100, 100, 100, 0.2); color: #888; }

/* ============================================================
   Kunden-Modul — Erweiterungen
   ============================================================ */

/* Klickbare Tabellenzeile */
.clickable-row {
    cursor: pointer;
    transition: background 0.12s;
}
.clickable-row:hover td {
    background: rgba(201, 162, 39, 0.07) !important;
}

/* Checkbox-Label in Filterleiste */
.filter-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #778;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.filter-check input[type="checkbox"] {
    accent-color: #c9a227;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0;
    margin-top: 8px;
    border-top: 1px solid #1a2540;
    flex-wrap: wrap;
    gap: 8px;
}
.pagination-info {
    font-size: 11px;
    color: #556;
}
.pagination-btn {
    background: #1a2540;
    border: 1px solid #2a3560;
    color: #c0c8d8;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.pagination-btn:hover {
    background: #2a3560;
    border-color: #c9a227;
}
.pagination-btn.active {
    background: #c9a227;
    border-color: #c9a227;
    color: #0c1220;
    font-weight: 700;
}

/* Sortierbare Spalten-Header */
.sortable {
    cursor: pointer;
}

.sortable:hover {
    color: #c9a227;
}

.sort-hint {
    font-size: 10px;
    color: #556;
    margin-left: 2px;
}

.sortable:hover .sort-hint {
    color: #c9a227;
}

.sort-active {
    font-size: 10px;
    color: #c9a227;
    margin-left: 2px;
}

/* Trend-Karten (Dossier rechte Spalte) */
.trend-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.trend-card {
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid #2a3560;
    background: #111827;
    border: 1px solid #1a2540;
    border-left-width: 4px;
}
.trend-green  { border-left-color: #2ecc71 !important; }
.trend-yellow { border-left-color: #f39c12 !important; }
.trend-red    { border-left-color: #e74c3c !important; }

.trend-label {
    font-size: 10px;
    font-weight: 600;
    color: #556;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}
.trend-value {
    font-size: 15px;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 2px;
}
.trend-detail {
    font-size: 11px;
    color: #778;
}

/* Formular: Zweispaltige Zeile */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Generisches Input / Select / Textarea (Kunden-Edit) */
.input {
    width: 100%;
    padding: 10px 12px;
    background: #0c1220;
    border: 1px solid #1a2540;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}
.input:focus {
    border-color: #c9a227;
}
.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
textarea.input {
    resize: vertical;
    min-height: 80px;
}
select.input {
    appearance: auto;
}

/* Karte mit Alarm-Rahmen (offene Posten) */
.card-alert {
    border-color: rgba(231, 76, 60, 0.5) !important;
}

/* Badge Gold (Priorität A) */
.badge-gold {
    background: rgba(201, 162, 39, 0.2);
    color: #c9a227;
}

