/*
 * Mtumba — tp-apple-theme.css
 * Apple-inspired design system. Load AFTER bootstrap.min.css and app.css.
 * Brand primary: #10B981 (emerald)
 */

/* ── Design Tokens ─────────────────────────────────── */
:root {
    --st-primary:       #10B981;
    --st-primary-hover: #059669;
    --st-primary-rgb:   16, 185, 129;
    --st-dark:          #111111;
    --st-light:         #ffffff;

    /* Light mode */
    --st-bg:            #f5f5f7;
    --st-surface:       rgba(255, 255, 255, 0.8);
    --st-surface-solid: #ffffff;
    --st-text:          #111111;
    --st-text-muted:    #6e6e73;
    --st-placeholder:   rgba(110, 110, 115, 0.65);
    --st-border:        rgba(0, 0, 0, 0.08);
    --st-glass-bg:      rgba(255, 255, 255, 0.82);
    --st-glass-border:  rgba(255, 255, 255, 0.5);
    --st-shadow:        0 2px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    --st-shadow-lg:     0 8px 30px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.06);
    --st-radius-sm:     12px;
    --st-radius-md:     18px;
    --st-radius-lg:     24px;
    --st-font-main:     'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Layout */
    --sidebar-width:           260px;
    --sidebar-collapsed-width: 80px;
    --header-height:           68px;
}

[data-theme-mode="dark"] {
    --st-bg:            #0a0a0a;
    --st-surface:       rgba(17, 17, 17, 0.8);
    --st-surface-solid: #141414;
    --st-text:          #f5f5f7;
    --st-text-muted:    #a1a1a6;
    --st-placeholder:   rgba(161, 161, 166, 0.6);
    --st-border:        rgba(255, 255, 255, 0.09);
    --st-glass-bg:      rgba(20, 20, 20, 0.85);
    --st-glass-border:  rgba(255, 255, 255, 0.07);
    --st-shadow:        0 2px 12px rgba(0, 0, 0, 0.4);
    --st-shadow-lg:     0 8px 30px rgba(0, 0, 0, 0.6);
}

/* ── Base Reset ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body.st-apple-ui {
    font-family: var(--st-font-main) !important;
    background-color: var(--st-bg) !important;
    color: var(--st-text) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Layout ────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-width); }
.sidebar-collapsed .st-sidebar    { width: var(--sidebar-collapsed-width); }
.sidebar-collapsed .brand-name,
.sidebar-collapsed .section-title,
.sidebar-collapsed .nav-link span { display: none; }
.sidebar-collapsed .nav-link      { justify-content: center; padding: 0.8rem; }
.sidebar-collapsed .nav-link i    { margin: 0; font-size: 1.4rem; }
.sidebar-collapsed .sidebar-header { justify-content: center; padding: 1.25rem 0.5rem; }
.sidebar-collapsed .st-header     { left: var(--sidebar-collapsed-width); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}
.sidebar-open .sidebar-overlay { display: block; }

@media (max-width: 992px) {
    .st-sidebar {
        z-index: 2001 !important;
        background: var(--st-surface-solid) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15) !important;
    }
    .main-content { margin-left: 0 !important; }
}

.page-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 1;
}

@media (max-width: 576px) {
    .page-container { padding: 1rem; }
}

/* ── Glass ─────────────────────────────────────────── */
.st-glass {
    background: var(--st-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--st-glass-border);
}

/* ── Sidebar ───────────────────────────────────────── */
.st-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--st-border);
    overflow: hidden;
}

@media (max-width: 992px) {
    .st-sidebar         { transform: translateX(-100%); }
    .sidebar-open .st-sidebar { transform: translateX(0); }
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--st-border);
    min-height: var(--header-height);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--st-text);
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--st-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.4px;
    color: var(--st-text);
}

.btn-close-sidebar {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--st-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    scrollbar-width: none;
}
.sidebar-content::-webkit-scrollbar { display: none; }

