:root {
    --stone: #F7F5F2;
    --stone-deep: #EDE9E3;
    --ink: #1C1917;
    --muted: #57534E;
    --muted-light: #78716C;
    --teal: #1B6B93;
    --teal-dark: #145A7A;
    --teal-deep: #0F3D56;
    --terracotta: #C4704B;
    --olive: #5C7A4A;
    --white: #ffffff;
    --success: #5C7A4A;
    --success-bg: #e8efe4;
    --danger: #a13e3e;
    --danger-bg: #f5e4e0;
    --warning: #C4704B;
    --warning-bg: #f8ebe4;
    --border: #ddd6cc;
    --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08);
    --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.08);
    --radius: 0.5rem;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', 'Segoe UI', sans-serif;

    /* Legacy aliases used across markup */
    --primary: var(--teal);
    --primary-dark: var(--teal-dark);
    --primary-light: #2a7fa8;
    --gray-dark: var(--ink);
    --gray-medium: var(--muted);
    --gray-light: var(--stone-deep);
    --bg-body: var(--stone);
    --bg-card: var(--white);
    --text: var(--ink);
    --text-muted: var(--muted);
}

[data-theme="dark"] {
    --stone: #12181c;
    --stone-deep: #1a2329;
    --ink: #f5f2ed;
    --muted: #a8a29e;
    --muted-light: #78716c;
    --teal: #4a9bc4;
    --teal-dark: #6bb0d0;
    --teal-deep: #0F3D56;
    --white: #1a2329;
    --border: #2d3a42;
    --success-bg: rgba(92, 122, 74, 0.2);
    --danger-bg: rgba(161, 62, 62, 0.2);
    --warning-bg: rgba(196, 112, 75, 0.2);
    --bg-body: #12181c;
    --bg-card: #1a2329;
    --text: #f5f2ed;
    --text-muted: #a8a29e;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .hero-brand, .section-title, .report-header .title {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* —— Site nav —— */
.site-nav {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.5rem;
    max-width: 1120px;
    margin: 0 auto;
}

.site-nav-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: rgba(247, 245, 242, 0.95);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}
.site-nav-brand:hover {
    background: rgba(247, 245, 242, 0.12);
    color: var(--stone);
}
.nav-brand-icon {
    width: 1.45rem;
    height: 1.45rem;
}

.site-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-nav .btn {
    box-shadow: none;
    border-color: rgba(247, 245, 242, 0.35);
    background: transparent;
    color: var(--stone);
}
.site-nav .btn:hover {
    background: rgba(247, 245, 242, 0.12);
    transform: none;
}
.site-nav .btn.blue {
    background: var(--stone);
    color: var(--teal-deep);
    border-color: var(--stone);
}
.site-nav .btn.blue:hover {
    background: var(--white);
    color: var(--teal-deep);
}
.site-nav .btn.btn-icon.blue {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}
.site-nav .btn.red {
    background: transparent;
    border-color: rgba(247, 245, 242, 0.35);
    color: var(--stone);
}
.site-nav .btn.btn-icon.red:hover {
    background: rgba(247, 245, 242, 0.12);
    transform: none;
}
.site-nav .btn.gray {
    background: transparent;
    color: var(--stone);
}

/* —— Hero —— */
.hero {
    position: relative;
    min-height: min(92vh, 720px);
    display: flex;
    align-items: flex-end;
    padding: 6.5rem 1.5rem 4.5rem;
    color: var(--stone);
    overflow: hidden;
    background:
        linear-gradient(165deg,
            rgba(15, 61, 86, 0.92) 0%,
            rgba(20, 90, 122, 0.88) 42%,
            rgba(27, 107, 147, 0.75) 68%,
            rgba(196, 112, 75, 0.45) 100%),
        linear-gradient(200deg, #0F3D56 0%, #1B6B93 55%, #C4704B 120%);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 70% 20%, rgba(247, 245, 242, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 15% 80%, rgba(92, 122, 74, 0.15), transparent 50%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3.5rem;
    background: linear-gradient(to top, var(--stone), transparent);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
}

.hero-brand {
    font-size: clamp(2.4rem, 6vw, 3.75rem);
    line-height: 1.1;
    color: var(--stone);
    margin-bottom: 0.85rem;
    animation: fadeUp 0.7s ease both;
}

.hero-headline {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 2.2vw, 1.25rem);
    font-weight: 600;
    color: rgba(247, 245, 242, 0.95);
    margin-bottom: 1.75rem;
    max-width: 32ch;
    animation: fadeUp 0.7s ease 0.1s both;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    animation: fadeUp 0.7s ease 0.26s both;
}

