.ai-chat-modal {
    /* colour — cool anchor ≈ hue 230, OKLCH throughout */
    --ai-paper: oklch(98.6% 0.004 230);
    --ai-paper-2: oklch(96.8% 0.007 230);
    --ai-paper-3: oklch(94% 0.011 230);
    --ai-ink: oklch(22% 0.025 250);
    --ai-ink-2: oklch(34% 0.022 248);
    --ai-neutral: oklch(46% 0.018 242);
    --ai-muted: oklch(52% 0.02 238);
    --ai-rule: oklch(90.5% 0.009 235);
    --ai-rule-2: oklch(80% 0.014 233);
    --ai-ink-surface: oklch(28% 0.035 250);
    --ai-accent: oklch(55% 0.105 215);
    --ai-accent-deep: oklch(46% 0.095 218);
    --ai-accent-ink: oklch(99% 0.002 220);
    --ai-accent-soft: oklch(94.5% 0.028 210);
    --ai-focus: oklch(55% 0.105 215);
    --ai-error: oklch(50% 0.185 27);
    --ai-error-soft: oklch(96.5% 0.018 25);
    --ai-error-rule: oklch(86% 0.06 25);
    --ai-warning-ink: oklch(48% 0.105 70);
    --ai-warning-soft: oklch(97% 0.022 85);
    --ai-warning-rule: oklch(86% 0.07 85);
    --ai-info-soft: oklch(96.8% 0.014 235);
    --ai-info-rule: oklch(86% 0.045 235);
    --ai-xlsx-ink: oklch(45% 0.12 152);
    --ai-xlsx-soft: oklch(95% 0.035 152);
    --ai-ppt-ink: oklch(50% 0.13 50);
    --ai-ppt-soft: oklch(95.5% 0.03 60);

    /* type — system-native on purpose: intranet users, CJK coverage, app parity */
    --ai-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
        Arial, sans-serif;
    --ai-font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas,
        "Liberation Mono", monospace;
    --ai-text-xs: 12px;
    --ai-text-sm: 13px;
    --ai-text-md: 14px;
    --ai-text-base: 16px;
    --ai-text-display: 24px;

    /* space — 4pt scale */
    --ai-space-2xs: 4px;
    --ai-space-xs: 8px;
    --ai-space-sm: 12px;
    --ai-space-md: 16px;
    --ai-space-lg: 24px;
    --ai-space-xl: 32px;

    /* shape */
    --ai-radius-tile: 12px;
    --ai-radius-btn: 12px;
    --ai-radius-chip: 12px;
    --ai-radius-card: 16px;
    --ai-radius-field: 16px;
    --ai-radius-bubble: 18px;
    --ai-radius-tail: 6px;
    --ai-radius-full: 999px;

    /* motion */
    --ai-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ai-ease-in: cubic-bezier(0.7, 0, 0.84, 0);
    --ai-dur-micro: 120ms;
    --ai-dur-short: 200ms;
    --ai-dur-med: 240ms;

    /* elevation */
    --ai-shadow-card: 0 1px 2px oklch(20% 0.02 240 / 0.05);
    --ai-shadow-modal: 0 24px 70px oklch(18% 0.03 245 / 0.24);
    --ai-ring: 0 0 0 2px var(--ai-paper), 0 0 0 4px var(--ai-focus);
}

.ai-chat-entry {
    position: fixed;
    top: var(--ai-chat-entry-y);
    left: var(--ai-chat-entry-x);
    width: 88px;
    z-index: 1100;
    touch-action: none;
    --ai-chat-tooltip-surface: #111827;
    --ai-chat-tooltip-ink: #f8fafc;
    --ai-chat-tooltip-muted: #cbd5e1;
    --ai-chat-tooltip-accent: #67e8f9;
    --ai-chat-tooltip-accent-strong: #22d3ee;
    --ai-chat-tooltip-cyan-soft: rgba(34, 211, 238, 0.34);
    --ai-chat-tooltip-violet-soft: rgba(139, 92, 246, 0.42);
    --ai-chat-tooltip-border: rgba(129, 140, 248, 0.34);
    --ai-chat-tooltip-control: rgba(255, 255, 255, 0.08);
    --ai-chat-tooltip-control-hover: rgba(255, 255, 255, 0.16);
    --ai-chat-tooltip-rule: rgba(255, 255, 255, 0.1);
    --ai-chat-tooltip-shadow: rgba(15, 23, 42, 0.32);
    --ai-chat-tooltip-focus: rgba(103, 232, 249, 0.72);
}

.ai-chat-tooltip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 13px);
    isolation: isolate;
    width: min(300px, calc(100vw - 48px));
    color: var(--ai-chat-tooltip-ink);
    background:
        radial-gradient(
            circle at 16% -22%,
            var(--ai-chat-tooltip-cyan-soft),
            transparent 43%
        ),
        radial-gradient(
            circle at 92% 118%,
            var(--ai-chat-tooltip-violet-soft),
            transparent 48%
        ),
        var(--ai-chat-tooltip-surface);
    border: 1px solid var(--ai-chat-tooltip-border);
    border-radius: 20px 20px 7px 20px;
    box-shadow: 0 20px 46px var(--ai-chat-tooltip-shadow);
    transform-origin: calc(100% - 28px) 100%;
    animation: ai-chat-tooltip-enter 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.ai-chat-tooltip::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20px;
    z-index: 0;
    width: 82px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--ai-chat-tooltip-accent),
        transparent
    );
    opacity: 0.8;
}

.ai-chat-tooltip::after {
    content: '';
    position: absolute;
    right: 22px;
    bottom: -9px;
    z-index: 0;
    width: 18px;
    height: 18px;
    border-right: 1px solid var(--ai-chat-tooltip-border);
    border-bottom: 1px solid var(--ai-chat-tooltip-border);
    background: var(--ai-chat-tooltip-surface);
    transform: rotate(45deg);
}

.ai-chat-tooltip:hover {
    transform: translateY(-2px);
}

.ai-chat-tooltip-content,
.ai-chat-tooltip-close {
    position: relative;
    z-index: 1;
    border: 0;
    color: inherit;
    font: inherit;
}

.ai-chat-tooltip-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 44px 16px 19px;
    border-radius: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.ai-chat-tooltip-close {
    position: absolute;
    top: 11px;
    right: 11px;
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    color: var(--ai-chat-tooltip-muted);
    background: var(--ai-chat-tooltip-control);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.ai-chat-tooltip-close:hover {
    color: var(--ai-chat-tooltip-ink);
    background: var(--ai-chat-tooltip-control-hover);
}

.ai-chat-tooltip-close:active {
    transform: scale(0.92);
}

.ai-chat-tooltip-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--ai-chat-tooltip-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.ai-chat-tooltip-status {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ai-chat-tooltip-accent-strong);
    box-shadow: 0 0 13px var(--ai-chat-tooltip-accent-strong);
    animation: ai-chat-tooltip-pulse 2.4s ease-in-out infinite;
}

.ai-chat-tooltip-headline {
    max-width: 225px;
    color: var(--ai-chat-tooltip-ink);
    font-size: 16px;
    font-weight: 750;
    line-height: 1.22;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.ai-chat-tooltip-copy {
    margin-top: 7px;
    color: var(--ai-chat-tooltip-muted);
    font-size: 12px;
    line-height: 1.5;
}

.ai-chat-tooltip-action {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid var(--ai-chat-tooltip-rule);
    color: var(--ai-chat-tooltip-accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.ai-chat-tooltip-action > span {
    font-size: 14px;
    transition: transform 160ms ease;
}

.ai-chat-tooltip-content:hover .ai-chat-tooltip-action > span {
    transform: translate(2px, -2px);
}

.ai-chat-tooltip-content:active {
    transform: translateY(1px);
}

.ai-chat-tooltip-content:disabled,
.ai-chat-tooltip-close:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.ai-chat-tooltip-content:focus-visible,
.ai-chat-tooltip-close:focus-visible {
    outline: 2px solid var(--ai-chat-tooltip-focus);
    outline-offset: 3px;
}

.ai-chat-launcher {
    width: 88px;
    height: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: grab;
    touch-action: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.ai-chat-launcher:active {
    cursor: grabbing;
}

.ai-chat-launcher:hover,
.ai-chat-launcher:focus-visible {
    transform: translateY(-2px) scale(1.04);
}

.ai-chat-launcher:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.ai-chat-launcher-wrap {
    position: relative;
    width: 88px;
    height: 88px;
}

.ai-chat-launcher-dismiss {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 1;
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 50%;
    color: #334155;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
}

.ai-chat-launcher-dismiss:hover {
    background: #f1f5f9;
    transform: scale(1.08);
}

.ai-chat-launcher-dismiss:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.65);
    outline-offset: 2px;
}

/* ------------------------------------------------------------ modal shell */

.ai-chat-modal.modal {
    pointer-events: none;
}

.ai-chat-modal .modal-dialog {
    position: fixed;
    top: var(--ai-chat-y, 0px);
    left: var(--ai-chat-x, 0px);
    width: var(--ai-chat-width, 640px);
    height: var(--ai-chat-height, 760px);
    max-width: none;
    max-height: none;
    margin: 0;
    pointer-events: auto;
}

.ai-chat-modal.is-maximized .modal-dialog {
    top: 0;
    left: 0;
    width: 100vw;
    /* dvh keeps the composer inside the visible screen where the browser UI
       makes vh taller than what is on show (mobile / TV Chrome). */
    height: 100vh;
    height: 100dvh;
}

.ai-chat-modal .modal-content {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    color: var(--ai-chat-ink, var(--ai-ink));
    background: var(--ai-paper);
    box-shadow: var(--ai-shadow-modal);
    font-family: var(--ai-font-ui);
}

/* ---------------------------------------------------------------- header */

.ai-chat-modal .modal-header {
    align-items: center;
    gap: var(--ai-space-sm);
    padding: var(--ai-space-sm) var(--ai-space-md);
    border-bottom: 1px solid var(--ai-rule);
    background: var(--ai-paper);
    cursor: move;
    touch-action: none;
    user-select: none;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: var(--ai-space-sm);
    margin: 0;
}

.ai-chat-title-icon,
.ai-chat-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-chat-title-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: var(--ai-radius-tile);
}

.ai-chat-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ai-chat-title-name {
    min-width: 0;
    color: var(--ai-ink);
    font-size: var(--ai-text-base);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ai-chat-title-sub {
    color: var(--ai-muted);
    font-size: var(--ai-text-xs);
    font-weight: 500;
    line-height: 1.3;
}

.ai-chat-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--ai-space-2xs);
    cursor: default;
}

