:root {
    --color-primary: #1a99fc;
    --color-primary-dark: #0d7fd4;
    --color-text-dark: #404040;
    --color-text-muted: gray;
    --font-main: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
}

/* Single scroll region in base.html — block horizontal rubber-banding / white gutters */
#maincontainer {
    overflow-x: hidden;
    max-width: 100%;
    overscroll-behavior-x: none;
    overflow-anchor: none;
}

/* Mobile: sticky-top fails when body overflow is hidden — pin navbar like iQ */
@media (max-width: 767.98px) {
    .d-flex.flex-column.vh-100 > .navbar.sticky-top {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        width: 100%;
    }
    #maincontainer {
        padding-top: calc(3.5rem + env(safe-area-inset-top, 0px));
    }
}

.navbar-toggler-icon {
    color: lightgray !important;
}

.fade-in {
    opacity: 0.00;
    transition: 1.5s all ease-in-out;
}

@keyframes bi-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.bi-spin {
    display: inline-block;
    animation: bi-spin 1s linear infinite;
}

.fade-in.active {
    opacity: 1.00;
}

/* Quill editor toolbar icons on dark backgrounds */
.ql-toolbar .ql-stroke {
    fill: none;
    stroke: #fff;
}

.ql-toolbar .ql-fill {
    fill: #fff;
    stroke: none;
}

.ql-toolbar .ql-picker {
    color: #fff;
}

.ql-editor p {
    color: var(--color-text-dark);
}

#post-panel .ql-editor p,
#posteditorcontainer .ql-editor p {
    margin-bottom: 0.75rem;
}
#post-panel .ql-editor p:last-child,
#posteditorcontainer .ql-editor p:last-child {
    margin-bottom: 0;
}
#post-panel .ql-editor h5,
#posteditorcontainer .ql-editor h5 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.message_holder [id^="postbody"],
.message_holder [id^="postbody"] p,
.message_holder [id^="postbody"] h5,
.message_holder [id^="postbody"] li,
.message_holder [id^="postbodycollapse"],
.message_holder [id^="postbodycollapse"] p {
    color: inherit;
}
.message_holder [id^="postbody"] p,
.message_holder [id^="postbodycollapse"] p {
    margin-bottom: 0.75rem;
}
.message_holder [id^="postbody"] p:last-child,
.message_holder [id^="postbodycollapse"] p:last-child {
    margin-bottom: 0;
}
.message_holder [id^="postbody"] h5 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Post panel — Publish / Attach / Reset action row (iQ + Post Manager) */
.post-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.post-form-actions-reset {
    margin-left: auto;
}

/* iQ — mobile toolbar: back, provider menu, Post button (single row) */
.iq-mob-toolbar {
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}
@media (max-width: 767.98px) {
    /* Fixed below navbar; spacer reserves flow space so posts are not covered */
    .iq-mob-toolbar {
        position: fixed;
        left: 0;
        right: 0;
        top: calc(3.5rem + env(safe-area-inset-top, 0px));
        z-index: 1020;
        background-color: #212529;
    }
    .iq-mob-toolbar-spacer {
        height: 2.75rem;
        flex-shrink: 0;
    }
    /* Small buffer so first card top border clears the fixed toolbar bottom edge */
    .message_holder {
        padding-top: 4px;
    }
    .message_holder > [id^="card"] {
        scroll-margin-top: calc(3.5rem + 2.75rem + 4px + env(safe-area-inset-top, 0px));
    }
}

.message_holder > [id^="card"] + [id^="card"] {
    margin-top: 5px;
}
.iq-mob-toolbar .link_back,
.iq-mob-toolbar #show_menu_mob_link {
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.iq-mob-toolbar #btn-toggle-post-panel-mob {
    width: auto;
    white-space: nowrap;
}
@media (max-width: 767.98px) {
    #section-right.iq-mob-post-open {
        display: block !important;
    }
    #section-right.iq-mob-post-open #post-panel {
        visibility: visible;
    }
    #section-right .text-end {
        display: none !important;
    }
    body.iq-mob-post-panel-open .page-footer {
        display: none;
    }
}

/* Post Manager — lock to viewport width on mobile (match iQ scroll behaviour) */
.postmanager-page {
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}
.postmanager-page .card,
.postmanager-page .form-control,
.postmanager-page .form-select {
    max-width: 100%;
}
#posteditorcontainer {
    max-width: 100%;
    overflow: hidden;
}
#posteditorcontainer .ql-toolbar.ql-snow {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
#posteditorcontainer #posteditor,
#posteditorcontainer .ql-container.ql-snow {
    max-width: 100%;
    box-sizing: border-box;
}
.post-texttype-row .form-check {
    min-height: 1.5rem;
    padding-left: 1.75em;
}
.post-texttype-row .form-check-label {
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .postmanager-page .post-form-actions-reset {
        margin-left: 0;
    }
    .posttime-clear-row {
        grid-template-columns: 1fr;
    }
    .posttime-clear-row .btn {
        width: 100%;
    }
}

