/* ==========================================================================
   Portal.UI — Network Tasman brand tokens
   Reference: docs/branding/network-tasman-brand.md
   ========================================================================== */

/* ---- Fonts ---- */

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-500-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-500.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-600-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-700-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/poppins-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/open-sans-400-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/open-sans-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/open-sans-700-ext.woff2') format('woff2');
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/_content/NetworkTasman.Portal.UI/fonts/open-sans-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Tokens ---- */

:root {
    /* Brand palette (numbered per brand doc) */
    --nt-black:     #000000;
    --nt-red-1:     #7A1518;
    --nt-red-2:     #CC4145;
    --nt-red-3:     #E46266;
    --nt-red-4:     #DE9993;
    --nt-stone:     #D8D0C0;
    --nt-sand:      #C2B59B;
    --nt-khaki:     #A8A782;
    --nt-moss:      #8E9968;
    --nt-wash:      rgba(0,0,0,0.05);
    --nt-grey:      #404040;
    --nt-off-white: #F9F9F9;
    --nt-white:     #FFFFFF;

    /* Semantic aliases */
    --portal-bg:             var(--nt-off-white);
    --portal-surface:        var(--nt-white);
    --portal-surface-tinted: var(--nt-stone);
    --portal-text:           var(--nt-black);
    --portal-text-muted:     var(--nt-grey);
    --portal-text-quiet:     var(--nt-khaki);
    --portal-border:         #E0DAC8;
    --portal-brand:          var(--nt-red-2);
    --portal-brand-hover:    var(--nt-red-1);
    --portal-brand-quiet:    var(--nt-red-3);
    --portal-chrome-bg:      var(--nt-black);
    --portal-chrome-text:    var(--nt-white);
    --portal-focus:          var(--nt-red-2);
    --portal-chip-active:    var(--portal-brand);
    --portal-hover-surface:  #fbeae9;

    /* Symbology (outside the brand palette on purpose) */
    --symbol-ok:      #2E8B57;
    --symbol-warn:    #F4B400;
    --symbol-fail:    #D93025;
    --symbol-info:    #1A73E8;
    --symbol-pending: #9AA0A6;

    /* Type */
    --portal-font-display: "Poppins", "Segoe UI", system-ui, sans-serif;
    --portal-font-body:    "Open Sans", "Segoe UI", system-ui, sans-serif;
    --portal-font-ui:      system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --portal-font-mono:    Consolas, "SF Mono", ui-monospace, monospace;

    --portal-size-h1:      2rem;
    --portal-size-h2:      1.375rem;
    --portal-size-h3:      1.125rem;
    --portal-size-h4:      0.9375rem;
    --portal-size-eyebrow: 0.6875rem;
    --portal-size-body:    0.875rem;
    --portal-size-meta:    0.75rem;
    --portal-size-grid:    0.8125rem;

    --portal-weight-body:   400;
    --portal-weight-strong: 600;
    --portal-weight-heavy:  700;

    --portal-lh-tight:  1.2;
    --portal-lh-normal: 1.4;
    --portal-lh-loose:  1.6;

    /* Spacing / radius / elevation */
    --portal-space-1: 0.25rem;
    --portal-space-2: 0.5rem;
    --portal-space-3: 0.75rem;
    --portal-space-4: 1rem;
    --portal-space-5: 1.5rem;
    --portal-space-6: 2.5rem;
    --portal-space-7: 4rem;

    --portal-radius-sm: 2px;
    --portal-radius:    3px;
    --portal-radius-lg: 6px;

    --portal-shadow-1: 0 1px 2px rgba(0,0,0,0.06);
    --portal-shadow-2: 0 4px 12px rgba(0,0,0,0.08);
}

/* Density modifier — applied on grid + detail page containers */
.portal-dense {
    --portal-size-body: 0.8125rem;
    --portal-size-grid: 0.75rem;
    --portal-size-h4:   0.875rem;
    --portal-space-4:   0.625rem;
    --portal-space-5:   1rem;
}

/* ---- Layout ---- */

/* `.portal-main` lives here (not scoped to PortalLayout.razor.css) so the
   full-width opt-in below can use :has() to reach a class set by a
   component outside this layout's Blazor CSS-isolation scope. */
.portal-main {
    padding: var(--portal-space-6) var(--portal-space-5);
    max-width: 90rem;
    width: 100%;
    margin: 0 auto;
    outline: none;
}
.portal-main:has(.portal-page-full-width) {
    max-width: none;
}

/* ---- Base ---- */

/* Reserve the scrollbar's width on every page so content does not shift sideways
   between pages that scroll and pages that do not. */
html { scrollbar-gutter: stable; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--portal-font-body);
    font-size: var(--portal-size-body);
    line-height: var(--portal-lh-normal);
    color: var(--portal-text);
    background: var(--portal-bg);
}

h1, h2, h3, h4 {
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-strong);
    line-height: var(--portal-lh-tight);
    margin: 0;
}
h1 { font-size: var(--portal-size-h1); color: var(--portal-text); }
h2 { font-size: var(--portal-size-h2); color: var(--portal-text); }
h3 { font-size: var(--portal-size-h3); color: var(--nt-red-3); }
h4 { font-size: var(--portal-size-h4); color: var(--nt-red-1); }

a { color: var(--portal-brand); text-decoration: underline; }
a:hover { color: var(--portal-brand-hover); }

