/* app.css — Lucpac.AdminApp. Brand values come from _content/LP.UI.Shared/css/lucpac-tokens.css, linked before this file in App.razor.
   The shared layout system (sidebar, status bar, page shell, footer, and their --nav-*, --sb-*, --pg-*
   variables) is _content/LP.UI.Shared/css/lucpac-layout.css, linked between the two; this file holds
   only AdminApp's own rules. */

* {
    margin: 0;
    padding: 0;
}

/* Everything is border-box.
 *
 * This reset used to set margin and padding only, which left the whole app on the CSS default of
 * content-box — where a declared width is the CONTENT width and padding and borders are added on
 * top. Any element with `width: 100%` and padding therefore rendered wider than the box containing
 * it, by exactly its padding plus its border.
 *
 * That is not a theoretical tidy-up. It surfaced as the sign-in field standing 24px proud of the
 * avatar popup, and it will keep surfacing one control at a time, because it is invisible until a
 * container is narrow enough for the difference to show. Several rules in this file and in the
 * component styles already carry `box-sizing: border-box` individually — each one a place where
 * somebody hit this and fixed it locally. They are now redundant and harmless.
 *
 * Telerik's own components already assume border-box, so this brings our CSS into line with the
 * component library rather than away from it.
 *
 * Verified rather than assumed: a layout audit over 21 pages — signed out and signed in, grids,
 * forms, dashboards and workspaces — measured every element that sticks out past its parent's
 * content box, before and after. See the commit for the numbers.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    font-family: var(--lucpac-font-body);
    line-height: 1.5rem;
    height: 100%;
    overflow: hidden;
}

/* Removed the global `h1:focus-visible { outline: accent }` rule. <FocusOnNavigate
   Selector="h1"> programmatically focuses the first heading on every navigation, so this
   blanket rule painted an accent "box" over decorative page headings (PageHeading title bar,
   login title, etc.) — a bug, not a wanted focus ring. No <h1> exists in the nav sidebar or any
   layout, so navbars are unaffected. If a specific heading needs a visible focus ring, scope it
   to that element rather than all <h1>. */

.content {
    padding-top: 1.1rem;
}

/* Recent Tenants dashboard grid: scale to fill its card (the dashboard content-grid stretches
   sibling cards to equal height) with a floor so it never collapses when there are few rows.
   Targets the Telerik grid root by its Class — must live in global CSS (scoped ::deep can't
   reach Telerik-rendered DOM). The card body is made a flex column so height:100% resolves. */
.recent-tenants-card .k-card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.recent-tenants-grid {
    height: 100%;
    min-height: 320px;
}

.recent-tenants-grid .k-grid-container {
    min-height: 0;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px color-mix(in srgb, var(--lucpac-navy-deep) 20%, transparent);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHR0aD0iNTYiIGhlaWdodD0iNDkiLz48L2NsaXBBcHRocD48ZyBjbGlwLXBhdGg9InVybCgjY2xpcDApIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjM1IC01MSkiPjxwYXRoIGQ9Ik0yNjMuNTA2IDUxQzI2NC43MTcgNTEgMjY1LjgxMyA1MS40ODM3IDI2Ni42MDYgNTIuMjY1OExtMjY3LjA1MiA1Mi43OTg3IDI2Ny41Mzk1IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI5MSA5NC42Nz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: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: var(--lucpac-line);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--lucpac-navy);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: var(--lucpac-navy);
}

/* ...except while a dock pane is being dragged (Chris, 2026-10-07: "the dock helper is hidden by
   the floating window"). A floating dock pane is a Telerik Window, rendered at the page root with a
   z-index around 10000; the dock indicators are rendered inside the DockManager, i.e. inside this
   wrapper, so the cap above put them under the window being dragged - the drop targets were there
   but could not be seen. Telerik gives them z-index 100002 for exactly this, which only works in
   the root stacking context. The indicators exist in the DOM only while a pane is being dragged,
   so lifting the cap just for that moment keeps it everywhere else; nobody has the avatar
   popover open mid-drag. */
