/* The UHSR dashboard's look: FinanceApp's (cd-manager's) layout, sidebar, stat cards,
   tables and buttons. The public home page has its own, site.css. */

body {
    background:
        radial-gradient(circle at top left, rgba(79, 163, 191, 0.1), transparent 28%),
        radial-gradient(circle at top right, rgba(242, 163, 107, 0.1), transparent 22%),
        linear-gradient(180deg, #f7fbfd 0%, #fbfcfd 100%);
    color: #234255;
}

.main {
    display: flex;
    min-height: 100vh;
    gap: 1rem;
    padding: 1rem;
    color: #234255;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
}

#content {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 252, 253, 0.98) 100%);
    border: 1px solid rgba(79, 163, 191, 0.1);
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(35, 66, 85, 0.06);
    min-height: calc(100vh - 2rem);
    padding: 1.5rem;
}

/* Sidebar */

.app-sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 1rem;
    align-self: flex-start;
    min-height: calc(100vh - 2rem);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(247, 252, 253, 0.97) 100%);
    border: 1px solid rgba(79, 163, 191, 0.12);
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(35, 66, 85, 0.08);
    padding: 1.5rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    color: #214160;
    font-size: 1.15rem;
    font-weight: 800;
}

.app-sidebar .user-card {
    overflow-wrap: anywhere;
}

.app-sidebar .fw-semibold {
    font-weight: 700;
}

