:root {
    --navy: #10294b;
    --navy-600: #1b3a66;
    --navy-700: #0b1e3a;
    --orange: #f26522;
    --orange-600: #d9551a;
    --orange-50: #fff4ec;
    --ink: #16233a;
    --muted: #6b7a90;
    --line: #e3e8ef;
    --bg: #f4f6fa;
    --danger: #c0392b;
    --ok: #1e8e5a;
    --font-display: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --radius: 14px;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
}

a {
    color: var(--orange-600);
}

[hidden] {
    display: none !important;
}

h1:focus,
h2:focus {
    outline: none;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: .6rem 1rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .1s ease, opacity .15s ease;
    line-height: 1.2;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--orange);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    background: var(--orange-600);
}

.btn--navy {
    background: var(--navy);
    color: #fff;
}

.btn--navy:hover:not(:disabled) {
    background: var(--navy-700);
}

.btn--ghost {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
}

.btn--ghost:hover:not(:disabled) {
    background: rgba(255, 255,255, .22);
}

.btn--outline {
    background: #fff;
    border-color: var(--line);
    color: var(--navy);
}

.btn--outline:hover:not(:disabled) {
    border-color: var(--navy);
}

.btn--danger {
    background: #fff;
    border-color: #f0c2bd;
    color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
    background: #fdf1ef;
}

.btn--sm {
    padding: .4rem .7rem;
    font-size: .78rem;
    border-radius: 8px;
}

/* ---------------- Forms ---------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-bottom: .85rem;
}

.field > label {
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="email"],
.field select,
.field textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .58rem .65rem;
    font-size: .92rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--orange);
    outline-offset: 1px;
    border-color: var(--orange);
}

.field small {
    font-size: .72rem;
    color: var(--muted);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.validation-message {
    color: var(--danger);
    font-size: .78rem;
    font-weight: 600;
}

/* ---------------- Cards / panels ---------------- */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(16, 41, 75, .05);
}

.panel__title {
    margin: 0 0 .8rem;
    font-size: 1.05rem;
    color: var(--navy);
    font-weight: 800;
}

.page-loading {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

.alert {
    border-radius: 10px;
    padding: .6rem .75rem;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .8rem;
}

.alert--error {
    background: #fdf1ef;
    border: 1px solid #f0c2bd;
    color: var(--danger);
}

.alert--ok {
    background: #eef8f2;
    border: 1px solid #bfe3ce;
    color: var(--ok);
}

/* ---------------- Toolbar (search + sort) ---------------- */
.toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .6rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .7rem;
    margin: .6rem 0 1rem;
    box-shadow: 0 2px 8px rgba(16, 41, 75, .05);
}

/* The form itself is the sticky element, so it can stick inside the page. */
#catalog-toolbar {
    position: sticky;
    top: 64px;
    z-index: 30;
}

.toolbar__search {
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 .6rem;
    background: var(--bg);
}

.toolbar__search:focus-within {
    border-color: var(--orange);
    background: #fff;
}

.toolbar__search-icon {
    font-size: .85rem;
    opacity: .6;
}

.toolbar__search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: .55rem 0;
    font-size: .92rem;
    color: var(--ink);
    min-width: 0;
}

.toolbar__search input:focus {
    outline: none;
}

.toolbar__sort {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.toolbar__sort label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.toolbar__sort select {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .5rem .55rem;
    font-size: .88rem;
    background: var(--bg);
    color: var(--ink);
    font-weight: 600;
}

.toolbar__count {
    margin: 0;
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}

/* ---------------- Pagination ---------------- */
.pager {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    margin-top: 1.3rem;
}

.pager__info {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}

.pager__links {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    justify-content: center;
}

.pager__link {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .55rem;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--navy);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .85rem;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.pager__link:hover {
    border-color: var(--orange);
    color: var(--orange-600);
}

.pager__link.is-active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* Marks the spot the infinite scroll watches for the next page. */
.sentinel {
    height: 1px;
    margin-top: .5rem;
}

/* ---------------- Empty state ---------------- */
.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 14px;
}

.empty__glyph {
    font-size: 2.6rem;
    display: block;
    margin-bottom: .4rem;
}

.empty h2 {
    margin: 0 0 .3rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--navy);
}

.empty p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: .88rem;
}

/* ---------------- Auth pages (login / change password) ---------------- */.auth {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem 0 2rem;
}

.auth__card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(16, 41, 75, .10);
}

.auth__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.1rem;
}

.auth__logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--navy);
    color: var(--orange);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .02em;
}

.auth__brand-text strong {
    display: block;
    font-family: var(--font-display);
    color: var(--navy);
    font-size: .95rem;
    letter-spacing: .05em;
}

.auth__brand-text small {
    display: block;
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth__title {
    margin: 0 0 .25rem;
    font-size: 1.25rem;
    color: var(--navy);
    font-weight: 800;
}

.auth__hint {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: .86rem;
}

.auth__submit {
    width: 100%;
    margin-top: .3rem;
    padding: .7rem 1rem;
}

.auth__back {
    display: block;
    margin-top: 1rem;
    text-align: center;
    font-size: .82rem;
    color: var(--muted);
    text-decoration: none;
}

.auth__back:hover {
    color: var(--orange-600);
}

/* ---------------- Blazor error UI ---------------- */
#blazor-error-ui {
    background: #ffe9e7;
    border-top: 1px solid #f0c2bd;
    bottom: 0;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, .08);
    display: none;
    left: 0;
    padding: .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--danger);
    font-size: .9rem;
}

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

/* ---------------- Responsive toolbar ---------------- */
@media (min-width: 560px) {
    .toolbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "search sort"
            "count  count";
        align-items: center;
    }

    .toolbar__search {
        grid-area: search;
    }

    .toolbar__sort {
        grid-area: sort;
    }

    .toolbar__count {
        grid-area: count;
    }
}

@media (min-width: 840px) {
    .toolbar {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas: "search sort count";
        gap: .8rem;
    }
}
