:root {
    color-scheme: dark;
    --admin-bg: #071426;
    --admin-panel: #101a29;
    --admin-panel-raised: #091a30;
    --admin-text: #eff8ff;
    --admin-muted: #a7afb8;
    --admin-accent: #FFAE42;
    --admin-warm: #d38a25;
    --admin-border: rgba(255, 174, 66, .36);
    --admin-field-border: rgba(92, 166, 255, .24);
    --admin-focus: #5ca6ff;
}

html[data-theme="light"] {
    color-scheme: light;
    --admin-bg: #eef4fc;
    --admin-panel: #ffffff;
    --admin-panel-raised: #e5eef9;
    --admin-text: #183454;
    --admin-muted: #526b86;
    --admin-accent: #FFAE42;
    --admin-warm: #d38a25;
    --admin-border: rgba(255, 174, 66, .45);
    --admin-field-border: rgba(24, 52, 84, .2);
    --admin-focus: #2b64ad;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at 50% 0, rgba(92, 166, 255, .1), transparent 44%),
        radial-gradient(ellipse at 90% 22%, rgba(255, 174, 66, .055), transparent 30%),
        var(--admin-bg);
    color: var(--admin-text);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    line-height: 1.55;
    transition: background-color .2s ease, color .2s ease;
}

button,
input,
textarea {
    font: inherit;
}

.admin-topbar {
    min-height: 72px;
    padding: 16px clamp(20px, 5vw, 72px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--admin-border);
    background: rgba(7, 20, 38, .72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-theme="light"] .admin-topbar {
    background: rgba(238, 244, 252, .88);
}

.admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--admin-accent);
    font-family: 'Anton', Impact, sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-decoration: none;
}

.admin-brand-mark {
    width: 42px;
    height: 42px;
    border: 1px solid var(--admin-border);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 16px rgba(255, 174, 66, .2);
}

.admin-brand-context {
    color: var(--admin-muted);
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: .72rem;
    letter-spacing: .08em;
}

.admin-home-link,
.eyebrow {
    color: var(--admin-accent);
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-home-link {
    font-size: .88rem;
    text-decoration: none;
}

.admin-home-link:hover {
    color: var(--admin-warm);
    text-decoration: underline;
}

.admin-theme-toggle {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--admin-border);
    border-radius: 50%;
    background: var(--admin-panel-raised);
    color: var(--admin-accent);
    cursor: pointer;
}

.admin-theme-toggle:hover {
    border-color: var(--admin-accent);
    box-shadow: 0 0 16px rgba(255, 174, 66, .2);
}

.admin-theme-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.admin-theme-icon-moon {
    display: none;
}

html[data-theme="light"] .admin-theme-icon-sun {
    display: none;
}

html[data-theme="light"] .admin-theme-icon-moon {
    display: block;
}

.admin-main {
    width: min(100% - 32px, 1000px);
    margin: 54px auto 90px;
}

.admin-card {
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid var(--admin-border);
    border-radius: 24px;
    background: var(--admin-panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(92, 166, 255, .06);
}

.admin-login {
    max-width: 460px;
    margin: 7vh auto;
}

.eyebrow {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    font-family: 'Anton', Impact, 'Arial Narrow', sans-serif;
    font-weight: 400;
    letter-spacing: .015em;
    line-height: 1.15;
}

.admin-login h1,
.dashboard-heading h1 {
    margin: 10px 0;
    font-size: clamp(2rem, 5vw, 3rem);
}

.admin-login > p,
.dashboard-heading p,
.card-heading > p {
    color: var(--admin-muted);
}

#adminLoginForm,
.announcement-form {
    display: grid;
    gap: 10px;
}

label {
    font-size: .88rem;
    font-weight: 600;
}

input:not([type="checkbox"]),
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--admin-field-border);
    border-radius: 12px;
    background: var(--admin-bg);
    color: var(--admin-text);
}

input:not([type="checkbox"]):focus-visible,
textarea:focus-visible {
    border-color: var(--admin-focus);
}

textarea {
    resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--admin-focus);
    outline-offset: 3px;
}

.admin-button {
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}

.admin-button-primary {
    border-color: var(--admin-accent);
    background: var(--admin-accent);
    color: #091a30;
}

.admin-button-primary:hover {
    filter: brightness(1.08);
}

.admin-button-quiet {
    background: transparent;
    color: var(--admin-text);
}

.admin-button-quiet:hover {
    background: var(--admin-panel-raised);
    border-color: var(--admin-field-border);
}

.admin-button-danger {
    border-color: rgba(255, 120, 120, .45);
    background: transparent;
    color: #ffb0a8;
}

.admin-button-danger:hover {
    background: rgba(255, 120, 120, .1);
}

.admin-message {
    min-height: 1.4em;
    margin: 4px 0;
    color: var(--admin-accent);
    font-size: .88rem;
}

