:root {
    --brand-teal: #0E7C7B;
    --brand-teal-dark: #0B4F4E;
    --brand-teal-light: #17A2A0;
    --brand-emerald: #10B981;
    --brand-emerald-dark: #059669;
    --sidebar-bg: #0B3B3A;
    --sidebar-hover: rgba(16, 185, 129, .16);
    --sidebar-active: linear-gradient(90deg, var(--brand-emerald), var(--brand-teal));
    --body-bg: #F1F5F5;
    --card-radius: 14px;
    --ink: #1F2A2A;
    --muted: #6B7A7A;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--body-bg);
    color: var(--ink);
    font-size: 14px;
}

/* Layout shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: #D7E7E6;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
    overflow-y: auto;
}
.sidebar .brand {
    padding: 18px 20px;
    font-weight: 700; font-size: 1.05rem; color: #fff;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand .logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: #fff;
    display: grid; place-items: center; color: #fff; font-size: 1rem;
    padding: 3px;
}
.sidebar .brand .logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar .nav-section {
    padding: 14px 20px 6px; font-size: .68rem; letter-spacing: .09em;
    text-transform: uppercase; color: #6FA6A4;
}
.sidebar a.nav-link {
    color: #C6DBDA; padding: 10px 20px; display: flex; align-items: center; gap: 12px;
    border-left: 3px solid transparent; font-size: .9rem; text-decoration: none;
}
.sidebar a.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar a.nav-link.active {
    background: var(--sidebar-hover); color: #fff; border-left-color: var(--brand-emerald);
    font-weight: 600;
}
.sidebar a.nav-link i { width: 18px; text-align: center; }

.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 60px; background: #fff; border-bottom: 1px solid #E2ECEC;
    display: flex; align-items: center; gap: 14px; padding: 0 20px;
    position: sticky; top: 0; z-index: 1030;
}
.topbar .page-title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.topbar .spacer { flex: 1; }
.topbar .user-chip {
    display: flex; align-items: center; gap: 9px; padding: 6px 12px;
    border-radius: 30px; background: var(--body-bg); font-size: .85rem;
}
.topbar .user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--sidebar-active);
    color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .8rem;
}
.burger { display: none; background: none; border: none; font-size: 1.4rem; color: var(--brand-teal); }

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

/* Cards */
.card {
    border: none; border-radius: var(--card-radius);
    box-shadow: 0 2px 14px rgba(11, 59, 58, .06);
}
.card-header {
    background: #fff; border-bottom: 1px solid #EDF3F3;
    font-weight: 600; border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
    display: flex; align-items: center; gap: 10px;
}

/* Stat tiles */
.stat-tile { border-radius: var(--card-radius); padding: 18px 20px; color: #fff; position: relative; overflow: hidden; }
.stat-tile .value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-tile .label { opacity: .9; font-size: .82rem; margin-top: 6px; }
.stat-tile i.bg-ico { position: absolute; right: 14px; top: 12px; font-size: 2.6rem; opacity: .18; }
.tile-teal { background: linear-gradient(135deg, var(--brand-teal), var(--brand-teal-dark)); }
.tile-emerald { background: linear-gradient(135deg, var(--brand-emerald), var(--brand-emerald-dark)); }
.tile-slate { background: linear-gradient(135deg, #334E4D, #22403F); }
.tile-amber { background: linear-gradient(135deg, #F59E0B, #D97706); }

/* Buttons & controls in brand colors */
.btn-primary { background: var(--brand-teal); border-color: var(--brand-teal); }
.btn-primary:hover { background: var(--brand-teal-dark); border-color: var(--brand-teal-dark); }
.btn-success { background: var(--brand-emerald); border-color: var(--brand-emerald); }
.btn-success:hover { background: var(--brand-emerald-dark); border-color: var(--brand-emerald-dark); }
.btn-outline-primary { color: var(--brand-teal); border-color: var(--brand-teal); }
.btn-outline-primary:hover { background: var(--brand-teal); color: #fff; }
a { color: var(--brand-teal); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand-teal-light);
    box-shadow: 0 0 0 .2rem rgba(23,162,160,.18);
}
.page-link { color: var(--brand-teal); }
.page-item.active .page-link { background: var(--brand-teal); border-color: var(--brand-teal); }

/* Tables */
.table thead th {
    background: #E8F3F2; color: var(--brand-teal-dark);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
    border-bottom: none; white-space: nowrap;
}
.table tbody tr:hover { background: #F4FAFA; }
.badge-fcra { background: #DCFCE7; color: #047857; }
.badge-nonfcra { background: #E0E7FF; color: #3730A3; }
.badge-soft { background: #E8F3F2; color: var(--brand-teal-dark); font-weight: 600; }

/* Login */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-teal-dark), var(--brand-emerald-dark));
    padding: 20px;
}
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 34px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .logo {
    width: 56px; height: 56px; border-radius: 14px; background: var(--sidebar-active);
    display: grid; place-items: center; color: #fff; font-size: 1.5rem; margin: 0 auto 14px;
}
.login-card .login-logo { display: block; width: 210px; max-width: 80%; height: auto; margin: 4px auto 18px; }

/* Responsive */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .burger { display: inline-block; }
    .sidebar-backdrop.show { display: block; }
}