.ai-chat-window-control,
.ai-chat-clear,
.ai-chat-close {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: var(--ai-neutral);
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    transition: color var(--ai-dur-micro) var(--ai-ease-out),
        background-color var(--ai-dur-micro) var(--ai-ease-out);
}

/* expand the touch target to 44px without growing the visual */
.ai-chat-window-control::before,
.ai-chat-clear::before,
.ai-chat-close::before {
    content: '';
    position: absolute;
    inset: -4px;
}

.ai-chat-close:hover,
.ai-chat-close.is-hover,
.ai-chat-window-control:hover,
.ai-chat-window-control.is-hover {
    color: var(--ai-ink);
    background: var(--ai-paper-3);
}

.ai-chat-clear:hover:not(:disabled),
.ai-chat-clear.is-hover {
    color: var(--ai-error);
    background: var(--ai-error-soft);
}

.ai-chat-clear:active:not(:disabled),
.ai-chat-close:active,
.ai-chat-window-control:active {
    transform: translateY(1px);
}

.ai-chat-clear:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ai-chat-clear:focus-visible,
.ai-chat-close:focus-visible,
.ai-chat-window-control:focus-visible {
    outline: 2px solid var(--ai-focus);
    outline-offset: 2px;
}

.ai-chat-resize-handle {
    position: absolute;
    z-index: 2;
    pointer-events: auto;
}

.ai-chat-resize-handle--n,
.ai-chat-resize-handle--s {
    right: 10px;
    left: 10px;
    height: 10px;
}

.ai-chat-resize-handle--n {
    top: 0;
    cursor: ns-resize;
}

.ai-chat-resize-handle--s {
    bottom: 0;
    cursor: ns-resize;
}

.ai-chat-resize-handle--e,
.ai-chat-resize-handle--w {
    top: 10px;
    bottom: 10px;
    width: 10px;
}

.ai-chat-resize-handle--e {
    right: 0;
    cursor: ew-resize;
}

.ai-chat-resize-handle--w {
    left: 0;
    cursor: ew-resize;
}

.ai-chat-resize-handle--ne,
.ai-chat-resize-handle--se,
.ai-chat-resize-handle--sw,
.ai-chat-resize-handle--nw {
    width: 14px;
    height: 14px;
}

.ai-chat-resize-handle--ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.ai-chat-resize-handle--se {
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
}

.ai-chat-resize-handle--sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.ai-chat-resize-handle--nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

/* ------------------------------------------------------------------ body */

.ai-chat-body {
    padding: 20px var(--ai-space-lg);
    background: var(--ai-paper-2);
    scrollbar-width: thin;
    scrollbar-color: var(--ai-rule-2) transparent;
}

.ai-chat-body::-webkit-scrollbar {
    width: 10px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: var(--ai-radius-full);
    background-color: var(--ai-rule-2);
    background-clip: content-box;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

/* ----------------------------------------------------------- empty state */

.ai-chat-empty {
    max-width: 620px;
    margin: var(--ai-space-xl) auto var(--ai-space-lg);
    text-align: center;
}

.ai-chat-empty-icon {
    position: relative;
    overflow: visible;
    width: 128px;
    height: 152px;
    margin: 0 auto var(--ai-space-md);
}

/* soft ground shadow so the mascot stands on the surface */
.ai-chat-empty-icon::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 84px;
    height: 12px;
    border-radius: var(--ai-radius-full);
    background: var(--ai-ink);
    opacity: 0.1;
    filter: blur(5px);
    transform: translateX(-50%);
}

.ai-chat-mascot {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.ai-chat-mascot--launcher {
    transform: translateY(2px) scale(1.26);
}

.ai-chat-mascot--title {
    transform: translateY(1px) scale(1.15);
}

.ai-chat-mascot--empty {
    position: relative;
    z-index: 1;
    transform: none;
}

.ai-chat-empty h5 {
    min-width: 0;
    margin: 0 0 var(--ai-space-xs);
    color: var(--ai-ink);
    font-size: var(--ai-text-display);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.ai-chat-empty p {
    max-width: 46ch;
    margin: 0 auto;
    color: var(--ai-muted);
    font-size: var(--ai-text-md);
    line-height: 1.55;
}

.ai-chat-suggest-head {
    max-width: 560px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ai-space-sm);
    margin: var(--ai-space-lg) auto 0;
}

.ai-chat-suggest-label {
    color: var(--ai-neutral);
    font-size: var(--ai-text-xs);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ai-chat-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--ai-rule-2);
    border-radius: var(--ai-radius-full);
    background: var(--ai-paper);
}

.ai-chat-lang-toggle button {
    position: relative;
    min-width: 44px;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px var(--ai-space-sm);
    border: 0;
    border-radius: var(--ai-radius-full);
    color: var(--ai-neutral);
    background: transparent;
    font-family: var(--ai-font-ui);
    font-size: var(--ai-text-xs);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--ai-dur-micro) var(--ai-ease-out),
        background-color var(--ai-dur-micro) var(--ai-ease-out);
}

/* expand the touch target vertically to ~44px without growing the pill */
.ai-chat-lang-toggle button::before {
    content: '';
    position: absolute;
    inset: -9px 0;
}

.ai-chat-lang-toggle button:hover:not([aria-pressed='true']),
.ai-chat-lang-toggle button.is-hover {
    color: var(--ai-ink-2);
    background: var(--ai-paper-3);
}

.ai-chat-lang-toggle button:active {
    transform: translateY(1px);
}

.ai-chat-lang-toggle button:focus-visible,
.ai-chat-lang-toggle button.is-focus {
    outline: 2px solid var(--ai-focus);
    outline-offset: 2px;
}

.ai-chat-lang-toggle button[aria-pressed='true'] {
    color: var(--ai-accent-ink);
    background: var(--ai-ink-surface);
}

.ai-chat-suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ai-space-sm);
    max-width: 560px;
    margin: var(--ai-space-sm) auto 0;
}

.ai-chat-suggestions button {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: var(--ai-space-sm) var(--ai-space-md);
    border: 1px solid var(--ai-rule-2);
    border-radius: var(--ai-radius-chip);
    color: var(--ai-ink-2);
    background: var(--ai-paper);
    font-family: var(--ai-font-ui);
    font-size: var(--ai-text-sm);
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--ai-dur-micro) var(--ai-ease-out),
        background-color var(--ai-dur-micro) var(--ai-ease-out),
        color var(--ai-dur-micro) var(--ai-ease-out),
        transform var(--ai-dur-micro) var(--ai-ease-out);
}

.ai-chat-suggestions button:hover:not(:disabled),
.ai-chat-suggestions button.is-hover {
    border-color: var(--ai-accent);
    color: var(--ai-accent-deep);
    background: var(--ai-accent-soft);
    transform: translateY(-1px);
}

.ai-chat-suggestions button:active:not(:disabled),
.ai-chat-suggestions button.is-active {
    transform: translateY(0);
}

.ai-chat-suggestions button:focus-visible,
.ai-chat-suggestions button.is-focus {
    outline: 2px solid var(--ai-focus);
    outline-offset: 2px;
}

.ai-chat-suggestions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-suggestions--compact {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    max-width: none;
    margin-top: var(--ai-space-xs);
}

.ai-chat-suggestions--compact button {
    min-height: 36px;
    padding: var(--ai-space-xs) var(--ai-space-sm);
    font-size: var(--ai-text-xs);
}

/* -------------------------------------------------------------- messages */

.ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-md);
}

.ai-chat-message {
    display: flex;
    align-items: flex-start;
    gap: var(--ai-space-xs);
    width: 100%;
    animation: ai-chat-message-in var(--ai-dur-med) var(--ai-ease-out) both;
}

.ai-chat-message--user {
    justify-content: flex-end;
}

.ai-chat-avatar {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 2px;
    padding: 2px;
    border: 1px solid var(--ai-rule);
    border-radius: 50%;
    background: var(--ai-paper);
}

.ai-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateY(1px) scale(1.2);
}

