/* Font, brand colour and links live in theme.css as tokens. */

/* One visible focus indicator for everything a keyboard can reach (links, rows, chips, buttons). */
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
.form-control:focus-visible, .form-select:focus-visible { outline: 0; }

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

/* Modal and drawer titles take focus only so screen readers announce them (Modal FocusTitle); a ring around a
   heading that isn't a control just looks like a bug. */
.modal-title[tabindex="-1"]:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger-ink);
}

.validation-message {
    color: var(--danger-ink);
    font-size: 12px;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: var(--border-strong);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Shared <Modal> (Components/Shared/Modal.razor): a native <dialog> wearing Bootstrap's modal
   classes. Reset the UA dialog box so .modal-dialog lays out exactly as it does inside .modal. */
dialog.app-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    overflow-x: hidden;
    overflow-y: auto;
}
dialog.app-modal::backdrop { background: var(--scrim); }

/* Drawer variant: the client quick view, sliding in from the right; full width on phones. */
dialog.app-drawer .modal-dialog {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    width: min(420px, 100vw);
    max-width: 100vw;
}
dialog.app-drawer .modal-content {
    height: 100%;
    border-radius: 0;
    overflow-y: auto;
    animation: drawer-in .2s ease-out;
}
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.app-drawer .modal-content { animation: none; } }

/* Skip link: off-screen until focused. */
.skip-link {
    position: absolute;
    left: .5rem;
    top: -3rem;
    z-index: 2000;
    padding: .5rem .75rem;
    background: var(--surface);
    border: 2px solid var(--focus);
    border-radius: var(--radius-md);
}
.skip-link:focus { top: .5rem; }

/* Phones and small tablets (below lg, which includes a phone in landscape): the sidebar becomes a
   drawer opened by the topbar burger (a real <button>; app-ui.js toggles .nav-open on .app-shell).
   A closed drawer is visibility:hidden, so its links leave the tab order instead of sitting
   off-screen as invisible tab stops. */
.nav-burger, .nav-backdrop, .nav-close { display: none; }
@media (max-width: 991.98px) {
    .nav-burger {
        display: inline-flex; align-items: center; justify-content: center;
        flex: none; width: 44px; height: 44px; margin-left: -.5rem; padding: 0;   /* flex: none, or the search squeezes it below 44px */
        border: 0; background: transparent; font-size: 1.4rem; color: var(--text-2);
    }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 1040; transform: translateX(-100%);
        visibility: hidden; transition: transform .2s, visibility 0s .2s; overflow-y: auto;
    }
    .app-shell.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s; }
    .app-shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 1030; background: var(--scrim); border: 0; }
    .topbar { padding: 0 .75rem !important; }
    /* Every page repeats its own title, so the crumb only costs space on a phone. */
    .topbar .crumb-root, .topbar .crumb-sep, .topbar .crumb-current { display: none; }
    .nav-close {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; margin-right: -.75rem; padding: 0;
        border: 0; background: transparent; font-size: 1.1rem; color: var(--text-2);
    }
}

/* Inbox: exactly one screen tall, so the thread scrolls inside and the reply box stays in view.
   Desktop: viewport − topbar − main padding. Phones: also − the tab bar main pads for (M4). */
.inbox-page { height: calc(100dvh - var(--topbar-h) - 3rem); }
.inbox-list { width: 100%; }
/* The list's column must be allowed to shrink, or a long preview widens it past the phone (M1). */
.inbox-list > * { flex: 1 1 auto; min-width: 0; }
@media (min-width: 992px) { .inbox-list { width: 360px; } }
/* Desktop with a chat open: one grid so the two panes share rows. Title bar beside the chat header,
   search and filters beside the summary, so the thread rows and the messages start at the same
   height. The wrappers in between become display:contents so their children land in the grid. */
