:root {
    --sidebar-width: 230px;
}

body {
    background: #f5f6f8;
}

.auth-body {
    min-height: 100vh;
    background: #eef1f5;
}

.auth-card {
    width: 100%;
    max-width: 460px;
}

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

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: #1e2430;
    color: #fff;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-brand {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.app-company-name {
    font-size: 0.85rem;
    color: #b7bfcc;
}

.app-sidebar .nav-link {
    color: #cfd6e3;
    border-radius: 6px;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
    background: #2c3444;
    color: #fff;
}

.app-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #313a4c;
}

.app-main {
    flex-grow: 1;
    padding: 1.75rem 2rem;
    max-width: calc(100vw - var(--sidebar-width));
    min-width: 0;
}

.app-topbar {
    display: none;
}

.app-sidebar-backdrop {
    display: none;
}

.card-table th {
    white-space: nowrap;
}

/* Darker grid lines than Bootstrap's default .table-bordered (too faint to
   read at a glance) — scoped to .card-table.table-bordered specifically, so
   it only affects tables that opt into both, not every .card-table. */
.card-table.table-bordered > :not(caption) > * > * {
    border-color: #adb5bd;
}

.text-right,
.text-end-num {
    text-align: right;
}

@media (max-width: 767.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-topbar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        background: #1e2430;
        color: #fff;
        padding: 0.65rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1040;
    }

    .app-topbar-title {
        font-weight: 600;
        font-size: 1rem;
    }

    .app-hamburger {
        border: 0;
        background: transparent;
        padding: 0.25rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

    .app-hamburger span {
        display: block;
        height: 2px;
        background: #fff;
        border-radius: 1px;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(80vw, 280px);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 1050;
        overflow-y: auto;
    }

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

    .app-sidebar-backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045;
    }

    .app-main {
        max-width: 100vw;
        padding: 1rem;
    }
}

@media print {
    .app-sidebar, .app-topbar, .no-print {
        display: none !important;
    }
    .app-main {
        max-width: 100%;
        padding: 0;
    }
}

/* Referral team tree (app/Helpers/referral_helper.php) — padding is set
   entirely here rather than via Bootstrap's px-3/py-3 utilities, which use
   !important and would otherwise clobber .team-children's deeper left
   indent (both would target the same <ul>'s padding-left). */
.team-tree, .team-children {
    list-style: none;
    margin: 0;
}
.team-tree {
    padding: 1rem;
}
.team-children {
    padding: 0.1rem 1rem 0 2.75rem;
}
.team-children > .team-node {
    position: relative;
}
.team-children > .team-node::before,
.team-children > .team-node::after {
    content: '';
    position: absolute;
    left: -1.05rem;
    border-color: #d7dce2;
    border-style: solid;
}
.team-children > .team-node::before {
    top: -0.35rem;
    bottom: 0;
    border-width: 0 0 0 2px;
}
.team-children > .team-node:last-child::before {
    bottom: auto;
    height: 1.7rem;
}
.team-children > .team-node::after {
    top: 1.25rem;
    width: 1rem;
    border-width: 0 0 2px 0;
}
.team-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.12s ease;
}
.team-row:hover {
    background: #f3f4f6;
}
.team-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    background: #fff;
    color: #6c757d;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
}
.team-toggle:hover {
    background: #eef1f4;
}
.team-toggle-icon::before {
    content: '\25BE'; /* ▾ expanded */
}
.team-toggle.collapsed .team-toggle-icon::before {
    content: '\25B8'; /* ▸ collapsed */
}
.team-drill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    border: 1px solid #0d6efd;
    border-radius: 50%;
    background: #fff;
    color: #0d6efd;
    font-size: 0.75rem;
    text-decoration: none;
}
.team-drill:hover {
    background: #0d6efd;
    color: #fff;
}
.team-toggle-spacer {
    display: inline-block;
    width: 1.5rem;
    flex: 0 0 auto;
}
.team-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    flex: 0 0 auto;
}
.team-row-info {
    min-width: 0;
    flex: 1 1 auto;
}
.team-row-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-row-meta {
    font-size: 0.78rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-row-side {
    flex: 0 0 auto;
    text-align: right;
}
.team-row-date {
    font-size: 0.72rem;
    color: #adb5bd;
    margin-top: 0.2rem;
}
.team-row-earned {
    font-size: 0.74rem;
    font-weight: 600;
    color: #198754;
    margin-top: 0.15rem;
}
.team-row-root {
    background: #eef2ff;
    border-radius: 0.5rem;
}
.team-row-root:hover {
    background: #eef2ff;
}
.team-row-root .team-row-name {
    font-size: 0.95rem;
}