.hero-cta .btn.blue {
    background: var(--stone);
    color: var(--teal-deep);
    border-color: var(--stone);
    box-shadow: var(--shadow-sm);
}
.hero-cta .btn.blue:hover {
    background: var(--white);
    transform: translateY(-1px);
}
.hero-cta .btn:not(.blue) {
    background: transparent;
    color: var(--stone);
    border-color: rgba(247, 245, 242, 0.4);
    box-shadow: none;
}
.hero-cta .btn:not(.blue):hover {
    background: rgba(247, 245, 242, 0.1);
    transform: none;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

/* —— Page shell —— */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.page-section {
    margin-bottom: 2.75rem;
    animation: fadeUp 0.55s ease both;
}

.page-section:nth-child(1) { animation-delay: 0.05s; }
.page-section:nth-child(2) { animation-delay: 0.1s; }
.page-section:nth-child(3) { animation-delay: 0.15s; }
.page-section:nth-child(4) { animation-delay: 0.2s; }
.page-section:nth-child(5) { animation-delay: 0.25s; }

.section-head {
    margin-bottom: 1.15rem;
}
.section-head h2 {
    font-size: 1.65rem;
    color: var(--teal-deep);
    margin-bottom: 0.3rem;
}
[data-theme="dark"] .section-head h2 { color: var(--teal); }
.section-head p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 48ch;
}

/* Legacy container (admin / log / pdf) */
.container {
    max-width: 1120px;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 2rem 1.5rem 3rem;
    position: relative;
}
.container::before { display: none; }
.container-wide { max-width: 1200px; }
.container-narrow { max-width: 800px; }

.page-fade { animation: fadeUp 0.45s ease; }

.admin-shell,
.log-shell {
    padding-top: 1.5rem;
}

.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.breadcrumb .sep { opacity: 0.45; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }

.header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) {
    .header { flex-direction: row; align-items: center; }
}

.logo-area { display: flex; align-items: center; gap: 0.75rem; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }

h1 {
    font-size: 1.85rem;
    color: var(--teal-deep);
}
[data-theme="dark"] h1 { color: var(--teal); }
h2, h3 { color: var(--teal-dark); }
[data-theme="dark"] h2,
[data-theme="dark"] h3 { color: var(--teal); }

.header-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.icon { width: 1.1rem; height: 1.1rem; }
.icon-lg { width: 2rem; height: 2rem; color: var(--teal); flex-shrink: 0; }

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 1.15rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn:active { transform: none; }
.btn-icon {
    padding: 0.55rem;
    box-shadow: none;
}

