/* ==========================================================================
   app.css — the console's shell and the few app-wide rules that are not
   MudBlazor's. Colour, type, shape and motion come from css/tokens.css (the
   design tokens, docs/DESIGN_SYSTEM.md, ADR-0013); the MudBlazor palette in
   App.razor carries the same values in MudBlazor's own slots. The whole app is
   in the token scope: <body class="tip-theme"> in index.html, so dialogs and
   popovers rendered at the body (MudDialogProvider, MudPopoverProvider)
   resolve the tokens too. No hex literal lives here any more.
   ========================================================================== */

html, body {
    font-family: var(--m3-font);
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

/* plain anchors outside MudBlazor components (rare) read the primary */
a {
    color: var(--m3-primary);
}

/* ---- Blazor's own chrome: the error bar, error boundary, the loading ring -------- */
#blazor-error-ui {
    color-scheme: light only;
    background: var(--m3-error-container);
    color: var(--m3-on-error-container);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA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M4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--m3-error);
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--m3-on-error);
}

    .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(--m3-surface-container-high);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--m3-primary);
            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: 600;
    color: var(--m3-on-surface-variant);
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

code {
    font-family: var(--m3-font-mono);
    color: var(--m3-tertiary);
}

/* Company picker dialog rows (ClubLayout) — hover feedback for the virtualized list. */
.tip-company-row:hover {
    background: color-mix(in srgb, var(--m3-on-surface) var(--m3-state-hover), transparent);
}

/* ---- MudBlazor on the tokens ------------------------------------------------------
   The palette in App.razor already carries the roles; these few rules are where
   MudBlazor's own CSS computes something the palette cannot express. */
/* a filled primary button lightens on hover (Fern) and deepens when pressed */
body .mud-button-filled.mud-button-filled-primary:hover { background-color: var(--m3-primary-hover); }
body .mud-button-filled.mud-button-filled-primary:active { background-color: var(--m3-primary-pressed); }
/* the tab indicator is the primary (no text-tone remap needed any more) */
body .mud-tab-slider { background: var(--m3-primary); }
/* keyboard focus is visible on every MudBlazor control */
body .mud-button-root:focus-visible,
body .mud-nav-link:focus-visible,
body .mud-chip:focus-visible { outline: 2px solid var(--m3-primary); outline-offset: 2px; }

/* ---- Console shell (ClubLayout / AdminLayout): one continuous chrome surface -----
   Top bar and sidebar share one tone with no dividing lines — an L-shaped frame — and
   the page content sits inside it as a lighter panel with a rounded top-left corner
   (the Google Cloud console arrangement, ADR-0012). The chrome tone is
   surface-container-high, the panel is surface; the theme's Drawer* / Background
   slots carry the same values. */
.tip-console .mud-main-content { background: var(--m3-surface-container-high); }
.tip-topbar {
    background: var(--m3-surface-container-high) !important;
    color: var(--m3-on-surface) !important;
    border: 0;
}
/* M3 top app bar (small): 64dp tall, 16dp side padding; toolbar content vertically centred. */
.tip-topbar .mud-toolbar { min-height: 64px; height: 64px; padding-left: 12px; padding-right: 16px; }
.tip-topbar .mud-button-root { margin-right: 0 !important; }
.tip-topbar-context {
    display: flex;
    align-items: center;
    margin-left: 12px;
    min-width: 0;
}
.tip-topbar-context .mud-input-control { min-width: 200px; }
.tip-topbar-context .mud-input-control .mud-input { background: var(--m3-surface-container-lowest); border-radius: var(--m3-radius-sm); }
.tip-topbar-context .mud-chip { background: var(--m3-surface-container-lowest); }
.tip-side { border: 0; }
/* Active navigation = colour only, no filled block (a block collides with the rounded
   panel corner beside it). Hover keeps a faint tint so the rows still feel clickable. */
.tip-side .mud-nav-link.active {
    background-color: transparent !important;
    color: var(--m3-primary) !important;
    font-weight: 600;
}
.tip-side .mud-nav-link.active .mud-nav-link-icon { color: var(--m3-primary) !important; }
.tip-side .mud-nav-link:hover { background-color: color-mix(in srgb, var(--m3-on-surface) var(--m3-state-hover), transparent) !important; }
.tip-side-foot {
    border-top: 1px solid color-mix(in srgb, var(--m3-outline-variant) 70%, transparent);
    padding: 12px 16px 12px;
}
.tip-console-panel {
    background: var(--m3-surface);
    border-top-left-radius: var(--m3-radius-xl);
    min-height: calc(100vh - var(--mud-appbar-height, 48px));
    padding: 0 8px;
}
/* Collapsed rail: section icons open a flyout with the section's pages (GCP pattern).
   MudMenu renders inline — force it to a full-width block so each section is one row. */
.tip-side .tip-rail-menu,
.tip-side .tip-rail-menu .mud-menu-activator { display: block !important; width: 100%; }
.tip-rail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    width: 44px;
    margin: 2px auto;
    cursor: pointer;
    color: var(--m3-on-surface);
    border-radius: var(--m3-radius-md);
    transition: background-color var(--m3-dur-short3) var(--m3-ease-standard);
}
.tip-rail-item:hover { background-color: color-mix(in srgb, var(--m3-on-surface) var(--m3-state-hover), transparent); }
.tip-rail-item.is-active { color: var(--m3-primary); }
.tip-rail-flyout-title {
    font: var(--m3-type-label-s) var(--m3-font);
    letter-spacing: var(--m3-tracking-label);
    text-transform: uppercase;
    color: var(--m3-on-surface-variant);
    padding: 8px 16px 4px;
}
.tip-rail-flyout-active { color: var(--m3-primary) !important; font-weight: 600; }

