/* Cosmic Sanguinem Admin Theme */
:root {
    --bg-dark: #050505;
    /* void-black */
    --bg-sidebar: #0a0101;
    /* Very dark red/black */
    --bg-card: #1a0505;
    /* card-bg */
    --bg-hover: #3a0000;
    /* blood-dark */

    --text-primary: #e0e0e0;
    /* text-white */
    --text-secondary: #888888;
    /* text-muted */

    --accent-primary: #ff3333;
    /* blood-bright */
    --accent-secondary: #8a0303;
    /* blood-red */

    --border-color: #440000;
    /* dark-border */
    --danger: #cf0000;

    --font-heading: 'Metal Mania', cursive;
    --font-body: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    /* Cosmic Background */
    background-image:
        radial-gradient(circle at 80% 20%, rgba(138, 3, 3, 0.15), transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(50, 0, 0, 0.2), transparent 40%) !important;
}

.admin-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    height: 100vh;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.brand img {
    height: 32px;
    filter: drop-shadow(0 0 5px var(--accent-primary));
}

.brand h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--accent-primary);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(138, 3, 3, 0.5);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.85rem;
    padding: 0.8rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(58, 0, 0, 0.3);
    border-color: rgba(138, 3, 3, 0.3);
}

.nav-item.active {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--accent-secondary);
    box-shadow: 0 0 15px rgba(138, 3, 3, 0.2);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active svg {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 5px var(--accent-primary));
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    padding: 2rem;
    background: transparent;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    gap: 1rem;
}

/* Hamburger hidden on desktop; shown via media query below */
#adminNavToggle {
    display: none;
    flex-shrink: 0;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-heading);
    color: var(--accent-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-hover);
    border: 1px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.2);
}

/* CARDS */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Single-column settings layout (page-based organization) */
#settingsForm > div[style*="max-width"] {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Settings section headers */
.dashboard-card h3 {
    margin-top: 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    border-bottom: 1px solid var(--bg-hover);
    padding-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Enhanced section headers for page-based layout */
.dashboard-card h3[style*="border-bottom: 2px"] {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

/* Subsection headers (Content, Image, Typography, Colors) */
h4[style*="border-left: 3px"] {
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1rem;
}

.dashboard-card,
.work-item-card {
    /* Reuse logic if any */
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Glass/Blood effect for cards */
.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

.dashboard-card h3 {
    margin-top: 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    border-bottom: 1px solid var(--bg-hover);
    padding-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* BUTTONS */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    font-size: 0.85rem;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--accent-secondary);
    color: var(--text-primary);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.3);
}

.btn-primary:hover {
    background: var(--accent-primary);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
}

/* Work Item Row Styling */
.work-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: background 0.3s ease;
}

.work-item-row:hover {
    background: var(--bg-hover);
}

.work-item-row .work-title {
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    flex: 1;
}

.work-item-row .actions {
    display: flex;
    gap: 0.5rem;
}

.work-item-row .action-btn {
    min-width: 80px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Comment Filter Buttons */
.comment-filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.comment-filter-tabs button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-filter-tabs button:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: rgba(138, 3, 3, 0.1);
}

.comment-filter-tabs button.active {
    background: rgba(138, 3, 3, 0.2);
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* FORM ELEMENTS */
input,
select,
textarea {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: 4px;
    font-family: var(--font-body);
}

/* Enhanced Select Dropdown Styling - Cosmic Sanguinem Theme */
select {
    background: linear-gradient(135deg, rgba(10, 1, 1, 0.95), rgba(26, 5, 5, 0.95));
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff3333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
}

select:hover {
    border-color: var(--accent-secondary);
    background: linear-gradient(135deg, rgba(26, 5, 5, 0.98), rgba(58, 0, 0, 0.98));
    box-shadow: 0 0 8px rgba(138, 3, 3, 0.3);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.4), 0 0 5px rgba(255, 51, 51, 0.2);
    background: linear-gradient(135deg, rgba(26, 5, 5, 0.98), rgba(58, 0, 0, 0.98));
}

