html, body, .mud-typography {
    font-family: "Inter", system-ui, -apple-system, sans-serif !important;
}

/* =====================================================================
   ZeloHUB Design System - global tokens & helper classes
   ---------------------------------------------------------------------
   - The --zhub-* custom properties mirror DesignTokens.cs (keep in sync).
   - Helper classes reference MudBlazor palette variables (--mud-palette-*)
     so they automatically adapt to light/dark mode without overrides.
   - Use these helpers in components/pages instead of inline styling.
   ===================================================================== */

/* ── Typography fine-tuning ─────────────────────────────────────────────
   Inter loaded via Google Fonts in App.razor.
   These settings match how CoreUI renders with system fonts on each OS:
   - tnum: tabular numerals (dashboard KPI values align in columns)
   - calt: contextual alternates (cleaner joins in menus/breadcrumbs)
   ────────────────────────────────────────────────────────────────────── */
:root {
    font-feature-settings: "calt" 1, "tnum" 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Tabular nums only where KPI values are displayed */
.app-stat-card__value,
.zhub-metric__value {
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

:root {
    /* Layout */
    --zhub-drawer-width: 256px;
    --zhub-drawer-mini-width: 64px;
    --zhub-topbar-height: 64px;
    --zhub-subbar-height: 48px;
    --zhub-footer-height: 48px;

    /* Spacing scale */
    --zhub-space-xs: 0.25rem;
    --zhub-space-sm: 0.5rem;
    --zhub-space-md: 1rem;
    --zhub-space-lg: 1.5rem;
    --zhub-space-xl: 2rem;

    /* Semantic spacing */
    --zhub-page-padding: 1.5rem;
    --zhub-card-padding: 1.25rem;
    --zhub-section-gap: 1.5rem;

    /* Corner radius */
    --zhub-radius: 0.375rem;
    --zhub-radius-lg: 0.5rem;

    /* Border shorthand driven by the active Mud palette */
    --zhub-border: 1px solid var(--mud-palette-lines-default);
}

/* ---------- Layout helpers ---------- */

.zhub-page {
    padding: var(--zhub-page-padding);
    background-color: var(--mud-palette-background);
    min-height: calc(100vh - var(--zhub-topbar-height));
}

/* Vertical rhythm between stacked sections/cards */
.zhub-section + .zhub-section {
    margin-top: var(--zhub-section-gap);
}

.zhub-stack > * + * {
    margin-top: var(--zhub-section-gap);
}

/* ---------- Card / surface helpers ---------- */

.zhub-card {
    background-color: var(--mud-palette-surface);
    border: var(--zhub-border);
    border-radius: var(--zhub-radius);
    overflow: hidden;
    /* CoreUI cards are flat with a barely-there lift */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zhub-card-header {
    padding: 0.75rem var(--zhub-card-padding);
    border-bottom: var(--zhub-border);
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.zhub-card-body {
    padding: var(--zhub-card-padding);
}

.zhub-card-footer {
    padding: 0.75rem var(--zhub-card-padding);
    border-top: var(--zhub-border);
}

/* ---------- Text helpers ---------- */

.zhub-text-muted {
    color: var(--mud-palette-text-secondary);
}

.zhub-text-strong {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.zhub-text-small {
    font-size: 0.75rem;
}

/* ---------- Metric block (CoreUI "border-start" accent) ---------- */

.zhub-metric {
    padding: 0.25rem 0.75rem;
    border-left: 4px solid var(--mud-palette-lines-default);
}

.zhub-metric--primary { border-left-color: var(--mud-palette-primary); }
.zhub-metric--info    { border-left-color: var(--mud-palette-info); }
.zhub-metric--success { border-left-color: var(--mud-palette-success); }
.zhub-metric--warning { border-left-color: var(--mud-palette-warning); }
.zhub-metric--danger  { border-left-color: var(--mud-palette-error); }

.zhub-metric__label {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

.zhub-metric__value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

/* ---------- Colored stat widget (top dashboard KPIs) ---------- */

.zhub-stat {
    color: #fff;
    border-radius: var(--zhub-radius);
    padding: 1rem 1rem 0.6rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 148px;
}

.zhub-stat--primary { background-color: var(--mud-palette-primary); }
.zhub-stat--info    { background-color: var(--mud-palette-info); }
.zhub-stat--warning { background-color: var(--mud-palette-warning); }
.zhub-stat--danger  { background-color: var(--mud-palette-error); }
.zhub-stat--success { background-color: var(--mud-palette-success); }

/* =====================================================================
   App shell – sidebar, drawer, nav items, topbar.
   These target MudBlazor-generated DOM classes so they live here
   in the global sheet (Blazor CSS isolation cannot reach child internals).
   ===================================================================== */

/* ── Sidebar container ──────────────────────────────────────────────── */

.app-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Drawer background is set by MudTheme DrawerBackground;
       the sidebar content inherits it. */
}

/* ── Brand / logo header ────────────────────────────────────────────── */

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
    height: var(--zhub-topbar-height);
    padding: 0 1rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    background-color: #212631;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: opacity 0.15s;
}

.app-sidebar__brand:hover { opacity: 0.88; }

.app-sidebar__brand-icon {
    /* accent the hub icon with the info/blue token */
    color: var(--mud-palette-info) !important;
    font-size: 1.5rem !important;
    flex-shrink: 0;
}

/* ── Scrollable nav area ────────────────────────────────────────────── */

.app-sidebar__scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* thin custom scrollbar on WebKit */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.app-sidebar__scroll::-webkit-scrollbar { width: 4px; }
.app-sidebar__scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
}

.app-sidebar__menu {
    padding: 0.375rem 0 1rem;
}

/* ── Section captions  (TEMA / COMPONENTES / EXTRAS) ───────────────── */

.app-nav-section {
    margin: 0.75rem 0 0.25rem;
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    user-select: none;
}

/* ── Top-level nav links ────────────────────────────────────────────── */

/* All MudNavLink inside the drawer: base colors */
.app-drawer .mud-nav-link {
    color: rgba(255, 255, 255, 0.72);
    border-radius: 0 !important;   /* flat, full-width like CoreUI */
    transition: background-color 0.12s, color 0.12s;
    position: relative;
    /* CoreUI nav-link rhythm: padding-y 0.8445rem → ~46px tall row */
    min-height: 46px;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    font-size: 0.875rem;
}

.app-drawer .mud-nav-link .mud-nav-link-icon {
    color: rgba(255, 255, 255, 0.72);
    transition: color 0.12s;
    /* Fixed icon gutter so labels align in a column (CoreUI feel) */
    font-size: 1.25rem !important;
    min-width: 1.25rem;
    margin-right: 0.9rem;
}

/* Hover */
.app-drawer .mud-nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    background-color: #2A303D;
}

.app-drawer .mud-nav-link:hover .mud-nav-link-icon {
    color: rgba(255, 255, 255, 0.95);
}

/* Active – CoreUI's left accent line */
.app-drawer .mud-nav-link.active,
.app-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) {
    color: var(--mud-palette-primary-text) !important;
    --mud-ripple-color: var(--mud-palette-primary-text);
    background-color: rgba(255, 255, 255, 0.09);
}

.app-drawer .mud-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--mud-palette-info);
    border-radius: 0 2px 2px 0;
}

