/* Spectranet Admin — matches frontend brand theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --sn-red: #E30613;
    --sn-red-dark: #C10510;
    --sn-red-soft: #FDE8EA;
    --sn-navy: #0B1220;
    --sn-ink: #111827;
    --sn-muted: #6B7280;
    --sn-border: #E5E7EB;
    --sn-border-strong: #D1D5DB;
    --sn-bg: #F7F8FA;
    --sn-surface: #FFFFFF;
    --sn-sidebar-width: 272px;
    --sn-radius: 14px;
    --sn-radius-sm: 10px;
    --sn-shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 8px 24px rgba(11, 18, 32, .04);
    --sn-shadow-sm: 0 1px 2px rgba(11, 18, 32, .05);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.admin-body {
    margin: 0;
    background: var(--sn-bg);
    color: var(--sn-ink);
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.admin-body.sidebar-open { overflow: hidden; }

img, svg, video { max-width: 100%; height: auto; }

a { color: var(--sn-red); text-decoration: none; }
a:hover { color: var(--sn-red-dark); }

/* Sidebar */
.admin-sidebar {
    width: min(var(--sn-sidebar-width), 88vw);
    background: var(--sn-surface);
    border-right: 1px solid var(--sn-border);
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    overflow: hidden;
}

.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--sn-border);
    flex-shrink: 0;
}

.admin-sidebar .brand img {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.admin-sidebar .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}

.admin-sidebar .brand-text strong {
    color: var(--sn-navy);
    font-weight: 700;
    font-size: 1rem;
}

.admin-sidebar .brand-text span {
    color: var(--sn-red);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.admin-sidebar-close {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--sn-border);
    background: #fff;
    border-radius: 10px;
    color: var(--sn-ink);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-sidebar-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: .75rem 0 1.5rem;
    overscroll-behavior: contain;
}

.admin-sidebar .nav-section {
    color: var(--sn-muted);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 1rem 1.2rem .35rem;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: #374151;
    border-radius: 10px;
    margin: .12rem .65rem;
    padding: .7rem .85rem;
    font-weight: 500;
    font-size: .9rem;
    min-height: 44px;
    transition: background .15s ease, color .15s ease;
}

.admin-sidebar .nav-link i {
    font-size: 1.05rem;
    color: #9CA3AF;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.admin-sidebar .nav-link:hover {
    background: #F3F4F6;
    color: var(--sn-navy);
}

.admin-sidebar .nav-link:hover i { color: var(--sn-red); }

.admin-sidebar .nav-link.active {
    background: var(--sn-red-soft);
    color: var(--sn-red);
    font-weight: 600;
}

.admin-sidebar .nav-link.active i { color: var(--sn-red); }

.admin-main {
    margin-left: var(--sn-sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    min-width: 0;
    width: auto;
}

.admin-topbar {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--sn-border);
    padding: .75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: .75rem;
}

.admin-topbar .page-heading {
    font-weight: 700;
    color: var(--sn-navy);
    font-size: 1rem;
    line-height: 1.25;
    word-break: break-word;
}

.admin-topbar .topbar-title-wrap {
    min-width: 0;
    flex: 1;
}

.admin-topbar .breadcrumb {
    margin: 0;
    flex-wrap: wrap;
    --bs-breadcrumb-divider-color: #D1D5DB;
}

.admin-topbar .breadcrumb-item,
.admin-topbar .breadcrumb-item a {
    color: var(--sn-muted);
    font-size: .75rem;
}

.admin-topbar .breadcrumb-item.active { color: var(--sn-ink); }

.admin-topbar #sidebarToggle {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-content {
    padding: 1rem;
    min-width: 0;
    max-width: 100%;
}

.admin-user-btn {
    border: 1px solid var(--sn-border);
    background: #fff;
    border-radius: 999px;
    padding: .3rem .65rem .3rem .35rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-weight: 500;
    color: var(--sn-ink);
    max-width: 100%;
}

.admin-user-btn:hover,
.admin-user-btn:focus {
    background: #F9FAFB;
    border-color: var(--sn-border-strong);
}

.admin-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--sn-red-soft);
    color: var(--sn-red);
    border-radius: 999px;
    padding: .25rem .7rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

/* Cards */
.stat-card,
.card.stat-card,
.admin-card {
    background: var(--sn-surface);
    border: 1px solid var(--sn-border) !important;
    border-radius: var(--sn-radius) !important;
    box-shadow: none !important;
    max-width: 100%;
}

