body {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 300px;
    padding: 28px 0;
    border-right: 1px solid var(--border);
    background: rgba(14, 14, 19, 0.96);
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: block;
    margin-bottom: 26px;
    text-align: center;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.sidebar-logo span {
    color: var(--primary);
}

.profile-section {
    padding: 0 22px;
    margin-bottom: 28px;
}

.profile-card,
.form-card,
.table-wrap,
.chat-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.profile-card {
    padding: 18px;
    text-align: center;
}

.profile-img-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 0 auto 12px;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(255, 42, 133, 0.4);
}

.status-online {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid #0d0d11;
}

.profile-name {
    display: block;
    font-weight: 800;
}

.profile-rank {
    color: var(--primary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0 14px;
    flex: 1;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 8px;
    border-radius: 14px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 700;
}

.nav-menu a.active,
.nav-menu a:hover {
    background: rgba(255, 42, 133, 0.12);
    color: white;
}

.logout-wrap {
    padding: 20px;
}

.logout-wrap button {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 77, 109, 0.24);
    background: rgba(255, 77, 109, 0.08);
    color: white;
    cursor: pointer;
    font-weight: 700;
}

.main-content {
    flex: 1;
    padding: 34px;
    overflow: auto;
    min-height: 100vh;
}

.section-header {
    margin-bottom: 26px;
}

.section-header h2 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.05em;
}

.section-header p {
    margin: 0;
    color: var(--text-dim);
}

.panel-section {
    display: none;
}

.panel-section.active {
    display: block;
}

.form-card {
    padding: 28px;
    margin-bottom: 24px;
}

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

.offer-assets-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.asset-group {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.asset-group .file-stack,
.asset-group .file-cache,
.asset-group .gallery-cache {
    flex: 1;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0c0c11;
    color: white;
}

.input-group select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #d9d9e5 50%),
        linear-gradient(135deg, #d9d9e5 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 4px),
        calc(100% - 14px) calc(50% - 4px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.btn-submit,
.btn-mini,
.btn-send {
    cursor: pointer;
    border: none;
}

.btn-submit {
    padding: 15px 24px;
    border-radius: 14px;
    background: var(--gradient);
    color: white;
    font-weight: 800;
}

.btn-mini {
    padding: 7px 10px;
    border-radius: 10px;
    color: white;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
}

.icon-btn-edit:hover {
    border-color: rgba(255, 42, 133, 0.45);
    background: rgba(255, 42, 133, 0.12);
}

.icon-btn-delete:hover {
    border-color: rgba(255, 77, 109, 0.45);
    background: rgba(255, 77, 109, 0.12);
}

.table-wrap {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
}

th {
    color: var(--text-dim);
    font-size: 0.76rem;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 42, 133, 0.12);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 700;
    margin: 2px 6px 2px 0;
}

.empty-state,
.empty-table {
    padding: 24px;
    text-align: center;
    color: var(--text-dim);
}

.chat-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: min(1000px, calc(100vh - 180px));
    min-height: 520px;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 42, 133, 0.75) rgba(255, 255, 255, 0.06);
}

.chat-messages::-webkit-scrollbar {
    width: 12px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-thumb {
    border: 2px solid rgba(12, 12, 17, 0.9);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 42, 133, 0.95), rgba(156, 61, 255, 0.95));
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 42, 133, 1), rgba(156, 61, 255, 1));
}

.msg {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    max-width: min(760px, 100%);
    width: auto;
}

.msg.me {
    align-self: flex-end;
}

.msg-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #101015;
}

.msg-body {
    display: grid;
    gap: 6px;
}

.msg-info {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    background: #23232d;
    line-height: 1.6;
}

.msg.me .msg-bubble {
    background: var(--gradient);
}

.msg-role {
    display: inline-flex;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 42, 133, 0.12);
    color: var(--primary);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-input-bar {
    display: flex;
    gap: 12px;
    padding: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-bar input {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0c0c11;
    color: white;
}

.btn-send {
    width: 52px;
    border-radius: 14px;
    background: var(--gradient);
    color: white;
}

#login-screen {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
}

