:root {
    --hb-primary: #0f6f5c;
    --hb-primary-dark: #0b5747;
    --hb-accent: #1d7ea8;
    --hb-bg: #f4f7f8;
    --hb-sidebar-bg: #103b34;
    --hb-sidebar-active: #0f6f5c;
    --hb-border: #e2e8ea;
    --hb-danger: #c0392b;
    --hb-warning: #b7791f;
    --hb-success: #1e8a5f;
}

body {
    background-color: var(--hb-bg);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 0.925rem;
    color: #1f2a2e;
}

/* ---- Layout ---- */
.hb-wrapper { display: flex; min-height: 100vh; }

.hb-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--hb-sidebar-bg);
    color: #d7e4e1;
    min-height: 100vh;
    position: sticky;
    top: 0;
}

/* The mobile off-canvas sidebar reuses .hb-sidebar for its visual styling, but it
   must never participate in the .hb-wrapper flex layout the way the static sidebar
   does. Because app.css loads after bootstrap.min.css, the plain .hb-sidebar rule
   above (position: sticky) would otherwise win over Bootstrap's .offcanvas rule
   (position: fixed) at equal specificity, leaving a phantom 240px column in the
   flex row even while the panel is hidden. This higher-specificity rule forces
   correct off-canvas behavior regardless of stylesheet order. */
.hb-sidebar.offcanvas {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
    min-height: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .3s ease-in-out, visibility .3s ease-in-out;
}
.hb-sidebar.offcanvas.show,
.hb-sidebar.offcanvas.showing {
    visibility: visible;
    transform: translateX(0);
}
.hb-sidebar .brand {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.hb-sidebar .nav-link {
    color: #b9cdc8;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.hb-sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.hb-sidebar .nav-link.active {
    background: rgba(255,255,255,0.09);
    color: #fff;
    border-left-color: #56c9a8;
    font-weight: 600;
}
.hb-sidebar .nav-section-title {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .06em;
    color: #7c9a92;
    padding: .9rem 1.1rem .25rem;
}

.hb-main { flex: 1; min-width: 0; }

.hb-topbar {
    background: #fff;
    border-bottom: 1px solid var(--hb-border);
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.hb-content { padding: 1.25rem; }

/* ---- Cards / KPIs ---- */
.kpi-card {
    background: #fff;
    border: 1px solid var(--hb-border);
    border-radius: .5rem;
    padding: 1rem 1.1rem;
}
.kpi-card .kpi-label { font-size: .78rem; color: #667379; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; color: #16302b; }
.kpi-card .kpi-icon {
    width: 40px; height: 40px; border-radius: .5rem;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15,111,92,0.1); color: var(--hb-primary);
    font-size: 1.15rem;
}

.card { border: 1px solid var(--hb-border); border-radius: .5rem; }
.card-header { background: #fbfcfc; border-bottom: 1px solid var(--hb-border); font-weight: 600; }

.table thead th {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #5c6b6f;
    border-bottom-width: 1px;
    background: #fbfcfc;
}
.table td, .table th { vertical-align: middle; }

.btn-primary { background-color: var(--hb-primary); border-color: var(--hb-primary); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--hb-primary-dark); border-color: var(--hb-primary-dark); }
.btn-outline-primary { color: var(--hb-primary); border-color: var(--hb-primary); }
.btn-outline-primary:hover { background-color: var(--hb-primary); border-color: var(--hb-primary); }

.badge-status-paid { background:#e3f6ee; color:#1e8a5f; }
.badge-status-pending { background:#fdf2e0; color:#b7791f; }
.badge-status-partial { background:#e6f0fb; color:#1d5fa8; }
.badge-status-cancelled { background:#fce9e7; color:#c0392b; }
.badge-status-refunded { background:#f1e9fb; color:#6c3fa8; }
.badge.badge-status-paid, .badge.badge-status-pending, .badge.badge-status-partial,
.badge.badge-status-cancelled, .badge.badge-status-refunded {
    font-weight: 600; font-size: .72rem; padding: .35em .6em;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hb-sidebar-bg), var(--hb-primary));
}
.login-card { background: #fff; border-radius: .6rem; padding: 2.25rem; width: 100%; max-width: 380px; }

@media print {
    .no-print { display: none !important; }
    .hb-wrapper { display: block; }
    .hb-content { padding: 0; }
}

.required-star::after { content: " *"; color: var(--hb-danger); }