.nav-section { margin-bottom: 1.75rem; }

.section-title {
    display: block;
    padding: 0 0.75rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--st-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.st-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 0.75rem;
    color: var(--st-text);
    text-decoration: none;
    border-radius: var(--st-radius-sm);
    transition: all 0.2s ease;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.875rem;
    min-height: 42px;
}

.st-sidebar .nav-link i {
    font-size: 1.2rem;
    color: var(--st-text-muted);
    transition: color 0.2s ease;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.st-sidebar .nav-link:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--st-text);
}
[data-theme-mode="dark"] .st-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.st-sidebar .nav-link.active {
    background: var(--st-primary);
    color: #fff;
}
.st-sidebar .nav-link.active i { color: #fff; }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--st-border);
    flex-shrink: 0;
}

/* ── Header ────────────────────────────────────────── */
.st-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    z-index: 999;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid var(--st-border);
}

@media (max-width: 992px) {
    .st-header { left: 0; }
}

.header-container {
    height: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

@media (max-width: 576px) {
    .header-container { padding: 0 1rem; }
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-mobile-menu, .btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--st-text);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}
.btn-mobile-menu:hover, .btn-icon:hover { background: rgba(0, 0, 0, 0.05); }
[data-theme-mode="dark"] .btn-mobile-menu:hover,
[data-theme-mode="dark"] .btn-icon:hover { background: rgba(255, 255, 255, 0.07); }

.collapse-icon-folded { display: none; }
.sidebar-collapsed .collapse-icon-unfolded { display: none; }
.sidebar-collapsed .collapse-icon-folded { display: flex; }

/* Theme toggle */
.theme-icon-dark { display: none; }
[data-theme-mode="dark"] .theme-icon-light { display: none; }
[data-theme-mode="dark"] .theme-icon-dark  { display: flex; }