.app-drawer .mud-nav-link.active .mud-nav-link-icon,
.app-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-icon {
    color: var(--mud-palette-primary-text) !important;
}

/* ── Nav groups (collapsible) ───────────────────────────────────────── */

/* Group header row */
.app-drawer .mud-nav-group > button,
.app-drawer .mud-nav-group-header {
    color: rgba(255, 255, 255, 0.72) !important;
    transition: background-color 0.12s, color 0.12s;
    border-radius: 0 !important;
    position: relative;
    /* Match the leaf nav-link height for a consistent column */
    min-height: 46px;
    font-size: 0.875rem;
}

.app-drawer .mud-nav-group .mud-nav-group-icon {
    font-size: 1.25rem !important;
    min-width: 1.25rem;
    margin-right: 0.9rem;
}

.app-drawer .mud-nav-group > button:hover,
.app-drawer .mud-nav-group-header:hover {
    color: rgba(255, 255, 255, 0.95) !important;
    background-color: #2A303D !important;
}

/* Group header icon */
.app-drawer .mud-nav-group .mud-nav-group-icon {
    color: rgba(255, 255, 255, 0.72);
}

/* Expand/collapse chevron */
.app-drawer .mud-nav-group-expand-icon {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* ── Child items (indented, bullet instead of icon) ─────────────────── */

.app-drawer .app-nav-item--child.mud-nav-link {
    /* extra left padding to clear the group icon gutter */
    padding-left: 3.5rem !important;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.65);
}

/* CSS bullet replaces the missing icon */
.app-drawer .app-nav-item--child.mud-nav-link::after {
    content: "";
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.35);
    transition: background-color 0.12s;
}

.app-drawer .app-nav-item--child.mud-nav-link:hover::after,
.app-drawer .app-nav-item--child.mud-nav-link.active::after {
    background-color: var(--mud-palette-info);
}

