/* ==========================================================================
   WD Power brand tokens.

   Measured off the master logo (QMS/Images/WDpower-logo-Small-01.jpg), not
   guessed: the flat fill areas are #404B9B and #FFF100. Everything below is
   derived from those two.

   Contrast, measured against the surfaces they are actually used on:

     navy   on white          7.78:1   AA  — body links, buttons, headings
     white  on navy           7.78:1   AA  — sidebar text
     yellow on navy           6.61:1   AA  — the signature pairing
     ink    on yellow        16.72:1   AA  — anything sitting inside a yellow chip
     yellow on white          1.18:1   FAIL

   That last line is the rule that shapes the whole system: brand yellow can
   never be text, a hairline, or an icon on a light surface. It is a block
   colour that carries ink, or an accent sitting on navy. Nothing else.

   THESE ARE CHROME COLOURS AND NEVER ENTER A CHART.
   The categorical --viz-* ramp below is validated for CVD separation, and the
   brand pair lands on top of two of its slots — navy is dE 20.4 from --viz-7
   violet and dE 21.0 from --viz-1 blue, brand yellow is dE 37.2 from
   --viz-warning. Painting a series brand-navy would put two near-identical
   blues in one legend; painting anything brand-yellow next to a warning pip
   makes an accent look like a status. Frame, nav, buttons and headings are
   brand. Data marks and status are --viz-*. The two vocabularies do not mix.
   ========================================================================== */

:root {
    --wd-navy:        #404B9B;   /* logo navy — primary brand colour          */
    --wd-navy-mid:    #2C3370;   /* gradient midpoint                         */
    --wd-navy-deep:   #20255C;   /* sidebar foot, app icon field              */
    --wd-navy-tint:   #eceef7;   /* 8% navy on white — quiet fills            */
    --wd-yellow:      #FFF100;   /* logo yellow — accent only, never text     */
    --wd-yellow-deep: #d9cd00;   /* for the rare yellow-on-light edge         */
    --wd-on-yellow:   #0b0b0b;   /* the only ink allowed inside a yellow chip */

    /* The diagonal hatch that fills the D of the logo, lifted as a motif.
       ~200 bytes, tiles at any size, and it is the one piece of brand texture
       that survives a 2G link. Used at low opacity behind navy panels only. */
    --wd-hatch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-4 18L18 -4M-4 4L4 -4M10 18L18 10' stroke='%23ffffff' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
}

html, body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

a, .btn-link {
    color: var(--wd-navy);
}

.btn-primary {
    color: #fff;
    background-color: var(--wd-navy);
    border-color: var(--wd-navy);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--wd-navy-mid);
    border-color: var(--wd-navy-mid);
}

/* Focus is brand navy with a white inner ring so it reads on both the light
   content area and the navy sidebar. */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--wd-navy);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

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

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

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOT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vPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ==========================================================================
   Data-visualisation tokens.

   Roles, not raw hex, so light and dark swap in one place. The categorical
   order is fixed and validated — slots are assigned by entity, never by rank,
   so filtering a series out never repaints the survivors.

   Validated with the dataviz palette validator:
     light  worst adjacent CVD dE 9.1, normal-vision dE 19.6  (three slots are
            below 3:1 on the light surface, so every chart ships direct labels
            and a table view — that is the required relief, not an option)
     dark   worst adjacent CVD dE 8.4, normal-vision dE 19.3, all >= 3:1
   ========================================================================== */

:root {
    --viz-surface:      #fcfcfb;
    --viz-plane:        #f9f9f7;
    --viz-ink:          #0b0b0b;
    --viz-ink-2:        #52514e;
    --viz-muted:        #898781;
    --viz-grid:         #e1e0d9;
    --viz-axis:         #c3c2b7;
    --viz-hairline:     rgba(11, 11, 11, 0.10);

    --viz-1: #2a78d6;   /* blue    */
    --viz-2: #eb6834;   /* orange  */
    --viz-3: #1baf7a;   /* aqua    */
    --viz-4: #eda100;   /* yellow  */
    --viz-5: #e87ba4;   /* magenta */
    --viz-6: #008300;   /* green   */
    --viz-7: #4a3aa7;   /* violet  */
    --viz-8: #e34948;   /* red     */

    /* Status is reserved. It never doubles as a series colour, and it never
       carries meaning alone — every use is paired with an icon and a word. */
    --viz-good:     #0ca30c;
    --viz-warning:  #fab219;
    --viz-serious:  #ec835a;
    --viz-critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --viz-surface:  #1a1a19;
        --viz-plane:    #0d0d0d;
        --viz-ink:      #ffffff;
        --viz-ink-2:    #c3c2b7;
        --viz-muted:    #898781;
        --viz-grid:     #2c2c2a;
        --viz-axis:     #383835;
        --viz-hairline: rgba(255, 255, 255, 0.10);

        --viz-1: #3987e5;
        --viz-2: #d95926;
        --viz-3: #199e70;
        --viz-4: #c98500;
        --viz-5: #d55181;
        --viz-6: #008300;
        --viz-7: #9085e9;
        --viz-8: #e66767;
    }
}

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

