/* Mobilize Cloud brand layer for the UBold theme (same approach as LLMs Ledger's brand-dashboard.css).
   Brand blue #148CCC (logo and estimate headings), ink #434343. Button blue is a shade darker for 4.5:1 contrast with white text. */
:root, [data-bs-theme=light] {
    --theme-primary: #0F74AA;
    --theme-primary-rgb: 15, 116, 170;
    --bs-primary: #0F74AA;
    --bs-primary-rgb: 15, 116, 170;
    --bs-link-color: #0F6FA3;
    --bs-link-color-rgb: 15, 111, 163;
    --bs-link-hover-color: #0B5279;
    --theme-link-color: #0F6FA3;
    --theme-link-hover-color: #0B5279;
    --portal-blue: #148CCC;
    --portal-ink: #434343;
    --bs-code-color: #0B5279;
    --theme-code-color: #0B5279;

    /* Semantic colors, remapped once (the theme's teal/coral/amber fail 4.5:1 and are off-brand).
       Status palette from the brief (#0ca30c / #fab219 / #d03b3b), darkened where it carries text. */
    --theme-success: #1a7f45; --theme-success-rgb: 26, 127, 69;
    --theme-success-text-emphasis: #0b6b32; --theme-success-bg-subtle: #e3f6ea; --theme-success-border-subtle: #b8e3c8;
    --theme-danger: #b32e2e; --theme-danger-rgb: 179, 46, 46;
    --theme-danger-text-emphasis: #a12222; --theme-danger-bg-subtle: #fdeaea; --theme-danger-border-subtle: #f5c2c2;
    --theme-warning: #fab219; --theme-warning-rgb: 250, 178, 25;
    --theme-warning-text-emphasis: #7a4f00; --theme-warning-bg-subtle: #fff4e0; --theme-warning-border-subtle: #f0d49a;
    --theme-info: #0F74AA; --theme-info-rgb: 15, 116, 170;
    --theme-info-text-emphasis: #0B5279; --theme-info-bg-subtle: #e2f2fb; --theme-info-border-subtle: #b5dcf1;
    --theme-primary-text-emphasis: #0B5279; --theme-primary-bg-subtle: #e2f2fb; --theme-primary-border-subtle: #b5dcf1;
    --portal-warning-text: #8a5a00;

    /* Brand-portal tokens. UBold defines --theme-*, not Bootstrap's --bs-* (those resolved to nothing), so every rule
       in this file uses these. Muted text is the proven .text-muted color (5.4:1), not --theme-secondary-color (2.4:1). */
    --portal-surface: #fff;
    --portal-bg: #f5f6f8;
    --portal-text: #4c4c5c;
    --portal-muted: #5f6b7c;
    --portal-border: #e1e5ea;
    --portal-border-strong: #c5ced8;
}
html[data-bs-theme=light][data-menu-color=light] {
    --theme-sidenav-item-hover-color: #0F74AA;
    --theme-sidenav-item-active-color: #0F74AA;
}
[data-bs-theme=dark] {
    --theme-primary: #148CCC;
    --theme-primary-rgb: 20, 140, 204;
    --bs-link-color: #6EC1EC;
    --bs-link-color-rgb: 110, 193, 236;
    --bs-link-hover-color: #A9DBF5;
    --theme-link-color: #6EC1EC;
    --theme-link-hover-color: #A9DBF5;
    --bs-code-color: #9fd6f3;
    --theme-code-color: #9fd6f3;
    --theme-success: #4cc97a; --theme-success-rgb: 76, 201, 122;
    --theme-success-text-emphasis: #6ee7a0; --theme-success-bg-subtle: rgba(20, 183, 84, .16); --theme-success-border-subtle: rgba(76, 201, 122, .35);
    --theme-danger: #f07272; --theme-danger-rgb: 240, 114, 114;
    --theme-danger-text-emphasis: #ff9b9e; --theme-danger-bg-subtle: rgba(229, 72, 77, .18); --theme-danger-border-subtle: rgba(240, 114, 114, .35);
    --theme-warning: #fab219; --theme-warning-rgb: 250, 178, 25;
    --theme-warning-text-emphasis: #f5c26b; --theme-warning-bg-subtle: rgba(245, 194, 107, .16); --theme-warning-border-subtle: rgba(245, 194, 107, .35);
    --theme-info: #4aa8e0; --theme-info-rgb: 74, 168, 224;
    --theme-info-text-emphasis: #9fd6f3; --theme-info-bg-subtle: rgba(20, 140, 204, .2); --theme-info-border-subtle: rgba(20, 140, 204, .4);
    --theme-primary-text-emphasis: #9fd6f3; --theme-primary-bg-subtle: rgba(20, 140, 204, .2); --theme-primary-border-subtle: rgba(20, 140, 204, .4);
    --portal-warning-text: #f5c26b;
    --portal-surface: #1e1f27;
    --portal-bg: #17181e;
    --portal-text: #aab8c5;
    --portal-muted: #a3b0bf;
    --portal-border: #30363e;
    --portal-border-strong: #454c56;
}
/* Text colors: warning text is dark amber (the amber fill stays for bars and dots). */
.text-warning { color: var(--portal-warning-text) !important; }
.btn-success {
    --theme-btn-bg: #1a7f45; --theme-btn-border-color: #1a7f45; --theme-btn-hover-bg: #156b3a; --theme-btn-hover-border-color: #156b3a;
    --theme-btn-active-bg: #115a30; --theme-btn-active-border-color: #115a30; --theme-btn-disabled-bg: #1a7f45; --theme-btn-disabled-border-color: #1a7f45;
}
.btn-warning {
    --theme-btn-color: #1f2a36; --theme-btn-hover-color: #1f2a36; --theme-btn-active-color: #1f2a36; --theme-btn-disabled-color: #1f2a36;
    --theme-btn-bg: #fab219; --theme-btn-border-color: #fab219; --theme-btn-hover-bg: #e9a510; --theme-btn-hover-border-color: #e9a510;
}
.alert-success, .alert-info, .alert-warning, .alert-danger { border: 1px solid var(--theme-alert-border-color); }
.alert-info { --theme-alert-color: var(--theme-info-text-emphasis); --theme-alert-bg: var(--theme-info-bg-subtle); --theme-alert-border-color: var(--theme-info-border-subtle); --theme-alert-link-color: var(--theme-info-text-emphasis); }
.alert-warning { --theme-alert-color: var(--theme-warning-text-emphasis); --theme-alert-bg: var(--theme-warning-bg-subtle); --theme-alert-border-color: var(--theme-warning-border-subtle); --theme-alert-link-color: var(--theme-warning-text-emphasis); }
code { color: var(--theme-code-color); background: var(--theme-tertiary-bg, #eef1f5); padding: .1em .35em; border-radius: 4px; font-size: .875em; }
.portal-codes code, pre code { background: none; padding: 0; }

.btn-primary {
    --theme-btn-bg: #0F74AA; --theme-btn-border-color: #0F74AA; --theme-btn-hover-bg: #0C628F; --theme-btn-hover-border-color: #0C628F;
    --theme-btn-active-bg: #0A5279; --theme-btn-active-border-color: #0A5279;
    --bs-btn-bg: #0F74AA; --bs-btn-border-color: #0F74AA; --bs-btn-hover-bg: #0C628F; --bs-btn-hover-border-color: #0C628F;
    --bs-btn-active-bg: #0A5279; --bs-btn-active-border-color: #0A5279; --bs-btn-disabled-bg: #0F74AA; --bs-btn-disabled-border-color: #0F74AA;
}
.progress-bar { background-color: #148CCC; }
.progress-bar.bg-success { background-color: #1a7f45 !important; }
.text-muted, .form-text { color: #5f6b7c !important; }
[data-bs-theme=dark] .text-muted, [data-bs-theme=dark] .form-text { color: #a3b0bf !important; }

/* Badges: contrast-checked soft colors (theme defaults are too light). */
.badge-soft-primary { color: #0B5279 !important; background-color: #e2f2fb !important; }
.badge-soft-warning { color: #7a4f00 !important; background-color: #fff4e0 !important; }
.badge-soft-danger { color: #a12222 !important; background-color: #fdeaea !important; }
.badge-soft-success { color: #0b6b32 !important; background-color: #e3f6ea !important; }
.badge-soft-secondary { color: #3d4756 !important; background-color: #eef1f5 !important; }
[data-bs-theme=dark] .badge-soft-primary { color: #9fd6f3 !important; background-color: rgba(20,140,204,.2) !important; }
[data-bs-theme=dark] .badge-soft-warning { color: #f5c26b !important; background-color: rgba(245,194,107,.16) !important; }
[data-bs-theme=dark] .badge-soft-danger { color: #ff9b9e !important; background-color: rgba(229,72,77,.18) !important; }
[data-bs-theme=dark] .badge-soft-success { color: #6ee7a0 !important; background-color: rgba(20,183,84,.16) !important; }
[data-bs-theme=dark] .badge-soft-secondary { color: #c9d2dc !important; background-color: rgba(255,255,255,.08) !important; }
a.badge { text-decoration: none; }
/* One badge size everywhere (12px), whatever the parent's font size. */
.badge { font-size: .75rem; padding: .3em .55em; font-weight: 700; letter-spacing: .01em; }
.badge i, .badge svg { width: 12px; height: 12px; }

:focus-visible { outline: 3px solid #148CCC !important; outline-offset: 2px !important; }
.sidenav-menu .logo img { height: 46px; width: auto; }
.sidenav-menu .logo .logo-sm img { height: 30px; }
.sidenav-menu { bottom: 0; height: auto; min-height: 100vh; }
.portal-subnav .side-nav-link { padding-left: 2.6rem; font-size: .875rem; }
.portal-subnav .menu-icon { transform: scale(.85); }
.page-title-head h1 { line-height: 1.3; }
.card-title.fs-base, h2.fs-base { font-size: 1rem; font-weight: 600; }
.btn-xs { --bs-btn-padding-y: .15rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem; }

/* Client header: their logo, name and site, with their accent color as a band on the left. */
.portal-brand-header { border-left: 5px solid var(--portal-accent, #148CCC); }
.portal-brand-logo { height: 56px; width: auto; max-width: 180px; object-fit: contain; }
.portal-brand-logo-sm { height: 40px; max-width: 120px; }
.portal-brand-initials {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 56px; height: 56px; border-radius: 12px; font-weight: 800; font-size: 1.15rem; color: #fff;
    background: var(--portal-accent, #148CCC);
}
.portal-brand-initials-sm { width: 40px; height: 40px; border-radius: 10px; font-size: .95rem; }
.portal-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.portal-tile-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
    color: #0F74AA; background: rgba(20, 140, 204, .1);
}
.portal-tile-icon svg { width: 22px; height: 22px; }
[data-bs-theme=dark] .portal-tile-icon { color: #6EC1EC; background: rgba(20, 140, 204, .2); }
.portal-card-link { text-decoration: none; color: inherit; border: 1px solid transparent; transition: border-color .15s, box-shadow .15s; }
.portal-card-link:hover { border-color: var(--portal-border); box-shadow: 0 2px 10px rgba(0,0,0,.06); color: inherit; }
.portal-row-done td { color: var(--portal-muted); }
.portal-check { width: 1.25rem; height: 1.25rem; cursor: pointer; }
.min-w-0 { min-width: 0; }

/* Sign-in pages */
.portal-auth { background: linear-gradient(160deg, rgba(20,140,204,.09), transparent 55%), var(--portal-bg); }
.portal-auth-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; color: #0F74AA; background: rgba(20,140,204,.12); }

/* Loading states (same as LLMs Ledger) */
.portal-spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; vertical-align: -0.15em; animation: portal-spin .7s linear infinite; margin-right: .4rem; }
@keyframes portal-spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef1f4 25%, #f7f9fb 37%, #eef1f4 63%); background-size: 400% 100%; animation: portal-shimmer 1.3s ease infinite; border-radius: 6px; }
[data-bs-theme=dark] .skeleton { background: linear-gradient(90deg, #2a2f3a 25%, #343a46 37%, #2a2f3a 63%); background-size: 400% 100%; }
@keyframes portal-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Light/dark toggle icons */
[data-bs-theme="dark"] .d-dark-none, [data-bs-theme="light"] .d-light-none { display: none !important; }

/* Skip link */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 2000; padding: .5rem 1rem; background: #0F74AA; color: #fff !important; border-radius: 0 0 .5rem 0; }
.skip-link:focus { left: 0; }

/* Links use the brand blue (the theme's default link color is purple). Same rule LLMs Ledger uses. */
a:not(.btn):not(.side-nav-link):not(.dropdown-item):not(.logo):not(.logo-light):not(.logo-dark):not(.link-reset):not(.badge):not(.page-link) { color: var(--theme-link-color); }
a:not(.btn):not(.side-nav-link):not(.link-reset):not(.badge):hover { color: var(--theme-link-hover-color); }
/* Client pages have no title bar, so give the client header the same space below the top bar. */


/* Validation summaries: one message, no bullet. */
.alert ul { margin: 0; padding-left: 0; list-style: none; }

/* "View as client" banner */
.portal-viewas { position: sticky; top: var(--theme-topbar-height, 70px); z-index: 1001; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    margin: 1rem 1.5rem 0; padding: .65rem 1rem; border-radius: .5rem; background: #fff4e0; color: #5c3d00; border: 1px solid #f0d49a; }
[data-bs-theme=dark] .portal-viewas { background: rgba(245,194,107,.16); color: #f5d9a3; border-color: rgba(245,194,107,.35); }

/* Projects and tasks */
.portal-prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-people { display: inline-flex; flex-shrink: 0; }
.portal-person { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    font-size: .7rem; font-weight: 700; color: #0B5279; background: #e2f2fb; border: 2px solid var(--portal-surface); }
.portal-people .portal-person + .portal-person { margin-left: -8px; }
.portal-person.staff { color: #fff; background: #0F74AA; }
.portal-person.more { color: #3d4756; background: #eef1f5; }
[data-bs-theme=dark] .portal-person { color: #9fd6f3; background: rgba(20,140,204,.22); }
.portal-task-check { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid #9aa6b5; background: transparent; color: transparent; padding: 0; cursor: pointer; transition: all .15s; }
[data-bs-theme=dark] .portal-task-check { border-color: #6b7785; }
.portal-task-check svg { width: 15px; height: 15px; }
.portal-task-check:hover { border-color: #1a8a4a; color: #1a8a4a; }
.portal-task-check.done { border-color: #1a8a4a; background: #1a8a4a; color: #fff; }
.portal-thumb { display: block; width: 120px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--portal-border); }
.portal-thumb img { width: 100%; height: 100%; object-fit: cover; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; margin-left: auto; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform .15s; opacity: .7; }
details.card[open] > summary::after { transform: rotate(45deg); }

/* Brand file manager */
#file-manager { position: relative; }
.portal-drop-hint { display: flex; align-items: center; gap: .75rem; margin: 1rem var(--theme-card-spacer-x, 1.5rem) 0; padding: .9rem 1rem; border: 2px dashed #c5ced8;
    border-radius: .6rem; color: var(--portal-muted); }
.portal-drop-hint svg { flex-shrink: 0; width: 20px; height: 20px; }
[data-bs-theme=dark] .portal-drop-hint { border-color: rgba(255,255,255,.18); }
@media (hover: none) { .portal-drop-hint { display: none; } }
.portal-drop-overlay { display: none; position: absolute; inset: 0; z-index: 5; border-radius: inherit; border: 3px dashed #148CCC;
    background: rgba(20,140,204,.08); backdrop-filter: blur(1px); align-items: center; justify-content: center; text-align: center; color: #0F74AA; pointer-events: none; }
#file-manager.is-dragging .portal-drop-overlay { display: flex; }
.portal-upload-list { margin: 0 var(--theme-card-spacer-x, 1.5rem); }
.portal-upload-list:not(:empty) { margin-top: .75rem; margin-bottom: .75rem; }
.portal-upload-row { padding: .4rem 0; }
.portal-upload-row .progress { margin-top: .3rem; }
.portal-file-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    color: #3d4756; background: #eef1f5; }
.portal-file-icon svg { width: 16px; height: 16px; }
.portal-file-icon.folder { color: #8a5a00; background: #fff4e0; }
.portal-file-icon.image { color: #0F74AA; background: #e2f2fb; }
.portal-file-icon.pdf { color: #a12222; background: #fdeaea; }
.portal-file-icon.sheet { color: #0b6b32; background: #e3f6ea; }
.portal-file-icon.media { color: #5b3fa6; background: #efe9fb; }
[data-bs-theme=dark] .portal-file-icon { background: rgba(255,255,255,.08); color: #c9d2dc; }
[data-bs-theme=dark] .portal-file-icon.folder { color: #f5c26b; background: rgba(245,194,107,.14); }
[data-bs-theme=dark] .portal-file-icon.image { color: #9fd6f3; background: rgba(20,140,204,.2); }
[data-bs-theme=dark] .portal-file-icon.pdf { color: #ff9b9e; background: rgba(229,72,77,.16); }
[data-bs-theme=dark] .portal-file-icon.sheet { color: #6ee7a0; background: rgba(20,183,84,.14); }
[data-bs-theme=dark] .portal-file-icon.media { color: #c4b5fd; background: rgba(139,92,246,.16); }
.portal-file-table td a { text-decoration: none; }

/* Small popovers built on <details> (new folder, rename/move/delete) */
.portal-popover { position: relative; }
.portal-popover > summary { list-style: none; }
.portal-popover > summary::-webkit-details-marker { display: none; }
.portal-popover-body { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: 280px; padding: 1rem; border-radius: .6rem;
    background: var(--portal-surface); color: var(--portal-text); border: 1px solid var(--portal-border-strong); box-shadow: 0 8px 28px rgba(0,0,0,.14); }
[data-bs-theme=dark] .portal-popover-body { box-shadow: 0 8px 28px rgba(0,0,0,.55); }
/* An open menu stacks above the rows after it. */
.portal-popover[open] { position: relative; z-index: 30; }
/* Menus in tables: let them out of the scrolling wrapper while open, and open upward on the last rows. */
.table-responsive:has(details.portal-popover[open]) { overflow: visible; }
.portal-file-table tbody tr:nth-last-child(-n+2):not(:only-child) .portal-popover-body { top: auto; bottom: calc(100% + 6px); }
@media (max-width: 575.98px) { .portal-popover-body { width: min(280px, calc(100vw - 48px)); } }

/* Email preview frame */
.portal-email-frame { height: 860px; max-width: 100%; border: 1px solid var(--portal-border); border-radius: 8px; background: #fff; }

/* Privacy and terms */
.portal-legal { line-height: 1.65; }
.portal-legal ul { padding-left: 1.2rem; }
.portal-legal li { margin-bottom: .35rem; }

/* Two-step sign-in */
.portal-otp { letter-spacing: .3em; font-variant-numeric: tabular-nums; font-weight: 600; }
.portal-otp::placeholder { letter-spacing: normal; font-weight: 400; }
.portal-qr { border: 1px solid var(--portal-border); border-radius: .5rem; padding: 6px; background: #fff; }
.portal-key { letter-spacing: .05em; word-break: break-all; }
.portal-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: 1rem; border: 1px dashed var(--portal-border); border-radius: .5rem; }
.portal-codes code { font-size: 1rem; color: var(--portal-text); }

/* Uptime: status colors are the fixed status palette (good / warning / critical), always paired with a label */
:root { --status-good: #0ca30c; --status-warn: #fab219; --status-bad: #d03b3b; --status-none: #e2e5ea; --chart-line: #148CCC; }
[data-bs-theme="dark"] { --status-none: #383835; --chart-line: #4aa8e0; }
.uptime-bars { display: flex; gap: 2px; height: 34px; align-items: stretch; }
.uptime-bar { flex: 1 1 0; min-width: 2px; border-radius: 2px; }
.uptime-good { background: var(--status-good); }
.uptime-warn { background: var(--status-warn); }
.uptime-bad { background: var(--status-bad); }
.uptime-none { background: var(--status-none); }
.uptime-bar:hover { opacity: .7; }
@media (max-width: 767.98px) { .uptime-bar-old { display: none; } }
.uptime-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .5rem; }
.uptime-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.monitor-badge { display: inline-flex; align-items: center; }
.response-chart-plot { position: relative; height: 200px; padding-left: 52px; }
.response-chart-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-grid { stroke: var(--theme-border-color, #dee2e6); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-base { stroke: var(--theme-border-color, #dee2e6); stroke-width: 1; }
@media (max-width: 575.98px) { .response-chart-x span:nth-child(even) { display: none; } }
.chart-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-down { fill: var(--status-bad); }
.chart-hit { fill: transparent; }
.chart-hit:hover { fill: rgba(127,127,127,.12); }
.chart-ylabel { position: absolute; left: 0; width: 46px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--portal-muted); font-variant-numeric: tabular-nums; }
.response-chart-x { position: relative; height: 18px; margin-left: 52px; font-size: 11px; color: var(--portal-muted); }
.response-chart-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.stat-tile .h3 { font-variant-numeric: tabular-nums; }

/* Stats */
.stats-hbar { height: 8px; background: var(--status-none); border-radius: 4px; overflow: hidden; }
.stats-hbar span { display: block; height: 100%; background: var(--chart-line); border-radius: 0 4px 4px 0; }
.stats-embed { position: relative; width: 100%; aspect-ratio: 4 / 3; }
@media (min-width: 992px) { .stats-embed { aspect-ratio: 16 / 10; } }
.stats-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* First-sign-in tour */
.tour-backdrop { position: fixed; inset: 0; z-index: 2000; }
.tour-backdrop.tour-dim { background: rgba(15, 23, 42, .55); }
.tour-spot { position: fixed; z-index: 2001; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55), 0 0 0 3px #148CCC; pointer-events: none; transition: all .25s ease; }
.tour-pop { position: fixed; z-index: 2002; width: min(360px, calc(100vw - 16px)); background: #fff; color: #1e293b;
    border-radius: 12px; padding: 1.25rem 1.25rem 1rem; box-shadow: 0 18px 48px rgba(0,0,0,.28); transition: top .25s ease, left .25s ease; }
.tour-pop.tour-center { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); }
.tour-pop.tour-sheet:not(.tour-center) { top: auto !important; left: 8px !important; right: 8px; bottom: 8px; width: auto; }
.tour-progress { display: flex; gap: 4px; margin-bottom: .6rem; }
.tour-progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--status-none); }
.tour-progress span.on { background: #148CCC; }
body.tour-open { overflow-x: hidden; }
.tour-pop .text-muted { color: #64748b !important; }
[data-bs-theme="dark"] .tour-pop { background: #1f2430; color: #e5e7eb; box-shadow: 0 18px 48px rgba(0,0,0,.6); }
[data-bs-theme="dark"] .tour-pop .text-muted { color: #9aa3b2 !important; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-pop { transition: none; } }

/* ======================================================================================================
   Shared building blocks (design review round 1). Prefer these classes over one-off spacing in pages.
   ====================================================================================================== */

/* Cards and tables share one inset: table cells and flush list items line up with the card header text. */
@media (max-width: 575.98px) { .card { --theme-card-spacer-x: 1rem; --theme-card-cap-padding-x: 1rem; } }
.card .table > :not(caption) > * > *:first-child { padding-left: var(--theme-card-spacer-x, 1.5rem); }
.card .table > :not(caption) > * > *:last-child { padding-right: var(--theme-card-spacer-x, 1.5rem); }
.card .table { font-variant-numeric: tabular-nums; }
.card > .list-group-flush > .list-group-item, .card > .list-group-flush > li.list-group-item { padding-inline: var(--theme-card-spacer-x, 1.5rem); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Cards in a gutter row: the gutter is the gap (no doubled margin) and tiles in a row are the same height. */
.row[class*="g-"] > .col > .card:only-child { margin-bottom: 0; height: 100%; }
.row[class*="g-"] > [class*="col-"] > .card:only-child { margin-bottom: 0; }
.row[class*="g-"] > [class*="col-"] > .card:not(:only-child):last-child { margin-bottom: 0; }
/* A vertical stack of cards and card rows with one gap (the same as the grid gutter), whatever each child's own margins. */
.portal-stack { display: flex; flex-direction: column; gap: var(--portal-gap, 1.5rem); }
.portal-stack > * { margin-top: 0; margin-bottom: 0; }
.portal-stack > .card { margin-bottom: 0; }
.portal-stack > .row { margin-top: 0; row-gap: var(--portal-gap, 1.5rem); }
.portal-stack > .row > * { margin-top: 0; }
main#main { padding-bottom: 1.5rem; }

/* Page header: one pattern for every page (eyebrow, back arrow, h1, badge, actions). */
.portal-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: 1.5rem 0 1.25rem; }
.portal-page-header h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; margin: 0; }
.portal-page-header .portal-page-title { flex: 1 1 260px; min-width: 0; }
.portal-eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--portal-muted); margin-bottom: .2rem; }
.portal-eyebrow a { color: inherit !important; text-decoration: none; }
.portal-eyebrow a:hover { text-decoration: underline; }
.portal-page-header .portal-page-sub { color: var(--portal-muted); margin-top: .2rem; }
.portal-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.portal-page-header .portal-back { flex-shrink: 0; align-self: center; }
.portal-page-header .portal-brand-initials, .portal-page-header .portal-brand-logo { align-self: center; }
@media (max-width: 767.98px) {
    .portal-page-header { padding: 1rem 0 1rem; }
    .portal-page-header h1 { font-size: 1.25rem; }
}
@media (max-width: 575.98px) {
    .portal-page-actions { width: 100%; }
    .portal-page-actions > .btn, .portal-page-actions > form, .portal-page-actions > .dropdown { flex: 1 1 auto; }
    .portal-page-actions > form > .btn, .portal-page-actions > .dropdown > .btn { width: 100%; }
}
.portal-intro { color: var(--portal-muted); max-width: 72ch; margin-top: -.5rem; margin-bottom: 1.25rem; }
.portal-brand-header-compact .portal-brand-initials-sm { width: 40px; height: 40px; }

/* Headings that sit between cards on the gray background. */
.portal-section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; font-size: .8125rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--portal-muted); margin: 1.75rem 0 .75rem; }
.portal-section-title:first-child { margin-top: 0; }
.portal-section-meta { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .8125rem; }

/* Segmented control (period pickers, filters, Current/All): one style, never wraps, scrolls sideways if it must. */
.portal-segmented { display: inline-flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; vertical-align: middle; }
.portal-segmented::-webkit-scrollbar { display: none; }
.portal-segmented > .btn { white-space: nowrap; flex: 0 0 auto; }
.portal-segmented .portal-count { display: inline-block; min-width: 1.4em; margin-left: .35rem; padding: 0 .35em; border-radius: 1em; font-size: .7rem; font-weight: 700; line-height: 1.5;
    background: rgba(15,116,170,.12); color: #0B5279; }
.portal-segmented .btn-primary .portal-count { background: rgba(255,255,255,.25); color: #fff; }
[data-bs-theme=dark] .portal-segmented .portal-count { background: rgba(20,140,204,.25); color: #9fd6f3; }

/* Form actions: default-size, auto-width buttons, left-aligned; full width only on phones. */
.portal-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.25rem; }
@media (max-width: 575.98px) { .portal-form-actions > .btn { flex: 1 1 100%; } }
.btn-primary:disabled, .btn-primary.disabled { --theme-btn-disabled-bg: #9cc3da; --theme-btn-disabled-border-color: #9cc3da; --theme-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #9cc3da; --bs-btn-disabled-border-color: #9cc3da; opacity: 1; }
[data-bs-theme=dark] .btn-primary:disabled, [data-bs-theme=dark] .btn-primary.disabled { --theme-btn-disabled-bg: #2b4a5e; --theme-btn-disabled-border-color: #2b4a5e; --theme-btn-disabled-color: #a3b0bf; }
.btn { white-space: nowrap; }
.btn.text-wrap { white-space: normal; }

/* Row actions in tables: one light button group per row; on phones they move under the title. */
.portal-row-actions { display: inline-flex; flex-wrap: wrap; gap: .375rem; justify-content: flex-end; }
.table td.portal-actions { white-space: nowrap; width: 1%; text-align: right; }

/* Form controls: visible borders for checkboxes (3:1). */
.form-check-input { border-color: #7d8999; }
[data-bs-theme=dark] .form-check-input { border-color: #6b7785; }
.form-check-input:checked { border-color: var(--theme-primary); }
.portal-file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.portal-file-pick .portal-file-name { color: var(--portal-muted); font-size: .875rem; min-width: 0; overflow-wrap: anywhere; }

/* Stat tiles */
.stat-tile .stat-tile-label { color: var(--portal-muted); margin-bottom: .25rem; }
.stat-tile .h3, .stat-tile .h5 { font-variant-numeric: tabular-nums; }
.stat-tile.stat-tile-danger { border-color: var(--theme-danger-border-subtle) !important; }
.stat-tile.stat-tile-warning { border-color: var(--theme-warning-border-subtle) !important; }
a.stat-tile, a.stat-tile:hover, a.portal-card-link, a.portal-card-link:hover { text-decoration: none; color: var(--theme-body-color) !important; }

/* "Latest report" / "Latest invoice": icon, text, button in a grid; the button drops under the text on phones. */
.portal-latest { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
.portal-latest > .min-w-0 { min-width: 0; }
@media (max-width: 575.98px) { .portal-latest { grid-template-columns: auto 1fr; } .portal-latest > .btn { grid-column: 1 / -1; } }

/* "Waiting on you": the client's next actions. */
.portal-waiting { border-color: var(--theme-warning-border-subtle); }
.portal-waiting > .card-header { background: var(--theme-warning-bg-subtle); }
.portal-waiting .portal-waiting-icon { color: var(--portal-warning-text); }
.portal-callout { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.25rem; border-radius: var(--theme-border-radius, .5rem); margin-bottom: 1.5rem;
    background: var(--theme-warning-bg-subtle); border: 1px solid var(--theme-warning-border-subtle); color: var(--theme-warning-text-emphasis); }
.portal-callout svg { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.portal-callout p { margin: 0; }

/* Brand cards on the portfolio page: accent rule, quick links into each brand. */
.portal-brand-card { border-top: 3px solid var(--portal-accent, #148CCC) !important; }
.portal-quick-links { display: flex; flex-wrap: wrap; gap: .125rem .25rem; position: relative; z-index: 2; margin-left: -.5rem; }
.portal-quick-links a { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; border-radius: .375rem; font-size: .8125rem; font-weight: 600;
    text-decoration: none; color: var(--portal-muted) !important; }
.portal-quick-links a:hover { color: var(--theme-link-color) !important; text-decoration: underline; }
.portal-quick-links svg { width: 15px; height: 15px; }
/* Phones: one row of icons, each with a small label under it. */
@media (max-width: 575.98px) {
    .portal-quick-links { flex-wrap: nowrap; justify-content: space-between; gap: 0; margin-inline: -.5rem; }
    .portal-quick-links a { flex-direction: column; gap: .15rem; padding: .4rem 0; min-width: 0; flex: 1 1 0; }
    .portal-quick-links a .portal-ql-text { font-size: 11px; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .portal-quick-links svg { width: 20px; height: 20px; }
}

/* Side menu: brand initials chips instead of one repeated building icon; light-mode active item gets a soft pill (as in dark). */
.portal-nav-initials { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; font-size: .625rem; font-weight: 800;
    letter-spacing: 0; color: #fff; background: var(--portal-accent, #148CCC); line-height: 1; }
html[data-bs-theme=light] .side-nav .side-nav-link.active { background: rgba(20,140,204,.08); border-radius: .5rem; }

/* Footer links: visible focus (the theme removes it). */
.footer a:focus-visible { outline: 2px solid #148CCC !important; outline-offset: 2px !important; border-radius: 2px; }

/* Settings rows */
.portal-setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
.portal-setting-row > :first-child { flex: 1 1 260px; min-width: 0; }
.portal-group-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--portal-muted); margin: 1.25rem 0 .5rem; }
.portal-group-label:first-of-type { margin-top: .25rem; }

/* Request and comment threads: body aligned with the author's name (avatar 30px + gap). */
.portal-thread-body { padding-left: calc(30px + .5rem); }
/* Comment and message header: avatar, name, "Mobilize Cloud", time on the right. On phones the time drops to its own line under the name. */
.portal-thread-meta { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .5rem; row-gap: 0; }
.portal-thread-meta strong { min-width: 0; overflow-wrap: anywhere; }
.portal-thread-time { margin-left: auto; color: var(--portal-muted); font-size: .75rem; white-space: nowrap; }
@media (max-width: 575.98px) {
    .portal-thread-time { flex-basis: 100%; margin-left: 0; padding-left: calc(30px + .5rem); margin-top: -.15rem; }
}

/* Sign-in pages */
.portal-auth .form-control-lg { padding-left: .9rem; }
.portal-auth main h1, .portal-auth main h1.fs-lg { font-size: 1.375rem !important; font-weight: 700; }
@media (max-width: 575.98px) {
    .portal-auth .container { padding-inline: 16px; }
    .portal-auth .card { padding: 1.25rem !important; }
    .portal-auth .auth-box { padding-inline: 0; }
}
.portal-two-col { display: grid; grid-template-columns: 1fr; column-gap: 2.5rem; }
@media (min-width: 768px) { .portal-two-col { grid-template-columns: 1fr 1fr; } }

/* File manager toolbar: breadcrumb, search, buttons. On phones: breadcrumb, then a full-width search, then the two buttons. */
.portal-file-search input { width: 200px; }
@media (max-width: 767.98px) {
    .portal-file-toolbar { row-gap: .75rem !important; }
    .portal-file-toolbar > nav, .portal-file-toolbar .portal-file-search, .portal-file-toolbar .portal-file-buttons { flex: 0 0 auto; width: 100%; }
    .portal-file-toolbar .portal-file-search input { width: 100%; }
    .portal-file-toolbar .portal-file-buttons > * { flex: 1 1 0; }
    .portal-file-toolbar .portal-file-buttons summary, .portal-file-toolbar .portal-file-buttons label { width: 100%; }
}
.portal-task-check-off { cursor: default; border-style: dashed; opacity: .6; }
.portal-task-check-off:hover { border-color: #9aa6b5; color: transparent; }
@media (max-width: 575.98px) { .portal-search { max-width: none !important; width: 100% !important; flex: 0 0 auto; margin-left: 0 !important; } }
/* The theme forces a 24px gap in every card header, which leaves big holes when the header wraps on a phone. */
.card-header { gap: .5rem .75rem !important; }
.card-header .breadcrumb { padding: 0; }

/* ---------- Round 2 ---------- */
/* Eyebrows wrap instead of cutting off the last (most specific) part. */
.portal-eyebrow { white-space: normal; }
/* Phones: the back arrow shares a row with the eyebrow, so the title gets the full width. */
@media (max-width: 575.98px) {
    .portal-page-header.has-back { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: .5rem; row-gap: .25rem; }
    .portal-page-header.has-back .portal-page-title { display: contents; }
    .portal-page-header.has-back .portal-back { width: 28px; height: 28px; padding: 0; grid-column: 1; }
    .portal-page-header.has-back .portal-back svg { width: 15px; height: 15px; }
    .portal-page-header.has-back .portal-eyebrow { grid-column: 2; margin: 0; }
    .portal-page-header.has-back .portal-eyebrow ~ * { grid-column: 1 / -1; }
    .portal-page-header.has-back .portal-page-actions { grid-column: 1 / -1; margin-top: .5rem; }
}
/* Segmented controls that scroll sideways fade at the edge so it's clear there's more (portal.js sets is-overflowing). */
.portal-segmented.is-overflowing { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
/* Admin requests: on phones the five filters wrap onto two rows instead of hiding "Done". */
@media (max-width: 575.98px) {
    .portal-segmented.portal-segmented-wrap { flex-wrap: wrap; overflow: visible; gap: .25rem; -webkit-mask-image: none; mask-image: none; }
    .portal-segmented.portal-segmented-wrap > .btn { border-radius: .375rem !important; margin-left: 0 !important; }
}
/* Dark mode: light buttons need a lighter label (the theme's fails 4.5:1). */
html[data-bs-theme=dark] .btn-light { --theme-btn-color: #dbe2ea; --bs-btn-color: #dbe2ea; --theme-btn-bg: rgba(255,255,255,.08); --bs-btn-bg: rgba(255,255,255,.08);
    --theme-btn-border-color: transparent; --theme-btn-hover-color: #fff; --bs-btn-hover-color: #fff; --theme-btn-hover-bg: rgba(255,255,255,.14);
    --theme-btn-active-color: #fff; --theme-btn-active-bg: rgba(255,255,255,.18); --theme-btn-disabled-color: #a3b0bf; }
/* Sign-in pages on phones: the card uses the screen width (UBold gives .auth-box 50px side padding). */
@media (max-width: 575.98px) { .auth-box.portal-auth { padding: 1.5rem 0 !important; } .portal-auth .container { padding-inline: 16px; } }
/* "Waiting on you": the count is the same chip in both themes; a calmer header band in dark mode. */
.portal-waiting > .card-header .badge { background: var(--portal-surface) !important; color: var(--theme-warning-text-emphasis) !important; border: 1px solid var(--theme-warning-border-subtle); }
[data-bs-theme=dark] .portal-waiting > .card-header { background: rgba(245,194,107,.08); }
/* Email preview list (and any list-group): a clear current item. */
.list-group-item.active, .list-group-item[aria-current="page"] { background: #e2f2fb; color: #0B5279 !important; font-weight: 600; border-color: var(--portal-border); box-shadow: inset 3px 0 0 #148CCC; }
[data-bs-theme=dark] .list-group-item.active, [data-bs-theme=dark] .list-group-item[aria-current="page"] { background: rgba(20,140,204,.2); color: #9fd6f3 !important; }

/* ---------- Live updates ---------- */
.portal-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 2500; display: flex; flex-direction: column; gap: .5rem; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.portal-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .55rem; padding: .7rem 1rem; border-radius: .6rem; background: #1f2a36; color: #fff; font-weight: 600; font-size: .875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.18); border-left: 4px solid #148CCC; transition: opacity .35s, transform .35s; }
.portal-toast svg { flex: 0 0 auto; width: 16px; height: 16px; margin-top: .1rem; color: #5cb8e8; }
[data-bs-theme=dark] .portal-toast svg { color: #0F74AA; }
/* Phones: a full-width bar above the bottom edge (and the home indicator). */
@media (max-width: 575.98px) {
    .portal-toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: none; }
    .portal-toast { width: 100%; }
}
/* A region that changed while someone was typing in it. */
.portal-live-stale { margin: .75rem var(--theme-card-spacer-x, 1.5rem); padding: .45rem .75rem; border-radius: .375rem; font-size: .8125rem;
    background: var(--theme-info-bg-subtle, #e2f2fb); color: var(--theme-info-text-emphasis, #0B5279); border: 1px solid var(--theme-info-border-subtle, #b6dff4); }
.portal-live-stale a { font-weight: 600; color: inherit; text-decoration: underline; }
.card-body > .portal-live-stale, .portal-stack > .portal-live-stale, .row > .portal-live-stale, [data-live-region].col-xl-8 > .portal-live-stale { margin-inline: 0; margin-top: 0; }
/* New items that arrive with a live refresh: a short highlight. */
@keyframes portal-flash { from { background-color: rgba(20,140,204,.18); } to { background-color: transparent; } }
.portal-live-new, .portal-live-new > td { animation: portal-flash 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) { .portal-live-new, .portal-live-new > td { animation: none; box-shadow: inset 3px 0 0 #148CCC; } }
.portal-toast.is-leaving { opacity: 0; transform: translateY(6px); }
[data-bs-theme=dark] .portal-toast { background: #e5e7eb; color: #1f2a36; }
/* Regions wrap card contents; keep the card insets as if they weren't there. */
.card > [data-live-region] > .list-group-flush > .list-group-item { padding-inline: var(--theme-card-spacer-x, 1.5rem); }
/* Side-menu counts */
.portal-nav-count { margin-left: auto; min-width: 1.4rem; text-align: center; border-radius: 999px; background: #0F74AA; color: #fff; font-size: .75rem; line-height: 1.2; padding: .2em .5em; }
.portal-nav-count[hidden] { display: none; }
.side-nav-link .menu-text { flex: 1 1 auto; }
html[data-sidenav-size="condensed"] .portal-nav-count { position: absolute; top: 4px; right: 4px; min-width: 1.1rem; padding: .1em .35em; }
/* The collapsed rail hides everything in a link except the icon; the count must stay visible there. */
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link .portal-nav-count:not([hidden]) { display: inline-block !important; font-size: .625rem; line-height: 1.1; }
/* Phones: the counts are inside the closed menu, so the menu button carries a dot while any count shows. */
.sidenav-toggle-button { position: relative; }
.sidenav-toggle-button.has-count::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #0F74AA; box-shadow: 0 0 0 2px var(--portal-surface, #fff); }

/* Top bar: the row fills the bar and centers its contents, so the menu button and the buttons on the right
   don't sit against the top edge. */
.app-topbar .topbar-menu { height: 100%; min-height: 70px; align-items: center; }

/* Client and brand logos in light and dark mode (LogoPair). */
.portal-logo-dark { display: none !important; }
[data-bs-theme="dark"] .portal-logo-light { display: none !important; }
[data-bs-theme="dark"] .portal-logo-dark { display: inline-block !important; }
[data-bs-theme="dark"] .portal-logo-plate { background: #fff; padding: 4px 8px; border-radius: 6px; box-sizing: content-box; }
/* Admin previews: the same logo on a light and a dark tile. */
.portal-logo-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.portal-logo-tile { border-radius: 8px; border: 1px solid var(--theme-border-color); min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; }
.portal-logo-tile img { max-height: 44px; max-width: 100%; object-fit: contain; }
.portal-logo-tile.is-light { background: #fff; color: #6b7785; }
.portal-logo-tile.is-dark { background: #1e222c; color: #9aa4b2; }
.portal-logo-tile.is-dark img.on-plate { background: #fff; padding: 4px 8px; border-radius: 6px; }
.portal-logo-tile small { font-size: 11px; }
.portal-logo-thumb { height: 28px; max-width: 72px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px 4px; border: 1px solid var(--theme-border-color); }
/* Dark mode uses each client's dark accent (set in admin, or worked out from the normal one). */
[data-bs-theme="dark"] [style*="--portal-accent-dark"] { --portal-accent: var(--portal-accent-dark) !important; }
.portal-swatch-on-dark { box-shadow: 0 0 0 3px #1e222c; }
/* Sortable table headers: the whole label is the link; the arrow shows the current order. */
.portal-sort { color: inherit !important; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.portal-sort:hover { text-decoration: underline; }
.portal-sort i { opacity: .45; }
.portal-sort.is-active i { opacity: 1; }
th.num .portal-sort { justify-content: flex-end; width: 100%; }
/* Comparison line on trend charts: dashed and quieter than the main line, with a small legend. */
.chart-line-compare { fill: none; stroke: #8a94a3; stroke-width: 1.5; stroke-dasharray: 5 4; stroke-linejoin: round; }
.chart-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--theme-secondary-color); margin-top: 6px; }
.chart-key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--chart-line); }
.chart-key-compare { border-top: 2px dashed #8a94a3; }

/* Stats range bar */
.stats-range { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.stats-range .form-control, .stats-range .form-select { width: auto; }
.stats-print-head { display: none; }

/* Save as PDF / print: just the report. */
@media print {
    @page { margin: 12mm; }
    html, body { background: #fff !important; }
    .sidenav-menu, .app-topbar, .portal-tour, .portal-toasts, .no-print, .stats-embed, .footer, footer, .skip-link,
    .portal-page-header, .portal-brand-header-compact { display: none !important; }
    /* The page no longer leaves room for the side menu. */
    .content-page { margin-left: 0 !important; padding-top: 0 !important; }
    .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #dfe3e8 !important; }
    .stats-print-head { display: flex !important; align-items: center; justify-content: space-between; gap: 16px;
        border-bottom: 2px solid #148CCC; padding-bottom: 8px; margin-bottom: 12px; }
    .stats-print-head img { height: 30px; width: auto; flex: 0 0 auto; margin-right: 4px; }
    a[href]::after { content: none !important; }
}
.portal-invoice-subject { min-width: 12rem; }
/* Brand home header: website link and the main "Submit a request" action. */
.portal-brand-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 575.98px) { .portal-brand-actions { width: 100%; } .portal-brand-actions > .btn { flex: 1 1 100%; justify-content: center; } .portal-brand-actions > .btn-primary { order: -1; } }
/* Light formatting in messages (lists from the request editor). */
.portal-prose ul, .portal-prose ol { margin: .25rem 0 .5rem; padding-left: 1.4rem; }
.portal-prose li { margin: .1rem 0; }
.portal-prose a { overflow-wrap: anywhere; }
/* Drop zone for attachments (portal.js). */
.portal-dropzone { border: 1.5px dashed var(--theme-border-color); border-radius: .5rem; padding: 1rem; text-align: center; background: var(--theme-tertiary-bg); transition: border-color .15s, background .15s; }
.portal-dropzone.is-over { border-color: var(--portal-accent, #148CCC); background: color-mix(in srgb, var(--portal-accent, #148CCC) 8%, transparent); }
.portal-dropzone:focus-within { border-color: var(--portal-accent, #148CCC); }
.portal-dropzone .portal-dz-icon { font-size: 1.75rem; color: var(--portal-accent, #148CCC); }
.portal-dropzone label { cursor: pointer; }
.portal-dz-list { list-style: none; margin: .75rem 0 0; padding: 0; text-align: left; }
.portal-dz-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: .375rem; background: var(--theme-secondary-bg); border: 1px solid var(--theme-border-color); margin-top: .35rem; font-size: .875rem; }
.portal-dz-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-dz-size { color: var(--theme-secondary-color); flex: 0 0 auto; }
.portal-dz-remove { padding: 0 .25rem; color: var(--theme-secondary-color); }
.portal-dropzone .portal-dz-or { display: none; }
.portal-dropzone.is-enhanced .portal-dz-or { display: inline; }
/* Simple editor (portal.js). */
.portal-editor { border: 1px solid var(--theme-border-color); border-radius: var(--theme-border-radius); background: var(--theme-secondary-bg); }
.portal-editor:focus-within { border-color: var(--portal-accent, #148CCC); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--portal-accent, #148CCC) 20%, transparent); }
.portal-editor.is-invalid { border-color: var(--theme-danger); }
.portal-editor-bar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--theme-border-color); background: var(--theme-tertiary-bg); border-radius: var(--theme-border-radius) var(--theme-border-radius) 0 0; }
.portal-editor-btn { padding: .25rem .45rem; color: var(--theme-body-color); border: 0; }
.portal-editor-btn:hover, .portal-editor-btn.active { background: var(--theme-border-color); }
.portal-editor-link { display: flex; gap: 6px; padding: 6px; border-bottom: 1px solid var(--theme-border-color); }
.portal-editor-link[hidden] { display: none; }
.portal-editor-area { position: relative; min-height: 6rem; max-height: 28rem; overflow-y: auto; padding: .6rem .8rem; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-editor-area ul, .portal-editor-area ol { margin: .25rem 0; padding-left: 1.4rem; }
.portal-editor.is-empty .portal-editor-area::before { content: attr(data-placeholder); color: var(--theme-secondary-color); pointer-events: none; position: absolute; }
/* Without script the file input shows as normal; with it the zone's label opens the picker. */
.portal-dropzone .portal-dz-input { display: block; margin: .5rem auto 0; max-width: 100%; }
.portal-dropzone.is-enhanced .portal-dz-input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; padding: 0; }
.portal-dropzone.is-enhanced .portal-dz-input:focus-visible + .form-text { text-decoration: underline; }
.portal-dropzone:has(.portal-dz-input:focus-visible) { outline: 2px solid var(--portal-accent, #148CCC); outline-offset: 2px; }
.portal-dropzone.is-enhanced { cursor: pointer; }
/* Uptime grid sparklines. */
.uptime-spark { display: inline-flex; gap: 1px; align-items: stretch; height: 18px; vertical-align: middle; }
.uptime-spark i { width: 3px; border-radius: 1px; }
.response-spark { width: 96px; height: 24px; vertical-align: middle; overflow: visible; }
.response-spark polyline { fill: none; stroke: var(--portal-accent, #148CCC); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.response-spark circle { fill: var(--portal-accent, #148CCC); }
.portal-spark-cell { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; white-space: nowrap; }
.portal-dropzone-compact { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem .5rem; padding: .5rem .75rem; text-align: left; }
.portal-dropzone-compact .portal-dz-icon { font-size: 1.15rem; }
.portal-dropzone-compact .portal-dz-help { margin: 0 !important; flex-basis: 100%; text-align: center; }
.portal-dropzone-compact .portal-dz-list { flex-basis: 100%; margin-top: .25rem; }
.portal-dropzone-compact .portal-dz-input { margin: 0; }
.portal-editor-area:focus, .portal-editor-area:focus-visible { outline: none !important; box-shadow: none !important; } /* the editor box shows focus */
