/* ==========================================================
   LinkShare — Responsive Stylesheet
   Mobile: app-style shell | Desktop: sidebar + wide content
   ========================================================== */

:root {
    --primary:      #1a1a2e;
    --accent:       #e94560;
    --success:      #28a745;
    --warning:      #ffc107;
    --danger:       #dc3545;
    --info:         #17a2b8;
    --light:        #f8f9fa;
    --dark:         #212529;
    --border:       #dee2e6;
    --text-muted:   #6c757d;
    --white:        #ffffff;
    --radius:       8px;
    --radius-lg:    14px;
    --radius-xl:    20px;
    --font:         'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'DM Mono', monospace;
    --sidebar-w:    240px;
    --topbar-h:     60px;
    --mob-topbar-h: 56px;
    --mob-nav-h:    64px;
    --transition:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: var(--font);
    background: #f0f2f5;
    color: #111;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

/* ======================================================
   LAYOUT SHELL
   ====================================================== */

/* Desktop topbar */
.desktop-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--primary);
    z-index: 200;
    display: flex;
    align-items: center;
}
.desktop-topbar-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.desktop-brand {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}
.desktop-nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.desktop-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.desktop-nav-link.active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; }
.desktop-topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.desktop-balance {
    background: rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.desktop-avatar-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.14);
    border: none;
    border-radius: 20px;
    padding: 6px 12px 6px 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* Desktop sidebar */
