/* Intentional product-level overrides on top of the Silicon UI Kit. */

/* Product typography. */
:root {
    --bs-body-font-family: "Google Sans", sans-serif;
}
body {
    font-family: "Google Sans", sans-serif;
    font-optical-sizing: auto;
    font-variation-settings: "GRAD" 0;
}

/* Authentication surface. */
.authentication-bg {
    background-color: #f6f8fb;
    background-image: linear-gradient(135deg, #f6f8fb 0%, #eef2f7 100%);
}
.authentication-bg .card {
    border: 0;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.06);
}

/* Bootstrap has no max-width utility; keep every login method in one visual column. */
.login-methods {
    width: 100%;
    max-width: 400px;
}

#workos-google-login-form {
    width: 100%;
}

/*
 * Google Identity branding exception.
 * This component intentionally follows Google's generated HTML-button CSS
 * instead of Silicon so the provider control retains Google's required logo,
 * typography, colors, spacing, and interaction states.
 */
.gsi-material-button {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border: 1px solid #747775;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #1f1f1f;
    cursor: pointer;
    font-family: "Roboto", Arial, sans-serif;
    font-size: 14px;
    height: 40px;
    letter-spacing: 0.25px;
    outline: none;
    overflow: hidden;
    padding: 0 12px;
    position: relative;
    text-align: center;
    -webkit-transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s;
    transition: background-color 0.218s, border-color 0.218s, box-shadow 0.218s;
    vertical-align: middle;
    white-space: nowrap;
    width: 100%;
    max-width: 400px;
    min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
    height: 20px;
    margin-right: 10px;
    min-width: 20px;
    width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
    -webkit-align-items: center;
    align-items: center;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: nowrap;
    flex-wrap: nowrap;
    height: 100%;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
    -webkit-flex-grow: 1;
    flex-grow: 1;
    font-family: "Roboto", Arial, sans-serif;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
    -webkit-transition: opacity 0.218s;
    transition: opacity 0.218s;
    bottom: 0;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.gsi-material-button:disabled {
    cursor: default;
    background-color: #ffffff61;
    border-color: #1f1f1f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents,
.gsi-material-button:disabled .gsi-material-button-icon {
    opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
    background-color: #303030;
    opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
    -webkit-box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
        0 1px 3px 1px rgba(60, 64, 67, 0.15);
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3),
        0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
    background-color: #303030;
    opacity: 8%;
}

/* Keep the varied device-card layouts aligned as one calm, scannable grid. */
@media (min-width: 768px) {
    .device-card {
        min-height: 17rem;
    }
}

/* Live device state: concentric signals keep the motion calm and purposeful. */
.device-live-card {
    background: linear-gradient(145deg, #fff 58%, rgba(var(--si-success-rgb), 0.08));
}
.device-status-visual {
    position: relative;
    width: 8.5rem;
    height: 8.5rem;
    margin-right: auto;
    margin-left: auto;
}
.device-status-ring,
.device-status-core {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.device-status-ring {
    border: 1px solid rgba(var(--si-success-rgb), 0.38);
    animation: device-status-ripple 2.4s ease-out infinite;
}
.device-status-ring-inner {
    width: 5.4rem;
    height: 5.4rem;
}
.device-status-ring-outer {
    width: 8rem;
    height: 8rem;
    animation-delay: 0.8s;
}
.device-status-core {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    font-size: 1.8rem;
    animation: device-status-glow 2.4s ease-in-out infinite;
}
.device-live-dot {
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 rgba(var(--si-success-rgb), 0.4);
    animation: device-live-dot 1.8s ease-out infinite;
}

@keyframes device-status-ripple {
    0% { opacity: 0.8; transform: translate(-50%, -50%) scale(0.72); }
    75%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes device-status-glow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.06); }
}
@keyframes device-live-dot {
    0% { box-shadow: 0 0 0 0 rgba(var(--si-success-rgb), 0.4); }
    70%, 100% { box-shadow: 0 0 0 0.4rem rgba(var(--si-success-rgb), 0); }
}

/* The axis-free sparkline bleeds to the card edges inside a clipped, text-free
   plot band. Its data can change freely without crossing readable content. */
.device-trend-card {
    background: linear-gradient(180deg, #fff 0%, #fff 42%, rgba(var(--si-primary-rgb), 0.045) 100%);
}
.device-trend-reading {
    max-width: 18rem;
}
.device-trend-plot {
    min-height: 6.5rem;
    margin-right: -1.5rem;
    margin-left: -1.5rem;
    overflow: hidden;
}
.device-trend-chart {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.78;
    pointer-events: none;
}
.device-trend-footer {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.72);
}

/* Expanded device trend. The modal chart gets a stable host height so ECharts
   can calculate its canvas when Bootstrap finishes revealing the dialog. */
.device-detail-chart {
    width: 100%;
    height: 28rem;
    min-height: 28rem;
}

/* Compact device conversation. Messages remain inside a bounded log so user
   input cannot cause the card to grow and break the surrounding grid. */
.device-chat-card {
    background: linear-gradient(145deg, #fff 62%, rgba(var(--si-primary-rgb), 0.055));
}
.device-chat-log {
    min-height: 8.75rem;
    max-height: 8.75rem;
    overflow-y: auto;
    background: var(--si-gray-100);
    scrollbar-width: thin;
}
.device-chat-log.is-scrolled {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.35rem, #000 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 1.35rem, #000 100%);
}
.device-chat-message {
    width: fit-content;
    max-width: 88%;
    border-radius: 0.75rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.75rem;
    line-height: 1.4;
}
.device-chat-message + .device-chat-message {
    margin-top: 0.55rem;
}
.device-chat-message-output {
    border: 1px solid var(--si-border-color);
    background: #fff;
    color: var(--si-body-color);
}
.device-chat-message-input {
    margin-left: auto;
    background: var(--si-primary);
    color: #fff;
}
.device-chat-speaker {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    opacity: 0.72;
    text-transform: uppercase;
}

/* Predictive health is deliberately glanceable: the conic ring communicates
   the score while the adjacent definition list carries exact diagnostics. */
.device-health-gauge {
    position: relative;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    background: conic-gradient(var(--si-warning) 0 82%, var(--si-gray-200) 82% 100%);
}
.device-health-gauge::before {
    position: absolute;
    inset: 0.65rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--si-border-color);
    content: "";
}
.device-health-gauge-value {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: baseline;
    transform: translate(-50%, -50%);
}
.device-health-gauge-value strong {
    color: var(--si-heading-color);
    font-size: 1.5rem;
    line-height: 1;
}
.device-health-gauge-value span {
    color: var(--si-gray-600);
    font-size: 0.625rem;
}

@media (prefers-reduced-motion: reduce) {
    .device-status-ring,
    .device-status-core,
    .device-live-dot {
        animation: none;
    }
    .device-status-ring-inner { opacity: 0.55; }
    .device-status-ring-outer { opacity: 0.28; }
}

/* Dashboard analytics. ECharts needs an explicit height on each host element. */
.dashboard-chart {
    width: 100%;
    height: 19rem;
    min-height: 19rem;
}
.dashboard-chart-lg {
    height: 22rem;
    min-height: 22rem;
}
.chart-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
}