.stat-card .card-body,
.admin-card .card-body {
    padding: 1rem;
}

.stat-card .stat-label {
    color: var(--sn-muted);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: .35rem;
}

.stat-card .stat-value {
    color: var(--sn-navy);
    font-size: clamp(1.25rem, 4vw, 1.65rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.1;
    word-break: break-word;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--sn-red-soft);
    color: var(--sn-red);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    border-radius: 999px;
    font-weight: 600;
    font-size: .875rem;
    padding: .55rem 1.1rem;
    min-height: 42px;
}

.btn-sm {
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .8rem;
    min-height: 36px;
}

.btn-primary {
    background: var(--sn-red) !important;
    border-color: var(--sn-red) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--sn-red-dark) !important;
    border-color: var(--sn-red-dark) !important;
}

.btn-outline-primary {
    color: var(--sn-red) !important;
    border-color: var(--sn-red) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: var(--sn-red-soft) !important;
}

.btn-outline-secondary {
    border-color: var(--sn-border-strong) !important;
    color: #374151 !important;
    background: #fff !important;
}

.btn-outline-secondary:hover {
    background: #F3F4F6 !important;
}

.btn-outline-danger { border-radius: 999px; }

/* Forms */
.form-control,
.form-select {
    border-radius: 10px !important;
    border-color: var(--sn-border-strong) !important;
    padding: .65rem .85rem;
    font-size: 16px; /* prevents iOS zoom */
    max-width: 100%;
}

@media (min-width: 768px) {
    .form-control,
    .form-select { font-size: .9rem; }
}

.form-control:focus,
.form-select:focus {
    border-color: var(--sn-red) !important;
    box-shadow: 0 0 0 .2rem rgba(227, 6, 19, .12) !important;
}

.form-label {
    font-weight: 600;
    color: var(--sn-navy);
    font-size: .85rem;
    margin-bottom: .35rem;
}

/* Tables — keep horizontal scroll on small screens */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    min-width: 640px;
}

.table thead th {
    background: #F9FAFB;
    color: var(--sn-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--sn-border) !important;
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: .9rem 1rem;
    vertical-align: middle;
    border-color: var(--sn-border) !important;
    color: var(--sn-ink);
}

