* { box-sizing: border-box; }

body {
    font-family: -apple-system, "Segoe UI", Arial, sans-serif;
    margin: 0;
    background: #f4f6f9;
    color: #222;
}

/* ---- Login page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: #fff;
    padding: 32px 28px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 340px;
}
.login-box h1 {
    font-size: 20px;
    color: #1F4E79;
    margin: 0 0 4px 0;
}
.login-box .subtitle {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}
.login-box label {
    display: block;
    font-size: 13px;
    color: #444;
    margin: 12px 0 4px 0;
}
.login-box input[type=text],
.login-box input[type=password] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
}
.login-box button {
    width: 100%;
    margin-top: 20px;
    padding: 11px;
    background: #1F4E79;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}
.login-box button:hover { background: #163b5c; }

/* ---- Layout ---- */
.topbar {
    background: #1F4E79;
    color: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
}
.topbar-title { font-weight: bold; font-size: 17px; }
.topbar-user { font-size: 14px; }
.topbar-user a {
    color: #fff;
    margin-left: 14px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.5);
    padding: 4px 10px;
    border-radius: 5px;
}
.topbar-user a:hover { background: rgba(255,255,255,0.15); }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 60px 16px;
}

section { margin-bottom: 32px; }
h2 {
    font-size: 16px;
    color: #1F4E79;
    border-bottom: 2px solid #e0e6ed;
    padding-bottom: 6px;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 14px;
}
.alert-error { background: #fce4e4; color: #9c0006; border: 1px solid #f5b5b5; }
.alert-warn  { background: #fff6e0; color: #9c6500; border: 1px solid #f5dd9b; }
.alert-ok    { background: #eaf5ec; color: #2e7d32; border: 1px solid #b7dfc0; }

.updated-note { color: #666; font-size: 13px; margin-top: 0; }

/* ---- Tiles ---- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.tile {
    background: #edf2fa;
    border-radius: 8px;
    padding: 14px;
}
.tile-green { background: #eaf5ec; }
.tile-red   { background: #fbefef; }
.tile-label { font-size: 12px; color: #5b6b7c; margin-bottom: 4px; }
.tile-value { font-size: 20px; font-weight: bold; color: #1F4E79; }
.tile-red .tile-value { color: #9c0006; }
.tile-green .tile-value { color: #2e7d32; }

/* ---- Table ---- */
/* Na mobile môžu byť tabuľky širšie ako obrazovka - .table-scroll obaľuje
   tabuľku a umožňuje vodorovné scrollovanie, s jemným "fade" tieňom na pravom
   okraji ako vizuálny náznak, že je čo scrollovať (inak si to používateľ
   nemusí všimnúť a myslí si, že dáta chýbajú). */
.table-scroll {
    position: relative;
    overflow-x: auto;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}
.table-scroll::after {
    content: '';
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    height: 100%;
    width: 18px;
    margin-left: -18px;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(0,0,0,0.06));
    pointer-events: none;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.data-table th {
    background: #1F4E79;
    color: #fff;
    font-size: 13px;
}
.data-table td { text-align: right; }
.data-table td:first-child, .data-table th:first-child { text-align: left; }

.badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.badge-ok   { background: #c6efce; color: #006100; }
.badge-warn { background: #ffeb9c; color: #9c6500; }
.badge-bad  { background: #ffc7ce; color: #9c0006; }

/* ---- Admin ---- */
.upload-form {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.upload-form button {
    padding: 10px 18px;
    background: #1F4E79;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.upload-form button:hover { background: #163b5c; }

.footer {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 20px;
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 7px 6px; }
    .tile-value { font-size: 17px; }
}

/* ---- Main navigation (owner pages) ---- */
.main-nav, .admin-nav {
    background: #fff;
    display: flex;
    gap: 4px;
    padding: 0 16px;
    border-bottom: 1px solid #e0e6ed;
    overflow-x: auto;
}
.main-nav-item, .admin-nav-item {
    padding: 12px 14px;
    text-decoration: none;
    color: #5b6b7c;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.main-nav-item.active, .admin-nav-item.active,
.main-nav-item:hover, .admin-nav-item:hover {
    color: #1F4E79;
    border-bottom-color: #1F4E79;
}

/* ---- Hamburger menu (mobil - vodorovné menu nahradí bočný vysúvací panel) ---- */
/* CSS-only prepínanie cez skrytý checkbox, žiadny JavaScript navyše.
   Nad breakpointom (600px) sa hamburger prvky úplne skryjú a menu vyzerá presne
   ako predtým - vodorovný pruh. Pod breakpointom sa menu skryje za tlačidlo ☰
   a otvára sa ako bočný panel (cca 2/3 šírky obrazovky) s tmavým prekrytím
   zvyšku obrazovky - kliknutím na prekrytie sa panel zavrie, rovnako ako
   výberom ktorejkoľvek položky (tá vždy vedie na novú stránku, kde je menu
   opäť v zatvorenom východiskovom stave). */
.nav-toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.nav-toggle-label {
    display: none;
    cursor: pointer;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 5px;
    position: relative;
    z-index: 60;
}
.nav-toggle-label:hover { background: rgba(255,255,255,0.15); }
.nav-overlay { display: none; }

@media (max-width: 600px) {
    .nav-toggle-label { display: inline-block; }

    /* Tmavé prekrytie za panelom - zabalí celú obrazovku, kliknutím sa menu zavrie */
    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0);
        pointer-events: none;
        z-index: 90;
        transition: background 0.2s ease;
    }
    .nav-toggle-checkbox:checked ~ .nav-overlay {
        background: rgba(0,0,0,0.4);
        pointer-events: auto;
    }

    .main-nav {
        display: flex;
        flex-direction: column;
        gap: 0;
        overflow-x: visible;
        overflow-y: auto;
        padding: 8px 0;
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        width: 75%;
        max-width: 320px;
        background: #fff;
        border-bottom: none;
        z-index: 100;
        box-shadow: -4px 0 16px rgba(0,0,0,0.15);
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }
    .nav-toggle-checkbox:checked ~ .main-nav {
        transform: translateX(0);
    }
    .main-nav-item {
        padding: 14px 18px;
        border-bottom: 1px solid #eee;
        border-left: 3px solid transparent;
    }
    .main-nav-item.active, .main-nav-item:hover {
        border-bottom-color: #eee;
        border-left-color: #1F4E79;
        background: #edf2fa;
    }
}

/* ---- Voting cards ---- */
.vote-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.vote-card.vote-closed { opacity: 0.85; }
.vote-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.vote-header h3 { margin: 0; font-size: 16px; color: #222; }
.vote-status {
    font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: bold; white-space: nowrap;
}
.vote-status-active { background: #c6efce; color: #006100; }
.vote-status-closed { background: #e2e2e2; color: #555; }
.vote-desc { font-size: 14px; color: #444; white-space: pre-line; }
.vote-meta { font-size: 12px; color: #888; }

.vote-form { display: flex; gap: 8px; margin: 12px 0 6px 0; flex-wrap: wrap; }
.vote-btn {
    padding: 9px 18px; border-radius: 6px; border: 2px solid #ccc; background: #fff;
    cursor: pointer; font-size: 14px; font-weight: bold;
}
.vote-yes { border-color: #2e7d32; color: #2e7d32; }
.vote-yes.vote-selected { background: #2e7d32; color: #fff; }
.vote-no { border-color: #9c0006; color: #9c0006; }
.vote-no.vote-selected { background: #9c0006; color: #fff; }
.vote-abstain { border-color: #9c6500; color: #9c6500; }
.vote-abstain.vote-selected { background: #9c6500; color: #fff; }

.vote-my { font-size: 13px; color: #444; }
.vote-pending { color: #9c6500; font-weight: bold; }

.vote-bar { background: #eee; border-radius: 6px; height: 10px; overflow: hidden; margin-top: 10px; }
.vote-bar-yes { background: #2e7d32; height: 100%; }
.vote-result { font-size: 12px; color: #555; margin: 6px 0 0 0; }
.vote-final { font-weight: bold; margin-top: 8px; }
.vote-final-ok { color: #2e7d32; }
.vote-final-bad { color: #9c0006; }
.vote-missing { font-size: 12px; color: #9c6500; margin-top: 6px; }

/* ---- Admin forms ---- */
.admin-form {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    max-width: 480px;
}
.admin-form label { display: block; font-size: 13px; color: #444; margin: 12px 0 4px 0; }
.admin-form input[type=text], .admin-form input[type=date], .admin-form input[type=number],
.admin-form input[type=password], .admin-form input[type=file], .admin-form select, .admin-form textarea {
    width: 100%; padding: 9px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px;
    font-family: inherit;
}
.admin-form textarea { resize: vertical; }
.admin-form button {
    margin-top: 16px; padding: 10px 18px; background: #1F4E79; color: #fff;
    border: none; border-radius: 6px; cursor: pointer;
}
.admin-form button:hover { background: #163b5c; }

.small-btn {
    padding: 5px 12px; background: #1F4E79; color: #fff; border: none;
    border-radius: 5px; cursor: pointer; font-size: 12px; text-decoration: none; display: inline-block;
}
.small-btn:hover { background: #163b5c; }

.password-reveal {
    background: #fff6e0; border: 1px solid #f5dd9b; padding: 12px 16px;
    border-radius: 6px; font-size: 16px; margin-bottom: 18px;
}

/* ---- Mini history chart ---- */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    background: #fff;
    border-radius: 8px;
    padding: 28px 12px 4px 12px;
    overflow-x: auto;
}
.chart-col { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.chart-bars { display: flex; gap: 2px; align-items: flex-end; height: 90px; }
.chart-bar { width: 12px; border-radius: 3px 3px 0 0; position: relative; }
.chart-bar-fond { background: #2e7d32; }
.chart-bar-zostatok { background: #1F4E79; }
.chart-bar-value {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%) rotate(-40deg);
    transform-origin: bottom left;
    font-size: 9px;
    color: #444;
    white-space: nowrap;
}
.chart-label { font-size: 10px; color: #888; margin-top: 4px; }
.chart-legend { font-size: 12px; color: #555; margin-top: 6px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 12px; vertical-align: middle; }
.legend-fond { background: #2e7d32; }
.legend-zostatok { background: #1F4E79; }

/* ---- Document filters & delete button ---- */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-chip {
    padding: 5px 12px; border-radius: 14px; background: #fff; border: 1px solid #ccc;
    color: #444; font-size: 12px; text-decoration: none;
}
.filter-chip-active { background: #1F4E79; color: #fff; border-color: #1F4E79; }
.small-btn-danger { background: #9c0006; }
.small-btn-danger:hover { background: #7a0004; }
.muted { color: #aaa; }

/* ---- Notice board ---- */
.notice-board {
    background: #fff3cd;
    border-left: 4px solid #e0a800;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #5c4300;
}

/* ---- Inline table inputs (kontakty) ---- */
.inline-input {
    width: 100%; padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px;
}
.inline-input:focus { border-color: #1F4E79; outline: none; }

/* ---- Pending vote notice ---- */
.notice-vote {
    background: #fce4e4;
    border-left: 4px solid #9c0006;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #7a0004;
}
.notice-vote a { color: #7a0004; font-weight: bold; }

/* ---- FAQ page ---- */
.faq-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    font-size: 14px;
    line-height: 1.65;
    color: #333;
}
.faq-box p {
    margin: 0 0 18px 0;
}
.faq-box p:last-child {
    margin-bottom: 0;
}
.faq-heading {
    color: #1F4E79;
    font-size: 15px;
    font-weight: bold;
    text-transform: none;
    letter-spacing: 0.02em;
    margin: 26px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e6ed;
}
.faq-heading:first-child {
    margin-top: 0;
}

.badge-missing { background: #e2e2e2; color: #555; }

/* ---- Admin sidebar layout ---- */
.admin-layout {
    display: flex;
    align-items: flex-start;
    gap: 0;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 60px 16px;
}
.admin-sidebar {
    width: 190px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    position: sticky;
    top: 20px;
}
.admin-sidebar-item {
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #444;
    font-size: 14px;
}
.admin-sidebar-item:hover { background: #edf2fa; color: #1F4E79; }
.admin-sidebar-item.active { background: #1F4E79; color: #fff; font-weight: bold; }
.admin-content {
    flex: 1;
    min-width: 0;
    padding-left: 20px;
}

@media (max-width: 760px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
    }
    .admin-content { padding-left: 0; padding-top: 16px; }
}

/* ---- Announcement archive ---- */
.notice-archived { opacity: 0.6; }
.notice-date { font-size: 11px; color: #888; margin-top: 4px; }

/* ---- Horizontal bar chart (výdavky podľa kategórie) ---- */
.hbar-chart { background: #fff; border-radius: 8px; padding: 16px; }
.hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar-label { width: 140px; font-size: 12px; color: #444; flex-shrink: 0; }
.hbar-track { flex: 1; background: #eee; border-radius: 5px; height: 16px; overflow: hidden; }
.hbar-fill { background: #1F4E79; height: 100%; border-radius: 5px; }
.hbar-value { width: 80px; text-align: right; font-size: 12px; color: #333; flex-shrink: 0; }

.chart-bar-elektrina { background: #F4A93E; }

@media (max-width: 600px) {
    .hbar-label { width: 90px; font-size: 11px; }
    .hbar-value { width: 60px; font-size: 11px; }
}

/* ---- Empty state (prázdna sekcia bez obsahu) ---- */
.empty-state {
    background: #fff;
    border: 1px dashed #d5dce5;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    color: #5b6b7c;
}
.empty-state-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.6; }
.empty-state-text { font-size: 14px; line-height: 1.5; max-width: 420px; margin: 0 auto; }