/* Legacy component classes (kept for existing markup — restyled to new tokens) */
.portal-page-header { margin-bottom: var(--portal-space-5); }
.portal-page-header h1 { margin: 0 0 var(--portal-space-2); }
.portal-page-header-subtitle { margin: 0; color: var(--portal-text-muted); }

.portal-empty {
    padding: var(--portal-space-6);
    text-align: center;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface-tinted);
}
.portal-empty-icon { font-size: 2rem; margin-bottom: var(--portal-space-3); color: var(--nt-red-1); }
.portal-empty h2 { margin: 0 0 var(--portal-space-2); font-size: var(--portal-size-h4); color: var(--nt-red-1); }

.portal-field { display: block; margin-bottom: var(--portal-space-4); }
.portal-field-label {
    display: block;
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-meta);
    margin-bottom: var(--portal-space-2);
    color: var(--portal-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.portal-input {
    display: block;
    width: 100%;
    padding: var(--portal-space-2) var(--portal-space-3);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    font: inherit;
    background: var(--portal-surface);
    color: inherit;
}
.portal-input:focus {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}
.portal-field-error {
    color: var(--symbol-fail);
    font-size: var(--portal-size-meta);
    margin-top: var(--portal-space-1);
}

.portal-button {
    display: inline-flex;
    align-items: center;
    gap: var(--portal-space-2);
    padding: var(--portal-space-2) var(--portal-space-4);
    border-radius: var(--portal-radius);
    border: 1px solid transparent;
    font: inherit;
    cursor: pointer;
}
.portal-button-primary {
    background: var(--portal-brand);
    color: var(--nt-white);
}
.portal-button-primary:hover { background: var(--portal-brand-hover); }
.portal-button:disabled { opacity: 0.6; cursor: default; }

.portal-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: var(--nt-white);
    border-radius: 50%;
    animation: portal-spin 0.9s linear infinite;
}
@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

