:root {
    /* Brand palette */
    --saffron: #f97316;
    --saffron-lt: #fff7ed;
    --saffron-mid: #fed7aa;
    --saffron-dk: #ea6a0a;
    --maroon: #7c1d2e;
    --maroon-lt: #fdf2f4;
    --gold: #d97706;
    --gold-lt: #fefce8;
    --indigo: #4338ca;
    
    /* Neutrals */
    --slate: #1e293b;
    --slate-mid: #475569;
    --slate-lt: #333;
    --slate-xlt: #cbd5e1;
    --bg: #f8f7f5;
    --surface: #ffffff;
    --border: #e8e4de;
    --border-soft: #f1ede7;

    /* Status */
    --success: #006D5B;
    --error: #dc2626;
    --warn: #d97706;

    /* Layout metrics */
    --header-h: 58px;
    --footer-h: 38px;
    --tabs-h: 46px;
    --sidebar-w: 240px;

    /* Radii & shadows */
    --radius: 14px;
    --radius-sm: 9px;
    --radius-xs: 6px;
    --shadow: 0 2px 16px rgba(0, 0, 0, .07);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, .10);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .14);

    /* Gradients */
    --grad-primary: linear-gradient(135deg, var(--saffron), var(--gold));
    --grad-maroon: linear-gradient(135deg, var(--maroon), #a83250);

    --kd-text: var(--slate);
    --kd-muted: var(--slate-lt);
    --kd-border: var(--border);
    --kd-surface: var(--surface);
    --kd-gold: var(--maroon);
    --kd-accent: var(--saffron);

    --xm-accent: #f97316;
    --xm-accent-d: #ea6d10;
    --xm-success: #22c55e;
    --xm-danger: #ef4444;
    --xm-bg: #ffffff;
    --xm-surface: #f8fafc;
    --xm-border: #e2e8f0;
    --xm-text: #1e293b;
    --xm-muted: #64748b;
    --xm-radius: 14px;
    --xm-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

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

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.app-wrapper {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    outline: none;
}

.wallet-badge i,
ion-icon {
    font-size: 18px;
}

#wrap-table {
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}


#wrap-header,
#wrap-navbar,
#wrap-footer {
    height: 1px; /* rows collapse to content height */
}

#wrap-main {
    height: 100%;
    overflow: hidden;
    position: relative;
}

.app-header {
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 12px;
    min-height: var(--header-h, 58px);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all .18s;
}

.logo-mark {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--maroon);
    letter-spacing: 3px;
}

.logo-sub {
    display: block;
    font-size: 8.5px;
    letter-spacing: 3px;
    color: var(--saffron);
    text-transform: uppercase;
    font-weight: 500;
}

.header-mobile {
    font-size: 12.5px;
    color: var(--slate-mid);
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 14px;
}

.wallet-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

/* ── More Menu ─────────────────────────── */
.more-menu-wrap {
    position: relative;
}

.more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--slate-mid, #8e8e93);
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.more-trigger:hover {
    background: var(--bg, #f5f5f5);
    color: var(--maroon, #6b0f1a);
}

.more-dropdown {
    display: none;
    position: fixed;
    min-width: 180px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e5ea);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    padding: 6px 0;
    right: 1px;
    z-index: 999;
    animation: moreFadeIn .15s ease;
}

.more-dropdown.open {
    display: block;
}

@keyframes moreFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.more-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text, #1c1c1e);
    text-decoration: none;
    transition: background .12s;
}

.more-dropdown a:hover {
    background: var(--bg, #f5f5f5);
}

.more-dropdown a i {
    width: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--saffron, #e8871e);
}

/* ── Main Tabs: left scroll + right fixed ⋮ ── */
.main-tabs-wrap {
    background: var(--bg);
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.main-tabs-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.main-tabs-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    padding: 8px 0 8px 14px;
    scrollbar-width: none;
}

.main-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.main-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.main-tabs-bar > .more-menu-wrap {
    flex: 0 0 44px; 
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 10px;
    box-sizing: border-box;
}

.app-layout {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
}

.app-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR SHELL
══════════════════════════════════════════════════════════ */
.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 800;
    overflow-y: auto;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    transform: translateX(-100%);
}

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

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 799;
}

