:root,
html,
html[data-theme="dark"] {
    --km-bg: #000000;
    --km-bg-soft: #121212;
    --km-text: #ffffff;
    --km-text-soft: #a0a0a0;
    --km-primary: #d4af37;
    --km-accent: #ffc107;
    --km-border: rgba(212, 175, 55, 0.2);
    --km-shadow: 0 18px 40px rgba(0, 0, 0, 0.8), 0 0 15px rgba(212, 175, 55, 0.05);
    --km-gradient: linear-gradient(135deg, #d4af37 0%, #ffc107 100%);
}

html[data-theme="light"] {
    --km-bg: #f9fbfd;
    --km-bg-soft: #ffffff;
    --km-text: #111827;
    --km-text-soft: #4b5563;
    --km-primary: #d4af37;
    --km-accent: #b8901c;
    --km-border: rgba(212, 175, 55, 0.15);
    --km-shadow: 0 18px 40px rgba(0, 0, 0, 0.05), 0 0 15px rgba(212, 175, 55, 0.02);
    --km-gradient: linear-gradient(135deg, #d4af37 0%, #b8901c 100%);
}

html, body {
    background: var(--km-bg);
    color: var(--km-text);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.km-shell {
    min-height: 100vh;
    padding-bottom: 88px;
    background:
        radial-gradient(1200px circle at 15% -20%, rgba(56, 189, 248, 0.16), transparent 35%),
        radial-gradient(900px circle at 100% -10%, rgba(20, 184, 166, 0.18), transparent 30%),
        var(--km-bg);
}

.km-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(18px);
    background: color-mix(in srgb, var(--km-bg) 72%, transparent);
    border-bottom: 1px solid var(--km-border);
}

.km-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    max-width: 980px;
    margin: 0 auto;
}

.km-logo {
    font-weight: 800;
    letter-spacing: 0.04em;
    font-size: 1rem;
    color: var(--km-text);
    text-transform: uppercase;
}

.km-actions {
    display: flex;
    gap: 8px;
}

.km-icon-btn {
    border: 1px solid var(--km-border);
    background: var(--km-bg-soft);
    color: var(--km-text);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.km-icon-btn.active,
.km-icon-btn.km-theme-dark,
.km-icon-btn.km-theme-light {
    background: var(--km-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 0 0 0.12rem rgba(255, 255, 255, 0.18);
}

.km-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
}

.km-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 14px 26px;
    animation: kmFadeUp 0.35s ease;
}

.km-card {
    border: 1px solid var(--km-border);
    background: var(--km-bg-soft);
    border-radius: 20px;
    box-shadow: var(--km-shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.km-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.14);
}

.km-skeleton {
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 25%, rgba(148, 163, 184, 0.28) 50%, rgba(148, 163, 184, 0.12) 75%);
    background-size: 200% 100%;
    animation: kmSkeleton 1.3s infinite;
    border-radius: 12px;
}

.km-skeleton.summary {
    display: none;
    width: min(140px, 100%);
    height: 1.25rem;
    border-radius: 10px;
}

.km-summary-currency {
    opacity: 0.88;
    margin-left: 6px;
    white-space: nowrap;
}

html[data-summary-loading] .km-summary-text {
    opacity: 0;
}

html[data-summary-loading] .km-skeleton.summary {
    display: inline-block;
}

html[data-summary-loading] .km-skeleton.summary {
    display: inline-block;
}

.km-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    background: color-mix(in srgb, var(--km-bg) 84%, transparent);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--km-border);
}