/* Avatar */
.avatar-circle {
    width: 38px;
    height: 38px;
    background: var(--st-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.btn-profile {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-profile:hover { background: rgba(0, 0, 0, 0.04); }

.profile-info { text-align: left; }
.profile-name {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
    color: var(--st-text);
}
.profile-role {
    display: block;
    font-size: 0.72rem;
    color: var(--st-text-muted);
}

/* Dropdown */
.st-dropdown {
    border: 1px solid var(--st-border) !important;
    box-shadow: var(--st-shadow-lg) !important;
    border-radius: var(--st-radius-md) !important;
    padding: 0.4rem !important;
    background: var(--st-surface-solid) !important;
    margin-top: 8px !important;
}

.st-dropdown .dropdown-item {
    border-radius: var(--st-radius-sm);
    padding: 0.55rem 0.875rem;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--st-text);
    transition: all 0.15s ease;
}
.st-dropdown .dropdown-item i { font-size: 1rem; color: var(--st-text-muted); }
.st-dropdown .dropdown-item:hover { background: var(--st-primary); color: #fff; }
.st-dropdown .dropdown-item:hover i { color: #fff; }
.st-dropdown .dropdown-item.text-danger:hover { background: #ff3b30; color: #fff; }
.st-dropdown .dropdown-divider { border-color: var(--st-border) !important; margin: 0.25rem 0.4rem !important; }

.dropdown-user-block {
    padding: 0.6rem 0.875rem;
    border-bottom: 1px solid var(--st-border);
    margin-bottom: 0.25rem;
}
.dropdown-user-block .user-email  { font-size: 0.75rem; color: var(--st-text-muted); }
.dropdown-user-block .user-plan   { font-size: 0.8rem; font-weight: 600; color: var(--st-text); text-transform: capitalize; }

/* ── Card ──────────────────────────────────────────── */
.st-card {
    background-color: var(--st-surface-solid);
    border-radius: var(--st-radius-md);
    border: 1px solid var(--st-border);
    box-shadow: var(--st-shadow);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}
.st-card:hover { box-shadow: var(--st-shadow-lg); }
.st-card.allow-overflow { overflow: visible !important; }

.card {
    background-color: var(--st-surface-solid) !important;
    border-radius: var(--st-radius-md) !important;
    border: 1px solid var(--st-border) !important;
    box-shadow: var(--st-shadow) !important;
    transition: box-shadow 0.2s ease !important;
}
.card:hover { box-shadow: var(--st-shadow-lg) !important; transform: none !important; }

/* ── Typography ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--st-text);
}

.tracking-tight { letter-spacing: -0.025em !important; }
.text-muted     { color: var(--st-text-muted) !important; }
.text-dark      { color: var(--st-text) !important; }

.fs-9  { font-size: 0.6rem !important; }
.fs-10 { font-size: 0.65rem !important; }
.fs-11 { font-size: 0.7rem !important; }
.fs-12 { font-size: 0.75rem !important; }
.fs-13 { font-size: 0.8rem !important; }
.fs-14 { font-size: 0.875rem !important; }
.tracking-widest { letter-spacing: 0.1em !important; }

/* ── Form Controls ─────────────────────────────────── */
.form-control,
.form-select,
textarea {
    background-color: var(--st-surface-solid) !important;
    color: var(--st-text) !important;
    border: 1px solid var(--st-border) !important;
    font-family: var(--st-font-main) !important;
    padding: 0.7rem 0.875rem !important;
    border-radius: var(--st-radius-sm) !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--st-primary) !important;
    box-shadow: 0 0 0 4px rgba(var(--st-primary-rgb), 0.12) !important;
    outline: none;
}
input::placeholder,
textarea::placeholder { color: var(--st-placeholder); opacity: 1; }

.input {
    background-color: var(--st-surface-solid) !important;
    color: var(--st-text) !important;
    border: 1px solid var(--st-border) !important;
    font-family: var(--st-font-main) !important;
    border-radius: var(--st-radius-sm) !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease;
}
.input:focus {
    border-color: var(--st-primary) !important;
    box-shadow: 0 0 0 4px rgba(var(--st-primary-rgb), 0.12) !important;
}

.label {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--st-text-muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--st-text);
}

[data-theme-mode="dark"] .form-control,
[data-theme-mode="dark"] .form-select,
[data-theme-mode="dark"] textarea,
[data-theme-mode="dark"] .input {
    background-color: #1c1c1e !important;
    color: var(--st-text) !important;
    border-color: rgba(255, 255, 255, 0.13) !important;
}
[data-theme-mode="dark"] .form-control:focus,
[data-theme-mode="dark"] .form-select:focus,
[data-theme-mode="dark"] textarea:focus,
[data-theme-mode="dark"] .input:focus {
    background-color: #232328 !important;
    border-color: var(--st-primary) !important;
}
[data-theme-mode="dark"] input::placeholder,
[data-theme-mode="dark"] textarea::placeholder {
    color: var(--st-placeholder) !important;
    opacity: 1 !important;
}

/* ── Buttons ───────────────────────────────────────── */
.st-btn-primary {
    background-color: var(--st-primary);
    color: #fff !important;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--st-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.st-btn-primary:hover {
    background-color: var(--st-primary-hover);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--st-primary-rgb), 0.35);
}

.btn-primary {
    background-color: var(--st-primary) !important;
    border-color: var(--st-primary) !important;
    border-radius: var(--st-radius-sm) !important;
    font-weight: 600 !important;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--st-primary-hover) !important;
    border-color: var(--st-primary-hover) !important;
    box-shadow: 0 4px 16px rgba(var(--st-primary-rgb), 0.3) !important;
}

.btn-light {
    background-color: var(--st-bg) !important;
    border: 1px solid var(--st-border) !important;
    color: var(--st-text) !important;
    border-radius: var(--st-radius-sm) !important;
    font-weight: 600;
}
.btn-light:hover {
    background-color: var(--st-surface-solid) !important;
    color: var(--st-text) !important;
    box-shadow: var(--st-shadow) !important;
}

