/* ==========================================================================
   AffilBit — design system layer, same palette as the mobile app
   Loaded after bootstrap.min.css + theme.min.css. Restyles existing
   Bootstrap 4 markup globally, so every admin and affiliate page inherits it.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    --font-sans: "Inter", "Noto Sans Bengali", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --sidebar-w: 264px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 64px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --primary: #d3192c;
    --primary-hover: #b3122a;
    --primary-soft: rgba(211, 25, 44, .10);
    --success: #157f3d;
    --success-soft: rgba(21, 127, 61, .12);
    --warning: #a16207;
    --warning-soft: rgba(161, 98, 7, .14);
    --danger: #b3122a;
    --danger-soft: rgba(179, 18, 42, .10);
    --info: #1d4ed8;
    --info-soft: rgba(29, 78, 216, .10);

    --bg: #f6f3f3;
    --surface: #ffffff;
    --surface-2: #faf8f8;
    --surface-hover: #f6f3f3;
    --border: #ece8e9;
    --border-strong: #dcd6d8;
    --text: #1c1b1f;
    --text-2: #3d3b40;
    --muted: #5c5a60;
    --ring: 0 0 0 4px rgba(211, 25, 44, .16);

    --shadow-xs: 0 1px 2px rgba(28, 27, 31, .05);
    --shadow-sm: 0 1px 3px rgba(28, 27, 31, .06), 0 1px 2px rgba(28, 27, 31, .04);
    --shadow-md: 0 10px 30px -12px rgba(28, 27, 31, .18);

    --sidebar-bg: #ffffff;
    --sidebar-text: #5c5a60;
    --sidebar-text-strong: #1c1b1f;
    --sidebar-hover: #f6f3f3;
    --sidebar-active: rgba(211, 25, 44, .09);
    --sidebar-active-text: #b3122a;
    --sidebar-border: #ece8e9;
}

:root[data-theme="dark"] {
    --primary: #e5394b;
    --primary-hover: #f0616d;
    --primary-soft: rgba(229, 57, 75, .18);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, .14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .14);
    --danger: #f0616d;
    --danger-soft: rgba(240, 97, 109, .14);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, .14);

    --bg: #141011;
    --surface: #1e191a;
    --surface-2: #181415;
    --surface-hover: #2a2324;
    --border: #332b2d;
    --border-strong: #453b3d;
    --text: #f1eced;
    --text-2: #d9d2d3;
    --muted: #a79fa1;
    --ring: 0 0 0 4px rgba(229, 57, 75, .28);

    --shadow-xs: none;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, .6);

    --sidebar-bg: #181415;
    --sidebar-text: #a79fa1;
    --sidebar-text-strong: #f1eced;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: rgba(229, 57, 75, .20);
    --sidebar-active-text: #ffffff;
    --sidebar-border: rgba(255, 255, 255, .08);
}

/* ---------- 2. Base ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-sans);
    color: var(--text);
    font-weight: 600;
    letter-spacing: -.01em;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); text-decoration: none; }

.text-muted { color: var(--muted) !important; }
.text-dark { color: var(--text) !important; }
.bg-white { background-color: var(--surface) !important; }
.bg-light { background-color: var(--surface-2) !important; }
.border, .border-top, .border-bottom { border-color: var(--border) !important; }
hr { border-top-color: var(--border); }
code { color: var(--primary); }

::selection { background: var(--primary-soft); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. Layout shell ---------- */
#layout-wrapper { min-height: 100vh; }

.main-content {
    margin-left: var(--sidebar-w);
    overflow: visible;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.page-content {
    flex: 1 0 auto;
    padding: calc(var(--topbar-h) + 28px) 12px 32px;
}

.page-content > .container-fluid,
.page-content .content-wrapper > .container-fluid { max-width: 1600px; }

/* ---------- 4. Sidebar ---------- */
.vertical-menu {
    width: var(--sidebar-w);
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: none;
    z-index: 1003;
    transition: width .25s ease, transform .25s ease;
}

.vertical-menu .simplebar-content-wrapper,
.vertical-menu [data-simplebar] { height: 100%; }

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand .logo-full { max-height: 36px; max-width: 170px; object-fit: contain; }

.sidebar-brand .logo-mark {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 10px;
    display: none;
    align-items: center; justify-content: center;
    background: var(--primary);
    color: #fff; font-weight: 700; font-size: 15px;
}

#sidebar-menu { padding: 14px 12px 24px; }

#sidebar-menu .menu-title {
    padding: 18px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted) !important;
    white-space: nowrap;
    pointer-events: none;
}

