@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --navy: #1a3a2a;
    --navy-light: #234d38;
    --gold: #c9a84c;
    --gold-light: #e8c97a;
    --cream: #f4f7f5;
    --white: #ffffff;
    --green: #1a6b3a;
    --green-light: #e4f2ea;
    --red: #c0392b;
    --red-light: #fdecea;
    --gray: #7a8f84;
    --border: #d4e0d9;
    --shadow: 0 4px 24px rgba(26, 58, 42, 0.10);
    --shadow-lg: 0 8px 48px rgba(26, 58, 42, 0.18);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── CUSTOM SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--cream);
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--navy);
    min-height: 100vh;
}

/* ── LOGIN ANIMATIONS ─────────────────────────────── */
@keyframes loginBgIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes loginOrbFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-16px) scale(1.04);
    }
}

@keyframes logoCirclePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.45);
    }

    70% {
        box-shadow: 0 0 0 14px rgba(201, 168, 76, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(201, 168, 76, 0);
    }
}

@keyframes dividerExpand {
    from {
        width: 0;
        opacity: 0;
    }

    to {
        width: 48px;
        opacity: 1;
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* LOGIN SCREEN */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, #2d6b4a 100%);
    position: relative;
    overflow: hidden;
    animation: loginBgIn 0.6s ease both;
}

#loginScreen::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.13) 0%, transparent 70%);
    animation: loginOrbFloat 7s ease-in-out infinite;
}

#loginScreen::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.08) 0%, transparent 70%);
    animation: loginOrbFloat 9s ease-in-out infinite reverse;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 52px 48px;
    width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: loginCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1px;
    animation: loginCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both,
    logoCirclePulse 2.5s ease 1s;
}

.login-logo .brand {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.5px;
    animation: fadeSlideUp 0.5s ease 0.5s both;
}

.login-logo .brand span {
    color: var(--gold);
}

.login-logo .tagline {
    font-size: 12px;
    color: var(--gray);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
    animation: fadeSlideUp 0.5s ease 0.6s both;
}

.gold-divider {
    height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    margin: 16px auto;
    border-radius: 2px;
    animation: dividerExpand 0.6s ease 0.65s both;
}

.login-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--navy);
    animation: fadeSlideUp 0.5s ease 0.68s both;
}

.login-subtitle {
    font-size: 13px;
    color: var(--gray);
    text-align: center;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.5s ease 0.73s both;
}

.form-group {
    margin-bottom: 20px;
    animation: fadeSlideUp 0.5s ease 0.78s both;
}

.form-group+.form-group {
    animation-delay: 0.84s;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--navy);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--navy);
    background: var(--cream);
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--gold);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    animation: fadeSlideUp 0.5s ease 0.9s both;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(26, 39, 68, 0.3);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    display: none;
}

.contact-hint {
    display: none;
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(201, 168, 76, 0.10);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 10px;
    font-size: 12px;
    color: #7a5f1a;
    text-align: center;
    line-height: 1.5;
    animation: fadeSlideUp 0.4s ease;
}

.contact-hint a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.contact-hint a:hover {
    text-decoration: underline;
}

/* LOADING SPINNER */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* MAIN APP */
#mainApp {
    display: none;
}

.header {
    background: var(--navy);
    padding: 0 40px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 16px rgba(26, 39, 68, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
}

.header-brand span {
    color: var(--gold);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-client {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.header-client strong {
    color: var(--white);
    font-weight: 600;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-right: auto;
    margin-left: 40px;
}

.nav-item {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── SETTINGS PANEL ──────────────────────────────── */
.settings-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 520px;
}

.settings-card-header {
    background: var(--navy);
    border-radius: 16px 16px 0 0;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-card-header-icon {
    font-size: 22px;
}

.settings-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--white);
    font-weight: 600;
}

.settings-card-body {
    padding: 28px;
}

.settings-form-group {
    margin-bottom: 18px;
}

.settings-form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--navy);
    margin-bottom: 7px;
}