.ai-chat-user-bubble {
    max-width: min(78%, 600px);
    padding: 12px 16px;
    border-radius: var(--ai-radius-bubble) var(--ai-radius-bubble)
        var(--ai-radius-tail) var(--ai-radius-bubble);
    color: var(--ai-paper);
    background: var(--ai-ink-surface);
    font-size: var(--ai-text-base);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-chat-message--assistant {
    justify-content: flex-start;
}

.ai-chat-response-card,
.ai-chat-typing {
    width: min(94%, 720px);
    border: 1px solid var(--ai-rule);
    border-radius: var(--ai-radius-tail) var(--ai-radius-card)
        var(--ai-radius-card) var(--ai-radius-card);
    background: var(--ai-paper);
    box-shadow: var(--ai-shadow-card);
}

.ai-chat-message .ai-chat-response-card,
.ai-chat-message .ai-chat-typing {
    width: auto;
    min-width: 0;
    max-width: min(94%, 720px);
    flex: 0 1 auto;
}

.ai-chat-response-card {
    position: relative;
    padding: var(--ai-space-md);
}

.ai-chat-response-card--info {
    border-color: var(--ai-info-rule);
    background: var(--ai-info-soft);
}

.ai-chat-response-card--warning {
    border-color: var(--ai-warning-rule);
    background: var(--ai-warning-soft);
}

.ai-chat-response-card--error {
    border-color: var(--ai-error-rule);
    background: var(--ai-error-soft);
}

.ai-chat-response-card > :last-child {
    margin-bottom: 0;
}

.ai-chat-module-badge {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: var(--ai-space-xs);
    margin-bottom: var(--ai-space-xs);
    padding: var(--ai-space-2xs) var(--ai-space-xs);
    border: 1px solid color-mix(in srgb, var(--ai-chat-module-color) 24%, var(--ai-paper));
    border-radius: var(--ai-radius-full);
    color: color-mix(in srgb, var(--ai-chat-module-color) 72%, black);
    background: color-mix(in srgb, var(--ai-chat-module-color) 7%, var(--ai-paper));
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ai-chat-module-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ai-chat-module-color);
}

.ai-chat-response-text {
    max-width: 70ch;
    margin: 0;
    color: var(--ai-ink);
    font-size: var(--ai-text-base);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.ai-chat-response-text > :first-child {
    margin-top: 0;
}

.ai-chat-response-text > :last-child {
    margin-bottom: 0;
}

.ai-chat-response-text p,
.ai-chat-response-text ul,
.ai-chat-response-text ol,
.ai-chat-response-text blockquote,
.ai-chat-response-text pre {
    margin: 0 0 var(--ai-space-xs);
}

.ai-chat-response-text ul,
.ai-chat-response-text ol {
    padding-left: var(--ai-space-lg);
}

.ai-chat-response-text strong {
    color: var(--ai-ink);
    font-weight: 700;
}

.ai-chat-response-text h1,
.ai-chat-response-text h2,
.ai-chat-response-text h3,
.ai-chat-response-text h4 {
    margin: var(--ai-space-md) 0 var(--ai-space-xs);
    color: var(--ai-ink);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.ai-chat-response-text h1 {
    font-size: 20px;
}

.ai-chat-response-text h2 {
    font-size: 18px;
}

.ai-chat-response-text h3,
.ai-chat-response-text h4 {
    font-size: var(--ai-text-base);
}

.ai-chat-response-text blockquote {
    padding: var(--ai-space-xs) var(--ai-space-sm);
    border-left: 2px solid var(--ai-rule-2);
    color: var(--ai-neutral);
    background: var(--ai-paper-2);
}

.ai-chat-response-text code {
    padding: 2px var(--ai-space-2xs);
    border-radius: 6px;
    color: var(--ai-ink-2);
    background: var(--ai-paper-3);
    font-family: var(--ai-font-mono);
    font-size: 0.88em;
}

.ai-chat-response-text pre {
    overflow: auto;
    padding: var(--ai-space-sm);
    border-radius: var(--ai-radius-tile);
    background: var(--ai-ink-surface);
}

.ai-chat-response-text pre code {
    padding: 0;
    color: var(--ai-paper-2);
    background: transparent;
}

.ai-chat-response-text a {
    color: var(--ai-accent-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-chat-state-detail {
    display: flex;
    align-items: flex-start;
    gap: var(--ai-space-xs);
    margin-top: var(--ai-space-sm);
    color: var(--ai-neutral);
    font-size: var(--ai-text-sm);
}

.ai-chat-state-detail > svg {
    flex: 0 0 auto;
    margin-top: 2px;
}

.ai-chat-state-detail p {
    margin: 2px 0 0;
}

/* ------------------------------------------------- secondary button voice */

.ai-chat-retry,
.ai-chat-table-footer button,
.ai-chat-report button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ai-space-xs);
    min-height: 36px;
    padding: var(--ai-space-xs) var(--ai-space-sm);
    border: 1px solid var(--ai-rule-2);
    border-radius: 10px;
    color: var(--ai-ink-2);
    background: var(--ai-paper);
    font-family: var(--ai-font-ui);
    font-size: var(--ai-text-sm);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--ai-dur-micro) var(--ai-ease-out),
        background-color var(--ai-dur-micro) var(--ai-ease-out),
        color var(--ai-dur-micro) var(--ai-ease-out);
}

.ai-chat-table-footer button:hover:not(:disabled),
.ai-chat-table-footer button.is-hover,
.ai-chat-report button:hover:not(:disabled),
.ai-chat-report button.is-hover {
    border-color: var(--ai-accent);
    color: var(--ai-accent-deep);
    background: var(--ai-accent-soft);
}

.ai-chat-retry:active:not(:disabled),
.ai-chat-table-footer button:active:not(:disabled),
.ai-chat-report button:active:not(:disabled) {
    transform: translateY(1px);
}

.ai-chat-retry:focus-visible,
.ai-chat-table-footer button:focus-visible,
.ai-chat-report button:focus-visible {
    outline: 2px solid var(--ai-focus);
    outline-offset: 2px;
}

.ai-chat-retry:disabled,
.ai-chat-table-footer button:disabled,
.ai-chat-report button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-retry {
    margin-top: var(--ai-space-sm);
    border-color: color-mix(in srgb, var(--ai-error) 30%, var(--ai-paper));
    color: var(--ai-error);
    background: var(--ai-paper);
}

.ai-chat-retry:hover:not(:disabled),
.ai-chat-retry.is-hover {
    border-color: var(--ai-error);
    color: var(--ai-error);
    background: var(--ai-error-soft);
}

/* ---------------------------------------------------- sections and table */

.ai-chat-section {
    margin-top: var(--ai-space-md);
    padding-top: var(--ai-space-sm);
    border-top: 1px solid var(--ai-rule);
}

.ai-chat-table-wrap {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--ai-rule);
    border-radius: var(--ai-radius-tile);
    background: var(--ai-paper);
}

.ai-chat-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--ai-text-xs);
    font-variant-numeric: tabular-nums;
}

.ai-chat-table th,
.ai-chat-table td {
    min-width: 110px;
    padding: var(--ai-space-xs) var(--ai-space-sm);
    border-right: 1px solid var(--ai-paper-3);
    border-bottom: 1px solid var(--ai-paper-3);
    color: var(--ai-ink-2);
    text-align: left;
    white-space: nowrap;
}

.ai-chat-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--ai-ink);
    background: var(--ai-paper-2);
    font-weight: 700;
}

.ai-chat-table tbody tr:hover td {
    background: var(--ai-paper-2);
}

.ai-chat-table tr:last-child td {
    border-bottom: 0;
}

.ai-chat-table th:last-child,
.ai-chat-table td:last-child {
    border-right: 0;
}

.ai-chat-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ai-space-sm);
    margin-top: var(--ai-space-xs);
    color: var(--ai-muted);
    font-size: var(--ai-text-xs);
}

/* ----------------------------------------------------------------- chart */

.ai-chat-chart {
    position: relative;
    min-height: 340px;
}

.ai-chat-chart-canvas {
    width: 100%;
    height: 340px;
}

.ai-chat-chart-loading {
    position: absolute;
    inset: var(--ai-space-md) 0 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ai-space-xs);
    color: var(--ai-muted);
    background: color-mix(in srgb, var(--ai-paper) 88%, transparent);
}

.ai-chat-chart-fallback {
    color: var(--ai-muted);
    font-size: var(--ai-text-sm);
}

.ai-chat-chart-fallback details {
    margin-top: var(--ai-space-xs);
}

.ai-chat-chart-fallback pre {
    max-height: 160px;
    margin-top: var(--ai-space-xs);
    overflow: auto;
    font-family: var(--ai-font-mono);
    white-space: pre-wrap;
}

/* -------------------------------------------------------------- insights */

.ai-chat-insights h6 {
    display: flex;
    align-items: center;
    gap: var(--ai-space-xs);
    margin: 0 0 var(--ai-space-xs);
    color: var(--ai-ink);
    font-size: var(--ai-text-md);
    font-weight: 700;
}

.ai-chat-insight-list {
    display: grid;
    gap: var(--ai-space-xs);
}

.ai-chat-insight {
    padding: var(--ai-space-sm);
    border-radius: 10px;
    background: var(--ai-paper-2);
}

