* {
    box-sizing: border-box;
}

:root {
    --navy: #002060;
    --navy-dark: #000d33;
    --orange: #ff8000;
    --blue: #115cb9;
    --bg: #f8f9ff;
    --surface-low: #eff4ff;
    --surface-high: #dce9ff;
    --border: #c5c6d2;
    --text: #0b1c30;
    --muted: #444650;
    --outline: #757681;
    --white: #ffffff;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body.dashboard-body {
    font-family: "Inter", sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.material-symbols-outlined {
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
    vertical-align: middle;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    position: fixed;
    z-index: 100;
    inset: 0 auto 0 0;
    width: 260px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;

    background: var(--navy);
    border-right: 1px solid rgba(255,255,255,.15);
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 104px;
    margin-bottom: 16px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,.08);
}

.sidebar-logo img {
    width: 100%;
    max-height: 88px;
    object-fit: contain;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.sidebar-link {
    min-height: 44px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;

    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;

    transition: .2s ease;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,128,0,.18);
}

.sidebar-link.active {
    color: #fff;
    background: var(--orange);
    font-weight: 700;
}

.sidebar-link .material-symbols-outlined {
    font-size: 21px;
}

.sidebar-bottom {
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-logout {
    margin-top: 3px;
}

.sidebar-overlay {
    display: none;
}


/* =====================================================
   WRAPPER / TOPBAR
===================================================== */

.dashboard-wrapper {
    min-height: 100vh;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 80;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    background: rgba(248,249,255,.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.topbar-left {
    gap: 26px;
}

.topbar-right {
    gap: 10px;
}

.topbar-title {
    margin: 0;
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 24px;
    color: var(--navy);
}

.view-tabs {
    display: flex;
    gap: 22px;
    height: 100%;
    align-items: center;
}

.view-tab {
    padding: 22px 0 17px;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

.view-tab:hover {
    color: var(--navy);
}

.view-tab.active {
    color: var(--orange);
    border-bottom-color: var(--orange);
    font-weight: 700;
}

.search-box {
    width: 220px;
    height: 36px;
    position: relative;
}

.search-box .material-symbols-outlined {
    position: absolute;
    left: 11px;
    top: 8px;
    font-size: 18px;
    color: var(--outline);
}

.search-box input {
    width: 100%;
    height: 100%;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    outline: none;
    background: rgba(255,255,255,.5);
    color: var(--text);
}

.search-box input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(255,128,0,.1);
}

.branch-chip {
    min-height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255,255,255,.5);
    font-size: 12px;
    font-weight: 600;
}

.branch-chip .material-symbols-outlined {
    font-size: 17px;
}

.icon-button {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    color: var(--outline);
    cursor: pointer;
}

.icon-button:hover {
    color: var(--navy);
    background: var(--surface-high);
}

.notification-dot {
    width: 7px;
    height: 7px;
    position: absolute;
    right: 7px;
    top: 6px;
    border-radius: 50%;
    background: var(--orange);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255,128,0,.3);
    background: rgba(255,128,0,.12);
    color: var(--orange);
}

.user-avatar .material-symbols-outlined {
    font-size: 20px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 160px;
}

.user-info strong {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info small {
    color: var(--outline);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-button {
    display: none;
    width: 38px;
    height: 38px;
    border: 0;
    background: transparent;
    color: var(--navy);
    border-radius: 8px;
}


/* =====================================================
   MAIN
===================================================== */

.dashboard-main {
    flex: 1;
    min-width: 0;
    padding: 16px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(135deg, var(--surface-low), var(--surface-high));
}

.glass-card {
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.58);
    box-shadow:
        0 4px 6px rgba(0,0,0,.04),
        0 2px 4px rgba(0,0,0,.025);
    border-radius: 12px;
}

.card-grid {
    display: grid;
    gap: 12px;
}

.card-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-actions {
    min-height: 92px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.quick-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .08em;
    font-weight: 700;
    white-space: nowrap;
}

.quick-title .material-symbols-outlined {
    font-size: 17px;
}

.quick-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
}

.quick-button {
    width: 74px;
    height: 64px;
    padding: 5px;
    border: 1px solid rgba(197,198,210,.35);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--navy);
    background: rgba(255,255,255,.5);
    cursor: pointer;
    transition: .2s ease;
}