#sidebar-menu .metismenu li { display: block; width: 100%; }

#sidebar-menu ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: 10px;
    color: var(--sidebar-text) !important;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: background-color .15s ease, color .15s ease;
}

#sidebar-menu ul li a i {
    font-size: 20px;
    min-width: 22px;
    line-height: 1;
    color: inherit;
    opacity: .9;
}

#sidebar-menu ul li a span { flex: 1; overflow: hidden; text-overflow: ellipsis; }

#sidebar-menu ul li a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-strong) !important;
}

#sidebar-menu ul li > a.active,
#sidebar-menu ul li.mm-active > a:not(.has-arrow) {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text) !important;
}

#sidebar-menu ul li > a.active::before,
#sidebar-menu ul li.mm-active > a:not(.has-arrow)::before {
    content: "";
    position: absolute;
    left: -12px; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

#sidebar-menu ul li.mm-active > a.has-arrow { color: var(--sidebar-text-strong) !important; }

/* chevron for groups */
#sidebar-menu .has-arrow::after {
    content: "\ea17";            /* bx-chevron-down */
    font-family: "boxicons";
    border: 0;
    width: auto; height: auto;
    position: static;
    transform: none;
    margin-left: auto;
    font-size: 18px;
    opacity: .6;
    transition: transform .2s ease;
}
#sidebar-menu .mm-active > .has-arrow::after { transform: rotate(180deg); }

#sidebar-menu .sub-menu {
    padding: 2px 0 6px 22px;
    margin-left: 11px;
    border-left: 1px solid var(--sidebar-border);
}
#sidebar-menu .sub-menu li a {
    padding: 7px 12px;
    font-size: 13.5px;
    font-weight: 400;
}
#sidebar-menu .sub-menu li a.active { background: transparent; color: var(--sidebar-active-text) !important; font-weight: 500; }
#sidebar-menu .sub-menu li a.active::before {
    left: -23px; top: 50%; bottom: auto;
    width: 7px; height: 7px; margin-top: -3.5px;
    border-radius: 50%;
}

.metismenu .mm-collapse:not(.mm-show) { display: none; }
.metismenu .mm-collapsing { height: 0; overflow: hidden; transition: height .25s ease; }

/* collapsed (desktop) — icon rail, expands on hover */
@media (min-width: 993px) {
    body.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed #page-topbar { left: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .vertical-menu { width: var(--sidebar-w-collapsed); }

    body.sidebar-collapsed .vertical-menu:not(:hover) .logo-full,
    body.sidebar-collapsed .vertical-menu:not(:hover) #sidebar-menu a span,
    body.sidebar-collapsed .vertical-menu:not(:hover) #sidebar-menu .has-arrow::after,
    body.sidebar-collapsed .vertical-menu:not(:hover) #sidebar-menu .sub-menu { display: none !important; }

    body.sidebar-collapsed .vertical-menu:not(:hover) .logo-mark { display: flex; }
    body.sidebar-collapsed .vertical-menu:not(:hover) .sidebar-brand { padding: 0 20px; }
    body.sidebar-collapsed .vertical-menu:not(:hover) #sidebar-menu .menu-title { visibility: hidden; height: 12px; padding: 0; }
    body.sidebar-collapsed .vertical-menu:not(:hover) #sidebar-menu ul li a { justify-content: center; }

    body.sidebar-collapsed .vertical-menu:hover {
        width: var(--sidebar-w);
        box-shadow: 12px 0 40px -12px rgba(0, 0, 0, .45);
    }
}

