:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --surface-3: #262b36;
    --border: #2a2f3a;
    --text: #e8eaed;
    --text-dim: #9aa1ac;
    --accent: #6ee7b7;
    --accent-strong: #34d399;
    --danger: #f87171;
    --danger-bg: #3a1c1c;
    --success: #4ade80;
    --success-bg: #143323;
    --warn-text: #fca5a5;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 0.9rem 1.5rem;
}
.topbar .brand { font-weight: 600; font-size: 1.1rem; letter-spacing: 0.01em; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar a { color: var(--text-dim); text-decoration: none; }
.topbar a:hover { color: var(--text); }
.role-badge {
    background: var(--surface-3);
    color: var(--text);
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

.flash {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--warn-text);
    padding: 0.7rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* ---- Prijava / obrazci ---- */
.login-box, .form-box {
    background: var(--surface);
    border: 1px solid var(--border);
    max-width: 420px;
    margin: 3rem auto;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.login-box h1, .form-box h1 { margin-top: 0; color: var(--text); }
form label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
form input[type=text], form input[type=password], form select, form input[type=file], form input[type=number] {
    width: 100%;
    padding: 0.6rem 0.7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-size: 1rem;
}
form input::placeholder { color: var(--text-dim); }
form input:focus, form select:focus { outline: none; border-color: var(--accent); }
.role-select { display: inline-block; margin-right: 1rem; font-weight: 400; color: var(--text); }

button, .button {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.6rem 1.3rem;
    background: var(--accent-strong);
    color: #06251a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--accent); }
.button.secondary { background: var(--surface-3); color: var(--text); margin-left: 0.5rem; }
button.danger { background: var(--danger); color: #2a0d0d; margin-top: 0; }
button.dot-button { background: none; border: none; padding: 0; margin: 0; cursor: pointer; }

/* ---- Kartice / povzetek ---- */
.summary-cards { display: flex; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    flex: 1;
    min-width: 200px;
}
.card-label { display: block; font-size: 0.78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.card-value { display: block; font-size: 1.8rem; font-weight: 700; margin-top: 0.25rem; color: var(--text); }
.card-value.warn { color: var(--warn-text); }
.card-sub { font-size: 0.8rem; color: var(--text-dim); }

h2 { margin-top: 2.2rem; color: var(--text); font-size: 1.15rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Admin tabela ---- */
table.bills-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
table.bills-table th, table.bills-table td {
    padding: 0.65rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
}
table.bills-table tr:last-child td { border-bottom: none; }
table.bills-table th { background: var(--surface-2); font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }

.dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.03); }
.dot.green { background: var(--success); }
.dot.red { background: var(--danger); }

.inline-form { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-form input {
    padding: 0.35rem 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
}
.inline-form button { margin: 0; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.ocr-note { font-size: 0.76rem; color: #d9a441; max-width: 180px; }
.hint { font-size: 0.8rem; color: var(--text-dim); margin: 0.3rem 0 0; }
.bill-types-list { padding-left: 1.2rem; color: var(--text); }

/* ---- Najemniški dashboard (modernejši, kartice namesto tabele) ---- */
.tenant-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.stat-card {
    background: linear-gradient(155deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem 1.5rem;
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon { font-size: 1.4rem; opacity: 0.85; }
.stat-card .stat-label { display: block; font-size: 0.78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.6rem; }
.stat-card .stat-value { display: block; font-size: 2rem; font-weight: 700; margin-top: 0.2rem; }
.stat-card.unpaid .stat-value { color: var(--warn-text); }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.3rem; }

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2.4rem;
    margin-bottom: 0.9rem;
}
.section-title h2 { margin: 0; }

.bill-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}
.bill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--danger);
    border-radius: 12px;
    padding: 1rem 1.2rem;
}
.bill-card.paid { border-left-color: var(--success); }
.bill-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.bill-card-type { font-weight: 600; font-size: 0.95rem; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.status-pill.paid { background: var(--success-bg); color: var(--success); }
.status-pill.unpaid { background: var(--danger-bg); color: var(--warn-text); }
.bill-card-period { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.3rem; }
.bill-card-amount { font-size: 1.5rem; font-weight: 700; margin-top: 0.7rem; }
.bill-card-link { display: inline-block; margin-top: 0.6rem; font-size: 0.82rem; }
.bill-card-empty { color: var(--text-dim); padding: 1rem 0; }

.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
}
.month-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.month-chip .month-name { font-size: 0.85rem; font-weight: 600; }
.month-chip .month-amount { display: block; font-size: 0.75rem; color: var(--text-dim); margin-top: 0.15rem; }

.year-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.year-switch input {
    width: 5.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
}
.year-switch button { margin: 0; padding: 0.4rem 0.9rem; font-size: 0.85rem; }