.ai-chat-insight-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.ai-chat-insight-heading strong {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: var(--ai-ink);
    font-size: var(--ai-text-sm);
    font-weight: 650;
}

.ai-chat-insight-heading strong::before {
    content: '';
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ai-chat-insight-color);
}

.ai-chat-insight-heading span {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: var(--ai-radius-full);
    color: color-mix(in srgb, var(--ai-chat-insight-color) 72%, black);
    background: color-mix(in srgb, var(--ai-chat-insight-color) 9%, var(--ai-paper));
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-chat-insight p {
    margin: var(--ai-space-2xs) 0 0 var(--ai-space-md);
    color: var(--ai-neutral);
    font-size: var(--ai-text-xs);
    line-height: 1.55;
    white-space: pre-wrap;
}

/* ---------------------------------------------------------------- report */

.ai-chat-report {
    display: flex;
    align-items: center;
    gap: var(--ai-space-sm);
}

.ai-chat-report-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 22px;
}

.ai-chat-report-icon.is-xlsx {
    color: var(--ai-xlsx-ink);
    background: var(--ai-xlsx-soft);
}

.ai-chat-report-icon.is-ppt {
    color: var(--ai-ppt-ink);
    background: var(--ai-ppt-soft);
}

.ai-chat-report-name {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: var(--ai-text-xs);
}

.ai-chat-report-name strong {
    color: var(--ai-ink);
    font-size: var(--ai-text-sm);
}

.ai-chat-report-name span {
    overflow: hidden;
    color: var(--ai-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-report-name small {
    color: var(--ai-error);
}

/* ---------------------------------------------------------------- typing */

.ai-chat-typing {
    display: flex;
    align-items: center;
    gap: var(--ai-space-xs);
    padding: var(--ai-space-sm) var(--ai-space-md);
    color: var(--ai-muted);
    font-size: var(--ai-text-sm);
}

.ai-chat-typing-dots {
    display: inline-flex;
    gap: 3px;
}

.ai-chat-typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ai-accent);
    animation: ai-chat-dot 1.1s infinite ease-in-out;
}

.ai-chat-typing-dots i:nth-child(2) {
    animation-delay: 120ms;
}

.ai-chat-typing-dots i:nth-child(3) {
    animation-delay: 240ms;
}

/* ------------------------------------------------------ footer / composer */

.ai-chat-footer {
    display: flex;
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: var(--ai-space-xs);
    padding: var(--ai-space-sm) var(--ai-space-md)
        calc(var(--ai-space-sm) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ai-rule);
    background: var(--ai-paper);
}

.ai-chat-footer > * {
    margin: 0;
}

.ai-chat-composer {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: var(--ai-space-xs);
    padding: var(--ai-space-2xs) var(--ai-space-2xs) var(--ai-space-2xs)
        var(--ai-space-sm);
    border: 1px solid var(--ai-rule-2);
    border-radius: var(--ai-radius-field);
    background: var(--ai-paper);
}

/* focus ring appears instantly — no transition on the composer border */
.ai-chat-composer:focus-within,
.ai-chat-composer.is-focus {
    border-color: var(--ai-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-accent) 16%, transparent);
}

.ai-chat-composer:has(.ai-chat-input:disabled) {
    background: var(--ai-paper-2);
}

.ai-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    min-height: 40px;
    max-height: 128px;
    padding: var(--ai-space-xs) 0;
    border: 0;
    color: var(--ai-ink);
    background: transparent;
    font-family: var(--ai-font-ui);
    font-size: var(--ai-text-base);
    line-height: 1.4;
    resize: none;
}

.ai-chat-input:focus {
    outline: none;
}

.ai-chat-input::placeholder {
    color: var(--ai-muted);
}

.ai-chat-input:disabled {
    color: var(--ai-neutral);
    cursor: not-allowed;
}

.ai-chat-send {
    flex: 0 0 auto;
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: var(--ai-radius-btn);
    color: var(--ai-accent-ink);
    background: var(--ai-ink-surface);
    font-size: 18px;
    cursor: pointer;
    transition: background-color var(--ai-dur-micro) var(--ai-ease-out),
        transform 100ms var(--ai-ease-out);
}

.ai-chat-send::before {
    content: '';
    position: absolute;
    inset: -2px;
}

.ai-chat-send:hover:not(:disabled),
.ai-chat-send.is-hover {
    background: var(--ai-ink);
}

.ai-chat-send:active:not(:disabled),
.ai-chat-send.is-active {
    transform: translateY(1px);
}

.ai-chat-send:focus-visible,
.ai-chat-send.is-focus {
    outline: none;
    box-shadow: var(--ai-ring);
}

.ai-chat-send:disabled {
    color: var(--ai-muted);
    background: var(--ai-paper-3);
    cursor: not-allowed;
}

/* -------------------------------------------------------------- keyframes */

@keyframes ai-chat-message-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ai-chat-tooltip-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ai-chat-tooltip-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.58;
        transform: scale(0.78);
    }
}

@keyframes ai-chat-dot {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 575.98px) {
    .ai-chat-modal.modal {
        pointer-events: auto;
    }

    .ai-chat-modal .modal-dialog {
        position: relative;
        top: auto;
        left: auto;
        width: auto;
        height: 100%;
        margin: 0;
    }

    .ai-chat-modal .modal-header {
        cursor: default;
        touch-action: auto;
        user-select: auto;
    }

    .ai-chat-window-control,
    .ai-chat-resize-handle {
        display: none;
    }

    .ai-chat-tooltip {
        width: min(288px, calc(100vw - 32px));
    }

    .ai-chat-modal .modal-content {
        min-height: 100%;
        border-radius: 0;
    }

    .ai-chat-modal .modal-header {
        padding: var(--ai-space-xs) var(--ai-space-sm);
    }

    .ai-chat-body {
        padding: var(--ai-space-sm);
    }

    .ai-chat-avatar {
        display: none;
    }

    .ai-chat-suggestions {
        grid-template-columns: minmax(0, 1fr);
    }

    .ai-chat-user-bubble {
        max-width: 88%;
    }

    .ai-chat-message .ai-chat-response-card,
    .ai-chat-message .ai-chat-typing {
        max-width: 100%;
    }

    .ai-chat-footer {
        padding: var(--ai-space-xs) var(--ai-space-sm)
            calc(var(--ai-space-xs) + env(safe-area-inset-bottom));
    }

    .ai-chat-report {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .ai-chat-report-name {
        width: calc(100% - 52px);
    }

    .ai-chat-report button {
        width: 100%;
    }
}

/* ---------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
    .ai-chat-launcher,
    .ai-chat-tooltip,
    .ai-chat-tooltip-status,
    .ai-chat-tooltip-action > span,
    .ai-chat-tooltip-close,
    .ai-chat-launcher-dismiss {
        animation: none;
        transition: none;
    }

    .ai-chat-launcher:hover,
    .ai-chat-tooltip:hover,
    .ai-chat-tooltip-close:hover,
    .ai-chat-launcher-dismiss:hover,
    .ai-chat-tooltip-content:active,
    .ai-chat-tooltip-content:hover .ai-chat-tooltip-action > span {
        transform: none;
    }

    .ai-chat-message {
        animation-name: ai-chat-message-in-reduced;
        animation-duration: 120ms;
    }

    .ai-chat-suggestions button,
    .ai-chat-lang-toggle button,
    .ai-chat-send,
    .ai-chat-window-control,
    .ai-chat-clear,
    .ai-chat-close,
    .ai-chat-retry,
    .ai-chat-table-footer button,
    .ai-chat-report button {
        transition: none;
    }

    .ai-chat-suggestions button:hover:not(:disabled),
    .ai-chat-lang-toggle button:active,
    .ai-chat-send:active:not(:disabled),
    .ai-chat-window-control:active,
    .ai-chat-clear:active:not(:disabled),
    .ai-chat-close:active {
        transform: none;
    }

    /* functional loader: keeps running, slower */
    .ai-chat-typing-dots i {
        animation-duration: 2.2s;
    }
}