.red { background: var(--danger); border-color: var(--danger); color: white; box-shadow: var(--shadow-sm); }
.green { background: var(--olive); border-color: var(--olive); color: white; box-shadow: var(--shadow-sm); }
.purple { background: var(--terracotta); border-color: var(--terracotta); color: white; box-shadow: var(--shadow-sm); }
.blue { background: var(--teal); border-color: var(--teal-dark); color: white; box-shadow: var(--shadow-sm); }
.gray { background: var(--muted); border-color: var(--muted); color: white; box-shadow: var(--shadow-sm); }
.orange { background: var(--terracotta); border-color: #a85c3a; color: white; box-shadow: var(--shadow-sm); }

.blue:hover, .green:hover, .red:hover, .purple:hover, .gray:hover, .orange:hover {
    filter: brightness(1.05);
}

/* —— Summary strip (not card-dashboard) —— */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1.5rem;
    padding: 1.35rem 0;
    margin-bottom: 0.5rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) {
    .summary-strip { grid-template-columns: repeat(4, 1fr); }
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-light);
}
.summary-value {
    font-family: var(--font-display);
    font-size: 1.45rem;
    color: var(--teal-deep);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
[data-theme="dark"] .summary-value { color: var(--teal); }
.summary-value.sm { font-size: 1.15rem; font-family: var(--font-body); font-weight: 600; }
.summary-ok .summary-value { color: var(--olive); }
.summary-warn .summary-value { color: var(--terracotta); }

/* Legacy dash cards → soft strip look if still used */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.dash-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.dash-primary, .dash-ok, .dash-warn { border: none; background: transparent; }
.dash-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-light);
}
.dash-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--teal-deep);
    font-variant-numeric: tabular-nums;
}
.dash-sm { font-size: 1.1rem; font-family: var(--font-body); font-weight: 600; }

/* —— Period selector —— */
.date-selector {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .date-selector { background: var(--bg-card); }
.date-selector form { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 576px) {
    .date-selector form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-width: 140px; }
@media (min-width: 576px) {
    .form-group { flex-direction: row; align-items: center; }
}
.form-group label {
    font-weight: 600;
    color: var(--teal-dark);
    min-width: 70px;
    font-size: 0.875rem;
}

select, input[type="text"], input[type="password"], input[type="number"] {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(27, 107, 147, 0.15);
}

/* —— Table —— */
.responsive-table-wrapper {
    overflow-x: auto;
    margin: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .responsive-table-wrapper { background: var(--bg-card); }
.table-animate { animation: fadeUp 0.4s ease; }

.expenses-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.expenses-table th {
    text-align: left;
    padding: 0.9rem 1.1rem;
    background: var(--teal-deep);
    color: var(--stone);
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.expenses-table td {
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--stone-deep);
}
.expenses-table tr:last-child td { border-bottom: none; }
.expenses-table tbody tr { transition: background 0.15s; }
.expenses-table tbody tr:hover td { background: rgba(27, 107, 147, 0.04); }
.amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.total-row { background: var(--stone-deep) !important; }
.total-row td {
    font-weight: 700;
    color: var(--teal-deep);
    border-top: 1px solid var(--border);
}
[data-theme="dark"] .total-row td { color: var(--teal); }

.receipt-link { color: var(--teal); font-weight: 600; text-decoration: none; }
.receipt-link:hover { text-decoration: underline; color: var(--teal-dark); }
.badge-ok { color: var(--olive); }
.badge-muted { color: var(--text-muted); font-size: 0.85rem; }

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: default;
    font-family: inherit;
}
.status-badge.paid { background: var(--success-bg); color: var(--olive); }
.status-badge.unpaid { background: var(--danger-bg); color: var(--danger); }
.inline-form { display: inline; }
button.status-badge { cursor: pointer; }
button.status-badge:hover { opacity: 0.85; }

/* —— Meter —— */
.meter-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    margin: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
[data-theme="dark"] .meter-box { background: var(--bg-card); }
.meter-header {
    display: flex; align-items: center; gap: 0.75rem;
    width: 100%; background: none; border: none; cursor: pointer;
    font-family: inherit; padding: 1.15rem 1.35rem; text-align: left;
    transition: background 0.15s;
}
.meter-header:hover { background: var(--stone-deep); }
.meter-header h2 {
    font-size: 1.35rem;
    color: var(--teal-deep);
}
[data-theme="dark"] .meter-header h2 { color: var(--teal); }
.meter-alert {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--warning-bg);
    color: var(--terracotta);
    padding: 0.25rem 0.65rem;
    border-radius: 0.35rem;
}
.meter-content {
    margin: 0;
    padding: 0 1.35rem 1.35rem;
    border-top: 1px solid var(--border);
    padding-top: 1.15rem;
}
.meter-content[hidden] { display: none !important; }