.quick-button:hover {
    background: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,.06);
    transform: translateY(-1px);
}

.quick-button .material-symbols-outlined {
    color: var(--orange);
    font-size: 21px;
}

.quick-button span:last-child {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.clock-widget {
    width: 64px;
    height: 64px;
    position: relative;
    flex: 0 0 auto;
    border: 1px solid rgba(197,198,210,.5);
    border-radius: 50%;
    background: rgba(255,255,255,.82);
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

.clock-widget > span {
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    color: var(--navy);
}

.clock-widget > span:nth-child(1) { top: 3px; left: 29px; }
.clock-widget > span:nth-child(2) { top: 27px; right: 3px; }
.clock-widget > span:nth-child(3) { bottom: 3px; left: 29px; }
.clock-widget > span:nth-child(4) { top: 27px; left: 4px; }

.clock-hand {
    position: absolute;
    left: 50%;
    bottom: 50%;
    width: 2px;
    transform-origin: bottom center;
    border-radius: 4px;
}

.clock-hand-one {
    height: 23px;
    background: var(--orange);
    transform: rotate(45deg);
}

.clock-hand-two {
    height: 27px;
    background: var(--navy);
    transform: rotate(-12deg);
}

.clock-center {
    position: absolute;
    width: 6px;
    height: 6px;
    left: calc(50% - 3px);
    top: calc(50% - 3px);
    background: var(--orange);
    border-radius: 50%;
}


/* =====================================================
   BALANCE / KPI
===================================================== */

.balance-card {
    min-height: 94px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.balance-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.balance-icon.navy {
    color: var(--navy);
    background: rgba(0,32,96,.08);
}

.balance-icon.orange {
    color: var(--orange);
    background: rgba(255,128,0,.1);
}

.balance-icon .material-symbols-outlined {
    font-size: 24px;
}

.balance-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-content span {
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.balance-content strong {
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 22px;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.kpi-card {
    min-height: 140px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 5px 12px rgba(0,0,0,.09);
}

.kpi-card.navy {
    background: linear-gradient(135deg, var(--navy-dark), #173a87);
}

.kpi-card.orange {
    background: linear-gradient(135deg, var(--orange), #e56d00);
}

.kpi-card .kpi-bg {
    position: absolute;
    right: -15px;
    bottom: -20px;
    font-size: 100px;
    opacity: .08;
}

.kpi-card h3 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 24px;
    line-height: 30px;
}

.kpi-card p {
    position: relative;
    z-index: 1;
    margin: 3px 0 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .8;
}

.kpi-card a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 14px;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
}

.kpi-card.navy a {
    color: var(--orange);
}

.kpi-card a .material-symbols-outlined {
    font-size: 15px;
}


/* =====================================================
   MATRICES / METRICS
===================================================== */

.matrix-card {
    overflow: hidden;
}

.matrix-header {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.matrix-header.navy {
    background: rgba(0,32,96,.035);
}

.matrix-header.orange {
    background: rgba(255,128,0,.04);
}

.matrix-header h4,
.matrix-header p {
    margin: 0;
}

.matrix-header h4 {
    font-size: 12px;
    color: var(--navy);
}

.matrix-header.orange h4 {
    color: var(--orange);
}

.matrix-header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.matrix-body {
    padding: 12px;
}

.matrix-row {
    min-height: 32px;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border-bottom: 1px solid rgba(197,198,210,.35);
}

.matrix-row:last-child {
    border-bottom: 0;
}

.matrix-row > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.matrix-row strong {
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    white-space: nowrap;
}

.orange-badge {
    color: #fff;
    background: var(--orange);
}

.dark-badge {
    color: #fff;
    background: var(--navy);
}

.muted-badge {
    color: #5f6470;
    background: #dfe2e7;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    min-height: 126px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}

.metric-bg {
    position: absolute;
    right: 13px;
    top: 12px;
    color: rgba(0,32,96,.22);
}

.metric-label {
    padding-right: 28px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

.metric-card > strong {
    color: var(--navy);
    font-size: 24px;
    line-height: 30px;
    overflow-wrap: anywhere;
}

.progress-track {
    height: 6px;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(117,118,129,.2);
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--orange);
}

.metric-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 1px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}


/* =====================================================
   SUMMARIES
===================================================== */

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 12px;
}

.summary-card,
.loan-record-card {
    padding: 16px;
}

.summary-card h4,
.loan-record-card h4 {
    margin: 0 0 12px;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(197,198,210,.35);
    color: var(--navy);
    font-size: 12px;
}

.summary-card h4 .material-symbols-outlined,
.loan-record-card h4 .material-symbols-outlined {
    font-size: 17px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-weight: 600;
}

.summary-row span .material-symbols-outlined {
    font-size: 15px;
}

.summary-row strong {
    color: var(--navy);
    white-space: nowrap;
}

.orange-text {
    color: var(--orange) !important;
}

.loan-record-grid {
    height: calc(100% - 30px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 10px;
    align-items: center;
}

.loan-record-grid > div {
    padding: 10px 6px;
    border: 1px solid rgba(197,198,210,.3);
    border-radius: 8px;
    background: rgba(255,255,255,.35);
    text-align: center;
}

.loan-record-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}

.loan-record-grid strong {
    color: var(--navy);
    font-size: 20px;
}


/* =====================================================
   MANAGEMENT
===================================================== */

.management-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 12px;
}

.management-card {
    min-height: 108px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.management-card span {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.management-card strong {
    color: var(--navy);
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 34px;
}

.management-card.highlighted {
    border-bottom: 4px solid var(--orange);
}

.management-card.highlighted strong {
    color: var(--orange);
}


/* =====================================================
   CHARTS
===================================================== */

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

.chart-card {
    min-width: 0;
    padding: 18px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.section-heading h3,
.chart-title {
    margin: 0;
    color: var(--navy);
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 21px;
    line-height: 28px;
}

.section-heading h3 small {
    color: var(--muted);
    font-family: "Inter", sans-serif;
    font-size: 11px;
    font-weight: 400;
}

.section-heading > .material-symbols-outlined {
    color: var(--outline);
    font-size: 18px;
}

.line-chart {
    height: 260px;
    position: relative;
    padding: 8px;
    overflow: hidden;
    border: 1px solid rgba(197,198,210,.3);
    border-radius: 8px;
    background: rgba(255,255,255,.32);
}

.line-chart svg {
    width: 100%;
    height: 100%;
}

.chart-axis {
    position: absolute;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
    pointer-events: none;
}

.y-axis {
    inset: 8px auto 26px 7px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.x-axis {
    left: 58px;
    right: 8px;
    bottom: 7px;
    display: flex;
    justify-content: space-between;
}

.donut-wrap {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut {
    width: 190px;
    height: 190px;
    position: relative;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut::after {
    content: "";
    position: absolute;
    inset: 26px;
    border-radius: 50%;
    background: #fff;
}

.donut > div {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.donut > div span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.donut > div strong {
    margin-top: 3px;
    color: var(--navy);
    font-size: 20px;
}

.donut-loan {
    background: conic-gradient(
        #cbd5e1 0 19%,
        #002060 19% 22.4%,
        #f97316 22.4% 48.3%,
        #ff8000 48.3% 100%
    );
}

.donut-record {
    background: conic-gradient(
        #cbd5e1 0 15%,
        #002060 15% 65%,
        #ff8000 65% 100%
    );
    width: 210px;
    height: 210px;
}

.donut-overview {
    background: conic-gradient(
        #002060 0 30%,
        #475569 30% 38%,
        #94a3b8 38% 45%,
        #ff8000 45% 100%
    );
}

.donut-overview::after {
    inset: 38px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 11px;
    height: 11px;
    display: inline-block;
    border-radius: 50%;
}

.reject { background: #cbd5e1; }
.pending { background: #002060; }
.open { background: #f97316; }
.approved { background: #ff8000; }
.present { background: #002060; }
.absent { background: #ff8000; }
.outstanding { background: #cbd5e1; }
.total { background: #002060; }
.received { background: #ff8000; }

.empty-state {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(197,198,210,.3);
    border-radius: 8px;
    background: rgba(255,255,255,.32);
}

.empty-state .material-symbols-outlined {
    margin-bottom: 7px;
    color: var(--border);
    font-size: 50px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.full-chart {
    padding-bottom: 16px;
}

.bar-chart {
    height: 260px;
    padding: 10px 30px 28px 60px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 7px;
    border: 1px solid rgba(197,198,210,.3);
    border-radius: 8px;
    background: rgba(255,255,255,.32);
}

.bar-wrap {
    height: 100%;
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.bar {
    width: min(30px, 80%);
    min-height: 3px;
    background: var(--navy);
    border-radius: 5px 5px 0 0;
    transition: .2s ease;
}

.bar-wrap:hover .bar {
    background: var(--orange);
}

.bar-value {
    position: absolute;
    bottom: calc(var(--height, 50%) + 5px);
    display: none;
    padding: 2px 4px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,.08);
    font-size: 9px;
}

.bar-wrap:hover .bar-value {
    display: block;
}

.bar-labels {
    padding: 6px 30px 0 60px;
    display: flex;
    justify-content: space-between;
    gap: 7px;
    color: var(--muted);
    font-size: 9px;
}

.bar-labels span {
    flex: 1;
    text-align: center;
}


/* =====================================================
   TABLES
===================================================== */

.table-card {
    min-width: 0;
    overflow: hidden;
}

.table-title {
    margin: 0;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 1px solid rgba(197,198,210,.3);
    background: rgba(255,255,255,.4);
    color: var(--navy);
    font-family: "Hanken Grotesk", sans-serif;
    font-size: 20px;
}

.table-title .material-symbols-outlined {
    font-size: 20px;
}

.pending-list {
    padding: 6px;
}

.pending-row {
    min-height: 48px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 8px;
}

.pending-row:hover {
    background: rgba(255,255,255,.5);
}

.pending-row > span {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.pending-row > span .material-symbols-outlined {
    color: var(--orange);
    font-size: 16px;
}

.pending-row strong {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(0,32,96,.08);
    color: var(--navy);
    font-size: 11px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

th,
td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(197,198,210,.22);
    white-space: nowrap;
    font-size: 11px;
}

th {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    font-size: 9px;
}

td {
    color: var(--text);
}

tbody tr:hover {
    background: rgba(255,255,255,.5);
}

.strong-cell {
    color: var(--navy);
    font-weight: 700;
}

.table-heading-row {
    min-height: 58px;
    padding-right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(197,198,210,.3);
    background: rgba(255,255,255,.4);
}

.table-heading-row .table-title {
    border: 0;
}

.export-button {
    margin-right: 2px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(197,198,210,.5);
    border-radius: 7px;
    background: rgba(255,255,255,.5);
    color: var(--navy);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.export-button:hover {
    background: #fff;
}

.export-button .material-symbols-outlined {
    font-size: 16px;
}

.large-table {
    min-width: 800px;
}

.term-badge {
    padding: 4px 7px;
    border-radius: 5px;
    background: rgba(0,32,96,.08);
    color: var(--navy);
    font-weight: 700;
}

.amount-cell {
    font-size: 14px;
    font-weight: 700;
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 1199px) {
    .sidebar {
        width: 230px;
    }

    .dashboard-wrapper {
        margin-left: 230px;
    }

    .card-grid-4 {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .metric-grid {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .loan-record-card {
        grid-column: span 2;
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 899px) {

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        width: min(290px, 86vw);
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 12px 0 30px rgba(0,0,0,.2);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        z-index: 90;
        inset: 0;
        display: block;
        background: rgba(0,0,0,.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    .dashboard-wrapper {
        margin-left: 0;
    }

    .topbar {
        padding: 0 14px;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar-left {
        gap: 7px;
    }

    .topbar-title {
        font-size: 21px;
    }

    .view-tabs {
        display: none;
    }

    .search-box {
        display: none;
    }

    .help-button {
        display: none;
    }

    .branch-chip span:not(.material-symbols-outlined) {
        display: none;
    }

    .dashboard-main {
        padding: 14px;
    }

    .quick-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-title {
        justify-content: center;
    }

    .quick-grid {
        width: 100%;
    }

    .clock-widget {
        display: none;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .management-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 599px) {

    .topbar {
        height: 58px;
    }

    .topbar-right {
        gap: 3px;
    }

    .notification-button {
        display: none;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .dashboard-main {
        padding: 10px;
        gap: 10px;
    }

    .card-grid-4 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .balance-card {
        min-height: 78px;
        padding: 12px;
    }

    .balance-icon {
        width: 42px;
        height: 42px;
    }

    .balance-content strong {
        font-size: 19px;
    }

    .kpi-card {
        min-height: 125px;
        padding: 16px;
    }

    .kpi-card h3 {
        font-size: 21px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metric-card {
        min-height: 112px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .loan-record-card {
        grid-column: auto;
    }

    .loan-record-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 7px;
    }

    .management-card {
        min-height: 90px;
    }

    .management-card strong {
        font-size: 29px;
    }

    .chart-card {
        padding: 13px;
    }

    .section-heading h3,
    .chart-title {
        font-size: 18px;
        line-height: 24px;
    }

    .line-chart {
        height: 210px;
    }

    .donut {
        width: 165px;
        height: 165px;
    }

    .donut-record {
        width: 180px;
        height: 180px;
    }

    .bar-chart {
        height: 210px;
        padding-left: 42px;
        padding-right: 10px;
        gap: 3px;
    }

    .bar-labels {
        padding-left: 42px;
        padding-right: 10px;
        font-size: 8px;
    }

    .table-title {
        font-size: 18px;
    }

    .table-heading-row {
        align-items: center;
    }

    .export-button {
        font-size: 9px;
        padding: 6px 7px;
    }

    .export-button .material-symbols-outlined {
        font-size: 14px;
    }

    th,
    td {
        padding: 9px 10px;
    }
}

/* Login Success Alert */
.login-alert-success {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;

    display: flex;
    align-items: center;
    gap: 12px;

    min-width: 320px;
    max-width: 450px;

    padding: 15px 18px;

    background: #ecfdf3;
    border: 1px solid #86efac;
    border-left: 5px solid #16a34a;

    color: #166534;

    border-radius: 10px;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);

    animation: loginSuccessSlide 0.35s ease-out;
}

.login-alert-success .alert-icon {
    color: #16a34a;
    font-size: 24px;
}

.login-alert-success .alert-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.login-alert-success .alert-content strong {
    font-size: 14px;
    font-weight: 700;
}

.login-alert-success .alert-content span {
    font-size: 13px;
}

.login-alert-success .alert-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 3px;
}

.login-alert-success .alert-close:hover {
    color: #166534;
}

@keyframes loginSuccessSlide {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 576px) {
    .login-alert-success {
        top: 15px;
        left: 15px;
        right: 15px;

        min-width: auto;
        max-width: none;
    }
}