@media (min-width: 992px) {
    .inbox-page:has(.thread-pane) {
        display: grid !important;
        grid-template-columns: 360px minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr) auto;
    }
    .inbox-page:has(.thread-pane) :is(.inbox-list, .inbox-list > div, .inbox-detail, .inbox-detail > div, .inbox-detail > div > div, .thread-pane) {
        display: contents !important;
    }
    .inbox-page:has(.thread-pane) .inbox-list-head { grid-area: 1 / 1; }
    .inbox-page:has(.thread-pane) .inbox-filters { grid-area: 2 / 1; }
    .inbox-page:has(.thread-pane) .inbox-rows { grid-area: 3 / 1 / -1 / 2; min-height: 0; }
    .inbox-page:has(.thread-pane) :is(.inbox-list-head, .inbox-filters, .inbox-rows) { border-right: 1px solid var(--border); }
    .thread-pane > * { grid-column: 2; }
    .thread-pane > .thread-head { grid-row: 1; }
    .thread-pane > .thread-summary { grid-row: 2; }
    .thread-pane > .thread-messages { grid-row: 3; min-height: 0; }
}

/* Appointments week view: 7 columns on desktop, stacked on phones. */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week-day { min-width: 0; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-md); padding: .5rem; min-height: 8rem; }
@media (max-width: 767.98px) { .week-grid { grid-template-columns: 1fr; } .week-day { min-height: 0; } }
.week-day-today { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-subtle); }

/* Header global search: fixed width on desktop, shrinks on phones. */
.topbar-search { width: 16rem; max-width: 40vw; }
/* A day column is narrow: stack the card and wrap its actions. */
.week-day .appt-row { flex-direction: column; align-items: flex-start !important; gap: .25rem; }
.week-day .appt-actions { flex-wrap: wrap; gap: .25rem !important; }

/* Inbox thread rows are buttons (keyboard-openable); make them look like list rows. */
/* relative: the row's visually-hidden labels are absolute; without it they escape the scrolling list and stretch the page. */
.thread-row { position: relative; display: block; width: 100%; text-align: left; background: var(--surface); color: inherit; }
.thread-row:hover { background: var(--surface-subtle); }
.thread-row.is-selected { background: var(--accent-subtle); box-shadow: inset 3px 0 0 var(--accent); }
.thread-row .thread-name { font-size: 13px; font-weight: 500; }
.thread-row .thread-preview { font-size: 13px; }
.thread-row .unread-dot { width: 8px; height: 8px; }

/* Deals board: columns share the width (min 13rem, so five stages fit a 1440px screen) and only scroll once they no longer fit. On
   phones each column snaps to the viewport so one stage reads at a time. */
.deal-board { min-height: 50vh; }
.deal-column { flex: 1 0 13rem; max-width: 22rem; min-height: 12rem; }
@media (max-width: 767.98px) {
    .deal-board { scroll-snap-type: x mandatory; }
    .deal-column { flex: 0 0 85%; min-width: 0; scroll-snap-align: start; }   /* min-width:0 or a long title widens it past the phone */
}

/* Sign-in cards: fixed comfortable width on desktop, full width on a phone. */
.auth-card { width: 100%; max-width: 380px; }

.bubble-time-on-brand { color: rgba(255, 255, 255, .85); }

/* Invisible click-catcher behind the notifications panel, so a click outside closes it. */
.bell-backdrop { position: fixed; inset: 0; z-index: 1049; background: transparent; border: 0; cursor: default; }

/* Screen-reader-only text inside a table cell is position:absolute; without a positioned ancestor it
   escapes the scroll box and widens the whole page on phones. */
.table-responsive { position: relative; }

/* Phones: the search takes the room the hidden breadcrumb leaves (after the base rule above). */
@media (max-width: 991.98px) {
    .topbar-search { flex: 1 1 auto; width: auto; max-width: none; }
}

/* ---------- Phone layout (mobile UI audit, 2026-10-03) ---------- */
:root { --tabbar-h: 3.5rem; --topbar-h: 52px; }

/* Desktop: the shell is one screen tall and <main> scrolls. Below lg the document scrolls instead
   (MainLayout.razor.css), so mobile browsers can shrink their toolbars (M12). */