.table-hover tbody tr:hover { background: #FAFAFA; }

.table-responsive {
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    background: #fff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Nested table-responsive inside cards shouldn't double-border oddly */
.card .table-responsive {
    border: 0;
    border-radius: 0;
}

/* Badges */
.badge {
    border-radius: 999px;
    font-weight: 600;
    padding: .35em .7em;
    white-space: normal;
    text-align: left;
}

.text-bg-success { background: #ECFDF5 !important; color: #047857 !important; }
.text-bg-secondary { background: #F3F4F6 !important; color: #4B5563 !important; }
.text-bg-warning { background: #FFF7ED !important; color: #C2410C !important; }
.text-bg-danger { background: var(--sn-red-soft) !important; color: var(--sn-red) !important; }
.text-bg-info { background: #EFF6FF !important; color: #1D4ED8 !important; }
.text-bg-primary { background: var(--sn-red-soft) !important; color: var(--sn-red) !important; }

/* Alerts */
.alert {
    border-radius: 12px;
    border: 1px solid transparent;
    word-break: break-word;
}

.alert-success {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #065F46;
}

.alert-danger {
    background: var(--sn-red-soft);
    border-color: #FECACA;
    color: #991B1B;
}

/* Pagination */
.pagination {
    flex-wrap: wrap;
    gap: .25rem;
    justify-content: center;
}

.pagination .page-link {
    border-radius: 999px !important;
    margin: 0;
    border: 1px solid var(--sn-border);
    color: var(--sn-ink);
    min-width: 38px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background: var(--sn-red);
    border-color: var(--sn-red);
}

.pagination .page-link:hover {
    background: var(--sn-red-soft);
    color: var(--sn-red);
}

/* Filter bar */
.admin-filters {
    background: #fff;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Full-width only when a button is the sole child of a column */
.admin-filters .row > [class*="col"] > .btn:only-child {
    width: 100%;
}

.admin-filters .d-flex,
.card.stat-card form .d-flex {
    flex-wrap: wrap;
    gap: .5rem !important;
    align-items: stretch;
}

.admin-filters .d-flex .btn,
.card.stat-card form .d-flex .btn {
    width: auto;
    flex: 1 1 calc(50% - .25rem);
    min-width: 110px;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .admin-filters .d-flex .btn,
    .card.stat-card form .d-flex .btn {
        flex: 0 0 auto;
    }
}

/* Page header / form actions */
.admin-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem 1rem;
    margin-bottom: 1rem;
}

.admin-page-header h1,
.admin-page-header .h4 {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.admin-page-header .actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    width: 100%;
    align-items: center;
}

.admin-page-header .actions .btn {
    flex: 1 1 auto;
    white-space: nowrap;
}

@media (min-width: 576px) {
    .admin-page-header .actions {
        width: auto;
        max-width: 100%;
    }
    .admin-page-header .actions .btn {
        flex: 0 0 auto;
    }
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .25rem;
}

.admin-form-actions .btn {
    flex: 1 1 calc(50% - .25rem);
    min-width: 120px;
    white-space: nowrap;
}

@media (min-width: 576px) {
    .admin-form-actions .btn {
        flex: 0 0 auto;
    }
}

/* ========== Modern dropdowns (menus + selects) ========== */
.dropdown-menu {
    --bs-dropdown-spacer: .5rem;
    border: 1px solid var(--sn-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(11, 18, 32, .12), 0 2px 8px rgba(11, 18, 32, .06) !important;
    padding: .45rem !important;
    max-width: min(320px, calc(100vw - 1.25rem));
    min-width: 220px;
    overflow: hidden;
    animation: snDropdownIn .16s ease-out;
    background: #fff !important;
    z-index: 1080;
}

@keyframes snDropdownIn {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
    border-radius: 10px !important;
    font-size: .9rem;
    font-weight: 500;
    padding: .7rem .85rem !important;
    min-height: 44px;
    display: flex !important;
    align-items: center;
    gap: .55rem;
    color: var(--sn-ink) !important;
    white-space: normal;
    line-height: 1.3;
}

.dropdown-item i {
    width: 1.15rem;
    text-align: center;
    color: #9CA3AF;
    flex-shrink: 0;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #F3F4F6 !important;
    color: var(--sn-navy) !important;
}

.dropdown-item:hover i,
.dropdown-item:focus i {
    color: var(--sn-red);
}

.dropdown-item.text-danger,
.dropdown-item.text-danger:hover {
    color: var(--sn-red) !important;
}

.dropdown-item.text-danger i {
    color: var(--sn-red) !important;
}

.dropdown-divider {
    margin: .35rem .4rem !important;
    border-color: var(--sn-border) !important;
    opacity: 1;
}

.dropdown-header {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--sn-muted);
    padding: .5rem .85rem .25rem;
}

.admin-user-btn.dropdown-toggle {
    max-width: min(200px, 42vw);
}

.admin-user-btn.dropdown-toggle::after {
    margin-left: .4rem;
    flex-shrink: 0;
    vertical-align: middle;
}

.admin-user-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Native <select> modern look (fallback before JS enhances) */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right .85rem center !important;
    background-size: 14px 14px !important;
    padding-right: 2.4rem !important;
    cursor: pointer;
}

.form-select:hover {
    border-color: #9CA3AF !important;
}

.form-select-sm {
    padding-right: 2rem !important;
    background-position: right .65rem center !important;
    background-size: 12px 12px !important;
}

/* ========== Custom select dropdown (replaces native open menu) ========== */
.sn-select {
    position: relative;
    display: block;
    width: 100%;
}

.sn-select.sn-select-auto {
    width: auto;
    min-width: 160px;
    display: inline-block;
}

.sn-select-native {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    z-index: -1;
}

.col-auto > .sn-select {
    width: auto;
    min-width: 160px;
}

.sn-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 42px;
    padding: .55rem 1rem;
    border: 1px solid var(--sn-border);
    border-radius: 12px;
    background: #fff;
    color: var(--sn-ink);
    font-size: .925rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
}

.sn-select-sm .sn-select-trigger {
    min-height: 34px;
    padding: .35rem .75rem;
    font-size: .825rem;
    border-radius: 10px;
}

.sn-select-trigger:hover {
    border-color: #9CA3AF;
}

.sn-select-trigger:focus {
    outline: none;
    border-color: rgba(227, 6, 19, .45);
    box-shadow: 0 0 0 .2rem rgba(227, 6, 19, .12);
}

.sn-select.is-open .sn-select-trigger {
    border-color: rgba(227, 6, 19, .5);
    box-shadow: 0 0 0 .2rem rgba(227, 6, 19, .12);
}

.sn-select-trigger:disabled,
.sn-select-trigger[aria-disabled="true"] {
    opacity: .65;
    cursor: not-allowed;
    background: #F9FAFB;
}

.sn-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sn-select-trigger.is-placeholder .sn-select-value {
    color: var(--sn-muted);
    font-weight: 500;
}

.sn-select-caret {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-right: 2px solid #9CA3AF;
    border-bottom: 2px solid #9CA3AF;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .16s ease, border-color .16s ease;
}

.sn-select.is-open .sn-select-caret {
    transform: rotate(225deg) translateY(-2px);
    border-color: var(--sn-red);
}

.sn-select-menu {
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    right: 0;
    z-index: 1085;
    display: none;
    max-height: min(280px, 50vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: .4rem;
    background: #fff;
    border: 1px solid var(--sn-border);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(11, 18, 32, .14), 0 2px 8px rgba(11, 18, 32, .06);
    animation: snDropdownIn .14s ease-out;
}

.sn-select.is-dropup .sn-select-menu {
    top: auto;
    bottom: calc(100% + .4rem);
    animation: snDropdownUp .14s ease-out;
}

@keyframes snDropdownUp {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sn-select.is-open .sn-select-menu {
    display: block;
}

.sn-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: .7rem .85rem;
    min-height: 42px;
    text-align: left;
    font-size: .9rem;
    font-weight: 500;
    color: var(--sn-ink);
    line-height: 1.3;
    cursor: pointer;
    white-space: normal;
}

.sn-select-sm .sn-select-option {
    min-height: 36px;
    padding: .5rem .7rem;
    font-size: .825rem;
}

.sn-select-option:hover,
.sn-select-option:focus {
    background: #F3F4F6;
    color: var(--sn-navy);
    outline: none;
}

.sn-select-option.is-selected {
    background: var(--sn-red-soft);
    color: var(--sn-red);
    font-weight: 600;
}

.sn-select-option.is-selected::after {
    content: "";
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sn-red);
    flex-shrink: 0;
}

.sn-select-option.is-disabled,
.sn-select-option:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Keep Bootstrap invalid state on custom select */
.sn-select:has(.is-invalid) .sn-select-trigger,
.sn-select.is-invalid-wrap .sn-select-trigger,
.was-validated .sn-select:has(:invalid) .sn-select-trigger {
    border-color: #dc3545;
}

@media (prefers-reduced-motion: reduce) {
    .sn-select-menu,
    .sn-select.is-dropup .sn-select-menu { animation: none; }
    .sn-select-caret { transition: none; }
}

/* Table action buttons — no overlap (site-wide) */
.table td.text-end,
.table th.text-end {
    white-space: normal !important;
    min-width: 132px;
}

.table td.text-end {
    text-align: right;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .35rem;
}

.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-end;
    align-items: center;
    max-width: 100%;
}

.table td.text-end > .btn,
.table td.text-end > form,
.table td.text-end > a,
.table-actions > .btn,
.table-actions > form,
.table-actions > a {
    display: inline-flex;
    vertical-align: middle;
    margin: 0;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.table td.text-end form,
.table-actions form {
    display: inline-flex;
    margin: 0;
}

.table td .btn-sm {
    min-width: 36px;
    min-height: 36px;
    padding-left: .55rem;
    padding-right: .55rem;
}

.table td .btn-link {
    text-decoration: none;
    line-height: 1;
}

/* Prevent title/badge/text collisions in table cells */
.table td .fw-semibold,
.table td .fw-bold {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.table td .badge {
    display: inline-block;
    margin: .15rem .2rem .15rem 0;
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.25;
}

.table td code {
    white-space: normal;
    word-break: break-all;
}

/* Filter / form button columns — never collide */
.card.stat-card form .row > [class*="col"].d-flex,
.admin-filters .row > [class*="col"].d-flex {
    flex-wrap: wrap;
    gap: .5rem;
    align-items: stretch;
}

.card.stat-card form .row > [class*="col"].d-flex > .btn,
.admin-filters .row > [class*="col"].d-flex > .btn {
    flex: 1 1 auto;
    min-width: 110px;
    white-space: nowrap;
}

/* List-group action rows (menus etc.) */
.list-group-item .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-start !important;
}

.list-group-item .d-flex.justify-content-between > .d-flex,
.list-group-item .d-flex.justify-content-between > div:last-child {
    flex-wrap: wrap;
    gap: .35rem;
}

/* Show-page top actions */
.d-flex.justify-content-end.mb-3,
.d-flex.justify-content-end.gap-2.mb-3 {
    flex-wrap: wrap;
    gap: .5rem;
}

.card-footer {
    background: #fff;
    border-top: 1px solid var(--sn-border);
    padding: .85rem 1rem;
    overflow-x: auto;
}

/* Tables without .table-responsive still scroll inside cards */
.stat-card .card-body:has(> table.table),
.stat-card .card-body:has(> form > .table-responsive),
.stat-card .card-body:has(> form > table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stat-card .card-body > table.table {
    margin-bottom: 0;
    min-width: 640px;
}

/* Card body action rows */
.card-body .d-flex.justify-content-between,
.card-body .d-flex.align-items-center.justify-content-between {
    flex-wrap: wrap;
    gap: .75rem;
}

.card-body .d-flex.gap-1,
.card-body .d-flex.gap-2 {
    flex-wrap: wrap;
}

/* Badges next to titles */
.fw-semibold + .badge,
.fw-bold + .badge,
h1 .badge,
h2 .badge,
.h6 .badge {
    margin-left: .25rem;
    vertical-align: middle;
}

/* Topbar — prevent control overlap */
.admin-topbar {
    flex-wrap: nowrap;
}

.admin-topbar .topbar-title-wrap {
    overflow: hidden;
}

.admin-topbar .page-heading {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ========== Auth pages (login / forgot / reset) ========== */
body.auth-body {
    --auth-font: "Outfit", "Segoe UI", sans-serif;
    --auth-display: "Syne", "Outfit", sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    font-family: var(--auth-font);
    background: #F4F5F7;
    color: var(--sn-ink);
}

.auth-stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 992px) {
    .auth-stage {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    }
}

/* Left brand plane */
.auth-visual {
    position: relative;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 4vw, 3.5rem);
    color: #fff;
    overflow: hidden;
    background:
        linear-gradient(155deg, rgba(227, 6, 19, .88) 0%, rgba(11, 18, 32, .55) 42%, rgba(11, 18, 32, .96) 100%),
        linear-gradient(180deg, #0B1220 0%, #151D2E 100%);
    animation: authVisualIn .7s ease-out both;
}

@media (min-width: 992px) {
    .auth-visual { display: flex; }
}

.auth-visual-grid {
    position: absolute;
    inset: -20%;
    background-image:
        linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 48px 48px;
    transform: rotate(-8deg);
    animation: authGridDrift 28s linear infinite;
    pointer-events: none;
}

.auth-visual-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    pointer-events: none;
}

.auth-visual-orb-a {
    width: 280px;
    height: 280px;
    top: -60px;
    right: -40px;
    background: radial-gradient(circle, rgba(227, 6, 19, .55), transparent 70%);
    animation: authOrbFloat 9s ease-in-out infinite;
}

.auth-visual-orb-b {
    width: 220px;
    height: 220px;
    bottom: 8%;
    left: -50px;
    background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
    animation: authOrbFloat 11s ease-in-out infinite reverse;
}

.auth-visual-inner {
    position: relative;
    z-index: 1;
    max-width: 460px;
    margin-top: auto;
    margin-bottom: auto;
    animation: authCopyIn .75s .12s ease-out both;
}

.auth-visual-logo {
    margin-bottom: 2rem;
}

.auth-visual-logo img {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}

.auth-visual-kicker {
    margin: 0 0 .85rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255,255,255,.72);
}

.auth-visual-title {
    margin: 0 0 1rem;
    font-family: var(--auth-display);
    font-weight: 800;
    font-size: clamp(2.6rem, 5vw, 4rem);
    line-height: .95;
    letter-spacing: -.04em;
    color: #fff;
}

.auth-visual-copy {
    margin: 0 0 1.75rem;
    font-size: 1.05rem;
    line-height: 1.55;
    color: rgba(255,255,255,.78);
    max-width: 34ch;
}

.auth-visual-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .7rem;
}

.auth-visual-points li {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .92rem;
    font-weight: 500;
    color: rgba(255,255,255,.88);
}

.auth-visual-points i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    flex-shrink: 0;
}

.auth-visual-footer {
    position: relative;
    z-index: 1;
    font-size: .78rem;
    letter-spacing: .04em;
    color: rgba(255,255,255,.5);
}

/* Right form panel */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(227, 6, 19, .06), transparent 40%),
        #F7F8FA;
}