/* Works Search Input */
#worksSearchInput {
    transition: all 0.3s ease;
}

#worksSearchInput:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.3);
}

#worksSearchInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Select option styling (for browsers that support it) */
select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.75rem;
    border: none;
}

select option:hover,
select option:focus {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

select option:checked {
    background: rgba(138, 3, 3, 0.4);
    color: var(--accent-primary);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 30px rgba(138, 3, 3, 0.5);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    color: var(--accent-primary);
}

.close {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: color 0.3s;
}

.close:hover {
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Sidebar: slide-out drawer on mobile */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        width: 240px;
        z-index: 500;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        left: 0;
    }

    /* Main content full width on mobile */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 1rem;
    }

    /* Top bar: hamburger visible */
    .top-bar {
        padding: 0.75rem 1rem;
    }

    .page-title {
        font-size: 1.2rem;
    }
}

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

    .top-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .comment-filter-tabs {
        flex-wrap: wrap;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* UTILITIES */
.mt-auto {
    margin-top: auto;
}

#logoutBtn {
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    #logoutBtn {
        margin-bottom: 3.5rem;
        margin-top: 1rem;
    }
}

.text-danger {
    color: #ef4444;
}

.mr-1 {
    margin-right: 1rem;
}

.m-0 {
    margin: 0;
}

.mt-0 {
    margin-top: 0;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.relative {
    position: relative;
}

.pt-20px {
    padding-top: 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-end-around {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
}

.text-sm {
    font-size: 0.85rem;
}

.text-blue {
    color: #3B82F6;
}

.cursor-pointer {
    cursor: pointer;
}

.bg-map-placeholder {
    background: #262933;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.logo-rotation {
    color: var(--accent-primary);
    transform: rotate(-20deg);
}

.border-bottom-light {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.section-title {
    margin: 0;
    color: var(--accent-primary);
}

.section-title-text {
    margin: 0;
    color: var(--text-primary);
}

.dropdown-width {
    width: 180px;
}

.trigger-style {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.icon-margin {
    margin-left: auto;
}

.flex-align-center {
    display: flex;
    align-items: center;
}

/* Element specific */
.resize-v {
    resize: vertical;
}

.mt-05 {
    margin-top: 0.5rem !important;
}

.ml-05 {
    margin-left: 0.5rem !important;
}

.mt-1 {
    margin-top: 1rem !important;
}

.preview-container {
    position: relative;
    display: inline-block;
}

.preview-img {
    max-width: 500px;
    max-height: 400px;
    border-radius: 4px;
    display: block;
}

.preview-header {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.preview-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.form-actions-flex {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.btn-save-settings {
    padding: 0.85rem 3rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 4px 12px rgba(255, 51, 51, 0.4), 0 0 20px rgba(138, 3, 3, 0.3);
    transition: all 0.3s ease;
}

.btn-save-settings:hover {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    box-shadow: 0 6px 20px rgba(255, 51, 51, 0.6), 0 0 30px rgba(255, 51, 51, 0.4);
    transform: translateY(-2px);
}

.btn-save-settings:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 51, 51, 0.4);
}

/* ================================================
   SETTINGS TAB – COSMIC SANGUINEM BRANDING
   ================================================ */

/* ── Sub-tab navigation bar ── */
.settings-subtab-bar {
    display: flex;
    gap: 0.35rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.settings-subtab-bar::-webkit-scrollbar { display: none; }

/* ── Individual sub-tab button ── */
.stab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.stab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.stab-btn:hover {
    color: var(--text-primary);
    background: rgba(138, 3, 3, 0.15);
    border-color: rgba(138, 3, 3, 0.35);
}

.stab-btn.active {
    color: var(--accent-primary);
    background: rgba(138, 3, 3, 0.22);
    border-color: var(--accent-secondary);
    box-shadow: 0 0 12px rgba(138, 3, 3, 0.25), inset 0 0 8px rgba(138, 3, 3, 0.08);
}

.stab-btn.active::after {
    width: 70%;
}

.stab-icon {
    font-size: 0.95rem;
    line-height: 1;
    filter: drop-shadow(0 0 3px rgba(255, 51, 51, 0));
    transition: filter 0.25s ease;
}

.stab-btn.active .stab-icon {
    filter: drop-shadow(0 0 4px rgba(255, 51, 51, 0.5));
}

.stab-label { line-height: 1; }

/* ── Sub-tab panels container ── */
.settings-subtab-panels {
    padding: 1.75rem;
    background: rgba(5, 5, 5, 0.55);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* ── Show only active panel ── */
.stab-panel {
    display: none;
}
.stab-panel.active {
    display: block;
    animation: stabFadeIn 0.2s ease forwards;
}

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

/* ── Section cards ── */
.settings-section-card {
    background: linear-gradient(145deg, rgba(26, 5, 5, 0.9), rgba(10, 1, 1, 0.85));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.settings-section-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0%, transparent 60%);
    pointer-events: none;
}

.settings-section-card:hover {
    border-color: rgba(138, 3, 3, 0.55);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 18px rgba(138, 3, 3, 0.1);
}

/* ── Section heading ── */
.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-primary);
    margin-bottom: 1.35rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(68, 0, 0, 0.7);
    position: relative;
}

.settings-section-heading::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 1px;
    background: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary);
}

.settings-section-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ── Form groups inside settings ── */
.settings-section-card .form-group {
    margin-bottom: 1.25rem;
}

.settings-section-card .form-group:last-child {
    margin-bottom: 0;
}

.settings-section-card label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
}

