html {
    zoom: 1.1;
}

/* ────────────────────────────────────────────────────────────
   MOBILE FOUNDATION — design tokens + utilities + global rules
   Spec: docs/superpowers/specs/2026-05-29-customer-portal-mobile-design.md
   ──────────────────────────────────────────────────────────── */
:root {
    /* Mobile spacing */
    --cx-pad-page-m: 16px;
    --cx-pad-card-m: 14px;
    --cx-gap-m: 12px;

    /* Touch targets — Apple HIG / Material */
    --cx-touch: 44px;

    /* Radius */
    --cx-radius-m: 10px;

    /* Typography — mobile sizes */
    --cx-fs-h1-m: 22px;
    --cx-fs-h2-m: 18px;
    --cx-fs-body-m: 14px;

    /* Safe-area — iPhone notch / home-indicator */
    --cx-safe-top: env(safe-area-inset-top, 0px);
    --cx-safe-bottom: env(safe-area-inset-bottom, 0px);
    --cx-safe-left: env(safe-area-inset-left, 0px);
    --cx-safe-right: env(safe-area-inset-right, 0px);
}

/* Touch-target guarantee — usable at any breakpoint */
.cx-touch {
    min-height: var(--cx-touch);
    min-width: var(--cx-touch);
}

/* Visible only on phone */
.cx-show-m { display: none; }

@media (max-width: 599.98px) {
    /* Drop the desktop zoom so layouts use natural viewport units */
    html { zoom: 1 !important; }

    body { font-size: var(--cx-fs-body-m); }

    /* No horizontal page scroll — inner containers may scroll, the page may not */
    html, body { overflow-x: hidden; }

    /* MudBlazor dialogs become fullscreen */
    .mud-dialog-container .mud-dialog:not(.mud-dialog-fullscreen) {
        margin: 0;
        max-width: 100vw;
        width: 100vw;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 0;
    }

    /* Utility classes — phone behavior */
    .cx-stack-m {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .cx-hide-m { display: none !important; }
    .cx-full-m { width: 100% !important; }
    .cx-show-m { display: revert; }

    /* App-bar / drawer respect iPhone notch + home-indicator
       (these class names live in PortalMainLayout) */
    .portal-mobile-appbar { padding-top: var(--cx-safe-top); }
    .rail-foot            { padding-bottom: var(--cx-safe-bottom); }
}

html, body {
    font-family: 'Lato', sans-serif;
    margin: 0;
    padding: 0;
}

/* Customer Portal: Lato everywhere except icon fonts; cap font-weight at 300. */
body, body *:not(.mud-icon-default):not(.mud-icon-svg):not(.material-icons):not(i.mud-icon-root):not([class*="material-icons"]) {
    font-family: 'Lato', sans-serif !important;
}

*, *::before, *::after {
    font-weight: 400 !important;
}

/* Customer Portal license dialog: collapse the empty MudDialog title row
   (we use our own LicenseInfoBlock as header). The close-X stays at the
   top-right of the dialog because it's absolutely positioned.
   These rules live in global app.css because the dialog is rendered
   through MudBlazor's dialog portal — scoped CSS can't reach it.
   !important is needed: MudBlazor's `:has(.mud-button-close)` selector
   has higher specificity for padding-inline-end. */
.lic-dialog .mud-dialog-title {
    padding: 0 !important;
    min-height: 0 !important;
}
.lic-dialog .mud-dialog-title h6 {
    display: none !important;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9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MjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: #929292;
}

.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;
}

.truncate-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: clamp(2rem, 10vw, 20rem);
}
.responsive-table {
    table-layout: fixed;
    width: 100%;
}
.toolbar-filters {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.toolbar-filters .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: auto !important;
}

.toolbar-filters .mud-select {
    width: 220px !important;
}

/* ============================================================
   CRANEbee design tokens — consumed by the scoped CSS of the
   license-overview / users components (var(--cx-*) / var(--lic-*)).
   ============================================================ */