@media (max-width: 575.98px) {
    .device-detail-chart {
        height: 21rem;
        min-height: 21rem;
    }
    .dashboard-chart,
    .dashboard-chart-lg {
        height: 17rem;
        min-height: 17rem;
    }
}

/* =========================================================================
   Gas Sensor Dashboard: device-card grid toolbar, skeleton placeholders, the
   ECharts trend frame, and the per-field reading stat grid. Trend tokens are
   namespaced under `.gas-trend-*`; the reading cards under `.gas-detail__*`;
   the dashboard device-card matrix under `.device-matrix__*`.
   ========================================================================= */

/* Identity line under a device-card name: "SN: … · Project …". */
.device-card-id {
    word-break: break-word;
}

/* Dense telemetry matrix ("Assembly Line Meter" card template): values keep
   tabular figures so stacked readings align; the wrapper dl carries the
   rounded frame via Bootstrap utilities (border-top border-start rounded-3)
   and each cell its own hairline borders (border-end border-bottom). */
.device-matrix__value {
    font-variant-numeric: tabular-nums;
    color: var(--si-heading-color);
}
.device-matrix__unit {
    font-weight: 600;
    color: var(--si-gray-600);
}
.device-matrix__accent--warning {
    color: var(--si-warning);
}
.device-matrix__accent--danger {
    color: var(--si-danger);
}