.settings-section-card input[type="text"],
.settings-section-card input[type="url"],
.settings-section-card input[type="email"],
.settings-section-card textarea,
.settings-section-card select {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.settings-section-card input:focus,
.settings-section-card textarea:focus,
.settings-section-card select:focus {
    border-color: var(--accent-primary);
    background: rgba(26, 5, 5, 0.85);
    box-shadow: 0 0 0 3px rgba(255, 51, 51, 0.12), 0 0 15px rgba(255, 51, 51, 0.25);
    outline: none;
}

.settings-section-card textarea {
    resize: vertical;
    min-height: 100px;
}

.settings-section-card small {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Image upload / action button row ── */
.settings-btn-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

/* ── Image preview container ── */
.settings-section-card .preview-container {
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    margin-top: 0.75rem;
}

.settings-section-card .preview-container img {
    display: block;
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.3);
}

/* ── Save row ── */
.settings-save-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* ── Loading overlay ── */
.settings-loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 2.5rem;
    background: rgba(5, 5, 5, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.25rem;
}

.settings-loading-overlay span {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    animation: settingsPulse 1.5s ease-in-out infinite;
}

@keyframes settingsPulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}

/* ── Inline field validation error ── */
.settings-field-error {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #ff6666;
    font-family: var(--font-body);
}

/* ── Social media list (stab-social) ── */
#socialMediaList .social-media-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: border-color 0.25s ease;
}

#socialMediaList .social-media-item:hover {
    border-color: rgba(138, 3, 3, 0.5);
}

#socialMediaList .social-media-item input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

#socialMediaList .social-media-item input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

/* ── Users list (stab-account) ── */
#usersList .user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: border-color 0.25s ease, background 0.25s ease;
}

#usersList .user-row:hover {
    background: rgba(26, 5, 5, 0.6);
    border-color: rgba(138, 3, 3, 0.45);
}

/* ── Subscribers table (stab-subscribers) ── */
.subscribers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.subscribers-table th,
.subscribers-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(138, 3, 3, 0.2);
}

.subscribers-table thead th {
    color: var(--blood-bright);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(138, 3, 3, 0.45);
}

