/* Sight Glass global styles. Component-specific rules live beside their
   components in .razor.css files; what is here is shared or has to reach
   MudBlazor's own markup. */

html, body {
    margin: 0;
}

/* ------------------------------------------------------------ boot screen */

.boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: radial-gradient(120% 90% at 50% 0%, #1E3050 0%, #14223A 55%, #0D1524 100%);
    color: #F9F9F6;
    font-family: "Segoe UI", system-ui, sans-serif;
}

.boot__mark { height: 34px; }

.boot__title {
    font-size: 1.05rem;
    letter-spacing: .32em;
    text-transform: uppercase;
    opacity: .8;
}

.boot__bar {
    width: 160px;
    height: 3px;
    background: rgba(255, 255, 255, .12);
    border-radius: 2px;
    overflow: hidden;
}

.boot__bar span {
    display: block;
    width: 40%;
    height: 100%;
    background: #F1B53D;
    animation: boot-slide 1.1s ease-in-out infinite;
}

@keyframes boot-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
    .boot__bar span { animation: none; width: 100%; }
}

/* ------------------------------------------------------------ error bar */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 12px 20px;
    background: #A6432F;
    color: #fff;
    font-family: "Segoe UI", system-ui, sans-serif;
}

#blazor-error-ui .reload { color: #fff; font-weight: 600; margin-left: 12px; }

/* ------------------------------------------------------------ shared */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head__eyebrow {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--mud-palette-secondary);
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 18px;
    padding: 16px 20px;
    border: 1px dashed var(--mud-palette-lines-inputs);
    border-radius: 4px;
    background: var(--mud-palette-background);
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: .95rem;
    letter-spacing: .06em;
}

.qr-box {
    width: 200px;
    height: 200px;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-lines-default);
}

.qr-box svg { width: 100%; height: 100%; display: block; }

.mono { font-family: Consolas, "Cascadia Mono", monospace; }

/* ------------------------------------------------------------ nav rows */
/* Rows in the type tree and the schema builder's side lists. Global because
   the tree is shared by the schema builder and the item list. */

.schema__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--mud-palette-text-primary);
    font: inherit;
    font-size: .875rem;
    text-align: left;
    cursor: pointer;
}

.schema__item:hover { background: var(--mud-palette-table-hover); }

