:root {
    --ink: #101812;
    --graphite: #202721;
    --pine: #0b3427;
    --emerald: #1f7a50;
    --mint: #e6f2ea;
    --porcelain: #f8f7f1;
    --ivory: #fffcf5;
    --gold: #d2a64a;
    --copper: #b8733b;
    --sky: #bfe2f2;
    --rose: #f1d9ce;
    --border: #e3e5db;
    --muted: #68756d;
}

body {
    background:
        radial-gradient(circle at 78% 8%, rgba(210, 166, 74, 0.13), transparent 26%),
        linear-gradient(135deg, var(--porcelain), #eef5ef 56%, #f6f0e9);
    color: var(--graphite);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

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

.admin-sidebar {
    background:
        linear-gradient(165deg, rgba(255, 255, 255, 0.04), transparent 38%),
        linear-gradient(145deg, var(--ink), var(--pine) 64%, #174c38);
    color: #fff;
    padding: 24px 16px;
    position: relative;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    width: 280px;
}

.admin-sidebar::after {
    background: linear-gradient(180deg, transparent, rgba(210, 166, 74, 0.16), transparent);
    content: "";
    inset: 0 0 0 auto;
    position: absolute;
    width: 1px;
}

.brand {
    align-items: center;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.brand-lockup {
    display: block;
    height: 132px;
    object-fit: contain;
    width: 132px;
}

.admin-sidebar .nav-link {
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 700;
    margin-bottom: 5px;
    padding: 10px 12px;
}

.admin-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(210, 166, 74, 0.18);
    color: #fff;
}

.admin-sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(210, 166, 74, 0.28), rgba(31, 122, 80, 0.34));
    border-color: rgba(210, 166, 74, 0.46);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
    color: #fff;
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-topbar {
    align-items: center;
    backdrop-filter: blur(18px);
    background: rgba(255, 252, 245, 0.9);
    border-bottom: 1px solid rgba(227, 229, 219, 0.86);
    display: flex;
    justify-content: space-between;
    padding: 22px 30px;
}

.admin-topbar h1 {
    color: var(--ink);
    font-size: 26px;
    font-weight: 900;
    line-height: 1.05;
    margin: 0;
}

.admin-topbar p {
    color: var(--muted);
    font-weight: 600;
    margin: 5px 0 0;
}

.admin-user {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(16, 24, 18, 0.06);
    min-width: 154px;
    padding: 9px 12px;
    text-align: right;
}

.admin-user span {
    color: var(--ink);
    display: block;
    font-weight: 800;
}

.admin-user small {
    color: var(--gold);
    display: block;
    font-size: 11px;
    font-weight: 800;
}

.admin-logout {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
    padding: 0;
}

.admin-logout:hover {
    color: #9a2f2f;
}

.admin-content {
    padding: 30px;
}

.content-panel,
.login-panel,
.metric-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(16, 24, 18, 0.06);
    padding: 22px;
}

.login-panel {
    margin: 76px auto;
    max-width: 440px;
}

.login-panel h2 {
    color: var(--ink);
    font-weight: 900;
    margin-bottom: 20px;
}

.metric-card {
    min-height: 118px;
    overflow: hidden;
    position: relative;
}

.metric-card::before {
    background: linear-gradient(135deg, rgba(210, 166, 74, 0.22), rgba(31, 122, 80, 0.12));
    content: "";
    height: 88px;
    position: absolute;
    right: -34px;
    top: -36px;
    transform: rotate(18deg);
    width: 112px;
}

.metric-card span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 800;
}

.metric-card strong {
    color: var(--ink);
    display: block;
    font-size: 31px;
    font-weight: 900;
    margin-top: 10px;
}

.panel-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.panel-head.compact {
    align-items: flex-start;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.content-page-item {
    align-items: center;
    background: var(--ivory);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px;
    text-align: left;
    width: 100%;
}

.content-page-item.active {
    background: rgba(13, 74, 54, 0.7);
    border-color: var(--gold);
}

.content-page-item span:first-child {
    display: grid;
    gap: 3px;
}

.content-page-item small {
    color: var(--muted);
}

.content-editor {
    line-height: 1.55;
    min-height: 440px;
    resize: vertical;
}

.support-chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 620px;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid rgba(216, 168, 74, 0.25);
    border-radius: 14px;
    background: rgba(5, 6, 6, 0.72);
}

.support-message {
    width: min(82%, 680px);
    padding: 12px 14px;
    border: 1px solid rgba(216, 168, 74, 0.28);
    border-radius: 14px;
    background: #151816;
}

.support-message.admin {
    align-self: flex-end;
    background: linear-gradient(145deg, #0b4a36, #063b2b);
    border-color: rgba(242, 200, 121, 0.5);
}

.support-message.user {
    align-self: flex-start;
}

.support-message-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    color: #f2c879;
}

.support-message-head small {
    color: #8e8e8e;
}

.support-message-text {
    white-space: normal;
    overflow-wrap: anywhere;
}

.support-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.support-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    padding: 7px;
    border: 1px solid rgba(216, 168, 74, 0.3);
    border-radius: 10px;
    color: #f4e7c4;
    text-decoration: none;
}

.support-attachment:hover {
    color: #f2c879;
    border-color: rgba(242, 200, 121, 0.72);
}

.support-attachment.image img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 7px;
}

.support-attachment span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-file-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #063b2b;
    color: #f2c879;
    font-size: 11px;
    font-weight: 900;
}

