/* ==========================================================================
   Recycle — design layer on top of SB Admin 2.
   Tokens first, then components. Nothing here changes behaviour.
   ========================================================================== */

:root {
    --r-green-50: #eaf7f0;
    --r-green-100: #cdebda;
    --r-green-500: #1f9d55;
    --r-green-600: #178044;
    --r-green-700: #116336;

    --r-ink: #1f2937;
    --r-ink-soft: #566072;
    --r-muted: #8a93a5;
    --r-line: #e6e9f0;
    --r-surface: #ffffff;
    --r-canvas: #f4f6fa;

    --r-info: #2f80ed;
    --r-warn: #d98518;
    --r-danger: #d64545;
    --r-success: var(--r-green-500);

    --r-radius: 14px;
    --r-radius-sm: 9px;
    --r-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
    --r-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
}

body,
body.bg-gradient-primary {
    background: var(--r-canvas);
    color: var(--r-ink);
    font-family: Nunito, "Segoe UI", system-ui, sans-serif;
}

/* ---------- Top navigation ---------------------------------------------- */

.topbar {
    background: var(--r-surface) !important;
    border-bottom: 1px solid var(--r-line);
    box-shadow: none !important;
    min-height: 66px;
}

.topbar .nav-link {
    color: var(--r-ink-soft) !important;
    font-weight: 600;
    padding: .5rem .9rem;
    border-radius: var(--r-radius-sm);
}

.topbar .nav-link:hover {
    background: var(--r-green-50);
    color: var(--r-green-700) !important;
}

.topbar .nav-link.is-active {
    color: var(--r-green-700) !important;
    background: var(--r-green-50);
}

/* Profile page dims the other affordances so the current page reads clearly. */
.topbar .nav-link.is-muted,
.topbar .nav-link.is-muted i,
.topbar .is-muted {
    color: var(--r-muted) !important;
    font-weight: 500 !important;
}

.topbar .nav-link.is-muted:hover {
    background: transparent;
    color: var(--r-ink-soft) !important;
}

/* Keeps the user menu inside the viewport instead of clipping past the edge. */
.topbar .navbar-nav .dropdown-menu-right {
    right: .75rem;
    left: auto;
    min-width: 12.5rem;
    white-space: nowrap;
}

.topbar .dropdown-menu {
    border: 1px solid var(--r-line);
    border-radius: var(--r-radius-sm);
    box-shadow: var(--r-shadow);
    padding: .35rem;
}

.topbar .dropdown-item {
    border-radius: 7px;
    padding: .55rem .75rem;
    font-size: .875rem;
}

.topbar .dropdown-item:active,
.topbar .dropdown-item:focus,
.topbar .dropdown-item:hover {
    background: var(--r-green-50);
    color: var(--r-green-700);
}

.topbar .badge-counter {
    font-size: .62rem;
    transform: translate(-40%, -30%);
}

/* Beats SB Admin 2's `.topbar .dropdown-list .dropdown-header` blue (3 classes). */
.topbar .dropdown-list .dropdown-header {
    background: var(--r-green-600);
    border: 0;
    color: #fff;
    letter-spacing: .04em;
}

/* ---------- Page shell --------------------------------------------------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.75rem 1.75rem .25rem;
}

.page-head__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--r-ink);
    margin: 0;
}

.page-head__sub {
    margin: .2rem 0 0;
    color: var(--r-muted);
    font-size: .875rem;
}

/* ---------- Cards -------------------------------------------------------- */

.card {
    border: 1px solid var(--r-line);
    border-radius: var(--r-radius);
    box-shadow: var(--r-shadow-sm);
}

.card .card-header {
    background: var(--r-surface);
    border-bottom: 1px solid var(--r-line);
    padding: 1rem 1.25rem;
    border-radius: var(--r-radius) var(--r-radius) 0 0;
}

.card .card-header h6 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--r-ink);
    margin: 0;
}