.portal-page-header-eyebrow {
    display: inline-block;
    margin-bottom: var(--portal-space-2);
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-eyebrow);
    color: var(--portal-brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portal-page-header-eyebrow-link {
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.portal-page-header-eyebrow-link:hover,
.portal-page-header-eyebrow-link:focus {
    opacity: 0.8;
    text-decoration: underline;
}

.report-load-error {
    padding: var(--portal-space-3);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--portal-radius-small, 6px);
    color: var(--portal-danger, #c00);
    font-size: var(--portal-size-body);
    line-height: 1.4;
}

.report-load-error strong {
    display: block;
    margin-bottom: var(--portal-space-1, 0.25rem);
}

/* ------------------------------------------------------------------
   Detail grid — labelled read-only value pairs used across detail
   pages (Worksites, Sites, Devices). Two columns of label|value
   pairs per row on wide screens, collapsing to one column on narrow.
   Wide fields (long descriptions, notes) span both columns via the
   .detail-field-wide modifier.
   ------------------------------------------------------------------ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--portal-space-5);
    row-gap: var(--portal-space-2);
    align-items: baseline;
}

/* Each pair is its own two-column grid so all labels within the pair
   share the same (max-content) width. */
.detail-field {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) 1fr;
    column-gap: var(--portal-space-3);
    align-items: baseline;
}

.detail-field-label {
    padding: var(--portal-space-1) 0;
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-meta);
    color: var(--portal-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: normal;
    min-width: 0;
}
.detail-field-value {
    padding: var(--portal-space-1) 0;
    font-family: var(--portal-font-body);
    font-size: var(--portal-size-body);
    color: var(--portal-text);
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Wide fields (Notes, Comment, long-form) span both columns. */
.detail-field-wide { grid-column: 1 / -1; }

/* A DetailField placed inside an .edit-grid already carries the
   .detail-field two-column pair layout above — no additional override
   needed here, the .edit-grid's outer grid places it in one of its
   two columns. */

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .detail-field {
        grid-template-columns: 1fr;
        row-gap: var(--portal-space-1);
    }
    .detail-field-label { padding: 0; }
    .detail-field-value { padding: 0; }
}

/* ------------------------------------------------------------------
   Portal buttons — three variants plus a shared base.
   ------------------------------------------------------------------ */
.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--portal-space-2);
    padding: 0.5rem 1rem;
    border-radius: var(--portal-radius);
    border: 1px solid transparent;
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-body);
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    user-select: none;
}
.portal-btn:focus-visible {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}
.portal-btn:disabled,
.portal-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.portal-btn-primary {
    background: var(--portal-brand);
    border-color: var(--portal-brand);
    color: var(--nt-white, #fff);
}
.portal-btn-primary:hover:not(:disabled) {
    background: var(--portal-brand-hover);
    border-color: var(--portal-brand-hover);
    color: var(--nt-white, #fff);
}

.portal-btn-secondary {
    background: var(--portal-surface);
    border-color: var(--nt-khaki, #A8A782);
    color: var(--portal-text);
}
.portal-btn-secondary:hover:not(:disabled) {
    background: var(--portal-surface-tinted);
    border-color: var(--portal-text-muted);
}

.portal-btn-danger {
    background: var(--portal-danger, #c0392b);
    border-color: var(--portal-danger, #c0392b);
    color: var(--nt-white, #fff);
}
.portal-btn-danger:hover:not(:disabled) {
    background: #a0271b;
    border-color: #a0271b;
    color: var(--nt-white, #fff);
}

/* ------------------------------------------------------------------
   Form primitives — shared across every create/edit form (Sites,
   Devices, Earth Tests, DeviceTypeFieldsForm). Kept global so any
   page using these class names gets consistent styling regardless of
   which component renders the DOM.
   ------------------------------------------------------------------ */

/* Two-column form layout that matches .detail-grid on read views.
   Each .edit-row is a label|input mini-grid; .edit-row-wide spans
   both outer columns for textareas and long inputs. */
.edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--portal-space-5);
    row-gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .edit-grid { grid-template-columns: 1fr; }
}

.edit-row {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) 1fr;
    column-gap: 1rem;
    align-items: center;
}

.edit-row.edit-row-wide,
.edit-row:has(textarea) {
    grid-column: 1 / -1;
}

.edit-label {
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-meta);
    color: var(--portal-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

/* Checkbox inside an .edit-row grid cell: left-align next to the label
   and give it visible size. Without this the browser default 13px input
   floats in the 1fr cell. */
.portal-checkbox {
    justify-self: start;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    cursor: pointer;
}

/* Select styled to match .portal-input's visual weight. */
.portal-select {
    padding: var(--portal-space-2) var(--portal-space-3);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
    color: inherit;
    font: inherit;
    line-height: 1.2;
}
.portal-select:focus {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}

/* Textarea inherits from .portal-input but ensures multiline height. */
.portal-textarea {
    display: block;
    width: 100%;
    padding: var(--portal-space-2) var(--portal-space-3);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    font: inherit;
    background: var(--portal-surface);
    color: inherit;
    min-height: 4.5rem;
    resize: vertical;
}
.portal-textarea:focus {
    outline: 2px solid var(--portal-focus);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------
   NetworkAssets card / hero / back-link — shared across the whole
   /network-assets area. Kept global so page components don't each
   redeclare their own scoped copies.
   ------------------------------------------------------------------ */

.na-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1000px;
}

.na-back {
    color: var(--portal-brand);
    font-size: var(--portal-size-meta);
    text-decoration: none;
    font-weight: var(--portal-weight-heavy);
}
.na-back:hover { text-decoration: underline; }

.na-panel {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.na-panel-heading {
    margin: 0;
    font-size: 1rem;
    font-weight: var(--portal-weight-heavy);
    color: var(--portal-text);
    border-bottom: 1px solid var(--portal-border);
    padding-bottom: 0.5rem;
}

/* Alias the existing per-page class names to the shared na-* rules so
   pages that already use `.device-panel` / `.device-back` etc. pick up
   the shared styling without needing to touch every razor. */
.device-back  { color: var(--portal-brand); font-size: var(--portal-size-meta); text-decoration: none; font-weight: var(--portal-weight-heavy); }
.device-back:hover { text-decoration: underline; }

.device-panel {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.device-panel-heading {
    margin: 0;
    font-size: 1rem;
    font-weight: var(--portal-weight-heavy);
    color: var(--portal-text);
    border-bottom: 1px solid var(--portal-border);
    padding-bottom: 0.5rem;
}

.device-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.device-hero-primary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.device-hero-identity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
/* Two-row aligned label/value layout inside the hero identity block. */
.device-hero-labels {
    display: grid;
    grid-template-columns: 6rem 1fr;
    align-items: baseline;
    gap: 0 0.5rem;
}
.device-hero-label {
    font-size: var(--portal-size-meta);
    color: var(--portal-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.device-hero-serial {
    font-size: 1.5rem;
    font-weight: var(--portal-weight-heavy);
    margin: 0;
    color: var(--portal-text);
}
.device-hero-site {
    margin: 0;
    font-size: var(--portal-size-meta);
    color: var(--portal-text-muted);
}
/* The site name is the way through to the site's Earth Test and MDI records,
   which are site-scoped and so have no device page of their own. */
.device-hero-site-link {
    color: var(--portal-brand);
    text-decoration: none;
    font-weight: var(--portal-weight-strong);
}
.device-hero-site-link:hover,
.device-hero-site-link:focus-visible {
    text-decoration: underline;
}
.device-hero-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

/* Grid edit row: signal which cells actually accept input.
   Only two of the orders grid's nine columns are writable, and the other seven
   render as plain text via CellEditTemplate. Tinting the row makes the edit
   state obvious, and leaving the writable cells at surface white makes them
   read as the inputs. Keyed off `:has(input)` rather than a column CssClass —
   setting CssClass on an editable column makes DevExpress drop its edit cell
   from the row. This lives in global CSS on purpose: `.razor.css` scope
   attributes never reach DevExpress-rendered internals. */
.dx-grid-portal tr.dxbl-grid-edit-row > td {
    /* !important: DevExpress's theme sets grid cell backgrounds with higher
       specificity than this rule can reach, and its own edit-row tint wins
       otherwise. Same pattern as the header/overflow overrides below. */
    background-color: var(--nt-wash) !important;
    color: var(--portal-text-muted);
}
.dx-grid-portal tr.dxbl-grid-edit-row > td:has(input) {
    background-color: var(--portal-surface) !important;
    box-shadow: inset 0 0 0 2px var(--portal-focus);
}
.dx-grid-portal tr.dxbl-grid-edit-row > td:has(input) .dxbl-text-edit,
.dx-grid-portal tr.dxbl-grid-edit-row > td:has(input) .dxbl-text-edit-input {
    background-color: transparent;
}

/* Inline "serial already exists" card on CreateDevice. */
.device-serial-exists-card {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--portal-radius);
    padding: 0.5rem 0.75rem;
    font-size: var(--portal-size-meta);
    color: #78350f;
}
.device-serial-override-link {
    font-size: var(--portal-size-meta);
    color: var(--portal-brand);
}

.status-text {
    display: inline-flex;
    align-items: center;
    gap: var(--portal-space-2);
    font-family: var(--portal-font-body);
    font-size: var(--portal-size-body);
    color: var(--portal-text);
}
.status-text-date {
    color: var(--portal-text-muted);
}

/* Form save/validation error paragraph — used on all create/edit pages. */
.form-save-error {
    margin: var(--portal-space-2) 0 0;
    color: var(--symbol-fail, #c00);
    font-size: var(--portal-size-meta);
}

/* ------------------------------------------------------------------
   Filter chip — shared across DeviceTypeFilter and GmsSitePrefixFilter.
   Promoted from scoped CSS to global so both components share the same
   rules without duplication.
   ------------------------------------------------------------------ */
.chip {
    padding: 0.35rem 0.85rem;
    border: 1px solid #c9ccd1;
    background: #fff;
    color: #2a2f36;
    border-radius: 999px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
    border-color: #7c8390;
    background: #f4f5f7;
}

.chip.active {
    background: var(--portal-chip-active);
    border-color: var(--portal-chip-active);
    color: #fff;
    font-weight: 600;
}

.chip.active:hover {
    background: var(--portal-brand-hover);
    border-color: var(--portal-brand-hover);
}

.preset-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}

.preset-chip-row .chip {
    background: transparent;
    border: 1px solid var(--portal-border, #d1d5db);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.preset-chip-row .chip-active {
    background: var(--portal-chip-active);
    color: white;
    border-color: transparent;
}

.preset-chip-sep {
    display: inline-block;
    width: 1px;
    height: 1.25rem;
    background: var(--portal-border, #E0DAC8);
    margin: 0 0.75rem;
    vertical-align: middle;
}

.preset-chip-row a.chip { text-decoration: none; }

/* ------------------------------------------------------------------
   HubSwitcher — Devices | Sites tab strip at top of hub pages.
   ------------------------------------------------------------------ */
.hub-tabs {
    display: flex;
    gap: 0;
    margin: 0.5rem 0 1rem;
    border-bottom: 1px solid var(--portal-border, #E0DAC8);
}

.hub-tab {
    padding: 0.75rem 1.75rem;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--portal-text-muted, #404040);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    /* Sit on top of the border-bottom line */
    margin-bottom: -1px;
}

.hub-tab:hover {
    color: var(--portal-text, #000000);
    text-decoration: none;
}

.hub-tab-active {
    color: var(--portal-chip-active);
    border-bottom-color: var(--portal-chip-active);
    font-weight: 600;
}

/* ------------------------------------------------------------------
   SerialLookupBox — toolbar input for "does this device already
   exist?" workflow. Inline flex layout with input, button, and
   optional inline message for viewers who search with no matches.
   ------------------------------------------------------------------ */
.serial-lookup {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.serial-lookup-message {
    color: var(--portal-warning, #b45309);
    font-size: 0.875rem;
}
.serial-lookup-add {
    white-space: nowrap;
}
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ------------------------------------------------------------------
   Hub toolbar — row above the grid on Devices and Sites hub pages.
   Splits workflow input (left) from action buttons (right) using
   flexbox space-between. Wraps on narrow viewports.
   ------------------------------------------------------------------ */
.hub-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 0.75rem;
    flex-wrap: wrap;
    min-height: 2.5rem;
}
.hub-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Hover affordance on clickable grid rows. Grids without --clickable stay static. */
.dx-grid-portal--clickable tbody tr:hover {
    cursor: pointer;
    background-color: var(--portal-hover-surface);
}

/* Group headings only fold (via their arrow); they open nothing, so they should
   not look clickable. */
.dx-grid-portal--clickable tbody tr.dxbl-grid-group-row:hover {
    cursor: default;
    background-color: transparent;
}

/* Site cell for a device that is not installed at a real substation. The value
   shown is the actual pseudo-substation code (STK*, WKS*, AR*, REG*, SECT*),
   which carries meaning beyond "in stock"; the styling marks it as not-a-site.
   Matches .device-in-stock on the device detail hero. */
.site-stock-code {
    font-style: italic;
    color: var(--symbol-ok, #16a34a);
}

/* ------------------------------------------------------------------
   DxGrid filter row — visual affordance so users recognise the first
   row as a filter input strip, not a data row.
   ------------------------------------------------------------------ */
.dx-grid-portal .dxbl-grid-filter-row-cell,
.dx-grid-portal .dxbl-grid-header-filter,
.dx-grid-portal .dxbl-grid-filter-row {
    background: var(--portal-surface-tinted);
}

.dx-grid-portal .dxbl-grid-filter-row-cell input,
.dx-grid-portal .dxbl-grid-header-filter input,
.dx-grid-portal .dxbl-grid-filter-row input {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 2px;
    font-size: var(--portal-size-meta);
}

/* Boundary line between filter row and first data row */
.dx-grid-portal tbody tr:first-child {
    border-top: 1px solid var(--portal-border);
}

/* Grey out and disable non-active tab headers during edit mode on detail pages.
   DevExpress 26.1.3 uses .dxbl-tabs-item + .dxbl-active on the DXBL-TAB-ITEM element. */
.dx-tabs--edit-lock .dxbl-tabs-item:not(.dxbl-active) {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------
   Breadcrumb — small orientation trail above hub and detail pages.
   Used by the shared Breadcrumb.razor component.
   ------------------------------------------------------------------ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--portal-size-meta, 0.75rem);
    color: var(--portal-text-muted, #404040);
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: var(--portal-weight-heavy, 700);
}
.breadcrumb-link {
    color: var(--portal-text-muted, #404040);
    text-decoration: none;
}
.breadcrumb-link:hover {
    color: var(--portal-brand, #CC4145);
    text-decoration: underline;
}
.breadcrumb-current {
    color: var(--portal-text, #000);
}
.breadcrumb-sep {
    color: var(--portal-text-quiet, #A8A782);
    font-size: 0.8em;
}

/* Site picker on CreateDevice Step 1 — input on left with dropdown below,
   optional "Add new site" button inline to the right. */
.site-picker-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.site-picker {
    position: relative;
    flex: 1;
    min-width: 0;
}
.site-picker input {
    width: 100%;
}
.site-picker-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 12rem;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--portal-surface, #fff);
    border: 1px solid var(--nt-khaki, #A8A782);
    border-radius: var(--portal-radius, 3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 100;
}
.site-picker-dropdown li {
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: var(--portal-size-body);
}
.site-picker-dropdown li:hover {
    background: var(--portal-hover-surface, #fbeae9);
}
.site-add-btn {
    white-space: nowrap;
}

/* Modal dialog overlay + panel. The .scrap-dialog-* class family is used by
   ScrapTransformerDialog (scoped duplicate in its .razor.css) and by
   NewSiteDialog (which relies on these global rules because scoped CSS
   from one component can't reach markup in another). */
.scrap-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.scrap-dialog {
    background: var(--portal-surface, #fff);
    border: 1px solid var(--portal-border, #e0dac8);
    border-radius: var(--portal-radius-lg, 6px);
    box-shadow: var(--portal-shadow-2, 0 4px 12px rgba(0,0,0,0.08));
    padding: 2rem;
    width: 100%;
    max-width: 30rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.scrap-dialog-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--portal-text, #111827);
    border-bottom: 1px solid var(--portal-border, #e0dac8);
    padding-bottom: 0.75rem;
}

.scrap-dialog-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* NewSiteDialog — single-column form so the input fields fill the dialog width
   rather than being squeezed by the default 2-column .edit-grid. */
.new-site-dialog {
    max-width: 32rem;
}
.new-site-dialog .edit-grid {
    grid-template-columns: 1fr;
}
.new-site-dialog .edit-row {
    grid-template-columns: 8rem 1fr;
}
.new-site-dialog .edit-combobox,
.new-site-dialog .portal-input,
.new-site-dialog .portal-textarea {
    width: 100%;
}

/* ------------------------------------------------------------------
   Documentation — document lists and the viewer page.
   ------------------------------------------------------------------ */
.documentation-group { margin-bottom: var(--portal-space-5); }

.documentation-group-heading {
    font-size: var(--portal-size-h3);
    margin: 0 0 var(--portal-space-2);
    color: var(--portal-text);
}

.documentation-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--portal-border);
}

.documentation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--portal-space-3);
    padding: var(--portal-space-2) var(--portal-space-1);
    border-bottom: 1px solid var(--portal-border);
}

.documentation-item-text { display: flex; flex-direction: column; min-width: 0; }
.documentation-item-name { font-weight: var(--portal-weight-strong); }
.documentation-item-desc { color: var(--portal-text-muted); font-size: var(--portal-size-meta); }
.documentation-item-actions { display: flex; align-items: center; gap: var(--portal-space-2); flex-shrink: 0; }
.documentation-action-group { display: flex; gap: var(--portal-space-1); }
.documentation-action-sep { width: 1px; align-self: stretch; background: var(--portal-border); }
.documentation-file-btn .documentation-btn-icon { margin-right: 0.3rem; vertical-align: -2px; }

.documentation-file-btn {
    display: inline-block;
    min-width: 4rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    background: var(--portal-surface);
    color: var(--portal-brand);
    font-family: var(--portal-font-ui);
    font-size: var(--portal-size-meta);
    font-weight: var(--portal-weight-strong);
    text-align: center;
    text-decoration: none;
}

.documentation-file-btn:hover { background: var(--portal-hover-surface); text-decoration: none; }
.documentation-file-btn:focus-visible { outline: 2px solid var(--portal-focus); outline-offset: 2px; }

.documentation-empty { color: var(--portal-text-muted); }

@media (max-width: 640px) {
    .documentation-item { flex-direction: column; align-items: flex-start; }
}

.documentation-intro { max-width: 60rem; margin-bottom: var(--portal-space-5); }
.documentation-intro h1 { font-size: var(--portal-size-h2); margin: 0 0 var(--portal-space-1); }
.documentation-intro-meta { color: var(--portal-text-muted); margin-top: 0; }

.documentation-viewer-surface {
    position: relative;
    /* Keep the whole viewer (and Autodesk's bottom toolbar) on screen: ~20rem is the
       top bar, breadcrumb, section tabs and document header above it. */
    height: calc(100dvh - 20rem);
    min-height: 24rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    overflow: hidden;
    background: var(--portal-surface);
}

/* PDFs: the browser's own viewer fills the surface, and the surface is nearly
   the window's height, so scrolling down to it gives a full-window viewer
   rather than one squeezed under the header. */
.documentation-viewer-surface:has(.documentation-pdf-frame) {
    height: calc(100dvh - 2rem);
}
.documentation-pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}
/* Where the browser can't show a PDF in the page (phones): the name and an
   Open button, so the surface needn't be screen-tall. */
.documentation-viewer-surface:has(.documentation-pdf-open) {
    height: auto;
    min-height: 0;
}
.documentation-pdf-open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--portal-space-3);
    padding: var(--portal-space-5);
}
.documentation-pdf-open p { margin: 0; }
.documentation-aps-canvas { position: absolute; inset: 0; }

.documentation-aps-error {
    position: absolute;
    inset: var(--portal-space-4) var(--portal-space-4) auto;
    padding: var(--portal-space-3);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow-1);
}

.documentation-viewer-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--portal-space-3);
    margin-bottom: var(--portal-space-3);
}

.documentation-viewer-title h1 { font-size: var(--portal-size-h2); margin: var(--portal-space-1) 0 0; }
.documentation-viewer-meta { color: var(--portal-text-muted); margin: var(--portal-space-1) 0 0; }
.documentation-back { font-size: var(--portal-size-meta); }
/* Same look as the link variant; it only steps back through browser history. */
.documentation-back-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--portal-brand);
    font: inherit;
    font-size: var(--portal-size-meta);
    text-decoration: underline;
    cursor: pointer;
}
.documentation-back-button:focus-visible { outline: 2px solid var(--portal-focus); outline-offset: 2px; }
.documentation-viewer-actions { display: flex; flex-wrap: wrap; gap: var(--portal-space-2); }

.documentation-image-surface { display: flex; align-items: center; justify-content: center; }
.documentation-image { max-width: 100%; max-height: 100%; object-fit: contain; }

.documentation-no-preview,
.documentation-not-found {
    padding: var(--portal-space-5);
    border: 1px dashed var(--portal-border);
    border-radius: var(--portal-radius);
    color: var(--portal-text-muted);
    text-align: center;
}

/* Account pages: sign-in, invitation, password and two-factor */
.portal-account { max-width: 28rem; }
.portal-account .portal-input { width: 100%; }
.portal-account-actions { display: flex; align-items: center; gap: var(--portal-space-4); margin-top: var(--portal-space-4); }
.portal-account-sso { margin-top: var(--portal-space-5); padding-top: var(--portal-space-4); border-top: 1px solid var(--portal-border); }
.portal-account-note { color: var(--portal-text-muted); font-size: var(--portal-size-meta); margin-top: var(--portal-space-4); }
.portal-check-label { display: flex; gap: var(--portal-space-2); align-items: center; margin-top: var(--portal-space-2); }
.portal-status { padding: var(--portal-space-3); border: 1px solid; border-radius: var(--portal-radius); margin-bottom: var(--portal-space-4); }
.portal-status-error { border-color: #D93025; background: #fdecea; color: #7a1c14; }
.portal-status-ok { border-color: #2E8B57; background: #eaf5ef; color: #1d5c3a; }
.portal-account-manage-body { display: grid; grid-template-columns: 12rem 1fr; gap: var(--portal-space-5); }
.portal-account-nav { display: flex; flex-direction: column; gap: var(--portal-space-2); }
.portal-account-nav a { color: var(--portal-text-muted); text-decoration: none; }
.portal-account-nav a.active { color: var(--portal-brand); font-weight: var(--portal-weight-strong); }
.portal-account-profile { display: grid; grid-template-columns: 8rem 1fr; gap: var(--portal-space-2) var(--portal-space-4); }
.portal-account-profile dt { color: var(--portal-text-muted); }
.portal-account-subhead { font-size: 1rem; margin: 0 0 var(--portal-space-3); }
.portal-recovery-codes { font-family: var(--portal-font-mono); columns: 2; }
@media (max-width: 40rem) { .portal-account-manage-body { grid-template-columns: 1fr; } }

/* Admin section */
.admin-nav { display: flex; gap: var(--portal-space-4); margin-bottom: var(--portal-space-4); border-bottom: 1px solid var(--portal-border); }
.admin-nav a { padding: var(--portal-space-2) 0; color: var(--portal-text-muted); text-decoration: none; }
.admin-nav a.active { color: var(--portal-brand); border-bottom: 2px solid var(--portal-brand); }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: var(--portal-space-3); align-items: center; margin-bottom: var(--portal-space-4); }
.admin-toolbar .admin-search { flex: 1 1 16rem; }
.admin-toolbar .admin-filter { width: 14rem; }
.admin-section { margin-bottom: var(--portal-space-6); }
.admin-section h2 { font-size: 1rem; margin: 0 0 var(--portal-space-3); }
.admin-role-group { margin-bottom: var(--portal-space-3); }
.admin-role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--portal-space-2); }
.admin-role-toggle { display: flex; gap: var(--portal-space-2); align-items: flex-start; }
.admin-role-toggle small { display: block; color: var(--portal-text-muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: var(--portal-space-3); align-items: center; }
.admin-hint { color: var(--portal-text-muted); font-size: var(--portal-size-meta); font-weight: normal; margin: 0; }
.admin-status { display: inline-flex; gap: var(--portal-space-2); align-items: center; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: var(--portal-space-2) var(--portal-space-3); border-bottom: 1px solid var(--portal-border); text-align: left; vertical-align: top; }
.admin-table th { color: var(--portal-text-muted); font-weight: 500; }

/* FocusOnNavigate moves focus to the page's h1 for screen readers; the focus
   itself stays, only the outline box it drew around headings goes. */
h1:focus { outline: none; }

/* Landing pages: hero and area tiles (Contractors landing, Hub dashboard) */
.landing-hero {
    padding: var(--portal-space-7) 0 var(--portal-space-6);
}
.landing-eyebrow {
    display: inline-block;
    margin-bottom: var(--portal-space-3);
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-heavy);
    font-size: var(--portal-size-eyebrow);
    color: var(--portal-brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.landing-title {
    font-size: 2.75rem;
    margin: 0 0 var(--portal-space-3);
    color: var(--nt-black);
}
.landing-subtitle {
    font-size: 1.125rem;
    color: var(--portal-text-muted);
    max-width: 48rem;
    margin: 0;
}
.landing-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--portal-space-4);
    margin-top: var(--portal-space-5);
}
.landing-tile {
    display: flex;
    flex-direction: column;
    gap: var(--portal-space-3);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: var(--portal-space-5);
    text-decoration: none;
    color: inherit;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.landing-tile:hover {
    border-color: var(--portal-brand);
    box-shadow: var(--portal-shadow-2);
    transform: translateY(-2px);
}
.landing-tile:hover .landing-tile-title { color: var(--portal-brand-hover); }
.landing-tile:hover .landing-tile-cta   { transform: translateX(2px); }
.landing-tile-icon { color: var(--portal-brand); line-height: 0; }
.landing-tile-title {
    margin: 0;
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-strong);
    font-size: 1.25rem;
    color: var(--nt-red-1);
}
.landing-tile-desc { margin: 0; color: var(--portal-text-muted); }
.landing-tile-cta {
    align-self: flex-start;
    font-family: var(--portal-font-body);
    font-weight: var(--portal-weight-heavy);
    font-size: 0.8125rem;
    color: var(--portal-brand);
    transition: transform 120ms ease;
}
.landing-notice {
    max-width: 36rem;
    margin-top: var(--portal-space-5);
    padding: var(--portal-space-5);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
}
.landing-notice h2 {
    margin: 0 0 var(--portal-space-2);
    font-family: var(--portal-font-display);
    font-size: 1.125rem;
    color: var(--nt-red-1);
}
.landing-notice p { margin: 0; color: var(--portal-text-muted); }

/* Hub dashboard (start screen spec §4.1): the attention list in the main column; start buttons and areas in a
   narrow sticky column; stacked below about 860px: the start buttons, the attention list, then the areas.
   The hero sits closer to the top bar than .landing-hero's (whose 4rem on top of .portal-main's 2.5rem left about
   100px): no top padding, pulled up so 1.5rem is left. */
.dash-hero {
    padding-top: 0;
    padding-bottom: var(--portal-space-5);
    margin-top: calc(var(--portal-space-5) - var(--portal-space-6));
}
.dash-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--portal-space-6);
    align-items: start;
}
.dash-side { position: sticky; top: var(--portal-space-5); }
.dash-band { margin-bottom: var(--portal-space-6); }
.dash-band-title {
    display: flex;
    align-items: center;
    gap: var(--portal-space-2);
    margin: 0 0 var(--portal-space-3);
    font-family: var(--portal-font-display);
    font-size: 0.8125rem;
    font-weight: var(--portal-weight-strong);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--portal-text-muted);
}
.dash-count {
    padding: 1px var(--portal-space-2);
    border-radius: 10px;
    background: var(--portal-brand);
    color: var(--nt-white);
    font-size: var(--portal-size-meta);
    letter-spacing: 0;
}
.dash-tasks {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
}
.dash-tasks-list { list-style: none; margin: 0; padding: 0; }
.dash-task {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--portal-space-4);
    align-items: center;
    padding: var(--portal-space-3) var(--portal-space-4);
    border-bottom: 1px solid var(--portal-border);
}
.dash-task:last-child { border-bottom: 0; }
.dash-task-title { display: block; font-size: 0.9375rem; font-weight: var(--portal-weight-strong); }
.dash-task-detail { display: block; margin-top: 2px; color: var(--portal-text-muted); font-size: 0.8125rem; }
.dash-task-ask {
    max-width: 16rem;
    text-align: right;
    color: var(--portal-brand-hover);
    font-size: 0.8125rem;
    font-weight: var(--portal-weight-strong);
}
.dash-button {
    display: inline-block;
    padding: var(--portal-space-2) var(--portal-space-4);
    border: 1px solid var(--portal-brand);
    border-radius: var(--portal-radius-lg);
    background: var(--portal-brand);
    color: var(--nt-white);
    font-size: 0.8125rem;
    font-weight: var(--portal-weight-strong);
    text-decoration: none;
    white-space: nowrap;
}
.dash-button:hover { background: var(--portal-brand-hover); border-color: var(--portal-brand-hover); color: var(--nt-white); }
.dash-button.ghost { background: var(--portal-surface); border-color: #bbb; color: var(--portal-text); }
.dash-button.ghost:hover { border-color: var(--portal-brand); color: var(--portal-brand-hover); }
.dash-empty { margin: 0; padding: var(--portal-space-4); color: var(--portal-text-muted); }
.dash-more,
.dash-inflight {
    display: flex;
    flex-wrap: wrap;
    gap: var(--portal-space-3);
    justify-content: space-between;
    align-items: center;
    padding: var(--portal-space-3) var(--portal-space-4);
    border-top: 1px solid var(--portal-border);
    font-size: 0.8125rem;
    color: var(--portal-text-muted);
}
.dash-more a, .dash-back { color: var(--portal-brand-hover); font-weight: var(--portal-weight-strong); }
.dash-inflight { background: #f4f1e8; border-radius: 0 0 var(--portal-radius-lg) var(--portal-radius-lg); }
.dash-pager { display: flex; gap: var(--portal-space-3); align-items: center; }
.dash-starts { display: grid; gap: var(--portal-space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dash-starts.compact { grid-template-columns: 1fr; gap: var(--portal-space-3); }
.dash-start {
    display: flex;
    gap: var(--portal-space-3);
    align-items: flex-start;
    padding: var(--portal-space-4);
    background: var(--portal-surface);
    border: 2px solid var(--nt-black);
    border-radius: var(--portal-radius-lg);
    color: inherit;
    text-decoration: none;
}
.dash-starts.compact .dash-start { align-items: center; padding: var(--portal-space-3); }
.dash-start:hover, .dash-start:focus-visible { border-color: var(--portal-brand); background: var(--portal-hover-surface); }
.dash-start-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--portal-brand);
    color: var(--nt-white);
    font-size: 1.2rem;
}
.dash-starts.compact .dash-start-icon { width: 2.25rem; height: 2.25rem; font-size: 1.05rem; }
.dash-start-text strong { display: block; font-family: var(--portal-font-display); font-size: 0.9375rem; }
.dash-start-line { display: block; margin-top: 2px; color: var(--portal-text-muted); font-size: 0.8125rem; line-height: 1.45; }
.dash-area {
    display: block;
    margin-bottom: var(--portal-space-2);
    padding: var(--portal-space-3) var(--portal-space-4);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
    color: inherit;
    text-decoration: none;
}
.dash-area:hover { border-color: var(--portal-brand); }
.dash-area strong { display: block; }
.dash-area span { display: block; margin-top: 2px; color: var(--portal-text-muted); font-size: var(--portal-size-meta); }
@media (max-width: 860px) {
    .dash-cols { grid-template-columns: 1fr; gap: 0; }   /* each band keeps its own margin below */
    /* The side column's box goes (its sections join the grid) so the areas can follow the attention list; the DOM
       order (attention, start, areas) stays as wide, the start buttons only moved up. */
    .dash-side { display: contents; }
    .dash-side > .dash-start-band { order: -1; }
    .dash-side > .dash-areas { order: 1; }
    .dash-task { grid-template-columns: 1fr; }
    .dash-task-ask { text-align: left; max-width: none; }
}

/* Signed-out account pages: full-height brand panel beside the form */
.account-shell {
    display: flex;
    min-height: 100vh;
    background: var(--portal-bg);
}
.account-brand {
    flex: 0 0 44%;
    display: flex;
    flex-direction: column;
    padding: var(--portal-space-6) var(--portal-space-6) var(--portal-space-5);
    background: var(--nt-red-1);
    color: var(--nt-white);
}
.account-brand-wordmark {
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-strong);
    font-size: 1.25rem;
    color: var(--nt-white);
}
.account-brand-badge {
    margin-left: var(--portal-space-2);
    padding: 2px 7px;
    border-radius: var(--portal-radius);
    background: var(--nt-stone);
    color: var(--nt-black);
    font-size: 0.625rem;
    font-weight: var(--portal-weight-heavy);
    letter-spacing: 0.06em;
    vertical-align: middle;
}
.account-brand-headline {
    margin: var(--portal-space-7) 0 0;
    max-width: 26rem;
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-strong);
    font-size: 2rem;
    line-height: var(--portal-lh-tight);
    color: var(--nt-white);
}
.account-brand-areas { list-style: none; margin: var(--portal-space-5) 0 0; padding: 0; }
.account-brand-areas li {
    display: flex;
    gap: var(--portal-space-3);
    margin-bottom: var(--portal-space-4);
    color: #eadfd6;
}
.account-brand-areas li::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--nt-white);
    opacity: 0.85;
}
.account-brand-areas strong {
    display: block;
    font-family: var(--portal-font-display);
    font-weight: var(--portal-weight-strong);
    color: var(--nt-white);
}
.account-brand-copyright { margin-top: auto; padding-top: var(--portal-space-5); font-size: var(--portal-size-meta); color: #e2c9c5; }
.account-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--portal-space-6);
}
.account-main .portal-account { width: 100%; max-width: 26rem; }
.account-main .portal-page-header h1 { font-size: 2.25rem; }
.portal-account-card {
    margin-top: var(--portal-space-4);
    padding: var(--portal-space-5);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-lg);
}
@media (max-width: 48rem) {
    .account-shell { flex-direction: column; }
    .account-brand { flex: none; padding: var(--portal-space-5); }
    .account-brand-headline { margin-top: var(--portal-space-4); font-size: 1.5rem; }
    .account-brand-copyright { display: none; }
    .account-main { justify-content: flex-start; padding: var(--portal-space-5); }
    .account-main::after {
        content: "\00A9  Network Tasman Limited";
        margin-top: var(--portal-space-6);
        font-size: var(--portal-size-meta);
        color: var(--portal-text-muted);
    }
}

/* Skip link: shared by PortalLayout and the Hub's AccountLayout */
.portal-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: var(--portal-space-2) var(--portal-space-3);
    background: var(--portal-brand);
    color: var(--nt-white);
    text-decoration: none;
    border-radius: 0 0 var(--portal-radius) 0;
}
.portal-skip-link:focus { left: 0; }
