/* ===================== Amazon design tokens ========================= */
:root {
    --squid-ink: #131A22;   /* top nav / brand panel        */
    --slate: #232F3E;       /* secondary nav / drawer       */
    --slate-soft: #37475A;  /* hover on slate surfaces      */
    --orange: #FF9900;      /* brand accent                 */
    --gold-cta-start: #FFD814;
    --gold-cta-end: #F7CA00;
    --gold-cta-hover: #F2C200;
    --gold-border: #FCD200;
    --link-teal: #007185;
    --link-teal-hover: #C7511F; /* Amazon's signature hover swap */
    --price-red: #C40000;

    --ink: #0F1111;         /* primary text                 */
    --slate-60: #565959;    /* secondary text               */
    --success: #007600;
    --border-gray: #D5D9D9;
    --border-strong: #888C8C;
    --divider: #E7E7E7;
    --surface: #FFFFFF;
    --surface-muted: #F7FAFA;
    --focus-ring: rgba(228, 121, 17, .5);
    --focus-edge: #E77600;

    --font-ui: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-ui);
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#app {
    min-height: 100%;
}

/* ----------------------------- Boot screen --------------------------- */
.app-loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1.25rem;
    background: var(--squid-ink);
}

.app-loading__mark {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: -.02em;
    color: #fff;
}

.app-loading__bar {
    width: 160px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--orange), var(--gold-cta-start));
    animation: boot 1.1s ease-in-out infinite alternate;
}

@keyframes boot {
    from { transform: scaleX(.25); opacity: .5; transform-origin: left; }
    to   { transform: scaleX(1); opacity: 1; transform-origin: left; }
}

/* ============================== Login ================================= */
.login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
}

/* --- Left: editorial brand panel --- */
.login__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    padding: clamp(2.5rem, 5vw, 5rem);
    color: #EAF0F2;
    background:
        radial-gradient(120% 90% at 0% 0%, var(--slate) 0%, var(--squid-ink) 58%);
    overflow: hidden;
}

.login__brand::after {
    content: "";
    position: absolute;
    left: clamp(2.5rem, 5vw, 5rem);
    bottom: 0;
    width: 64px;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-cta-start), var(--orange));
}

.login__brand-top {
    display: flex;
    align-items: baseline;
    gap: .6rem;
}

.wordmark {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: -.02em;
    color: #fff;
}

.wordmark__tag {
    font-family: var(--font-ui);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--orange);
    padding: .15rem .45rem;
    border: 1px solid rgba(255, 153, 0, .4);
    border-radius: 4px;
}

.brand-headline {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.4rem, 4.4vw, 3.6rem);
    line-height: 1.04;
    letter-spacing: -.02em;
    margin: 0 0 1.25rem;
    color: #fff;
}

.brand-sub {
    font-size: clamp(1rem, 1.3vw, 1.12rem);
    line-height: 1.6;
    max-width: 42ch;
    color: #B9C4CC;
    margin: 0 0 2rem;
}

.brand-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .75rem;
    max-width: 42ch;
}

.brand-points li {
    position: relative;
    padding-left: 1.4rem;
    font-size: .98rem;
    color: #D4DCE1;
}

.brand-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .55em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--orange);
}

.login__brand-foot {
    font-size: .8rem;
    letter-spacing: .04em;
    color: #7E8C95;
    margin: 0;
}

/* --- Right: sign-in form --- */
.login__panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    background: var(--surface);
}

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

.login__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: -.015em;
    margin: 0 0 .35rem;
}

.login__subtitle {
    color: var(--slate-60);
    font-size: .98rem;
    margin: 0 0 1.75rem;
}

.field {
    margin-bottom: 1.15rem;
}

.field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .4rem;
    color: var(--ink);
}

.field__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.field__reveal {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--link-teal);
    cursor: pointer;
}

.field__reveal:hover {
    color: var(--link-teal-hover);
    text-decoration: underline;
}

.field__input {
    width: 100%;
    padding: .7rem .75rem;
    font: inherit;
    font-size: .98rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: inset 0 1px 2px rgba(15, 17, 17, .08);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.field__input::placeholder {
    color: #9AA0A0;
}

.field__input:focus {
    outline: none;
    border-color: var(--focus-edge);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.field .validation-message {
    display: block;
    margin-top: .35rem;
    font-size: .82rem;
    color: var(--price-red);
}

.cta {
    width: 100%;
    margin-top: .35rem;
    padding: .72rem 1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    border: 1px solid var(--gold-border);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--gold-cta-start), var(--gold-cta-end));
    box-shadow: 0 1px 0 rgba(15, 17, 17, .12);
    transition: filter .12s ease, box-shadow .12s ease, transform .04s ease;
}

.cta:hover {
    background: linear-gradient(180deg, var(--gold-cta-hover), var(--gold-cta-end));
}

.cta:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

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

.cta:disabled {
    cursor: progress;
    filter: grayscale(.35) opacity(.7);
}

.login__error {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    padding: .8rem .9rem;
    margin-bottom: 1.4rem;
    border: 1px solid #D89B9B;
    border-left: 4px solid var(--price-red);
    border-radius: 6px;
    background: #FFF5F5;
}

