/* The web app's own pages in On-Site Energy's house style (PBI 2662), as in OSE's proposals: white pages, navy ink,
   Crete Round headings over Inter text, the genuine logo, and the blue-to-green wave for colour. Everything is served
   from this site (fonts/, brand/), as the security policy allows no other source. The engineer's model in the viewer is
   a separate, sandboxed page and isn't touched. Text colours meet WCAG AA on the backgrounds they're used on; OSE's
   green and lime are too pale for text, so they appear only in the logo and the wave. */

/* Crete Round and Inter, from the OSE brand toolkit (SIL Open Font License; see docs/Brand-Assets.md): WOFF2 copies
   (under half the size; App.razor preloads the two most used), with the original TrueType files for a browser that
   can't use them. */
@font-face { font-family: "Crete Round"; src: url("fonts/CreteRound-Regular.woff2") format("woff2"), url("fonts/CreteRound-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Crete Round"; src: url("fonts/CreteRound-Italic.woff2") format("woff2"), url("fonts/CreteRound-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff2") format("woff2"), url("fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff2") format("woff2"), url("fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.woff2") format("woff2"), url("fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
    /* OSE brand colours. */
    --navy: #172546;
    --indigo: #302683;
    --blue: #1d70b7;
    --green: #95c11e;
    --lime: #c7d300;
    /* OSE's functional colours: tables and highlights only. */
    --light-blue: #cbecfb;
    --row-grey: #f2f2f2;
    --table-green: #c1f0c6;
    --line: #dce0e6;
    /* Secondary text: 5.4:1 on row grey, 6:1 on white. */
    --muted: #5a6375;
    --danger: #c0392b;
    --head: "Crete Round", Georgia, serif;
    --body: "Inter", Calibri, Arial, Helvetica, sans-serif;
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--navy);
}

/* White pages, laid out top to bottom: OSE's header, the page, and (on the short pages) the wave at the foot. */
body { margin: 0; background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }

h1, h2, h3 { font-family: var(--head); font-weight: 400; color: var(--navy); line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 16px; }
h2 { font-size: 1.45rem; margin: 28px 0 10px; }
h3 { font-size: 1.15rem; margin: 20px 0 8px; }
/* The router focuses the heading on navigation, for screen readers; it needs no visible ring. */
h1:focus { outline: none; }
/* A page's title has OSE's thin hairline beneath it, as on their content pages. */
main > h1, main > header.bar { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 18px; }
main > header.bar h1 { margin: 0; }

a { color: var(--blue); }
a:hover { color: var(--indigo); }

/* OSE's header on every page but the viewer: the genuine logo (never redrawn or recoloured) and their kicker. */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px 0; }
.site-header .brand { display: inline-block; line-height: 0; }
.site-header .brand img { height: 48px; width: auto; }
.kicker { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); }
.kicker .sep { color: var(--lime); margin: 0 .25em; }
@media (max-width: 640px) { .site-header { padding: 12px 16px 0; } .site-header .kicker { display: none; } }

/* The wave: across the foot of the short pages (sign-in, setup, a client's models), as on OSE's covers; down the left
   edge of the long staff pages, as on their content pages. Always blue to green, left to right, cropped, never stretched.
   Chosen by the page's own <main> (the wave follows it in MainLayout), which every browser supports. */
.brand-wave { display: none; flex-shrink: 0; height: 180px; margin-top: 32px; background: url("brand/wave.jpg") center / cover no-repeat; }
main.narrow ~ .brand-wave { display: block; }
main.wide::before, main.guide::before { content: ""; position: fixed; top: 0; bottom: 0; left: 0; width: 10px; background: url("brand/wave-edge.png") center / cover no-repeat; pointer-events: none; }

.narrow { max-width: 520px; width: 100%; box-sizing: border-box; margin: 40px auto 0; padding: 0 16px; }
.wide { max-width: 1200px; width: 100%; box-sizing: border-box; margin: 28px auto 48px; padding: 0 24px; }
/* Get started (PBI 2657): reading width, numbered steps and a download button. */
.guide { max-width: 760px; width: 100%; box-sizing: border-box; margin: 28px auto 48px; padding: 0 24px; }
.guide .steps > li { margin-bottom: 14px; }
.guide .steps h2 { font-size: 1.2rem; margin: 18px 0 4px; }

