:root {
    --primary: #1a56db;
    --primary-hover: #1443a6;
    --danger: #dc2626;
    --success: #16a34a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: var(--gray-900);
    color: white;
    padding: 12px 0;
    margin-bottom: 30px;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-links a {
    color: var(--gray-300);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.2s;
}

.nav-links a:hover { color: white; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn:hover { background: var(--gray-100); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
}
.table tbody tr:hover { background: var(--gray-50); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 2px;
}
.badge-ok   { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err  { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* === UCTO LEGACY TABULKY (generic <table> bez class) ==========
   Ucto templates (pohyby, zustatky, denik, rozvaha, vysledovka, dary,
   sklad, mzdy, klasifikace500, zadani, ...) pouzivaji generic <table>
   bez class="". V blueprint kontextu (nonprofit) musime poskytnout
   generic styling — nonprofit's .table class zustava pro svoje pouziti.
   =============================================================== */

.main-content table:not(.projekty-table) {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}
.main-content table:not(.projekty-table) thead { background: #f8fafc; }
.main-content table:not(.projekty-table) th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
}
.main-content table:not(.projekty-table) td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}
.main-content table:not(.projekty-table) tr:last-child td { border-bottom: none; }
.main-content table:not(.projekty-table) tbody tr:hover { background: #f8fafc; }

/* Shared utility tridy — .num / .bold / .total-row — pouzivaji ucto + nonprofit */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.negative { color: #dc2626; font-weight: 600; }
.bold { font-weight: 700; }
.total-row td { background: #f1f5f9 !important; font-weight: 700; }

/* === PROJEKTY TABLE (pouziva /ucetnictvi/projekty) === */

table.projekty-table {
    width: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
table.projekty-table th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--gray-200);
}
table.projekty-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
}
table.projekty-table tr:last-child td { border-bottom: none; }
table.projekty-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.projekty-table td.num.bold { font-weight: 700; }
table.projekty-table td.num.negative { color: #dc2626; font-weight: 600; }
table.projekty-table a { color: var(--primary); text-decoration: none; font-weight: 500; }
table.projekty-table a:hover { text-decoration: underline; }
/* Skupiny (total-row) — modre pozadi */
table.projekty-table tr.total-row td { background: #f0f9ff; font-weight: 600; }
/* Zebra — jen pro ne-skupiny */
table.projekty-table tbody tr:nth-child(even):not(.total-row):not(:hover) {
    background: #fafbfc;
}
/* Vycerpane — sedy text, bez line-through (per uzivatelske rozhodnuti) */
table.projekty-table tr.row-vycerpany td { color: var(--gray-500); }
table.projekty-table tr.row-vycerpany a { color: var(--gray-500); }

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--gray-700);
}
.card h3 {
    font-size: 0.95rem;
    margin-top: 12px;
    margin-bottom: 8px;
    color: var(--gray-500);
}

/* Definition lists */
dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 6px 12px;
}
dt { font-weight: 600; color: var(--gray-500); font-size: 0.85rem; }
dd { color: var(--gray-900); }

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.detail-grid .card { margin-bottom: 0; }

/* Downloads */
.downloads {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Forms */
fieldset {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
legend {
    font-weight: 700;
    padding: 0 8px;
    color: var(--gray-700);
}
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.form-row .form-group { flex: 1; }
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 40px;
}

/* Items table inputs */
.items-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 0.85rem;
}
.items-table input:focus {
    outline: none;
    border-color: var(--primary);
}
.totals-row {
    background: var(--gray-50);
}

/* Select */
.select-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}
.select-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Help text */
.help-text {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 6px;
}
.help-text a { color: var(--primary); }

/* Upload form */
.upload-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

/* Vehicle cards */
.vehicle-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.vehicle-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state p { margin-bottom: 16px; font-size: 1.1rem; }
