/* HIIVO TECH ownership theme. Status colors are intentionally independent. */
:root, html[data-theme="light"], html[data-theme="dark"] {
    --hiivo-primary: #0659EF;
    --hiivo-dark: #09225A;
    --hiivo-white: #FFFFFF;
    --hiivo-black: #000000;
    --primary: #0659EF;
    --primary-hover: #09225A;
    --heading-color: #09225A;
    --link-color: #0659EF;
    --focus-color: #0659EF;
    /* Compatibility aliases for existing component styles. */
    --dms-red: #0659EF;
    --dms-red-2: #09225A;
    --dms-navy: #09225A;
    --dms-navy-2: #09225A;
    --dms-bg: #f7f7f7;
    --dms-surface: #fff;
    --dms-text: #222;
    --dms-muted: #666;
    --dms-border: #e5e5e5;
    --dms-shadow: 0 14px 35px rgba(0,0,0,.08);
    --bs-primary: #0659EF;
    --bs-primary-rgb: 6, 89, 239;
    --bs-link-color: #0659EF;
    --bs-link-color-rgb: 6, 89, 239;
    --bs-link-hover-color: #09225A;
    --bs-link-hover-color-rgb: 9, 34, 90;
    --bs-primary-text-emphasis: #09225A;
    --bs-primary-bg-subtle: rgba(6,89,239,.08);
    --bs-primary-border-subtle: rgba(6,89,239,.25);
    --bs-focus-ring-color: rgba(6,89,239,.25);
    /* Django admin */
    --secondary: #09225A;
    --accent: #fff;
    --header-bg: #09225A;
    --header-color: #fff;
    --header-branding-color: #fff;
    --link-fg: #0659EF;
    --link-hover-color: #09225A;
    --button-bg: #0659EF;
    --button-hover-bg: #09225A;
    --default-button-bg: #0659EF;
    --default-button-hover-bg: #09225A;
    --selected-bg: rgba(6,89,239,.08);
    --selected-row: rgba(6,89,239,.08);
}
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #0659EF;
    --bs-btn-border-color: #0659EF;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #09225A;
    --bs-btn-hover-border-color: #09225A;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #09225A;
    --bs-btn-active-border-color: #09225A;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #0659EF;
    --bs-btn-disabled-border-color: #0659EF;
    --bs-btn-focus-shadow-rgb: 6,89,239;
}
.btn-outline-primary {
    --bs-btn-color: #0659EF;
    --bs-btn-border-color: #0659EF;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #09225A;
    --bs-btn-hover-border-color: #09225A;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0659EF;
    --bs-btn-active-border-color: #0659EF;
    --bs-btn-disabled-color: #0659EF;
    --bs-btn-disabled-border-color: #0659EF;
    --bs-btn-focus-shadow-rgb: 6,89,239;
}
.form-control:focus, .form-select:focus, .form-check-input:focus,
.ts-wrapper.focus .ts-control {
    border-color: #0659EF;
    box-shadow: 0 0 0 .2rem rgba(6,89,239,.2);
}
.form-check-input:checked, .dropdown-item.active, .dropdown-item:active,
.nav-pills .nav-link.active { background-color: #0659EF; border-color: #0659EF; color: #fff; }
.pagination { --bs-pagination-color:#0659EF; --bs-pagination-hover-color:#09225A; --bs-pagination-active-bg:#0659EF; --bs-pagination-active-border-color:#0659EF; }
.nav-tabs { --bs-nav-tabs-link-active-color:#0659EF; }
.accordion { --bs-accordion-active-color:#09225A; --bs-accordion-active-bg:rgba(6,89,239,.08); --bs-accordion-btn-focus-box-shadow:0 0 0 .2rem rgba(6,89,239,.2); }
.module-header-info h1, .module-title, .brand-title, .home-hero h1,
.portal-title, .settings-info-tile strong, .modal-title { color:#09225A; }
.dms-navbar .nav-link { color:#09225A; }
.dms-navbar .nav-link:hover, .dms-navbar .nav-link.active { color:#0659EF; }
.portal-card, .dms-portal-badge { --portal-color:#0659EF !important; }
.module-card { background-color:#fff; }
.module-card:hover, .module-card.active { border-color:#0659EF; }
.hiivo-product-mark { display:inline-flex; align-items:center; justify-content:center; width:100%; height:100%; color:#0659EF; font:bold 13px Arial,sans-serif; letter-spacing:-.5px; }
.hiivo-footer { background:#fff; border-top:1px solid #e5e5e5; color:#555; font:12px/1.6 Arial,sans-serif; padding:14px 16px; text-align:center; flex-shrink:0; }
.hiivo-footer a, .hiivo-ownership a { color:#0659EF; }
.hiivo-footer a:hover, .hiivo-ownership a:hover { color:#09225A; }
.hiivo-footer-print { display:none; }
.hiivo-footer { position:relative; }
.hiivo-footer-install { position:absolute; right:16px; top:50%; transform:translateY(-50%); display:flex; align-items:center; gap:8px; }
@media (max-width: 767.98px) { .hiivo-footer-install { position:static; transform:none; margin-top:8px; justify-content:center; } }
.hiivo-install-btn { align-items:center; background:#0659EF; border:0; border-radius:999px; box-shadow:0 4px 12px rgba(6,89,239,.3); color:#fff; cursor:pointer; display:inline-flex; font:600 12px/1 Arial,sans-serif; height:34px; justify-content:center; min-width:34px; overflow:hidden; padding:0 10px; transition:background .25s ease, box-shadow .25s ease, padding .3s ease; white-space:nowrap; }
.hiivo-install-btn i { font-size:14px; }
.hiivo-install-label { display:inline-block; max-width:0; opacity:0; transition:max-width .35s ease, opacity .25s ease, margin-left .35s ease; }
.hiivo-install-btn:hover, .hiivo-install-btn:focus-visible { background:#09225A; box-shadow:0 6px 16px rgba(9,34,90,.35); padding:0 14px; }
.hiivo-install-btn:hover .hiivo-install-label, .hiivo-install-btn:focus-visible .hiivo-install-label { margin-left:7px; max-width:120px; opacity:1; }
.hiivo-install-btn:hover i { animation:hiivoInstallBounce .6s ease; }
@keyframes hiivoInstallBounce { 0%,100% { transform:translateY(0); } 40% { transform:translateY(3px); } 70% { transform:translateY(-1px); } }
.hiivo-install-btn[hidden], .hiivo-install-btn.d-none { display:none; }
/* Footer "AI Assistant" popup */
.hiivo-ai-btn[aria-expanded="true"] { background:#09225A; }
.hiivo-ai-popup { background:#fff; border:1px solid #dfe5f2; border-radius:16px; bottom:76px; box-shadow:0 18px 48px rgba(9,34,90,.28); display:flex; flex-direction:column; height:min(640px, calc(100vh - 110px)); opacity:0; overflow:hidden; position:fixed; right:18px; transform:translateY(12px) scale(.98); transform-origin:bottom right; transition:opacity .2s ease, transform .2s ease; width:min(440px, calc(100vw - 36px)); z-index:1990; }
.hiivo-ai-popup.is-open { opacity:1; transform:none; }
.hiivo-ai-popup[hidden] { display:none; }
.hiivo-ai-popup-head { align-items:center; background:linear-gradient(135deg, #09225A, #0659EF); color:#fff; display:flex; gap:4px; padding:10px 10px 10px 16px; }
.hiivo-ai-popup-title { flex:1; font:700 14px/1.2 Arial,sans-serif; }
.hiivo-ai-popup-title i { margin-right:6px; }
.hiivo-ai-popup-action { align-items:center; background:transparent; border:0; border-radius:8px; color:#fff; cursor:pointer; display:inline-flex; font-size:14px; height:30px; justify-content:center; text-decoration:none; width:30px; }
.hiivo-ai-popup-action:hover, .hiivo-ai-popup-action:focus-visible { background:rgba(255,255,255,.18); color:#fff; }
.hiivo-ai-popup-frame { border:0; flex:1; width:100%; }
@media (max-width: 575.98px) { .hiivo-ai-popup { border-radius:0; bottom:0; height:100%; right:0; width:100%; } }
.hiivo-ownership { background:#fff; border:1px solid #e5e5e5; border-radius:12px; padding:16px 20px; color:#222; }
.hiivo-ownership strong { color:#09225A; }
.hiivo-ownership p { margin:4px 0; }
@media print {
    /* Credit lines sit outside the printed sheet and spill onto an extra
       blank page, so they are screen-only. */
    .hiivo-footer, .hiivo-document-credit, .hiivo-ai-popup { display:none !important; }
}
/* HIIVO TECH branding; module icons retain their original category colors. */
.command-hero, .crm-hero, .directory-strip { background:#09225A; color:#fff; }
.command-btn-primary, .btn-login { background:#0659EF; color:#fff; }
.command-btn-primary:hover, .btn-login:hover { background:#09225A; color:#fff; filter:none; }
.home-hero, .portal-select-page { background-color:#f7f7f7; }
.btn-primary:focus-visible, .btn-outline-primary:focus-visible { box-shadow:0 0 0 .2rem rgba(6,89,239,.25); }
.login-brand-footer, .login-brand-footer i { color:rgba(255,255,255,.85); font-size:.75rem; }
.login-foot-note, .portal-foot-note { color:#555; font-size:.75rem; }
.login-form-panel h1, .login-form-panel h2, .portal-header h1 { color:#09225A; }
.btn-verify { background:#0659EF; }
.btn-verify:hover { background:#09225A; filter:none; }
.login-brand .login-brand-footer { color:rgba(255,255,255,.85); font-size:.75rem; }
.portal-select-page .portal-foot-note { color:#555; font-size:.75rem; }

/* Keep ownership at the viewport bottom on short pages, after content on long ones. */
@media screen {
    body.hiivo-portal-layout {
        display:flex;
        flex-direction:column;
        min-height:100vh;
        min-height:100dvh;
    }
    body.hiivo-portal-layout > main { flex:1 0 auto; }
    body.hiivo-portal-layout.wa-page > main { flex:1 1 auto; }
    body.hiivo-portal-layout > .hiivo-footer { margin-top:auto; }
}

/* Shared branded portal headers. */
    .home-hero.hiivo-portal-hero {
        display:grid;
        grid-template-columns:minmax(0, 1fr) auto;
        align-items:center;
        gap:24px;
        padding:26px 30px;
        background:#fff;
    }
    .hiivo-portal-hero .hiivo-portal-brand { gap:24px; align-items:center; }
    .hiivo-portal-hero .home-hero-mark.hiivo-owner-logo {
        width:200px; height:auto; padding:12px 24px 12px 0;
        background:transparent; border:0; border-right:1px solid #e5e5e5;
        border-radius:0; box-shadow:none;
    }
    .hiivo-portal-hero .hiivo-owner-logo img { display:block; width:100%; height:auto; }
    .hiivo-portal-copy { min-width:0; }
    .hiivo-portal-hero .section-kicker { font-size:.72rem; letter-spacing:.06em; margin-bottom:6px!important; }
    .hiivo-portal-hero h1 { font-size:1.9rem; line-height:1.15; }
    .hiivo-portal-owner { color:#666; font-size:.78rem; margin:5px 0 0; }
    .hiivo-portal-hero .home-hero-subtitle { font-size:.88rem; line-height:1.5; margin-top:10px; }
    .hiivo-portal-hero .home-hero-meta { gap:12px; min-width:0; }
    .hiivo-portal-hero .home-hero-chips { flex-wrap:wrap; justify-content:flex-end; }
    @media (max-width:1100px) {
        .home-hero.hiivo-portal-hero { grid-template-columns:minmax(0, 1fr); gap:20px; }
        .hiivo-portal-hero .home-hero-meta { flex-direction:row; flex-wrap:wrap; align-items:center; justify-content:space-between; border-top:1px solid #eee; padding-top:16px; }
        .hiivo-portal-hero .home-hero-chips { justify-content:flex-start; }
    }
    @media (max-width:575px) {
        .home-hero.hiivo-portal-hero { padding:22px 20px; }
        .hiivo-portal-hero .hiivo-portal-brand { flex-direction:column; align-items:flex-start; gap:18px; }
        .hiivo-portal-hero .home-hero-mark.hiivo-owner-logo { width:170px; padding:0; border:0; }
        .hiivo-portal-hero h1 { font-size:1.65rem; }
        .hiivo-portal-hero .home-branch-chip { white-space:normal; overflow-wrap:anywhere; }
    }
