/*
   Layout and page-level styling for the portal shell, built to the Nauralta design
   handoff. Brand tokens and the Radzen theme mapping live in nauralta.css, which is
   loaded first; everything here is the app's own furniture.
*/

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

h1:focus {
    outline: none;
}

/* ─────────────────────────────────────────────────────────────
   Boot screen and crash banner — painted before .NET starts, so
   they can only use plain CSS and must already be in the house style.
   ───────────────────────────────────────────────────────────── */
.portal-loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: #14121F;
    color: #9C9AAC;
    font-family: 'Space Mono', ui-monospace, monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.portal-loading__spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #302D46;
    border-top-color: #DB56D0;
    border-radius: 50%;
    animation: portal-spin 1s linear infinite;
}

@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

#blazor-error-ui {
    background: #232037;
    border-top: 1px solid #E5537B;
    bottom: 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    color: #F5F4FA;
    display: none;
    font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.875rem;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

#blazor-error-ui .reload {
    color: #DB56D0;
    margin-inline-start: 0.75rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.6rem;
}

/* ─────────────────────────────────────────────────────────────
   App shell
   ───────────────────────────────────────────────────────────── */
.shell {
    display: flex;
    min-height: 100vh;
}

.shell__sidebar {
    width: var(--shell-sidebar-width);
    flex-shrink: 0;
    background: var(--bg-1);
    border-inline-end: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 24px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}

.shell__brand {
    padding: 4px 10px 26px;
}

.shell__brand img {
    height: 30px;
    display: block;
}

.shell__eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0 10px 10px;
}

/* The navigation owns whatever height is left over, so the account block below it sits
   on the bottom edge and a navigation too long for the sidebar scrolls rather than
   pushing the account off. min-height:0 is what lets a flex item scroll at all. */
.shell__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* The account corner: the block itself is the menu's trigger, so it is a button that
   has to look like the row it replaced rather than like a button. */
.shell__account {
    margin-top: auto;
    position: relative;
}

.shell__user {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 10px 2px;
    border: none;
    border-top: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: color 140ms;
}

.shell__user-caret {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 18px;
    color: var(--text-dim);
    transition: transform 160ms;
}

.shell__user.is-open .shell__user-caret {
    transform: rotate(180deg);
}

.shell__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.shell__user-text {
    min-width: 0;
}

.shell__user-name {
    font-size: 13px;
    color: var(--text-hi);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell__user-role {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* Opens upwards, because there is nothing below it but the bottom of the window. */
.shell__account-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 4px;
    right: 4px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--bg-2);
    box-shadow: 0 12px 32px rgb(0 0 0 / 45%);
}

.shell__account-email {
    padding: 6px 10px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell__account-item {
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-mut);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 140ms, color 140ms;
}

.shell__account-item:hover {
    background: var(--bg-3);
    color: var(--text-hi);
}

.shell__account-item--signout:hover {
    color: var(--brand-pink);
}

/* Catches the click that closes the menu. Below the sidebar rather than above it: the
   sidebar is a stacking context of its own, so no z-index the menu gives itself can lift
   it over a scrim on the sidebar's own level — the scrim would sit invisibly over the
   menu and swallow every click meant for it. Above the top bar and the content, which is
   everything it actually has to cover. */
.shell__menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
}

/* Navigation */
.nav__group {
    display: flex;
    flex-direction: column;
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    background: transparent;
    color: var(--text-mut);
    font-family: var(--font-mono);
    font-size: 13.5px;
    letter-spacing: 0.01em;
    text-align: start;
    text-decoration: none;
    transition: background 140ms var(--ease), color 140ms;
}

.nav__item:hover {
    background: var(--bg-2);
    color: var(--text-hi);
}

.nav__item.is-active {
    background: var(--bg-3);
    color: var(--text-hi);
}

.nav__stripe {
    width: 3px;
    height: 16px;
    border-radius: 2px;
    background: transparent;
    flex-shrink: 0;
}

.nav__item.is-active .nav__stripe {
    background: var(--grad-wave);
}

.nav__child {
    display: block;
    margin-inline-start: 27px;
    padding: 8px 12px;
    border: none;
    border-inline-start: 1px solid var(--line);
    border-radius: 0 var(--r-xs) var(--r-xs) 0;
    cursor: pointer;
    background: transparent;
    color: var(--text-mut);
    font-family: var(--font-sans);
    font-size: 13.5px;
    text-align: start;
    text-decoration: none;
    transition: color 140ms;
}

.nav__child:hover {
    color: var(--text-hi);
}

.nav__child.is-active {
    color: var(--brand-pink);
}

/* Main column */
.shell__main {
    flex: 1;
    min-width: 0;
}

.shell__topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 32px;
    height: var(--shell-topbar-height);
    background: rgba(20, 18, 31, 0.72);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.shell__crumb {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell__topbar-left,
.shell__topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

/* The sidebar toggle only exists in the narrow layout. */
.shell__burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text-mut);
    cursor: pointer;
}

.shell__burger:hover {
    border-color: var(--line-strong);
    color: var(--text-hi);
}

.shell__scrim {
    display: none;
}

.shell__content {
    padding: 34px 32px 64px;
    max-width: 1400px;
}

/* The language picker is a hairline pill in the header, matching the design. The
   Class parameter lands directly on RadzenDropDown's own root element (it IS
   .rz-dropdown), not on a wrapper around it, so these need to be compound
   selectors rather than descendant ones. */