.admin-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(10px);
    z-index: 14000;
    overflow-y: auto;
}

.admin-modal.is-open {
    display: flex;
}

.modal-card {
    position: relative;
    width: min(1180px, calc(100vw - 36px));
    padding: 34px 36px;
    border-radius: 28px;
    border: 1px solid rgba(255, 42, 133, 0.2);
    background: rgba(15, 15, 20, 0.97);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    margin: auto;
}

#product-edit-modal .modal-card {
    width: min(1260px, calc(100vw - 28px));
}

#product-edit-modal .input-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 20px 18px;
}

#product-edit-modal .file-cache {
    min-height: 74px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: white;
    cursor: pointer;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.login-box {
    width: min(420px, 100%);
    padding: 34px;
    border-radius: 28px;
    border: 1px solid rgba(255, 42, 133, 0.22);
    background: rgba(15, 15, 20, 0.96);
    transform: translateY(-4vh);
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 22px;
    font-size: 2.2rem;
}

.login-back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
}

.login-back-link:hover {
    color: white;
    transform: translateX(-2px);
}

.login-box span {
    color: var(--primary);
}

.smart-select {
    position: relative;
}

.smart-select-input {
    padding-right: 54px !important;
}

.smart-select-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.smart-select-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.smart-select.is-open .smart-select-toggle {
    transform: translateY(-50%) rotate(180deg);
}

.smart-select-list {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    display: none;
    max-height: 240px;
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(14, 14, 19, 0.98);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
    z-index: 30;
}

.smart-select.is-open .smart-select-list {
    display: grid;
    gap: 6px;
}

.smart-select-option,
.smart-select-empty {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: white;
    text-align: left;
}

.smart-select-option {
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.smart-select-option:hover,
.smart-select-option.is-active {
    background: rgba(255, 42, 133, 0.12);
    color: white;
}

.smart-select-empty {
    color: var(--text-dim);
    cursor: default;
}

.table-preview {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 10px;
}

.table-preview-empty {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
}

.helper-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.helper-btn {
    background: rgba(255, 255, 255, 0.06);
}

.helper-text {
    display: block;
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.6;
}

.file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 42, 133, 0.34);
    background: rgba(255, 42, 133, 0.06);
    color: white;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.file-picker:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 42, 133, 0.58);
    background: rgba(255, 42, 133, 0.1);
}

.file-picker i {
    color: var(--primary);
}

.file-stack {
    display: grid;
    gap: 14px;
}

.file-cache {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 54px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.gallery-cache {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 84px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.file-cache-empty {
    color: var(--text-dim);
    font-size: 0.92rem;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.file-chip.deleted {
    opacity: 0.55;
    border-style: dashed;
}

.file-chip button {
    border: none;
    background: transparent;
    color: #ff8da6;
    cursor: pointer;
    font-size: 0.9rem;
}

.gallery-chip {
    position: relative;
    width: 108px;
    height: 108px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.gallery-chip.deleted {
    opacity: 0.5;
    border-style: dashed;
}

.gallery-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-chip button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: rgba(13, 13, 18, 0.88);
    color: #ff8da6;
    cursor: pointer;
}

#offer-img-prev,
#product-img-prev {
    display: none;
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 42, 133, 0.28);
    margin-top: 12px;
}

#edit-img-prev {
    display: none;
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 42, 133, 0.28);
}

.preview-empty {
    width: 110px;
    height: 110px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
}

@media (max-width: 980px) {
    body {
        display: block;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

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

    .offer-assets-grid {
        grid-template-columns: 1fr;
    }

    #product-edit-modal .input-grid {
        grid-template-columns: 1fr;
    }

    .msg {
        max-width: 100%;
    }

    .login-box {
        transform: none;
    }

    .chat-container {
        height: min(1000px, calc(100vh - 120px));
    }
}