.category-asset-preview {
    align-items: center;
    background: var(--ivory);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--muted);
    display: flex;
    height: 74px;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}

.category-asset-preview img {
    height: 64px;
    object-fit: contain;
    width: 64px;
}

.category-thumb {
    object-fit: contain;
}

.city-checkbox-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.city-checkbox {
    align-items: center;
    background: var(--ivory);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    gap: 8px;
    padding: 10px 12px;
}

.city-checkbox > span {
    flex: 1;
    min-width: 0;
}

.city-checkbox > .form-control {
    flex: 0 0 88px;
    text-align: center;
    width: 88px;
}

.panel-head h2,
.content-panel h2 {
    color: var(--ink);
    font-size: 23px;
    font-weight: 900;
    margin-bottom: 6px;
}

.panel-head p,
.content-panel p {
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0;
}

.empty-state {
    background: linear-gradient(135deg, rgba(230, 242, 234, 0.72), rgba(255, 252, 245, 0.9));
    border: 1px dashed rgba(210, 166, 74, 0.45);
    border-radius: 8px;
    color: var(--muted);
    margin-top: 18px;
    padding: 18px;
}

.image-upload {
    background: rgba(230, 242, 234, 0.5);
    border: 1px dashed rgba(31, 122, 80, 0.42);
    border-radius: 8px;
    padding: 14px;
}

.image-preview-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.image-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.image-card.primary {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(210, 166, 74, 0.14);
}

.image-card.pending {
    opacity: 0.84;
}

.image-card img {
    aspect-ratio: 1 / 1;
    background: var(--porcelain);
    display: block;
    object-fit: contain;
    width: 100%;
}

.image-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
    padding: 9px;
}

.image-file-name {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    padding: 8px 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-thumb {
    align-items: center;
    background: var(--porcelain);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    height: 52px;
    justify-content: center;
    object-fit: contain;
    width: 52px;
}

.table-thumb.placeholder {
    color: var(--muted);
    font-size: 9px;
    text-align: center;
}

.stack-list {
    display: grid;
    gap: 9px;
}

.stack-list-item {
    align-items: center;
    background: rgba(255, 252, 245, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 11px 12px;
}

.stack-list-item strong,
.stack-list-item small {
    display: block;
}

.stack-list-item small {
    color: var(--muted);
    margin-top: 2px;
}

.stock-value {
    align-items: center;
    background: #f3e4df;
    border-radius: 999px;
    color: #9a2f2f;
    display: inline-flex;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    min-width: 34px;
    padding: 0 10px;
}

.admin-form {
    background: rgba(255, 252, 245, 0.78);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.form-control,
.form-select {
    background-color: #fff;
    border-color: var(--border);
    border-radius: 8px;
    color: var(--graphite);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(210, 166, 74, 0.16);
}

.form-label,
.form-check-label,
label {
    color: var(--graphite);
    font-weight: 700;
}

.btn {
    border-radius: 8px;
    font-weight: 800;
}

.btn-success,
.btn-outline-success:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.btn-success:hover {
    background: var(--pine);
    border-color: var(--pine);
}

.btn-outline-success {
    border-color: var(--gold);
    color: var(--pine);
}

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--graphite);
}

.btn-outline-secondary:hover {
    background: var(--mint);
    border-color: var(--emerald);
    color: var(--pine);
}

.admin-table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(230, 242, 234, 0.42);
}

.admin-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.admin-table td {
    color: var(--graphite);
    font-size: 14px;
    vertical-align: middle;
}

.table-responsive {
    border: 1px solid var(--border);
    border-radius: 8px;
}

.panel-subtitle {
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
    margin: 0 0 12px;
}

.info-list {
    background: rgba(255, 252, 245, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

.info-list dl {
    display: grid;
    gap: 8px 14px;
    grid-template-columns: 140px 1fr;
    margin: 0;
}

.info-list dt {
    color: var(--muted);
    font-weight: 900;
}

.info-list dd {
    margin: 0;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 900;
    padding: 5px 9px;
}

.status-pill.on {
    background: var(--mint);
    color: var(--emerald);
}

.status-pill.off {
    background: #f3e4df;
    color: #9a2f2f;
}

.status-pill.wait {
    background: #fff1c9;
    color: #7c5b09;
}

@media (max-width: 900px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        height: auto;
        overflow: visible;
        padding: 12px;
        position: relative;
        width: 100%;
    }

    .brand {
        justify-content: flex-start;
        margin-bottom: 10px;
    }

    .brand-lockup {
        height: 56px;
        width: 110px;
    }

    .admin-sidebar .nav {
        flex-direction: row !important;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .admin-sidebar .nav-link {
        flex: 0 0 auto;
        margin: 0;
        white-space: nowrap;
    }

    .admin-topbar {
        align-items: flex-start;
        display: block;
        padding: 18px 16px;
    }

    .admin-user {
        margin-top: 14px;
        text-align: left;
    }

    .admin-content {
        padding: 16px;
    }

    .content-panel,
    .login-panel,
    .metric-card {
        padding: 16px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-head > .btn,
    .panel-head > a.btn {
        width: 100%;
    }
}

@media print {
    .admin-sidebar,
    .admin-topbar,
    .admin-form,
    .btn {
        display: none !important;
    }

    .admin-content {
        padding: 0;
    }

    .content-panel {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    #orders-page,
    #order-details-panel .order-management-controls {
        display: none !important;
    }

    #order-details-panel {
        display: block !important;
    }
}