.auth-panel-inner {
    width: 100%;
    max-width: 420px;
    animation: authPanelIn .55s .08s ease-out both;
}

.auth-panel-mobile-brand {
    display: flex;
    margin-bottom: 1.5rem;
}

.auth-panel-mobile-brand img {
    height: 34px;
    width: auto;
}

@media (min-width: 992px) {
    .auth-panel {
        padding: 2.5rem 3rem;
        background: #fff;
    }
    .auth-panel-mobile-brand { display: none; }
}

.auth-panel-head {
    margin-bottom: 1.75rem;
}

.auth-panel-head h2 {
    margin: 0 0 .4rem;
    font-family: var(--auth-display);
    font-weight: 700;
    font-size: clamp(1.65rem, 3vw, 2rem);
    letter-spacing: -.03em;
    color: var(--sn-navy);
    line-height: 1.15;
}

.auth-panel-head p {
    margin: 0;
    color: var(--sn-muted);
    font-size: .95rem;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 1.1rem;
}

.auth-field .form-label {
    font-weight: 600;
    font-size: .85rem;
    color: var(--sn-navy);
    margin-bottom: .4rem;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}

.auth-input-wrap .form-control {
    padding-left: 2.65rem;
    min-height: 48px;
    border-radius: 12px;
    border-color: var(--sn-border);
    background: #fff;
    font-size: .95rem;
    box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input-wrap .form-control:hover {
    border-color: #9CA3AF;
}

.auth-input-wrap .form-control:focus {
    border-color: rgba(227, 6, 19, .45);
    box-shadow: 0 0 0 .2rem rgba(227, 6, 19, .12);
}

.auth-form-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: -.15rem;
}

