/* ── Reset & base ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-h: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, .08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Tenant page ──────────────────────────────────────────────── */
.tenant-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.rent-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 3rem;
    width: 100%;
    max-width: 520px;
    text-align: center;
}

.rent-card h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: .25rem;
}

.rent-card .period {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2rem;
}

/* Główna kwota */
.total-amount {
    font-size: 3.2rem;
    /* ~51px – o 4pt większy niż składowe (32px) */
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    margin-bottom: .4rem;
}

.total-amount.paid-color {
    color: var(--success);
}

.paid-badge {
    display: inline-block;
    background: #dcfce7;
    color: var(--success);
    font-size: 1rem;
    font-weight: 700;
    padding: .35rem 1.1rem;
    border-radius: 99px;
    margin-bottom: 1.5rem;
    letter-spacing: .04em;
}

.due-date {
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.due-date strong {
    color: var(--text);
}

/* Składowe */
.components {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: left;
}

.components h3 {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.component-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    /* ~16px / approx 12pt */
}

.component-row:last-child {
    border-bottom: none;
}

.component-row .label {
    color: var(--text-muted);
}

.component-row .amount {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.component-row.interest .label {
    color: var(--danger);
}

.component-row.interest .amount {
    color: var(--danger);
}

/* Zaległości */
.arrears-box {
    margin-top: 1.5rem;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: .9rem;
    color: #713f12;
}

.arrears-box strong {
    display: block;
    margin-bottom: .25rem;
    font-size: .95rem;
}

/* ── Admin layout ─────────────────────────────────────────────── */
.admin-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    background: var(--primary);
    color: #fff;
    padding: .85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.topbar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .03em;
}

.topbar a {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-size: .9rem;
}

.topbar a:hover {
    color: #fff;
}

.admin-main {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: .75rem;
}

/* Month selector tabs */
.month-nav {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.month-nav a {
    padding: .4rem .85rem;
    border-radius: 6px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--primary);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s;
}

.month-nav a:hover,
.month-nav a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Summary table */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem 1.5rem;
    margin-bottom: 1.25rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-item .s-label {
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.summary-item .s-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.summary-item .s-value.green {
    color: var(--success);
}

.summary-item .s-value.red {
    color: var(--danger);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

label {
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type=text],
input[type=number],
input[type=date],
input[type=password],
select {
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    color: var(--text);
    background: #fff;
    transition: border-color .15s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

textarea {
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    color: var(--text);
    width: 100%;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.btn {
    display: inline-block;
    padding: .6rem 1.4rem;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, opacity .15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-h);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    font-size: .8rem;
    padding: .3rem .75rem;
}

.btn-danger:hover {
    opacity: .85;
}

.btn-sm {
    font-size: .82rem;
    padding: .3rem .7rem;
}

.form-actions {
    margin-top: 1.25rem;
}

/* Alerts */
.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Payments table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th {
    text-align: left;
    padding: .5rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--border);
}

td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Change password section */
.details {
    font-size: .85rem;
    color: var(--text-muted);
    cursor: pointer;
}