.app-drawer .app-nav-item--child.mud-nav-link.active,
.app-drawer .app-nav-item--child.mud-nav-link.active:not(.mud-nav-link-disabled) {
    color: var(--mud-palette-primary-text) !important;
    background-color: rgba(255, 255, 255, 0.06);
}

.app-drawer .app-nav-item--child.mud-nav-link.active::before {
    /* no left bar on child items – bullet is enough */
    display: none;
}

/* ── Badge chips on nav items ───────────────────────────────────────── */

.app-nav-item__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    width: 100%;
}

.app-nav-item__badge {
    height: 17px !important;
    min-height: 17px !important;
    font-size: 0.6rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    padding: 0 0.35rem !important;
}

/* ── Top app-bar shell ──────────────────────────────────────────────── */

.app-appbar {
    border-bottom: var(--zhub-border);
    /* AppbarBackground + AppbarText come from the MudTheme palette */
}

/* ── Left zone: toggle + brand (mobile) + breadcrumbs ──────────────── */

.app-topbar__left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;   /* prevent flex overflow */
}

.app-topbar__toggle {
    flex-shrink: 0;
}

.app-topbar__brand {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 1rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    margin-left: 0.125rem;
}

.app-topbar__breadcrumbs {
    /* truncate if the viewport is too narrow */
    overflow: hidden;
    white-space: nowrap;
}

/* Inactive / ancestor breadcrumb links use the muted text token */
.app-topbar__breadcrumbs .mud-breadcrumb-item:not(:last-child) .mud-link,
.app-topbar__breadcrumbs .mud-breadcrumb-separator {
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
}

/* Current page crumb (last, disabled) */
.app-topbar__breadcrumbs .mud-breadcrumb-item:last-child {
    color: var(--mud-palette-text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ── Right zone: action buttons ─────────────────────────────────────── */

.app-topbar__actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.app-topbar__action-btn {
    /* Slightly smaller tap target than default to keep the bar lean */
    width: 38px !important;
    height: 38px !important;
}

/* Notification badge positioning fix */
.app-topbar__badge {
    display: inline-flex;
    align-items: center;
}

/* ── Vertical rule ───────────────────────────────────────────────────── */

.app-topbar__vr {
    width: 1px;
    height: 22px;
    background-color: var(--mud-palette-lines-default);
    margin: 0 0.375rem;
    flex-shrink: 0;
}

/* ── User trigger button ─────────────────────────────────────────────── */

.app-topbar__user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--zhub-radius);
    cursor: pointer;
    color: inherit;
    transition: background-color 0.15s;
}

.app-topbar__user-trigger:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.app-topbar__avatar {
    flex-shrink: 0;
}

.app-topbar__user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.app-topbar__user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

.app-topbar__user-role {
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.app-topbar__user-chevron {
    color: var(--mud-palette-text-secondary) !important;
    font-size: 1rem !important;
}

/* ── User menu popover ───────────────────────────────────────────────── */

.app-topbar__user-popover {
    min-width: 200px;
}

/* Header row inside the dropdown (avatar + name/role) */
.app-topbar__menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.625rem;
}

.app-topbar__menu-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.app-topbar__menu-header-text strong {
    font-size: 0.875rem;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

.app-topbar__menu-header-text small {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

/* Logout item in red */
.app-topbar__logout {
    color: var(--mud-palette-error) !important;
}

/* =====================================================================
   Reusable app components (page headers, cards, tables, states)
   ===================================================================== */

.app-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--zhub-space-md);
    margin-bottom: var(--zhub-section-gap);
}

.app-page-header__main {
    display: flex;
    flex-direction: column;
    gap: var(--zhub-space-xs);
    min-width: 0;
}

.app-page-header__overline {
    color: var(--mud-palette-text-secondary);
}

.app-page-header__title {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.app-page-header__subtitle {
    color: var(--mud-palette-text-secondary);
}

.app-page-header__actions {
    display: flex;
    align-items: center;
    gap: var(--zhub-space-sm);
    flex-wrap: wrap;
}

.app-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--zhub-space-md);
    margin-bottom: var(--zhub-space-sm);
}

.app-section-header__title {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.app-section-header__subtitle {
    color: var(--mud-palette-text-secondary);
}

.app-section-header__actions {
    display: flex;
    align-items: center;
    gap: var(--zhub-space-sm);
}

.app-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--zhub-space-sm);
}

.app-card__header-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-card__title {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.app-card__subtitle {
    color: var(--mud-palette-text-secondary);
}

.app-card__header-actions {
    display: flex;
    align-items: center;
    gap: var(--zhub-space-xs);
}

.app-stat-card__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 148px;
}