.schema__item.is-selected {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.schema__item.is-retired .schema__item-text {
    text-decoration: line-through;
    opacity: .6;
}

.schema__item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schema__swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

.schema__count {
    font-size: .75rem;
    opacity: .7;
}


/* ------------------------------------------------------------ map (js/map.js)
   Popups and cluster counts are created by the map library, outside Blazor's
   scoped styles, so they live here. */

.sg-map-count {
    pointer-events: none;
    color: #F9F9F6;
    font: 600 12px/1 "Segoe UI", system-ui, sans-serif;
}

.sg-map-card {
    font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
    color: #1D1D1B;
    min-width: 160px;
}

.sg-map-card a {
    color: #234923;
    font-weight: 600;
    text-decoration: none;
}

.sg-map-card a:hover { text-decoration: underline; }

.sg-map-card__name { display: block; font-size: 14px; margin-right: 14px; }
.sg-map-card__detail { color: #55606F; margin-top: 2px; }
.sg-map-card__placed { color: #55606F; font-style: italic; margin-top: 4px; }
.sg-map-card__actions { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.sg-map-card__list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.sg-map-card__list li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.sg-map-card__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.sg-map-logo {
    position: absolute;
    left: 10px;
    bottom: 28px;
    z-index: 2;
    line-height: 0;
}

.sg-map-logo img { height: 21px; }

/* ------------------------------------------------- QR label sheets (labels page)
   A4, 21 labels of 63.5 × 38.1 mm in 3 columns and 7 rows (Avery L7160
   layout): 15.15 mm top margin, 7.25 mm side margins, 2.54 mm between
   columns. Global, not scoped: the QR drawings are injected markup, and
   @page has to be. */

@page {
    size: A4;
    margin: 0;
}

.sg-print { min-height: 100vh; padding: 16px 0 32px; }

.sg-print-controls {
    max-width: 210mm;
    margin: 0 auto 16px;
    padding: 0 8px;
    font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

.sg-print-controls h1 { font-size: 22px; margin: 6px 0 12px; }
.sg-print-controls__back { color: inherit; }
.sg-print-controls__error { color: #A6432F; }

.sg-print-controls__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 18px 28px;
    margin-bottom: 14px;
}

.sg-print-controls__row label { display: inline-flex; align-items: center; gap: 8px; }
.sg-print-controls__row input[type=number] { width: 60px; padding: 4px; }

.sg-print-controls__print {
    padding: 8px 22px;
    border: 0;
    border-radius: 4px;
    background: #234923;
    color: #fff;
    font: 600 14px "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}

.sg-print-controls__hint { flex: 1; min-width: 260px; margin: 0; opacity: .8; }

.sg-start {
    display: grid;
    grid-template-columns: repeat(3, 34px);
    gap: 3px;
    margin-top: 6px;
}

.sg-start button {
    height: 20px;
    border: 1px solid #9aa3ad;
    border-radius: 2px;
    background: #fff;
    color: #1D1D1B;
    font-size: 11px;
    cursor: pointer;
}

.sg-start button.used { background: #d4d8dc; color: #6b7280; text-decoration: line-through; }
.sg-start button.first { background: #F1B53D; border-color: #F1B53D; font-weight: 700; }

.sg-sheet {
    box-sizing: border-box;
    width: 210mm;
    height: 297mm;
    margin: 0 auto 16px;
    padding: 15.15mm 7.25mm 0;
    display: grid;
    grid-template-columns: repeat(3, 63.5mm);
    grid-auto-rows: 38.1mm;
    column-gap: 2.54mm;
    align-content: start;
    background: #fff;
    color: #000;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
    overflow: hidden;
    break-after: page;
}

.sg-label {
    box-sizing: border-box;
    display: flex;
    gap: 2mm;
    padding: 3mm;
    overflow: hidden;
    outline: 1px dashed #cfd4d9;
    font-family: "Segoe UI", Arial, sans-serif;
}

.sg-label__qr { width: 28mm; height: 28mm; flex: none; align-self: center; }
.sg-label__qr svg { display: block; width: 100%; height: 100%; }

.sg-label__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sg-label__logo { height: 3.2mm; width: auto; align-self: flex-start; margin-bottom: 1.2mm; }

.sg-label__name {
    font-size: 8pt;
    font-weight: 700;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.sg-label__meta {
    margin-top: .8mm;
    font-size: 6pt;
    line-height: 1.2;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sg-label__code {
    margin-top: auto;
    font: 700 10pt/1 Consolas, "Courier New", monospace;
    letter-spacing: .06em;
}

@media print {
    html, body { background: #fff !important; }
    .sg-print { padding: 0; }
    .sg-print-controls { display: none; }
    .sg-sheet { margin: 0; box-shadow: none; }
    .sg-label { outline: 0; }
    .mud-snackbar-provider, .mud-popover-provider { display: none !important; }
}

/* Looking back (increment 9): the top-bar date, gold while it's in the past. */
.sg-asat.mud-button-root { text-transform: none; font-weight: 500; }
.sg-asat--on.mud-button-root { color: #14223A; background: #F1B53D; }
.sg-asat--on.mud-button-root:hover { background: #F5C766; }

/* ---------------------------------------------- web line badges (js/web.js)
   The link type's icon on its colour at the middle of each line. Created by
   the script, so styled here rather than in WebCanvas's scoped styles. */
.web-badges {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.web-badge {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 2px solid var(--mud-palette-background);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    pointer-events: auto;
    cursor: default;
}

.web-badge svg { width: 12px; height: 12px; fill: #fff; }

/* Chips: a change, a link, a step in a chain - an icon and a few words
   (increment 11). --chip is the colour. */
.sg-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    margin: 2px 4px 2px 0;
    padding: 1px 8px 1px 4px;
    border-radius: 12px;
    font-size: .8rem;
    line-height: 20px;
    color: var(--mud-palette-text-primary);
    background: color-mix(in srgb, var(--chip, #6B7280) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--chip, #6B7280) 35%, transparent);
    vertical-align: middle;
}

.sg-chip .sg-chip__icon {
    width: 15px;
    height: 15px;
    font-size: 15px;
    flex: none;
    color: color-mix(in srgb, var(--chip, #6B7280) 80%, var(--mud-palette-text-primary));
}

.sg-chip__sign { font-weight: 700; color: color-mix(in srgb, var(--chip, #6B7280) 80%, var(--mud-palette-text-primary)); }
.sg-chip__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-chip--ended { opacity: .75; }
.sg-chip--ended .sg-chip__text { text-decoration: line-through; }
a.sg-chip { text-decoration: none; }
a.sg-chip:hover { border-color: var(--chip, #6B7280); }

.help-tip { vertical-align: middle; cursor: help; margin-left: 4px; }

/* The bell (increment 11). The menu's popover sits outside the layout, so these are global. */
.sg-bell__popover { width: min(380px, calc(100vw - 24px)); }
.sg-bell__head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; font-weight: 600; }
.sg-bell__empty { display: flex; align-items: center; gap: 8px; padding: 12px 16px 16px; color: var(--mud-palette-text-secondary); }
.sg-bell__list { max-height: 60vh; overflow-y: auto; }
.sg-bell__alert {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sg-bell__alert:hover { background: var(--mud-palette-action-default-hover); }
.sg-bell__alert.is-new { background: color-mix(in srgb, var(--mud-palette-warning) 10%, transparent); }
.sg-bell__icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    color: #fff;
    background: var(--chip);
}
.sg-bell__icon .mud-icon-root { font-size: 16px; width: 16px; height: 16px; }
.sg-bell__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sg-bell__title, .sg-bell__detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-bell__title { font-size: .875rem; font-weight: 600; }
.sg-bell__detail { font-size: .78rem; color: var(--mud-palette-text-secondary); }
.sg-bell__when { font-size: .72rem; color: var(--mud-palette-text-secondary); flex: none; }

/* Item page tabs on phones: all four in view, without scroll arrows. Global:
   the tabs sit inside MudPaper, out of reach of the page's scoped styles. */
@media (max-width: 599px) {
    .item-tabs .mud-tab {
        min-width: 0 !important;
        padding: 6px 6px;
        font-size: .74rem;
    }
}

/* Item and customer page header (increment 12: shared). */
.item-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.item-head__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    color: #fff;
    flex: none;
    margin-top: 4px;
}

.item-head__text { flex: 1; min-width: 220px; }

.item-head__trail { font-size: .8rem; color: var(--mud-palette-text-secondary); }

.item-head__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: .8rem;
    color: var(--mud-palette-text-secondary);
}

.item-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* CRM pages (increment 14): shared heads, groups and rows. */
.crm__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; }
.crm__group { margin: 10px 0 2px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.crm__empty { display: flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--mud-palette-text-secondary); }
.crm__activity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-primary);
    text-decoration: none;
}
.crm__activity:hover b { text-decoration: underline; }
.crm__kind {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    color: #fff;
    background: var(--chip);
}
.crm__kind .mud-icon-root { font-size: 16px; width: 16px; height: 16px; }
.crm__activity-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.crm__activity-text b, .crm__activity-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm__activity-text span { font-size: .78rem; color: var(--mud-palette-text-secondary); }
.crm__when { flex: none; font-size: .78rem; color: var(--mud-palette-text-secondary); }
.crm__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.crm__filters .mud-input-control { width: auto; min-width: 160px; flex: 0 1 220px; }
