*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 15px;
    line-height: 1.5;
}

.wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.login-wrap {
    max-width: 360px;
    margin: 8rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.login-wrap h2 { margin-bottom: 1.5rem; font-size: 1.3rem; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 { font-size: 1.4rem; }

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #4f46e5;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.col-group { display: flex; flex-direction: column; gap: 0.5rem; }

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-row label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="month"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f8fafc;
    transition: border-color 0.15s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #4f46e5;
    background: #fff;
}

textarea { resize: vertical; }

.btn-primary {
    display: inline-block;
    background: #4f46e5;
    color: #fff;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary:hover { background: #4338ca; }

.btn-secondary {
    display: inline-block;
    background: #e2e8f0;
    color: #334155;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.notice {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.notice.success { background: #dcfce7; color: #166534; }

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-box {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label { font-size: 0.75rem; color: #64748b; }
.stat-value { font-size: 1rem; font-weight: 700; color: #1e293b; }

.funnel-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.funnel-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.funnel-step span { color: #64748b; }
.funnel-step strong { font-size: 1rem; }
.funnel-step.highlight { background: #dcfce7; }
.funnel-step.highlight strong { color: #166534; }
.funnel-arrow { font-size: 0.78rem; color: #94a3b8; }

.poznamky {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85rem;
    color: #475569;
}

.footer-bar {
    margin-top: 2rem;
    text-align: right;
}

.error { color: #dc2626; font-size: 0.85rem; margin-top: 0.5rem; }

canvas { max-height: 400px; }

@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .funnel-row { flex-direction: column; align-items: flex-start; }
}
/* NAV */
.main-nav {
    background: #1e293b;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 54px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
    margin-right: 1rem;
    white-space: nowrap;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }

.nav-link {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: #334155; color: #fff; }
.nav-link.active { background: #4f46e5; color: #fff; }

.nav-logout {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.82rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: color 0.15s;
}

.nav-logout:hover { color: #fff; }

/* KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.kpi-box {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.kpi-highlight    { border-top: 3px solid #4f46e5; }
.kpi-highlight-sk { border-top: 3px solid #10b981; }

.kpi-label { font-size: 0.75rem; color: #64748b; font-weight: 500; }
.kpi-value { font-size: 1.4rem; font-weight: 700; color: #1e293b; }

.trend-up   { font-size: 0.78rem; color: #16a34a; font-weight: 600; }
.trend-down { font-size: 0.78rem; color: #dc2626; font-weight: 600; }

/* TRYCHTÝŘ vizuál */
.funnel-visual { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }

.funnel-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.funnel-bar-label {
    width: 90px;
    font-size: 0.82rem;
    color: #64748b;
    text-align: right;
    flex-shrink: 0;
}

.funnel-bar-track {
    flex: 1;
    background: #f1f5f9;
    border-radius: 6px;
    height: 34px;
    overflow: hidden;
}

.funnel-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding-left: 0.75rem;
    transition: width 0.6s ease;
    min-width: 40px;
}

.funnel-bar-fill span { color: #fff; font-size: 0.82rem; font-weight: 600; }
.funnel-bar-pct { width: 50px; font-size: 0.78rem; color: #64748b; flex-shrink: 0; }

/* CHART TABS */
.chart-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.chart-tab {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #475569;
}

.chart-tab:hover  { border-color: #4f46e5; color: #4f46e5; }
.chart-tab.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }

.hidden { display: none !important; }

/* QUICK ACTIONS */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.action-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    text-decoration: none;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    font-size: 0.85rem;
    font-weight: 500;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-icon { font-size: 1.75rem; }

/* MISC */
.period-label { font-size: 0.85rem; color: #64748b; margin-bottom: 1rem; }
.empty-state  { text-align: center; padding: 2rem; color: #64748b; }
.poznamky-text { font-size: 0.9rem; color: #475569; line-height: 1.6; }
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: 0.5rem; }
.login-sub  { text-align: center; color: #64748b; font-size: 0.85rem; margin-bottom: 1.5rem; }

@media (max-width: 768px) {
    .kpi-grid       { grid-template-columns: repeat(2, 1fr); }
    .quick-actions  { grid-template-columns: repeat(2, 1fr); }
    .nav-links      { display: none; }
}

@media (max-width: 480px) {
    .kpi-grid      { grid-template-columns: 1fr 1fr; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
}