.settings-form-group input {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--navy);
    background: var(--cream);
    transition: all 0.2s;
    outline: none;
}

.settings-form-group input:focus {
    border-color: var(--gold);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.settings-error {
    display: none;
    background: var(--red-light);
    color: var(--red);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.settings-success {
    display: none;
    background: var(--green-light);
    color: var(--green);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-settings-save {
    padding: 13px 28px;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-settings-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26, 39, 68, 0.25);
}

.btn-settings-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(26, 58, 42, 0.2);
    transform: translateY(-1px);
}

/* STATS */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--white);
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.total {
    border-left-color: var(--navy);
}

.stat-card.pending {
    border-left-color: var(--gold);
}

.stat-card.approved {
    border-left-color: var(--green);
}

.stat-card.rejected {
    border-left-color: var(--red);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--navy);
}

.stat-sub {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* SECTION */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--navy);
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-tab {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--gray);
    font-family: 'DM Sans', sans-serif;
}

.filter-tab.active {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* INVOICE TABLE */
.invoice-table {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.invoice-table-header {
    display: grid;
    grid-template-columns: 1.6fr 1.1fr 0.85fr 0.75fr 0.95fr 0.9fr 0.9fr 1.85fr;
    column-gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Każda komórka nagłówka i wiersza ma własny niezależny grid (osobny <div>),
   więc bez min-width:0 dłuższa treść w wierszu poszerza jego kolumnę ponad
   wartość fr i wizualnie "wycieka" do sąsiedniej komórki, rozjeżdżając się
   względem nagłówka. min-width:0 + ellipsis trzyma treść w granicach kolumny. */
.invoice-table-header>*,
.invoice-row>* {
    min-width: 0;
}

.invoice-table-header .sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    white-space: nowrap;
}

.invoice-table-header .num-col {
    justify-content: flex-end;
}

.invoice-table-header .sortable:hover {
    color: var(--gold-light);
}

.sort-icon {
    font-size: 10px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.sort-icon.sort-active {
    opacity: 1;
    color: var(--gold-light);
}

.invoice-row {
    display: grid;
    grid-template-columns: 1.6fr 1.1fr 0.85fr 0.75fr 0.95fr 0.9fr 0.9fr 1.85fr;
    column-gap: 10px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.invoice-row:last-child {
    border-bottom: none;
}

.invoice-row:hover {
    background: #f5f8f6;
    box-shadow: inset 3px 0 0 var(--navy);
}

.invoice-row.approved {
    background: rgba(26, 107, 58, 0.03);
}

.invoice-row.rejected {
    background: rgba(192, 57, 43, 0.03);
}

/* Podświetlanie nieopłaconych */
.invoice-row.row-unpaid {
    border-left: 3px solid #f39c12;
}

.invoice-row.row-unpaid-overdue {
    border-left: 3px solid var(--red);
    background: rgba(192, 57, 43, 0.04) !important;
}

.invoice-row.row-paid {
    border-left: 3px solid var(--green);
}

.vendor-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 16px;
}

.invoice-doc {
    min-width: 0;
    overflow: hidden;
}

.invoice-number {
    font-size: 13px;
    color: var(--navy);
    font-family: monospace;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-date {
    font-size: 12px;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.num-col {
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 4px;
}

.invoice-amount {
    font-weight: 700;
    font-size: 15px;
    color: var(--navy);
    font-family: 'Playfair Display', serif;
}

.invoice-net,
.invoice-vat {
    font-size: 13px;
    color: var(--gray);
    font-family: 'Playfair Display', serif;
}

.invoice-net.vat-adjusted,
.invoice-vat.vat-adjusted {
    background: rgba(241, 196, 15, 0.2);
    color: #8a6d1a;
    font-weight: 600;
    border-radius: 6px;
    padding: 3px 6px;
    margin: -3px -2px;
}

.invoice-vat.vat-adjusted i {
    font-size: 10px;
    color: #c9941a;
    margin-left: 3px;
}

.vat-adjusted-note {
    background: rgba(241, 196, 15, 0.12);
    border: 1px solid rgba(201, 148, 26, 0.35);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: #6b5410;
}

.vat-adjusted-note i {
    color: #c9941a;
    margin-right: 6px;
}

.due-date {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.due-overdue {
    color: var(--red);
    font-weight: 600;
}

.due-soon {
    color: #e67e22;
    font-weight: 500;
}

.due-ok {
    color: var(--gray);
}

.invoice-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-approved {
    background: var(--green-light);
    color: var(--green);
}

.status-rejected {
    background: var(--red-light);
    color: var(--red);
}

.btn-approve,
.btn-reject {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: 'DM Sans', sans-serif;
}

.btn-approve {
    background: var(--green-light);
    color: var(--green);
}

.btn-approve:hover {
    background: var(--green);
    color: var(--white);
    transform: scale(1.05);
}

.btn-reject {
    background: var(--red-light);
    color: var(--red);
}

.btn-reject:hover {
    background: var(--red);
    color: var(--white);
    transform: scale(1.05);
}

/* LOADING STATE */
.loading-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--gray);
}

.loading-state .big-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.loading-state p {
    font-size: 14px;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 39, 68, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: var(--navy);
    padding: 24px 32px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--white);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 32px;
}

.invoice-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.detail-field label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gray);
    display: block;
    margin-bottom: 6px;
}

.detail-field .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
}