@keyframes ai-chat-message-in-reduced {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Hallmark · genre: modern-minimal · macrostructure: Control-room Workbench · theme: studied-DNA (source: Floor Deck Wireframes.dc.html #4a) · tone: night-shift glass cockpit · anchor hue: deep indigo + signal green · visual fingerprint: frosted cards floating over an aurora gradient, glow-dot liveness, translucent hairlines */
/* Hallmark · pre-emit critique: P5 H5 E5 S5 R4 V5 */
:root {
    --floor-font-body: 'IBM Plex Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --floor-canvas: linear-gradient(135deg, #f8fbff 0%, #edf4fb 52%, #e7f0f9 100%);
    --floor-orb-blue: radial-gradient(circle, rgb(163 206 255 / 0.28), transparent 68%);
    --floor-orb-magenta: radial-gradient(circle, rgb(213 196 255 / 0.18), transparent 68%);
    --floor-glass-header: rgb(255 255 255 / 0.94);
    --floor-glass-card: #ffffff;
    --floor-glass-panel: #ffffff;
    --floor-glass-tile: #f8fbff;
    --floor-glass-chip: #f3f7fb;
    --floor-glass-chip-hover: #e8f2ff;
    --floor-glass-control: #f5f8fc;
    --floor-glass-row-hover: #edf5ff;
    --floor-glass-dark: #eef5fb;
    --floor-edge-header: #d8e3ef;
    --floor-edge-card: #dce7f1;
    --floor-edge-panel: #d7e3ee;
    --floor-edge-tile: #dce7f1;
    --floor-edge-chip: #d8e4ef;
    --floor-edge-control: #c9d8e7;
    --floor-edge-dark: #bfd5e8;
    --floor-edge-baseline: #c9d9e7;
    --floor-hairline: #e0e9f1;
    --floor-hairline-strong: #cbd9e6;
    --floor-track: #c3d2e0;
    --floor-track-edge: rgba(21, 37, 58, 0.1);
    --floor-ink: #15253a;
    --floor-ink-soft: #455b72;
    --floor-muted: #64758a;
    --floor-title-ink: #1d3650;
    --floor-on-dark: #15253a;
    --floor-on-dark-soft: #30465d;
    --floor-on-dark-muted: #64758a;
    --floor-dark-ink: #1d3650;
    --floor-dark-muted: #64758a;
    --floor-blue: #2a6fd6;
    --floor-blue-ink: #1e56ab;
    --floor-blue-edge: rgba(42, 111, 214, 0.5);
    --floor-blue-edge-strong: rgba(42, 111, 214, 0.6);
    --floor-green: #157a43;
    --floor-green-fill: #1d8a4e;
    --floor-live: #16824b;
    --floor-live-bright: #12683d;
    --floor-live-bg: #e6f6ec;
    --floor-live-edge: #a9ddbd;
    --floor-amber: #a4700f;
    --floor-red: #b32b3d;
    --floor-magenta: #a63bb5;
    --floor-target-line: #6ea8ff;
    --floor-bar-on: #57d08a;
    --floor-bar-below: #e2687a;
    --floor-focus: #6ea8ff;
    --floor-blur-card: none;
    --floor-blur-header: none;
    --floor-blur-tile: none;
    --floor-shadow-card: 0 6px 20px rgb(41 72 102 / 0.08);
    --floor-shadow-dark: 0 6px 20px rgb(41 72 102 / 0.1);
    --floor-radius-lg: 16px;
    --floor-radius-md: 12px;
    --floor-radius-sm: 10px;
    --floor-radius-xs: 8px;
    --floor-radius-pill: 999px;
    --floor-space-3xs: 4px;
    --floor-space-2xs: 8px;
    --floor-space-xs: 12px;
    --floor-space-sm: 16px;
    --floor-space-md: 24px;
    --floor-space-lg: 32px;
    --floor-pad-x: clamp(16px, 3.2vw, 32px);
    /* Breathing room between the deck's major bands (KPIs / operations /
       analysis). Tightened on short screens, where height is scarce. */
    --floor-section-gap: 20px;
    /* First-paint estimate of the chrome the app shell puts around the deck.
       syncDeckHeight() replaces it with a measured value on the same frame, so
       this only has to be in the right ballpark — deliberately generous, since
       overshooting here is what puts a scrollbar on screen. */
    --floor-shell-offset: 160px;
    --floor-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --floor-motion-fast: 150ms;
    --floor-motion-base: 220ms;
}

html,
body {
    overflow-x: clip;
}

.floor-deck {
    position: relative;
    /* dvh, not vh: on mobile/TV Chrome `vh` is the toolbar-hidden viewport, so
       a 100vh floor outruns the visible screen and the page scrolls even when
       nothing overflows. */
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: var(--floor-space-lg);
    overflow: clip;
    color: var(--floor-ink);
    font-family: var(--floor-font-body);
}

.floor-deck *,
.floor-deck *::before,
.floor-deck *::after {
    box-sizing: border-box;
}

.floor-deck>* {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.floor-deck h1,
.floor-deck h2,
.floor-deck p {
    margin-top: 0;
}

/* ---- header ---- */

.floor-deck__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--floor-space-xs) var(--floor-space-sm);
    align-items: center;
    padding: var(--floor-space-2xs) var(--floor-pad-x);
    background: var(--floor-glass-header);
    backdrop-filter: var(--floor-blur-header);
    -webkit-backdrop-filter: var(--floor-blur-header);
}

.floor-deck__header--tabs-only {
    grid-template-columns: minmax(0, 1fr);
}

.floor-deck__view-tabs {
    display: inline-flex;
    position: relative;
    gap: 0;
    align-items: center;
    width: max-content;
    max-width: 100%;
    padding: 0;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.floor-deck__view-tab {
    display: inline-flex;
    position: relative;
    flex: none;
    gap: 6px;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--floor-on-dark-soft);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1;
    transition: background var(--floor-motion-fast) var(--floor-ease), color var(--floor-motion-fast) var(--floor-ease), box-shadow var(--floor-motion-fast) var(--floor-ease);
}

.floor-deck__view-tab svg {
    width: 16px;
    height: 16px;
}

.floor-deck__view-tab:hover {
    background: var(--floor-glass-chip-hover);
    color: var(--floor-on-dark);
}

.floor-deck__view-tab.is-active {
    background: transparent;
    box-shadow: none;
    color: var(--floor-blue);
}

.floor-deck__view-tab-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    pointer-events: none;
    border-radius: var(--floor-radius-pill) var(--floor-radius-pill) 0 0;
    background: var(--floor-blue);
}

.floor-deck__view-tab-indicator.is-ready {
    transition: transform 220ms var(--floor-ease), width 220ms var(--floor-ease);
}

.floor-deck__view-tab.is-active:hover {
    color: var(--floor-blue);
}

@media (prefers-reduced-motion: reduce) {
    .floor-deck__view-tab-indicator {
        transition: none;
    }
}

.home-page-workspace__content {
    padding: var(--floor-space-2xs) 0 var(--floor-space-sm);
}

.floor-deck h1 {
    min-width: 0;
    margin: 0;
    color: var(--floor-on-dark);
    font-size: clamp(22px, 2vw, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    overflow-wrap: anywhere;
}

.floor-deck__date-control {
    display: flex;
    gap: var(--floor-space-2xs);
    align-items: center;
    min-width: 0;
    justify-self: start;
    width: max-content;
    padding: var(--floor-space-2xs) var(--floor-space-xs);
    border: 1px solid var(--floor-edge-control);
    border-radius: var(--floor-radius-sm);
    background: var(--floor-glass-control);
    color: var(--floor-on-dark-soft);
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--floor-motion-fast) var(--floor-ease),
        background var(--floor-motion-fast) var(--floor-ease),
        box-shadow var(--floor-motion-base) var(--floor-ease),
        transform var(--floor-motion-fast) var(--floor-ease);
}

.floor-deck__date-control:hover {
    border-color: var(--floor-blue-edge);
    background: var(--floor-glass-chip-hover);
    box-shadow: var(--floor-shadow-card);
    transform: translateY(-1px);
}

.floor-deck__date-control:active {
    box-shadow: none;
    transform: translateY(1px);
}

.floor-deck__date-icon {
    flex: none;
    width: 18px;
    height: 18px;
    transition: color var(--floor-motion-fast) var(--floor-ease),
        transform var(--floor-motion-base) var(--floor-ease);
}

.floor-deck__date-control:hover .floor-deck__date-icon {
    color: var(--floor-blue);
}

.floor-deck__date-control input {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--floor-on-dark);
    color-scheme: light;
    font: inherit;
    font-weight: 600;
}

.floor-deck__date-control input::-webkit-calendar-picker-indicator {
    display: none;
}

.floor-deck__date-control input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.floor-deck__date-control small {
    color: var(--floor-on-dark-muted);
    font-size: 12px;
    white-space: nowrap;
}

.floor-deck__date-control:focus-within {
    border-color: var(--floor-focus);
}

.floor-deck input:focus-visible,
.floor-deck a:focus-visible,
.floor-deck button:focus-visible {
    outline: 3px solid var(--floor-focus);
    outline-offset: 2px;
}

.floor-deck__live {
    display: inline-flex;
    gap: var(--floor-space-2xs);
    align-items: center;
    justify-self: start;
    padding: 7px 16px;
    border-radius: var(--floor-radius-pill);
    background: var(--floor-live-bg);
    color: var(--floor-live-bright);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.floor-deck__live span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--floor-live);
    box-shadow: 0 0 8px var(--floor-live);
}

.floor-deck__live--historic {
    border-color: var(--floor-edge-control);
    background: var(--floor-glass-control);
    color: var(--floor-on-dark-muted);
}

.floor-deck__live--historic span {
    background: var(--floor-on-dark-muted);
    box-shadow: none;
}

/* ---- frosted surfaces ---- */

.floor-deck__metric,
.floor-deck__panel,
.floor-deck__analysis-card {
    min-width: 0;
    border-radius: var(--floor-radius-lg);
    background: var(--floor-glass-card);
    backdrop-filter: var(--floor-blur-card);
    -webkit-backdrop-filter: var(--floor-blur-card);
    box-shadow: var(--floor-shadow-card);
}

.floor-deck__metric,
.floor-deck__panel,
.floor-deck__machine-card,
.floor-deck__job-item,
.floor-deck__analysis-card {
    transition:
        transform var(--floor-motion-fast) var(--floor-ease),
        border-color var(--floor-motion-fast) var(--floor-ease),
        box-shadow var(--floor-motion-fast) var(--floor-ease);
}