/* ── Tables ────────────────────────────────────────── */
.table { color: var(--st-text); background: transparent; }
.allow-overflow .table-responsive { overflow: visible !important; }

.table thead th {
    background-color: var(--st-bg) !important;
    border-bottom: 1px solid var(--st-border) !important;
    color: var(--st-text-muted) !important;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    background-color: var(--st-surface-solid) !important;
    color: var(--st-text) !important;
    border-bottom: 1px solid var(--st-border) !important;
    padding: 0.875rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
}

.table-hover tbody tr:hover td {
    background-color: rgba(var(--st-primary-rgb), 0.025) !important;
}

.st-table-card {
    background: var(--st-surface-solid);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    box-shadow: var(--st-shadow);
    overflow: hidden;
}

.st-table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--st-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(var(--st-primary-rgb), 0.02);
}

.st-table-search {
    position: relative;
    min-width: 240px;
}
.st-table-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--st-text-muted);
    font-size: 1rem;
}
.st-table-search input {
    padding-left: 38px !important;
    border-radius: 100px !important;
}

@media (max-width: 768px) {
    .table-responsive { overflow-x: hidden !important; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr {
        margin-bottom: 1rem;
        background: var(--st-surface-solid);
        border: 1px solid var(--st-border) !important;
        border-radius: var(--st-radius-md);
        padding: 0.875rem;
        box-shadow: var(--st-shadow);
    }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.6rem 0 !important;
        border-bottom: 1px solid var(--st-border) !important;
        background: transparent !important;
    }
    .table td:last-child { border-bottom: none !important; }
    .table td::before {
        content: attr(data-label);
        font-weight: 700;
        text-align: left;
        text-transform: uppercase;
        font-size: 0.65rem;
        color: var(--st-text-muted);
        flex-shrink: 0;
    }
}

/* ── Pagination ────────────────────────────────────── */
.pagination-apple .page-link {
    border: none;
    background: var(--st-surface-solid);
    color: var(--st-text);
    border-radius: 10px !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.82rem;
    transition: all 0.2s ease;
    box-shadow: var(--st-shadow);
}
.pagination-apple .page-item.active .page-link {
    background: var(--st-primary) !important;
    color: #fff !important;
}
.pagination-apple .page-link:hover:not(.disabled) {
    background: var(--st-primary);
    color: #fff;
}

/* ── Badges ────────────────────────────────────────── */
.bg-primary-transparent { background-color: rgba(var(--st-primary-rgb), 0.10) !important; }
.bg-success-transparent { background-color: rgba(52, 199, 89,  0.10) !important; }
.bg-danger-transparent  { background-color: rgba(255, 59, 48,  0.10) !important; }
.bg-warning-transparent { background-color: rgba(255, 159, 10, 0.10) !important; }
.bg-info-transparent    { background-color: rgba(0, 122, 255,  0.10) !important; }

.text-primary  { color: var(--st-primary) !important; }
.bg-primary    { background-color: var(--st-primary) !important; }
.border-primary { border-color: var(--st-primary) !important; }

/* ── Toast Alerts ──────────────────────────────────── */
.alert-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    width: 100%;
    max-width: 380px;
    pointer-events: auto;
}
.alert-toast + .alert-toast { top: calc(1.25rem + 70px); }

/* ── Tabs (Apple style) ────────────────────────────── */
.nav-tabs-apple {
    border-bottom: 1px solid var(--st-border);
    gap: 1.75rem;
    background: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-tabs-apple::-webkit-scrollbar { display: none; }
.nav-tabs-apple .nav-link {
    border: none !important;
    background: none !important;
    padding: 1rem 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--st-text-muted);
    position: relative;
    transition: color 0.2s ease;
    white-space: nowrap;
    border-radius: 0 !important;
}
.nav-tabs-apple .nav-link:hover { color: var(--st-text); }
.nav-tabs-apple .nav-link.active {
    color: var(--st-primary);
    background: none !important;
}
.nav-tabs-apple .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--st-primary);
    border-radius: 2px 2px 0 0;
}