.subscribers-table tbody tr:hover {
    background: rgba(138, 3, 3, 0.06);
}

.btn-icon-danger {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
    color: inherit;
}

.btn-icon-danger:hover {
    opacity: 1;
    background: rgba(255, 59, 59, 0.12);
}

/* ── Storage tab panel ── */
#stab-storage .settings-section-card {
    margin-bottom: 1.25rem;
}

/* ── Responsive adjustments ── */
@media (max-width: 768px) {
    .settings-subtab-bar {
        padding: 0.4rem 0.5rem;
        gap: 0.25rem;
        border-radius: 6px 6px 0 0;
    }

    .stab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.76rem;
        letter-spacing: 0.3px;
    }

    .stab-icon {
        font-size: 0.88rem;
    }

    .settings-subtab-panels {
        padding: 1.1rem;
    }

    .settings-section-card {
        padding: 1.1rem;
        margin-bottom: 1rem;
    }

    .settings-save-row {
        justify-content: stretch;
    }

    .settings-save-row .btn-save-settings {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stab-label { display: none; }
    .stab-btn { padding: 0.6rem 0.85rem; }
    .stab-icon { font-size: 1.05rem; }

    .settings-section-heading {
        font-size: 0.82rem;
        letter-spacing: 1px;
    }

    .settings-section-card .form-group label {
        font-size: 0.78rem;
    }
}

.text-muted-block {
    display: block;
    margin-top: 0.5rem;
    color: #666;
}

.bg-white {
    background: #FFFFFF;
    border: 1px solid #ddd;
}

.bg-black {
    background: #000000;
}

.bg-light-gray {
    background: #E7E6E6;
}

.bg-dark-blue-gray {
    background: #44546A;
}

.bg-blue-light {
    background: #5B9BD5;
}

.bg-orange {
    background: #ED7D31;
}

.bg-gray {
    background: #A5A5A5;
}

.bg-yellow {
    background: #FFC000;
}

.bg-blue {
    background: #4472C4;
}

.bg-green {
    background: #70AD47;
}

/* Standard Colors */
.bg-red-dark {
    background: #C00000;
}

.bg-red {
    background: #FF0000;
}

.bg-yellow-bright {
    background: #FFFF00;
}

.bg-green-light {
    background: #92D050;
}

.bg-green-bright {
    background: #00B050;
}

.bg-cyan {
    background: #00B0F0;
}

.bg-blue-bright {
    background: #0070C0;
}

.bg-blue-dark {
    background: #002060;
}

.bg-purple {
    background: #7030A0;
}

.tips-text {
    display: block;
    margin-top: 0.5rem;
    color: #666;
}

/* Office-style Dropdown */
.office-dropdown-container {
    position: relative;
    display: inline-block;
}

.office-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 150px;
}

.office-trigger:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.office-trigger.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.3);
}

.office-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--accent-secondary);
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(138,3,3,0.1);
    z-index: 1000;
    min-width: 220px;
    max-height: 380px;
    overflow-y: auto;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.office-popover::-webkit-scrollbar { width: 5px; }
.office-popover::-webkit-scrollbar-track { background: transparent; }
.office-popover::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.office-popover::-webkit-scrollbar-thumb:hover { background: var(--accent-secondary); }

.office-popover.active {
    display: block;
}

.font-list {
    padding: 0.5rem 0;
}

/* Reserve 3px on the left of every item so active state never shifts text */
.font-item {
    padding: 0.65rem 1rem 0.65rem calc(1rem + 3px);
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.font-item:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-left-color: rgba(138,3,3,0.4);
}

.font-item.active {
    background: rgba(138, 3, 3, 0.25);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    pointer-events: none;
    opacity: 0.6;
}

/* Font list group labels */
.font-list-group-label {
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.45rem 1rem 0.15rem;
    border-top: 1px solid rgba(138,3,3,0.12);
    margin-top: 0.1rem;
    pointer-events: none;
    user-select: none;
}
.font-list-group-label:first-child { border-top: none; }