/* ---- task dialog: the searchable track field's options -------------------------------
   Colour dot · name · family. */
.tip-track-option { display: flex; width: 100%; align-items: center; gap: 8px; min-width: 0; }
.tip-track-option i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tip-track-option span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-track-option small { margin-left: auto; padding-left: 12px; font: var(--m3-type-label-s) var(--m3-font); font-weight: 400; color: var(--m3-on-surface-variant); white-space: nowrap; }

/* ---- task dialog: many pins ---------------------------------------------------------
   The pin chips under the map and the numbered pin icon the point picker draws. The pin
   colour is the tertiary — the intelligence accent that marks sensors and points. */
.tip-task-pins { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tip-task-pin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 4px 0 6px;
    border-radius: var(--m3-radius-full);
    border: 1px solid var(--m3-outline);
    font: var(--m3-type-body-s) var(--m3-font);
    font-size: 13px;
}
.tip-task-pin b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--m3-tertiary);
    color: var(--m3-on-tertiary);
    font: var(--m3-type-label-s) var(--m3-font);
    font-weight: 600;
}
.tip-task-pin input { width: 110px; border: 0; background: transparent; font: inherit; color: inherit; outline: none; }
.tip-task-pin input::placeholder { color: var(--m3-on-surface-variant); }
.tip-task-pin button { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 2px; display: inline-flex; cursor: pointer; color: var(--m3-on-surface-variant); }
.tip-task-pin button:hover { color: var(--m3-error); }
.tip-task-pin button .mud-icon-root { font-size: 16px; }
.tip-pick-pin span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--m3-tertiary);
    border: 2.5px solid var(--m3-surface-container-lowest);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color: var(--m3-on-tertiary);
    font: var(--m3-type-label-s) var(--m3-font);
    font-weight: 600;
    cursor: pointer;
}

/* The product mark (Layout/TipMark, DESIGN_SYSTEM.md §3.1): the shield, an inline svg in
   currentColor — sized here by height, the width follows the drawing's 175:185. On the
   console's light chrome it wears the primary; on the guest pages' brand-green bar it
   inherits the bar's white like the wordmark beside it, so no rule is needed there. */
.tip-mark { display: inline-block; height: 24px; aspect-ratio: 175 / 185; width: auto; flex: 0 0 auto; vertical-align: middle; }
.tip-product-logo { gap: 10px; }
.tip-product-logo .tip-mark { height: 28px; }
.tip-topbar .tip-product-logo .tip-mark { color: var(--m3-primary); }
.tip-ti-word { font: 600 18px/28px var(--m3-font-brand); letter-spacing: -.01em; white-space: nowrap; margin-left: 10px; }

/* ---- the user menu's Appearance row ------------------------------------------------
   One row like the items around it (icon · label), with a small icon segmented control
   at its end — auto · light · dark — drawn the way an OS draws one: a quiet track in the
   surface tone, the chosen segment a lifted thumb (surface-bright, level-1 shadow) with
   the icon in the primary. Icons only; the titles explain them on hover. */
.tip-appearance { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 16px 6px 16px; }
.tip-appearance-label { display: inline-flex; align-items: center; gap: 14px; font: var(--m3-type-body-m) var(--m3-font); font-size: 15px; color: var(--m3-on-surface); }
.tip-appearance-label .mud-icon-root { color: var(--m3-on-surface-variant); width: 22px; height: 22px; }
/* The segmented control — the house's shape for one-of-many (the Appearance row here, the
   intelligence page's List | Map, period and heat switches): a quiet track, the chosen
   segment a lifted thumb. Labels welcome; the Appearance row is the icon-only size. */
.tip-seg { display: inline-flex; padding: 2px; border-radius: var(--m3-radius-full); background: var(--m3-surface-container-high); }
.tip-seg button {
    appearance: none; -webkit-appearance: none; border: 0; margin: 0; height: 30px; padding: 0 12px;
    border-radius: var(--m3-radius-full); background: transparent; color: var(--m3-on-surface-variant);
    font: var(--m3-type-label-l) var(--m3-font); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    white-space: nowrap; cursor: pointer;
    transition: background-color var(--m3-dur-short3) var(--m3-ease-standard), color var(--m3-dur-short3) var(--m3-ease-standard);
}
.tip-seg button .mud-icon-root { width: 18px; height: 18px; }
.tip-seg button:hover { color: var(--m3-on-surface); }
.tip-seg button.is-on { background: var(--m3-surface-bright); color: var(--m3-primary); box-shadow: var(--m3-elev-1); }
.tip-seg button:focus-visible { outline: 2px solid var(--m3-primary); outline-offset: 1px; }
.tip-seg-mini button { height: 26px; padding: 0 10px; font: var(--m3-type-label-m) var(--m3-font); }
.tip-appearance .tip-seg button { width: 34px; height: 26px; padding: 0; }