.input-group {
    display: flex; flex-direction: column; gap: 0.5rem;
    margin-bottom: 1rem; align-items: flex-start;
}
@media (min-width: 576px) {
    .input-group { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
.input-group label { font-weight: 600; min-width: 80px; color: var(--teal-dark); }
.input-group input { flex: 1; min-width: 140px; }
.input-group input:disabled { opacity: 0.7; }

.diff-badge {
    font-size: 0.75rem; font-weight: 600;
    padding: 0.2rem 0.55rem; border-radius: 0.35rem;
}
.diff-up { background: var(--warning-bg); color: #8a4a2e; }
.diff-down { background: var(--success-bg); color: var(--olive); }

.meter-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

.status-message { padding: 0.75rem; border-radius: var(--radius); margin-top: 0.75rem; font-weight: 500; }
.status-success { background: var(--success-bg); color: var(--olive); border-left: 3px solid var(--olive); }
.status-locked { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.status-info { background: rgba(27, 107, 147, 0.1); color: var(--teal-dark); border-left: 3px solid var(--teal); }

.chart-section { margin: 0; }
.section-title {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
    color: var(--teal-deep);
}
[data-theme="dark"] .section-title { color: var(--teal); }
.chart-wrap {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-top: 1rem;
}
[data-theme="dark"] .chart-wrap { background: var(--bg-card); }

.pdf-section {
    text-align: left;
    margin: 0;
    padding-top: 0;
    border-top: none;
}

/* —— Mobile bar —— */
.mobile-bar {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--teal-deep);
    color: var(--stone);
    padding: 0.85rem 1.15rem;
    justify-content: space-between; align-items: center;
    font-size: 0.875rem; z-index: 100;
    box-shadow: 0 -4px 16px rgba(28, 25, 23, 0.12);
}
@media (max-width: 768px) {
    .mobile-bar { display: flex; }
    body { padding-bottom: 4.5rem; }
    .site-nav .btn:not(.btn-icon):not(.blue) { display: none; }
}

/* —— Footer —— */
.footer {
    margin-top: 0;
    text-align: center;
    color: var(--muted-light);
    font-size: 0.8rem;
    padding: 2rem 1.5rem 2.5rem;
    border-top: 1px solid var(--border);
    background: var(--stone-deep);
}
.footer p { margin: 0; line-height: 1.6; }
.footer-credit {
    color: var(--teal-dark);
    font-weight: 600;
    text-decoration: none;
}
[data-theme="dark"] .footer { background: #0d1215; }
.glow-text { color: var(--teal); font-weight: 600; }

/* —— Login modal —— */
.login-modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 61, 86, 0.55);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}
.login-modal:not([hidden]) {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.login-modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    background: var(--bg-card);
    animation: modalSlideIn 0.25s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}
.modal-close:hover {
    background: var(--stone-deep);
    color: var(--text);
}

.login-modal-header {
    text-align: center;
    padding: 2rem 1.75rem 1.25rem;
    background: linear-gradient(180deg, var(--stone-deep) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
}
.login-modal-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--teal);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.login-modal-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}
.login-modal-header h3 {
    font-size: 1.45rem;
    color: var(--teal-deep);
    margin: 0 0 0.25rem;
}
[data-theme="dark"] .login-modal-header h3 { color: var(--teal); }
.login-modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.login-modal-form {
    padding: 1.5rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.modal-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--teal-dark);
    letter-spacing: 0.02em;
}
.modal-field input {
    width: 100%;
    height: 2.75rem;
    padding: 0 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
.modal-field input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(27, 107, 147, 0.15);
}