/* Small badge inside font items */
.font-badge {
    display: inline-block;
    font-size: 0.62rem;
    background: rgba(138,3,3,0.35);
    color: var(--accent-primary);
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 0.35rem;
    letter-spacing: 0.04em;
    font-family: var(--font-body, sans-serif) !important;
    font-style: normal;
}

/* Custom font input row at bottom of each dropdown */
.font-custom-row {
    display: flex;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem 0.6rem;
    border-top: 1px solid rgba(138,3,3,0.2);
    background: rgba(0,0,0,0.25);
    position: sticky;
    bottom: 0;
}
.font-custom-input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.55rem;
    background: rgba(10,0,0,0.65);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}
.font-custom-input::placeholder { color: var(--text-muted); font-style: italic; }
.font-custom-input:focus { border-color: var(--accent-primary); }
.font-custom-apply {
    padding: 0.35rem 0.65rem;
    background: linear-gradient(135deg, #8a0303, #6b0202);
    border: 1px solid rgba(138,3,3,0.5);
    border-radius: 4px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.font-custom-apply:hover { opacity: 0.82; }

/* Comment Action Buttons */
.btn-approve {
    background: linear-gradient(135deg, #16A34A, #15803D);
    color: white;
    padding: 0.6rem 1.2rem;
    border: 1px solid #22C55E;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.btn-approve:hover {
    background: linear-gradient(135deg, #22C55E, #16A34A);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    transform: translateY(-2px);
}

.btn-unapprove {
    background: transparent;
    color: var(--accent-primary);
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(138, 3, 3, 0.3);
}

.btn-unapprove:hover {
    background: rgba(138, 3, 3, 0.2);
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
    transform: translateY(-2px);
}

.btn-delete {
    background: transparent;
    color: var(--danger);
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--danger);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(207, 0, 0, 0.3);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 20px rgba(207, 0, 0, 0.5);
    transform: translateY(-2px);
}

/* Admin Comment Card Styling */
.admin-comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.admin-comment-card:hover {
    border-color: var(--accent-secondary);
    box-shadow: 0 4px 20px rgba(138, 3, 3, 0.2);
}

.admin-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-comment-work-title {
    color: var(--accent-primary);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
}

.admin-comment-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-comment-status {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-comment-status.approved {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
    border: 1px solid #22C55E;
}

.admin-comment-status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
    border: 1px solid #F59E0B;
}

.admin-comment-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.admin-comment-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ================================================
   MOBILE SIDEBAR OVERLAY (dims background when drawer open)
   Cross-browser compatible
   ================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 499;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
    display: block;
}

/* ================================================
   CROSS-BROWSER COMPATIBILITY FIXES
   Targets: Safari, Firefox, Chrome
   ================================================ */

/* backdrop-filter: prefix for Safari < 15 */
.sidebar,
.modal,
.modal-content,
.top-bar {
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

/* Smooth scrolling - Firefox & Safari */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;    /* Safari mobile font inflation fix */
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Form inputs: remove default Safari/iOS styling */
input,
select,
textarea,
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Ensure consistent box-sizing cross-browser */
*,
*::before,
*::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* iOS Safari: prevent tap highlight on nav items */
.nav-item,
.btn,
.modal-content,
.nav-toggle {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
}

/* Firefox: remove dotted outline on focus */
button::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Safari: fix flexbox gap support (was buggy before Safari 14.1) */
@supports not (gap: 1rem) {
    .dashboard-grid > * + * {
        margin-top: 1.5rem;
    }
    .section-header > * + * {
        margin-left: 1rem;
    }
}

/* Scrollbar styling - Chrome/Edge/Safari */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-sidebar, #0a0101);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-secondary, #8a0303);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary, #ff3232);
}

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--accent-secondary, #8a0303) var(--bg-sidebar, #0a0101); }

/* ================================================
   ADMIN MOBILE ENHANCEMENTS
   ================================================ */

/* Works list rows */
.work-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
    flex-wrap: wrap;
}
.work-item-row .work-title {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.work-item-row .actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Medium mobile (768px and below) */
@media (max-width: 768px) {
    .modal.active { -webkit-overflow-scrolling: touch; overflow-y: auto; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .section-header .btn { align-self: flex-start; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.5rem; }
    .preview-img { max-width: 100%; }
    #usersList > div { flex-direction: column !important; gap: 0.75rem; align-items: flex-start !important; }
    .form-actions-flex { justify-content: stretch; }
    .btn-save-settings { width: 100%; padding: 0.85rem 1rem; }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
    .work-item-row { flex-direction: column; align-items: flex-start; padding: 1rem; }
    .work-item-row .actions { width: 100%; }
    .work-item-row .actions .btn { flex: 1; text-align: center; padding: 0.6rem 0.5rem; font-size: 0.8rem; }

    .top-bar .page-title { font-size: 1rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Full screen modal on phones */
    .modal { align-items: flex-start !important; }
    .modal-content { width: 100% !important; max-width: 100% !important; margin: 0 !important; border-radius: 0 !important; min-height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

    /* 16px prevents iOS Safari auto-zoom on focus */
    .form-group input, .form-group select, .form-group textarea,
    .settings-section input, .settings-section select, .settings-section textarea { width: 100%; font-size: 16px !important; }

    /* Analytics / stats single column */
    .analytics-grid, .stats-grid { grid-template-columns: 1fr !important; }

    /* Comment actions stack */
    .admin-comment-actions { flex-direction: column; }
    .admin-comment-actions .btn { width: 100%; text-align: center; }

    .top-bar { gap: 0.4rem; padding: 0.5rem 0.75rem; }
}

/* Hamburger visible on mobile; sidebar scrollable */
@media (max-width: 900px) {
    #adminNavToggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
        background: rgba(138, 3, 3, 0.2);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        color: var(--accent-primary);
        font-size: 1.2rem;
        flex-shrink: 0;
    }

    /* Sidebar needs to scroll when content is taller than viewport */
    .sidebar {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Works search input: don't overflow */
    #worksSearchInput {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        font-size: 14px;
    }

    /* User-profile: hide the admin label on small bars */
    .user-profile > span:not(.user-avatar) {
        display: none;
    }

    .user-profile {
        gap: 0.5rem;
        flex-shrink: 0;
    }

    /* Page title truncation in top-bar */
    .top-bar .page-title {
        flex: 1;
        min-width: 0;
        font-size: 1.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* iOS Safari: background-attachment: fixed causes jank on touch devices */
@media (hover: none) and (pointer: coarse) {
    body { background-attachment: scroll; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .sidebar, .modal, .modal-content, .btn, .nav-item, .sidebar-overlay { transition: none !important; animation: none !important; }
}

/* ── Branded checkbox ───────────────────────────────────────────────────── */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: rgba(10,0,0,0.55);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    vertical-align: middle;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
input[type="checkbox"]:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(138,3,3,0.22);
}
input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 6px rgba(138,3,3,0.5);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(138,3,3,0.4);
}
input[type="checkbox"]:indeterminate {
    background: rgba(138,3,3,0.5);
    border-color: var(--accent-primary);
}
input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 5px;
    width: 10px;
    height: 2px;
    background: #fff;
}

/* ── Color fields grid (3-column row inside Colors card) ───────────────── */
.color-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem 1.5rem;
}

/* ── Color trigger (compact button, mirrors office-trigger style) ───────── */
.color-trigger-wrap { display: block; }

.color-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: rgba(10,0,0,0.55);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: var(--font-body, inherit);
    font-size: 0.9rem;
    transition: border-color 0.18s, box-shadow 0.18s;
    text-align: left;
}
.color-trigger:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(138,3,3,0.22);
}
.color-trigger[aria-expanded="true"] {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(138,3,3,0.3);
}
.color-trigger-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.18);
    background: #333;
    flex-shrink: 0;
}
.color-trigger-hex {
    flex: 1;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary, #ccc);
    letter-spacing: 0.03em;
}
.color-trigger-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Shared Color Picker popover ────────────────────────────────────────── */
.shared-color-picker {
    position: absolute;
    z-index: 9999;
    background: linear-gradient(135deg, #1a0000 0%, #0d0000 100%);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(138,3,3,0.25);
    padding: 1rem;
    width: 280px;
    max-width: 92vw;
}

.scp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}
.scp-label {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
}
.scp-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.scp-close-btn:hover { color: var(--accent-primary); background: rgba(138,3,3,0.15); }