.detail-field .value.amount {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
}

.pdf-preview {
    background: var(--cream);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.pdf-preview:hover {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.05);
}

.pdf-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.pdf-text {
    font-size: 14px;
    color: var(--gray);
}

.pdf-text strong {
    color: var(--navy);
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

/* PDF BUTTON W LIŚCIE */
.btn-pdf {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--gold);
    background: rgba(201, 168, 76, 0.08);
    color: #8a6914;
    cursor: pointer;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-pdf:hover {
    background: var(--gold);
    color: #fff;
}

.btn-pdf:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* PDF VIEWER MODAL */
#pdfModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 39, 68, 0.85);
    z-index: 300;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

#pdfModal.open {
    display: flex;
}

.pdf-modal-inner {
    background: var(--white);
    border-radius: 16px;
    width: 92vw;
    max-width: 900px;
    height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.pdf-modal-header {
    background: var(--navy);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pdf-modal-title {
    color: var(--white);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Playfair Display', serif;
}

.pdf-modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-pdf-download {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--gold);
    background: transparent;
    color: var(--gold);
    cursor: pointer;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.btn-pdf-download:hover {
    background: var(--gold);
    color: var(--navy);
}

.btn-pdf-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
}

.btn-pdf-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#pdfFrame {
    flex: 1;
    border: none;
    width: 100%;
}

.pdf-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--gray);
}

.pdf-loading .big-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.btn-modal-approve {
    flex: 1;
    padding: 14px;
    background: linear-gradient(135deg, #2d7a4f, #3a9962);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-modal-approve:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45, 122, 79, 0.35);
}

.btn-modal-reject {
    flex: 1;
    padding: 14px;
    background: var(--white);
    color: var(--red);
    border: 2px solid var(--red);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-modal-reject:hover {
    background: var(--red);
    color: var(--white);
    transform: translateY(-1px);
}

/* NOTICE */
.notice-banner {
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.12), rgba(201, 168, 76, 0.06));
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: #7a5f1a;
}

.notice-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* EMPTY / ERROR */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--gray);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--navy);
    margin-bottom: 8px;
}

/* FOOTER */
.footer {
    text-align: center;
    padding: 32px 40px;
    font-size: 12px;
    color: var(--gray);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* LINE ITEMS */
.line-items-header {
    display: grid;
    grid-template-columns: 1fr 80px 110px 36px;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gray);
    padding: 0 4px;
    margin-bottom: 6px;
}