.content-scroll-wrapper:has(.k-dock-navigator) {
    z-index: auto;
}


@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════
   SystemNotificationManager Toolbar overflow
   Popup.  Toolbar Popup is rendered outside the 
   isolated component subtree. and thus needs to 
   be styled here in the global CSS
   ═══════════════════════════════════════════════ */
.k-toolbar-popup .snm-tgl-btn,
.k-toolbar-popup .snm-btn {
    background-color: var(--base-1st-clr) !important;
    color: var(--base-3rd-clr) !important;
    border: 1.5px solid var(--base-2nd-clr) !important;
    font-size: 0.72rem !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

    .k-toolbar-popup .snm-tgl-btn:hover,
    .k-toolbar-popup .snm-btn:hover,
    .k-toolbar-popup .snm-tgl-btn.k-hover,
    .k-toolbar-popup .snm-btn.k-hover {
        background-color: var(--nav-hover-bg) !important;
        color: var(--base-3rd-clr) !important;
        border: 1.5px solid var(--nav-hover-border-clr) !important;
    }

    .k-toolbar-popup .snm-tgl-btn.k-selected,
    .k-toolbar-popup .snm-tgl-btn[aria-pressed="true"] {
        background-color: var(--base-2nd-clr) !important;
        color: var(--base-3rd-clr) !important;
        border-color: var(--base-2nd-clr) !important;
    }

    .k-toolbar-popup .snm-tgl-btn .k-button-text,
    .k-toolbar-popup .snm-btn .k-button-text {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        color: inherit !important;
        visibility: visible !important;
    }

    .k-toolbar-popup .snm-tgl-btn .k-icon,
    .k-toolbar-popup .snm-tgl-btn .k-svg-icon,
    .k-toolbar-popup .snm-btn .k-icon,
    .k-toolbar-popup .snm-btn .k-svg-icon {
        color: var(--base-3rd-clr) !important;
        fill: var(--base-3rd-clr) !important;
    }

.k-toolbar-popup .snm-btn-label {
    font-size: 0.72rem !important;
    white-space: nowrap;
}

/* The legacy global .login-* block (white card, navy→blue gradient, position:fixed, z-index:1000) was
   deleted on 2026-10-19. It pre-dated LoginLayout.razor.css and Login.razor.css, and because it was
   global it kept applying underneath them: the title rendered in Metrophobic, the subtitle and footer
   in generic sans-serif, and its fixed/inset box fought the layout's own shell. The login page is now
   owned entirely by LoginLayout.razor.css (ground), Login.razor.css (card) and SignInPanel.razor.css
   (form). */

/* Master-detail grid expand glyph.
   Telerik defaults to a "+" which collides visually with the Add command
   button's "+" icon. Replace it with the same downward chevron the NavMenu
   uses to expand sub-items (AppIcons.Nav.ToggleArrow), so "expand" looks
   the same wherever the user encounters it.
   Opt in by setting Class="custom-icons" on the master TelerikGrid.
   NOTE: keep this path in sync with AppIcons.Nav.ToggleArrow — CSS can't
   reference C# constants. */
.custom-icons .k-hierarchy-cell .k-svg-icon.k-svg-i-plus svg path {
    d: path("M256 352 128 224l22.6-22.6L256 306.7l105.4-105.3L384 224z");
}

/* Account Ledger opening/closing balance badge (rendered inside Telerik group header/footer cells,
   so styled globally). Fixed width, right-justified, semi-transparent fill so the amount stays legible:
   red = owing (debit), green = in credit, blue = zero. DT/CR suffix set in the component. */
.balance-badge {
    display: inline-block;
    width: 250px;
    flex: none;            /* never let a flex parent grow/shrink it — both badges stay identical width */
    text-align: center;    /* content centered in the badge */
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--lucpac-navy-deep);
}
.balance-badge.bal-debit  { background: color-mix(in srgb, var(--lucpac-danger) 20%, transparent); }   /* owing */
.balance-badge.bal-credit { background: color-mix(in srgb, var(--lucpac-success) 20%, transparent); }  /* in credit */
.balance-badge.bal-zero   { background: var(--lucpac-sky-tint); }                                       /* zero */

