/* View Certi v1.1 - Light / Dark SaaS theme */
:root {
    --font: 'Inter', system-ui, sans-serif;
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-w: 340px;
    --header-h: 60px;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-elevated: #ffffff;
    --bg-subtle: #eef1f8;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-soft: #eef2ff;
    --primary-hover: #4338ca;
    --accent: #0891b2;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.04);
    --sidebar-bg: #F8FAFC;
    --header-bg: rgba(255,255,255,.85);
    --card: #ffffff;
}

[data-theme="dark"] {
    --bg: #0b0f19;
    --bg-elevated: #111827;
    --bg-subtle: #1a2234;
    --border: #1f2937;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-soft: rgba(99,102,241,.12);
    --primary-hover: #a5b4fc;
    --accent: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 4px 24px rgba(0,0,0,.35);
    --sidebar-bg: #0f1524;
    --header-bg: rgba(11,15,25,.9);
    --card: #111827;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    background-image:
        radial-gradient(circle at top right, rgba(79,70,229,.04) 0%, transparent 40%),
        radial-gradient(circle at bottom left, rgba(99,102,241,.03) 0%, transparent 40%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 200;
    transition: transform .25s ease, background var(--transition);
}

/* Premium header card */
.sidebar-header-card {
    margin: .85rem .85rem .35rem;
    padding: .9rem 1rem;
    background: #FFFFFF;
    border: 1px solid #E6EAF2;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sidebar-close-btn:hover {
    background: var(--bg-subtle);
}
.sidebar-close-btn:active {
    background: var(--bg-subtle);
    opacity: 0.8;
}
.sidebar-header-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(59, 130, 246, .08));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-header-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sidebar-header-meta strong {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
}
.sidebar-header-meta small {
    display: block;
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: .1rem;
}

.nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: .35rem .85rem .85rem;
    scrollbar-width: thin;
}
.nav-quick-links {
    display: grid;
    gap: .35rem;
    margin-bottom: .65rem;
}

