/* Copyright (c) Sunmara GmbH. All rights reserved. */

:root {
    --swa-ink: #141414;
    --swa-nebel-100: #A6B4B8;
    --swa-nebel-300: #8A9CA0;
    --swa-nebel-600: #5E7077;
    --swa-gray-700: #475159;
    --swa-gray-300: #DCE2E5;
    --swa-gray-100: #F6F8F9;
    --swa-error: #9B3D4A;
    --swa-error-surface: #F8F1F2;
}

html, body {
    font-family: Inter, Helvetica, Arial, sans-serif;
    margin: 0;
}

.swa-appbar {
    border-bottom: 1px solid var(--swa-gray-300);
}

.swa-wordmark {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.swa-table {
    border: 1px solid var(--swa-gray-300);
    border-radius: 12px;
}

.swa-metric .mud-typography-h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

/* Monospace so the snippet is scannable and line breaks stay predictable. */
.swa-snippet .mud-input-slot {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
}

/* The integration brief is preformatted text: its indentation and blank lines
   carry meaning for the agent that receives it, so it must not be re-wrapped.
   Scrolls inside its own box rather than widening the settings page. */
.swa-ai-brief {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    margin: 0;
    max-height: 32rem;
    overflow: auto;
    white-space: pre;
}

.swa-danger-zone {
    border-color: var(--swa-error);
}

/* Breakdown bars are CSS, not charts: ten charts on one page would mean ten
   JavaScript interop round-trips over the Blazor circuit on every reload. */

/* Theme-dependent values live on custom properties, and the properties exist at
   two levels. :root plus the media query is only the default, for pages that
   carry no theme toggle (sign-in, public share). The dashboard sets .swa-dark
   or .swa-light on its layout root, and a variable on an ancestor beats the
   :root one whatever media query set it - which is what lets the app's toggle
   override the operating system in BOTH directions. Keying these off
   prefers-color-scheme alone left dark bars standing in a light dashboard for
   every user whose OS runs dark. */
/* Two tones per theme. --swa-bar is the uniform full-width tint of a breakdown
   row - the share is carried by the number alone, an owner decision after two
   rounds with proportional bar lengths that read as broken alignment rather
   than as data. --swa-chart-bar is for the realtime minute columns and is
   deliberately much stronger: a column chart is read against empty space, not
   against a label sitting on top of it, and the row tint was near-invisible
   there in both themes. Nebel-600/-300 per the palette proposal in CLAUDE.md. */
:root {
    --swa-bar: #E8EDEF;
    --swa-chart-bar: var(--swa-nebel-600);
    --swa-breakdown-value: var(--swa-gray-700);
}

@media (prefers-color-scheme: dark) {
    :root {
        --swa-bar: #262626;
        --swa-chart-bar: var(--swa-nebel-300);
        --swa-breakdown-value: var(--swa-nebel-100);
    }
}

.swa-light {
    --swa-bar: #E8EDEF;
    --swa-chart-bar: var(--swa-nebel-600);
    --swa-breakdown-value: var(--swa-gray-700);
}

.swa-dark {
    --swa-bar: #262626;
    --swa-chart-bar: var(--swa-nebel-300);
    --swa-breakdown-value: var(--swa-nebel-100);
}

.swa-breakdown__row {
    margin-bottom: 2px;
}

.swa-breakdown__row--clickable {
    cursor: pointer;
}

.swa-breakdown__row--clickable:hover .swa-breakdown__bar {
    outline: 1px solid var(--swa-nebel-300);
}

.swa-breakdown__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--swa-bar);
}

.swa-breakdown__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.swa-breakdown__value {
    flex: none;
    font-variant-numeric: tabular-nums;
    color: var(--swa-breakdown-value);
}

.swa-delta {
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Named for the reading, not for the sign: a rising bounce rate is bad news
   and has to be coloured as such. */
.swa-delta--good {
    color: #3D6B5C;
}

.swa-delta--bad {
    color: #9B3D4A;
}

/* Sign-in: minimal and centred, no product description or promotional text.
   Anonymous pages have no theme toggle, so following the system preference via
   the media queries below is correct there. */
.swa-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--swa-gray-100);
    padding: 24px;
}

.swa-login__card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid var(--swa-gray-300);
    border-radius: 12px;
    padding: 32px;
}

.swa-login__wordmark {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--swa-ink);
    margin: 0 0 24px;
}

.swa-login__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--swa-gray-700);
    margin-bottom: 6px;
}

.swa-login__input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 16px;
    font: inherit;
    color: var(--swa-ink);
    background: #fff;
    border: 1px solid var(--swa-gray-300);
    border-radius: 8px;
}

.swa-login__input:focus {
    outline: none;
    border-color: var(--swa-nebel-600);
    box-shadow: 0 0 0 3px rgba(94, 112, 119, 0.15);
}

.swa-login__button {
    width: 100%;
    padding: 11px 16px;
    font: inherit;
    font-weight: 500;
    color: #fff;
    background: var(--swa-ink);
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

.swa-login__button:hover {
    background: #000;
}

.swa-login__error {
    color: var(--swa-error);
    background: var(--swa-error-surface);
    font-size: 0.8125rem;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 0 16px;
}

.validation-message {
    color: var(--swa-error);
    font-size: 0.8125rem;
    display: block;
    margin: -10px 0 12px;
}

@media (prefers-color-scheme: dark) {
    .swa-login {
        background: var(--swa-ink);
    }

    .swa-login__card {
        background: #1D1D1D;
        border-color: #2F2F2F;
    }

    .swa-login__wordmark {
        color: #fff;
    }

    .swa-login__label {
        color: var(--swa-nebel-100);
    }

    .swa-login__input {
        color: #fff;
        background: #141414;
        border-color: #2F2F2F;
    }

    .swa-login__button {
        color: var(--swa-ink);
        background: #fff;
    }
}

/* Realtime: repainted every five seconds, so everything here is plain CSS. */
.swa-realtime-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 96px;
}

.swa-realtime-bars__bar {
    flex: 1 1 0;
    min-width: 3px;
    border-radius: 2px 2px 0 0;
    background: var(--swa-chart-bar);
}

.swa-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
    background: #3D6B5C;
    animation: swa-live-pulse 2s ease-in-out infinite;
}

@keyframes swa-live-pulse {
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .swa-live-dot { animation: none; }
}

.swa-login__button--oidc {
    display: block;
    text-align: center;
    text-decoration: none;
    margin-bottom: 4px;
}

.swa-login__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--swa-gray-700, #6b7280);
    font-size: 0.8125rem;
}

.swa-login__divider::before,
.swa-login__divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--swa-gray-300, #d1d5db);
}

/* Public dashboard: standalone page without rail or user menu. */
.swa-share {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.swa-share__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.swa-share__wordmark {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.swa-share__password {
    max-width: 380px;
    margin: 48px auto;
}

/* Diagnostics: values and log lines are meant to be selected and pasted, so they
   stay monospaced and wrap rather than scroll a report out of sight. */
.swa-diagnostics__value {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
}

.swa-diagnostics__log {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    background: var(--mud-palette-background-gray);
}
