:root {
    --navy: #142337;
    --background: #f3f5f8;
    --text: #192638;
    --muted: #788496;
    --border: #e2e7ee;
    --primary: #2864dc;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.7px; }
h2 { font-size: 17px; margin: 0 0 18px; }
p { line-height: 1.6; }
.muted { color: var(--muted); }

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

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--navy);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.brand small {
    display: block;
    font-size: 11px;
    color: #a4b3c7;
    margin-top: 4px;
}

.menu-label {
    color: #8293a9;
    font-size: 10px;
    letter-spacing: 1.4px;
    padding: 0 12px 12px;
}

nav a {
    display: block;
    color: #b7c4d5;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 7px;
    text-decoration: none;
}

nav a:hover, nav a.active {
    background: #29415e;
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding: 30px 12px 0;
}

.logout {
    padding: 8px 0;
    background: transparent;
    color: #a4b3c7;
    text-align: left;
}

.main { flex: 1; min-width: 0; }

.topbar {
    min-height: 64px;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.status {
    font-size: 11px;
    color: #66758b;
    background: #edf1f6;
    border-radius: 20px;
    padding: 6px 12px;
}

.content {
    max-width: 1500px;
    padding: 30px;
    margin: auto;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 25px 0;
}

.metric, .panel, .notice {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
}

.metric span { color: var(--muted); }
.metric strong {
    display: block;
    font-size: 28px;
    margin: 14px 0;
}

.metric small, .year-row small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
}

.panel { margin-bottom: 20px; }

.notice {
    border-left: 4px solid var(--primary);
    margin-top: 24px;
}

.notice p { margin-bottom: 0; }

.year-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 17px 0;
    border-top: 1px solid var(--border);
}

.pending {
    background: #fff3dc;
    color: #996715;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #e9eef5;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    padding: 38px;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 15px 50px #14233712;
}

.login-card .brand-icon { margin-bottom: 25px; }
.login-card form { margin-top: 28px; }

label {
    display: block;
    font-weight: 600;
    margin: 18px 0 8px;
}

input {
    width: 100%;
    padding: 13px;
    border: 1px solid #d5dce6;
    border-radius: 8px;
    font-size: 15px;
}

input:focus {
    outline: 2px solid #2864dc44;
    border-color: var(--primary);
}

button {
    border: 0;
    border-radius: 8px;
    padding: 13px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
}

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

.error {
    background: #fff0f0;
    color: #a82929;
    padding: 12px;
    border-radius: 8px;
}

@media (max-width: 1100px) {
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .app { display: block; }
    .sidebar { width: 100%; padding: 16px; }
    .brand { margin-bottom: 16px; }
    .menu-label { display: none; }
    nav { display: flex; overflow-x: auto; gap: 5px; }
    nav a { white-space: nowrap; }
    .sidebar-footer { padding: 10px; }
    .content { padding: 16px; }
    .topbar { padding: 16px; }
    .metrics { gap: 10px; }
    .metric { padding: 14px; }
    .metric strong { font-size: 23px; }
}

textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d5dce6;
    border-radius: 8px;
    background: white;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.success {
    background: #e9f8ef;
    color: #167447;
    border: 1px solid #ccebd8;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.btn-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    padding: 10px 14px;
    font-weight: 600;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
