:root {
    --bg: #f4efe6;
    --bg-accent: #e9dfd1;
    --panel: #ffffff;
    --text: #1d1c1a;
    --muted: #6f6a61;
    --sidebar: #101b1d;
    --sidebar-ink: #f4f0ea;
    --accent: #e07b47;
    --accent-strong: #cc6531;
    --ring: rgba(224, 123, 71, 0.35);
    --border: #e2d7c6;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.admin-body {
    background: radial-gradient(1200px 600px at 10% -10%, #f7efe1 0%, var(--bg) 55%, #edf1f2 100%);
    min-height: 100vh;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 270px;
    padding: 28px 24px;
    background: linear-gradient(165deg, #172629 0%, #0f181a 70%);
    color: var(--sidebar-ink);
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #f2c08d;
    color: #1b1b1b;
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    font-weight: 700;
    display: grid;
    place-items: center;
    font-size: 20px;
}

.brand-title {
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    font-weight: 600;
    font-size: 18px;
}

.brand-sub {
    font-size: 12px;
    color: rgba(244, 240, 234, 0.7);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-link {
    text-decoration: none;
    color: inherit;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.nav-link.is-active {
    background: rgba(224, 123, 71, 0.25);
    color: #ffffff;
    border: 1px solid rgba(224, 123, 71, 0.35);
}

.logout-form {
    margin-top: auto;
}

.nav-logout {
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.admin-main {
    flex: 1;
    padding: 32px 40px 48px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-title {
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    font-weight: 600;
    font-size: 26px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 14px;
}

.topbar-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.meta-pill {
    background: #fff4ea;
    color: var(--accent-strong);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(224, 123, 71, 0.3);
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    color: var(--muted);
    margin: 0 0 8px;
}

.hero-title {
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    font-size: 38px;
    margin: 0 0 10px;
}

.hero-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.hero-card {
    background: linear-gradient(135deg, #fff1e4 0%, #ffe5cf 100%);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(224, 123, 71, 0.3);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hero-card-title {
    font-weight: 600;
}

.hero-card-text {
    margin: 0;
    color: #7a5a45;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.panel {
    background: var(--panel);
    border-radius: 20px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(24, 23, 20, 0.08);
    animation: fadeUp 0.5s ease both;
}

.panel:nth-child(2) {
    animation-delay: 0.06s;
}

.panel:nth-child(3) {
    animation-delay: 0.12s;
}

.panel-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 10px;
}

.panel-value {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
}

.panel-note {
    color: var(--muted);
    font-size: 13px;
}

.panel-link {
    display: inline-flex;
    margin-top: 14px;
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.panel-link:hover {
    color: #b55023;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.muted {
    color: var(--muted);
}

.ghost-button {
    background: transparent;
    border: 1px dashed rgba(29, 28, 26, 0.2);
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ghost-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.wide-panel {
    animation-delay: 0.18s;
}

.empty-state {
    display: flex;
    gap: 16px;
    align-items: center;
    background: #faf7f1;
    border-radius: 16px;
    padding: 18px;
    border: 1px dashed rgba(29, 28, 26, 0.1);
}

.empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #f4dec8;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #8a5a37;
}

.empty-title {
    font-weight: 600;
}

.empty-text {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.status-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: #fff8ef;
    color: #6f4f39;
}

.status-banner.success {
    background: #eef8f1;
    border-color: #cfe7d5;
    color: #2f6b3f;
}

.status-banner.error {
    background: #fff3f0;
    border-color: #f2c7be;
    color: #9b3a2b;
}

.table-wrapper {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: auto;
    background: #fffdf9;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(29, 28, 26, 0.08);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    background: #fbf6ef;
}

.data-table tbody tr:hover {
    background: #fdf7ef;
}

.mono {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
}

.stacked {
    display: grid;
    gap: 4px;
}

.stacked-title {
    font-weight: 600;
}

.stacked-sub {
    font-size: 12px;
    color: var(--muted);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.action-link {
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.action-link:hover {
    color: #b55023;
}

.secondary-button {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-button:hover {
    border-color: rgba(29, 28, 26, 0.2);
}

.danger-button {
    background: #f4d6d0;
    color: #8c2e22;
    border: 1px solid #e5b9b0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.danger-button:hover {
    background: #f0c2ba;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.info-card {
    background: #faf7f1;
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px dashed rgba(29, 28, 26, 0.12);
}

.info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.info-value {
    margin-top: 6px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.form-full {
    grid-column: 1 / -1;
}

.field textarea {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    min-height: 140px;
    resize: vertical;
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.danger-zone {
    margin-top: 20px;
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(178, 64, 45, 0.4);
    background: #fff6f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.chat-shell {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.chat-log {
    background: #fbf7f0;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 18px 0;
}

.chat-message {
    display: flex;
}

.chat-message--user {
    justify-content: flex-end;
}

.chat-message--bot {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(29, 28, 26, 0.08);
    box-shadow: 0 6px 16px rgba(24, 23, 20, 0.08);
    font-size: 14px;
    line-height: 1.4;
}

.chat-message--user .chat-bubble {
    background: #fff4ea;
    border-color: rgba(224, 123, 71, 0.35);
}

.chat-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
}

.danger-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-body {
    background: radial-gradient(1200px 600px at 90% 0%, #fce8d6 0%, #f4efe6 45%, #eef1f2 100%);
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 32px;
    padding: 48px clamp(24px, 6vw, 80px);
    align-items: center;
}

.auth-card {
    background: var(--panel);
    border-radius: 24px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 50px rgba(24, 23, 20, 0.12);
    animation: fadeUp 0.5s ease both;
}

.auth-header h1 {
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    margin: 12px 0 6px;
    font-size: 30px;
}

.auth-header p {
    margin: 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    background: #ffe7d2;
    color: #b15326;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.field {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.field input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

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

.primary-button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(224, 123, 71, 0.3);
}

.validation-summary {
    background: #fff3f0;
    border: 1px solid #f2c7be;
    padding: 10px 12px;
    border-radius: 12px;
    color: #9b3a2b;
    font-size: 13px;
}

.field-error {
    color: #b2412d;
    font-size: 12px;
}

.callout {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fef3e5;
    border: 1px solid rgba(224, 123, 71, 0.3);
    font-size: 13px;
    color: #8b5532;
}

.auth-side {
    display: grid;
    gap: 18px;
}

.auth-side-card {
    background: linear-gradient(160deg, #1c2a2d 0%, #131a1c 100%);
    color: #f4f0ea;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 22px 40px rgba(15, 18, 18, 0.28);
    animation: fadeUp 0.6s ease both;
}

.auth-side-card h2 {
    font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
    margin-top: 0;
}

.auth-side-card ul {
    margin: 16px 0 0;
    padding-left: 20px;
    color: rgba(244, 240, 234, 0.8);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 1024px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 18px;
    }

    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .logout-form {
        margin-top: 0;
        width: auto;
    }

    .admin-main {
        padding: 24px;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .admin-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .danger-zone {
        flex-direction: column;
        align-items: flex-start;
    }
}