/* ── Segmented control ─────────────────────────────── */
.st-seg-ctrl {
    background: var(--st-bg);
    border-radius: 100px;
    padding: 3px;
    display: inline-flex;
    border: 1px solid var(--st-border);
}
.st-seg-ctrl button {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--st-text-muted);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.st-seg-ctrl button.active {
    background: var(--st-surface-solid);
    color: var(--st-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ── Page header pattern ───────────────────────────── */
.page-header-st {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.page-header-st h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

/* ── Stat card pattern ─────────────────────────────── */
.kpi-card {
    background: var(--st-surface-solid);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    box-shadow: var(--st-shadow);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s ease;
}
.kpi-card:hover { box-shadow: var(--st-shadow-lg); }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.3rem;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--st-text);
    letter-spacing: -0.03em;
    line-height: 1;
}
.kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--st-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 0.2rem;
}

/* ── Footer ────────────────────────────────────────── */
.st-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--st-border);
    font-size: 0.75rem;
    color: var(--st-text-muted);
    text-align: center;
}

/* ── Shared table pager ────────────────────────────── */
.tbl-pager {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.875rem 1.1rem;
    border-top: 1px solid var(--st-border);
    font-size: 0.8rem; color: var(--st-text-muted);
    flex-wrap: wrap; gap: 0.5rem;
}
.tbl-pager-btns { display: flex; align-items: center; gap: 0.4rem; }
.tbl-page-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--st-border);
    background: var(--st-surface-solid); color: var(--st-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem; transition: all 0.15s ease;
}
.tbl-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tbl-page-btn:not(:disabled):hover { border-color: var(--st-primary); color: var(--st-primary); }
.tbl-page-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem; padding: 0 0.25rem;
}

/* ── Animations ────────────────────────────────────── */
@keyframes stFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; }
}
.animate-fade-in { animation: stFadeIn 0.4s ease-out both; }

/* ── Dark mode: 3rd-party overrides ───────────────── */
[data-theme-mode="dark"] .bg-light         { background-color: rgba(255,255,255,0.04) !important; }
[data-theme-mode="dark"] .bg-white         { background-color: var(--st-surface-solid) !important; }
[data-theme-mode="dark"] .table-hover tbody tr:hover td {
    background-color: rgba(255,255,255,0.04) !important;
}
[data-theme-mode="dark"] .btn-close        { filter: invert(1) grayscale(100%) brightness(200%); }

/* ── Misc helpers ──────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.object-fit-cover { object-fit: cover; }
pre, code { font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--st-text); }

/* Modal scroll fix (form inside .modal-content as direct flex child) */
.modal-content > form { display: contents; }

/* ── Small-device overrides (≤ 576px) ─────────────── */
@media (max-width: 576px) {
    .st-table-search  { min-width: 0; width: 100%; }
    .st-table-header  { flex-direction: column; align-items: stretch; }
    .kpi-value        { font-size: 1.35rem; }
    .page-header-st h1 { font-size: 1.35rem; }
    .st-seg-ctrl      { width: 100%; justify-content: center; }
    .nav-tabs-apple   { gap: 1rem; }
    .alert-toast      { right: .75rem; left: .75rem; width: auto; max-width: none; }
    .page-header-st   { flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }
    .kpi-card         { gap: .75rem; padding: 1rem; }
    .kpi-icon         { width: 40px; height: 40px; font-size: 1.1rem; }
    .st-card          { overflow-wrap: break-word; word-break: break-word; }
    .st-card pre, .st-card code { overflow-wrap: normal; word-break: normal; }
    .modal-dialog     { margin: .5rem; }
}