.login-alert {
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}
.login-alert[hidden] { display: none !important; }
.login-alert.is-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(161, 62, 62, 0.2);
}
.login-alert.is-success {
    background: var(--success-bg);
    color: var(--olive);
    border: 1px solid rgba(92, 122, 74, 0.25);
}
.login-alert.is-info {
    background: rgba(27, 107, 147, 0.1);
    color: var(--teal-dark);
    border: 1px solid rgba(27, 107, 147, 0.2);
}

.login-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.25rem;
}
.btn-login-submit {
    width: 100%;
    height: 2.75rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-login-cancel {
    width: 100%;
    height: 2.5rem;
    background: transparent;
    border: 1px solid var(--border);
    box-shadow: none;
    color: var(--text-muted);
}
.btn-login-cancel:hover {
    background: var(--stone-deep);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.text-error { color: var(--danger); }
.text-success { color: var(--olive); }
.text-info { color: var(--teal); }

/* —— Cards (admin interaction surfaces) —— */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .card { background: var(--bg-card); }
.card-title {
    font-size: 1.35rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--teal-deep);
}
[data-theme="dark"] .card-title { color: var(--teal); }
.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: -0.5rem 0 1.25rem;
    line-height: 1.45;
}
.danger-zone { background: var(--danger-bg); border-color: rgba(161, 62, 62, 0.35); }
.danger-zone .card-title { color: var(--danger); }

.message-container {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-weight: 500;
    animation: fadeUp 0.3s ease;
}
.message-success { background: var(--success-bg); color: var(--olive); border-left: 3px solid var(--olive); }
.message-error { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }

.month-calendar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}
@media (min-width: 576px) {
    .month-calendar { grid-template-columns: repeat(12, 1fr); }
}
.month-cell {
    display: flex; align-items: center; justify-content: center;
    padding: 0.65rem 0.25rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    color: var(--text);
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.month-cell:hover { transform: translateY(-1px); border-color: var(--teal); }
.month-cell.active {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}
.status-empty { background: var(--bg-card); opacity: 0.65; }
.status-partial { background: var(--warning-bg); border-color: var(--terracotta); color: #8a4a2e; }
.status-complete { background: var(--success-bg); border-color: var(--olive); color: var(--olive); }

.calendar-legend {
    display: flex; gap: 1rem; flex-wrap: wrap;
    margin-top: 1rem; font-size: 0.8rem; color: var(--text-muted);
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.25rem; vertical-align: middle; }
.dot-empty { background: var(--border); }
.dot-partial { background: var(--terracotta); }
.dot-complete { background: var(--olive); }

.lock-status {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.65rem; border-radius: 0.35rem;
    font-size: 0.8rem; font-weight: 600;
    font-family: var(--font-body);
}
.status-unlocked { background: var(--success-bg); color: var(--olive); }
.inline-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.form-row {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.75rem; margin-bottom: 1rem;
}
.form-row > label:first-child { min-width: 160px; font-weight: 600; color: var(--teal-dark); }
.form-row input[type="number"],
.form-row input[type="text"],
.form-row input[type="password"] { flex: 1; min-width: 120px; }

.form-actions {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* Admin — režije */
.rezija-section { margin-bottom: 2rem; }
.rezija-section-heading {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.rezija-section-heading h3 {
    font-size: 1.45rem;
    color: var(--teal-deep);
    margin-bottom: 0.35rem;
}
[data-theme="dark"] .rezija-section-heading h3 { color: var(--teal); }
.rezija-section-heading p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.rezija-cards-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.rezija-card {
    margin-bottom: 0 !important;
    padding: 0;
    overflow: hidden;
}
.rezija-card.has-file { border-color: var(--olive); }
.rezija-card.is-paid {
    box-shadow: inset 3px 0 0 var(--olive), var(--shadow-sm);
}

.form-actions-card {
    display: flex;
    justify-content: flex-end;
    padding: 1.15rem 1.35rem;
    margin-bottom: 0 !important;
    background: var(--stone-deep);
    border-style: solid;
}
.form-actions-card .btn { min-width: 200px; }

.rezija-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    background: var(--stone-deep);
    border-bottom: 1px solid var(--border);
}

.rezija-item-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.rezija-item-title h4 {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--teal-deep);
    margin: 0;
}
[data-theme="dark"] .rezija-item-title h4 { color: var(--teal); }
.rezija-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: var(--radius);
    background: var(--teal);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rezija-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.mini-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 0.35rem;
    white-space: nowrap;
}
.mini-amount { background: rgba(27, 107, 147, 0.12); color: var(--teal-dark); }
.mini-paid { background: var(--success-bg); color: var(--olive); }
.mini-unpaid { background: var(--danger-bg); color: var(--danger); }

.rezija-item-body {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.25rem 1.5rem;
    padding: 1.35rem 1.25rem 1.5rem;
    align-items: start;
    background: var(--bg-card);
}
@media (min-width: 768px) {
    .rezija-item-body {
        grid-template-columns: 160px 180px 1fr;
    }
}

.rezija-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.rezija-field > label:first-child {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.rezija-field input[type="number"] {
    width: 100%;
    max-width: 160px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.rezija-field-check { justify-content: center; }
.rezija-field-check .checkbox-label {
    font-size: 0.875rem;
    padding-top: 0.15rem;
}

.rezija-field-upload {
    grid-column: 1 / -1;
    padding-top: 1.15rem;
    margin-top: 0.35rem;
    border-top: 1px dashed var(--border);
}
@media (min-width: 768px) {
    .rezija-field-upload { grid-column: auto; }
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--stone-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.file-preview-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}
.file-preview-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--teal);
    color: white;
    border-radius: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.file-preview-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.file-preview-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}
.file-preview-link {
    font-size: 0.8rem;
    color: var(--teal);
    font-weight: 600;
    text-decoration: none;
}
.file-preview-link:hover { text-decoration: underline; }

.drop-zone {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: background 0.15s, border-color 0.15s;
}
.drop-zone.drag-over {
    background: var(--success-bg);
    border-color: var(--olive);
}
.drop-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.85rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
}
.drop-label .icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--teal);
    margin-bottom: 0.15rem;
}
.drop-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--teal);
}
.drop-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.drop-zone.has-selected {
    border-color: var(--teal);
    border-style: solid;
    background: rgba(27, 107, 147, 0.06);
}
.drop-zone.has-selected .drop-text { color: var(--olive); }