/* Buttons: OSE blue (5.2:1 with white), indigo on hover; red only for deleting. */
a.button, button { font: inherit; font-weight: 600; background: var(--blue); color: #fff; border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; }
a.button { display: inline-block; text-decoration: none; }
a.button:hover, button:hover { background: var(--indigo); color: #fff; }
button:disabled, button:disabled:hover { background: #b4bcc9; color: #fff; cursor: not-allowed; }
button.link, button.link:hover { background: none; color: var(--blue); padding: 0; font-weight: 400; }
button.link:hover { color: var(--indigo); }
button.danger { background: var(--danger); }
button.danger:hover { background: #a02e22; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.notice { background: #e6f4d7; padding: 8px 12px; border-radius: 4px; }
form { display: grid; gap: 8px; margin: 16px 0; }
form.inline { display: inline; margin: 0; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #b9c1cd; border-radius: 4px; color: var(--navy); background: #fff; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* Sign-in alternatives ("Email me a code", "send another code"): a link-styled button within a sentence. */
.alternative { display: block; margin: 8px 0; }
.alternative button.link { text-decoration: underline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tables in OSE's style: light-blue header cells, navy text, hairlines and every other row in row grey. */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 7px 10px; vertical-align: top; }
th { background: var(--light-blue); color: var(--navy); font-weight: 600; }
td { border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) { background: var(--row-grey); }
table.small { font-size: 12.5px; }
td.actions { display: flex; gap: 8px; align-items: center; }
td.actions button { padding: 4px 12px; }
/* Buttons at the right-hand end of a row (Delete, PBI 2656). */
td.actions.end { justify-content: flex-end; }

/* The question a delete asks before it runs, over the page. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(23, 37, 70, .45); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal { background: #fff; border-radius: 6px; padding: 16px 20px; max-width: 520px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.modal h3 { margin-top: 0; }

/* Status tags, in OSE's functional colours. */
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line); margin-left: 6px; color: var(--navy); }
.tag.published { background: var(--table-green); }
.tag.draft { background: var(--light-blue); }
.tag.withdrawn { background: #eef0f3; }
.tag.internal { background: #fbe0dd; }
/* Who last published a version, under its status (PBI 2661). */
.byline { display: block; margin-top: 4px; font-size: .85em; color: var(--muted); }

/* A client's models. */
.cards { list-style: none; padding: 0; display: grid; gap: 10px; }
.cards a { display: block; background: #fff; padding: 14px 16px; border-radius: 6px; border: 1px solid var(--line); border-left: 4px solid var(--blue); text-decoration: none; font-weight: 600; }
.cards a:hover { border-color: var(--blue); }
/* Version reference under the project name, e.g. "Version 3, 21 Oct 2026 14:32". */
.cards .reference { display: block; margin-top: 4px; font-size: .85em; font-weight: 400; color: var(--muted); }
pre.token { background: var(--row-grey); padding: 8px; border: 1px solid var(--line); overflow-x: auto; }
/* Authenticator setup: the QR code on a white background (scanners need contrast) and the key to type instead. */
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
code.key { font-size: 1.05em; letter-spacing: .05em; white-space: nowrap; }

/* The viewer: OSE's bar (logo, Back, the model's name and reference) above the model's sandboxed frame. */
.frame { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
/* It wraps on a narrow screen rather than running off the edge; the model's frame takes what height is left. */
.frame-bar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; }
.frame-bar .brand { height: 30px; width: auto; }
.frame-body { position: relative; overflow: hidden; }
/* The viewer bar's Back button and view switch (PBI 2658): a compact OSE button, and a bold link. */
.frame-bar a.button.back { padding: 4px 12px; }
.frame-bar a.view-switch { font-weight: 600; }
.frame-body iframe { width: 100%; height: 100%; border: 0; display: block; }
.watermark { position: absolute; inset: -50%; pointer-events: none; display: flex; flex-wrap: wrap; gap: 80px 120px; transform: rotate(-24deg); opacity: .08; font-size: 14px; user-select: none; color: #000; }

/* Blazor's bar for an unhandled error, hidden until Blazor shows it; here rather than in one layout, as both layouts use it. */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; width: 100%; box-sizing: border-box; z-index: 1000; padding: .6rem 1.25rem .7rem; background: lightyellow; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); color-scheme: light only; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
/* The error page's headings. */
.text-danger { color: var(--danger); }