/* Group header spans the full row on the grouped column: label left, badge right.
   width:100% + flex:1 make the flex container fill the (spanning) header cell so
   space-between actually pushes the badge to the far right. */
.k-grid .group-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    flex: 1 1 auto;
}

/* The closing badge sits in the last (Credit) column's group footer; anchor it right and let it extend
   left over the Debit column without being clipped. */
.k-grid .closing-badge {
    display: flex;
    justify-content: flex-end;
}
.k-grid .closing-label {
    text-align: right;
}
.k-grid tr.k-group-footer > td {
    overflow: visible;
}

/* The grid toolbar's layout (spacer, search box, Set / Reset) moved to LP.UI.Shared's lucpac-grid.css
   on 2026-10-27, so TenantAdminApp's grids get it too. */

/* Message-template editor: read-only placeholder cheat-sheet rendered as token chips.
   Lives in global app.css because the editor's TelerikWindow content is outside the
   component's scopable DOM (same reason header/grid styles live here). */
.placeholder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.placeholder-chip {
    background: var(--lucpac-mist);
    border: 1px solid var(--lucpac-line);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.85em;
}

/* Message-template editor: one tab per body, editor beside a live preview. Side by side while the
   window is wide enough for both to be useful, stacked below that - a preview squeezed to a third
   of the window says nothing about spacing. */
.mt-body-tabs {
    margin-bottom: 12px;
}

.mt-body-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
    gap: 16px;
    padding-top: 8px;
}

.mt-body-editor,
.mt-body-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.mt-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mt-preview-subject {
    padding: 6px 8px;
    border: 1px solid var(--lucpac-line);
    border-radius: 4px;
    background: var(--lucpac-mist-soft);
    overflow-wrap: anywhere;
}

/* The frame is white whatever the app theme, because that is what an email client shows. A fixed
   height and the frame's own scrollbar: sizing it to the content would need script inside a frame
   that is sandboxed precisely so it runs none. */
.mt-preview-frame {
    width: 100%;
    border: 1px solid var(--lucpac-line);
    border-radius: 4px;
    background: var(--lucpac-paper);
}

.mt-preview-frame.mt-preview-phone {
    width: 375px;
    max-width: 100%;
    align-self: center;
}

.mt-preview-frame iframe {
    display: block;
    width: 100%;
    height: 26rem;
    border: 0;
}

/* Plain text keeps every space and line break as written - that spacing is the point of the
   preview - and wraps long lines as a reader would. */
.mt-preview-text {
    margin: 0;
    min-height: 10rem;
    max-height: 26rem;
    overflow: auto;
    padding: 8px 10px;
    border: 1px solid var(--lucpac-line);
    border-radius: 4px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: inherit;
    font-size: 0.95em;
    line-height: 1.4;
}

.mt-samples {
    display: grid;
    grid-template-columns: minmax(10rem, max-content) minmax(0, 1fr);
    gap: 6px 10px;
    align-items: center;
    margin: 6px 0;
}

.mt-sample-token {
    font-family: monospace;
    font-size: 0.85em;
}

.mt-sample-undeclared {
    color: var(--lucpac-warning);
    text-decoration: underline dotted;
    cursor: help;
}

/* ── Public requests: detail view and history (UIComponants/Requests) ─────────────────────────
   Global rather than isolated because RequestCallHistory and RequestReplyHistory are shared by
   the detail window and the work screens, and should look the same in both. rd- is the detail
   view, rh- the history lists. */
