:root {
    --navy: #102a56;
    --blue: #1769e0;
    --sky: #eaf2ff;
    --ink: #172033;
    --muted: #6d7890;
    --line: #e6eaf0;
    --bg: #f5f7fb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
.app-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 26px; }
.brand, .login-brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; padding: 0 8px; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 13px; background: #fff; color: var(--navy); display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.brand strong, .login-brand strong { display: block; font-size: 16px; letter-spacing: .1px; }
.brand small, .login-brand small { display: block; color: #a9bddf; margin-top: 3px; font-size: 10px; letter-spacing: .5px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a { color: #cbd7eb; text-decoration: none; padding: 12px 13px; border-radius: 11px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.side-nav a.active, .side-nav a:hover { background: #244577; color: #fff; }
.side-nav a.disabled-link { opacity: .62; cursor: not-allowed; }
.side-nav a small { margin-left: auto; font-size: 9px; border: 1px solid #8296b7; border-radius: 20px; padding: 2px 5px; }
.sidebar-foot { margin-top: auto; color: #a9bddf; font-size: 11px; line-height: 1.7; padding: 8px; }
.main-area { min-width: 0; }
.topbar { min-height: 76px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 30px; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 750; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user strong, .topbar-user small { display: block; font-size: 12px; }
.topbar-user small { color: var(--muted); text-transform: capitalize; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sky); color: var(--blue); display: grid; place-items: center; font-weight: 800; }
.page-content { padding: 26px 30px 44px; max-width: 1600px; margin: 0 auto; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.welcome-row h2 { margin: 0 0 6px; font-size: 24px; font-weight: 750; }
.welcome-row p { margin: 0; color: var(--muted); font-size: 14px; }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: #1258c4; --bs-btn-hover-border-color: #1258c4; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card, .surface-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 19px; min-width: 0; }
.metric-label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); color: var(--blue); display: grid; place-items: center; font-size: 18px; }
.metric-card strong { display: block; font-size: 27px; letter-spacing: -.5px; margin: 12px 0 5px; }
.metric-card small { color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.surface-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.surface-heading h3 { margin: 0; font-size: 16px; font-weight: 750; }
.surface-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.soft-tag, .status-tag { white-space: nowrap; display: inline-block; border-radius: 99px; padding: 5px 9px; background: #edf1f7; color: #596579; font-size: 10px; font-weight: 750; }
.module-list { display: grid; }
.module-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.module-row:last-child { border-bottom: 0; padding-bottom: 0; }
.module-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #f0f5ff; color: var(--blue); font-size: 18px; flex: 0 0 36px; }
.module-row div { min-width: 0; flex: 1; }
.module-row strong { display: block; font-size: 13px; }
.module-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.user-details { margin: 0; }
.user-details div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-details div:last-child { border-bottom: 0; }
.user-details dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.user-details dd { margin: 0; font-size: 12px; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.branch-grid { grid-template-columns: minmax(260px, .8fr) minmax(0, 1.5fr); }
.field-error { color: #b42332; font-size: 12px; margin-top: 4px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #102a56, #1b457e); }
.login-card { width: min(100%, 440px); background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 24px 70px #071a3b50; }
.login-brand { color: var(--ink); padding: 0; margin-bottom: 30px; }
.login-brand .brand-mark { background: var(--navy); color: #fff; }
.login-brand small { color: var(--muted); }
.login-card h1 { font-size: 23px; font-weight: 800; }
.login-card .form-control { border-color: #dce2eb; }
.login-foot { color: var(--muted); font-size: 11px; text-align: center; margin: 20px 0 0; }
.mobile-nav { display: none; }
@media (max-width: 1000px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar { padding: 14px 17px; min-height: 68px; }
    .page-content { padding: 20px 16px 90px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid, .branch-grid { grid-template-columns: 1fr; }
    .mobile-nav { display: flex; position: fixed; z-index: 1030; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; }
    .mobile-nav a, .mobile-nav button { border: 0; background: transparent; color: var(--muted); text-decoration: none; font-size: 18px; display: grid; gap: 3px; justify-items: center; padding: 3px 8px; }
    .mobile-nav span { font-size: 10px; }
    .mobile-nav form { display: contents; }
}
@media (max-width: 520px) {
    .metric-grid { gap: 9px; }
    .metric-card { padding: 13px; }
    .metric-card strong { font-size: 22px; }
    .welcome-row { align-items: center; }
    .welcome-row h2 { font-size: 20px; }
    .welcome-row p { font-size: 12px; }
    .topbar h1 { font-size: 17px; }
    .topbar p { font-size: 11px; }
    .topbar-user { gap: 7px; }
    .topbar-user .btn { padding: 5px 7px; }
    .surface-card { padding: 14px; }
    .module-row { flex-wrap: wrap; }
    .status-tag { margin-left: 48px; }
    .login-card { padding: 24px; }
}
