:root {
    --primary-color: #1e3a5f;
    --primary-light: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    background: var(--primary-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.header-controls {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.control-group label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
}

.control-group select {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    min-width: 200px;
    cursor: pointer;
}

.control-group select:focus {
    outline: 2px solid var(--primary-light);
}

/* Hero Section */
.hero-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.hero-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.zastupce-info .label,
.level-display .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.zastupce-info h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    color: white;
}

.level-s { background: linear-gradient(135deg, #94a3b8, #64748b); }
.level-m { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.level-l { background: linear-gradient(135deg, #34d399, #10b981); }
.level-xl { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.level-xxl { background: linear-gradient(135deg, #f472b6, #ec4899); }

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-color);
    padding: 1.25rem;
    border-radius: 10px;
    text-align: center;
}

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.stat-card.primary .stat-label {
    color: rgba(255, 255, 255, 0.85);
}

.stat-card.success {
    background: linear-gradient(135deg, #059669, var(--success-color));
    color: white;
}

.stat-card.success .stat-label,
.stat-card.success .stat-sublabel {
    color: rgba(255, 255, 255, 0.85);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-sublabel {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.9;
}

/* Progress Section */
.progress-section {
    text-align: center;
}

.progress-container {
    background: var(--bg-color);
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-light), var(--success-color));
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Data Section */
.data-section {
    margin-bottom: 1.5rem;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

/* Kategorie Table */
.kategorie-table {
    width: 100%;
    border-collapse: collapse;
}

.kategorie-table th,
.kategorie-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.kategorie-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    background: var(--bg-color);
}

.kategorie-table .empty-row {
    opacity: 0.5;
}

.kategorie-table .total-row {
    background: var(--primary-color);
    color: white;
}

.kategorie-table .total-row td {
    border-bottom: none;
}

/* Chart */
.chart-card {
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Table Section */
.table-section .card {
    padding: 0;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.table-header h3 {
    margin: 0;
    padding: 0;
    border: none;
}

.export-btn {
    padding: 0.5rem 1rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.export-btn:hover {
    background: #059669;
}

.table-wrapper {
    overflow-x: auto;
}

.op-table {
    width: 100%;
    border-collapse: collapse;
}

.op-table th,
.op-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.op-table th {
    background: var(--bg-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.op-table tbody tr:hover {
    background: var(--bg-color);
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-li-riziko {
    background: #dbeafe;
    color: #1e40af;
}

.badge-li-invest {
    background: #d1fae5;
    color: #065f46;
}

.badge-pzp-kasko {
    background: #fef3c7;
    color: #92400e;
}

.badge-privat {
    background: #fce7f3;
    color: #9f1239;
}

.badge-cp {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-investicie {
    background: #ccfbf1;
    color: #0f766e;
}

.badge-hypoteky {
    background: #f1f5f9;
    color: #475569;
}

/* Utility Classes */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.font-bold {
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-controls {
        width: 100%;
    }

    .control-group {
        flex: 1;
    }

    .control-group select {
        width: 100%;
        min-width: auto;
    }

    .hero-main {
        flex-direction: column;
        text-align: center;
    }

    .level-display {
        text-align: center;
    }

    .hero-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .level-badge {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .op-table {
        font-size: 0.85rem;
    }

    .op-table th,
    .op-table td {
        padding: 0.625rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .hero-stats {
        grid-template-columns: 1fr;
    }
}
