* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f4f8fb;
    color: #263238;
}

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

.login-card {
    width: 390px;
    background: #fff;
    padding: 32px;
    border-radius: 18px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.10);
}

.login-card h2 {
    margin: 0 0 8px;
    color: #145374;
    text-align: center;
}

.login-card p {
    margin: 0 0 25px;
    text-align: center;
    color: #78909c;
    font-size: 14px;
}

.app {
    min-height: 100vh;
}

.topbar {
    background: linear-gradient(135deg, #d9efff, #eef8ff);
    padding: 18px 28px;
    border-bottom: 1px solid #d6eaf5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    color: #145374;
    font-size: 23px;
}

.user-info {
    font-size: 14px;
    color: #607d8b;
}

.layout {
    display: flex;
}

.sidebar {
    width: 245px;
    background: #ffffff;
    min-height: calc(100vh - 70px);
    border-right: 1px solid #e1edf3;
    padding: 18px;
}

.menu-btn {
    display: block;
    width: 100%;
    border: none;
    background: #f5fbff;
    color: #176b87;
    padding: 13px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.menu-group {
    margin-bottom: 10px;
}

.menu-group .menu-btn {
    margin-bottom: 0;
}

.menu-group summary {
    list-style: none;
}

.menu-group summary::-webkit-details-marker {
    display: none;
}

.menu-group summary::after {
    content: "v";
    float: right;
    font-size: 12px;
}

.menu-group[open] summary::after {
    content: "^";
}

.submenu-btn {
    display: block;
    width: calc(100% - 18px);
    margin: 8px 0 0 18px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef8ff;
    color: #176b87;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.submenu-btn:hover {
    background: #d9efff;
}

.menu-btn:hover,
body[data-page="dashboard"] .menu-dashboard,
body[data-page="data-entry"] .menu-data-entry,
body[data-page="report"] .menu-report,
body[data-page="agenda"] .menu-agenda,
body[data-page="kpi-options"] .menu-kpi-options {
    background: #219ebc;
    color: #fff;
}

.content {
    flex: 1;
    padding: 25px;
}

.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    margin-bottom: 22px;
    overflow: hidden;
}

.card-header {
    background: #eaf7ff;
    padding: 17px 22px;
    border-bottom: 1px solid #dceef7;
}

.card-header h2 {
    margin: 0;
    color: #145374;
    font-size: 20px;
}

.card-body {
    padding: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

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

label {
    font-size: 13px;
    font-weight: 600;
    color: #455a64;
    margin-bottom: 6px;
}

input, select, textarea {
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    background: #fbfdff;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100,181,246,0.15);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.section-title {
    margin: 20px 0 12px;
    color: #176b87;
    font-size: 18px;
    border-left: 5px solid #8ecae6;
    padding-left: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th {
    background: #f0f7fb;
    color: #37474f;
    font-size: 14px;
    text-align: left;
    padding: 13px 15px;
    border-bottom: 1px solid #dce5ea;
}

td {
    padding: 13px 15px;
    border-bottom: 1px solid #eef3f6;
    font-size: 14px;
    vertical-align: middle;
}

tr:hover {
    background: #fbfdff;
}

.status-cell {
    width: 160px;
    text-align: center;
}

.check-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eef8ff;
    padding: 7px 12px;
    border-radius: 20px;
    color: #176b87;
    font-weight: 600;
    font-size: 13px;
}

.check-wrap input {
    width: 17px;
    height: 17px;
    accent-color: #219ebc;
}

.btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

button,
.button-link {
    border: none;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #219ebc;
    color: white;
}

.btn-secondary {
    background: #e9eef2;
    color: #455a64;
}

.btn-danger {
    background: #ffebee;
    color: #c62828;
}

.btn-small {
    padding: 7px 12px;
    font-size: 12px;
}

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 700;
}

.badge-checked {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-unchecked {
    background: #fff3e0;
    color: #ef6c00;
}

.summary-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.summary-box {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
}

.summary-box h3 {
    margin: 0;
    font-size: 26px;
    color: #145374;
}

.summary-box p {
    margin: 5px 0 0;
    color: #78909c;
    font-size: 14px;
}

.message {
    margin-bottom: 16px;
    color: #176b87;
    font-weight: 600;
}

.message.error {
    color: #c62828;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(38, 50, 56, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}

.modal {
    width: min(620px, 100%);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    overflow: hidden;
}

.modal-wide {
    width: 80vw;
    max-width: 80vw;
}

.kpi-edit-grid {
    grid-template-columns: 1fr 7fr 1fr 1fr;
}

.modal-header {
    background: #eaf7ff;
    padding: 17px 22px;
    border-bottom: 1px solid #dceef7;
}

.modal-header h2 {
    margin: 0;
    color: #145374;
    font-size: 20px;
}

.modal-body {
    padding: 22px;
}

@media (max-width: 1000px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        min-height: auto;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .menu-btn { margin-bottom: 0; }
    .form-grid, .form-grid-3, .summary-boxes { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
    .form-grid, .form-grid-3, .summary-boxes, .sidebar { grid-template-columns: 1fr; }
    .content { padding: 15px; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .modal-wide {
        width: 100%;
        max-width: 100%;
    }
    .kpi-edit-grid {
        grid-template-columns: 1fr;
    }
}