/* Accordion category cards */
.nav-group {
    position: relative;
    margin-bottom: .55rem;
}
.nav-group-card {
    background: #FFFFFF;
    border: 1px solid #E6EAF2;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
    overflow: hidden;
    transition: all .25s ease;
}
.nav-group:hover .nav-group-card {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
}
.nav-group.open .nav-group-card,
.nav-group.active-group.open .nav-group-card,
.nav-group.search-open .nav-group-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(59, 130, 246, .08));
    border: 1px solid rgba(99, 102, 241, .25);
    box-shadow: 0 10px 25px rgba(99, 102, 241, .12);
    transform: translateY(-2px);
}
.nav-group-head {
    position: relative;
    display: flex;
    align-items: stretch;
}
.nav-label-link {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding: .78rem .85rem;
    min-height: 52px;
    touch-action: manipulation;
    user-select: none;
    transition: all .25s ease;
}
.nav-label-link::after {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: transparent;
    transition: all .25s ease;
}
.nav-group.open .nav-label-link::after,
.nav-group.active-group .nav-label-link::after {
    background: linear-gradient(180deg, #6366F1, #8B5CF6);
}
.nav-label-left {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
}
.nav-group-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(99, 102, 241, .08);
    font-size: .95rem;
    flex-shrink: 0;
}
.nav-label-text {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-count-badge {
    min-width: 26px;
    height: 26px;
    padding: 0 .45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, .25);
    flex-shrink: 0;
}
.nav-group-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    border: 0;
    border-left: 1px solid #E6EAF2;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .25s ease;
}
.nav-group-toggle svg { transition: transform .25s ease; }
.nav-group.open .nav-group-toggle svg { transform: rotate(180deg); color: #6366F1; }

/* Active state for group label link */
.nav-label-link.active {
    color: #6366F1;
    font-weight: 600;
}
.nav-label-link.active .nav-label-text {
    color: #6366F1;
}
.nav-label-link.active .nav-group-icon {
    background: rgba(99, 102, 241, .15);
    box-shadow: 0 4px 12px rgba(99, 102, 241, .1);
}

.nav-group-items {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-4px);
    transition: max-height .28s ease, opacity .22s ease, transform .22s ease;
    padding: 0 .55rem;
}
.nav-group.hover-open .nav-group-items,
.nav-group.open .nav-group-items,
.nav-group.search-open .nav-group-items {
    max-height: 1200px;
    opacity: 1;
    transform: translateY(0);
    padding: .25rem .55rem .65rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .58rem .72rem;
    border-radius: 14px;
    font-size: .84rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all .25s ease;
    margin-bottom: .2rem;
}
.nav-item-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(15, 23, 42, .04);
    font-size: .9rem;
    flex-shrink: 0;
    transition: all .25s ease;
}
.nav-item-text {
    min-width: 0;
    line-height: 1.35;
}
.nav-free-badge {
    display: inline-block;
    font-size: .55rem;
    font-weight: 700;
    padding: .05rem .35rem;
    border-radius: 4px;
    background: rgba(5,150,105,.12);
    color: var(--success);
    margin-left: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.nav-inactive-badge {
    display: inline-block;
    font-size: .55rem;
    font-weight: 700;
    padding: .05rem .35rem;
    border-radius: 4px;
    background: rgba(220,38,38,.12);
    color: var(--danger);
    margin-left: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.nav-item-disabled {
    opacity: .5 !important;
    cursor: default !important;
    pointer-events: none !important;
}
.nav-item-disabled:hover {
    background: transparent !important;
    color: inherit !important;
    transform: none !important;
}
.nav-item-top {
    background: #FFFFFF;
    border: 1px solid #E6EAF2;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}
.nav-item:hover {
    background: rgba(255, 255, 255, .92);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
}
.nav-item:hover .nav-item-icon {
    background: rgba(99, 102, 241, .1);
}
.nav-item.active,
.nav-item.child-active {
    background: #FFFFFF;
    color: #6366F1;
    font-weight: 600;
    border-left: 4px solid #6366F1;
    box-shadow: 0 6px 18px rgba(99, 102, 241, .15);
    padding-left: calc(.72rem - 3px);
}
.nav-item.active .nav-item-icon,
.nav-item.child-active .nav-item-icon {
    background: rgba(99, 102, 241, .12);
}
.nav-item-child {
    font-size: .81rem;
}

.nav-subgroup {
    margin-bottom: .5rem;
}
.nav-subgroup:last-child {
    margin-bottom: 0;
}
.nav-subgroup-head {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: .35rem .72rem .2rem;
    opacity: .7;
    border-bottom: 1px solid var(--border);
    margin: 0 -.2rem .25rem;
}

/* Sticky sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    padding: .65rem .85rem .85rem;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    display: grid;
    gap: .35rem;
}
.sidebar-footer-divider {
    height: 1px;
    background: var(--border);
    margin: .15rem 0;
}
.nav-item-logout:hover {
    color: var(--danger);
}
.nav-item-logout:hover .nav-item-icon {
    background: rgba(220, 38, 38, .1);
}

/* Dark mode nav states — clean, no glow */
[data-theme="dark"] .nav-item-top {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: none;
    border-radius: 16px;
}
[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item-top:hover {
    background: rgba(255, 255, 255, .06);
    color: #FFFFFF;
    box-shadow: none;
    transform: none;
}
[data-theme="dark"] .nav-item:hover .nav-item-icon,
[data-theme="dark"] .nav-item-top:hover .nav-item-icon {
    background: rgba(99, 102, 241, .12);
    color: #A5B4FC;
}
[data-theme="dark"] .nav-item.active,
[data-theme="dark"] .nav-item.child-active {
    background: var(--bg-subtle);
    color: var(--text);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    border-radius: 16px;
    box-shadow: none;
    padding-left: calc(.72rem - 3px);
}
[data-theme="dark"] .nav-item.active .nav-item-icon,
[data-theme="dark"] .nav-item.child-active .nav-item-icon {
    background: var(--bg-subtle);
    color: var(--text-muted);
}
[data-theme="dark"] .nav-label-link.active {
    color: var(--primary);
}
[data-theme="dark"] .nav-label-link.active .nav-label-text {
    color: var(--primary);
}
[data-theme="dark"] .nav-label-link.active .nav-group-icon {
    background: rgba(129, 140, 248, .15);
}
[data-theme="dark"] .nav-count-badge {
    box-shadow: none;
}
[data-theme="dark"] .nav-group.open .nav-label-link::after,
[data-theme="dark"] .nav-group.active-group .nav-label-link::after {
    background: var(--primary);
    box-shadow: none;
    opacity: .15;
}

/* Dark mode — accordion cards */
[data-theme="dark"] .sidebar-header-card {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    border-radius: 20px;
}
[data-theme="dark"] .sidebar-header-logo {
    background: rgba(129, 140, 248, .12);
}
[data-theme="dark"] .nav-group-card {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    border-radius: 20px;
}
[data-theme="dark"] .nav-group:hover .nav-group-card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .nav-group.open .nav-group-card,
[data-theme="dark"] .nav-group.active-group.open .nav-group-card,
[data-theme="dark"] .nav-group.search-open .nav-group-card {
    background: var(--bg-elevated);
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.header {
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem; gap: 1rem;
}
.header-left { display: flex; align-items: center; gap: .75rem; flex: 1; }
.menu-btn {
    display: none; border: 1px solid var(--border); background: var(--bg-elevated);
    color: var(--text); border-radius: 8px; padding: .35rem .55rem; cursor: pointer;
}
.search-input {
    max-width: 320px; width: 100%;
    padding: .45rem .85rem .45rem 2rem;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-elevated); color: var(--text); font-size: .84rem;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-input.has-kbd {
    padding-right: 2rem;
}
.search-wrap { position: relative; flex: 1; max-width: 360px; }
.search-wrap svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 14px; color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: .65rem; }

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text);
    transition: background .2s ease, border-color .2s ease;
}
.wallet-chip {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
    transition: background .2s ease, border-color .2s ease;
}
.wallet-chip:hover {
    background: var(--bg-subtle);
}
.wallet-icon {
    font-size: .95rem;
    line-height: 1;
}
.wallet-amount {
    line-height: 1;
}
.theme-toggle:hover {
    background: var(--bg-subtle);
}
.theme-toggle-icon {
    font-size: 1.15rem;
    line-height: 1;
}
.theme-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: .35rem .55rem;
    border-radius: 8px;
    background: var(--text);
    color: var(--bg-elevated);
    font-size: .68rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 120;
}
.theme-toggle:hover .theme-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.user-menu { position: relative; }
.user-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem .65rem .3rem .3rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
    font: inherit;
    color: inherit;
}
.user-chip:hover,
.user-menu.open .user-chip {
    background: var(--bg-subtle);
    border-color: rgba(99, 102, 241, .25);
}
.user-chip-chevron {
    color: var(--text-muted);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.user-menu.open .user-chip-chevron { transform: rotate(180deg); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.avatar-lg {
    width: 42px;
    height: 42px;
    font-size: .85rem;
}
.user-chip .meta { line-height: 1.2; text-align: left; }
.user-chip .meta strong { display: block; font-size: .8rem; font-weight: 600; }
.user-chip .meta small { display: block; font-size: .68rem; color: var(--text-muted); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(280px, calc(100vw - 2rem));
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    z-index: 150;
}
.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-dropdown-head {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .25rem .15rem .65rem;
}
.user-dropdown-meta strong {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
}
.user-dropdown-meta small {
    display: block;
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: .1rem;
}
.user-wallet-badge {
    display: inline-flex;
    margin-top: .55rem;
    padding: .28rem .55rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, .1);
    border: 1px solid rgba(99, 102, 241, .18);
    color: var(--primary);
    font-size: .68rem;
    font-weight: 600;
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: .35rem 0;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .58rem .65rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-size: .82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.user-dropdown-item:hover {
    background: var(--bg-subtle);
}
.user-dropdown-item-danger:hover {
    background: rgba(220, 38, 38, .08);
    color: var(--danger);
}
.user-dropdown-icon {
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

[data-theme="dark"] .user-dropdown {
    box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
}
[data-theme="dark"] .user-wallet-badge {
    background: rgba(99, 102, 241, .15);
    border-color: rgba(99, 102, 241, .22);
    color: #A5B4FC;
}
[data-theme="dark"] .theme-tooltip {
    background: #1f2937;
    color: #f1f5f9;
}

.page { padding: 1.25rem; max-width: 1280px; }
.page-title { font-size: 1.35rem; font-weight: 700; margin-bottom: .15rem; }
.page-sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 1.25rem; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: .85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-pad { padding: 1rem 1.15rem; }
.card-head {
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: .9rem; font-weight: 600; }

.stat .lbl { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.stat .val { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat .val.primary { color: var(--primary); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .5rem .95rem; border-radius: 8px; font-size: .84rem; font-weight: 600;
    border: none; cursor: pointer; transition: all var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn:disabled {
    cursor: not-allowed;
    opacity: .7;
    transform: none;
    box-shadow: none;
}
.btn.is-loading {
    pointer-events: none;
}
.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: btn-spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.field label { display: block; font-size: .78rem; font-weight: 500; color: var(--text-muted); margin-bottom: .3rem; }
.field input, .field select, .field textarea {
    width: 100%; padding: .55rem .75rem;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-subtle); color: var(--text); font-size: .875rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.field.full { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; }
table.data,
table.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.data th,
table.data td,
table.data-table th,
table.data-table td { padding: .65rem .85rem; text-align: left; border-bottom: 1px solid var(--border); }
table.data th,
table.data-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
table.data tr:hover td,
table.data-table tr:hover td { background: var(--bg-subtle); }

/* smart-table */
.st-wrap { padding: .65rem 1rem 0; }
.st-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: 0 0 .65rem;
}
.st-bar-left { display: flex; align-items: center; gap: .5rem; }
.st-bar-right { display: flex; align-items: center; gap: .65rem; }
.st-search {
    min-width: min(100%, 280px);
    width: min(100%, 280px);
    padding: .55rem .8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: .85rem;
}
.st-meta { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.st-pag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .4rem 0 .65rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.st-pag-left,
.st-pag-right { display: flex; align-items: center; gap: .6rem; }
.st-pag-left label {
    font-size: .8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .3rem;
}
.st-pag-left select {
    padding: .2rem .4rem;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: .8rem;
}
.st-info { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.st-chk { width: 40px; min-width: 40px; text-align: center !important; }
.st-chk input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.st-hid { display: none !important; }
.st-pag-hid { display: none !important; }
.table-empty-state { text-align: center; color: var(--text-muted); padding: 1rem; }
.search-empty-state {
    margin: .85rem 0;
    padding: .9rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    text-align: center;
    font-size: .84rem;
    font-weight: 600;
}

.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .84rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: rgba(5,150,105,.1); border-color: rgba(5,150,105,.25); color: var(--success); }
.alert-error { background: rgba(220,38,38,.1); border-color: rgba(220,38,38,.25); color: var(--danger); }
.alert-warning { background: rgba(217,119,6,.1); border-color: rgba(217,119,6,.25); color: var(--warning); }

.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { padding: .45rem .75rem; border-radius: 8px; font-size: .8rem; font-weight: 500; border: 1px solid var(--border); background: var(--bg-subtle); transition: all var(--transition); }
.pill:hover { border-color: var(--primary); background: var(--primary-soft); }
.pill-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.pill-primary:hover { background: var(--primary-hover); color: #fff; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .65rem; }
.svc-card { padding: .85rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-subtle); transition: all var(--transition); }
.svc-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.svc-card h4 { font-size: .84rem; margin-bottom: .15rem; }
.svc-card p { font-size: .72rem; color: var(--text-muted); }
.svc-card .fee { font-size: .68rem; color: var(--success); margin-top: .35rem; font-weight: 600; }
.svc-card .fee.fee-free { display: inline-block; background: var(--success); color: #fff; padding: 0 .5rem; border-radius: 4px; font-size: .65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.activity-item { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .82rem; }
.activity-item:last-child { border-bottom: none; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo img { width: 56px; border-radius: 12px; }

.setting-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.setting-copy {
    color: var(--text-muted);
    font-size: .84rem;
}
.setting-form {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.status-on {
    color: var(--success);
    background: rgba(5,150,105,.1);
    border-color: rgba(5,150,105,.24);
}
.status-off {
    color: var(--danger);
    background: rgba(220,38,38,.1);
    border-color: rgba(220,38,38,.2);
}
.summary-stack {
    display: grid;
    gap: .7rem;
}
.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
    font-size: .84rem;
}
.summary-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.setting-note {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: .8rem;
}

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 1.5rem; max-width: 360px; width: 90%; text-align: center; border: 1px solid var(--border); }
.auto-wallet-grid { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 360px); gap: 1rem; align-items: start; }
.auto-wallet-card,
.auto-wallet-help { min-height: 100%; }
.auto-wallet-actions { display: grid; gap: .75rem; }
.auto-wallet-modal { max-width: 420px; width: min(92vw, 420px); padding: 1.5rem 1.35rem; }
.auto-qr-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    padding: 1rem;
    margin-bottom: .85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
}
.auto-qr-frame img {
    width: min(100%, 240px);
    height: auto;
    object-fit: contain;
}
.auto-wallet-status { font-size: .82rem; color: var(--warning); margin: .75rem 0 1rem; }
.auto-wallet-modal-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar.open ~ .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .auto-wallet-grid { grid-template-columns: 1fr; }
    .st-bar { align-items: stretch; }
    .st-bar-left { width: 100%; }
    .st-search { width: 100%; min-width: 100%; }
    .st-pag { flex-direction: column; align-items: stretch; }
    .st-pag-left, .st-pag-right { justify-content: center; }
    .main { margin-left: 0; }
    .menu-btn { display: block; }
    .nav-label-link { padding-right: .85rem; }
    .nav-count-badge { display: none; }
    .nav-group-toggle {
        display: inline-flex;
    }
    .nav-group:hover .nav-group-card { transform: none; }
    .nav-group.hover-open .nav-group-items { max-height: 0; opacity: 0; transform: translateY(-4px); }
    .nav-group.open .nav-group-items,
    .nav-group.search-open .nav-group-items {
        max-height: 480px;
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search keyboard shortcut */
.search-kbd {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 .35rem;
    line-height: 1.5;
    pointer-events: none;
    font-family: inherit;
}

/* ─── Dashboard v2 ─── */
.dash {
    padding: 1.5rem;
    max-width: 1200px;
}

/* Dashboard Greeting */
.dash-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.dash-greeting-text {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.dash-greeting-hello {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.dash-greeting-sub {
    font-size: .85rem;
    color: var(--text-muted);
}
.dash-greeting-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .35rem .65rem .35rem .85rem;
    min-width: 260px;
    transition: border-color .2s, box-shadow .2s;
}
.dash-greeting-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.dash-search-icon {
    font-size: .85rem;
    opacity: .5;
    flex-shrink: 0;
}
.dash-search-input {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: .82rem;
    width: 100%;
    outline: none;
    font-family: inherit;
}
.dash-search-shortcut {
    flex-shrink: 0;
}
.dash-search-shortcut kbd {
    display: inline-flex;
    align-items: center;
    padding: .1rem .4rem;
    border-radius: 4px;
    font-size: .68rem;
    font-weight: 600;
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-family: inherit;
    white-space: nowrap;
}

.dash-hero {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary), #6366f1 45%, #7c3aed 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 130px;
}
.dash-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 40%, rgba(255,255,255,.15) 0%, transparent 60%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,.08) 0%, transparent 40%);
    pointer-events: none;
}
.dash-hero-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}
.dash-hero-balance {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.dash-hero-label {
    font-size: .78rem;
    opacity: .7;
    font-weight: 500;
    letter-spacing: .02em;
}
.dash-hero-amount {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
}
.dash-hero-actions {
    display: flex;
    gap: .6rem;
    margin-top: .1rem;
}
.dash-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .45rem .95rem;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 600;
    background: rgba(255,255,255,.2);
    color: #fff;
    transition: background .2s, transform .2s;
    border: none;
    cursor: pointer;
}
.dash-hero-btn:hover {
    background: rgba(255,255,255,.35);
    transform: translateY(-1px);
}
.dash-hero-btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,.35);
}
.dash-hero-btn-outline:hover {
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.55);
}
.dash-hero-divider {
    width: 1px;
    background: rgba(255,255,255,.18);
    margin: .25rem 1.5rem;
    flex-shrink: 0;
}
.dash-hero-side {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    justify-content: center;
    min-width: 200px;
    position: relative;
    z-index: 1;
}
.dash-hero-info {
    display: flex;
    flex-direction: column;
    gap: .05rem;
}
.dash-hero-info-label {
    font-size: .65rem;
    opacity: .6;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.dash-hero-info-value {
    font-size: .88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .35rem;
}
.dash-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-hero-last {
    padding-top: .35rem;
    border-top: 1px solid rgba(255,255,255,.15);
    margin-top: .1rem;
}
.dash-hero-time {
    font-size: .68rem;
    opacity: .55;
    margin-top: .05rem;
}

[data-theme="dark"] .dash-hero-info-value {
    color: #fff;
}
.dash-hero-last .dash-hero-info-value {
    text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.dash-hero-last-value {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: fit-content;
    padding: .34rem .72rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15,23,42,.14);
}
.dash-hero-last-credit {
    color: #dcfce7 !important;
    background: rgba(5,150,105,.22);
}
.dash-hero-last-debit {
    color: #fee2e2 !important;
    background: rgba(220,38,38,.24);
}
[data-theme="dark"] .dash-hero-last-credit {
    color: #bbf7d0 !important;
    background: rgba(34,197,94,.2);
}
[data-theme="dark"] .dash-hero-last-debit {
    color: #fecaca !important;
    background: rgba(248,113,113,.2);
}

.dash-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}
.dash-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dash-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0;
}
.dash-card-header h3 {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}
.dash-card-link {
    font-size: .78rem;
    font-weight: 500;
    color: var(--primary);
}
.dash-card-link:hover {
    text-decoration: underline;
}