/* ── Tablet table fix (769–992px) ── */
@media (min-width: 769px) and (max-width: 992px) {
    .table-responsive { overflow-x: auto; }
}

/* ── Marketplace-specific ──────────────────────────── */
/* Listing cards */
.listing-card {
    background: var(--st-surface-solid);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    box-shadow: var(--st-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: var(--st-text);
}
.listing-card:hover {
    box-shadow: var(--st-shadow-lg);
    transform: translateY(-2px);
    color: var(--st-text);
    text-decoration: none;
}
.listing-card-photo {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--st-bg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.listing-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.listing-card:hover .listing-card-photo img {
    transform: scale(1.03);
}
.listing-card-body {
    padding: 0.75rem 0.875rem 0.875rem;
}
.listing-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--st-text);
    margin: 0 0 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.listing-card-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--st-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

/* Trust stars */
.trust-stars { color: #FF9500; font-size: 0.875rem; }

/* Boost badge overlay */
.boost-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.boost-featured { background: #FF9500; color: #fff; }
.boost-top      { background: var(--st-primary); color: #fff; }
.boost-highlight { background: rgba(var(--st-primary-rgb), 0.15); color: var(--st-primary); }

/* ── Enhanced listing card overlays ─────────────────── */
.lc-photo-gradient {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 48%;
    background: linear-gradient(to top, rgba(0,0,0,0.32) 0%, transparent 100%);
    pointer-events: none;
}
.lc-no-photo {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--st-bg);
    color: var(--st-border);
    font-size: 2rem;
}
.lc-condition-badge {
    position: absolute;
    top: 0.45rem; right: 0.45rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.42rem;
    border-radius: 100px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #374151;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
[data-theme-mode="dark"] .lc-condition-badge {
    background: rgba(20,20,20,0.82);
    color: rgba(255,255,255,0.75);
}
.lc-save-btn {
    position: absolute;
    bottom: 0.45rem; right: 0.45rem;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.78);
    transition: opacity 0.18s, transform 0.18s;
    padding: 0;
    line-height: 1;
}
[data-theme-mode="dark"] .lc-save-btn {
    background: rgba(20,20,20,0.82);
    color: rgba(255,255,255,0.7);
}
.listing-card:hover .lc-save-btn {
    opacity: 1; transform: scale(1);
}
.lc-save-btn:hover { color: var(--st-primary) !important; }
.lc-save-btn.saved { opacity: 1; transform: scale(1); color: var(--st-primary); }
.lc-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--st-primary);
    letter-spacing: -0.025em;
    margin: 0 0 0.1rem;
    line-height: 1.2;
}
.lc-price sup {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    vertical-align: super;
    opacity: 0.75;
    margin-right: 1px;
}
.lc-cat-chip {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 100px;
    background: rgba(var(--st-primary-rgb), 0.1);
    color: var(--st-primary);
    margin-bottom: 0.28rem;
    line-height: 1.6;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.2rem;
    margin-top: 0.35rem;
}
.lc-meta-loc {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--st-text-muted);
    display: flex; align-items: center; gap: 2px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    min-width: 0;
}
.lc-meta-loc i { font-size: 0.65rem; flex-shrink: 0; opacity: 0.7; }
.lc-meta-time {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--st-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.8;
}

/* Category chips */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 1rem;
    border-radius: 100px;
    background: var(--st-surface-solid);
    border: 1px solid var(--st-border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--st-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}
.category-chip:hover,
.category-chip.active {
    background: var(--st-primary);
    border-color: var(--st-primary);
    color: #fff;
}

/* ── Listing detail carousel ──────────────────────── */
.listing-carousel-main {
    position: relative;
    background: var(--st-bg);
}
.lc-main-img {
    display: block;
    transition: opacity 0.2s ease;
}

/* Alpine transition helpers */
.lc-fade-enter        { transition: opacity 0.25s ease; }
.lc-fade-enter-start  { opacity: 0; }
.lc-fade-enter-end    { opacity: 1; }