.app-stat-card__title {
    opacity: 0.94;
}

.app-stat-card__value {
    color: #fff;
    margin-top: var(--zhub-space-xs);
    font-weight: 700;
    font-size: 1.3125rem;
    line-height: 1.2;
}

.app-stat-card__trend {
    margin-top: 0.2rem;
}

.app-stat-card__trend--up {
    color: rgba(255, 255, 255, 0.95);
}

.app-stat-card__trend--down {
    color: rgba(255, 255, 255, 0.92);
}

.app-stat-card__trend--neutral {
    color: rgba(255, 255, 255, 0.85);
}

.app-stat-card__extra {
    margin-top: var(--zhub-space-sm);
}

.app-table-container__toolbar {
    padding: 0 0 var(--zhub-space-sm);
    border-bottom: var(--zhub-border);
    margin-bottom: var(--zhub-space-sm);
}

.app-table-container__table-wrap {
    overflow-x: auto;
}

.app-table-container__table {
    min-width: 640px;
}

/* ── AppDataTable: action column pinned left ─────────────────────────── */
.app-data-table {
    width: 100%;
}

.app-data-table__actions-header,
.app-data-table__actions-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
    background-color: var(--mud-palette-surface);
    box-shadow: 2px 0 6px -4px rgba(15, 23, 42, 0.18);
}

.app-data-table thead .app-data-table__actions-header {
    z-index: 3;
    background-color: var(--mud-palette-table-lines);
}

.app-data-table .mud-table-row:hover .app-data-table__actions-cell {
    background-color: var(--mud-palette-table-hover);
}

.app-data-table__actions-header {
    font-weight: 600;
    text-align: left;
}

.app-data-table__actions {
    min-height: 2rem;
    gap: 0.125rem;
}

.app-status-badge {
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}

.app-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: calc(var(--zhub-space-xl) + var(--zhub-space-sm));
    border: var(--zhub-border);
    border-radius: var(--zhub-radius);
    background-color: var(--mud-palette-surface);
    gap: var(--zhub-space-sm);
}

.app-empty-state__icon {
    font-size: 2.5rem !important;
    color: var(--mud-palette-text-secondary);
    opacity: 0.8;
}

.app-empty-state__title {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.app-empty-state__description {
    color: var(--mud-palette-text-secondary);
    max-width: 38rem;
}

.app-empty-state__actions {
    margin-top: var(--zhub-space-sm);
    display: flex;
    gap: var(--zhub-space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.app-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--zhub-space-sm);
    flex-wrap: wrap;
}

.app-action-bar__left,
.app-action-bar__right {
    display: flex;
    align-items: center;
    gap: var(--zhub-space-sm);
    flex-wrap: wrap;
}

.app-confirm-dialog__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--zhub-space-sm);
    max-width: 34rem;
}

.app-confirm-dialog__icon {
    color: var(--mud-palette-warning);
    font-size: 1.5rem !important;
}

.app-confirm-dialog__title {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
}

.app-confirm-dialog__message {
    color: var(--mud-palette-text-secondary);
}

.app-client-delete-dialog__content {
    max-width: 34rem;
}

.app-client-delete-dialog__lead {
    color: var(--mud-palette-text-primary);
}

.app-client-delete-dialog__option {
    border-color: var(--mud-palette-lines-default) !important;
    background-color: var(--mud-palette-surface);
}

.app-client-delete-dialog .mud-dialog-actions {
    flex-wrap: wrap;
    gap: var(--zhub-space-xs);
    justify-content: flex-end;
}

.app-loading-state {
    display: flex;
    flex-direction: column;
    gap: var(--zhub-space-sm);
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.app-loading-state__message {
    color: var(--mud-palette-text-secondary);
}

@media (max-width: 959.95px) {
    .app-page-header,
    .app-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .app-page-header__actions,
    .app-section-header__actions {
        justify-content: flex-start;
    }
}

/* ── Client form – logo upload section ─────────────────────────────────── */

.client-logo-section {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--zhub-radius);
    background: var(--mud-palette-background-grey, #f8f9fa);
}

.client-logo-preview {
    position: relative;
    flex-shrink: 0;
}

.client-logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--zhub-radius);
    border: 1px solid var(--mud-palette-lines-default);
    background: #fff;
    display: block;
}

.client-logo-remove {
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18) !important;
}

.client-logo-empty {
    width: 80px;
    height: 80px;
    border-radius: var(--zhub-radius);
    border: 2px dashed var(--mud-palette-lines-default);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--mud-palette-surface);
}

