/* ================================
   Global & Body Styles
   ================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap'); /* Added for Login Header */

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    margin: 0;
    padding: 0;
    color: #1f2937;
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ================================
   1. Login Screen (Updated Branding)
   ================================ */
#login-container {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background-color: #0f172a;
}

.login-box {
    background: #ffffff; padding: 3rem; border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%; max-width: 400px; text-align: center; box-sizing: border-box;
}

.login-logo {
    width: 80px; height: 80px; margin-bottom: 1rem; object-fit: contain;
}

.font-heading {
    font-family: 'Poppins', sans-serif; text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 0.25rem !important;
    color: #0f172a; font-size: 1.5rem; margin-top: 0;
}

.login-box p {
    color: #64748b; font-size: 0.95rem; margin-top: 0; margin-bottom: 2rem;
}

.login-box input {
    width: 100%; padding: 14px; margin-bottom: 1rem;
    border: 1px solid #e5e7eb; border-radius: 8px; box-sizing: border-box; font-size: 1rem;
}
.login-box input:focus { outline: 2px solid #97c12f; border-color: transparent; }

/* Remember Me Styling */
.remember-me-wrapper {
    display: flex; align-items: center; justify-content: flex-start;
    margin-bottom: 1.5rem; font-size: 0.9rem; color: #475569;
}
.remember-me-wrapper input {
    width: auto !important; margin-bottom: 0 !important; margin-right: 0.5rem; cursor: pointer;
}
.remember-me-wrapper label { cursor: pointer; }

#login-button {
    width: 100%; padding: 14px; border: none; border-radius: 8px;
    background-color: #97c12f; color: white; font-weight: 600;
    font-size: 1rem; cursor: pointer; transition: all 0.2s;
}
#login-button:hover { background-color: #82a828; transform: translateY(-1px); }

.copyright {
    margin-top: 2rem !important; font-size: 0.75rem !important; color: #94a3b8 !important;
}

/* ================================
   2. Main Layout
   ================================ */
#app-container { display: flex; flex-direction: column; height: 100vh; position: relative; }

header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1.5rem; background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb; flex-shrink: 0; z-index: 20;
    position: sticky; top: 0;
}
.header-left { display: flex; align-items: center; gap: 1rem; }
header h1 { margin: 0; font-size: 1.25rem; color: #0f172a; font-weight: 700; }

main { display: flex; flex-grow: 1; overflow: hidden; }

/* UPDATED SIDEBAR */
nav {
    width: 240px; flex-shrink: 0; background: #0f172a; color: white;
    display: flex; flex-direction: column; height: 100%; box-sizing: border-box;
}

.nav-scroll-area { padding: 1rem; overflow-y: auto; flex-grow: 1; }

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.filters-compact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-group h3 {
    font-size: 0.7rem;
    font-weight: 600;
    color: #cbd5e1;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-buttons button {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: fit-content;
}

.filter-buttons button:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
}

.filter-buttons button.active {
    background: #97c12f;
    color: #0f172a;
    border-color: #97c12f;
    font-weight: 600;
}

.search-input-compact,
.select-compact {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.search-input-compact:focus,
.select-compact:focus {
    outline: 2px solid #97c12f;
    border-color: transparent;
}

.checkbox-row-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.checkbox-row-compact input {
    width: auto !important;
    accent-color: #97c12f;
}

.admin-tool-btn-compact {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
}

.admin-tool-btn-compact:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
}

.admin-tool-btn-compact.subtle {
    background: rgba(255,255,255,0.05);
    font-size: 0.8rem;
    padding: 0.5rem;
}

.admin-panel-collapsible {
    margin-top: 0.5rem;
}

