:root {
    --brand-50: 255 245 245;
    --brand-100: 253 225 225;
    --brand-400: 229 80 80;
    --brand-500: 187 18 38;
    --brand-600: 153 14 30;
    --brand-800: 89 6 15;
    --brand-900: 52 3 9;

    --primary-red: #b11226;
    --primary-red-dark: #7a0b16;
    --surface-white: #ffffff;
    --surface-wash: #f6f6f6;
    --surface-gray: #e1e1e1;
    --ink: #050505;
    --charcoal: #1a1a1a;
    --graphite: #2f3033;
    --steel: #4d515a;
    --muted-gray: #8a8d95;

    --nav-sidebar-width: 16rem; /* matches md:w-64 on #sidebar */
    --header-height: 4rem;      /* matches h-16 on header */
    --search-bar-height: 62px;  /* height of .global-search-fixed bar */
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

/* Branches watermark scrollbar - more visible */
#branches-watermark::-webkit-scrollbar {
    width: 8px;
}

#branches-watermark::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    border-radius: 4px;
}

#branches-watermark::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 4px;
}

#branches-watermark::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.8);
}

/* Tenant selector modal scrollbar */
#tenant-selector .overflow-y-auto::-webkit-scrollbar {
    width: 10px;
}

#tenant-selector .overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#tenant-selector .overflow-y-auto::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

#tenant-selector .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: var(--primary-red-dark);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseSlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; transform: scale(1.02); }
}

.animate-pulse-slow {
    animation: pulseSlow 3s infinite;
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

.animate-scale-up {
    animation: scaleUp 0.3s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.group-item:hover i {
    transform: scale(1.2);
    transition: transform 0.2s;
}

#ad-modal, #ad-wizard-modal, #invoice-modal, #pay-modal {
    transition: opacity 0.3s ease;
}

#app-container {
    background-image: radial-gradient(circle at 10% 20%, rgb(248, 250, 252) 0%, rgb(241, 245, 249) 90%);
}

@media (max-width: 768px) {
    .custom-scrollbar::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Tooltip styling */
.tooltip {
    position: relative;
}
.tooltip:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--charcoal);
    color: var(--surface-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 50;
    margin-bottom: 5px;
}

.help-guide-container {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;
    pointer-events: none;
}

.help-guide-button {
    pointer-events: auto;
    position: fixed;
    top: 64px;
    left: 20px;
    padding: 6px 10px;
    min-width: 92px;
    border-radius: 12px;
    border: 2px solid #dc2626;
    background: #ffffff;
    color: #b91c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.2px;
    text-align: center;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.help-guide-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
    border-color: #b91c1c;
}

.help-guide-button:active {
    transform: translateY(0);
}

.help-guide-button::after {
    content: none;
}

.help-guide-backdrop {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 110;
    border: none;
}

.help-guide-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.help-guide-panel {
    pointer-events: auto;
    position: fixed;
    top: 128px;
    left: 16px;
    width: min(320px, calc(100vw - 32px));
    max-height: calc(100vh - 160px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    transform: translateX(-12px) scale(0.98);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 130;
}

.help-guide-panel.is-open {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.help-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(120deg, #fee2e2, #fff7ed);
    color: #7f1d1d;
}

.help-guide-header h3 {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
}

.help-guide-close {
    background: transparent;
    border: none;
    color: #7f1d1d;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.help-guide-close:hover {
    background: rgba(248, 113, 113, 0.2);
    transform: rotate(8deg);
}

.help-guide-body {
    padding: 16px;
    overflow-y: auto;
}

.help-guide-description {
    margin: 0 0 12px;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.help-guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.help-guide-list li {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    color: #0f172a;
    font-weight: 600;
}

@media (max-width: 640px) {
    .help-guide-button {
        top: 60px;
        left: 12px;
        min-width: 86px;
        padding: 5px 9px;
        font-size: 10px;
    }

    .help-guide-panel {
        top: 112px;
        left: 12px;
        width: min(300px, calc(100vw - 24px));
    }
}

/* Sidebar: position fixed, starts from the very top, full viewport height */
@media (min-width: 768px) {
    #sidebar {
        position: fixed;
        top: 0;        /* no gap — sidebar touches the top of the screen */
        right: 0;
        height: 100vh; /* full viewport height */
    }

    /* Reserve space on the right so content does not slide under the sidebar */
    #app-container {
        padding-right: var(--nav-sidebar-width);
    }

    /* ID+element specificity (1,0,1) beats Tailwind class selectors (0,1,0).
       Keeps the header visually above the sidebar (z-50) at all times. */
    #app-container header {
        position: relative;
        z-index: 60;
    }
}