/* Search is intentionally wider than sort; the sort control stays anchored to
   the dashboard's right edge without either field becoming overly wide. */
.device-toolbar {
    display: flex;
    align-items: end;
    gap: 1rem;
    width: 100%;
}

.device-toolbar__search {
    flex: 1 1 36rem;
    max-width: 36rem;
}

/* Sort grouped at the toolbar's right edge. */
.device-toolbar__controls {
    display: flex;
    align-items: end;
    gap: 1rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.device-toolbar__sort {
    flex: 0 0 18rem;
    max-width: 18rem;
}

@media (max-width: 767.98px) {
    .device-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .device-toolbar__search {
        flex-basis: auto;
        max-width: none;
        margin-left: 0;
    }

    .device-toolbar__controls {
        flex-direction: row;
        align-items: end;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
    }

    .device-toolbar__sort {
        flex: 1 1 auto;
        max-width: none;
        margin-left: 0;
    }
}

/* Skeleton placeholders for the first load. The shimmer is disabled under
   prefers-reduced-motion (see the global motion block below). */
.gas-skeleton-bar {
    position: relative;
    overflow: hidden;
    background: linear-gradient(100deg, #eef1f8 30%, #f7f8fc 50%, #eef1f8 70%);
    background-size: 200% 100%;
    animation: gas-skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes gas-skeleton-shimmer {
    0% { background-position: 180% 0; }
    100% { background-position: -180% 0; }
}

/* Trend frame: one framed host holds the ECharts canvas and its state overlays. */
.gas-trend-frame {
    position: relative;
    width: 100%;
    height: 26rem;
    min-height: 26rem;
}
.gas-trend-chart {
    width: 100%;
    height: 100%;
}
.gas-trend-state {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
}
.gas-trend-state:not(.d-none) {
    display: flex;
}
/* Device-details page: stacked charts inside a .row/.col wrapper.
   The column wrappers have no intrinsic height, so the percentage chain
   (.gas-trend-frame 26rem → .gas-trend-chart height:100%) breaks and the
   canvas collapses to 0. Give each host an explicit height instead. */
.gas-trend-frame--split {
    height: auto;
    min-height: 0;
}
.gas-trend-frame--split .gas-trend-chart {
    height: 22rem;
    min-height: 22rem;
}
@media (max-width: 575.98px) {
    .gas-trend-frame--split .gas-trend-chart {
        height: 18rem;
        min-height: 18rem;
    }
}
.gas-trend-message p {
    max-width: 28rem;
}

@media (max-width: 575.98px) {
    .gas-trend-frame:not(.gas-trend-frame--split) {
        height: 20rem;
        min-height: 20rem;
    }
}

/* Respect reduced-motion across the dashboard surface: stop the skeleton
   shimmer and any decorative ECharts animation. Keep all state panels fully
   legible. */
@media (prefers-reduced-motion: reduce) {
    .gas-skeleton-bar {
        animation: none;
        background: #eef1f8;
    }
    .gas-trend-chart {
        transition: none;
    }
}

/* =========================================================================
   Device details page: reading stat grid (one card per gas field) and the
   environment card. Namespaced under `.gas-detail__*`.
   ========================================================================= */

/* Responsive stat grid: one card per reading. */
.gas-detail__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1rem;
}
.gas-detail__stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--si-border-color);
    border-radius: 0.75rem;
}
.gas-detail__stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--si-heading-color);
    word-break: break-word;
}
.gas-detail__stat-unit {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--si-gray-600);
}
.gas-detail__stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--si-gray-600);
}

/* =========================================================================
   Device details header card (DZASS-style): SN line + metadata row.
   Namespaced classes mirror the reference portal so the layout reads the same
   without depending on any DZASS stylesheet.
   ========================================================================= */
.device-card-sn {
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    word-break: break-all;
}
.detail-meta {
    border-top: 1px solid var(--si-border-color);
    padding-top: 0.75rem;
}
@media (max-width: 575.98px) {
    .detail-meta {
        flex-direction: column;
        gap: 0.35rem !important;
    }
}\n