.admin-toggle-btn {
    width: 100%;
    padding: 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.admin-toggle-btn:hover {
    background: rgba(255,255,255,0.12);
}

.admin-toggle-btn .admin-chevron {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.admin-toggle-btn.active .admin-chevron {
    transform: rotate(180deg);
}

.admin-panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.admin-panel-content.expanded {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
    padding-top: 0.75rem;
}

.admin-help-text {
    font-size: 0.7rem;
    color: #94a3b8;
    margin: 0.5rem 0 0 0;
    font-style: italic;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.admin-field-compact {
    margin-bottom: 0.75rem;
}

.admin-field-compact label {
    display: block;
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-bottom: 0.25rem;
}

.input-compact,
.textarea-compact {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.85rem;
    box-sizing: border-box;
    font-family: inherit;
}

.textarea-compact {
    resize: vertical;
    min-height: 60px;
}

.input-compact:focus,
.textarea-compact:focus {
    outline: 2px solid #97c12f;
    border-color: transparent;
}

.counts-compact {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 0.5rem;
    color: #e2e8f0;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.counts-compact div {
    display: flex;
    justify-content: space-between;
}

.counts-compact span {
    font-weight: 600;
    color: #97c12f;
}

.nav-footer {
    padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: space-between;
    background-color: #0b1120;
}

.admin-profile { display: flex; align-items: center; gap: 10px; }
#admin-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    border: 2px solid #97c12f; object-fit: cover;
}
.nav-footer span { font-weight: 600; font-size: 0.9rem; color: white; }

.cog-btn {
    background: transparent; border: none; color: #94a3b8;
    font-size: 1.2rem; cursor: pointer; transition: color 0.2s; padding: 5px;
}
.cog-btn:hover { color: white; transform: rotate(45deg); transition: transform 0.3s; }

nav h2 {
    margin: 0 0 0.75rem 0; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.05em; color: #94a3b8; font-weight: 700;
}

.filters + .filters { margin-top: 1.25rem; }

.filters button {
    display: flex; align-items: center; width: 100%;
    padding: 10px 12px; margin-bottom: 4px;
    border: none; border-radius: 8px;
    background: transparent; color: #cbd5e1;
    font-weight: 500; font-size: 0.95rem;
    cursor: pointer; transition: all 0.2s;
}
.filters button:hover { background-color: rgba(255,255,255,0.1); color: white; }
.filters button.active { background-color: #97c12f; color: #0f172a; font-weight: 700; }

/* Search & filter inputs */
#search-filters input,
#search-filters select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.95rem;
    margin-bottom: 10px;
}
#search-filters input::placeholder { color: #94a3b8; }
#search-filters select { color: #e2e8f0; }
#search-filters input:focus,
#search-filters select:focus {
    outline: 2px solid #97c12f;
    border-color: transparent;
}

.admin-tool-btn.subtle {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.15);
}
.admin-tool-btn.subtle:hover {
    background: rgba(255,255,255,0.15);
}

.admin-panel {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-field label {
    display: block;
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.admin-field textarea,
.admin-field input[type="datetime-local"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 0.95rem;
}
.admin-field textarea:focus,
.admin-field input[type="datetime-local"]:focus {
    outline: 2px solid #97c12f;
    border-color: transparent;
}

.counts {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 10px;
    color: #e2e8f0;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.95rem;
    margin-top: 4px;
}
.checkbox-row input {
    width: auto !important;
    accent-color: #97c12f;
}

.admin-tool-panel {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.admin-tool-section {
    display: flex;
    flex-direction: column;
}

#director-message-log-container {
    max-height: 600px;
    overflow-y: auto;
}

#director-message-log-list {
    max-height: 500px;
}

/* ================================
   3. Ticket List
   ================================ */
#ticket-list-section { 
    flex-grow: 1; 
    background: #f3f4f6; 
    overflow-y: auto; 
    min-width: 0; /* Allows flex shrinking */
    display: flex;
    flex-direction: column;
}

#ticket-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Right Sidebar for Message History */
#message-history-sidebar {
    width: 380px;
    flex-shrink: 0;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 25;
}