.client-logo-upload-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-log-ocorrencia-dialog__relevante {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    background: var(--mud-palette-success);
    color: var(--mud-palette-success-text, #fff);
}

.login-log-ocorrencia-dialog__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-log-ocorrencia-dialog__list {
    max-height: 320px;
    overflow-y: auto;
}

.login-log-ocorrencia-dialog__item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.login-log-ocorrencia-dialog__item:hover {
    background: var(--mud-palette-action-default-hover);
}

.login-log-ocorrencia-dialog__item--selected {
    border-color: var(--mud-palette-primary) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
}

.login-log-ocorrencia-dialog__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.login-log-ocorrencia-dialog__option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Public layout (tenant access entry / login) ───────────────────────── */
.public-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--mud-palette-background-grey, #f4f5f7);
}

.public-layout__content {
    width: 100%;
    max-width: 420px;
}

.public-layout__content--cartao {
    max-width: 700px;
}

.public-layout__content--cartao .zelo-card-result-viewer__frame {
    min-height: min(75vh, 720px);
    height: min(75vh, 720px);
}

.access-entry-card {
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.access-entry-cpf {
    width: 100%;
}

/* ── Portal – tenant access page (state machine) ─────────────────────────── */

.portal-card {
    background: var(--mud-palette-surface);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10);
    padding: 2rem;
    width: 100%;
}

.portal-card__header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.portal-card__header--centered {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.portal-card__header-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.portal-card__logo--centered,
.portal-card__logo-img--centered {
    margin-inline: auto;
}

.portal-section-title--centered {
    text-align: center;
    width: 100%;
}

.portal-card__logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-card__logo-img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    flex-shrink: 0;
}

.portal-card__tenant {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--mud-palette-text-primary);
    line-height: 1.2;
}

.portal-card__subtitle {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

.portal-section-title {
    color: var(--mud-palette-text-primary) !important;
    font-weight: 600 !important;
}

.portal-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.portal-form-field__label {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

.portal-form-field__input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.875rem 0.75rem;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--mud-default-borderradius, 4px);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
}

.portal-form-field__input:focus {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 1px;
    border-color: var(--mud-palette-primary);
}

.portal-form-field__input--uppercase {
    text-transform: uppercase;
}

.portal-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

.portal-error {
    text-align: center;
}

/* User info strip above CPF search */
.portal-user-info {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.portal-user-divider {
    margin: 0 0.125rem;
    color: var(--mud-palette-lines-default);
}

.portal-logout-link:hover {
    color: var(--mud-palette-primary) !important;
    text-decoration: underline;
}

.portal-company-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
}

.portal-company-info__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.portal-company-info__label {
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
}

.portal-company-info__value {
    color: var(--mud-palette-text-primary);
}

.portal-company-info__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* Zelo API carteirinha result viewer */
.zelo-card-result-viewer__frame {
    display: block;
    width: 100%;
    min-height: min(70vh, 640px);
    height: min(70vh, 640px);
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.zelo-card-result-viewer__text {
    max-height: min(50vh, 480px);
    overflow: auto;
}

.zelo-cartao-dialog__html {
    width: 100%;
    max-height: min(70vh, 640px);
    overflow: auto;
    border-radius: 8px;
    background: #fff;
}

/* Actions row (back + print) */
.portal-card-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ── Member card (carteirinha) ────────────────────────────────────────────── */

.member-card {
    border: 2px solid var(--mud-palette-primary);
    border-radius: 12px;
    overflow: hidden;
    background: var(--mud-palette-surface);
}

.member-card__header {
    background: var(--mud-palette-primary);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.member-card__logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.member-card__org {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
}

.member-card__label {
    font-size: 0.6875rem;
    opacity: 0.8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.member-card__body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.member-card__field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.member-card__field-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-secondary);
}

.member-card__field-value {
    font-size: 0.9375rem;
    color: var(--mud-palette-text-primary);
    font-weight: 500;
}

.member-card__mono {
    font-family: "Roboto Mono", ui-monospace, monospace;
    letter-spacing: 0.04em;
}

.member-card__footer {
    padding: 0.625rem 1.25rem;
    background: var(--mud-palette-background-grey, #f4f5f7);
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
    text-align: right;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* ── Print styles ─────────────────────────────────────────────────────────── */

@media print {
    .portal-card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .portal-card__header,
    .portal-user-info,
    .portal-card-actions,
    .portal-section-title,
    .mud-button,
    .mud-text-field {
        display: none !important;
    }

    .member-card {
        border: 2px solid #000;
        break-inside: avoid;
    }

    .member-card__header {
        background: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