.km-notif-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.km-notif-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.km-notif-drawer {
    position: fixed;
    right: 20px;
    top: 20px;
    width: min(340px, 90vw);
    min-height: 80px;
    height: auto;
    max-height: calc(80vh);
    z-index: 1041;
    border-radius: 26px;
    transform: translateX(16px);
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 36px 100px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(24px);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.km-notif-drawer.show {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.km-notif-badge,
.km-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
}

.km-notif-item {
    display: flex;
    gap: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 14px;
    position: relative;
    color: #f8fafc;
    backdrop-filter: blur(14px);
    transition: transform 0.24s ease, border-color 0.24s ease, background 0.24s ease;
    min-height: 72px;
}

.km-notif-item:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.km-notif-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.km-notif-body {
    flex: 1;
    min-width: 0;
}

.km-notif-title {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #f8fafc;
}

.km-notif-desc {
    font-size: 0.84rem;
    color: rgba(248, 250, 252, 0.78);
    line-height: 1.5;
    margin-bottom: 8px;
}

.km-notif-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.76rem;
    color: rgba(248, 250, 252, 0.62);
}

.km-notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(18, 25, 45, 0.98), rgba(32, 41, 62, 0.92));
    color: #f8fafc;
}

.km-notif-head strong {
    font-size: 0.94rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.km-notif-list {
    padding: 10px;
    overflow-y: auto;
    display: grid;
    gap: 12px;
    max-height: calc(80vh - 80px);
}

.km-notif-skeleton {
    display: grid;
    gap: 8px;
}

.km-ripple {
    position: relative;
    overflow: hidden;
}

.km-ripple::after {
    content: '';
    position: absolute;
    left: var(--km-ripple-x, 50%);
    top: var(--km-ripple-y, 50%);
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%) scale(0);
    border-radius: 999px;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

.km-ripple.is-animating::after {
    animation: kmRipple 0.55s ease-out;
}

@keyframes kmRipple {
    from { transform: translate(-50%, -50%) scale(0); opacity: 0.5; }
    to { transform: translate(-50%, -50%) scale(18); opacity: 0; }
}

.km-stagger {
    opacity: 0;
    transform: translateY(8px);
    animation: kmFadeUp 0.4s ease forwards;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    color: #e2e8f0;
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-danger,
[data-theme="dark"] .btn-outline-info {
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.35);
}

.km-bottom-nav .nav-wrap {
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.km-tab {
    text-decoration: none;
    color: var(--km-text-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 8px;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.km-tab i {
    font-size: 1rem;
}

.km-tab.active {
    color: var(--km-primary);
}

.km-tab.active i {
    text-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
}

@keyframes kmFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes kmSkeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@media (min-width: 768px) {
    .km-page {
        padding: 24px 20px 40px;
    }
}

/* Sidebar Styles */
.km-sidebar {
    display: none;
    width: 260px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: color-mix(in srgb, var(--km-bg) 95%, transparent);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--km-border);
    flex-direction: column;
    padding: 24px 18px;
    z-index: 1035;
    overflow-y: auto;
}

.km-sidebar-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--km-border);
}

.km-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: var(--km-bg-soft);
    border: 1px solid var(--km-border);
    margin-bottom: 24px;
}

.km-sidebar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--km-gradient);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.km-sidebar-user-meta {
    flex: 1;
    min-width: 0;
}

.km-sidebar-username {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--km-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.km-sidebar-balance {
    font-size: 0.76rem;
    margin-top: 2px;
    color: var(--km-text-soft);
}

.km-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.km-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--km-text-soft);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background 0.22s ease, color 0.22s ease;
}

.km-sidebar-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.km-sidebar-link:hover {
    background: var(--km-bg-soft);
    color: var(--km-text);
}

.km-sidebar-link.active {
    background: var(--km-bg-soft);
    color: var(--km-primary);
    border: 1px solid var(--km-border);
}

.km-sidebar-divider {
    margin: 12px 0;
    border-color: var(--km-border);
    opacity: 0.5;
}

@media (min-width: 992px) {
    .km-sidebar {
        display: flex;
    }
    
    .km-page {
        margin-left: 260px;
        padding-left: 30px;
        padding-right: 30px;
    }
    
    .km-topbar {
        margin-left: 260px;
    }
    
    .km-topbar .km-logo {
        display: none;
    }
}
