* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top left, rgba(15, 76, 129, 0.16), transparent 32%), #f1f4f8;
    color: #14233c;
}
header {
    background: linear-gradient(135deg, #0f4c81 0%, #163e78 100%);
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 10px 30px rgba(15, 28, 52, 0.12);
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand img {
    width: 60px;
    height: auto;
    border-radius: 16px;
    background: rgba(255,255,255,0.12);
    padding: 8px;
}
.brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.brand-tagline {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.82);
}
nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}
nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}
nav a:hover,
nav a.active {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    flex-wrap: wrap;
}
.header-right a.logout-link {
    color: #fff;
    background: rgba(255,255,255,0.12);
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}
.header-right a.logout-link:hover {
    background: rgba(255,255,255,0.2);
}
.header-right .user-welcome {
    color: rgba(255,255,255,0.9);
}
main {
    max-width: 1180px;
    margin: 28px auto;
    padding: 0 18px 40px;
}
.page-header h1 {
    margin: 0 0 24px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    letter-spacing: -0.03em;
}
.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.search-form input[type="text"],
.search-form input[type="date"] {
    flex: 1;
    min-width: 180px;
    padding: 12px 14px;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 28, 52, 0.06);
}
.search-form button {
    background: #d93939;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease;
}
.search-form button:hover {
    background: #b42f2f;
    transform: translateY(-1px);
}
.login-container {
    max-width: 460px;
    margin: 40px auto;
    padding: 28px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 28, 52, 0.08);
}
.login-container h2 {
    margin: 0 0 20px;
    font-size: 1.5rem;
    color: #0f4c81;
}
.login-form {
    display: grid;
    gap: 16px;
}
.login-form label {
    font-weight: 600;
}
.login-form .checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #c7cbd1;
    border-radius: 8px;
    font-size: 1rem;
}
.login-form button {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: #0f4c81;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
.login-form button:hover {
    background: #0b3560;
}
.table-wrapper {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #d8dee4;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 28, 52, 0.08);
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f5;
}
th {
    background: #f1f5f9;
    font-weight: 700;
}
tr:last-child td {
    border-bottom: none;
}
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #d93939;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease;
}
.button-link:hover {
    background: #b42f2f;
    transform: translateY(-1px);
}
.summary-box {
    display: grid;
    gap: 16px;
    margin: 24px 0;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card {
    background: #fff;
    padding: 20px;
    border: 1px solid rgba(15, 28, 52, 0.08);
    border-radius: 18px;
    box-shadow: 0 14px 42px rgba(15, 28, 52, 0.06);
}
.card h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}
.card p {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
}
.chart-card {
    margin: 24px 0;
    padding: 22px;
    background: #fff;
    border: 1px solid rgba(15, 28, 52, 0.08);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 28, 52, 0.05);
}
.chart-card h2 {
    margin: 0 0 18px;
    font-size: 1.2rem;
}
.chart-legend {
    display: flex;
    gap: 18px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #0f4c81;
}
.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-block;
}
.legend-color.faturuar {
    background: #d93939;
}
.legend-color.inkasuar {
    background: #219653;
}
.column-chart {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.column-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 110px;
}
.column-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 240px;
    padding: 12px 0 0;
    border-left: 1px solid #e4e9ee;
    border-bottom: 1px solid #e4e9ee;
}
.column-bar {
    width: 36px;
    border-radius: 8px 8px 0 0;
    background: #d93939;
    transition: opacity 0.2s ease;
}
.column-bar.inkasuar {
    background: #219653;
}
.column-label {
    margin-top: 12px;
    font-weight: 700;
    color: #0f4c81;
}
.column-percent {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #4d5769;
}
.pagination {
    margin: 24px 0 0;
    text-align: center;
}
.pagination ul {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.pagination li {
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d9e2ec;
    text-decoration: none;
    color: #0f4c81;
    background: #fff;
}
.pagination a:hover {
    background: #eff4fb;
}
.pagination li.active span {
    background: #0f4c81;
    color: #fff;
    border-color: #0f4c81;
}
.summary-row td {
    font-weight: 700;
    background: #f5f7fa;
}
.success {
    margin: 18px 0;
    padding: 16px;
    background: #e6f7e8;
    border: 1px solid #9ed4a7;
    color: #1d6a2a;
    border-radius: 12px;
}
.error {
    margin: 18px 0;
    padding: 16px;
    background: #ffe4e1;
    border: 1px solid #f0b4b1;
    color: #8b1a1a;
    border-radius: 12px;
}
footer {
    text-align: center;
    padding: 22px 16px;
    color: #5c6975;
}

/* New styles for invoice management features */
.form-container {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(15, 28, 52, 0.08);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.edit-form h2 {
    margin-top: 0;
    color: #0f4c81;
    font-size: 1.4rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    color: #1a2940;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 14px;
    border: 1px solid #d0d7e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #0f4c81;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.form-buttons button,
.form-buttons a {
    flex: 1;
    padding: 11px 16px;
    text-align: center;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.form-buttons button {
    background: #0f4c81;
    color: #fff;
}

.form-buttons button:hover {
    background: #0a3454;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
}

.form-buttons a {
    background: #e0e7f1;
    color: #1a2940;
}

.form-buttons a:hover {
    background: #d0d7e0;
}

.delete-btn {
    background: #d32f2f !important;
    color: #fff !important;
}

.delete-btn:hover {
    background: #b71c1c !important;
}

.success {
    margin: 18px 0;
    padding: 16px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
    border-radius: 12px;
}

details {
    margin: 8px 0;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f4c81;
}

details pre {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 8px 0 0 0;
}

@media (max-width: 780px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    nav ul {
        justify-content: center;
    }
    .search-form {
        flex-direction: column;
    }
    .search-form button {
        width: 100%;
    }
    .column-chart {
        overflow-x: auto;
    }
    .form-buttons {
        flex-direction: column;
    }
    .form-buttons a,
    .form-buttons button {
        width: 100%;
    }
}

.hero-card {
    background: linear-gradient(135deg, rgba(15, 76, 129, 0.95), rgba(217, 57, 57, 0.9));
    color: #fff;
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 22px;
    box-shadow: 0 20px 50px rgba(15, 28, 52, 0.14);
}

.hero-card h1 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 2rem;
}

.hero-card p {
    margin: 0 0 8px;
    line-height: 1.6;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0;
}

.checkbox-field input {
    margin-top: 4px;
}

.status-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    background: #eef2f5;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="number"],
.inline-form input[type="text"],
.inline-form select {
    padding: 8px 10px;
    border: 1px solid #d0d7e0;
    border-radius: 8px;
}

.inline-form button {
    padding: 8px 12px;
    border: none;
    background: #0f4c81;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.report-card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 18px 45px rgba(15, 28, 52, 0.08);
}

.report-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 2px solid #d93939;
    padding-bottom: 14px;
}

.report-title {
    margin: 0;
    color: #0f4c81;
}

.report-meta {
    color: #4d5769;
    font-weight: 600;
}

.report-list table {
    min-width: 100%;
}

.print-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.print-actions a,
.print-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.print-actions a {
    background: #0f4c81;
    color: #fff;
}

.print-actions button {
    background: #d93939;
    color: #fff;
}

@media print {
    header, nav, .print-actions, footer {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .report-card {
        box-shadow: none;
        padding: 0;
    }
}

pre {
    white-space: pre-wrap;
    font-family: Consolas, 'Courier New', monospace;
    line-height: 1.5;
}