#message-history-sidebar.hidden {
    display: none;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    flex-shrink: 0;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

#director-message-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#director-message-log-list > div {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    transition: all 0.2s;
}

#director-message-log-list > div:hover {
    background: #f3f4f6;
    border-color: #97c12f;
}

#director-message-log-list p {
    margin: 0.5rem 0;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.5;
}

.delete-message-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.delete-message-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.delete-message-btn:active {
    transform: scale(0.95);
}

.close-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.ticket-item {
    background: white; padding: 1.25rem; margin-bottom: 0.75rem;
    border-radius: 12px; border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); cursor: pointer; transition: all 0.2s ease;
    position: relative;
}
.ticket-item:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.ticket-item.active { border-color: #97c12f; box-shadow: 0 0 0 2px #97c12f; }

.ticket-flag {
    position: absolute; top: 1rem; right: 1rem;
    color: #C42217; font-size: 1.2rem;
}

.ticket-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.ticket-category {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    padding: 2px 8px; border-radius: 99px; background: #f3f4f6; color: #4b5563;
}
.ticket-date { font-size: 0.75rem; color: #9ca3af; }
.ticket-email { font-size: 0.875rem; font-weight: 600; color: #1f2937; margin-bottom: 0.25rem; }
.ticket-snippet {
    font-size: 0.875rem; color: #6b7280;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-archived {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* ================================
   4. Ticket Detail View (Condensed)
   ================================ */
#ticket-detail-container {
    width: 45%; flex-shrink: 0; background: white;
    border-left: 1px solid #e5e7eb; display: flex; flex-direction: column;
    min-width: 0; /* Allows flex shrinking */
}

/* Adjust ticket detail width when message history sidebar is open */
#message-history-sidebar:not(.hidden) ~ #ticket-detail-container {
    width: 35%;
}

/* Scrolling Fix included here */
.detail-content-wrapper { 
    padding: 2rem; 
    overflow-y: auto; 
    height: 100%; 
    box-sizing: border-box; /* Ensures padding doesn't expand height */
    
    /* 400px is nearly half a screen. This forces the content up. */
    padding-bottom: 400px !important; 
}

.compact-header {
    margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #e5e7eb;
}
.compact-title {
    font-size: 1.25rem; font-weight: 700; color: #111827;
    margin: 0 0 0.5rem 0; display: flex; align-items: center; gap: 8px;
}
.pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #e5e7eb;
}
.pill-archived {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}
.compact-meta { font-size: 0.875rem; color: #6b7280; line-height: 1.5; }
.compact-meta strong { color: #374151; font-weight: 600; }

.ticket-message-body {
    font-size: 1rem; line-height: 1.6; color: #1f2937;
    margin-bottom: 2rem; white-space: pre-wrap;
}

.admin-section {
    background-color: #f9fafb; padding: 1.5rem; border-radius: 12px; border: 1px solid #e5e7eb;
}

.detail-group { margin-bottom: 1rem; }
.detail-group label {
    display: block; font-size: 0.75rem; font-weight: 700;
    color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem;
}

textarea, select {
    width: 100%; padding: 10px; border: 1px solid #d1d5db;
    border-radius: 8px; font-family: inherit; font-size: 0.95rem; margin-top: 0;
    background: white;
}
textarea:focus, select:focus { outline: 2px solid #97c12f; border-color: transparent; }

.action-row { display: flex; gap: 10px; margin-top: 1.5rem; }

#save-ticket-button {
    flex: 2; padding: 12px; background: #0f172a; color: white;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer;
}
#toggle-priority-button {
    flex: 1; padding: 12px; background: white; color: #C42217;
    border: 1px solid #C42217; border-radius: 8px; font-weight: 600; cursor: pointer;
}
#toggle-priority-button.is-flagged { background: #C42217; color: white; }

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.delete-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
}

.bulk-delete-button, .select-all-button, .deselect-all-button {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.bulk-delete-button {
    background: #ef4444;
    color: white;
}

.bulk-delete-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.bulk-delete-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.select-all-button {
    background: #0f172a;
    color: white;
}

.select-all-button:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.deselect-all-button {
    background: #6b7280;
    color: white;
}

.deselect-all-button:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

/* ================================
   5. Mobile Responsive
   ================================ */
.hamburger-button, .header-back-button {
    background: transparent; 
    border: none; 
    font-size: 1.25rem; 
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 25;
    color: #0f172a;
}
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 40; display: none;
}

@media (max-width: 768px) {
    .hamburger-button { 
        display: flex !important; 
    }
    
    .header-back-button {
        display: none;
    }
    
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 100;
        padding: 0.75rem 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .header-left {
        gap: 0.75rem;
    }
    
    header h1 {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }
    
    main {
        margin-top: 60px;
        height: calc(100vh - 60px);
    }
    
    nav {
        position: fixed; 
        top: 0; 
        left: 0; 
        height: 100%; 
        z-index: 150;
        transform: translateX(-100%); 
        transition: transform 0.3s ease;
        width: 280px;
    }
    
    nav.is-open { 
        transform: translateX(0); 
    }
    
    .overlay.hidden { 
        display: none; 
    }
    
    .overlay { 
        display: block; 
        z-index: 140;
    }
    
    #ticket-list-section {
        width: 100%;
        margin-top: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .bulk-actions {
        position: sticky;
        top: 60px;
        z-index: 20;
        padding: 0.75rem;
        background: #f8fafc;
        border-bottom: 2px solid #e2e8f0;
        flex-shrink: 0;
    }
    
    #ticket-list-container {
        padding: 0.75rem;
        flex: 1;
        overflow-y: auto;
    }
    
    .ticket-item {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }
    
    #ticket-detail-container {
        position: fixed; top: 60px; left: 0; width: 100%; height: calc(100% - 60px);
        z-index: 30; display: none; border-left: none;
        overflow-y: auto;
    }
    
    /* Message History Sidebar - Full screen on mobile */
    #message-history-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 60;
        border-left: none;
        background: white;
    }
    
    .sidebar-header {
        padding: 1rem;
        background: #f9fafb;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .sidebar-content {
        padding: 1rem;
    }
    
    #director-message-log-list > div {
        padding: 0.875rem;
        font-size: 0.875rem;
    }
    
    #app-container.show-detail #ticket-list-section { display: none; }
    #app-container.show-detail #ticket-detail-container { display: block; }
    #app-container.show-detail .hamburger-button { display: none; }
    #app-container.show-detail .header-back-button { display: block; }
    
    #app-container.show-stats #ticket-list-section { display: none; }
    #app-container.show-stats #ticket-detail-container { display: none; }
    #app-container.show-stats #usage-stats-container { display: block; }
    #app-container.show-stats .hamburger-button { display: none; }
    #app-container.show-stats .header-back-button { display: block; }
    
    /* Hide message history when showing stats or detail */
    #app-container.show-stats #message-history-sidebar,
    #app-container.show-detail #message-history-sidebar {
        display: none !important;
    }
    
    /* Compact admin tools for mobile */
    .nav-scroll-area {
        padding: 0.75rem;
    }
    
    .nav-section {
        margin-bottom: 1rem;
    }
    
    .filter-buttons button {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }
    
    .admin-tool-btn-compact {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .admin-field-compact {
        margin-bottom: 0.6rem;
    }
    
    .input-compact,
    .textarea-compact {
        font-size: 0.875rem;
        padding: 0.6rem;
    }
}

/* Reply Section Styles */
.reply-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px dashed #e5e7eb;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

#reply-message {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    min-height: 80px;
    margin-bottom: 10px;
    font-family: inherit;
}

#send-reply-btn {
    width: 100%;
    padding: 12px;
    background-color: #16a34a; /* Green */
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#send-reply-btn:hover { background-color: #15803d; }