.app-sidebar .text-muted {
    color: #6b8192 !important;
    font-size: 0.86rem;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.65rem 0.85rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #6b8192;
    text-align: left;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.app-sidebar .nav-link.active,
.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus-visible {
    background: linear-gradient(90deg, #e7f5fa 0%, #fff1e7 100%);
    color: #234255;
    box-shadow: inset 0 0 0 1px rgba(79, 163, 191, 0.1);
    transform: translateX(1px);
}

.app-sidebar-footer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(79, 163, 191, 0.12);
}

.app-sidebar-footer form {
    margin: 0;
}

/* Page header */

.admin-dashboard-home {
    width: 100%;
}

.admin-dashboard-home .sites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.admin-dashboard-home .sites-header h3 {
    color: #214160;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Stat cards */

.admin-dashboard-stats .stat-card {
    background: linear-gradient(180deg, #fbfdfe 0%, #f4fafc 100%);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(79, 163, 191, 0.1);
    padding: 1.25rem;
    text-align: center;
}

.admin-dashboard-stats .stat-card h4 {
    color: #214160;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin: 0 0 0.45rem;
}

.admin-dashboard-stats .stat-card small {
    color: #6b8192;
    font-size: 0.86rem;
    font-weight: 700;
}

/* Tables */

.admin-dashboard-table-wrap {
    background: linear-gradient(180deg, #fbfdfe 0%, #f7fbfd 100%);
    border: 1px solid rgba(79, 163, 191, 0.1);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(79, 163, 191, 0.04);
    overflow: auto;
}

.admin-dashboard-table {
    border-collapse: collapse;
    margin: 0;
    min-width: 760px;
    width: 100%;
}

.admin-dashboard-table th,
.admin-dashboard-table td {
    border-bottom: 1px solid rgba(79, 163, 191, 0.1);
    color: #234255;
    padding: 0.9rem 1rem;
    text-align: left;
    vertical-align: middle;
}

.admin-dashboard-table td strong,
.admin-dashboard-table td small {
    display: block;
}

.admin-dashboard-table td strong {
    font-weight: 800;
}

.admin-dashboard-table td small {
    color: #6b8192;
    font-size: 0.82rem;
    margin-top: 0.15rem;
    overflow-wrap: anywhere;
}

.admin-dashboard-table th {
    background: #eef6fa;
    color: #214160;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* Sortable headers (templates/finances/includes/sort_header.html). */
.sort-header-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    line-height: 0.6;
}

.sort-arrows a {
    color: #b6c3cf;
    font-size: 0.95rem;
    text-decoration: none;
}

.sort-arrows a:hover,
.sort-arrows a:focus-visible,
.sort-arrows a.is-active {
    color: #143a4e;
}

.admin-dashboard-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-dashboard-table tbody tr:hover {
    background: rgba(79, 163, 191, 0.06);
}

.admin-dashboard-table-link {
    color: #31657f;
    font-weight: 700;
    text-decoration: none;
}

.admin-dashboard-table-link:hover,
.admin-dashboard-table-link:focus-visible {
    color: #1d3c4b;
    text-decoration: underline;
}

.admin-dashboard-table-empty {
    color: #6b8192;
    text-align: center;
}

/* Buttons */

.admin-dashboard-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: #e7f5fa;
    box-shadow: inset 0 0 0 1px rgba(79, 163, 191, 0.12);
    color: #31657f;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.admin-dashboard-action-link:hover,
.admin-dashboard-action-link:focus-visible {
    color: #1d3c4b;
    text-decoration: underline;
}

/* The main action on a form. */
.button.default {
    background: #31657f;
    color: #fff;
}

.button.default:hover,
.button.default:focus-visible {
    background: #1d3c4b;
    color: #fff;
}

/* Sign in */

.app-login {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 5rem);
}

.app-login-card {
    width: min(100%, 24rem);
    padding: 1.75rem;
}

.app-login-card h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #214160;
    font-weight: 800;
}

.app-login-card form {
    display: grid;
    gap: 0.4rem;
}

.app-login-card label {
    margin-top: 0.4rem;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
}

.app-login-card input {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #c8d7e4;
    border-radius: 10px;
    background: #f8fbfd;
}

.app-login-card button {
    justify-self: start;
    margin-top: 1rem;
}

.app-form-error {
    color: #991b1b;
    font-size: 0.85rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .main {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .app-sidebar {
        flex: 0 0 72px;
        min-height: calc(100vh - 1.5rem);
        padding: 1rem 0.6rem;
    }

    .app-sidebar .user-card,
    .app-brand {
        display: none;
    }

    .app-sidebar .nav-link {
        justify-content: center;
        font-size: 0;
    }

    .app-sidebar .nav-link i {
        font-size: 1.2rem;
    }
}

/* Finances: stat-card changes, by-category cards and pies (the Overview and
   Finances pages). */

.finances-change {
    display: block;
    margin-top: 0.35rem;
    color: #6b8192;
    font-size: 0.8rem;
    font-weight: 600;
}

.finances-change strong {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    font-weight: 800;
}

.finances-change-good strong { color: #166534; }
.finances-change-bad strong { color: #991b1b; }

.finances-income { color: #166534; }
.finances-expense { color: #991b1b; }

.admin-dashboard-stats .stat-card h4.finances-income { color: #166534; }
.admin-dashboard-stats .stat-card h4.finances-expense { color: #991b1b; }

.finances-section-title {
    margin: 0 0 0.75rem;
    color: #1d3c4b;
    font-size: 1.1rem;
    font-weight: 800;
}

.finances-breakdowns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.finances-breakdown {
    padding: 1.25rem;
}

.finances-breakdown h5 {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.9rem;
    color: #1d3c4b;
    font-size: 0.95rem;
    font-weight: 800;
}

.finances-breakdown ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.7rem;
}

.finances-breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: #334155;
    font-size: 0.88rem;
}

.finances-pie {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.finances-pie svg {
    flex: 0 0 180px;
    width: 180px;
    height: 180px;
}

/* A thin line of the card's color between slices. */
.finances-pie path,
.finances-pie circle {
    stroke: #f9fcfd;
    stroke-width: 2;
    stroke-linejoin: round;
    transition: opacity 0.15s ease;
}

.finances-pie svg:hover path:not(:hover) {
    opacity: 0.55;
}

.finances-breakdown ul.finances-pie-legend {
    flex: 1;
    min-width: 0;
    gap: 0.55rem;
}

.finances-pie-legend span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.finances-pie-legend i {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.finances-pie-legend span:last-child {
    white-space: nowrap;
}

.finances-empty {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
}

@media (max-width: 768px) {
    .finances-breakdowns {
        grid-template-columns: 1fr;
    }
}

/* Pie above its legend once the card is too narrow for both. */
.finances-breakdown {
    container-type: inline-size;
}

@container (max-width: 440px) {
    .finances-pie {
        flex-direction: column;
        align-items: stretch;
    }

    .finances-pie svg {
        align-self: center;
    }
}