.line-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 110px 36px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.line-item-row input {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: var(--navy);
    background: var(--cream);
    width: 100%;
    transition: border-color 0.2s;
}

.line-item-row input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--white);
}

.btn-remove-row {
    width: 36px;
    height: 36px;
    background: var(--red-light);
    border: 1.5px solid rgba(192, 57, 43, 0.25);
    border-radius: 8px;
    color: var(--red);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-row:hover {
    background: var(--red);
    color: #fff;
}

.btn-add-row {
    width: 100%;
    padding: 9px;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--gray);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-add-row:hover {
    border-color: var(--gold);
    color: var(--navy);
    background: rgba(201, 168, 76, 0.05);
}

.line-items-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1.5px solid var(--border);
    font-size: 14px;
    color: var(--gray);
}

.line-items-total strong {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--navy);
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--navy);
    color: var(--white);
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--green);
}

.toast.error {
    background: var(--red);
}

/* COOKIE BANNER */
.cookie-banner {
    position: fixed;
    bottom: -100px;
    /* starts hidden */
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -4px 24px rgba(26, 58, 42, 0.15);
    z-index: 500;
    display: flex;
    justify-content: center;
    padding: 16px;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cookie-banner.show {
    bottom: 0;
}

.cookie-content {
    max-width: 1100px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.cookie-text {
    font-size: 13px;
    color: var(--gray);
    line-height: 1.5;
}

.cookie-text strong {
    color: var(--navy);
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    margin-right: 8px;
}

.cookie-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.cookie-btn:hover {
    box-shadow: 0 4px 16px rgba(26, 39, 68, 0.25);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-table-header,
    .invoice-row {
        grid-template-columns: 1.8fr 1fr 1fr 1.6fr;
    }

    .invoice-table-header span:nth-child(2),
    .invoice-table-header span:nth-child(3),
    .invoice-table-header span:nth-child(4),
    .invoice-table-header span:nth-child(6),
    .invoice-row>*:nth-child(2),
    .invoice-row>*:nth-child(3),
    .invoice-row>*:nth-child(4),
    .invoice-row>*:nth-child(6) {
        display: none;
    }

    .main-content {
        padding: 24px 20px;
    }

    .header {
        padding: 0 20px;
    }

    .login-card {
        width: 90%;
        padding: 36px 28px;
    }

    .modal {
        width: 95%;
    }
}

/* ── URLOPY ── */
.leave-stat-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.leave-stat {
    background: var(--white);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: transform .2s;
}

.leave-stat:hover {
    transform: translateY(-2px);
}

.leave-stat.lv1 {
    border-left-color: var(--gold);
}

.leave-stat.lv2 {
    border-left-color: var(--green);
}

.leave-stat.lv3 {
    border-left-color: var(--blue);
}

.leave-stat.lv4 {
    border-left-color: var(--red);
}

.leave-table {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.lv-hdr {
    display: grid;
    grid-template-columns: 2fr 1.6fr 1.2fr 1fr 1.2fr 1.2fr;
    padding: 12px 22px;
    background: var(--navy);
    color: rgba(255, 255, 255, .75);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.lv-row {
    display: grid;
    grid-template-columns: 2fr 1.6fr 1.2fr 1fr 1.2fr 1.2fr;
    padding: 15px 22px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background .15s;
}

.lv-row:last-child {
    border-bottom: none;
}

.lv-row:hover {
    background: #faf9f7;
}

.lv-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.lv-type-wypoczynkowy {
    background: var(--green-light);
    color: var(--green);
}

.lv-type-zalegly {
    background: #fef3e7;
    color: #e67e22;
}

.lv-type-okolicznosciowy {
    background: var(--blue-light);
    color: var(--blue);
}

.lv-type-bezplatny {
    background: #f3e8ff;
    color: #7c3aed;
}

.lv-type-macierzynski {
    background: #fce7f3;
    color: #be185d;
}

.lv-type-rodzicielski {
    background: #fff7ed;
    color: #c2410c;
}

.lv-type-ojcowski {
    background: #eff6ff;
    color: #1d4ed8;
}

.lv-type-wychowawczy {
    background: #f0fdf4;
    color: #166534;
}

.lv-type-na_zadanie {
    background: #fefce8;
    color: #854d0e;
}

.lv-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.lv-pending {
    background: rgba(201, 168, 76, .15);
    color: #8a6914;
}

.lv-approved {
    background: var(--green-light);
    color: var(--green);
}

.lv-rejected {
    background: var(--red-light);
    color: var(--red);
}

.lv-row-actions {
    display: flex;
    gap: 6px;
}

.btn-lv-ok {
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--green-light);
    color: var(--green);
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.btn-lv-ok:hover {
    background: var(--green);
    color: #fff;
}

.btn-lv-rej {
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--red-light);
    color: var(--red);
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.btn-lv-rej:hover {
    background: var(--red);
    color: #fff;
}

.lv-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.lv-filter-tab {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--gray);
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
}

.lv-filter-tab.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* ── PRACOWNICY ── */
.emp-table {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.emp-hdr {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.4fr;
    padding: 12px 22px;
    background: var(--navy);
    color: rgba(255, 255, 255, .75);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.emp-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.4fr;
    padding: 15px 22px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background .15s;
}

.emp-row:last-child {
    border-bottom: none;
}

.emp-row:hover {
    background: #faf9f7;
}

.emp-name {
    font-weight: 600;
    font-size: 14px;
}

.saldo-mini {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
}

.saldo-mini.ok {
    color: var(--green);
}

.saldo-mini.warn {
    color: var(--orange);
}

.saldo-mini.low {
    color: var(--red);
}

.emp-actions {
    display: flex;
    gap: 6px;
}

.btn-emp {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: 'DM Sans', sans-serif;
    border: none;
}

.btn-emp.edit {
    background: var(--blue-light);
    color: var(--blue);
}

.btn-emp.edit:hover {
    background: var(--blue);
    color: #fff;
}

.btn-emp.del {
    background: var(--red-light);
    color: var(--red);
}

.btn-emp.del:hover {
    background: var(--red);
    color: #fff;
}

.code-box {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin: 16px 0;
}

.code-box .code-val {
    font-family: monospace;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #e8c97a;
    display: block;
    margin: 8px 0;
}

.code-box small {
    font-size: 12px;
    opacity: .7;
}

/* ── INVOICE TOOLBAR (wyszukiwarka + filtry) ─────────────────────── */
.invoice-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.invoice-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.invoice-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 14px;
    pointer-events: none;
}

.invoice-search {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    background: var(--white);
    color: var(--navy);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(26,58,42,0.06);
}

.invoice-search:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26,58,42,0.08);
}

/* Filter tab variants */
.filter-tab-unpaid {
    border-color: #f39c12 !important;
    color: #b07d10 !important;
}

.filter-tab-unpaid.active,
.filter-tab-unpaid:hover {
    background: #f39c12 !important;
    color: #fff !important;
    border-color: #f39c12 !important;
}

.filter-tab-paid {
    border-color: var(--green) !important;
    color: var(--green) !important;
}

.filter-tab-paid.active,
.filter-tab-paid:hover {
    background: var(--green) !important;
    color: #fff !important;
    border-color: var(--green) !important;
}

/* ── PAYMENT BUTTON ──────────────────────────────────────────────── */
.invoice-paid-cell {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.btn-payment {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
}

.btn-paid {
    background: var(--green-light);
    color: var(--green);
    border-color: var(--green);
}

.btn-paid:hover {
    background: var(--green);
    color: #fff;
}

.btn-unpaid {
    background: #fdecea;
    color: var(--red);
    border-color: var(--red);
}

.btn-unpaid:hover {
    background: var(--red);
    color: #fff;
}