.viz-figure {
    background: var(--viz-surface);
    border: 1px solid var(--viz-hairline);
    border-radius: .5rem;
    padding: .75rem .9rem 1rem;
    /* 720px viewBox + .9rem padding either side. The card tracks the chart it
       holds, so a capped chart does not sit stranded in a full-viewport box. */
    max-width: 47rem;
}

.viz-figure > figcaption {
    color: var(--viz-ink);
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: .1rem;
}

.viz-sub {
    color: var(--viz-muted);
    font-size: .78rem;
    margin-bottom: .5rem;
}

.viz-chart { display: block; width: 100%; height: auto; overflow: visible; }

/* Gridlines and axes are solid hairlines one step off the surface. Never
   dashed — dashing reads as "projection" when it is only a grid. */
.viz-grid-line { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis-line { stroke: var(--viz-axis); stroke-width: 1; }
.viz-tick      { fill: var(--viz-muted); font-size: 10px; font-variant-numeric: tabular-nums; }

/* 2px line, round join/cap. Gaps are real gaps: the path simply breaks.

   The element+class selector is deliberate. The .viz-sN series colours below
   set `fill` for the end-marker dots, and they come later in the sheet, so a
   bare `.viz-line { fill: none }` loses the tie on specificity and every line
   is painted as a filled area — SVG closes an open subpath to fill it, which
   turns each segment into a wedge. `path.viz-line` outranks .viz-sN and keeps
   lines as lines regardless of source order. */
path.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
                vector-effect: non-scaling-stroke; }
.viz-area  { stroke: none; opacity: .10; }

/* End markers carry a 2px surface ring so they stay legible where lines cross. */
.viz-dot   { stroke: var(--viz-surface); stroke-width: 2; }

.viz-label { fill: var(--viz-ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }

.viz-s1 { stroke: var(--viz-1); fill: var(--viz-1); }
.viz-s2 { stroke: var(--viz-2); fill: var(--viz-2); }
.viz-s3 { stroke: var(--viz-3); fill: var(--viz-3); }
.viz-s4 { stroke: var(--viz-4); fill: var(--viz-4); }
.viz-s5 { stroke: var(--viz-5); fill: var(--viz-5); }
.viz-s6 { stroke: var(--viz-6); fill: var(--viz-6); }
.viz-s7 { stroke: var(--viz-7); fill: var(--viz-7); }
.viz-s8 { stroke: var(--viz-8); fill: var(--viz-8); }

/* ------------------------------------------------------------------- legend */

.viz-legend {
    display: flex; flex-wrap: wrap; gap: .25rem 1rem;
    list-style: none; margin: .4rem 0 0; padding: 0;
    font-size: .8rem; color: var(--viz-ink-2);
}

.viz-legend li { display: flex; align-items: center; gap: .4rem; }

/* Identity comes from the mark beside the text, never from colouring the text. */
.viz-key { width: 14px; height: 3px; border-radius: 2px; flex: none; }

/* ---------------------------------------------------------------- stat tiles */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .75rem;
}

.stat-tile {
    background: var(--viz-surface);
    border: 1px solid var(--viz-hairline);
    border-radius: .5rem;
    padding: .6rem .75rem .5rem;
}

.stat-label { color: var(--viz-muted); font-size: .75rem; }

/* Proportional figures on purpose: tabular-nums makes a display-size number
   look loose. Tabular is reserved for columns that must align. */
.stat-value { color: var(--viz-ink); font-size: 1.5rem; font-weight: 600; line-height: 1.15; }
.stat-unit  { color: var(--viz-ink-2); font-size: .85rem; font-weight: 400; margin-left: .15rem; }

/* Absent data is "n/a" in muted text. Never 0, never blank. */
.stat-na    { color: var(--viz-muted); font-size: 1.5rem; font-weight: 400; }

