/* ======================================================================================
   Zrike Brands Tickets (tickets.zrikebrands.com). The shell styles the shared Tickets and
   notification libraries expect from their host (action-button, empty-state, sc-modal, sc-edit-*,
   sc-token, upc-status, shell-*), copied from Diamond.AppHost's app.css with R2's navy app bar.
   Ticket and tray styles come from _content/Diamond.Tickets.Blazor/tickets.css and
   _content/Diamond.Notifications.Blazor/notifications.css.
   ====================================================================================== */

:root {
    /* Facet Blue palette (approved Option A) */
    --bar: #1A1A2E;            /* app bar / nav (R2 navy) */
    --bar-ink: #F2F7FB;
    --accent: #2E7CC0;
    --accent-deep: #1E5C93;
    --accent-soft: #DCEBF8;
    --on-accent: #FFFFFF;
    --ground: #F4F7FA;
    --card: #FFFFFF;
    --field: #EAF0F6;
    --line: #D8E1EA;
    --ink: #17273A;
    --muted: #62778C;
    --good: #1F8A5D;
    --warn: #B3641B;

    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --sh-card: 0 1px 2px rgba(20, 40, 63, 0.06);
    --sh-pop: 0 12px 32px rgba(20, 40, 63, 0.18);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    min-height: 100%;
}

#app {
    min-height: 100vh;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ── Shell ─────────────────────────────────────────────────────────────────────────── */

.shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.shell-topbar {
    background: var(--bar);
    color: var(--bar-ink);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.shell-back {
    background: none;
    border: none;
    color: var(--bar-ink);
    width: 2rem;
    height: 2rem;
    padding: 0.25rem;
    margin-left: -0.35rem;
    border-radius: var(--r-sm);
}

.shell-back svg {
    width: 100%;
    height: 100%;
}

.shell-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    min-width: 0;
}

.shell-brand-title {
    font-weight: 650;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shell-brand-eyebrow {
    font-weight: 400;
    font-size: 0.68rem;
    opacity: 0.75;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shell-app-menu {
    margin-left: auto;
    position: relative;
}

.shell-avatar {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    border: none;
    background: var(--accent-soft);
    color: var(--accent-deep);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shell-app-menu-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    border: none;
    z-index: 110;
}

.shell-app-menu-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 120;
    min-width: 15rem;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-pop);
    padding: 0.4rem;
}

.shell-app-menu-user {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.65rem;
}

.shell-app-menu-user-name {
    font-weight: 650;
    font-size: 0.9rem;
}

.shell-app-menu-user-meta {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.shell-app-menu-separator {
    height: 1px;
    background: var(--line);
    margin: 0.3rem 0;
}

.shell-app-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    background: none;
    border: none;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    color: var(--ink);
}

.shell-app-menu-item:hover {
    background: var(--field);
}

.shell-app-menu-logout {
    color: var(--warn);
    font-weight: 600;
}

.shell-app-version-panel {
    padding: 0.4rem 0.65rem 0.55rem;
    font-size: 0.8rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.shell-app-version-line {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.shell-app-version-line strong {
    color: var(--ink);
    font-weight: 600;
}

.shell-app-version-error {
    color: var(--warn);
}

.shell-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.9rem 0.9rem 2rem;
}

/* ── Empty states / error boundary ─────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
    color: var(--muted);
}

.empty-state h2, .empty-state h1 {
    color: var(--ink);
    font-size: 1.15rem;
    margin: 0 0 0.4rem;
}

.empty-state p {
    margin: 0.25rem 0;
    font-size: 0.92rem;
}

/* The call-to-action under an empty state's message gets breathing room. */
.empty-state .action-button { margin-top: 1rem; }

.empty-state-detail {
    font-size: 0.8rem;
    opacity: 0.8;
    word-break: break-word;
}

.empty-state .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
}

.error-boundary {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--muted);
}

.action-button {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-md);
    padding: 0.6rem 1.25rem;
    font-weight: 650;
    font-size: 0.9rem;
}

.action-button:disabled {
    opacity: 0.55;
    cursor: default;
}

.action-button-secondary {
    background: var(--field);
    color: var(--ink);
}