/* Post Manager — post time field + clear button (grid stretches both to same row height) */
.posttime-clear-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: stretch;
}
.posttime-clear-row .posttime-field {
    min-width: 0;
}
.posttime-clear-row .form-control,
.posttime-clear-row .flatpickr-input {
    width: 100%;
    min-width: 0;
    margin: 0;
}
.posttime-clear-row .flatpickr-wrapper {
    width: 100%;
}
.posttime-clear-row .flatpickr-day.selected,
.posttime-clear-row .flatpickr-day.startRange,
.posttime-clear-row .flatpickr-day.endRange {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.posttime-clear-row .flatpickr-day.selected:hover,
.posttime-clear-row .flatpickr-day.startRange:hover,
.posttime-clear-row .flatpickr-day.endRange:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}
.posttime-clear-row .btn {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    margin: 0;
    line-height: 1;
    white-space: nowrap;
}

/* iQ + Post Manager — Quill must not use .form-control (breaks placeholder vs caret alignment) */
#post-panel .ql-toolbar.ql-snow,
#posteditorcontainer .ql-toolbar.ql-snow {
    border: 1px solid #6c757d;
    border-bottom: 0;
    background: #343a40;
}
#post-panel .ql-toolbar.ql-snow .ql-stroke,
#posteditorcontainer .ql-toolbar.ql-snow .ql-stroke {
    fill: none;
    stroke: gray;
}
#post-panel .ql-toolbar.ql-snow .ql-fill,
#posteditorcontainer .ql-toolbar.ql-snow .ql-fill {
    fill: gray;
    stroke: none;
}
#post-panel .ql-toolbar.ql-snow .ql-picker,
#post-panel .ql-toolbar.ql-snow .ql-picker-label,
#posteditorcontainer .ql-toolbar.ql-snow .ql-picker,
#posteditorcontainer .ql-toolbar.ql-snow .ql-picker-label {
    color: gray;
}
#post-panel .ql-toolbar.ql-snow button:hover .ql-stroke,
#post-panel .ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke,
#posteditorcontainer .ql-toolbar.ql-snow button:hover .ql-stroke,
#posteditorcontainer .ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke {
    stroke: lightgray;
}
#post-panel .ql-toolbar.ql-snow button:hover .ql-fill,
#post-panel .ql-toolbar.ql-snow .ql-picker-label:hover .ql-fill,
#posteditorcontainer .ql-toolbar.ql-snow button:hover .ql-fill,
#posteditorcontainer .ql-toolbar.ql-snow .ql-picker-label:hover .ql-fill {
    fill: lightgray;
}
#post-panel .ql-toolbar.ql-snow button.ql-active .ql-stroke,
#posteditorcontainer .ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--color-primary);
}
#post-panel .ql-toolbar.ql-snow button.ql-active .ql-fill,
#posteditorcontainer .ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--color-primary);
}
#post-panel .ql-container.ql-snow,
#posteditorcontainer .ql-container.ql-snow {
    border: 1px solid #6c757d;
    font-size: 15px;
    font-family: var(--font-main);
    background: #fff;
}
#post-panel .ql-container.ql-snow {
    height: 300px;
}
#posteditorcontainer .ql-container.ql-snow {
    height: 500px;
}
#post-panel .ql-editor,
#posteditorcontainer .ql-editor {
    padding: 12px 15px;
    min-height: 100%;
}
#post-panel .ql-editor.ql-blank::before,
#posteditorcontainer .ql-editor.ql-blank::before {
    left: 15px;
    right: 15px;
    font-style: normal;
    color: #6c757d;
}

