:root {
    --nav-bg: #101828;
    --nav-bg-alt: #111827;
    --nav-fg: #e5e7eb;
    --nav-fg-muted: #9ca3af;
    --nav-accent: #22c5b8;
    --nav-border: #1f2933;

    --page-bg: #f4f5fb;
    --card-bg: #ffffff;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page-bg);
    color: #111827;
}

/* === Shell layout (sidebar + main) === */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--page-bg);
}

.app-sidebar {
    width: 260px;
    background: var(--nav-bg);
    color: var(--nav-fg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--nav-border);
    transition: width 0.18s ease;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* === Sidebar header (logo + toggle) === */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px 14px 14px;
    border-bottom: 1px solid #111827;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 8px;
}

/* Full vs mini brand (controlled by collapsed state) */
.brand-full {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.brand-mini {
    display: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--nav-accent);
    color: #0b1120;
    font-weight: 700;
    font-size: 0.9rem;
}

.brand-text {
    font-weight: 600;
    letter-spacing: 0.04em;
    font-size: 0.95rem;
}

.sidebar-toggle {
    border: none;
    background: transparent;
    color: var(--nav-fg-muted);
    cursor: pointer;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--nav-fg);
}

/* === Menu === */
.sidebar-menu {
    flex: 1;
    padding: 8px 6px 8px 6px;
    overflow-y: auto;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item + .menu-item {
    margin-top: 2px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--nav-fg-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-link:hover {
    background: var(--nav-bg-alt);
    color: var(--nav-fg);
}

.menu-link.is-active {
    background: rgba(34, 197, 184, 0.14);
    color: #e5f4ff;
}

.menu-icon {
    width: 24px;
    text-align: center;
    font-size: 1rem;
}

.menu-label {
    white-space: nowrap;
}

/* === Sidebar footer / user slide-up === */
.sidebar-footer {
    padding: 10px 10px 12px;
    border-top: 1px solid #111827;
    position: relative; /* anchor for the slide-up */
}

.sidebar-user-area {
    position: relative;
}

/* Base pill (avatar + name) */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0; /* remove button default margin */
}

/* Make it look nothing like a default button */
.user-pill--button {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px 4px;
    cursor: pointer;
    text-align: left;
    color: inherit;
    border-radius: 8px;
}

.user-pill--button:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Avatar + text */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e5e7eb;
}

.user-avatar--small {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.user-info {
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e5e7eb;
}

.user-role {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Slide-up panel */
.user-menu-panel {
    position: absolute;
    right: 0;
    bottom: 44px; /* sits just above the footer pill */
    width: 220px;
    background: #111827;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    padding: 8px 8px 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition:
        opacity 0.16s ease-out,
        transform 0.16s ease-out;
    z-index: 20;
}

/* open state */
.user-menu-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* little arrow */
.user-menu-panel::after {
    content: "";
    position: absolute;
    bottom: -6px;
    right: 16px;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #111827 transparent transparent transparent;
}

/* header inside menu */
.user-menu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

.user-menu-info {
    min-width: 0;
}

.user-menu-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #f9fafb;
}

.user-menu-email {
    font-size: 0.72rem;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* logout item */
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px;
    margin-top: 4px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.84rem;
    color: #e5e7eb;
}

.user-menu-item:hover {
    background: rgba(34, 197, 184, 0.16);
    color: #f9fafb;
}

.user-menu-icon {
    width: 20px;
    text-align: center;
}

.user-menu-label {
    white-space: nowrap;
}

/* === Topbar + content === */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
}

.topbar-left {
    font-size: 0.9rem;
    color: #6b7280;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user {
    font-size: 0.9rem;
    color: #4b5563;
}

.app-content {
    padding: 16px 18px 24px;
}

/* === Collapsed sidebar state (ABP-style mini) === */
.layout--sidebar-collapsed .app-sidebar {
    width: 72px;
}

/* hide name/email/text when collapsed */
.layout--sidebar-collapsed .user-info {
    display: none;
}

/* center avatar when collapsed */
.layout--sidebar-collapsed .user-pill {
    justify-content: center;
}

/* keep the panel aligned to the mini avatar in collapsed mode too */
.layout--sidebar-collapsed .user-menu-panel {
    left: 8px;
    right: auto;
}

/* Center icons when collapsed */
.layout--sidebar-collapsed .menu-link {
    justify-content: center;
    padding-inline: 8px;
}

.layout--sidebar-collapsed .menu-label {
    display: none;
}

/* Logo swap when collapsed */
.layout--sidebar-collapsed .brand-full {
    display: none;
}

.layout--sidebar-collapsed .brand-mini {
    display: inline-flex;
}

.layout--sidebar-collapsed .user-menu-panel::after {
    right: auto;
    left: 28px; /* tweak this if needed to line up under the avatar */
}

/* === Simple card styles for dashboard etc. === */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 6px;
}

.dash-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.btn-add-widget {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: var(--nav-accent);
    color: #0b1120;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.btn-add-widget__icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-add-widget:hover {
    background: #1db1a6;
}

.btn-add-widget:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}


.receipt-compact * {
    line-height: 1.2 !important;
}
.nav-tabs .nav-link {
    padding: 3px 8px !important;
}
.tab-content > .tab-pane {
    padding: 4px 4px !important;
}
.table-sm > :not(caption) > * > * {
    padding: 0.2rem 0.35rem !important;
}
hr.my-2 {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
}
