/* Himmelsbach Dashboard – Clean & Professional */

:root {
    --gruen: #22c55e;
    --gelb: #eab308;
    --rot: #ef4444;
    --blau: #3b82f6;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Header */
header {
    background: var(--text);
    color: white;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}
.logo-link { text-decoration: none; color: white; }
.logo-link h1 { font-size: 1.125rem; font-weight: 600; }
.logo-link:hover h1 { color: #93c5fd; }

/* Navigation */
.main-nav {
    display: flex;
    gap: 0;
    height: 100%;
}
.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    height: 100%;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.nav-link:hover { color: white; }
.nav-link.active {
    color: white;
    border-bottom-color: var(--primary);
}

.header-meta { display: flex; gap: 1.5rem; align-items: center; }
.timestamp { color: #94a3b8; font-size: 0.8rem; }
.btn-logout {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid #475569;
    border-radius: 4px;
}
.btn-logout:hover { color: white; border-color: white; }

/* Main */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Page Header */
.page-header { margin-bottom: 1.5rem; }
.page-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.results-header { margin-bottom: 1.5rem; }
.results-header h2 { font-size: 1.125rem; color: var(--text-muted); }

/* Breadcrumb */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.card h4 { font-size: 0.9rem; margin: 1rem 0 0.5rem; color: var(--text-muted); }

/* Ampel Summary */
.ampel-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.ampel {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}
.ampel-gruen { background: #dcfce7; color: #166534; }
.ampel-gelb { background: #fef9c3; color: #854d0e; }
.ampel-rot { background: #fee2e2; color: #991b1b; }
.total { color: var(--text-muted); font-size: 0.875rem; line-height: 2; }

/* Dots */
.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot-gruen { background: var(--gruen); }
.dot-gelb { background: var(--gelb); }
.dot-rot { background: var(--rot); }

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
th, td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.row-gruen { background: #f0fdf4; }
.row-gelb { background: #fffbeb; }
.row-rot { background: #fef2f2; }

/* Conflicts */
.conflict {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin: 1px 0;
}
.conflict-kritisch { background: #fee2e2; color: #991b1b; }
.conflict-warnung { background: #fef9c3; color: #854d0e; }
.conflict-info { background: #e0e7ff; color: #3730a3; }

/* Agent Overview Grid (Dashboard) */
.agent-overview-card { }
.agent-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.agent-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}
.agent-chip:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(37,99,235,0.1);
}
.agent-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.agent-chip.status-active .agent-chip-dot { background: var(--gruen); }
.agent-chip.status-priority .agent-chip-dot { background: var(--rot); }
.agent-chip.status-planned .agent-chip-dot { background: var(--border); }
.agent-chip-label { font-weight: 500; }
.agent-chip-company { color: var(--text-muted); font-size: 0.75rem; }

/* Agent Results (Dashboard) */
.agent-result {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}
.agent-result:hover { border-color: var(--primary); }
.result-arrow { margin-left: auto; color: var(--text-muted); }
.recommendation {
    width: 100%;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
.run-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.5rem; }

/* Agent Structure Page */
.agent-structure { }
.company-card { }
.company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.company-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.agent-count { color: var(--text-muted); font-size: 0.8rem; }
.tier-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tier-1 { background: #dbeafe; color: #1e40af; }
.tier-2 { background: #e0e7ff; color: #3730a3; }

.agent-list { }
.agent-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.375rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}
.agent-row:hover {
    border-color: var(--primary);
    background: #f8faff;
}
.agent-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.agent-status-indicator.status-active { background: var(--gruen); }
.agent-status-indicator.status-priority { background: var(--rot); }
.agent-status-indicator.status-planned { background: #cbd5e1; }
.agent-info { flex: 1; }
.agent-name { font-weight: 500; font-size: 0.9rem; }
.agent-file { display: block; color: var(--text-muted); font-size: 0.75rem; font-family: monospace; }
.row-arrow { color: var(--text-muted); font-size: 0.9rem; }

/* Status Tags */
.status-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tag-active { background: #dcfce7; color: #166534; }
.tag-priority { background: #fee2e2; color: #991b1b; }
.tag-planned { background: #f1f5f9; color: #64748b; }

/* Agent Detail Page */
.role-content { }
.role-markdown {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
    max-height: 600px;
    overflow-y: auto;
}
.result-json {
    background: #0f172a;
    color: #a5f3fc;
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
}
.tool-calls-list {
    list-style: none;
    padding: 0;
}
.tool-calls-list li {
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.tool-calls-list code {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
}
.tool-input { color: var(--text-muted); font-size: 0.8rem; margin-left: 0.5rem; }
.empty-hint { color: var(--text-muted); font-style: italic; }

/* Buttons */
.btn-back {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}
.btn-back:hover { text-decoration: underline; }
.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.btn-primary:hover { background: #1d4ed8; }
.detail-actions { margin-top: 1rem; }

/* Security Page */
.infra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}
.infra-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}
.infra-item h4 { font-size: 0.9rem; margin-bottom: 0.25rem; color: var(--text); }
.infra-ip { font-family: monospace; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.infra-services { list-style: none; padding: 0; }
.infra-services li {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.15rem 0;
}
.security-agent-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Legend */
.legend-items { display: flex; gap: 2rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }

/* Date nav */
.date-nav { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.date-chip {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-muted);
}
.date-chip.active { background: var(--primary); color: white; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state h2 { color: var(--text); margin-bottom: 0.5rem; }
.empty-state code {
    display: inline-block;
    margin-top: 1rem;
    background: var(--text);
    color: #a5f3fc;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Login */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.login-card h1 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.login-card input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}
.login-card button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }

/* Alert */
.alert { padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.summary-number { font-size: 2rem; font-weight: 700; }
.summary-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.card-ok { border-left: 4px solid var(--gruen); }
.card-ok .summary-number { color: var(--gruen); }
.card-warn { border-left: 4px solid var(--gelb); }
.card-warn .summary-number { color: var(--gelb); }
.card-critical { border-left: 4px solid var(--rot); }
.card-critical .summary-number { color: var(--rot); }
.card-total { border-left: 4px solid var(--blau); }
.card-total .summary-number { color: var(--blau); }

/* Agent Status Grid */
.agent-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}
.agent-status-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}
.agent-status-card:hover { border-color: var(--primary); box-shadow: 0 2px 6px rgba(37,99,235,0.1); }
.agent-status-header { margin-bottom: 0.5rem; }
.agent-status-name { font-weight: 600; font-size: 0.85rem; display: block; }
.agent-status-company { font-size: 0.7rem; color: var(--text-muted); }
.agent-status-body { display: flex; align-items: center; gap: 0.5rem; }
.agent-status-dot { width: 14px; height: 14px; border-radius: 50%; }
.dot-grau { background: #cbd5e1; }
.status-text { font-size: 0.8rem; color: var(--text-muted); }
.agent-status-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.4rem; }

/* Tier Results */
.tier-results { margin-bottom: 1rem; }
.results-list { display: flex; flex-direction: column; gap: 0.375rem; }
.result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}
.result-row:hover { border-color: var(--primary); background: #f8faff; }
.result-name { font-size: 0.85rem; font-weight: 500; flex: 1; }
.error-badge { font-size: 0.7rem; background: #fee2e2; color: #991b1b; padding: 0.1rem 0.4rem; border-radius: 3px; }

/* Result Cards */
.result-card { }
.result-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.result-card-header h3 { margin-bottom: 0; }
.badge { font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 4px; }
.badge-gruen { background: #dcfce7; color: #166534; }
.badge-gelb { background: #fef9c3; color: #854d0e; }
.badge-rot { background: #fee2e2; color: #991b1b; }

/* Parsed Result Display */
.parsed-result { }
.result-section {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    border-left: 3px solid var(--border);
}
.result-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.result-section-text {
    font-size: 0.875rem;
    line-height: 1.6;
}
.result-empfehlung {
    background: #eff6ff;
    border-left-color: var(--primary);
}
.result-reichweite {
    background: #f0fdf4;
    border-left-color: var(--gruen);
}
.result-events-compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.result-event-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.25rem 0;
}
.event-name { flex: 1; font-weight: 500; }
.event-date { color: var(--text-muted); font-size: 0.75rem; }
.result-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.25rem 0;
}
.result-raw-toggle {
    margin-top: 0.75rem;
}
.result-raw-toggle summary {
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
}
.result-raw-toggle summary:hover { text-decoration: underline; }
.result-raw-toggle .result-json {
    margin-top: 0.5rem;
    max-height: 300px;
}

/* Start Options */
.start-options { margin-top: 1.5rem; }
.start-options p { margin-top: 0.75rem; font-size: 0.85rem; }

/* Mapping Table */
.mapping-table { margin-top: 0.5rem; }
.mapping-table td { font-size: 0.85rem; }

/* Approval Items */
.fix-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color 0.15s;
}
.fix-item:hover { border-color: var(--primary); }
.fix-status-pending { border-left: 4px solid var(--gelb); }
.fix-status-on_hold { border-left: 4px solid #94a3b8; }
.fix-status-approved { border-left: 4px solid var(--blau); }
.fix-status-executed { border-left: 4px solid var(--gruen); }
.fix-status-failed { border-left: 4px solid var(--rot); }
.fix-status-rejected { border-left: 4px solid #94a3b8; opacity: 0.7; }
.fix-status-rolled_back { border-left: 4px solid #f97316; }

.fix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.fix-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.fix-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-security_headers { background: #dbeafe; color: #1e40af; }
.badge-wp_plugin_update { background: #fef9c3; color: #854d0e; }
.badge-wp_plugin_delete { background: #f1f5f9; color: #64748b; }

.fix-severity {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.severity-high { background: #fee2e2; color: #991b1b; }
.severity-medium { background: #fef9c3; color: #854d0e; }
.severity-low { background: #e0e7ff; color: #3730a3; }

.fix-domain {
    font-weight: 600;
    font-size: 0.85rem;
    font-family: monospace;
}
.fix-server {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.fix-status-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fix-tag-pending { background: #fef9c3; color: #854d0e; }
.fix-tag-on_hold { background: #f1f5f9; color: #64748b; }
.fix-tag-approved { background: #dbeafe; color: #1e40af; }
.fix-tag-executed { background: #dcfce7; color: #166534; }
.fix-tag-failed { background: #fee2e2; color: #991b1b; }
.fix-tag-rejected { background: #f1f5f9; color: #64748b; }
.fix-tag-rolled_back { background: #ffedd5; color: #9a3412; }

.fix-description {
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.fix-details {
    margin-bottom: 0.75rem;
}
.fix-details summary {
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
}
.fix-details summary:hover { text-decoration: underline; }
.fix-commands {
    margin-top: 0.5rem;
}
.fix-commands strong {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}
.fix-commands pre {
    background: #0f172a;
    color: #a5f3fc;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.fix-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.fix-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.btn-approve, .btn-reject, .btn-rollback {
    border: none;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-approve {
    background: var(--gruen);
    color: white;
}
.btn-approve:hover { background: #16a34a; }
.btn-approve:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}
.btn-reject {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-reject:hover { background: #e2e8f0; }
.btn-rollback {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.btn-rollback:hover { background: #fed7aa; }

.fix-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* HTMX loading indicator */
.fix-item.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    main { padding: 0 1rem; }
    .header-content { flex-direction: column; gap: 0.5rem; height: auto; padding: 0.5rem 0; }
    .main-nav { height: auto; }
    table { font-size: 0.75rem; }
    th, td { padding: 0.4rem; }
    .infra-grid { grid-template-columns: 1fr; }
    .security-agent-link { flex-direction: column; gap: 0.75rem; }
}