.login__error-mark {
    flex: none;
    display: grid;
    place-content: center;
    width: 20px;
    height: 20px;
    margin-top: .1rem;
    border-radius: 50%;
    background: var(--price-red);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
}

.login__error strong {
    display: block;
    font-size: .9rem;
}

.login__error span {
    font-size: .88rem;
    color: var(--slate-60);
}

.login__fineprint {
    margin: 1.6rem 0 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--divider);
    font-size: .8rem;
    line-height: 1.5;
    color: var(--slate-60);
}

/* ===================== Protected shell (Home) ======================== */
.shell {
    min-height: 100vh;
    background: var(--surface-muted);
}

.shell__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem clamp(1.25rem, 4vw, 2.5rem);
    background: var(--squid-ink);
}

.shell__bar-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.shell__nav {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.shell__nav-link {
    font-size: .9rem;
    font-weight: 600;
    color: #C8D0D6;
    text-decoration: none;
    padding: .4rem .75rem;
    border-radius: 6px;
}

.shell__nav-link:hover {
    color: #fff;
    background: var(--slate);
}

.shell__nav-link.active {
    color: #fff;
    background: var(--slate-soft);
}

.wordmark--dark {
    color: #fff;
}

.shell__bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shell__user {
    color: #C8D0D6;
    font-size: .9rem;
}

.shell__signout {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    background: var(--slate);
    border: 1px solid var(--slate-soft);
    border-radius: 6px;
    padding: .45rem .9rem;
    cursor: pointer;
}

.shell__signout:hover {
    background: var(--slate-soft);
}

.shell__body {
    padding: clamp(1.5rem, 4vw, 3rem);
}

.shell__body h1 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.015em;
    margin: 0 0 .75rem;
}

.shell__body p {
    color: var(--slate-60);
    line-height: 1.6;
    margin: 0;
}

/* ===================== Management pages (shared) ===================== */
.mgmt-page > * {
    animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}

.mgmt-page > *:nth-child(2) { animation-delay: .06s; }
.mgmt-page > *:nth-child(3) { animation-delay: .12s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 1.75rem;
}

.page-head h1 {
    margin: 0 0 .3rem;
}

.page-head__sub {
    margin: 0;
    color: var(--slate-60);
    font-size: .98rem;
    max-width: 52ch;
}

/* --- Segmented status filter (separated from the table) --- */
.seg {
    display: inline-flex;
    gap: .15rem;
    padding: .25rem;
    margin-bottom: 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border-gray);
    border-radius: 10px;
}

.seg__btn {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: var(--slate-60);
    background: transparent;
    border: none;
    border-radius: 7px;
    padding: .4rem .95rem;
    cursor: pointer;
    transition: color .12s ease, background .12s ease;
}

.seg__btn:hover {
    color: var(--ink);
}

.seg__btn.is-active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 17, 17, .12);
}

/* --- Table panel (single hairline surface, no nested cards) --- */
.mgmt-panel {
    background: var(--surface);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    overflow: hidden;
}

.mgmt-panel .mud-table-head th {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--slate-60);
}

/* Left-align every column; only Actions (last) sits right */
.mgmt-panel .mud-table-cell {
    text-align: left;
}

.mgmt-panel .mud-table-cell:last-child {
    text-align: right;
}

/* --- Status indicator (dot + label) --- */
.status {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink);
}

.status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--slate-60);
}

.status--active .status__dot { background: var(--success); }
.status--inactive { color: var(--slate-60); }
.status--inactive .status__dot { background: var(--border-strong); }

/* --- Empty state --- */
.mgmt-empty {
    padding: 2.5rem 1rem;
    text-align: center;
}

.mgmt-empty__title {
    margin: 0 0 .35rem;
    font-weight: 600;
    color: var(--ink);
}

.mgmt-empty__hint {
    margin: 0;
    color: var(--slate-60);
    font-size: .9rem;
}

/* --- Details dialog --- */
.dlg-head {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.dlg-field__label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--slate-60);
    margin-bottom: .35rem;
}

.dlg-field__value {
    margin: 0;
    line-height: 1.6;
    color: var(--ink);
}

.dlg-field__empty {
    margin: 0;
    color: var(--slate-60);
    font-style: italic;
}

.dlg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

@media (prefers-reduced-motion: reduce) {
    .mgmt-page > * { animation: none; }
}

/* =========================== Responsive ============================== */
@media (max-width: 880px) {
    .login {
        grid-template-columns: 1fr;
    }

    .login__brand {
        gap: 2rem;
        padding: 2rem 1.5rem 2.5rem;
    }

    .login__brand-copy .brand-points {
        display: none;
    }

    .brand-headline {
        margin-bottom: .75rem;
    }

    .login__brand-foot {
        display: none;
    }

    /* --- Protected shell on small screens --- */
    .shell__bar {
        flex-wrap: wrap;
        gap: .75rem 1rem;
        padding: .75rem 1rem;
    }

    .shell__bar-left {
        gap: 1rem;
        min-width: 0;
    }

    .shell__bar-right {
        margin-left: auto;
        min-width: 0;
    }

    .shell__user {
        max-width: 45vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ===================== Blazor framework error UI ===================== */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    padding: .9rem 1.25rem;
    background: var(--squid-ink);
    color: #fff;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
}

#blazor-error-ui .reload {
    color: var(--orange);
    margin-left: .5rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}
