:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 60px;
    --color-bg: #f5f6f8;
    --color-sidebar-bg: #1f2937;
    --color-sidebar-text: #d1d5db;
    --color-accent: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.app-sidebar__logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px 0 16px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__brand {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__toggle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--color-sidebar-text);
    cursor: pointer;
}

.app-sidebar__toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.app-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.app-nav__group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 12px 16px 4px;
}

.app-nav__item {
    padding: 10px 16px;
    color: var(--color-sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}

/* Kotak ikon berukuran tetap agar semua nama menu sejajar walau lebar ikon Font Awesome berbeda-beda. */
.app-nav__icon {
    flex-shrink: 0;
    width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.app-nav__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar tertutup (class .sidebar-collapsed di <html>, diatur JS di App.razor): hanya ikon; judul grup diganti garis pemisah. */
.sidebar-collapsed .app-shell {
    --sidebar-width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .app-sidebar__brand,
.sidebar-collapsed .app-nav__label {
    display: none;
}

.sidebar-collapsed .app-sidebar__logo {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .app-nav__item {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-collapsed .app-nav__group-label {
    height: 0;
    margin: 8px 14px;
    padding: 0;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.app-nav__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.app-nav__item.active {
    background: var(--color-accent);
    color: #fff;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.app-topbar__spacer {
    flex: 1;
}

.app-topbar__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Menu Pengguna di topbar (dropdown memakai <details>, tanpa JavaScript) */
.app-user-menu {
    position: relative;
}

.app-user-menu__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.app-user-menu__toggle::-webkit-details-marker {
    display: none;
}

.app-user-menu__toggle:hover {
    background: #f3f4f6;
}

.app-user-menu__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
}

.app-user-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    overflow: hidden;
}

.app-user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: inherit;
    text-align: left;
    text-decoration: none;
}

.app-user-menu__item:hover {
    background: #f3f4f6;
}

/* Halaman login, setup, dan ganti password */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #fff;
    font-size: 22px;
}

.app-content {
    padding: 24px;
    overflow-y: auto;
}

/* Grafik tren bulanan (Income/Expense Summary) */
.trend-chart {
    display: flex;
    align-items: stretch;
    gap: 6px;
    height: 160px;
}

.trend-chart__bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.trend-chart__track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.trend-chart__fill {
    width: 100%;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    opacity: 0.35;
}

.trend-chart__bar:hover .trend-chart__fill,
.trend-chart__bar.is-selected .trend-chart__fill {
    opacity: 1;
}

.trend-chart__label {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
}

.trend-chart__bar.is-selected .trend-chart__label {
    font-weight: 700;
    color: #111827;
}