.app-col { min-width: 0; }
@media (min-width: 992px) {
    .app-col { overflow: hidden; }
    .app-main { overflow: auto; }
}

/* The composer's attach label wraps a visually hidden file input; show the input's focus on it. */
.attach-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Notification panel: compact on desktop, readable 15px+ on phones. */
.bell-list { font-size: .875rem; }
@media (max-width: 991.98px) { .bell-list { font-size: .95rem; } }

/* Thread header extras: a full row on phones (opened by "⋯"), inline and right-aligned from lg. */
.thread-extra { width: 100%; }
@media (min-width: 992px) { .thread-extra { width: auto; margin-left: auto; } }

/* Bottom tab bar: the four daily screens plus "Más" (M10). */
.tabbar { display: none; }
@media (max-width: 991.98px) {
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--surface); border-top: 1px solid var(--line);
    }
    .tabbar-link {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: .15rem; padding: 0; border: 0; background: none;
        font-size: .75rem; color: var(--text-muted-strong); text-decoration: none;
    }
    .tabbar-link .lc { width: 20px; height: 20px; }
    .tabbar-link.active { color: var(--accent-ink); font-weight: 500; }
    .app-main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 1rem) !important; }
    .inbox-page { height: calc(100dvh - var(--topbar-h) - 2rem - var(--tabbar-h) - env(safe-area-inset-bottom, 0px)); }

    /* An open conversation takes the whole screen, like a messaging app; Back returns to the list. */
    body:has(.inbox-thread-open) .tabbar { display: none; }
    body:has(.inbox-thread-open) .app-main { padding-bottom: 1rem !important; }
    .inbox-page.inbox-thread-open { height: calc(100dvh - var(--topbar-h) - 2rem); }

    /* Toasts sit just above the tab bar, full width, near the thumb (M11). */
    .toast-container {
        top: auto !important; right: 0 !important; left: 0;
        bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
        padding: .5rem !important;
    }
    .toast-container .toast { width: 100%; }
    .toast-container .btn { min-height: 44px; }
}

/* On touch screens Enter adds a line (app-ui.js), so the "Enter to send" hint would be wrong. */
@media (pointer: coarse) { .composer-enter-hint { display: none !important; } }

/* A phone in landscape is only ~375px tall: tighter chat chrome so messages still show (M2). */
@media (max-width: 991.98px) and (max-height: 500px) {
    body:has(.inbox-thread-open) .app-main { padding-top: .5rem !important; padding-bottom: .5rem !important; }
    .inbox-page.inbox-thread-open { height: calc(100dvh - var(--topbar-h) - 1rem); }
    .inbox-thread-open .thread-head, .inbox-thread-open .composer-box { padding: .5rem .75rem !important; }
    .inbox-thread-open [data-testid=inbox-back] { padding-top: 0; padding-bottom: 0; }
}

/* iOS Safari zooms into any focused field under 16px; Bootstrap's -sm controls are 14px (M6). */
@media (max-width: 991.98px), (pointer: coarse) {
    .form-control-sm, .form-select-sm { font-size: 16px; }
}

