:root {
    --navy: #0a1f44;
    --navy-light: #16305e;
    --gold: #c9a227;
    --gold-light: #e0c15c;
    --bg: #f4f5f7;
    --text: #1c2333;
    --muted: #6b7280;
    --border: #e2e4e9;
    --success: #1d9e75;
    --danger: #d64545;
    --white: #ffffff;
}

* { box-sizing: border-box; }

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

/* Simple top bar for standalone public pages (track.php) */
.topbar {
    background: var(--navy);
    color: var(--white);
    padding: 14px 24px;
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .brand span { color: var(--gold); font-weight: 400; }

/* Standalone centered container - used by login.php and track.php (no sidebar) */
.container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ===== Layout shell: sidebar + main area ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .logo {
    padding: 22px 20px;
    font-size: 19px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar .logo span { color: var(--gold); font-weight: 400; }

.sidebar nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.sidebar nav a.active {
    background: rgba(255,255,255,0.08);
    border-left-color: var(--gold);
    color: var(--white);
    font-weight: 600;
}
.sidebar nav a .badge-soon {
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 400;
}

.sidebar .logout-link {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar .logout-link a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
}
.sidebar .logout-link a svg { width: 18px; height: 18px; }
.sidebar .logout-link a:hover { color: var(--white); }

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topheader {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topheader h1 { margin: 0; font-size: 20px; }

.top-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}
.top-actions .bell {
    color: var(--navy);
    cursor: default;
    opacity: 0.7;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.user-chip .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.content-container {
    padding: 28px;
    max-width: 1200px;
    width: 100%;
}

@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .logo { font-size: 0; padding: 22px 0; text-align: center; }
    .sidebar nav a span, .sidebar nav a .badge-soon { display: none; }
    .sidebar nav a { justify-content: center; padding: 14px; }
    .sidebar .logout-link a span { display: none; }
    .sidebar .logout-link a { justify-content: center; }
    .user-chip > div:last-child { display: none; }
    .content-container { padding: 16px; }
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

h1, h2, h3 { color: var(--navy); margin-top: 0; }

label {
    display: block;
    font-weight: 600;
    margin: 14px 0 6px;
    font-size: 14px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

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

.btn {
    display: inline-block;
    background: var(--navy);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-top: 16px;
}
.btn:hover { background: var(--navy-light); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-light); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
th { background: var(--bg); color: var(--navy); font-weight: 600; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-submitted { background: #e6f1fb; color: #185fa5; }
.badge-document_review { background: #faeeda; color: #854f0b; }
.badge-sent_to_bank { background: #eeedfe; color: #3c3489; }
.badge-bank_approved { background: #eaf3de; color: #3b6d11; }
.badge-bank_rejected { background: #fcebeb; color: #791f1f; }
.badge-disbursed { background: #e1f5ee; color: #085041; }
.badge-completed { background: #0a1f44; color: #e0c15c; }

.progress-wrap {
    background: var(--border);
    border-radius: 20px;
    height: 12px;
    overflow: hidden;
    margin: 10px 0;
}
.progress-bar {
    background: linear-gradient(90deg, var(--navy), var(--gold));
    height: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 4px solid var(--navy);
    border-radius: 10px;
    padding: 18px;
    text-align: left;
}
.stat-box .stat-label-top { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 8px; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--navy); }
.stat-box .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.stat-blue { border-top-color: #185fa5; }
.stat-green { border-top-color: #3b6d11; }
.stat-red { border-top-color: #791f1f; }
.stat-gold { border-top-color: var(--gold); }
.stat-purple { border-top-color: #3c3489; }
.stat-teal { border-top-color: #085041; }

.error { background: #fcebeb; color: #791f1f; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.success-msg { background: #eaf3de; color: #3b6d11; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }

.timeline { list-style: none; padding: 0; margin: 20px 0; }
.timeline li {
    padding: 12px 0 12px 24px;
    border-left: 2px solid var(--border);
    position: relative;
    font-size: 14px;
}
.timeline li:before {
    content: '';
    width: 10px; height: 10px;
    background: var(--gold);
    border-radius: 50%;
    position: absolute;
    left: -6px; top: 16px;
}
.timeline li:last-child { border-left: 2px solid transparent; }
.timeline .t-date { color: var(--muted); font-size: 12px; }