/* Nav arrow buttons */
.listing-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    color: var(--st-dark);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    transition: background 0.15s ease, transform 0.15s ease;
}
.listing-carousel-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.08);
}
[data-theme-mode="dark"] .listing-carousel-btn {
    background: rgba(30,30,30,0.88);
    color: #f5f5f7;
}
.listing-carousel-btn-prev { left: 0.75rem; }
.listing-carousel-btn-next { right: 0.75rem; }

/* Counter badge */
.lc-counter {
    position: absolute;
    bottom: 0.75rem;
    right: 0.875rem;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    pointer-events: none;
    letter-spacing: 0.03em;
}

/* Thumbnail strip */
.lc-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.lc-thumbs::-webkit-scrollbar { display: none; }

.listing-thumb {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease, transform 0.15s ease;
    box-shadow: var(--st-shadow);
}
.listing-thumb:hover { transform: scale(1.04); }
.listing-thumb.active {
    border-color: var(--st-primary);
    box-shadow: 0 0 0 1px var(--st-primary);
}

/* Dot indicators — only shown on small screens */
.lc-dots {
    display: none;
    justify-content: center;
    gap: 6px;
    margin-top: 0.6rem;
}
@media (max-width: 576px) {
    .lc-thumbs { display: none; }
    .lc-dots   { display: flex; }
}
.lc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--st-border);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.lc-dot.active {
    background: var(--st-primary);
    transform: scale(1.25);
}

/* Lightbox */
.lc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lc-lightbox-img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.lc-lightbox-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}
.lc-lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* Sold ribbon — overlaid on carousel top-left */
.lc-sold-ribbon {
    position: absolute;
    top: 0.875rem;
    left: 0.875rem;
    background: #10B981;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.28rem 0.7rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(16,185,129,0.35);
    z-index: 10;
}

/* Sold notice replacing contact buttons */
.lc-sold-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--st-radius-sm);
    background: rgba(16,185,129,0.07);
    border: 1px solid rgba(16,185,129,0.18);
}
.lc-sold-notice > i {
    font-size: 1.2rem;
    color: #10B981;
    flex-shrink: 0;
    margin-top: 0.15rem;
}
.lc-sold-notice p { font-size: 0.875rem; color: var(--st-text); }
.lc-sold-notice .st-link-muted {
    font-size: 0.8rem;
    color: var(--st-text-muted);
    text-decoration: none;
}
.lc-sold-notice .st-link-muted:hover { color: var(--st-primary); }

/* Payment method pills */
.pay-method-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.875rem;
    border-radius: var(--st-radius-sm);
    background: var(--pm-bg, rgba(110,110,115,0.08));
    border: 1px solid color-mix(in srgb, var(--pm-color, #6e6e73) 20%, transparent);
}
.pay-method-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--pm-color, #6e6e73);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.pay-method-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pm-color, var(--st-text));
}

/* Dev OTP banner */
.dev-otp-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed rgba(245, 158, 11, 0.5);
    border-radius: var(--st-radius-sm);
}
.dev-otp-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #B45309;
    flex-shrink: 0;
}
.dev-otp-code {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: #92400E;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
[data-theme-mode="dark"] .dev-otp-banner { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); }
[data-theme-mode="dark"] .dev-otp-label  { color: #FCD34D; }
[data-theme-mode="dark"] .dev-otp-code   { color: #FDE68A; }

/* ── Admin: missing utility definitions ─────────────────
 * These classes were referenced across admin views but never
 * defined. Defining them here fixes all pages at once.
 * ──────────────────────────────────────────────────────── */

/* CSS variable alias — pages reference --st-bg-secondary but
 * the token was never defined; alias it to --st-bg */
:root                    { --st-bg-secondary: var(--st-bg); }
[data-theme-mode="dark"] { --st-bg-secondary: var(--st-bg); }

/* Page heading used across all admin pages */
.st-h4 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--st-text);
    margin: 0;
}