.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.card-toolbar .form-select,
.card-toolbar select {
    border: 1px solid var(--r-line);
    border-radius: var(--r-radius-sm);
    padding: .35rem .65rem;
    font-size: .85rem;
    color: var(--r-ink);
    background: var(--r-surface);
    min-width: 7.5rem;
}

/* ---------- Stat tiles --------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin: 1.25rem 1.75rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: .9rem;
    background: var(--r-surface);
    border: 1px solid var(--r-line);
    border-radius: var(--r-radius);
    box-shadow: var(--r-shadow-sm);
    padding: 1.05rem 1.15rem;
}

.stat__icon {
    flex: 0 0 44px;
    height: 44px;
    width: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.05rem;
    background: var(--r-green-50);
    color: var(--r-green-600);
}

.stat--info .stat__icon { background: #e8f1fd; color: var(--r-info); }
.stat--warn .stat__icon { background: #fdf3e3; color: var(--r-warn); }
.stat--danger .stat__icon { background: #fdeaea; color: var(--r-danger); }

.stat__label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--r-muted);
}

.stat__value {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--r-ink);
    line-height: 1.25;
}

.stat__hint {
    display: block;
    font-size: .78rem;
    color: var(--r-ink-soft);
}

.stat__action {
    margin-left: auto;
}

/* ---------- Buttons ------------------------------------------------------ */

.btn {
    border-radius: var(--r-radius-sm);
    font-weight: 600;
    font-size: .875rem;
}

.btn-primary {
    background: var(--r-green-600);
    border-color: var(--r-green-600);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--r-green-700);
    border-color: var(--r-green-700);
    box-shadow: none;
}

.btn-outline-primary {
    color: var(--r-green-700);
    border-color: var(--r-green-100);
    background: var(--r-green-50);
}

.btn-outline-primary:hover {
    background: var(--r-green-100);
    border-color: var(--r-green-100);
    color: var(--r-green-700);
}

.btn-danger { background: var(--r-danger); border-color: var(--r-danger); }

/* Recolor the leftover SB Admin 2 "primary" (blue) utilities to the green theme. */
.text-primary { color: var(--r-green-600) !important; }
a.text-primary:hover, a.text-primary:focus { color: var(--r-green-700) !important; }
.bg-primary { background-color: var(--r-green-600) !important; }
.border-left-primary { border-left: .25rem solid var(--r-green-600) !important; }

.btnCustom {
    display: inline-block;
    font-weight: 600;
    font-size: .85rem;
    color: #fff;
    text-align: center;
    background: var(--r-green-600);
    border: 0;
    padding: .4rem .85rem;
    border-radius: var(--r-radius-sm);
    transition: background .15s ease-in-out;
}

.btnCustom:hover { background: var(--r-green-700); }

/* ---------- Tables ------------------------------------------------------- */

.table-wrap {
    max-height: 340px;
    overflow: auto;
    border-radius: 0 0 var(--r-radius) var(--r-radius);
}

.table {
    margin-bottom: 0;
    font-size: .86rem;
    color: var(--r-ink);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fbfcfe;
    border-bottom: 1px solid var(--r-line) !important;
    border-top: 0 !important;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--r-muted);
    white-space: nowrap;
    padding: .7rem .85rem;
}

.table tbody td {
    border-top: 1px solid var(--r-line);
    padding: .7rem .85rem;
    vertical-align: middle;
}

.table tbody tr:hover td { background: #fafbfd; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-bordered,
.table-bordered td,
.table-bordered th { border: 0; }

.code-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .78rem;
    background: #f1f3f8;
    border-radius: 6px;
    padding: .15rem .45rem;
    color: var(--r-ink-soft);
}

/* ---------- Status badges ------------------------------------------------ */

.badge-status {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    padding: .25rem .6rem;
    border-radius: 999px;
    text-transform: capitalize;
}