:root {
    --cx-midnight:      #293949;
    --cx-midnight-deep: #18212A;

    --cx-gray:          #F4F4F4;
    --cx-gray-2:        #B1BAC3;
    --cx-divider-soft:  #DDE3DD;

    --cx-yellow:        #D58936;
    --cx-yellow-dk:     #AA6E2B;
    --cx-yellow-lt:     #DDA15E;
    --cx-yellow-sub:    #FFE0B5;

    --cx-blue:          #0F8C8C;
    --cx-blue-dk:       #0A6868;
    --cx-blue-lt:       #3DAAA8;
    --cx-blue-sub:      #D3ECEC;

    --cx-red:           #C13F3F;

    --cx-text-1:        #293949;
    --cx-text-2:        rgba(41,57,73,0.70);
    --cx-text-3:        rgba(41,57,73,0.55);
    --cx-text-on-dark:  #F4F4F4;

    --cx-success:       #2e7d32;
    --cx-info:          #2196F3;
    --cx-warning:       #ED6C02;
    --cx-error:         #D32F2F;

    --lic-kauf:    var(--cx-success);
    --lic-miet:    #7B4FB8;
    --lic-demo:    var(--cx-yellow);
    --lic-sponsor: var(--cx-blue);
}

/* ============================================================
   AppTooltip — shared component (MudBlazorTemplates/AppTooltip).

   Pure-CSS tooltip via ::after on the trigger wrapper. We avoid
   MudBlazor's JS-positioned popover because the customer portal
   applies `html { zoom: 1.1 }`, which causes a proportional drift
   in the popover's computed top/left.

   The wrapper sits inside the same zoomed coordinate space as the
   tooltip pseudo-element, so the position stays exact regardless
   of where the trigger is on the page.
   ============================================================ */
.app-tooltip-wrap {
    position: relative;
}
/* AppTooltip renders a <span>; inline-block keeps the wrapper tight
   around the trigger (icon, chip) and doesn't disturb table cell sizing.
   Block-level elements that opt in via class="… app-tooltip-wrap"
   (e.g. .lic-stat) keep their own display value, so grid/flex layouts
   aren't affected. */
span.app-tooltip-wrap {
    display: inline-block;
    vertical-align: middle;
}
.app-tooltip-wrap::after {
    content: attr(data-app-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    /* scale(0) collapses the absolute box to 0×0 when not hovered,
       so it doesn't contribute to any ancestor's scroll/overflow area.
       transform-origin keeps the grow animation centered on the trigger. */
    transform: translateX(-50%) scale(0);
    transform-origin: bottom center;
    background: var(--cx-midnight, #293949);
    color: #fff;
    font-family: 'Lato', sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(41, 57, 73, 0.22);
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 220px;
    width: max-content;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease 0.15s, transform 0.15s ease 0.15s;
    z-index: 10000;
}
.app-tooltip-wrap:hover::after,
.app-tooltip-wrap:focus-within::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ── Placement: right ── */
.app-tooltip-wrap[data-app-tooltip-placement="right"]::after {
    bottom: auto;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) scale(0);
    transform-origin: center left;
}
.app-tooltip-wrap[data-app-tooltip-placement="right"]:hover::after,
.app-tooltip-wrap[data-app-tooltip-placement="right"]:focus-within::after {
    transform: translateY(-50%) scale(1);
}

/* ── Placement: left ── */
.app-tooltip-wrap[data-app-tooltip-placement="left"]::after {
    bottom: auto;
    left: auto;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) scale(0);
    transform-origin: center right;
}
.app-tooltip-wrap[data-app-tooltip-placement="left"]:hover::after,
.app-tooltip-wrap[data-app-tooltip-placement="left"]:focus-within::after {
    transform: translateY(-50%) scale(1);
}

/* ── Placement: bottom ── */
.app-tooltip-wrap[data-app-tooltip-placement="bottom"]::after {
    bottom: auto;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    transform-origin: top center;
}
.app-tooltip-wrap[data-app-tooltip-placement="bottom"]:hover::after,
.app-tooltip-wrap[data-app-tooltip-placement="bottom"]:focus-within::after {
    transform: translateX(-50%) scale(1);
}

/* Make sure pseudo-tooltips on triggers inside MudTable cells are
   not clipped by the table container's default overflow rules. */
.users-table .mud-table-container,
.users-table .mud-table-root {
    overflow: visible !important;
}