/* Tiny uppercase label above filter controls */
.st-label-sm {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--st-text-muted);
}

/* Outline button — used on refresh, pagination, secondary actions */
.st-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.48rem 1rem;
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    background: transparent;
    color: var(--st-text);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none !important;
    font-family: var(--st-font-main);
    line-height: 1.4;
}
.st-btn-outline:hover {
    border-color: var(--st-primary);
    color: var(--st-primary) !important;
    background: rgba(16, 185, 129, 0.05);
}
.st-btn-outline:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Shared admin table components ─────────────────────── */

/* Status segmented control — used on every table page */
.period-seg {
    display: inline-flex;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    flex-wrap: wrap;
}
.seg-btn {
    padding: 0.3rem 0.85rem;
    border: none; border-radius: 7px;
    font-size: 0.78rem; font-weight: 600;
    color: var(--st-text-muted); background: transparent;
    cursor: pointer; transition: all 0.18s ease;
    font-family: var(--st-font-main);
    white-space: nowrap;
}
.seg-btn.active { background: var(--st-primary); color: #fff; }
.seg-btn:not(.active):hover { color: var(--st-text); }

/* Table card wrapper */
.adm-table-wrap {
    background: var(--st-surface-solid);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-md);
    overflow: hidden;
}

/* Standard admin data table */
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.adm-table thead th {
    background: var(--st-bg);
    padding: 0.7rem 1rem;
    font-size: 0.67rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--st-text-muted);
    border-bottom: 1px solid var(--st-border);
    white-space: nowrap;
}
.adm-table thead th:first-child { padding-left: 1.1rem; }
.adm-table thead th:last-child  { padding-right: 1.1rem; }
.adm-table tbody tr {
    border-bottom: 1px solid var(--st-border);
    transition: background 0.12s ease;
}
.adm-table tbody tr:last-child { border-bottom: none; }
.adm-table tbody tr:hover { background: rgba(255,255,255,.025); }
[data-theme-mode="light"] .adm-table tbody tr:hover { background: rgba(0,0,0,.018); }
.adm-table td { padding: 0.75rem 1rem; vertical-align: middle; }
.adm-table td:first-child { padding-left: 1.1rem; }
.adm-table td:last-child  { padding-right: 1.1rem; }

/* Coloured status badge pill */
.adm-badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.55rem; border-radius: 100px;
    font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}

/* Pagination bar */
.adm-pager {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.875rem 1.1rem;
    border-top: 1px solid var(--st-border);
    font-size: 0.8rem; color: var(--st-text-muted);
    flex-wrap: wrap; gap: 0.5rem;
}
.adm-pager-btns { display: flex; align-items: center; gap: 0.4rem; }
.adm-page-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--st-border);
    background: var(--st-surface-solid); color: var(--st-text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem; transition: all 0.15s ease;
}
.adm-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.adm-page-btn:not(:disabled):hover { border-color: var(--st-primary); color: var(--st-primary); }
.adm-page-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem; color: var(--st-text-muted); padding: 0 0.25rem;
}

/* Empty / loading / error state centred box */
.adm-state-box {
    padding: 3.5rem 1rem;
    text-align: center; color: var(--st-text-muted);
}
.adm-state-box i { font-size: 2.2rem; opacity: .5; display: block; margin-bottom: 0.6rem; }
.adm-state-box p { font-size: 0.85rem; margin: 0; }

/* Thumbnail cell used in listings / moderation */
.adm-thumb {
    width: 40px; height: 40px; border-radius: 8px;
    background: var(--st-bg); border: 1px solid var(--st-border);
    overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.adm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-thumb i   { color: var(--st-text-muted); font-size: 1rem; }

/* Marketplace navbar */
.marketplace-nav {
    background: var(--st-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--st-border);
    position: sticky;
    top: 0;
    z-index: 999;
}