@media (min-width: 992px) {
    .app-sidebar {
        transform: translateX(0);
    }

    #wrap-main .app-main,
    #wrap-navbar .main-tabs-wrap,
    .app-header {
        margin-left: var(--sidebar-w);
    }
}

@media (max-width: 767.98px) {
    .app-header {
        padding: 0 10px;
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

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

.sidebar-close-wrap {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 12px;
}

.btn-close-sidebar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    font-size: 16px;
    cursor: pointer;
    transition: background .2s, color .2s, transform .15s;
}

.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text-primary, #f9fafb);
    transform: scale(1.08);
}

.btn-close-sidebar:active {
    transform: scale(.92);
}

/* ══════════════════════════════════════════════════════════
   ACCOUNT / USER BLOCK
══════════════════════════════════════════════════════════ */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-soft);
}

.su-avatar {
    font-size: 28px;
    color: var(--saffron);
}

.su-mobile {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate);
}

.su-wallet {
    font-size: 11px;
    color: var(--gold);
    font-weight: 600;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   NAV / SECTION LABELS
══════════════════════════════════════════════════════════ */
.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.nav-section-label {
    font-size: 9.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--slate-lt);
    padding: 10px 8px 4px;
    font-weight: 600;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 10px;
}

.sb-add-profile-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: var(--saffron);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--slate-mid);
    transition: all .15s;
    margin-bottom: 2px;
}

.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.nav-item:hover {
    background: var(--saffron-lt);
    color: var(--maroon);
}

.nav-item.active {
    background: var(--saffron-lt);
    color: var(--maroon);
    font-weight: 600;
    border-left: 3px solid var(--saffron);
}

.nav-item.disabled {
    opacity: .4;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   ACTIVE PROFILE CARD (top, single item)
══════════════════════════════════════════════════════════ */
.sidebar-active-profile {
    padding: 12px 16px;
    background: var(--saffron-lt);
    border: 1px solid var(--saffron-mid);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 8px 6px;
}

.sap-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.sap-text-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.sb-profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--maroon);
    color: var(--maroon);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 1px;
}

#sb-profile-name.sap-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--maroon);
}

.sap-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-size: 11px;
    color: #333;
    line-height: 1.35;
    width: 100%;
    box-sizing: border-box;
}

.sap-meta-row1,
.sap-meta-row2 {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

/* ══════════════════════════════════════════════════════════
   ADDITIONAL PROFILES LIST — reuses .profile-card / .pc-*
   from the Profiles page, restyled for the narrow sidebar
   with flat/direct colors (no hover, touch/web view)
══════════════════════════════════════════════════════════ */
.sb-profile-list {
    display: flex;
    flex-direction: column;
    /* gap: 8px; */
}

.sb-profile-list .profile-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm, 10px);
    background: var(--saffron-lt);
    border: 1px solid var(--saffron-mid);
    cursor: pointer;
}

.sb-profile-list .pc-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--saffron);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sb-profile-list .pc-info {
    flex: 1;
    min-width: 0;
}

.sb-profile-list .pc-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sb-profile-list .pc-primary-badge {
    font-size: 8.5px;
    background: var(--gold, #f5b400);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.sb-profile-list .pc-meta {
    font-size: 10.5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 2px;
}

.sb-profile-list .pc-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* Flat, direct colors — always visible, no hover state (web view) */
.sb-profile-list .pc-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 7px;
    font-size: 11px;
    cursor: pointer;
}

.sb-profile-list .pc-btn.pc-edit {
    background: #e8f3ff;
    color: #1f7ae0;
}

.sb-profile-list .pc-btn.pc-delete {
    background: #fde8e8;
    color: #e04b4b;
}

/* Arrow status badge — gray by default, green for active profile */
.sb-profile-list .pc-status {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eceff3;
    color: #9aa3af;
    font-size: 12px;
    flex-shrink: 0;
}

.sb-profile-list .pc-status.active {
    background: #dcfce7;
    color: #16a34a;
}

.sidebar-active-profile{
    border: 1px solid #008080;

}