.badge-status.is-pending { background: #fdf3e3; color: #96601a; }
.badge-status.is-requested { background: rgba(31, 157, 85, .12); color: var(--r-green-600); }
.badge-status.is-accepted { background: var(--r-green-50); color: var(--r-green-700); }
.badge-status.is-declined { background: #fdeaea; color: #a32b2b; }
.badge-status.is-done { background: rgba(17, 99, 54, .12); color: var(--r-green-700); }

/* ---------- Empty state -------------------------------------------------- */

.empty-state td,
.empty-state {
    text-align: center;
    color: var(--r-muted);
    font-size: .85rem;
    padding: 2rem 1rem !important;
}

.empty-state i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: .5rem;
    opacity: .5;
}

/* ---------- Modals ------------------------------------------------------- */

.modal-content {
    border: 0;
    border-radius: var(--r-radius);
    box-shadow: 0 24px 64px -20px rgba(16, 24, 40, .35);
}

.modal-header {
    border-bottom: 1px solid var(--r-line);
    padding: 1rem 1.25rem;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.modal-footer {
    border-top: 1px solid var(--r-line);
    padding: .85rem 1.25rem;
}

.detail-list { margin: 0; font-size: .875rem; }
.detail-list dt { color: var(--r-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.detail-list dd { margin: 0 0 .65rem; color: var(--r-ink); font-weight: 600; }

/* ---------- Forms -------------------------------------------------------- */

.form-control,
.custom-select {
    border: 1px solid var(--r-line);
    border-radius: var(--r-radius-sm);
    font-size: .9rem;
    color: var(--r-ink);
}

.form-control:focus {
    border-color: var(--r-green-500);
    box-shadow: 0 0 0 3px rgba(31, 157, 85, .14);
}

.form-label,
label.form-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--r-muted);
    margin-bottom: .3rem;
}

.input-group-text {
    background: #f1f3f8;
    border: 1px solid var(--r-line);
    color: var(--r-ink-soft);
    font-weight: 600;
    font-size: .85rem;
}

/* ---------- Auth screens ------------------------------------------------- */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1100px 520px at 12% -10%, #dff1e6 0%, transparent 60%),
        radial-gradient(900px 480px at 110% 110%, #dde9fb 0%, transparent 55%),
        var(--r-canvas);
}

.auth-card {
    width: min(960px, 100%);
    background: var(--r-surface);
    border-radius: 20px;
    box-shadow: 0 30px 70px -30px rgba(16, 24, 40, .4);
    overflow: hidden;
}

.auth-card__brand {
    background: linear-gradient(160deg, var(--r-green-600), var(--r-green-700));
    color: #fff;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.auth-card__brand img { max-width: 260px; width: 100%; }
.auth-card__brand h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.auth-card__brand p { font-size: .85rem; opacity: .85; margin: 0; }

.auth-card__body { padding: 2.5rem 2.25rem; }
.auth-card__body h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: .25rem; }
.auth-card__body .lead-sub { color: var(--r-muted); font-size: .875rem; margin-bottom: 1.5rem; }

.form-control-user {
    border-radius: 10rem !important;
    padding: .7rem 1.1rem !important;
    height: auto !important;
    font-size: .9rem !important;
}

.btn-user { border-radius: 10rem !important; padding: .65rem 1rem !important; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--r-muted);
    font-size: .75rem;
    margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--r-line);
}

@media (max-width: 991.98px) {
    .auth-card__brand { padding: 1.75rem; }
    .auth-card__brand img { max-width: 180px; }
    .auth-card__body { padding: 1.75rem 1.5rem; }
}

/* ---------- Charts ------------------------------------------------------- */

.chart-box { position: relative; height: 300px; padding: .5rem .25rem; }

@media (max-width: 767.98px) {
    .page-head, .stat-grid { margin-left: 1rem; margin-right: 1rem; }
    .chart-box { height: 240px; }
}