@media (hover: hover) {

    .floor-deck__metric:hover,
    .floor-deck__panel:hover,
    .floor-deck__machine-card:hover,
    .floor-deck__job-item:hover,
    .floor-deck__analysis-card:hover {
        transform: translateY(-2px);
        /* border-color: var(--floor-blue-edge-strong); */
        /* box-shadow: 0 0 0 1px var(--floor-blue-edge), var(--floor-shadow-card); */
    }
}

/* ---- staggered card entrance ---- */

@keyframes floor-deck-card-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Each card group remounts (via a changing React key) on data load, date
   change, poll refresh, and sort change, replaying this entrance. `backwards`
   fill hides the card during its stagger delay, then releases the transform so
   the hover lift keeps working once the animation settles. */
.floor-deck__metric,
.floor-deck__machine-card,
.floor-deck__job-item,
.floor-deck__analysis-card {
    animation: floor-deck-card-in var(--floor-motion-base) var(--floor-ease) backwards;
    animation-delay: calc(min(var(--stagger-index, 0), 10) * 45ms);
}

/* ---- KPI strip ---- */

.floor-deck__metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--floor-space-sm);
    padding: var(--floor-section-gap) var(--floor-pad-x) 0;
}

.floor-deck__metric {
    display: flex;
    flex-direction: column;
    gap: var(--floor-space-3xs);
    min-height: 112px;
    padding: var(--floor-space-xs);
}

.floor-deck__metric--oee {
    --floor-track: #98bce8;
    border-color: #b8d5fb;
    background: #e6f0ff;
}

.floor-deck__metric--output {
    --floor-track: #93c9bf;
    border-color: #b7e1dc;
    background: #e4f6f3;
}

.floor-deck__metric--good-output {
    --floor-track: #97cba5;
    border-color: #bce5c8;
    background: #e8f7ec;
}

.floor-deck__metric--downtime {
    --floor-track: #efb2bc;
    border-color: #f3bcc5;
    background: #fdecef;
}

.floor-deck__metric--machines {
    --floor-track: #c0aae8;
    border-color: #d6c2f4;
    background: #f1ebfd;
}

.floor-deck__metric-label {
    margin: 0;
    overflow: hidden;
    color: var(--floor-ink-soft);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
}

.floor-deck__metric-main {
    display: flex;
    gap: var(--floor-space-2xs);
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto;
    min-width: 0;
}

.floor-deck__metric-value {
    color: var(--floor-ink);
    font-size: clamp(22px, 1.9vw, 32px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.floor-deck__metric-value small {
    color: var(--floor-ink-soft);
    font-size: 0.45em;
    font-weight: 500;
}

.floor-deck__metric-value--down {
    color: var(--floor-red);
}

.floor-deck__metric-detail {
    min-height: 16px;
    margin: 0;
    color: var(--floor-ink-soft);
    font-size: 12px;
    font-weight: 500;
}

.floor-deck__metric-detail--good {
    color: var(--floor-green);
    font-weight: 600;
}

.floor-deck__metric-detail--delta {
    display: flex;
    gap: 4px;
    align-items: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.floor-deck__metric-detail--up {
    color: var(--floor-green);
}

.floor-deck__metric-detail--down {
    color: var(--floor-red);
}

/* ---- semicircle gauges ---- */

.floor-deck__semi {
    display: block;
    flex: none;
    overflow: hidden;
}

.floor-deck__semi::before {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(from 270deg, var(--semi-color) var(--semi-fill, 0deg), var(--floor-track) var(--semi-fill, 0deg) 180deg, transparent 180deg);
    content: '';
    -webkit-mask: radial-gradient(circle, transparent 56%, #000 57%);
    mask: radial-gradient(circle, transparent 56%, #000 57%);
}

.floor-deck__semi--sm {
    width: 52px;
    height: 26px;
}

.floor-deck__semi--md {
    width: 72px;
    height: 36px;
}

.floor-deck__semi--lg {
    width: 92px;
    height: 46px;
}

.floor-deck__semi--blue {
    --semi-color: var(--floor-blue);
}

.floor-deck__semi--green {
    --semi-color: var(--floor-green-fill);
}

.floor-deck__semi--amber {
    --semi-color: var(--floor-amber);
}

/* ---- progress bars ---- */

.floor-deck__progress-row {
    display: flex;
    gap: var(--floor-space-2xs);
    align-items: center;
}

.floor-deck__progress-row b {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.floor-deck__progress-row .floor-deck__progress {
    flex: 1;
}

.floor-deck__progress {
    display: block;
    overflow: hidden;
    height: 10px;
    border-radius: var(--floor-radius-pill);
    background: var(--floor-track);
    box-shadow: inset 0 0 0 1px var(--floor-track-edge);
}

.floor-deck__progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--floor-blue);
}

/* ---- operations zone ---- */

.floor-deck__operations-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1.45fr);
    gap: var(--floor-space-sm);
    padding: var(--floor-section-gap) var(--floor-pad-x);
}

.floor-deck__panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: var(--floor-space-xs) var(--floor-space-sm) var(--floor-space-sm);
    border-color: var(--floor-edge-panel);
    background: var(--floor-glass-panel);
}

.floor-deck__panel-heading {
    display: flex;
    flex: none;
    gap: var(--floor-space-xs);
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--floor-space-2xs);
    min-width: 0;
}

.floor-deck__panel-heading>div {
    min-width: 0;
}

.floor-deck__panel-title {
    display: flex;
    gap: var(--floor-space-3xs);
    align-items: center;
    min-width: 0;
}

/* ---- info popover ---- */

.floor-deck__info {
    display: flex;
    position: relative;
    flex: none;
    align-items: center;
}

.floor-deck__info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--floor-muted);
    cursor: pointer;
    transition: color var(--floor-motion-fast) var(--floor-ease),
        background var(--floor-motion-fast) var(--floor-ease);
}

.floor-deck__info-button svg {
    width: 17px;
    height: 17px;
}

.floor-deck__info-button:hover,
.floor-deck__info-button[aria-expanded="true"] {
    background: var(--floor-glass-chip-hover);
    color: var(--floor-blue);
}

.floor-deck__info-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: -8px;
    z-index: 5;
    width: max-content;
    max-width: min(320px, 72vw);
    padding: var(--floor-space-xs);
    border: 1px solid var(--floor-edge-panel);
    border-radius: var(--floor-radius-md);
    background: var(--floor-glass-panel);
    box-shadow: var(--floor-shadow-dark);
    animation: floor-deck-info-in var(--floor-motion-base) var(--floor-ease);
}