/* mobile off-canvas */
@media (max-width: 992px) {
    .vertical-menu {
        display: block !important;
        transform: translateX(-100%);
        width: 280px;
    }
    body.enable-vertical-menu .vertical-menu { transform: none; box-shadow: var(--shadow-md); }
    .main-content { margin-left: 0 !important; }
    .menu-overlay {
        position: fixed;
        z-index: 1002;
        background: rgba(2, 6, 23, .5);
        backdrop-filter: blur(2px);
    }
    body.enable-vertical-menu { overflow: hidden; }
}

/* ---------- 5. Topbar ---------- */
#page-topbar {
    left: var(--sidebar-w);
    height: var(--topbar-h);
    z-index: 1002;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    transition: left .25s ease;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    #page-topbar { background: var(--surface); }
}
@media (max-width: 992px) { #page-topbar { left: 0; } }

#page-topbar .navbar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 0 12px;
    background: transparent !important;
    box-shadow: none;
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }

.topbar-title {
    margin: 0 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 21px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.topbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 8px; }

.user-trigger {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 4px 4px;
    border: 0; border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.user-trigger:hover { background: var(--surface-hover); }
.user-trigger:focus { outline: none; }
.user-trigger .user-meta { text-align: left; line-height: 1.2; }
.user-trigger .user-name { font-size: 13.5px; font-weight: 600; display: block; }
.user-trigger .user-role { font-size: 12px; color: var(--muted); }
.user-trigger i { color: var(--muted); font-size: 18px; }

.avatar {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 10px;
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary);
    color: #fff; font-weight: 600; font-size: 14px;
}

/* ---------- 6. Page header / breadcrumb ---------- */
.page-title-box {
    padding: 0 0 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: space-between;
}
.page-title-box h4,
.content-header h1 {
    font-size: 22px !important;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0;
}
.content-header { padding: 0 0 12px; }

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}
.breadcrumb-item a { color: var(--muted); }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-2); font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before { content: "/"; color: var(--border-strong); }

.page-subtitle { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }

