/* Mobile: avoid accidental horizontal scroll; allow flex children to shrink */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

.app-topbar .topbar-menu {
    min-width: 0;
}

.app-topbar .topbar-menu > .d-flex:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.app-topbar .topbar-menu > .d-flex:last-child {
    flex: 0 0 auto;
}

/* No notification item: hide divider that used to sit before the user menu. */
.app-topbar .nav-user::before {
    display: none;
}

/* Notched phones: keep topbar clear of the status area */
@supports (padding: max(0px)) {
    .app-topbar {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }
}

:root {
    --fcf-emerald: #10b981;
    --fcf-emerald-dark: #047857;
    --fcf-white: #ffffff;
    --fcf-text: #111827;
    --fcf-muted: #6b7280;
    --fcf-border: #e5e7eb;
}

html[data-menu-color="dark"] {
    /* Dark emerald gradient (top-left → bottom-right) */
    --theme-sidenav-bg: linear-gradient(
        155deg,
        #0f766e 0%,
        #047857 32%,
        #065f46 65%,
        #064e3b 88%,
        #022c22 100%
    );
    --theme-sidenav-border-color: #064e3b;
    --theme-sidenav-item-color: #ecfdf5;
    --theme-sidenav-item-hover-color: var(--fcf-white);
    --theme-sidenav-item-hover-bg: rgba(255, 255, 255, 0.12);
    --theme-sidenav-item-active-color: var(--fcf-white);
    --theme-sidenav-item-active-bg: rgba(255, 255, 255, 0.18);
}

/* Match product label to sidebar link / section title color (not Bootstrap text-muted). */
.sidenav-menu .fcf-sidenav-brand-label {
    color: var(--theme-sidenav-item-color, #e7fff6);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

/* Topbar: compact product name on small screens (full text from md up). */
.fcf-topbar-brand-mobile {
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Paces hides .logo-topbar entirely ≤375px — keep a small mark for brand recognition. */
@media (max-width: 375px) {
    html body .app-topbar .logo-topbar {
        display: block !important;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    html body .app-topbar .logo-topbar .logo-sm img {
        height: 20px !important;
        width: auto;
        max-width: 100%;
    }
}

/* Topbar logo: slightly smaller on narrow phones where only .logo-sm applies. */
@media (max-width: 575.98px) {
    .app-topbar .logo-topbar .logo-sm img {
        height: 22px;
        width: auto;
        max-width: min(120px, 28vw);
    }
}

/* Sidebar brand: 2× default logo dimensions on desktop; scale down on mobile/offcanvas. */
.sidenav-menu > a.logo .logo-lg img {
    height: calc(var(--theme-logo-lg-height, 22px) * 2);
    width: auto;
    max-width: 100%;
}

.sidenav-menu > a.logo .logo-sm img {
    height: calc(var(--theme-logo-sm-height, 26px) * 2);
    width: auto;
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .sidenav-menu > a.logo {
        line-height: 1.2;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .sidenav-menu > a.logo .logo-lg img {
        height: calc(var(--theme-logo-lg-height, 22px) * 1.2);
        max-height: 30px;
    }

    .sidenav-menu > a.logo .logo-sm img {
        height: calc(var(--theme-logo-sm-height, 26px) * 1.1);
        max-height: 28px;
    }

    .sidenav-menu .fcf-sidenav-brand-label {
        font-size: 0.65rem;
        letter-spacing: 0.06em;
    }

    .app-topbar .fcf-topbar-brand-mobile {
        font-size: 0.75rem;
    }
}

.side-nav .side-nav-link:hover {
    background-color: var(--theme-sidenav-item-hover-bg, var(--fcf-emerald-dark)) !important;
}

.side-nav > .side-nav-item.active > a {
    background-color: var(--theme-sidenav-item-active-bg, var(--fcf-emerald-dark)) !important;
}

.app-topbar .topbar-item .topbar-link:hover,
.app-topbar .topbar-item .topbar-link:focus {
    color: var(--fcf-emerald) !important;
}

.btn-primary {
    background-color: var(--fcf-emerald);
    border-color: var(--fcf-emerald);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--fcf-emerald-dark) !important;
    border-color: var(--fcf-emerald-dark) !important;
}

.card {
    border: 1px solid var(--fcf-border);
}

.table-hover tbody tr:hover {
    background-color: rgba(16, 185, 129, 0.08);
}

.fcf-gradient-header {
    background: linear-gradient(90deg, #10b981 0%, #047857 100%);
    border-bottom: 0;
}

.fcf-kpi-card {
    border-left: 4px solid #10b981;
}

.fcf-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
    margin-bottom: 8px;
}

/* Page title row: no background strip, border, or shadow (overrides Paces theme skins). */
.page-title-head {
    margin: 0 0 1rem 0;
    padding: 0.35rem 0;
    min-height: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.page-title-head::before,
.page-title-head::after {
    display: none !important;
    content: none !important;
}

.page-title-head .fcf-page-title-breadcrumb {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    text-align: end;
}

.page-title-head .breadcrumb {
    margin-bottom: 0 !important;
}

.page-title-head .fcf-page-title-text {
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    white-space: nowrap;
}

/* Card section titles: one line with ellipsis when space is tight. */
.card-header .card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.card-header.d-flex .card-title {
    flex: 1 1 auto;
    min-width: 0;
}

.card-body > h4.card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Paces/Bootstrap scrollable modal behavior for long forms. */
.modal-dialog.modal-dialog-scrollable {
    height: calc(100% - var(--bs-modal-margin) * 2);
}

.modal-dialog.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
}