.floor-deck__info-title {
    margin: 0 0 var(--floor-space-2xs);
    color: var(--floor-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.floor-deck__info-popover ul {
    display: grid;
    gap: var(--floor-space-2xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

.floor-deck__info-entry {
    display: flex;
    gap: var(--floor-space-2xs);
    align-items: flex-start;
    color: var(--floor-ink-soft);
    font-size: 12.5px;
    line-height: 1.45;
}

.floor-deck__info-entry strong {
    color: var(--floor-job-ink);
}

.floor-deck__info-swatch {
    flex: none;
    width: 16px;
    height: 8px;
    margin-top: 5px;
    border-radius: var(--floor-radius-pill);
    background: var(--floor-job-accent);
}

@keyframes floor-deck-info-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floor-deck h2 {
    margin-bottom: 0;
    color: var(--floor-ink);
    font-size: clamp(16px, 1.3vw, 19px);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.floor-deck__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--floor-space-xs);
    margin: var(--floor-space-3xs) 0 0;
    font-size: 13px;
    font-weight: 600;
}

.floor-deck__legend-item {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.floor-deck__legend-item::before {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}

.floor-deck__legend-item--running {
    color: var(--floor-green);
}

.floor-deck__legend-item--idle {
    color: #94a3b8;
}

.floor-deck__panel-heading a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 var(--floor-space-xs);
    border: 1px solid var(--floor-blue-edge-strong);
    border-radius: var(--floor-radius-sm);
    background: var(--floor-glass-chip);
    color: var(--floor-blue-ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--floor-motion-fast) var(--floor-ease), transform var(--floor-motion-fast) var(--floor-ease);
    white-space: nowrap;
}

.floor-deck__panel-heading a:hover {
    background: var(--floor-glass-chip-hover);
    transform: translateY(-1px);
}

.floor-deck__panel-heading a:active {
    transform: translateY(1px);
}

/* ---- machine cards ---- */

.floor-deck__machine-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 auto;
    gap: var(--floor-space-2xs);
    align-content: start;
    min-height: 0;
}

.floor-deck__machine-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: var(--floor-space-2xs) var(--floor-space-xs);
    border: 1px solid var(--floor-edge-tile);
    border-radius: var(--floor-radius-sm);
    background: var(--floor-glass-tile);
    backdrop-filter: var(--floor-blur-tile);
    -webkit-backdrop-filter: var(--floor-blur-tile);
}

.floor-deck__machine-heading {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.floor-deck__machine-heading strong {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floor-deck__machine-oee {
    flex: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.floor-deck__machine-oee small {
    margin-left: 1px;
    font-size: 9.5px;
    font-weight: 600;
}

.floor-deck__machine-oee--on {
    color: var(--floor-green);
}

.floor-deck__machine-oee--below {
    color: var(--floor-red);
}

.floor-deck__machine-job {
    margin: 0;
    overflow: hidden;
    color: var(--floor-muted);
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floor-deck__machine-progress {
    display: flex;
    gap: var(--floor-space-2xs);
    align-items: center;
}

.floor-deck__machine-progress small {
    flex: none;
    min-width: 28px;
    color: var(--floor-ink-soft);
    font-size: 10.5px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.floor-deck__status-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.floor-deck__status-dot--running {
    background: var(--floor-green-fill);
}

.floor-deck__status-dot--idle {
    background: #94a3b8;
}

.floor-deck__status-dot--stopped {
    background: var(--floor-red);
}

.floor-deck__machine-card .floor-deck__progress {
    flex: 1 1 auto;
    height: 6px;
}

/* ---- job order progress list ---- */

.floor-deck__jobs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--floor-space-2xs);
    justify-content: flex-end;
}

.floor-deck__job-sort {
    position: relative;
    display: inline-flex;
}

.floor-deck__job-sort select {
    min-height: 30px;
    padding: 0 30px 0 var(--floor-space-2xs);
    border: 1px solid var(--floor-edge-control);
    border-radius: var(--floor-radius-sm);
    outline: 2px solid transparent;
    outline-offset: 2px;
    background: var(--floor-glass-control);
    color: var(--floor-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

@media (hover: hover) {
    .floor-deck__job-sort select:hover {
        background: var(--floor-glass-chip-hover);
    }
}

.floor-deck__job-sort select:focus-visible {
    outline-color: var(--floor-focus);
}

.floor-deck__job-sort select:active {
    background: var(--floor-glass-chip);
}

.floor-deck__job-sort select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* ---- quiet scroll regions ---- */

/* The operations lists keep their scrollbar invisible until hovered or
   focused. `scroll` rather than `auto` plus a stable gutter so the track is
   reserved up front and the rows never shift when the thumb appears. */
.floor-deck__job-list,
.floor-deck__machine-grid {
    overflow-y: scroll;
    scrollbar-color: transparent transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.floor-deck__job-list:focus,
.floor-deck__machine-grid:focus {
    scrollbar-color: var(--floor-hairline-strong) transparent;
}

.floor-deck__job-list::-webkit-scrollbar,
.floor-deck__machine-grid::-webkit-scrollbar {
    width: 8px;
}

.floor-deck__job-list::-webkit-scrollbar-track,
.floor-deck__machine-grid::-webkit-scrollbar-track {
    background: transparent;
}

.floor-deck__job-list::-webkit-scrollbar-thumb,
.floor-deck__machine-grid::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: var(--floor-radius-pill);
    background: transparent;
    background-clip: padding-box;
}

.floor-deck__job-list:hover::-webkit-scrollbar-thumb,
.floor-deck__job-list:focus::-webkit-scrollbar-thumb,
.floor-deck__machine-grid:hover::-webkit-scrollbar-thumb,
.floor-deck__machine-grid:focus::-webkit-scrollbar-thumb {
    background: var(--floor-hairline-strong);
    background-clip: padding-box;
}

@media (hover: hover) {

    .floor-deck__job-list:hover,
    .floor-deck__machine-grid:hover {
        scrollbar-color: var(--floor-hairline-strong) transparent;
    }
}

.floor-deck__job-list {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 0;
    min-height: 0;
    height: 0;
}

.floor-deck__job-item {
    --floor-job-accent: var(--floor-blue);
    --floor-job-ink: var(--floor-blue-ink);
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(110px, 1.5fr) 56px minmax(0, auto);
    gap: 0 var(--floor-space-xs);
    align-items: center;
    padding: var(--floor-space-2xs) 0;
    border-bottom: 1px solid var(--floor-hairline);
}

.floor-deck__job-item:last-child {
    border-bottom: 0;
}

.floor-deck__job-item--on-track {
    --floor-job-accent: var(--floor-blue);
    --floor-job-ink: var(--floor-blue-ink);
}

.floor-deck__job-item--behind {
    --floor-job-accent: var(--floor-red);
    --floor-job-ink: var(--floor-red);
}

.floor-deck__job-item--over-target {
    --floor-job-accent: var(--floor-amber);
    --floor-job-ink: var(--floor-amber);
}

.floor-deck__job-item--complete {
    --floor-job-accent: var(--floor-green-fill);
    --floor-job-ink: var(--floor-green);
}

.floor-deck__job-id,
.floor-deck__job-track {
    min-width: 0;
}

.floor-deck__job-id strong,
.floor-deck__job-id span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floor-deck__job-id strong {
    color: var(--floor-ink);
    font-size: 13.5px;
    font-weight: 700;
}

.floor-deck__job-id span {
    color: var(--floor-muted);
    font-size: 11px;
    font-weight: 600;
}

.floor-deck__job-qty {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--floor-ink-soft);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floor-deck__job-qty b {
    color: var(--floor-ink);
    font-weight: 700;
}

.floor-deck__job-percent {
    color: var(--floor-job-ink);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.floor-deck__job-percent small {
    font-size: 11px;
    font-weight: 600;
}

.floor-deck__job-due {
    color: var(--floor-job-ink);
    font-size: 11.5px;
    font-style: normal;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.floor-deck__job-bar {
    display: block;
    overflow: hidden;
    height: 8px;
    border-radius: var(--floor-radius-pill);
    background: var(--floor-track);
    box-shadow: inset 0 0 0 1px var(--floor-track-edge);
}

.floor-deck__job-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--floor-job-accent);
}

.floor-deck__job-qty .floor-deck__job-variance {
    color: var(--floor-job-ink);
}

/* ---- tactical analysis ---- */

.floor-deck__analysis {
    padding: 0 var(--floor-pad-x) var(--floor-section-gap);
}

.floor-deck__analysis-heading {
    display: flex;
    flex-wrap: wrap;
    gap: var(--floor-space-3xs) var(--floor-space-xs);
    align-items: baseline;
    margin-bottom: var(--floor-space-2xs);
}

.floor-deck__analysis-heading h2 {
    color: var(--floor-on-dark);
    font-size: clamp(17px, 1.4vw, 20px);
}

.floor-deck__analysis-heading p {
    margin: 0;
    color: var(--floor-on-dark-muted);
    font-size: 13px;
}

.floor-deck__analysis-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
    gap: var(--floor-space-sm);
}

.floor-deck__analysis-card {
    min-height: 0;
    padding: var(--floor-space-xs);
}

.floor-deck__analysis-card--link {
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.floor-deck__analysis-card--link:focus-visible {
    outline: 3px solid var(--floor-focus);
    outline-offset: 2px;
}

.floor-deck__card-title {
    margin: 0;
    color: var(--floor-title-ink);
    font-size: 15px;
    font-weight: 600;
}

.floor-deck__card-title span {
    color: var(--floor-muted);
    font-size: 13px;
    font-weight: 400;
}

.floor-deck__analysis-card--dark {
    border-color: #344457;
    background: #202833;
    box-shadow: 0 8px 22px rgb(22 30 41 / 0.24);
    color: #f8fbff;
}

.floor-deck__analysis-card--dark .floor-deck__card-title {
    color: #f8fbff;
}

.floor-deck__analysis-card--dark .floor-deck__card-title span,
.floor-deck__analysis-card--dark .floor-deck__chart-labels {
    color: #afbecf;
}

.floor-deck__analysis-card--loss {
    border-color: #e2c9ef;
    background: #f7edfc;
}

.floor-deck__analysis-card--loss-quality {
    border-color: #f3c4ce;
    background: #fcecef;
}

.floor-deck__analysis-card--loss-technical {
    border-color: #cbdcff;
    background: #eaf1ff;
}

.floor-deck__analysis-card--loss-organization {
    border-color: #f1d39b;
    background: #fff4e1;
}

.floor-deck__analysis-card--loss-quality .floor-deck__loss-value {
    color: #c53c5d;
}

.floor-deck__analysis-card--loss-quality .floor-deck__sparkline polyline {
    stroke: #c53c5d;
}

.floor-deck__analysis-card--loss-technical .floor-deck__loss-value {
    color: #3676da;
}

.floor-deck__analysis-card--loss-technical .floor-deck__sparkline polyline {
    stroke: #3676da;
}

.floor-deck__analysis-card--loss-organization .floor-deck__loss-value {
    color: #b7791f;
}

.floor-deck__analysis-card--loss-organization .floor-deck__sparkline polyline {
    stroke: #b7791f;
}

.floor-deck__oee-bars {
    position: relative;
    display: flex;
    gap: 3px;
    align-items: end;
    height: 84px;
    margin-top: var(--floor-space-2xs);
    border-bottom: 1px solid var(--floor-edge-baseline);
}

.floor-deck__oee-bars::before {
    position: absolute;
    top: var(--target-line, 20%);
    right: 0;
    left: 0;
    border-top: 1.5px dashed var(--floor-target-line);
    content: '';
}

.floor-deck__oee-bars span {
    flex: 1;
    min-width: 2px;
    height: var(--bar-height, 2%);
    border-radius: 2px 2px 0 0;
    background: var(--floor-bar-on);
}

.floor-deck__oee-bars .is-below-target {
    background: var(--floor-bar-below);
}

.floor-deck__chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--floor-space-3xs);
    color: var(--floor-muted);
    font-size: 11px;
}

.floor-deck__loss-value {
    display: block;
    margin-top: var(--floor-space-3xs);
    font-size: clamp(22px, 1.7vw, 30px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.floor-deck__loss-value small {
    margin-left: var(--floor-space-3xs);
    color: var(--floor-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.floor-deck__sparkline {
    width: 100%;
    height: 42px;
    margin-top: var(--floor-space-2xs);
    overflow: visible;
}

.floor-deck__sparkline polyline {
    fill: none;
    stroke: var(--floor-magenta);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5.5;
    vector-effect: non-scaling-stroke;
}

/* ---- shared states ---- */

.floor-deck__empty {
    grid-column: 1 / -1;
    margin: var(--floor-space-2xs) 0;
    color: var(--floor-muted);
    font-size: 13px;
    font-weight: 500;
}

.floor-deck__retry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: var(--floor-space-xs) var(--floor-pad-x) 0;
    padding: 0 var(--floor-space-xs);
    border: 1px solid var(--floor-edge-control);
    border-radius: var(--floor-radius-sm);
    background: var(--floor-glass-control);
    color: var(--floor-on-dark-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--floor-motion-fast) var(--floor-ease), transform var(--floor-motion-fast) var(--floor-ease);
}

.floor-deck__analysis .floor-deck__retry {
    margin: 0 0 var(--floor-space-xs);
}

.floor-deck__retry:hover {
    background: var(--floor-edge-header);
    transform: translateY(-1px);
}

.floor-deck__retry:active {
    transform: translateY(1px);
}

.floor-deck__retry:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.floor-deck__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    white-space: nowrap;
}

.is-loading>* {
    opacity: 0.5;
}

/* ---- no-blur fallback ---- */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --floor-glass-header: #ffffff;
        --floor-glass-card: #ffffff;
        --floor-glass-panel: #ffffff;
        --floor-glass-tile: #f8fbff;
        --floor-glass-control: #f5f8fc;
        --floor-glass-dark: #eef5fb;
    }
}

/* ---- responsive ---- */

/* Sizes the deck to exactly one screen so every card is visible without page
   scrolling; the two operations lists absorb the slack and scroll internally.
   The 1100px floor matters: below it the KPI and analysis grids wrap to two
   rows each, which no longer fits one screen — those widths (and viewports
   under 560px tall) get ordinary page scrolling instead. */
@media (min-width: 1100px) and (min-height: 600px) {
    .floor-deck--deck {
        display: flex;
        flex-direction: column;
        /* syncDeckHeight() in FloorDeck.jsx measures the space the shell
           actually leaves and sets --floor-deck-height; the calc() is only a
           first-paint fallback for the frame before that runs. */
        height: var(--floor-deck-height, calc(100svh - var(--floor-shell-offset)));
        min-height: 0;
        padding-bottom: 0;
        /* Never scrollable. The deck is nearly window-tall, so a scrollbar here
           is indistinguishable from the page's — and the card entrance
           animation (translateY) alone is enough to summon one. The two
           operations lists are the only things that scroll. */
        overflow: clip;
    }

    /* No min-height here: the operations band is the deck's only flexible row,
       so anything it refuses to give up gets pushed off the bottom instead. */
    .floor-deck--deck .floor-deck__operations-grid {
        flex: 1 1 auto;
        min-height: 0;
    }

}

/* On short screens the fixed rows have to give way, or the operations lists
   are left with almost no room. */
@media (min-width: 1100px) and (min-height: 720px) and (max-height: 880px) {
    .floor-deck--deck {
        --floor-section-gap: 14px;
    }

    .floor-deck--deck .floor-deck__metric {
        min-height: 96px;
    }

    .floor-deck--deck .floor-deck__analysis-heading p {
        display: none;
    }

    .floor-deck--deck .floor-deck__oee-bars {
        height: 58px;
    }

    .floor-deck--deck .floor-deck__sparkline {
        height: 32px;
    }

    .floor-deck--deck .floor-deck__loss-value {
        font-size: clamp(20px, 1.5vw, 24px);
    }
}

/* Very short viewports — a 1080p screen at 150% zoom lands here. Everything
   outside the operations band is squeezed to its floor so the two lists keep
   a usable amount of room. */
@media (min-width: 1100px) and (min-height: 600px) and (max-height: 719px) {
    .floor-deck--deck {
        --floor-section-gap: 10px;
    }

    /* Cards keep every figure; only the chrome around them gives way. */
    .floor-deck--deck .floor-deck__header {
        padding-top: var(--floor-space-3xs);
        padding-bottom: var(--floor-space-3xs);
    }

    .floor-deck--deck .floor-deck__metric {
        min-height: 0;
        gap: 2px;
        padding: var(--floor-space-2xs);
    }

    .floor-deck--deck .floor-deck__metric-value {
        font-size: clamp(20px, 1.5vw, 26px);
    }

    .floor-deck--deck .floor-deck__metric-detail {
        min-height: 0;
    }

    .floor-deck--deck .floor-deck__semi--md {
        width: 58px;
        height: 29px;
    }

    .floor-deck--deck .floor-deck__analysis-heading {
        margin-bottom: var(--floor-space-3xs);
    }

    .floor-deck--deck .floor-deck__analysis-heading p {
        display: none;
    }

    .floor-deck--deck .floor-deck__analysis-card {
        padding: var(--floor-space-2xs);
    }

    .floor-deck--deck .floor-deck__oee-bars {
        height: 32px;
        margin-top: var(--floor-space-3xs);
    }

    .floor-deck--deck .floor-deck__sparkline {
        height: 18px;
        margin-top: var(--floor-space-3xs);
    }

    .floor-deck--deck .floor-deck__loss-value {
        margin-top: 0;
        font-size: clamp(18px, 1.3vw, 22px);
    }

    /* Axis captions are the first thing that can go — the bars and the
       headline number still carry the reading. */
    .floor-deck--deck .floor-deck__chart-labels {
        display: none;
    }
}

/* Both bands hold one row down to 1100px — that is what lets the deck fit a
   single screen at 150% browser zoom. Below it they wrap and the deck goes
   back to page scrolling. */
@media (max-width: 1099px) {
    .floor-deck__metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .floor-deck__analysis-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .floor-deck__oee-trend {
        grid-column: span 2;
    }
}

/* Outside the viewport lock nothing caps the panels, so a large fleet would
   push the page metres long before the user reaches the bottom. Bound them so
   both lists scroll in place instead. */
@media (max-width: 1099px),
(max-height: 599px) {

    .floor-deck__status-panel,
    .floor-deck__jobs-panel {
        height: min(58svh, 520px);
    }
}

@media (max-width: 1024px) {
    .floor-deck__operations-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .floor-deck__metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .floor-deck__date-control small {
        display: none;
    }

    .floor-deck__metric {
        min-height: 112px;
    }

    /* Stack the job row: id + percent, then the bar, then the due label. */
    .floor-deck__job-item {
        grid-template-columns: minmax(0, 1fr) 56px;
        row-gap: var(--floor-space-3xs);
    }

    .floor-deck__job-id {
        grid-area: 1 / 1;
    }

    .floor-deck__job-percent {
        grid-area: 1 / 2;
    }

    .floor-deck__job-track {
        grid-area: 2 / 1 / auto / -1;
    }

    .floor-deck__job-due {
        grid-area: 3 / 1 / auto / -1;
        text-align: left;
    }
}

@media (max-width: 414px) {
    .floor-deck__header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--floor-space-2xs) var(--floor-space-xs);
    }

    .floor-deck__date-control {
        grid-column: 1;
        grid-row: 2;
        justify-self: end;
    }

    .floor-deck__live {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }

    .floor-deck__view-tabs {
        grid-column: 1 / -1;
    }

    .floor-deck__metric-grid,
    .floor-deck__analysis-grid,
    .floor-deck__machine-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .floor-deck__oee-trend {
        grid-column: auto;
    }

    .floor-deck__jobs-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 320px) {
    .floor-deck__metric-value {
        font-size: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .floor-deck *,
    .floor-deck *::before,
    .floor-deck *::after {
        scroll-behavior: auto;
        transition-duration: 1ms;
    }

    .floor-deck__metric,
    .floor-deck__machine-card,
    .floor-deck__job-item,
    .floor-deck__analysis-card,
    .floor-deck__date-control:hover .floor-deck__date-icon,
    .floor-deck__info-popover {
        animation: none;
    }

    .floor-deck__date-control:hover {
        transform: none;
    }
}

.bom-action-trigger {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #fff;
    color: #495057;
    letter-spacing: 1px;
    padding-bottom: 4px;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.bom-action-trigger:hover {
    background-color: #f1f3f5 !important;
    border-color: #adb5bd !important;
}

.bom-action-menu {
    z-index: 9999;
    min-width: 160px;
    padding: 4px 0;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.table-row-action-menu {
    position: fixed;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
}

.bom-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    transition: background-color 0.12s;
}

.bom-menu-item:hover {
    background-color: #f8f9fa;
}

.bom-menu-item--danger {
    color: #dc3545;
}

.bom-menu-item--danger:hover {
    background-color: #fff5f5;
    color: #b02a37;
}

.bom-menu-item--copy {
    color: #6f42c1;
}

.bom-menu-item--copy:hover {
    background-color: #f3eeff;
}

.bom-menu-item--paste {
    color: #198754;
}

.bom-menu-item--paste:hover {
    background-color: #eafaf1;
}


/*# sourceMappingURL=main-09176910.3af944ad.css.map*/