/* Touch targets: at least 24×24 everywhere small (WCAG 2.5.8), 44×44 for icon buttons (M7). */
@media (max-width: 991.98px), (pointer: coarse) {
    .form-check-input { width: 1.5rem; height: 1.5rem; }
    .form-check { min-height: 1.5rem; padding-left: 2.25rem; }
    .form-check .form-check-input { margin-left: -2.25rem; }
    .form-switch { padding-left: 3.5rem; }
    .form-switch .form-check-input { width: 2.75rem; margin-left: -3.5rem; }
    .btn-icon { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .btn-close { padding: .875rem; }
    .pagination .page-link { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

/* A tap leaves :hover stuck on touch screens, so outline buttons looked pressed or disabled (M18). */
@media (hover: none) {
    .btn[class] { --bs-btn-hover-bg: var(--bs-btn-bg); --bs-btn-hover-color: var(--bs-btn-color); --bs-btn-hover-border-color: var(--bs-btn-border-color); }
}

/* Phones: a padded main leaves room for Bootstrap's .row gutters, so nothing scrolls sideways (M16). */
@media (max-width: 575.98px) {
    .app-main .row { --bs-gutter-x: 1rem; }
}

/* List-style rows for tables on phones (M15, M19): each row becomes a two-line item instead of a
   squeezed grid. Mark cells with .cell-sel / .cell-main / .cell-sub / .cell-end. */
@media (max-width: 767.98px) {
    .table-stack > thead { display: none; }
    .table-stack, .table-stack > tbody { display: block; }
    .table-stack > tbody > tr {
        display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "sel main end" "sel sub end" "act act act";
        column-gap: .75rem; align-items: center;
        padding: .65rem .75rem; border-bottom: 1px solid var(--line-soft);
    }
    .table-stack > tbody > tr > td { display: block; padding: 0; border: 0; background: transparent; }
    .table-stack > tbody > tr > td.cell-sel { grid-area: sel; }
    .table-stack > tbody > tr > td.cell-main { grid-area: main; min-width: 0; }
    .table-stack > tbody > tr > td.cell-sub { grid-area: sub; min-width: 0; font-size: .875rem; color: var(--text-muted-strong); }
    .table-stack > tbody > tr > td.cell-end { grid-area: end; text-align: right; }
    .table-stack > tbody > tr > td.cell-full { grid-area: act; text-align: left; }
    .table-stack > tbody > tr > td.cell-full:not(:empty) { margin-top: .5rem; }
    .table-stack > tbody > tr > td:not([class*="cell-"]) { display: none; }
    .table-responsive:has(> .table-stack) { overflow-x: visible; }
}

/* ---- Shared components: Avatar, Skeleton, Tooltip ------------------------------------------ */
.avatar {
    --avatar-size: 2rem;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: var(--avatar-size); height: var(--avatar-size); border-radius: 50%;
    font-size: calc(var(--avatar-size) * .38); font-weight: 500; line-height: 1; user-select: none;
    background: hsl(var(--avatar-h) 60% 92%); color: hsl(var(--avatar-h) 45% 28%);
}
[data-bs-theme=dark] .avatar { background: hsl(var(--avatar-h) 35% 22%); color: hsl(var(--avatar-h) 70% 82%); }
.avatar-sm { --avatar-size: 1.5rem; }
.avatar-lg { --avatar-size: 2.75rem; }

.skeleton-line { display: block; height: .9rem; margin-bottom: .6rem; border-radius: var(--radius-sm); background: var(--surface-hover); }

.tooltip { --bs-tooltip-font-size: var(--fs-xs); }

/* ---- Topbar: icon button, quick-create and user menus, command palette --------------------- */
.topbar-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--control-md); height: var(--control-md); padding: 0; border: 0; border-radius: var(--radius-md);
    background: transparent; color: var(--ink-secondary); font-size: 16px;
}
.topbar-btn:hover { background: var(--surface-hover); }
/* Relay icon sizes: 16px in the chrome, 20px for the phone burger and tab bar. */
.topbar-btn .lc, .nav-close .lc, .nav-collapse .lc { width: 16px; height: 16px; }
.nav-burger .lc { width: 20px; height: 20px; }
.topbar-menu { position: relative; }
.topbar-menu > summary { list-style: none; cursor: pointer; }
.topbar-menu > summary::-webkit-details-marker { display: none; }
.topbar-avatar { display: inline-flex; border-radius: 50%; }
.topbar-panel {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 1050; min-width: 12rem; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.topbar-panel-end { left: auto; right: 0; }
.topbar-panel a, .topbar-panel button {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--control-md); padding: 6px 8px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--ink); font-size: 13px; text-align: left; text-decoration: none;
}
.topbar-panel a:hover, .topbar-panel button:hover { background: var(--surface-hover); color: var(--text); }
.topbar-panel-head { padding: 6px 8px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-tertiary); }
@media (max-width: 575.98px) { .topbar-panel { position: fixed; top: calc(var(--topbar-h) + 4px); left: .5rem; right: .5rem; } }