/* ── Login ─────────────────────────────────────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--ground);
    padding: 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 22rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-card);
    padding: 1.75rem 1.5rem;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.25rem;
}

.login-brand h1 {
    font-size: 1.25rem;
    margin: 0.75rem 0 0.15rem;
}

.login-brand p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 0.9rem 0 0.25rem;
}

.login-input {
    width: 100%;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    color: var(--ink);
    font-family: inherit;
}

.login-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.login-error {
    color: var(--warn);
    font-size: 0.85rem;
    margin: 0.75rem 0 0;
}

.login-submit {
    width: 100%;
    margin-top: 1.25rem;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-md);
    padding: 0.7rem;
    font-weight: 650;
    font-size: 0.95rem;
}

.login-submit:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Boot-failure panel injected by boot.js when Blazor can't start. */
.boot-error-detail {
    font-size: 0.8rem;
    color: var(--text-muted, #8a94a3);
    overflow-wrap: anywhere;
}

.empty-state .login-submit {
    max-width: 20rem;
}

.boot-reset {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* Lookup status lines */

.upc-status {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.1rem 0.15rem;
}

.upc-status-error {
    color: var(--warn);
}

.upc-status-warn {
    color: var(--warn);
}

/* Details (audit) modal */

.sc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 40, 63, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sc-modal {
    width: min(100%, 26rem);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-pop);
    padding: 1rem;
}

.sc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.sc-modal-header h3 {
    margin: 0;
    font-size: 1rem;
}

.sc-modal-close {
    background: var(--field);
    border: none;
    color: var(--muted);
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sc-modal-close:hover {
    background: var(--accent-soft);
    color: var(--accent-deep);
}

.sc-modal-section {
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
    margin-top: 0.7rem;
}

.sc-modal-section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.sc-modal-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.sc-modal-grid {
    display: grid;
    grid-template-columns: minmax(6.5rem, 8rem) minmax(0, 1fr);
    gap: 0.4rem 0.8rem;
    margin: 0;
}

.sc-modal-grid dt {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
}

.sc-modal-grid dd {
    margin: 0;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

/* Edit / New page */

.sc-edit-page {
    max-width: 34rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sc-edit-title {
    margin: 0.2rem 0 0;
    font-size: 1.15rem;
}

.sc-edit-errors {
    background: #FBEAEA;
    border: 1px solid #E6B8B8;
    color: #8C2B2B;
    border-radius: var(--r-md);
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
}

.sc-edit-errors ul {
    margin: 0;
    padding-left: 1.1rem;
}

.sc-edit-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-card);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sc-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
    flex: 1;
    min-width: 0;
}

.sc-edit-field-label {
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
}

.sc-edit-field input, .sc-edit-field select, .sc-edit-field textarea {
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 0.55rem 0.7rem;
    font-size: 0.92rem;
    color: var(--ink);
    font-family: inherit;
    font-weight: 400;
    resize: vertical;
}

.sc-edit-field input:focus, .sc-edit-field select:focus, .sc-edit-field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.sc-edit-hint {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--muted);
}

.sc-edit-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sc-edit-ltl-row {
    align-items: center;
}

.sc-token-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 2.1rem;
    background: var(--field);
    border: 1px dashed var(--line);
    border-radius: var(--r-md);
    padding: 0.4rem 0.5rem;
    align-items: center;
}

.sc-token {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--accent-soft);
    color: var(--accent-deep);
    border-radius: 999px;
    padding: 0.15rem 0.3rem 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 650;
    font-family: Consolas, monospace;
}

.sc-token button {
    background: none;
    border: none;
    color: var(--accent-deep);
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.05rem 0.25rem;
    border-radius: 999px;
}

.sc-token button:hover {
    background: rgba(30, 92, 147, 0.15);
}

.sc-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--line);
    padding-top: 0.85rem;
}

.sc-edit-actions .action-button-secondary {
    margin-right: auto;
}

.sc-delete-btn {
    background: #B23A3A;
}

.sc-delete-btn:hover {
    background: #8C2B2B;
}

/* ── Blazor error UI ───────────────────────────────────────────────────────────────── */

#blazor-error-ui {
    background: #FDF3CF;
    color: #6B5410;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    font-size: 0.9rem;
}

#blazor-error-ui .reload {
    color: inherit;
    font-weight: 700;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Shell: notification bell, tray and toasts (all apps) ──────────────────────────── */

:root {
    --tk-bad: #B3273A;
    --tk-bad-soft: #FBE7EB;
    --tk-warn-soft: #FBEEDC;
    --tk-good-soft: #DDF3E8;
    --tk-purple: #5B4B9E;
    --tk-purple-soft: #E8E3F7;
    --tk-amber: #8A6A00;
    --tk-amber-soft: #FFF5D6;
}

.shell-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shell-topbar-actions .shell-app-menu {
    margin-left: 0;
}

/* ── App update banner ─────────────────────────────────────────────────────────────── */

.app-update-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--accent-soft);
    color: var(--accent-deep);
    border: 1px solid var(--accent);
    border-radius: var(--r-md);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.app-update-banner-button {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-sm);
    padding: 0.45rem 0.9rem;
    font-weight: 650;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ── Zrike Brands additions ────────────────────────────────────────────────────────── */

a.shell-brand {
    color: inherit;
    text-decoration: none;
}

.r2-logo {
    width: 1.6rem;
    height: 1.6rem;
    flex: none;
    display: inline-block;
    border-radius: 6px;
    background: url("images/icon-192.png") center / cover no-repeat;
}

.r2-logo-lg {
    width: 3rem;
    height: 3rem;
    border-radius: 10px;
}

@media (min-width: 980px) {
    .shell-topbar .r2-logo {
        width: 1.9rem;
        height: 1.9rem;
    }
}

.shell-nav {
    display: flex;
    gap: 0.25rem;
    margin-left: 1rem;
}

.shell-nav a {
    color: var(--bar-ink);
    opacity: 0.75;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    border-radius: var(--r-sm);
}

.shell-nav a.active,
.shell-nav a:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
    .shell-nav {
        display: none;
    }
}