.auth-form-meta .form-check-label {
    font-size: .9rem;
    color: var(--sn-ink);
}

.auth-form-meta .form-check-input:checked {
    background-color: var(--sn-red);
    border-color: var(--sn-red);
}

.auth-link {
    font-size: .9rem;
    font-weight: 600;
    color: var(--sn-red);
    text-decoration: none;
}

.auth-link:hover {
    color: var(--sn-red-dark);
    text-decoration: underline;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    min-height: 50px;
    margin-top: .25rem;
    border: 0;
    border-radius: 12px;
    background: var(--sn-red);
    color: #fff;
    font-family: var(--auth-font);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -.01em;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 10px 24px rgba(227, 6, 19, .22);
}

.auth-submit:hover {
    background: var(--sn-red-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(227, 6, 19, .28);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit i {
    transition: transform .18s ease;
}

.auth-submit:hover i {
    transform: translateX(3px);
}

.auth-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: .35rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--sn-muted);
    text-decoration: none;
}

.auth-back:hover {
    color: var(--sn-navy);
}

.auth-panel .alert {
    margin-bottom: 1.25rem;
    border-radius: 12px;
}

@keyframes authVisualIn {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes authCopyIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authFormIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authGridDrift {
    from { transform: rotate(-8deg) translate3d(0, 0, 0); }
    to { transform: rotate(-8deg) translate3d(48px, 48px, 0); }
}

@keyframes authOrbFloat {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-12px, 16px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-visual,
    .auth-visual-inner,
    .auth-panel-inner,
    .auth-visual-grid,
    .auth-visual-orb,
    .auth-submit,
    .auth-submit i {
        animation: none !important;
        transition: none !important;
    }
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, .45);
    z-index: 1035;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-backdrop.show { display: block; }

/* Hero slider previews */
.hero-preview {
    position: relative;
    border: 1px dashed var(--sn-border-strong);
    border-radius: 14px;
    background: #F9FAFB;
    overflow: hidden;
    display: grid;
    place-items: center;
    width: 100%;
}

.hero-preview-desktop { aspect-ratio: 16 / 7; }
.hero-preview-mobile {
    aspect-ratio: 4 / 5;
    max-width: min(280px, 70%);
    margin-left: auto;
    margin-right: auto;
}
.hero-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-preview-empty {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    color: var(--sn-muted); font-size: .85rem; padding: 1rem;
}
.hero-preview-empty i { font-size: 1.6rem; color: var(--sn-red); opacity: .7; }
.hero-preview-note {
    position: absolute; left: .5rem; right: .5rem; bottom: .5rem;
    background: rgba(11,18,32,.75); color: #fff; border-radius: 999px;
    font-size: .68rem; text-align: center; padding: .25rem .5rem;
}

/* Lists / empty */
.list-row-soft + .list-row-soft { border-top: 1px solid var(--sn-border); }
.list-row-soft { padding: .75rem 0; }

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--sn-muted);
}