/* ---------- 7. Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 24px;
    color: var(--text);
}
.card > form { padding: 20px 24px 0; }
.card-body { padding: 24px; }
.card-header, .card-footer {
    background: transparent;
    border-color: var(--border);
    padding: 16px 24px;
}
.card-header:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card-footer:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-title, .card-header h4, .card-header h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
}
.card-header .card-title { margin-bottom: 0; }
.card-outline { border-top: 3px solid var(--primary); }

.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.card-head h5 { margin: 0; font-size: 15.5px; font-weight: 600; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- 8. Buttons ---------- */
.btn {
    font-weight: 500;
    font-size: 14px;
    border-radius: 10px;
    padding: 8px 16px;
    line-height: 1.45;
    border-width: 1px;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus, .btn.focus { box-shadow: var(--ring) !important; }
.btn i { vertical-align: -1px; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 11px 22px; font-size: 15px; border-radius: 12px; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:not(:disabled):not(.disabled):active { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-success { background: #157f3d; border-color: #157f3d; color: #fff; }
.btn-success:hover, .btn-success:not(:disabled):not(.disabled):active { background: #145c2e; border-color: #145c2e; color: #fff; }

.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover, .btn-danger:not(:disabled):not(.disabled):active { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-warning { background: #a16207; border-color: #a16207; color: #fff; }
.btn-warning:hover, .btn-warning:not(:disabled):not(.disabled):active { background: #7a4e06; border-color: #7a4e06; color: #fff; }

.btn-info { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn-info:hover, .btn-info:not(:disabled):not(.disabled):active { background: #1e40af; border-color: #1e40af; color: #fff; }

.btn-secondary, .btn-light {
    background: var(--surface); border-color: var(--border-strong); color: var(--text-2);
}
.btn-secondary:hover, .btn-light:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }

.btn-dark { background: #1c1b1f; border-color: #1c1b1f; color: #fff; }

[class*="btn-outline-"] { background: transparent; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

/* legacy "btn-sm btn-info" links without .btn → compact icon buttons */
a.btn-sm:not(.btn), button.btn-sm:not(.btn) {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px;
    padding: 0 8px;
    margin: 2px 1px;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    color: #fff !important;
    cursor: pointer;
    vertical-align: middle;
    transition: filter .15s ease;
}
a.btn-sm:not(.btn):hover, button.btn-sm:not(.btn):hover { filter: brightness(.92); }
.btn-sm.btn-info:not(.btn) { background: #1d4ed8; }
.btn-sm.btn-danger:not(.btn) { background: #b3122a; }
.btn-sm.btn-success:not(.btn) { background: #157f3d; }
.btn-sm.btn-warning:not(.btn) { background: #a16207; }
.btn-sm.btn-primary:not(.btn) { background: var(--primary); }

/* ---------- 9. Forms ---------- */
label, .col-form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}
.form-group { margin-bottom: 18px; }

.form-control, .custom-select {
    height: 42px;
    padding: 9px 13px;
    font-size: 14px;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: var(--shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--muted); opacity: .75; }
.form-control:focus, .custom-select:focus {
    color: var(--text);
    background-color: var(--surface);
    border-color: var(--primary);
    box-shadow: var(--ring);
}
.form-control:disabled, .form-control[readonly] {
    background-color: var(--surface-2);
    color: var(--muted);
    opacity: 1;
}
textarea.form-control { height: auto; min-height: 96px; }
select.form-control:not([size]):not([multiple]) { height: 42px; }
.form-control-sm, .custom-select-sm { height: 34px !important; padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.form-control[type="file"] { padding: 6px; height: 42px; cursor: pointer; }
.form-control[type="file"]::file-selector-button {
    border: 0; border-radius: 7px;
    padding: 5px 12px; margin-right: 12px;
    background: var(--primary-soft); color: var(--primary);
    font-weight: 500; cursor: pointer;
}

.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3e%3cpath d='M5.3 7.3a1 1 0 011.4 0L10 10.6l3.3-3.3a1 1 0 111.4 1.4l-4 4a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 32px;
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.invalid-feedback, .form-group .text-danger { font-size: 12.5px; margin-top: 5px; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }

.input-group-text {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--muted);
    border-radius: 10px;
}

.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--primary); border-color: var(--primary); }
.custom-control-label { font-weight: 400; }

/* form footer with actions */
.form-actions {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end;
    padding-top: 18px; margin-top: 6px;
    border-top: 1px solid var(--border);
}

/* Select2 */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 42px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; padding-left: 13px; color: var(--text); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; right: 8px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--primary); box-shadow: var(--ring); }
.select2-dropdown { background: var(--surface); border-color: var(--border); border-radius: 10px; box-shadow: var(--shadow-md); overflow: hidden; }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--primary); }
.select2-container--default .select2-search--dropdown .select2-search__field { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--primary-soft); border: 0; color: var(--primary); border-radius: 6px; }

/* Dropify */
.dropify-wrapper { border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.dropify-wrapper:hover { background-image: none; border-color: var(--primary); }

/* ---------- 10. Tables ---------- */
.table {
    color: var(--text-2);
    margin-bottom: 0;
    font-size: 13.5px;
}
.table th, .table td {
    padding: 13px 16px;
    vertical-align: middle;
    border-top: 1px solid var(--border);
}
.table thead th,
.table th {
    background: var(--surface-2) !important;
    color: var(--muted);
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    border-top: 0;
}
.table tbody th { text-transform: none; letter-spacing: 0; font-size: 13.5px !important; color: var(--text); }
.table tfoot th, .table tfoot td {
    background: var(--surface-2) !important;
    color: var(--text);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13.5px !important;
    border-top: 1px solid var(--border-strong);
}
.table tbody tr { transition: background-color .12s ease; }
.table-hover tbody tr:hover, .table tbody tr:hover { background-color: var(--surface-hover); color: var(--text); }
.table-striped tbody tr:nth-of-type(odd) { background-color: var(--surface-2); }
.table-bordered, .table-bordered th, .table-bordered td { border-color: var(--border); }
.table-borderless td, .table-borderless th { border: 0; }
.table-sm th, .table-sm td { padding: 8px 12px; }

.table td .row { margin: 0; flex-wrap: nowrap; gap: 4px; align-items: center; }
.table td form { display: inline-block; margin: 0; }
.table td .btn + .btn, .table td .btn + form, .table td form + .btn, .table td form + a { margin-left: 2px; }
.table td .btn-sm { min-width: 32px; }

/* tables that sit directly in a card get a clean, framed wrapper */
.card-body > .table-responsive,
.card-body > .filter_data,
.card-body > .table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.card-body > .table-responsive > .table,
.card-body > .filter_data > .table { margin: 0; }

/* sticky head scroll tables used across list pages */
table.fixTableHead {
    height: auto !important;
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
table.fixTableHead thead th { position: sticky; top: 0; z-index: 2; }
.table-responsive { border-radius: var(--radius); }

/* ---------- 11. Badges & status ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 999px;
    letter-spacing: .01em;
}
.badge.bg-success, .badge-success { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.bg-warning, .badge-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.badge.bg-danger, .badge-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge.bg-info, .badge-info { background: var(--info-soft) !important; color: var(--info) !important; }
.badge.bg-primary, .badge-primary { background: var(--primary-soft) !important; color: var(--primary) !important; }
.badge.bg-secondary, .badge-secondary, .badge-light { background: var(--surface-hover) !important; color: var(--muted) !important; }
.badge.bg-success::before, .badge-success::before,
.badge.bg-warning::before, .badge-warning::before,
.badge.bg-danger::before, .badge-danger::before,
.badge.bg-info::before, .badge-info::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ---------- 12. Alerts / toasts ---------- */
.alert {
    display: flex; gap: 12px; align-items: flex-start;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 13px 16px;
    font-size: 14px;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert > i { font-size: 20px; line-height: 1.1; }
.alert .alert-body { flex: 1; }
.alert .close { margin-left: auto; padding: 0 4px; font-size: 20px; color: inherit; opacity: .6; text-shadow: none; position: static; }
.alert-success { background: var(--success-soft); border-color: rgba(21, 127, 61, .25); color: var(--success); }
.alert-danger { background: var(--danger-soft); border-color: rgba(179, 18, 42, .25); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: rgba(161, 98, 7, .25); color: var(--warning); }
.alert-info { background: var(--info-soft); border-color: rgba(29, 78, 216, .25); color: var(--info); }

#toast-container > div { border-radius: 12px; box-shadow: var(--shadow-md) !important; opacity: 1; font-family: var(--font-sans); padding: 14px 16px 14px 50px; }
#toast-container > div:hover { box-shadow: var(--shadow-md) !important; }

/* ---------- 13. Pagination & DataTables ---------- */
.pagination { gap: 4px; flex-wrap: wrap; margin: 18px 0 0; }
.page-link {
    min-width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border) !important;
    border-radius: 9px !important;
    background: var(--surface);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    margin: 0 !important;
}
.page-link:hover { background: var(--surface-hover); color: var(--text); }
.page-link:focus { box-shadow: var(--ring); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary) !important; color: #fff; }
.page-item.disabled .page-link { background: var(--surface-2); color: var(--muted); opacity: .7; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    padding: 4px 10px;
    margin-left: 6px;
}
.dataTables_wrapper .dataTables_filter input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: 13px; padding-top: 22px !important; }
.dt-buttons .btn { margin-right: 4px; }
table.dataTable { border-collapse: collapse !important; margin: 12px 0 !important; }
.dataTables_length label, .dataTables_filter label { font-weight: 400; color: var(--muted); }

/* ---------- 14. Dropdowns, nav, modal, misc ---------- */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    font-size: 14px;
    animation: dd-in .14s ease-out;
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-2);
}
.dropdown-item i { font-size: 18px; color: var(--muted); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-hover); color: var(--text); }
.dropdown-item.text-danger:hover i, .dropdown-item.text-danger i { color: var(--danger); }
.dropdown-divider { border-color: var(--border); margin: 6px 0; }
.dropdown-header { padding: 8px 12px; }

.nav-pills .nav-link { border-radius: 9px; color: var(--muted); font-weight: 500; padding: 7px 14px; }
.nav-pills .nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-tabs { border-color: var(--border); }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; }
.nav-tabs .nav-link.active { background: transparent; color: var(--primary); border-bottom-color: var(--primary); }

.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.modal-header, .modal-footer { border-color: var(--border); padding: 16px 24px; }
.modal-body { padding: 24px; }
.modal-backdrop.show { opacity: .55; }
.close { color: var(--text); }

.list-group-item { background: var(--surface); border-color: var(--border); color: var(--text-2); }

.img-circle { border-radius: 50%; }
.profile-user-img { border: 3px solid var(--border); padding: 3px; object-fit: cover; aspect-ratio: 1; }
.profile-username { font-size: 16px; margin-top: 12px; }

/* ---------- 15. Footer ---------- */
.footer {
    position: static;
    left: auto;
    padding: 18px 24px;
    background: transparent !important;
    color: var(--muted) !important;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.footer a { color: var(--text-2); font-weight: 500; }
.footer a:hover { color: var(--primary); }

/* ---------- 16. Dashboard widgets ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
    overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-card .stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .stat-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 21px;
}
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }

.section-label {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted);
    margin: 4px 0 12px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.hero-card {
    background: linear-gradient(120deg, #d3192c 0%, #a8101f 100%);
    color: #fff;
    border: 0;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.hero-card::after {
    content: ""; position: absolute; right: -60px; top: -80px;
    width: 260px; height: 260px; border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.hero-card h2 { color: #fff; font-size: 22px; margin: 0 0 4px; }
.hero-card p { margin: 0; opacity: .85; }
.hero-card .hero-metric { position: relative; z-index: 1; text-align: right; }
.hero-card .hero-metric span { display: block; font-size: 12.5px; opacity: .8; }
.hero-card .hero-metric strong { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }

.chart-wrap { position: relative; height: 320px; padding: 16px 20px 20px; }

.activity-list { list-style: none; margin: 0; padding: 6px 0; }
.activity-list li {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: 0; }
.activity-list .a-main { flex: 1; min-width: 0; }
.activity-list .a-title { font-weight: 500; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-list .a-sub { font-size: 12.5px; color: var(--muted); }
.activity-list .a-amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }

.empty-state { padding: 36px 24px; text-align: center; color: var(--muted); }
.empty-state i { font-size: 34px; display: block; margin-bottom: 8px; opacity: .6; }

.card-flush .table th:first-child, .card-flush .table td:first-child { padding-left: 24px; }
.card-flush .table th:last-child, .card-flush .table td:last-child { padding-right: 24px; }
.card-flush .table thead th { border-top: 0; }

/* ---------- 17. Responsive tweaks ---------- */
@media (max-width: 768px) {
    .page-content { padding: calc(var(--topbar-h) + 18px) 4px 24px; }
    .card-body { padding: 18px; }
    .card > form { padding: 16px 18px 0; }
    .page-title-box h4, .content-header h1 { font-size: 19px !important; }
    .stat-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 21px; }
    .hero-card { padding: 20px; }
    .hero-card .hero-metric { text-align: left; }
    #page-topbar .navbar-header { padding: 0 10px 0 6px; }
    .footer { text-align: center; }
    .footer .text-sm-right { text-align: center !important; }
}

/* ---------- 18. Print ---------- */
@media print {
    .vertical-menu, #page-topbar, .footer, .menu-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { border: 0; box-shadow: none; }
}

/* ---------- 19. AffilBit brand ---------- */
.vertical-menu { border-right: 1px solid var(--sidebar-border); }
.sidebar-brand.brand-text .logo-mark { display: flex; }
.sidebar-brand .logo-name { color: var(--sidebar-text-strong); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.sidebar-brand:hover .logo-name { color: var(--sidebar-text-strong); }
.btn-danger:hover { color: #fff; }

/* ---------- 20. Login pages ---------- */
.auth-page { min-height: 100vh; background: var(--bg); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }

.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 48px 32px;
    background: linear-gradient(150deg, #d3192c 0%, #a8101f 100%);
    color: #fff;
}
.auth-hero::before, .auth-hero::after {
    content: ""; position: absolute; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .16);
}
.auth-hero::before { width: 520px; height: 520px; left: -160px; bottom: -220px; }
.auth-hero::after { width: 320px; height: 320px; right: -90px; top: -110px; background: rgba(255, 255, 255, .06); border: 0; }
.auth-hero-inner { position: relative; z-index: 1; max-width: 360px; width: 100%; }
.auth-logo {
    width: 72px; height: 72px; border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    background: #fff; color: #d3192c;
    box-shadow: 0 16px 40px rgba(80, 0, 16, .35);
}
.auth-hero h1 { color: #fff; font-size: 34px; font-weight: 700; margin: 20px 0 4px; }
.auth-hero p { color: rgba(255, 255, 255, .92); font-size: 16px; margin: 0; }
.auth-ladder { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 28px 0 0; }
.auth-ladder li {
    padding: 4px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff; font-size: 13px; font-weight: 600;
}

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card {
    width: 100%; max-width: 420px;
    padding: 32px 28px;
    background: var(--surface);
    border-radius: 22px;
    box-shadow: 0 10px 28px rgba(120, 10, 25, .10);
}
.auth-card h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.auth-card .form-group { margin-bottom: 16px; }
.auth-card .form-control { height: 46px; border-radius: 12px; font-size: 15px; }
.auth-card .form-control[readonly] { background: var(--surface-2); color: var(--muted); }
.auth-row { text-align: right; margin: -6px 0 16px; font-size: 13.5px; }
.auth-submit { height: 48px; border-radius: 14px; font-size: 15px; font-weight: 600; }
.auth-help { margin: 20px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.auth-help a { font-weight: 600; }

@media (max-width: 991.98px) {
    .auth-shell { display: block; }
    .auth-hero { display: block; padding: 32px 24px 76px; }
    .auth-hero-inner { max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
    .auth-logo { width: 52px; height: 52px; border-radius: 16px; grid-row: span 2; }
    .auth-logo svg { width: 26px; height: 26px; }
    .auth-hero h1 { font-size: 24px; margin: 0; }
    .auth-hero p { font-size: 14px; }
    .auth-ladder { display: none; }
    .auth-main { display: block; padding: 0 16px 32px; margin-top: -48px; position: relative; z-index: 2; }
    .auth-card { margin: 0 auto; padding: 26px 20px; }
}

/* ---------- 21. Tables and checkboxes in both themes ---------- */
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--border) !important; }
.table .thead-light th { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* theme.min.css leaves room for a sidebar the shell already offsets */
#page-topbar .navbar-header { margin-left: 0; }

/* ---------- 22. Colorful sidebar icons, same tiles as the app's services ---------- */
#side-menu > li:nth-child(8n+1) { --ic: #d3192c; --ic-soft: #fdecee; }
#side-menu > li:nth-child(8n+2) { --ic: #1d4ed8; --ic-soft: #e8effd; }
#side-menu > li:nth-child(8n+3) { --ic: #157f3d; --ic-soft: #e7f6ec; }
#side-menu > li:nth-child(8n+4) { --ic: #6d28d9; --ic-soft: #f1eafb; }
#side-menu > li:nth-child(8n+5) { --ic: #c2410c; --ic-soft: #fef0e4; }
#side-menu > li:nth-child(8n+6) { --ic: #0f766e; --ic-soft: #e3f5f3; }
#side-menu > li:nth-child(8n+7) { --ic: #a16207; --ic-soft: #fcf3dc; }
#side-menu > li:nth-child(8n+8) { --ic: #be185d; --ic-soft: #fce7f3; }

:root[data-theme="dark"] #side-menu > li:nth-child(8n+1) { --ic: #f0616d; --ic-soft: rgba(240, 97, 109, .18); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+2) { --ic: #7aa2ff; --ic-soft: rgba(122, 162, 255, .18); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+3) { --ic: #4ade80; --ic-soft: rgba(74, 222, 128, .16); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+4) { --ic: #b794f6; --ic-soft: rgba(183, 148, 246, .18); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+5) { --ic: #fb923c; --ic-soft: rgba(251, 146, 60, .18); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+6) { --ic: #2dd4bf; --ic-soft: rgba(45, 212, 191, .16); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+7) { --ic: #facc15; --ic-soft: rgba(250, 204, 21, .16); }
:root[data-theme="dark"] #side-menu > li:nth-child(8n+8) { --ic: #f472b6; --ic-soft: rgba(244, 114, 182, .18); }

#sidebar-menu #side-menu > li > a > i {
    width: 30px; height: 30px; min-width: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    font-size: 18px;
    color: var(--ic);
    background: var(--ic-soft);
    opacity: 1;
}
#sidebar-menu #side-menu > li > a { padding-top: 6px; padding-bottom: 6px; }

/* ---------- 23. Colorful dashboard cards ---------- */
.stat-card, .dash-card { --card-a: #d3192c; --card-b: #a8101f; }
.stat-grid .stat-card:nth-child(8n+1) { --card-a: #d3192c; --card-b: #a8101f; }
.stat-grid .stat-card:nth-child(8n+2) { --card-a: #1d4ed8; --card-b: #1e3a8a; }
.stat-grid .stat-card:nth-child(8n+3) { --card-a: #b45309; --card-b: #7a4e06; }
.stat-grid .stat-card:nth-child(8n+4) { --card-a: #157f3d; --card-b: #145c2e; }
.stat-grid ~ .stat-grid .stat-card:nth-child(8n+1) { --card-a: #6d28d9; --card-b: #4c1d95; }
.stat-grid ~ .stat-grid .stat-card:nth-child(8n+2) { --card-a: #0f766e; --card-b: #115e59; }
.stat-grid ~ .stat-grid .stat-card:nth-child(8n+3) { --card-a: #c2410c; --card-b: #9a3412; }
.stat-grid ~ .stat-grid .stat-card:nth-child(8n+4) { --card-a: #be185d; --card-b: #9d174d; }

.dash-red { --card-a: #d3192c; --card-b: #a8101f; }
.dash-blue { --card-a: #1d4ed8; --card-b: #1e3a8a; }
.dash-amber { --card-a: #b45309; --card-b: #7a4e06; }
.dash-green { --card-a: #157f3d; --card-b: #145c2e; }
.dash-purple { --card-a: #6d28d9; --card-b: #4c1d95; }
.dash-teal { --card-a: #0f766e; --card-b: #115e59; }
.dash-orange { --card-a: #c2410c; --card-b: #9a3412; }
.dash-pink { --card-a: #be185d; --card-b: #9d174d; }

.stat-card, .dash-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--card-a), var(--card-b));
    border: 0;
    box-shadow: 0 10px 24px -14px var(--card-b);
}
.stat-card::after, .dash-card::after {
    content: ""; position: absolute; right: -36px; top: -44px;
    width: 130px; height: 130px; border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    pointer-events: none;
}
.stat-card > *, .dash-card > * { position: relative; z-index: 1; }
.stat-card:hover { border-color: transparent; box-shadow: 0 16px 30px -14px var(--card-b); }

.stat-card .stat-label, .stat-card .stat-value { color: #fff; }
.stat-card .stat-foot { color: rgba(255, 255, 255, .88); }
.stat-card .stat-icon { background: rgba(255, 255, 255, .20) !important; color: #fff !important; }

.dash-card h3, .dash-card h4, .dash-card h6, .dash-card span, .dash-card a, .dash-card i, .dash-card .text-muted { color: #fff !important; }
.dash-card { height: calc(100% - 24px); min-height: 150px; }
