:root {
    color-scheme: light;
    --admin-bg: #f4efe7;
    --admin-bg-soft: #fbf7f0;
    --admin-card: #fffaf2;
    --admin-card-strong: #ffffff;
    --admin-body-bg:
        radial-gradient(circle at top left, rgba(233, 120, 51, 0.18), transparent 32rem),
        linear-gradient(135deg, #f4efe7 0%, #eee2d1 48%, #f7efe2 100%);
    --admin-auth-card-bg: rgba(255, 250, 242, 0.92);
    --admin-sidebar-bg: rgba(255, 250, 242, 0.74);
    --admin-panel-bg: rgba(255, 250, 242, 0.86);
    --admin-nav-active-bg: #efe0cb;
    --admin-nav-placeholder-border: rgba(62, 49, 34, 0.16);
    --admin-nav-placeholder-strong: rgba(34, 32, 29, 0.52);
    --admin-user-card-bg: rgba(255, 255, 255, 0.62);
    --admin-thread-active-bg: #efe0cb;
    --admin-thread-time: rgba(118, 109, 99, 0.78);
    --admin-message-bg: #fffdf7;
    --admin-message-support-bg: #2f4f40;
    --admin-message-support-text: #fffaf2;
    --admin-message-support-muted: rgba(255, 250, 242, 0.72);
    --admin-reply-bg: rgba(255, 250, 242, 0.96);
    --admin-closed-bg: rgba(118, 109, 99, 0.1);
    --admin-input-bg: #fffdf7;
    --admin-focus-ring: rgba(233, 120, 51, 0.14);
    --admin-danger-bg: rgba(185, 73, 50, 0.12);
    --admin-danger-bg-hover: rgba(185, 73, 50, 0.2);
    --admin-error-bg: rgba(185, 73, 50, 0.08);
    --admin-error-border: rgba(185, 73, 50, 0.18);
    --admin-ghost-bg: rgba(255, 255, 255, 0.6);
    --admin-primary-button-text: #fffaf2;
    --admin-success-bg: rgba(79, 125, 82, 0.14);
    --admin-success-text: #2f5c35;
    --admin-ink: #22201d;
    --admin-muted: #766d63;
    --admin-line: rgba(62, 49, 34, 0.12);
    --admin-shadow: 0 22px 60px rgba(58, 43, 25, 0.12);
    --admin-orange: #e97833;
    --admin-orange-dark: #b95621;
    --admin-blue: #315f86;
    --admin-green: #4f7d52;
    --admin-danger: #b94932;
    --admin-radius-lg: 28px;
    --admin-radius-md: 20px;
    --admin-radius-sm: 14px;
    font-family: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --admin-bg: #12110f;
    --admin-bg-soft: #1a1713;
    --admin-card: #211c17;
    --admin-card-strong: #2b241d;
    --admin-body-bg:
        radial-gradient(circle at top left, rgba(255, 145, 77, 0.17), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(84, 126, 101, 0.12), transparent 28rem),
        linear-gradient(135deg, #12110f 0%, #1a1713 48%, #211b15 100%);
    --admin-auth-card-bg: rgba(33, 28, 23, 0.94);
    --admin-sidebar-bg: rgba(26, 23, 19, 0.84);
    --admin-panel-bg: rgba(33, 28, 23, 0.9);
    --admin-nav-active-bg: rgba(255, 145, 77, 0.16);
    --admin-nav-placeholder-border: rgba(255, 239, 219, 0.18);
    --admin-nav-placeholder-strong: rgba(247, 239, 226, 0.7);
    --admin-user-card-bg: rgba(255, 239, 219, 0.07);
    --admin-thread-active-bg: rgba(255, 145, 77, 0.14);
    --admin-thread-time: rgba(201, 188, 171, 0.76);
    --admin-message-bg: #2b241d;
    --admin-message-support-bg: #416c56;
    --admin-message-support-text: #fffaf2;
    --admin-message-support-muted: rgba(255, 250, 242, 0.76);
    --admin-reply-bg: rgba(26, 23, 19, 0.96);
    --admin-closed-bg: rgba(255, 239, 219, 0.07);
    --admin-input-bg: #171410;
    --admin-focus-ring: rgba(255, 145, 77, 0.22);
    --admin-danger-bg: rgba(255, 143, 120, 0.14);
    --admin-danger-bg-hover: rgba(255, 143, 120, 0.22);
    --admin-error-bg: rgba(255, 143, 120, 0.12);
    --admin-error-border: rgba(255, 143, 120, 0.28);
    --admin-ghost-bg: rgba(255, 239, 219, 0.08);
    --admin-primary-button-text: #21170f;
    --admin-success-bg: rgba(156, 202, 149, 0.14);
    --admin-success-text: #bde4b7;
    --admin-ink: #f7efe2;
    --admin-muted: #c9bcab;
    --admin-line: rgba(255, 239, 219, 0.14);
    --admin-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --admin-orange: #ff9650;
    --admin-orange-dark: #ffb071;
    --admin-blue: #8dbfe8;
    --admin-green: #9cca95;
    --admin-danger: #ff9a84;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--admin-body-bg);
    color: var(--admin-ink);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.admin-auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.admin-auth-card {
    background: var(--admin-auth-card-bg);
    border: 1px solid var(--admin-line);
    border-radius: 34px;
    box-shadow: var(--admin-shadow);
    max-width: 440px;
    padding: 2rem;
    width: 100%;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 180ms ease;
}

.admin-sidebar {
    background: var(--admin-sidebar-bg);
    border-right: 1px solid var(--admin-line);
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-height: 100vh;
    padding: 1.4rem;
    position: sticky;
    top: 0;
    transition: opacity 180ms ease, padding 180ms ease, transform 180ms ease, width 180ms ease;
    z-index: 1040;
}

.admin-menu-toggle {
    align-items: center;
    background: var(--admin-card);
    border: 1px solid var(--admin-line);
    border-radius: 16px;
    box-shadow: var(--admin-shadow);
    color: var(--admin-ink);
    display: inline-flex;
    flex-direction: column;
    gap: 0.32rem;
    height: 46px;
    justify-content: center;
    left: 1rem;
    position: fixed;
    top: 1rem;
    width: 46px;
    z-index: 1050;
}

.admin-menu-toggle span {
    background: currentColor;
    border-radius: 999px;
    height: 2px;
    transition: opacity 160ms ease, transform 160ms ease;
    width: 18px;
}

body:not(.admin-menu-collapsed) .admin-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body:not(.admin-menu-collapsed) .admin-menu-toggle span:nth-child(2) {
    opacity: 0;
}

body:not(.admin-menu-collapsed) .admin-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.admin-menu-backdrop {
    display: none;
}

body.admin-menu-collapsed .admin-shell {
    grid-template-columns: 0 minmax(0, 1fr);
}

body.admin-menu-collapsed .admin-sidebar {
    opacity: 0;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    pointer-events: none;
}

.admin-main {
    padding: 2rem;
}

.admin-brand {
    align-items: center;
    display: flex;
    gap: 0.85rem;
}

.admin-brand--center {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.admin-brand__mark {
    align-items: center;
    background: linear-gradient(145deg, #2f4f40, #e97833);
    border-radius: 18px;
    color: #fffaf2;
    display: inline-flex;
    font-weight: 800;
    height: 48px;
    justify-content: center;
    letter-spacing: -0.04em;
    width: 48px;
}

.admin-brand__name,
.admin-brand__caption {
    display: block;
}

.admin-brand__name {
    font-size: 1.05rem;
    font-weight: 800;
}

.admin-brand__caption {
    color: var(--admin-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-nav {
    display: grid;
    gap: 0.45rem;
}

.admin-nav__link {
    border-radius: 18px;
    color: var(--admin-muted);
    font-weight: 800;
    padding: 0.9rem 1rem;
}

.admin-nav__link.is-active,
.admin-nav__link:hover {
    background: var(--admin-nav-active-bg);
    color: var(--admin-ink);
}

.admin-nav-placeholder {
    border: 1px dashed var(--admin-nav-placeholder-border);
    border-radius: 20px;
    color: var(--admin-muted);
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
}

.admin-nav-placeholder span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.admin-nav-placeholder strong {
    color: var(--admin-nav-placeholder-strong);
    font-size: 0.9rem;
}

.admin-sidebar__footer {
    display: grid;
    gap: 0.8rem;
    margin-top: auto;
}

.admin-user-card {
    background: var(--admin-user-card-bg);
    border: 1px solid var(--admin-line);
    border-radius: 20px;
    padding: 0.9rem;
}

.admin-user-card strong,
.admin-user-card span {
    display: block;
}

.admin-user-card span {
    color: var(--admin-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
}

.admin-page-header {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.4rem;
}

.admin-page-header h1,
.admin-conversation__header h2,
.admin-panel h1 {
    letter-spacing: -0.04em;
    margin: 0;
}

.admin-page-header h1 {
    font-size: clamp(2rem, 4vw, 3.3rem);
}

.admin-page-header p,
.admin-conversation__header p,
.admin-panel p {
    color: var(--admin-muted);
    margin: 0.35rem 0 0;
}

.admin-eyebrow {
    color: var(--admin-orange-dark);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-panel {
    background: var(--admin-panel-bg);
    border: 1px solid var(--admin-line);
    border-radius: var(--admin-radius-lg);
    box-shadow: var(--admin-shadow);
}

.admin-support-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(280px, 0.36fr) minmax(0, 1fr);
}

.admin-thread-list {
    max-height: calc(100vh - 8rem);
    overflow: auto;
    padding: 0.75rem;
}

.admin-thread-row {
    border-radius: 20px;
    display: grid;
    gap: 0.28rem;
    padding: 0.95rem;
}

.admin-thread-row.is-active,
.admin-thread-row:hover {
    background: var(--admin-thread-active-bg);
}

.admin-thread-row__title {
    font-weight: 900;
}

.admin-thread-row__meta {
    color: var(--admin-muted);
    display: -webkit-box;
    font-size: 0.9rem;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-thread-row__time {
    color: var(--admin-thread-time);
    font-size: 0.78rem;
    font-weight: 800;
}

.admin-conversation {
    display: grid;
    grid-template-rows: auto minmax(360px, 1fr) auto;
    max-height: calc(100vh - 8rem);
    overflow: hidden;
}

.admin-conversation__header {
    align-items: center;
    border-bottom: 1px solid var(--admin-line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1.2rem 1.3rem;
}

.admin-message-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow: auto;
    padding: 1.2rem;
}

.admin-message-row {
    display: flex;
}

.admin-message-row--support {
    justify-content: flex-end;
}

.admin-message-bubble {
    background: var(--admin-message-bg);
    border: 1px solid var(--admin-line);
    border-radius: 22px;
    max-width: min(680px, 82%);
    padding: 0.95rem 1rem;
}

.admin-message-row--support .admin-message-bubble {
    background: var(--admin-message-support-bg);
    color: var(--admin-message-support-text);
}

.admin-message-bubble__author {
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.admin-message-bubble__text {
    line-height: 1.45;
}

.admin-message-bubble__subject {
    color: var(--admin-muted);
    font-size: 0.84rem;
    font-weight: 900;
    margin-bottom: 0.45rem;
}

.admin-message-row--support .admin-message-bubble__subject {
    color: var(--admin-message-support-muted);
}

.admin-message-bubble__time {
    color: var(--admin-muted);
    font-size: 0.76rem;
    font-weight: 800;
    margin-top: 0.55rem;
}

.admin-message-row--support .admin-message-bubble__time {
    color: var(--admin-message-support-muted);
}

.admin-reply-form {
    align-items: flex-end;
    background: var(--admin-reply-bg);
    border-top: 1px solid var(--admin-line);
    display: grid;
    gap: 0.8rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 1rem;
}

.admin-reply-actions {
    display: flex;
    justify-content: flex-end;
}

.admin-closed-notice {
    background: var(--admin-closed-bg);
    border-top: 1px solid var(--admin-line);
    color: var(--admin-muted);
    font-weight: 800;
    padding: 1rem;
    text-align: center;
}

.admin-form {
    display: grid;
    gap: 0.95rem;
}

.admin-form label {
    color: var(--admin-muted);
    display: grid;
    font-size: 0.82rem;
    font-weight: 900;
    gap: 0.4rem;
    letter-spacing: 0.04em;
}

.admin-form input,
.admin-reply-form textarea {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-line);
    border-radius: 16px;
    color: var(--admin-ink);
    outline: none;
    padding: 0.85rem 0.95rem;
    width: 100%;
}

.admin-form input::placeholder,
.admin-reply-form textarea::placeholder {
    color: color-mix(in srgb, var(--admin-muted) 76%, transparent);
}

.admin-form input:focus,
.admin-reply-form textarea:focus {
    border-color: rgba(233, 120, 51, 0.72);
    box-shadow: 0 0 0 4px var(--admin-focus-ring);
}

.admin-button {
    align-items: center;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    padding: 0.82rem 1.2rem;
}

.admin-button--primary {
    background: var(--admin-orange);
    color: var(--admin-primary-button-text);
}

.admin-button--primary:hover {
    background: var(--admin-orange-dark);
}

.admin-button--danger {
    background: var(--admin-danger-bg);
    color: var(--admin-danger);
}

.admin-button--danger:hover {
    background: var(--admin-danger-bg-hover);
}

.admin-button--ghost {
    background: var(--admin-ghost-bg);
    color: var(--admin-muted);
    width: 100%;
}

.admin-theme-toggle {
    align-items: center;
    background: var(--admin-ghost-bg);
    border: 0;
    border-radius: 999px;
    color: var(--admin-ink);
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    gap: 0.55rem;
    justify-content: center;
    padding: 0.82rem 1rem;
    width: 100%;
}

.admin-theme-toggle:hover,
.admin-theme-toggle:focus-visible {
    background: var(--admin-nav-active-bg);
    outline: none;
}

.admin-theme-toggle__icon {
    color: var(--admin-orange-dark);
}

.admin-account-panel {
    max-width: 620px;
    padding: 1.3rem;
}

.admin-error-panel {
    padding: 1.4rem;
}

.admin-error-details {
    background: var(--admin-error-bg);
    border: 1px solid var(--admin-error-border);
    border-radius: 16px;
    color: var(--admin-danger);
    margin: 1rem 0 0;
    overflow: auto;
    padding: 1rem;
    white-space: pre-wrap;
}

.admin-empty {
    align-items: center;
    color: var(--admin-muted);
    display: flex;
    min-height: 120px;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.admin-flash {
    border-radius: 18px;
    font-weight: 800;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
}

.admin-flash--success {
    background: var(--admin-success-bg);
    color: var(--admin-success-text);
}

.admin-flash--danger {
    background: var(--admin-danger-bg);
    color: var(--admin-danger);
}

.admin-feedback-list {
    display: grid;
    gap: 1rem;
}

.admin-feedback-card {
    display: grid;
    gap: 0.75rem;
}

.admin-feedback-card__meta {
    color: var(--admin-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-feedback-card__tags {
    background: var(--admin-bg-soft);
    border-radius: 999px;
    color: var(--admin-muted);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.45rem 0.75rem;
    width: fit-content;
}

.admin-feedback-status-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-feedback-status-form select {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-line);
    border-radius: 999px;
    color: var(--admin-ink);
    font-weight: 800;
    padding: 0.75rem 1rem;
}

.admin-feedback-status-form textarea {
    background: var(--admin-input-bg);
    border: 1px solid var(--admin-line);
    border-radius: 16px;
    color: var(--admin-ink);
    flex: 1 1 260px;
    padding: 0.75rem 0.9rem;
}

@media (max-width: 960px) {
    .admin-shell,
    .admin-support-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        left: 0;
        min-height: 100vh;
        opacity: 1;
        padding: 1.4rem;
        pointer-events: auto;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        width: min(320px, calc(100vw - 2rem));
    }

    body:not(.admin-menu-collapsed) .admin-sidebar {
        transform: translateX(0);
    }

    body:not(.admin-menu-collapsed) .admin-menu-backdrop {
        background: rgba(29, 24, 18, 0.36);
        backdrop-filter: blur(4px);
        display: block;
        inset: 0;
        position: fixed;
        z-index: 1035;
    }

    body.admin-menu-collapsed .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-main {
        padding: 5rem 1rem 1rem;
    }

    .admin-conversation,
    .admin-thread-list {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .admin-reply-form {
        grid-template-columns: 1fr;
    }

    .admin-message-bubble {
        max-width: 94%;
    }
}