.checkbox-label {
    display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    min-width: auto !important;
}

.reset-section { display: flex; gap: 1rem; flex-wrap: wrap; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.stat-box {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--muted-light);
}
.stat-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--teal-deep);
    margin-top: 0.25rem;
}
[data-theme="dark"] .stat-value { color: var(--teal); }

/* Log table */
.log-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    margin-top: 1.5rem;
}
[data-theme="dark"] .log-table { background: var(--bg-card); }
.table-header, .table-row {
    display: grid;
    grid-template-columns: 170px 130px 90px 90px 1fr;
    padding: 0.75rem 1rem;
    align-items: center;
    font-size: 0.85rem;
}
.table-header {
    background: var(--teal-deep);
    color: var(--stone);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table-row { border-bottom: 1px solid var(--stone-deep); }
.table-row:nth-child(even) { background: rgba(27, 107, 147, 0.03); }
.log-role { padding: 0.15rem 0.5rem; border-radius: 0.25rem; font-size: 0.7rem; font-weight: 700; }
.role-admin { background: var(--danger); color: white; }
.role-user { background: var(--teal); color: white; }
.empty-log { padding: 2rem; text-align: center; color: var(--text-muted); }

@media (max-width: 900px) {
    .table-header { display: none; }
    .table-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .table-row div::before {
        content: attr(data-label) ': ';
        font-weight: 600; color: var(--teal);
    }
}

/* Print / PDF report */
.print-page body,
body.print-page {
    background: white;
    padding: 1rem;
}
.report-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.report-header .title {
    font-size: 1.75rem;
    color: var(--teal-deep);
}
.report-header .period { color: var(--text-muted); margin-top: 0.25rem; }
.meter-info {
    background: var(--stone-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.meter-info h3 { margin-bottom: 0.75rem; }
.report-footer { margin-top: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.signature-line { margin-top: 2rem; font-style: italic; }
.actions { text-align: center; margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

@media print {
    body { background: white !important; padding: 0 !important; }
    .container { border: none; box-shadow: none; padding: 0; }
    .hero, .site-nav, .container::before, .no-print, .actions, .header-actions, .mobile-bar, .footer { display: none !important; }
    .expenses-table th { background: #eee !important; color: black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 768px) {
    .hero { min-height: 70vh; padding: 5.5rem 1.25rem 3.5rem; }
    .page { padding: 0 1.25rem 3rem; }
    .container { padding: 1.25rem 1.25rem 2.5rem; }
    h1 { font-size: 1.5rem; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; }
    .btn { width: auto; }
    .form-row { flex-direction: column; align-items: stretch; }
    .form-row > label:first-child { min-width: auto; }
    .month-calendar { grid-template-columns: repeat(4, 1fr); }
    .rezija-item-body { grid-template-columns: 1fr; }
    .rezija-field input[type="number"] { max-width: none; }
    .rezija-field-upload { grid-column: 1; }
    .form-actions-card .btn { width: 100%; min-width: 0; }
}

/* Compact admin top bar without full hero */
.admin-top {
    background: linear-gradient(135deg, var(--teal-deep) 0%, var(--teal) 100%);
    color: var(--stone);
    padding: 1.75rem 1.5rem 1.5rem;
}
.admin-top-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 768px) {
    .admin-top-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}
.admin-top h1 {
    color: var(--stone);
    font-size: 1.75rem;
    margin-bottom: 0.2rem;
}
.admin-top .subtitle { color: rgba(247, 245, 242, 0.75); }
.admin-top .header-actions .btn {
    box-shadow: none;
}
.admin-top .btn.blue {
    background: var(--stone);
    color: var(--teal-deep);
    border-color: var(--stone);
}
.admin-top .btn:not(.blue) {
    background: transparent;
    color: var(--stone);
    border-color: rgba(247, 245, 242, 0.35);
}
.admin-top .btn:not(.blue):hover {
    background: rgba(247, 245, 242, 0.12);
    transform: none;
}
.admin-top .btn.blue:hover {
    background: var(--white);
}

.password-form { margin-bottom: 0.5rem; }
.password-form-title {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--teal-dark);
    margin: 0 0 0.85rem;
}
.password-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* —— Login page —— */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        linear-gradient(165deg,
            rgba(15, 61, 86, 0.94) 0%,
            rgba(27, 107, 147, 0.88) 55%,
            rgba(196, 112, 75, 0.4) 100%),
        #0F3D56;
}
.login-shell {
    width: 100%;
    max-width: 400px;
}
.login-card {
    background: var(--stone);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: fadeUp 0.45s ease;
}
.login-card-header {
    text-align: center;
    padding: 2rem 1.75rem 1.25rem;
    background: linear-gradient(180deg, var(--stone-deep) 0%, var(--stone) 100%);
    border-bottom: 1px solid var(--border);
}
.login-card-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--teal-deep);
    color: var(--stone);
    border-radius: var(--radius);
}
.login-card-icon svg { width: 1.4rem; height: 1.4rem; }
.login-card-header h1 {
    font-size: 1.65rem;
    color: var(--teal-deep);
    margin: 0 0 0.3rem;
}
.login-card-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.login-form {
    padding: 1.5rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-card .login-alert {
    margin: 1rem 1.75rem 0;
}
.login-foot {
    text-align: center;
    margin-top: 1.25rem;
    color: rgba(247, 245, 242, 0.65);
    font-size: 0.8rem;
}
.login-page .btn-login-submit {
    width: 100%;
    height: 2.75rem;
    margin-top: 0.25rem;
}