.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    padding: 1rem 1.25rem 1.25rem;
}
.dash-quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: .75rem .35rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: all .2s;
    text-align: center;
}
.dash-quick-item:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,.1);
}
.dash-quick-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.15rem;
    transition: transform .2s;
}
.dash-quick-item:hover .dash-quick-icon {
    transform: scale(1.1);
}
.dash-quick-label {
    font-size: .72rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
}

.dash-most-grid {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .75rem 1.25rem 1.25rem;
}
.dash-most-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: all .2s;
}
.dash-most-card:hover {
    border-color: var(--primary);
}
.dash-most-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}
.dash-most-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
}
.dash-most-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-most-count {
    font-size: .7rem;
    color: var(--text-muted);
}
.dash-most-btn {
    flex-shrink: 0;
    padding: .25rem .65rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    transition: background .2s;
}
.dash-most-btn:hover {
    background: var(--primary-hover);
}

.dash-activity-list {
    padding: .75rem 1.25rem 1.25rem;
}
.dash-activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
    gap: .5rem;
}
.dash-activity-item:last-child {
    border-bottom: none;
}
.dash-activity-left {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    flex: 1;
}
.dash-activity-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: .9rem;
    flex-shrink: 0;
    font-weight: 700;
}
.dash-activity-credit {
    background: rgba(5,150,105,.1);
    color: var(--success);
}
.dash-activity-debit {
    background: rgba(220,38,38,.1);
    color: var(--danger);
}
.dash-activity-refund {
    background: rgba(8,145,178,.1) !important;
    color: var(--accent) !important;
}
.dash-activity-body {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
}
.dash-activity-text {
    font-size: .82rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-activity-text a {
    color: inherit;
}
.dash-activity-text a:hover {
    color: var(--primary);
    text-decoration: underline;
}
.dash-activity-amount {
    font-size: .75rem;
    font-weight: 600;
}
.dash-activity-time {
    font-size: .68rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.dash-empty {
    color: var(--text-muted);
    font-size: .84rem;
    text-align: center;
    padding: 1rem 0;
}

/* Dark mode overrides for dashboard */
[data-theme="dark"] .dash-card {
    background: var(--bg-elevated);
    border-color: var(--border);
}
[data-theme="dark"] .dash-quick-item {
    background: var(--bg);
    border-color: var(--border);
}
[data-theme="dark"] .dash-quick-item:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
[data-theme="dark"] .dash-most-card {
    background: var(--bg);
    border-color: var(--border);
}
[data-theme="dark"] .dash-most-btn {
    background: var(--primary);
    color: #fff;
}
[data-theme="dark"] .dash-hero {
    background: linear-gradient(135deg, #3730a3, #4f46e5 45%, #6d28d9 100%);
}
[data-theme="dark"] .dash-activity-credit {
    background: rgba(52,211,153,.1);
}
[data-theme="dark"] .dash-activity-debit {
    background: rgba(248,113,113,.1);
}
[data-theme="dark"] .dash-activity-refund {
    background: rgba(34,211,238,.1) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .dash-row {
        grid-template-columns: 1fr;
    }
    .dash-hero {
        flex-direction: column;
        gap: .75rem;
        padding: 1.25rem;
    }
    .dash-hero-divider {
        display: none;
    }
    .dash-hero-side {
        min-width: 0;
        border-top: 1px solid rgba(255,255,255,.15);
        padding-top: .5rem;
    }
    .dash-hero-amount {
        font-size: 1.75rem;
    }
    .dash-greeting {
        flex-direction: column;
        align-items: stretch;
    }
    .dash-greeting-search {
        min-width: 0;
        width: 100%;
    }
    .dash-quick-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 600px) {
    .dash-hero-amount {
        font-size: 1.5rem;
    }
    .dash-quick-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-hero-actions {
        flex-direction: column;
    }
}