.empty-state i {
    font-size: 2rem;
    color: var(--sn-red);
    opacity: .7;
}

/* Utility: prevent flex children from overflowing */
.row > * { min-width: 0; }

/* Tabs (settings etc.) */
.nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: .25rem;
}

.nav-tabs .nav-link {
    white-space: nowrap;
}

/* ========== Responsive breakpoints ========== */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-105%);
        box-shadow: 0 0 40px rgba(11, 18, 32, .18);
    }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-sidebar-close { display: inline-flex; }
    .admin-main { margin-left: 0; width: 100%; }
}

@media (max-width: 767.98px) {
    .admin-content { padding: .85rem; }
    .admin-topbar { padding: .65rem .85rem; }
    .stat-card .card-body,
    .admin-card .card-body { padding: .9rem; }
    .admin-badge-pill { font-size: .65rem; }
    .table { font-size: .85rem; }
    .table thead th,
    .table tbody td { padding: .7rem .75rem; }
}

@media (max-width: 575.98px) {
    .admin-content { padding: .75rem; }
    .stat-card .stat-icon { width: 38px; height: 38px; font-size: 1rem; }
    .hero-preview-mobile { max-width: 200px; }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .admin-sidebar { transition: none; }
    .dropdown-menu,
    .notification-menu { animation: none; }
}