.rd { display: flex; flex-direction: column; gap: 0.9rem; }
.rd h3, .rh h3 { margin: 0 0 0.35rem; font-size: 0.95rem; font-weight: 600; color: var(--lucpac-navy); }
.rd section p { margin: 0 0 0.3rem; }
.rd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.rd-type { font-weight: 600; font-size: 1.05rem; }
.rd-received, .rd-muted, .rh-muted { color: var(--lucpac-text-muted); font-size: 0.85rem; }
.rd-facts { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: 0.25rem 1rem; margin: 0; }
.rd-facts dt { color: var(--lucpac-text-muted); }
.rd-facts dd { margin: 0; }
.rd-text, .rh-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.rh-list { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.rh-when { margin-right: 0.5rem; color: var(--lucpac-text-muted); font-size: 0.85rem; }
.rh-reply { margin-left: 0.4rem; }
.rh-error { margin-top: 0.2rem; color: var(--lucpac-danger); font-size: 0.85rem; }

/* The Requests list: the whole row opens the request, so say so with the cursor. */
.requests-grid .k-master-row { cursor: pointer; }
.requests-reply-failed { color: var(--lucpac-danger); font-weight: 600; }
.requests-reply-queued { color: var(--lucpac-warning); }
.requests-open-only { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0 0.5rem; }

/* Product marketing workers (2026-10-13): the card and page editors, the review note and the
   preview beside them. Global rather than scoped because the editors and the workers that host
   them are separate components sharing one look, and CSS isolation stops at a component boundary.
   Every class is pm- prefixed, so nothing else on a page can pick these up. */
.pm-worker { display: grid; gap: 1rem; }
.pm-intro { margin: 0; }
.pm-message { margin: 0; color: var(--lucpac-text-muted); }
.pm-note {
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--lucpac-warning);
    background: color-mix(in srgb, var(--lucpac-warning) 8%, transparent);
    border-radius: 4px;
    white-space: pre-line;
}
.pm-note-heading { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.pm-form { display: grid; gap: 0.9rem; }
.pm-group { margin: 0.5rem 0 0; font-size: 1rem; font-weight: 600; }
.pm-field { display: grid; gap: 0.3rem; }
.pm-label { font-weight: 600; font-size: 0.9rem; }
.pm-hint { margin: 0; font-size: 0.8rem; color: var(--lucpac-text-muted); }
.pm-fixed { font-family: ui-monospace, monospace; }
.pm-row { display: flex; gap: 0.5rem; align-items: center; }
.pm-row > :first-child { flex: 1 1 auto; }
.pm-row-actions { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.pm-section {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0.9rem 1rem 1rem;
    border: 1px solid var(--lucpac-line);
    border-radius: 8px;
}
.pm-section-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.pm-section-title { font-weight: 600; }
.pm-item {
    display: grid;
    gap: 0.6rem;
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--kendo-color-base-subtle, var(--lucpac-mist));
}
.pm-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }

/* Notification toasts (TelerikNotification): Kendo's stock fills - a saturated blue, green, orange and
   red - in brand tints instead, as the grid's status badges (audit, 2026-10-27). */
.k-notification { border-radius: var(--lucpac-radius); font-family: var(--lucpac-font-body); }
.k-notification-primary { background: var(--lucpac-navy); border-color: var(--lucpac-navy); color: var(--lucpac-on-navy); }
.k-notification-info { background: var(--lucpac-sky-tint); border-color: var(--lucpac-control-border-hover); color: var(--lucpac-navy); }
.k-notification-success { background: color-mix(in srgb, var(--lucpac-success) 14%, var(--lucpac-paper)); border-color: color-mix(in srgb, var(--lucpac-success) 40%, transparent); color: var(--lucpac-success); }
.k-notification-warning { background: color-mix(in srgb, var(--lucpac-warning) 16%, var(--lucpac-paper)); border-color: color-mix(in srgb, var(--lucpac-warning) 40%, transparent); color: var(--lucpac-warning); }
.k-notification-error { background: var(--lucpac-danger-bg); border-color: var(--lucpac-danger-border); color: var(--lucpac-danger); }

/* Icons given a ThemeColor (the notification bell's slide-out, alert badges) draw Kendo's stock colour
   for it; these are the brand's for the same meaning (2026-10-27). */
.k-svg-icon.k-color-primary,
.k-svg-icon.k-color-info { color: var(--lucpac-navy); }
.k-svg-icon.k-color-success { color: var(--lucpac-success); }
.k-svg-icon.k-color-warning { color: var(--lucpac-warning); }
.k-svg-icon.k-color-error { color: var(--lucpac-danger); }