dialog.cmd-palette {
    width: min(36rem, calc(100vw - 2rem)); margin: 12vh auto auto; padding: .75rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
dialog.cmd-palette::backdrop { background: var(--scrim); }
.cmd-list { max-height: 50vh; margin: .5rem 0 0; padding: 0; overflow-y: auto; list-style: none; }
.cmd-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; }
.cmd-list li[aria-selected=true] { background: var(--accent-subtle); color: var(--accent-ink); }
.cmd-list .cmd-kind { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted-strong); }
.cmd-hint { margin-top: .5rem; font-size: var(--fs-xs); color: var(--text-muted-strong); }

/* ---- Desktop sidebar collapse to an icon rail (class on <html>, set before first paint) ------ */
.nav-collapse { display: none; }
@media (min-width: 992px) {
    .nav-collapse {
        display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0;
        border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text-muted-strong);
    }
    .nav-collapse:hover { background: var(--surface-hover); }
    html.nav-collapsed .sidebar { width: 56px; min-width: 56px; }
    html.nav-collapsed .sidebar-brand { height: auto; padding: 14px 0 .5rem; flex-direction: column; gap: .5rem; }
    html.nav-collapsed .sidebar-brand .sidebar-label, html.nav-collapsed .sidebar-group .sidebar-label,
    html.nav-collapsed .sidebar-user, html.nav-collapsed .sidebar-tenant .sidebar-label,
    html.nav-collapsed .sidebar-tenant .lc-arrow-left-right { display: none; }
    html.nav-collapsed .sidebar-brand .nav-collapse { margin: 0; }
    html.nav-collapsed .sidebar-link { justify-content: center; margin: .1rem .5rem; padding: .55rem 0; }
    html.nav-collapsed .sidebar-tenant { justify-content: center; margin: 0 .5rem .5rem; padding: .5rem 0; }
    html.nav-collapsed .sidebar-group { padding: .6rem 0 0; border-top: 1px solid var(--line); margin: .5rem .75rem 0; height: 0; overflow: hidden; }
    /* Labels stay readable to screen readers; only the pixels go away. */
    html.nav-collapsed .sidebar-link .sidebar-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }
}

/* Bell count: a small badge on the bell icon's top-right corner, placed against the icon (.bell-wrap) so it sits the same
   at every button size and stays inside the 3rem topbar. Needs the .btn prefix: Bootstrap's ".btn .badge" would otherwise win. */
.bell-wrap { position: relative; display: inline-block; line-height: 1; }
.btn .bell-count { position: absolute; top: -.4rem; left: calc(100% - .2rem); min-width: 1rem; font-size: .6rem; padding: .3em .4em; line-height: 1; }

/* Desktop toasts drop below the 3rem topbar so they never cover the Create button, bell or avatar. */
@media (min-width: 992px) { .toast-container.top-0 { top: calc(var(--topbar-h) + 8px) !important; } }

/* Settings tab strips scroll sideways on phones; no scrollbar track, and app-ui.js centres the active tab. */
.settings-tabs ul { scrollbar-width: none; }
.settings-tabs ul::-webkit-scrollbar { display: none; }