/* ----------------------------------------------------------------- state pips */

.state-pip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem; white-space: nowrap;
}

.state-pip::before {
    content: ""; width: .55rem; height: .55rem; border-radius: 50%; flex: none;
}

.state-reporting::before     { background: var(--viz-good); }
.state-late::before          { background: var(--viz-warning); }
.state-silent::before        { background: var(--viz-critical); }
.state-neverreported::before { background: var(--viz-muted); }

.sev-info     { color: var(--viz-ink-2); }
.sev-warn     { color: var(--viz-serious); }
.sev-fault    { color: var(--viz-critical); font-weight: 600; }

.table-viz { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- identity chrome */

.identity-name {
    color: var(--viz-ink-2);
    font-size: .9rem;
    margin-right: auto;
}

.signout-form {
    display: inline;
    margin: 0;
}

.signout-form .btn-link {
    padding: 0;
    vertical-align: baseline;
}

/* ---------------------------------------------------------------- sign-in */

/* The one screen with room to be brand-forward: it carries no data, so the
   navy panel and the hatch motif cost nothing in legibility. Every screen
   after this one is quieter — measurements outrank identity once you are in. */

.signin-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 3rem 1rem;
    background:
        radial-gradient(ellipse 90rem 40rem at 50% -8rem, var(--wd-navy-tint), transparent 70%);
}

.signin-card {
    width: 100%;
    max-width: 26rem;
    border: 1px solid var(--viz-grid);
    border-radius: 10px;
    overflow: hidden;
    background: var(--viz-surface);
    box-shadow: 0 1px 2px rgba(32, 37, 92, .06), 0 8px 24px -12px rgba(32, 37, 92, .28);
}

/* Navy masthead carrying the reversed lockup. */
.signin-masthead {
    position: relative;
    background: linear-gradient(160deg, var(--wd-navy) 0%, var(--wd-navy-deep) 100%);
    padding: 1.75rem 2rem 1.5rem;
}

.signin-masthead::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--wd-hatch);
    opacity: .07;
    pointer-events: none;
}

.signin-masthead > * { position: relative; }

.signin-masthead img {
    display: block;
    width: 9.5rem;
    height: auto;
}

.signin-body { padding: 1.75rem 2rem 2rem; }

.signin-card h1 {
    font-size: 1.35rem;
    letter-spacing: -.01em;
    margin: .9rem 0 .2rem;
    color: #fff;
}

.signin-lede {
    color: rgba(255, 255, 255, .74);
    font-size: .875rem;
    margin-bottom: 0;
}

/* Status note: yellow is the accent, but it is a rule beside ink — never the
   text itself, which would be 1.18:1 on this surface. */
.signin-note {
    border-left: 3px solid var(--wd-yellow);
    background: #fffdf0;
    padding: .55rem .75rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

.signin-option + .signin-option {
    border-top: 1px solid var(--viz-grid);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.signin-option h2 { font-size: 1rem; margin-bottom: .25rem; }

.signin-option p {
    color: var(--viz-muted);
    font-size: .85rem;
    margin-bottom: .75rem;
}

.signin-foot {
    color: var(--viz-muted);
    font-size: .75rem;
    text-align: center;
    margin: 1.25rem 0 0;
}

/* Same shape as .signin-note, different rule colour: a failed sign-in is a
   status, not an alarm, and it must not out-shout the form it sits above. */
.signin-error {
    border-left: 3px solid var(--viz-critical);
    background: #fff5f5;
    padding: .55rem .75rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 1.5rem;
    font-size: .9rem;
}

/* ---------------------------------------------------------------- admin */

.otp-box {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 1.15rem;
    letter-spacing: .05em;
    background: var(--viz-surface);
    border: 1px solid var(--viz-grid);
    border-radius: 6px;
    padding: .6rem .8rem;
    display: inline-block;
    user-select: all;
}

.role-warning {
    color: var(--viz-serious);
    font-size: .85rem;
    margin: .25rem 0 0 1.5rem;
}

/* Sits inside the success alert that carries the one-time password: the account was
   created, and only the mail failed. Coloured to be read, not to claim the whole
   operation went wrong. */
.mail-failed {
    color: var(--viz-serious);
}

.site-grants {
    max-height: 18rem;
    overflow-y: auto;
    border: 1px solid var(--viz-grid);
    border-radius: 6px;
    padding: .5rem .75rem;
}

.grant-count { color: var(--viz-muted); font-size: .85rem; }