.admin-dashboard {
    display: grid;
    gap: 24px;
}

.dashboard-heading,
.card-heading,
.inventory-row,
.announcement-row,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-heading {
    align-items: flex-start;
}

.dashboard-heading p {
    max-width: 620px;
    margin-bottom: 0;
}

.dashboard-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--admin-field-border);
}

.dashboard-nav-button {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--admin-muted);
    font-weight: 700;
    cursor: pointer;
}

.dashboard-nav-button:hover,
.dashboard-nav-button.is-active {
    border-color: var(--admin-border);
    background: var(--admin-panel-raised);
    color: var(--admin-text);
}

.dashboard-nav-button.is-active {
    border-color: var(--admin-accent);
    box-shadow: inset 0 -2px var(--admin-accent);
}

.card-heading {
    align-items: flex-end;
    margin-bottom: 24px;
}

.card-heading h2 {
    margin: 6px 0 0;
}

.card-heading > p {
    margin-bottom: 2px;
    text-align: right;
    font-size: .84rem;
}

.inventory-list,
.announcement-admin-list,
.admin-orders-list {
    display: grid;
    gap: 12px;
}

.admin-order-row {
    padding: 18px;
    border: 1px solid var(--admin-field-border);
    border-radius: 16px;
    background: var(--admin-panel-raised);
}

.admin-order-heading,
.admin-order-items li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
}

.admin-order-heading h3 {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-order-heading time,
.admin-order-meta {
    color: var(--admin-muted);
    font-size: .82rem;
}

.admin-order-customer {
    margin: 14px 0 4px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.admin-order-meta {
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.admin-order-items {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 14px 0;
    border-top: 1px solid var(--admin-field-border);
    border-bottom: 1px solid var(--admin-field-border);
    list-style: none;
}

.admin-order-items li {
    overflow-wrap: anywhere;
}

.admin-order-items strong,
.admin-order-total {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.admin-order-total {
    margin: 14px 0 0;
    color: var(--admin-accent);
    font-weight: 700;
    text-align: right;
}

.admin-order-notes {
    margin: 12px 0 0;
    color: var(--admin-muted);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.inventory-row,
.announcement-row {
    padding: 16px;
    border: 1px solid var(--admin-field-border);
    border-radius: 16px;
    background: var(--admin-panel-raised);
}

.inventory-name {
    min-width: 130px;
    font-weight: 700;
}

.inventory-fields {
    display: flex;
    align-items: end;
    gap: 12px;
}

.inventory-fields label {
    display: grid;
    gap: 5px;
    color: var(--admin-muted);
    font-size: .74rem;
}

.inventory-fields input {
    width: 128px;
}

.announcement-form {
    max-width: 720px;
    margin-bottom: 28px;
}

.publish-option {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 6px 0;
}

.publish-option input {
    width: 17px;
    height: 17px;
    accent-color: var(--admin-accent);
}

.form-actions {
    justify-content: flex-start;
}

.announcement-row {
    align-items: flex-start;
}

.announcement-copy {
    min-width: 0;
}

.announcement-copy h3 {
    margin: 0 0 6px;
}

.announcement-copy p {
    margin-bottom: 8px;
    color: var(--admin-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.announcement-meta {
    color: var(--admin-warm);
    font-size: .76rem;
}

.announcement-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.announcement-actions .admin-button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: .82rem;
}

.empty-state {
    margin: 0;
    color: var(--admin-muted);
}

.visitor-count {
    margin: 0;
    color: var(--admin-accent);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.visitor-count-note {
    margin: 12px 0 0;
    color: var(--admin-muted);
    font-size: .88rem;
}

.admin-button,
.dashboard-nav-button,
.admin-home-link {
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.admin-button:active,
.dashboard-nav-button:active {
    transform: scale(.98);
}

::selection {
    background: var(--admin-warm);
    color: #091a30;
}

[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    .admin-topbar {
        padding-right: 16px;
        padding-left: 16px;
    }

    .admin-topbar-actions {
        gap: 10px;
    }

    .admin-brand {
        gap: 7px;
        font-size: 1rem;
    }

    .admin-brand-mark {
        width: 36px;
        height: 36px;
    }

    .admin-brand-context {
        font-size: .62rem;
    }

    .admin-home-link {
        font-size: .76rem;
    }

    .admin-theme-toggle {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
    }

    .admin-main {
        margin-top: 28px;
    }

    .dashboard-heading,
    .card-heading,
    .inventory-row,
    .announcement-row,
    .admin-order-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .card-heading > p {
        text-align: left;
    }

    .inventory-fields {
        align-items: stretch;
    }

    .inventory-fields label,
    .inventory-fields input {
        width: 100%;
    }

    .announcement-actions {
        flex-wrap: wrap;
    }

    .admin-order-heading time {
        margin-top: -10px;
    }
}