/* ---- Calendar page (month and week) -------------------------------------------------------- */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-surface); overflow: hidden; }
.cal-head { padding: .35rem .5rem; background: var(--surface-2); color: var(--text-muted-strong); font-size: 12px; font-weight: 500; text-align: center; }
.cal-day { position: relative; min-height: 6rem; padding: .25rem; background: var(--surface); }
.cal-day.is-other { background: var(--surface-2); }
.cal-day.is-other .cal-num { color: var(--text-muted-strong); }
.cal-day.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .25rem; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: var(--fs-sm); }
.cal-day.is-today .cal-num { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.cal-chip { display: block; margin-top: .15rem; padding: .1rem .35rem; border-left: 3px solid var(--chip, var(--text-muted-strong)); border-radius: .25rem; background: var(--surface-hover); color: var(--text); font-size: .7rem; line-height: 1.35; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip:hover { background: var(--accent-subtle); color: var(--text); }
.cal-chip-wide { white-space: normal; font-size: var(--fs-sm); padding: .3rem .5rem; margin-top: 0; }
.cal-chip-done { opacity: .55; text-decoration: line-through; }
.cal-more { margin-top: .15rem; padding: 0 .25rem; border: 0; background: transparent; color: var(--brand-text); font-size: .7rem; }
.cal-count { position: absolute; right: .3rem; bottom: .25rem; min-width: 1.1rem; padding: 0 .3rem; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: .65rem; text-align: center; line-height: 1.1rem; }
.cal-key { display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; border-radius: .15rem; background: var(--chip, var(--text-muted-strong)); vertical-align: -.05rem; }
.cal-key-task { background: var(--text-muted-strong); }
@media (max-width: 767.98px) { .cal-day { min-height: 3.25rem; } }

/* ---- Charts (Components/Sales/TrendChart, BarChart, ChartLegend) --------------------------------
   Series colours are --series-N from theme.css. Marks carry the colour; every word stays in a text token. */
.chart-wrap { overflow-x: auto; }
.chart-svg { display: block; width: 100%; min-width: 520px; max-width: 760px; height: auto; font-family: inherit; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--text-muted-strong); font-size: 12px; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: .1; stroke: none; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-hit { fill: transparent; outline: none; }
.chart-cross { stroke: var(--text-muted-strong); stroke-width: 1; opacity: 0; pointer-events: none; }
.chart-hover-dot { stroke: var(--surface); stroke-width: 2; opacity: 0; pointer-events: none; }
.chart-tip { opacity: 0; pointer-events: none; transition: opacity .1s; }
.chart-tip rect { fill: var(--surface); stroke: var(--line); }
.chart-tip-label { fill: var(--text-muted-strong); font-size: 12px; }
.chart-tip-value { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-pt:hover .chart-cross, .chart-pt:hover .chart-hover-dot, .chart-pt:hover .chart-tip,
.chart-pt:focus-within .chart-cross, .chart-pt:focus-within .chart-hover-dot, .chart-pt:focus-within .chart-tip { opacity: 1; }
.chart-pt:hover .chart-hit, .chart-pt:focus-within .chart-hit { fill: var(--accent-subtle); opacity: .5; }
.chart-hit:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 .5rem; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-2); }
.chart-swatch { display: inline-block; width: .7rem; height: .7rem; margin-right: .4rem; border-radius: .2rem; vertical-align: -.05rem; }
.chart-table > summary { cursor: pointer; color: var(--text-muted-strong); }

/* ---- Relay page layout ------------------------------------------------------------------------
   Pages max out at 1376px; the deals board and the inbox run edge to edge. */
.app-page { max-width: 1376px; margin: 0 auto; }
.app-page:has(.deal-board, .inbox-page) { max-width: none; }

/* Record pages (client, company, deal): main content on the left, a 340px properties panel on the right.
   The panel comes first in the markup, so below 1024px it stacks above the timeline. */
.record-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
    .record-layout { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "main props"; align-items: start; }
    .record-main { grid-area: main; min-width: 0; }
    .record-props { grid-area: props; min-width: 0; }
}

/* Shortcut hints (Relay kbd: mono 11/16). */
kbd { padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-subtle); color: var(--ink-secondary); font: 500 11px/16px var(--bs-font-monospace); box-shadow: none; }

/* Record properties (client record panel and drawer): caption label beside its value, one row each. */
.props-list { display: grid; gap: 10px; margin: 0; }
.props-list > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 8px; align-items: baseline; }
.props-list dt { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-secondary); }
.props-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.record-props .card-body > .mb-3:last-child { margin-bottom: 0 !important; }

/* Short screens: the inbox thread keeps its height for messages, so the summary shrinks to two lines. */
@media (max-height: 760px) {
    .summary-strip { margin-bottom: .5rem !important; }
    .summary-strip .card-body { padding: .5rem .75rem; }
    .summary-strip .summary-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