a, a:link, a:visited, a:active {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Clickable card/row that wraps mixed content (div, not anchor — avoids copy-paste as link) */
.link-expand {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.link-expand:hover {
    text-decoration: none;
}

/* Only actual links (e.g. Read more) dim on hover; div wrappers (whole post) do not */
a.link-expand:hover {
    filter: brightness(80%);
}

/* Scoped — only p and li INSIDE .link-expand, not all li globally */
.link-expand p,
.link-expand li {
    color: white;
}

/* Primary button uses brand colour; other variants (outline, danger, success,
   secondary) are left to Bootstrap so they render correctly */
.btn-primary {
    color: white !important;
    border-color: var(--color-primary);
    background-color: var(--color-primary);
}

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

.btn-outline-primary {
    color: var(--color-primary) !important;
    border-color: var(--color-primary);
    background-color: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: white !important;
    border-color: var(--color-primary);
    background-color: var(--color-primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    font-weight: normal;
}

i {
    color: var(--color-primary);
}

.lead {
    font-size: 18px;
    max-width: 500px;
}

.display-a {
    font-family: "Roboto", sans-serif;
    padding-top: 10px;
    padding-bottom: 30px;
    color: #ffffff;
}

.form-control {
    color: var(--color-text-dark);
    font-family: var(--font-main);
    margin-bottom: 10px;
}

.form-control:focus {
    color: var(--color-text-dark);
    border-color: var(--color-primary);
    box-shadow: none;
}

input[name='texttypeRadio'] {
    accent-color: var(--color-primary);
}

input[type='checkbox']:checked {
    accent-color: var(--color-primary);
}

.description1 {
    color: var(--color-text-muted);
    font-size: small;
    margin-left: 0px;
}

.description2 {
    color: var(--color-text-muted);
    font-size: small;
    margin-left: 10px;
}

.descriptionlink1 {
    color: var(--color-text-muted);
    font-size: small;
    text-decoration: none;
}

.descriptionlink1:hover {
    color: var(--color-text-muted);
    text-decoration: underline;
}

.descriptionmodal1 {
    color: var(--color-text-muted);
}

/* Shared app modal (#iModal) — Bootstrap 5 close control + header layout */
#iModal .modal-header {
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
#iModal .modal-title {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    padding-right: 0.5rem;
}
#iModal .btn-close {
    margin: 0;
    padding: 0.625rem;
    opacity: 0.55;
}
#iModal .btn-close:hover,
#iModal .btn-close:focus {
    opacity: 0.85;
    box-shadow: none;
}
#iModal .modal-body {
    padding: 1rem 1.25rem;
}
#iModal .modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.sessionlabel {
    background-color: var(--color-primary);
    color: white;
    font-size: x-small;
    white-space: pre-wrap;
    padding-left: 2px;
    padding-right: 2px;
}

.sessiontext1 {
    color: var(--color-primary);
    font-size: smaller;
    font-weight: bold;
}

.sessiontext2 {
    color: var(--color-primary);
    font-size: medium;
    font-weight: 600;
}

.sessiontext3 {
    color: var(--color-primary);
    font-size: smaller;
    font-weight: normal;
}

.spacer20 {
    margin-top: 20px;
}

.sidemenu1 {
    color: var(--color-primary);
}

.listitem1 {
    color: var(--color-text-muted);
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.myaccount p,
.myaccount li {
    color: var(--color-text-muted);
}

.userguide p,
.userguide li {
    color: white;
}

.myproviders li {
    color: var(--color-primary);
}

.myproviders a:hover {
    text-decoration: none;
}

/* ------------------------------------------------------------------
   Utility classes — replace repeated inline styles across templates
   ------------------------------------------------------------------ */

/* Page backgrounds */
.bg-page       { background-color: #dedede; }
.bg-page-light { background-color: #ececec; }

/* Brand colours */
.text-brand        { color: var(--color-primary) !important; }
.text-brand-500    { color: var(--color-primary); font-weight: 500; }
.text-brand-normal { color: var(--color-primary); font-weight: 400; }
.text-dark-body    { color: var(--color-text-dark); }
.bg-brand          { background-color: var(--color-primary); color: white; }

/* Large section icon (icon displayed above a section heading) */
.section-icon {
    font-size: x-large;
    margin-bottom: 10px;
    color: var(--color-primary);
}

/* Typography */
.pre-wrap { white-space: pre-wrap; }

/* Flash / alert card */
.flash-card {
    background-color: #dedede;
    border-color: darkgray;
}

/* Repeated icon positioning patterns */
.icon-toggle { margin-left: 10px; padding-top: 5px; }
.icon-info   { margin-left: 10px; }

/* Nested provider/topic menu indentation */
.menu-indent-1 { padding-left: 25px; margin-top: 5px; }
.menu-indent-2 { padding-left: 15px; padding-bottom: 5px; }

/* Large bottom spacer used on scrollable content pages */
.page-scroll-spacer { padding-bottom: 500px; }

/* Splash screen — shown once per tab/session via sessionStorage in base.html */
html.splash-seen #splash-screen { display: none; }
#splash-screen {
    position: fixed;
    inset: 0;
    background: #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: splash-out 0.4s ease 1s forwards;
}
#splash-screen img {
    width: min(240px, 55vw);
}
@keyframes splash-out {
    from { opacity: 1; }
    to   { opacity: 0; visibility: hidden; pointer-events: none; }
}