.scp-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    margin-top: 0.6rem;
}
.scp-group-label:first-child { margin-top: 0; }

.scp-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 0.2rem;
}

.scp-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
    flex-shrink: 0;
}
.scp-swatch:hover {
    transform: scale(1.18);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 6px rgba(255,255,255,0.3);
}
.scp-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent-primary);
    transform: scale(1.12);
}

.scp-hex-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(138,3,3,0.2);
}
.scp-hex-row label {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
#scpHexInput {
    flex: 1;
    background: rgba(10,0,0,0.6);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    outline: none;
    transition: border-color 0.15s;
}
#scpHexInput:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(138,3,3,0.25); }

.scp-preview-swatch {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.18);
    background: #333;
    flex-shrink: 0;
}

.scp-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.85rem;
}
.scp-footer .btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

@media (max-width: 600px) {
    .color-fields-grid { grid-template-columns: 1fr 1fr; }
    .shared-color-picker { width: 260px; }
}

/* ================================================
   CONTACT MESSAGES — Branded Card Layout
   ================================================ */

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.msg-card {
    background: var(--bg-card, #110000);
    border: 1px solid var(--border-color, rgba(138,3,3,0.3));
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.msg-card:hover {
    border-color: rgba(138, 3, 3, 0.6);
    background: var(--bg-hover, rgba(138,3,3,0.06));
    box-shadow: 0 2px 16px rgba(138, 3, 3, 0.12);
}

.msg-card.msg-selected {
    border-color: var(--blood-red, #8a0303);
    background: rgba(138, 3, 3, 0.08);
}

.msg-card-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.msg-card-header .msg-checkbox {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--blood-red, #8a0303);
}

.msg-card-sender {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.msg-name {
    color: var(--text-primary, #e8d5d5);
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-email {
    color: var(--blood-bright, #ff3333);
    font-size: 0.82rem;
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.2s;
}

.msg-email:hover {
    color: #fff;
    text-decoration: underline;
}

.msg-date {
    color: var(--text-muted, #886666);
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.msg-delete-icon {
    flex-shrink: 0;
    padding: 0.35rem 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--danger, #cc0000);
    border-radius: 6px;
    color: var(--danger, #cc0000);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.msg-delete-icon:hover {
    background: var(--danger, #cc0000);
    color: #fff;
}

.msg-card-body {
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border-left: 3px solid rgba(138, 3, 3, 0.5);
    color: var(--text-white, #f5e6e6);
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted, #886666);
    font-style: italic;
    letter-spacing: 0.03em;
}

.msg-empty-error {
    color: var(--danger, #cc0000);
    font-style: normal;
}

/* Select-all label in toolbar */
.msg-select-all-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted, #886666);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.msg-select-all-label:hover { color: var(--text-primary, #e8d5d5); }

.msg-select-all-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--blood-red, #8a0303);
}

/* Checkbox selection highlights card */
.msg-card:has(.msg-checkbox:checked) {
    border-color: var(--blood-red, #8a0303);
    background: rgba(138, 3, 3, 0.08);
}

@media (max-width: 600px) {
    .msg-card { padding: 1rem; }
    .msg-card-header { flex-wrap: wrap; gap: 0.6rem; }
    .msg-date { order: 3; width: 100%; }
    .msg-delete-icon { order: 4; margin-left: auto; }
}

/* ================================================
   ADDITIONAL MOBILE POLISH
   ================================================ */

/* Works list header — stack on small screens */
@media (max-width: 768px) {
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .work-filters {
        width: 100%;
    }

    #worksSearchInput {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    /* Works header columns — hide less important columns */
    .works-header .col-category,
    .works-header .col-date {
        display: none;
    }

    /* Add-work button: don't let it shrink */
    #addWorkBtn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Settings cards — full width on mobile */
    .settings-grid,
    .color-fields-grid {
        grid-template-columns: 1fr !important;
    }

    /* Analytics grid */
    .analytics-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* User profile: shrink buttons */
    .user-profile .btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    /* User profile: hide non-critical buttons on very small screens */
    .user-profile #addWorkBtn {
        display: none;
    }

    /* Analytics: single col */
    .analytics-grid {
        grid-template-columns: 1fr !important;
    }

    /* Topbar: save settings button full row */
    .top-bar {
        flex-wrap: wrap;
    }

    /* Main content padding */
    .main-content {
        padding: 0.75rem !important;
    }
}

/* ── Analytics Dashboard ─────────────────────────────────── */
.analytics-container {
    display: grid;
    gap: 1.25rem;
    margin-top: 1rem;
}

/* Period / filter bar */
.analytics-period-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.analytics-period-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-right: 0.25rem;
}
.analytics-period-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.period-btn {
    padding: 0.45rem 0.85rem;
    background: rgba(0,0,0,0.3);
    color: var(--text-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.period-btn.active,
.period-btn:hover {
    background: var(--blood-red);
}
.analytics-reset-btn {
    padding: 0.45rem 0.85rem;
    background: rgba(138,3,3,0.25);
    color: var(--text-white);
    border: 1px solid var(--blood-red);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.analytics-reset-btn:hover {
    background: rgba(138,3,3,0.55);
}

/* Summary stat boxes */
.analytics-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.analytics-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
}
.analytics-stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.analytics-stat-value {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--blood-bright);
    line-height: 1.1;
}
.analytics-stat-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* Two-column grid for referrers + country */
.analytics-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

/* Shared card */
.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}
.analytics-card-title {
    color: var(--text-white);
    font-size: 1rem;
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blood-red);
}

/* List rows */
.analytics-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.analytics-list-scroll {
    max-height: 360px;
    overflow-y: auto;
}
.analytics-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    min-width: 0;
}
.analytics-list-label {
    color: var(--text-white);
    font-size: 0.875rem;
    min-width: 0;
    flex: 1;
}
.analytics-list-path {
    font-family: monospace;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.analytics-list-count {
    color: var(--blood-bright);
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Works rows */
.analytics-work-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    min-width: 0;
}
.analytics-work-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}
.analytics-work-rank {
    color: var(--blood-bright);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.analytics-work-title {
    color: var(--text-white);
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.analytics-work-cat {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.15rem;
}
.analytics-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem 0;
    margin: 0;
}

/* Responsive tweaks */
@media (max-width: 600px) {
    .analytics-period-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .analytics-summary-row {
        grid-template-columns: 1fr 1fr;
    }
    .analytics-stat-value {
        font-size: 2rem;
    }
    .analytics-grid-2 {
        grid-template-columns: 1fr;
    }
    .analytics-work-row {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .analytics-work-row .analytics-list-count {
        width: 100%;
        text-align: right;
    }
}
@media (max-width: 380px) {
    .analytics-summary-row {
        grid-template-columns: 1fr;
    }
    .analytics-stat-value {
        font-size: 1.8rem;
    }
    .period-btn,
    .analytics-reset-btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.65rem;
    }
}

