:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar: #182b45;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #cbd5e1;
    --danger: #dc2626;
    --success: #16a34a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #182b45, #315c91);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    padding: 36px;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
    margin: 0 0 12px;
    text-align: center;
    color: var(--sidebar);
    font-size: 32px;
}

.login-card p {
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text);
    font-size: 15px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: var(--primary-hover);
}

.login-card button {
    width: 100%;
}

.login-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.alert {
    padding: 12px;
    margin-bottom: 18px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: var(--danger);
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }
}
/* Main application layout */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--sidebar);
    color: white;
    padding: 24px 18px;
}

.sidebar h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

.sidebar p {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 30px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar nav a {
    display: block;
    padding: 12px 14px;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

.sidebar nav a:hover {
    background: #334e70;
}

.sidebar nav a.active {
    background: var(--primary);
    color: white;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 18px 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.topbar span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 5px;
}

.topbar form {
    margin: 0;
}

.main-content h1 {
    margin-bottom: 10px;
}

.main-content > p {
    color: var(--muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit, minmax(230px, 1fr)
    );
    gap: 20px;
    margin-top: 30px;
}

.dashboard-card {
    display: block;
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--primary);
    text-decoration: none;
    color: var(--text);
    transition: 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.dashboard-card h3 {
    margin: 0 0 12px;
    color: var(--sidebar);
}

.dashboard-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #cbd5e1;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .main-content {
        padding: 16px;
    }

    .topbar {
        padding: 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
/* Database tables */

.table-container {
    width: 100%;
    overflow-x: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 25px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.data-table th {
    padding: 16px;
    background: var(--sidebar);
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #e8f0ff;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
}

.pagination a {
    padding: 10px 18px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
}

.pagination a:hover {
    background: var(--primary-hover);
}

.pagination span {
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .data-table {
        font-size: 13px;
    }
}
/* Data entry forms */

.form-card {
    max-width: 700px;
    background: white;
    padding: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 25px;
}

.form-card p {
    color: var(--muted);
    font-size: 13px;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.form-actions a,
.topbar a {
    padding: 12px 20px;
    background: #e2e8f0;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

.form-actions a:hover,
.topbar a:hover {
    background: #cbd5e1;
}

@media (max-width: 768px) {
    .form-card {
        padding: 18px;
    }
}
/* Table action buttons */

.table-actions {
    white-space: nowrap;
}

.table-actions form {
    display: inline-block;
    margin: 0;
}

.btn-edit,
.btn-delete {
    display: inline-block;
    width: auto;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn-edit {
    background: var(--primary);
    margin-right: 5px;
}

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

.btn-delete {
    background: var(--danger);
}

.btn-delete:hover {
    background: #b91c1c;
}

@media (max-width: 768px) {
    .btn-edit,
    .btn-delete {
        padding: 7px 10px;
        font-size: 12px;
    }
}
/* Table search */

.search-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

.search-form input {
    flex: 1;
    min-width: 180px;
    max-width: 400px;
    margin: 0;
}

.search-form button {
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.btn-reset {
    display: inline-block;
    padding: 12px 18px;
    background: #e2e8f0;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

.btn-reset:hover {
    background: #cbd5e1;
}

@media (max-width: 768px) {
    .search-form input {
        flex-basis: 100%;
        max-width: 100%;
    }
}
/* Table filters */

.search-form .filter-select {
    width: auto;
    min-width: 180px;
    max-width: 300px;
    margin: 0;
    padding: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.search-form .filter-select:hover {
    border-color: var(--primary);
}

.search-form .filter-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

@media (max-width: 768px) {
    .search-form .filter-select {
        width: 100%;
        max-width: 100%;
    }
}
/* Audit log */

.audit-action {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    background: #e2e8f0;
    color: #475569;
}

.audit-login_success,
.audit-insert {
    background: #dcfce7;
    color: #15803d;
}

.audit-update {
    background: #dbeafe;
    color: #1d4ed8;
}

.audit-login_failed,
.audit-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.audit-logout {
    background: #e2e8f0;
    color: #475569;
}
/* Report export */

.form-actions .report-export {
    background: var(--success);
    color: white;
}

.form-actions .report-export:hover {
    background: #15803d;
}

/* Printable reports */

@media print {

    @page {
        size: A4 landscape;
        margin: 15mm;
    }

    body {
        background: white;
        color: black;
        font-size: 12px;
    }

    .sidebar,
    .topbar,
    .form-actions,
    .pagination,
    footer {
        display: none !important;
    }

    .layout {
        display: block;
        min-height: auto;
    }

    .main-content {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .table-container {
        overflow: visible;
        border: none;
        border-radius: 0;
    }

    .data-table {
        width: 100%;
        font-size: 11px;
        border-collapse: collapse;
    }

    .data-table th,
    .data-table td {
        background: white !important;
        color: black !important;
        border: 1px solid #999;
        padding: 8px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .data-table thead {
        display: table-header-group;
    }

    .data-table tr {
        break-inside: avoid;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 10px;
    }
}