.rz-dropdown.shell__language {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    min-height: 0;
    height: auto;
}

.rz-dropdown.shell__language:hover {
    border-color: var(--line-strong);
}

.rz-dropdown.shell__language .rz-dropdown-label {
    padding: 6px 4px 6px 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-mut);
}

.rz-dropdown.shell__language .rz-dropdown-trigger {
    padding-inline-end: 10px;
    color: var(--text-mut);
}

@media (max-width: 900px) {
    .shell__sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        transform: translateX(-100%);
        transition: transform var(--dur) var(--ease);
        box-shadow: var(--shadow-lg);
    }

    .shell__sidebar.is-open {
        transform: translateX(0);
    }

    .shell__burger {
        display: inline-flex;
    }

    .shell__sidebar.is-open ~ .shell__scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(10, 9, 16, 0.6);
        backdrop-filter: blur(2px);
    }

    .shell__content {
        padding: 24px 18px 56px;
    }

    .shell__topbar {
        padding: 0 18px;
        gap: 12px;
    }
}

/* ─────────────────────────────────────────────────────────────
   Page furniture — the heading block every page opens with.
   ───────────────────────────────────────────────────────────── */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 30px;
    letter-spacing: -0.02em;
    color: var(--text-hi);
    line-height: 1.15;
}

.page-sub {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--text-mut);
    max-width: 68ch;
    text-wrap: pretty;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brand-pink);
    margin-bottom: 10px;
}

/* A back link above a detail page's title. */
.back-link {
    align-self: flex-start;
    display: inline-block;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 18px;
    color: var(--text-mut);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 140ms;
}

.back-link:hover {
    color: var(--brand-pink);
}

/* ─────────────────────────────────────────────────────────────
   Dashboard
   ───────────────────────────────────────────────────────────── */
.dash {
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.dash__greeting {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 32px;
    letter-spacing: -0.02em;
    color: var(--text-hi);
}

.dash__lede {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-mut);
    max-width: 62ch;
    text-wrap: pretty;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1000px) {
    .quick-grid {
        grid-template-columns: 1fr;
    }
}

.quick-card {
    text-align: start;
    cursor: pointer;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    color: inherit;
    font: inherit;
    transition: transform 160ms var(--ease), border-color 160ms, box-shadow var(--dur);
}

.quick-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--glow-indigo);
}

.quick-card__eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.quick-card__title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 17px;
    color: var(--text-hi);
    margin: 10px 0 6px;
}

.quick-card__body {
    font-size: 13.5px;
    color: var(--text-mut);
    line-height: 1.5;
}

/* A card whose top edge carries the brand wave — used for panels that frame a list. */
.panel {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.panel__wave {
    height: 3px;
    background: var(--grad-wave);
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
}

.panel__title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 17px;
    color: var(--text-hi);
}

.panel__foot {
    padding: 14px 24px;
    font-size: 13px;
    color: var(--text-dim);
}

/* Live/offline indicator next to a panel title. */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
}

.status-pill__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill.is-live {
    color: var(--success);
}

.status-pill.is-live .status-pill__dot {
    box-shadow: 0 0 10px rgba(53, 192, 138, 0.8);
}

/* Event feed */
.event {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    align-items: baseline;
    gap: 18px;
    padding: 15px 24px;
    border-bottom: 1px solid var(--line);
}

.event__time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--brand-indigo);
}

.event__text {
    font-size: 14px;
    color: var(--text-hi);
    line-height: 1.5;
}

.event__meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: end;
}

@media (max-width: 700px) {
    .event {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .event__meta {
        text-align: start;
    }
}

/* A label/value pair, as used across the invoice detail header. */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

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

.meta__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.meta__value {
    font-size: 14.5px;
    color: var(--text-hi);
    margin-top: 6px;
}

/* ─────────────────────────────────────────────────────────────
   Login — a full-bleed split: brand panel beside the form.
   ───────────────────────────────────────────────────────────── */
.login {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

.login__art {
    position: relative;
    overflow: hidden;
    background: var(--grad-signal);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
}

.login__arcs {
    position: absolute;
    inset-inline-end: -120px;
    bottom: -140px;
    width: 620px;
    opacity: 0.28;
    pointer-events: none;
}

.login__logo {
    height: 32px;
    position: relative;
    align-self: flex-start;
}

.login__pitch {
    position: relative;
    max-width: 26ch;
}

.login__pitch-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.login__pitch-title {
    margin: 14px 0 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 40px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
}

.login__pitch-body {
    margin: 16px 0 0;
    font-size: 15.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
}

.login__form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--bg-0);
}

.login__form {
    width: 100%;
    max-width: 380px;
}

.login__title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -0.01em;
    color: var(--text-hi);
}

.login__sub {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--text-mut);
}

.login__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.login__forgot {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--text-mut);
}

.two-factor__qr {
    display: flex;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    background: #ffffff;
}

.two-factor__key {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-2, rgba(0, 0, 0, 0.04));
    font-size: 14px;
    letter-spacing: 1px;
    word-break: break-all;
}

.two-factor__codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    background: var(--surface-2, rgba(0, 0, 0, 0.04));
}

.two-factor__codes code {
    font-size: 14px;
    text-align: center;
}

@media (max-width: 860px) {
    .login {
        grid-template-columns: 1fr;
    }

    .login__art {
        min-height: 260px;
        padding: 32px 28px;
    }

    .login__pitch-title {
        font-size: 30px;
    }

    .login__form-side {
        padding: 32px 24px 56px;
    }
}