.desktop-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--topbar-h));
    background: var(--primary);
    z-index: 150;
    overflow-y: auto;
    overflow-x: hidden;
}
.desktop-sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 20px 0 16px;
}
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 8px;
}
.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-balance-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}
.sidebar-balance-pill i { font-size: 13px; opacity: 0.6; }
.sidebar-nav { padding: 0 8px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.sidebar-link.active { background: rgba(255,255,255,0.13); color: #fff; font-weight: 600; }
.sidebar-link.active i { color: var(--accent); }
.sidebar-bottom-links { padding: 0 8px 8px; border-top: 1px solid rgba(255,255,255,0.07); padding-top: 12px; }

/* Main app layout */
.app-layout {
    display: flex;
}

/* Desktop: content offset by sidebar + topbar */
@media (min-width: 992px) {
    .app-layout { padding-top: var(--topbar-h); }
    .app-content-wrap {
        margin-left: var(--sidebar-w);
        flex: 1;
        min-height: calc(100vh - var(--topbar-h));
        overflow-y: auto;
        overflow-x: hidden;
    }
    #main-content { padding: 28px 32px; max-width: 1100px; }
}

/* Mobile: full-width, bottom nav */
@media (max-width: 991.98px) {
    .app-layout { flex-direction: column; }
    .app-content-wrap {
        flex: 1;
        min-height: calc(100vh - var(--mob-topbar-h) - var(--mob-nav-h));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
    }
    #main-content { padding: 14px 14px 0; }
    .app-content-wrap::-webkit-scrollbar { display: none; }
    .app-content-wrap { scrollbar-width: none; }
}

/* ======================================================
   MOBILE TOP BAR
   ====================================================== */
.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--primary);
    height: var(--mob-topbar-h);
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.mobile-brand { font-size: 17px; font-weight: 800; color: #fff; text-decoration: none; }
.mobile-balance {
    background: rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 5px;
}
.mobile-avatar {
    width: 33px; height: 33px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit;
}

/* Mobile profile dropdown */
.profile-sheet { position: fixed; inset: 0; z-index: 9990; display: none; }
.profile-sheet.open { display: flex; flex-direction: column; }
.profile-sheet-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(3px); }
.profile-sheet-panel {
    position: absolute;
    top: 62px; right: 12px;
    background: #fff;
    border-radius: 16px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 16px 50px rgba(0,0,0,0.18);
    animation: popIn 0.2s var(--transition);
}
.profile-user-info { padding: 12px 16px 10px; border-bottom: 1px solid #f3f4f6; }
.profile-sheet-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; font-size: 13.5px; font-weight: 500;
    color: #333; text-decoration: none;
    transition: background 0.1s; cursor: pointer;
}
.profile-sheet-item i { width: 16px; text-align: center; color: #aaa; }
.profile-sheet-item:hover { background: #f9fafb; }

/* ======================================================
   MOBILE BOTTOM NAV
   ====================================================== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: #fff;
    height: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid rgba(0,0,0,0.07);
    box-shadow: 0 -6px 24px rgba(0,0,0,0.06);
    align-items: stretch;
}
.mob-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; text-decoration: none; color: #bbb;
    font-size: 10.5px; font-weight: 600;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mob-nav-item i {
    font-size: 19px;
    display: block;
    width: 38px; height: 26px;
    line-height: 26px; text-align: center;
    border-radius: 12px;
    transition: background 0.15s, transform 0.2s var(--transition);
}
.mob-nav-item.active { color: var(--primary); }
.mob-nav-item.active i { background: rgba(26,26,46,0.08); transform: scale(1.08); }
.mob-nav-item:active i { transform: scale(0.9); }

/* ======================================================
   PULL-TO-REFRESH
   ====================================================== */
#ptr-indicator {
    height: 0; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 13px; font-weight: 600;
    color: var(--primary); background: transparent;
    transition: height 0.2s ease;
}
#ptr-indicator.pulling, #ptr-indicator.refreshing { height: 52px; }
#ptr-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
}
#ptr-indicator.refreshing #ptr-spinner { animation: spin 0.7s linear infinite; }

/* ======================================================
   FLASH TOASTS
   ====================================================== */
.flash-stack { padding: 12px 14px 0; }
.flash-toast {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 8px;
    animation: slideDown 0.3s var(--transition);
}
.flash-toast.success { background: #e6f9f0; color: #15803d; }
.flash-toast.danger  { background: #fef2f2; color: #dc2626; }
.flash-toast.warning { background: #fffbeb; color: #d97706; }
.flash-toast.info    { background: #eff6ff; color: #2563eb; }

/* ======================================================
   COPY FEEDBACK
   ====================================================== */
.copy-feedback {
    position: fixed; z-index: 9999;
    bottom: calc(var(--mob-nav-h) + 14px + env(safe-area-inset-bottom, 0px));
    left: 50%; transform: translateX(-50%) translateY(16px);
    background: #111; color: #fff;
    font-size: 13px; font-weight: 600;
    padding: 10px 20px; border-radius: 99px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s var(--transition);
    white-space: nowrap;
}
.copy-feedback.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 992px) {
    .copy-feedback { bottom: 24px; }
}

/* ======================================================
   PAGE CONTENT COMPONENTS
   ====================================================== */

/* Page section title (used inside views) */
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 2px; }
.page-sub   { font-size: 13px; color: #999; font-weight: 500; }

@media (min-width: 992px) {
    .page-title { font-size: 26px; }
}

.section-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.section-title { font-size: 15px; font-weight: 700; color: #111; }
.section-link  { font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; }

/* ---- App Card ---- */
.app-card {
    background: #fff;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
@media (min-width: 992px) {
    .app-card { border-radius: var(--radius-lg); box-shadow: 0 1px 6px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; }
}
.app-card-header {
    padding: 14px 18px 10px;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: 14px;
}
.app-card-body { padding: 4px 18px 18px; }
.card-title-icon { display: flex; align-items: center; gap: 9px; }
.icon-circle {
    width: 30px; height: 30px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
}

/* ---- Hero balance card ---- */
.stat-hero {
    background: var(--primary);
    border-radius: var(--radius-xl);
    padding: 22px 20px;
    color: #fff;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}
.stat-hero::before {
    content: ''; position: absolute;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.04); top: -50px; right: -30px;
}
.stat-hero::after {
    content: ''; position: absolute;
    width: 110px; height: 110px; border-radius: 50%;
    background: rgba(255,255,255,0.03); bottom: -25px; left: 20px;
}
.stat-hero-label { font-size: 12px; opacity: 0.6; margin-bottom: 5px; font-weight: 500; }
.stat-hero-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
@media (min-width: 992px) {
    .stat-hero-value { font-size: 38px; }
}
.stat-hero-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px; margin-top: 8px;
}
.badge-hero-up   { background: rgba(74,222,128,0.18); color: #4ade80; }
.badge-hero-down { background: rgba(248,113,113,0.18); color: #f87171; }

/* ---- Stat grid ---- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
@media (min-width: 992px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .stat-grid .span-2 { grid-column: span 2; }
}
.stat-tile {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
    position: relative; overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
    transition: transform 0.15s var(--transition), box-shadow 0.15s;
    cursor: default;
}
.stat-tile:active { transform: scale(0.97); }
@media (min-width: 992px) {
    .stat-tile { border-radius: var(--radius-lg); border: 1px solid #f0f0f0; box-shadow: none; }
    .stat-tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-1px); }
}
.stat-tile-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.stat-tile-value { font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -0.5px; color: #111; }
.stat-tile-value.sm { font-size: 16px; }
.stat-tile-label { font-size: 11.5px; color: #999; font-weight: 500; }
.stat-tile-badge {
    font-size: 10.5px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px;
    display: inline-flex; align-items: center; gap: 3px; width: fit-content;
}
.badge-up   { background: #e6f9f0; color: #15803d; }
.badge-down { background: #fef2f2; color: #dc2626; }

/* Icon bg helpers */
.icon-primary-bg { background: rgba(26,26,46,0.08);  color: var(--primary); }
.icon-accent-bg  { background: rgba(233,69,96,0.1);  color: var(--accent); }
.icon-success-bg { background: rgba(21,128,61,0.1);  color: #15803d; }
.icon-warning-bg { background: rgba(217,119,6,0.1);  color: #d97706; }
.icon-info-bg    { background: rgba(37,99,235,0.1);  color: #2563eb; }
.icon-purple-bg  { background: rgba(124,58,237,0.1); color: #7c3aed; }

/* ---- Quick actions ---- */
.quick-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.quick-action-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px;
    background: #fff; border-radius: var(--radius-lg); padding: 14px 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05); cursor: pointer; border: none; font-family: inherit;
    transition: transform 0.15s var(--transition), box-shadow 0.15s;
    text-decoration: none;
}
.quick-action-btn:active { transform: scale(0.93); }
@media (min-width: 992px) {
    .quick-action-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
}
.quick-action-icon {
    width: 46px; height: 46px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.quick-action-label { font-size: 12px; font-weight: 600; color: #444; }

/* ---- List items ---- */
.app-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 18px; border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s; cursor: default;
}
.app-list-item:last-child { border-bottom: none; }
.app-list-item:active { background: #f9fafb; }
@media (min-width: 992px) {
    .app-list-item:hover { background: #fafafa; }
}
.list-item-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 15px;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 13.5px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub   { font-size: 12px; color: #999; margin-top: 2px; }
.list-item-right { text-align: right; flex-shrink: 0; }
.list-item-amount { font-size: 14px; font-weight: 700; }
.list-item-amount.positive { color: #15803d; }
.list-item-amount.negative { color: #dc2626; }
.list-item-time  { font-size: 11px; color: #bbb; margin-top: 2px; }

/* ---- Pill badges ---- */
.pill-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
}
.pill-active   { background: #e6f9f0; color: #15803d; }
.pill-pending  { background: #fffbeb; color: #d97706; }
.pill-rejected { background: #fef2f2; color: #dc2626; }
.pill-inactive { background: #f3f4f6; color: #6b7280; }

/* ---- Progress bar ---- */
.app-progress { background: #f0f0f0; border-radius: 99px; height: 8px; overflow: hidden; }
.app-progress-bar {
    height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.5s ease;
}

/* ---- Search bar ---- */
.app-search {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border-radius: 12px; padding: 10px 14px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05); margin-bottom: 14px;
}
.app-search i { color: #ccc; font-size: 14px; }
.app-search input {
    border: none; outline: none; flex: 1;
    font-size: 14px; font-family: inherit; background: transparent; color: #111;
}
.app-search input::placeholder { color: #ccc; }
.app-search-btn {
    background: var(--primary); color: #fff; border: none;
    border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}

/* ---- Form controls ---- */
.app-form-group { margin-bottom: 14px; }
.app-form-label { font-size: 12.5px; font-weight: 600; color: #555; margin-bottom: 6px; display: block; }
.app-form-control {
    width: 100%; background: #f8f9fa; border: 1.5px solid #f0f0f0;
    border-radius: var(--radius); padding: 11px 14px; font-size: 14px;
    font-family: inherit; color: #111; outline: none; transition: border-color 0.15s;
}
.app-form-control:focus { border-color: var(--primary); background: #fff; }
.app-form-control:disabled { opacity: 0.55; }
.app-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

/* ---- Buttons ---- */
.btn-app {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: none; border-radius: var(--radius); font-family: inherit;
    font-weight: 600; font-size: 14px; cursor: pointer; padding: 12px 20px;
    transition: transform 0.15s var(--transition), opacity 0.15s;
    text-decoration: none; width: 100%;
}
.btn-app:active { transform: scale(0.96); opacity: 0.9; }
.btn-app.primary { background: var(--primary); color: #fff; }
.btn-app.accent  { background: var(--accent);  color: #fff; }
.btn-app.success { background: #15803d; color: #fff; }
.btn-app.ghost   { background: #f3f4f6; color: #333; }
.btn-app.outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-app.wa      { background: #25d366; color: #fff; }
.btn-app.sm      { padding: 8px 14px; font-size: 12.5px; width: auto; border-radius: 8px; }
@media (min-width: 992px) {
    .btn-app { width: auto; }
    .btn-app.full { width: 100%; }
    .btn-app:hover { opacity: 0.88; }
}

/* ---- Empty state ---- */
.app-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.app-empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.3; }
.app-empty-text { font-size: 14px; color: #aaa; font-weight: 500; }

/* ---- Copy button (legacy) ---- */
.btn-copy {
    background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius); padding: 6px 14px; font-size: 12px;
    cursor: pointer; transition: background 0.15s; font-family: inherit;
}
.btn-copy:hover  { background: #2d2d4e; }
.btn-copy.copied { background: #15803d; }

/* ---- Legacy stat-card (compat with admin/other views) ---- */
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); padding: 1rem 1.1rem; display: flex; align-items: center; gap: .75rem; min-width: 0; }
.stat-card-body { min-width: 0; flex: 1; }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value--currency { font-size: 1.1rem; }
.stat-card .stat-label { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.mini-stat { font-size: 11px; font-weight: 600; }
.mini-stat.up { color: #15803d; }
.icon-primary { background: #e8eaf0; color: var(--primary); }
.icon-accent  { background: #fde8ec; color: var(--accent); }
.icon-success { background: #e6f4ea; color: #15803d; }
.icon-warning { background: #fff8e1; color: #e65100; }
.icon-info    { background: #e3f2fd; color: var(--info); }
.icon-purple  { background: #f3e8ff; color: #7c3aed; }

/* ---- Legacy cards ---- */
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); margin-bottom: 1.25rem; }
.card-header { background: var(--white); border-bottom: 1px solid var(--border); padding: .85rem 1.25rem; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 1.25rem; }

/* ---- Status badges (legacy) ---- */
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.badge-active    { background: #e6f4ea; color: #2e7d32; }
.badge-inactive  { background: #fce4ec; color: #c62828; }
.badge-pending   { background: #fff3cd; color: #856404; }
.badge-approved  { background: #e6f4ea; color: #2e7d32; }
.badge-rejected  { background: #fce4ec; color: #c62828; }
.badge-cancelled { background: #f5f5f5; color: #666; }

/* ---- Forms (bootstrap compat) ---- */
.form-control, .form-select { border: 1px solid var(--border); border-radius: var(--radius); font-size: 13.5px; padding: .5rem .85rem; color: var(--dark); background: var(--white); transition: border-color .15s; font-family: inherit; }
.form-control:focus, .form-select:focus { border-color: var(--primary); outline: none; box-shadow: none; }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-text  { font-size: 12px; color: var(--text-muted); }
.input-group-text { font-size: 13px; border-color: var(--border); }

/* ---- Alerts ---- */
.alert { border-radius: var(--radius); font-size: 13.5px; border-width: 1px; padding: .85rem 1rem; }
.alert-success { background: #e6f4ea; border-color: #c3e6cb; color: #155724; }
.alert-danger  { background: #fce4ec; border-color: #f5c6cb; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #ffeaa7; color: #856404; }
.alert-info    { background: #e3f2fd; border-color: #bee5eb; color: #0c5460; }

/* ---- Short URL box ---- */
.short-url-box { display: flex; align-items: center; gap: .5rem; background: #f8f9fa; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 12.5px; font-family: monospace; }
.short-url-box span { flex: 1; color: var(--primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Pagination ---- */
.pagination .page-link { border-color: var(--border); color: var(--primary); font-size: 13px; padding: .35rem .7rem; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---- Member badges ---- */
.member-badge { display: inline-flex; align-items: center; gap: 5px; background: #e6f4ea; color: #2e7d32; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.non-member-badge { background: #fce4ec; color: #c62828; }

/* ---- Table ---- */
.table { font-size: 13px; }
.table th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 2px solid var(--border); padding: .65rem .85rem; }
.table td { vertical-align: middle; padding: .65rem .85rem; border-color: var(--border); }
.table-hover tbody tr:hover { background: #fafafa; }

/* ---- Buttons (bootstrap compat) ---- */
.btn { border-radius: var(--radius); font-size: 13px; font-weight: 500; padding: .45rem .95rem; transition: opacity .15s; border-width: 1px; font-family: inherit; }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #212529; }
.btn-outline-primary   { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { border-color: #ccc; color: #555; background: transparent; }
.btn-sm { padding: .3rem .65rem; font-size: 12px; }

/* ---- Page header (legacy) ---- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .5rem; }
.page-header h4 { margin: 0; font-weight: 700; }

/* ---- Empty state (legacy) ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: .75rem; opacity: .3; display: block; }
.empty-state p { font-size: 14px; }

/* ---- Referral card ---- */
.referral-copy-card { cursor: pointer; transition: background .15s; }
.referral-copy-card:hover { background: #f0f5ff !important; }

/* ======================================================
   DESKTOP TWO-COLUMN HELPERS
   ====================================================== */
@media (min-width: 992px) {
    .desktop-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: start;
    }
    .desktop-grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        align-items: start;
    }
    .desktop-cols-7-5 {
        display: grid;
        grid-template-columns: 7fr 5fr;
        gap: 20px;
        align-items: start;
    }
}

/* ======================================================
   ANIMATIONS
   ====================================================== */
@keyframes slideDown  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn      { from { opacity: 0; transform: scale(0.9) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeSlideUp 0.4s var(--transition) both; }

/* Stagger */
.stagger > * { opacity: 0; animation: fadeSlideUp 0.35s var(--transition) forwards; }
.stagger > *:nth-child(1)  { animation-delay: 0.04s; }
.stagger > *:nth-child(2)  { animation-delay: 0.08s; }
.stagger > *:nth-child(3)  { animation-delay: 0.12s; }
.stagger > *:nth-child(4)  { animation-delay: 0.16s; }
.stagger > *:nth-child(5)  { animation-delay: 0.20s; }
.stagger > *:nth-child(6)  { animation-delay: 0.24s; }
.stagger > *:nth-child(n+7){ animation-delay: 0.28s; }

/* ======================================================
   PWA STANDALONE
   ====================================================== */
@media (display-mode: standalone) {
    .mobile-topbar { padding-top: env(safe-area-inset-top, 20px); height: calc(var(--mob-topbar-h) + env(safe-area-inset-top, 20px)); }
}