/* ========== Notifications ========== */
.notification-bell-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--sn-border);
    background: #fff;
    color: var(--sn-navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.notification-bell-btn:hover {
    background: #F9FAFB;
    border-color: var(--sn-border-strong);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--sn-red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notification-menu {
    width: min(360px, calc(100vw - 1.25rem));
    min-width: min(280px, calc(100vw - 1.25rem));
    border: 1px solid var(--sn-border) !important;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(11, 18, 32, .12), 0 2px 8px rgba(11, 18, 32, .06) !important;
    padding: 0 !important;
    animation: snDropdownIn .16s ease-out;
}

.notification-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--sn-border);
    background: #fff;
    flex-wrap: wrap;
}

.notification-menu-header strong {
    color: var(--sn-navy);
    font-size: .95rem;
}

.notification-menu-header .btn-link {
    color: var(--sn-red);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.notification-menu-list {
    max-height: 360px;
    overflow-y: auto;
    background: #fff;
}

.notification-menu-item {
    width: 100%;
    border: 0;
    background: #fff;
    display: flex;
    gap: .75rem;
    text-align: left;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--sn-border);
    align-items: flex-start;
}

.notification-menu-item:hover { background: #FAFAFA; }

.notification-menu-item.is-unread {
    background: var(--sn-red-soft);
}

.notification-menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--sn-border);
    display: grid;
    place-items: center;
    color: var(--sn-red);
    flex-shrink: 0;
}

.notification-menu-copy {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.notification-menu-copy .title {
    font-weight: 600;
    color: var(--sn-navy);
    font-size: .88rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-menu-copy .message,
.notification-menu-copy .time {
    color: var(--sn-muted);
    font-size: .78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--sn-muted);
    font-size: .9rem;
}

.notification-menu-footer {
    display: block;
    text-align: center;
    padding: .85rem 1rem;
    font-weight: 600;
    font-size: .85rem;
    border-top: 1px solid var(--sn-border);
    background: #F9FAFB;
    color: var(--sn-red);
}

.notification-menu-footer:hover { color: var(--sn-red-dark); }

.notification-row {
    display: flex;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--sn-border);
}

.notification-row.is-unread { background: #FFF7F8; }

.notification-row .notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--sn-red-soft);
    color: var(--sn-red);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.notification-body { flex: 1; }

