:root {
            --bg-primary: #f4f7fa;
            --bg-secondary: #ffffff;
            --bg-sidebar: #1e293b;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-light: #f8fafc;
            --accent-primary: #3b82f6;
            --accent-primary-hover: #2563eb;
            --border-color: #e2e8f0;
            --shadow-color: rgba(0, 0, 0, 0.05);

            --priority-high: #ef4444;
            --priority-medium: #f97316;
            --priority-low: #22c55e;
            --priority-bg-high: #fee2e2;
            --priority-bg-medium: #ffedd5;
            --priority-bg-low: #dcfce7;
            
            --status-open-bg: #dbeafe;
            --status-open-text: #3b82f6;
            --status-progress-bg: #f3e8ff;
            --status-progress-text: #9333ea;
            --status-closed-bg: #f1f5f9;
            --status-closed-text: #64748b;
        }

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

        html {
            font-size: 62.5%; 
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            font-size: 1.6rem;
            line-height: 1.6;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Main Application Layout */
        .app-container {
            display: flex;
            min-height: 100vh;
        }

        /* Sidebar Styling */
        .sidebar {
            width: 26rem;
            background-color: var(--bg-sidebar);
            color: var(--text-light);
            padding: 2.4rem;
            display: flex;
            flex-direction: column;
            transition: width 0.3s ease;
        }

        .sidebar-header {
            display: flex;
            align-items: center;
            gap: 1.2rem;
            margin-bottom: 4rem;
        }

        .logo-icon {
            width: 3.2rem;
            height: 3.2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--accent-primary);
            border-radius: 0.8rem;
        }

        .logo-text {
            font-size: 2rem;
            font-weight: 700;
        }

        .sidebar-nav {
            flex-grow: 1;
        }

        .nav-list {
            list-style-type: none;
        }

        .nav-item a {
            display: flex;
            align-items: center;
            gap: 1.2rem;
            padding: 1.2rem 1.6rem;
            border-radius: 0.8rem;
            text-decoration: none;
            color: var(--text-light);
            font-weight: 500;
            transition: background-color 0.2s;
        }

        .nav-item a:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }

        .nav-item a.active {
            background-color: var(--accent-primary);
        }
        
        .nav-item a:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: 2px;
        }

        .nav-icon {
            width: 2rem;
            height: 2rem;
        }

        .new-ticket-btn {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 1rem;
            background-color: var(--accent-primary);
            color: var(--text-light);
            border: none;
            padding: 1.4rem;
            border-radius: 0.8rem;
            font-size: 1.6rem;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            text-decoration: none;
            transition: background-color 0.2s, transform 0.1s;
        }

        .new-ticket-btn:hover {
            background-color: var(--accent-primary-hover);
        }

        .new-ticket-btn:active {
            transform: scale(0.98);
        }
        
        .new-ticket-btn:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: 2px;
        }


        /* --- New Content Wrapper --- */
        .content-wrapper {
            display: flex;
            flex-grow: 1;
            overflow: hidden;
        }

        /* Main Content Area */
        .main-content {
           flex-grow: 1;
            padding: 2.4rem 3.2rem;
            display: flex;
            flex-direction: column;
            gap: 2.4rem;
            transition: margin-right 0.3s ease;
        }

        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1.6rem;
        }
        

        .main-header h1 {
            font-size: clamp(2.4rem, 4vw, 3.2rem);
            font-weight: 700;
        }

        .search-and-user {
            display: flex;
            align-items: center;
            gap: 1.6rem;
        }

        .search-wrapper {
            position: relative;
        }
        
        .search-icon {
            position: absolute;
            top: 50%;
            left: 1.4rem;
            transform: translateY(-50%);
            width: 1.8rem;
            height: 1.8rem;
            color: var(--text-secondary);
        }

        .search-input {
            width: 25rem;
            padding: 1rem 1.4rem 1rem 4rem;
            border-radius: 0.8rem;
            border: 1px solid var(--border-color);
            background-color: var(--bg-secondary);
            font-size: 1.5rem;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }
        
        .user-profile {
            width: 4rem;
            height: 4rem;
            display: flex;
            justify-content: center;
            align-items: center;
             font-size: 2rem;
            border-radius: 50%;
            background-color: var(--border-color);
            cursor: pointer;
        }

        /* Filters Section */
        .filters {
            display: flex;
            gap: 0.8rem;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 1.6rem;
            flex-wrap: wrap;
        }

        .filter-btn {
            padding: 0.8rem 1.6rem;
            border-radius: 2rem;
            border: 1px solid transparent;
            background: none;
            color: var(--text-secondary);
            font-size: 1.4rem;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s, color 0.2s;
        }

        .filter-btn.active {
            background-color: var(--accent-primary);
            color: var(--text-light);
        }
        
        .filter-btn:hover:not(.active) {
            background-color: var(--border-color);
            color: var(--text-primary);
        }
        
        .filter-btn:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: 2px;
        }

        /* Ticket List Section */
        .tickets-container {
            background-color: var(--bg-secondary);
            border-radius: 1.2rem;
            box-shadow: 0 4px 12px var(--shadow-color);
            overflow: hidden;
            flex-grow: 1;
        }
        
        .ticket-list {
            display: flex;
            flex-direction: column;
        }

        .ticket-card {
            display: grid;
            grid-template-columns: 5rem 1fr 12rem 10rem 14rem;
            align-items: center;
            gap: 1.6rem;
            padding: 2rem 2.4rem;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: background-color 0.2s;
        }
        
        .ticket-card:last-child {
            border-bottom: none;
        }
        
        .ticket-card:hover {
            background-color: #f8fafc;
        }
        
        .ticket-card:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: -2px;
            background-color: #f8fafc;
        }

        .agent-avatar {
            width: 4rem;
            height: 4rem;
            border-radius: 50%;
            background-color: var(--border-color);
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: 600;
        }

        .ticket-info .subject {
            font-weight: 600;
            font-size: 1.6rem;
            color: var(--text-primary);
        }

        .ticket-info .preview {
            font-size: 1.4rem;
            color: var(--text-secondary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 90%;
        }

        .customer-name, .last-updated {
            font-size: 1.4rem;
            color: var(--text-secondary);
        }
        
        .priority-label {
            display: inline-flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.4rem 1rem;
            border-radius: 1.2rem;
            font-size: 1.2rem;
            font-weight: 600;
            text-transform: uppercase;
        }

        .priority-label::before {
            content: '';
            width: 0.8rem;
            height: 0.8rem;
            border-radius: 50%;
        }

        .priority-label.high {
            background-color: var(--priority-bg-high);
            color: var(--priority-high);
        }
        .priority-label.high::before { background-color: var(--priority-high); }

        .priority-label.medium {
            background-color: var(--priority-bg-medium);
            color: var(--priority-medium);
        }
        .priority-label.medium::before { background-color: var(--priority-medium); }

        .priority-label.low {
            background-color: var(--priority-bg-low);
            color: var(--priority-low);
        }
        .priority-label.low::before { background-color: var(--priority-low); }
        
        .status-label {
            padding: 0.4rem 1.2rem;
            border-radius: 0.6rem;
            font-size: 1.3rem;
            font-weight: 500;
            text-align: center;
        }
        
        .status-label.open {
            background-color: var(--status-open-bg);
            color: var(--status-open-text);
        }
        .status-label.progress {
            background-color: var(--status-progress-bg);
            color: var(--status-progress-text);
        }
        .status-label.closed {
            background-color: var(--status-closed-bg);
            color: var(--status-closed-text);
        }
  

         /* --- Conversation Sidebar Styling --- */

         
        .conversation-sidebar {
            width: 0;
            flex-shrink: 0;
            background-color: var(--bg-secondary);
            border-left: 1px solid var(--border-color);
            transition: width 0.3s ease, padding 0.3s ease;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

          /* This class will be used to show the sidebar */
        .conversation-open .conversation-sidebar {
            width: 36rem;
            padding: 2.4rem;
        }

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

        .conversation-header .subject {
            font-size: 1.8rem;
            font-weight: 600;
            margin-bottom: 0.4rem;
        }
        
        .conversation-header .customer-info {
            font-size: 1.4rem;
            color: var(--text-secondary);
        }

        .conversation-body {
            flex-grow: 1;
            overflow-y: auto;
            padding: 2.4rem 0;
            display: flex;
            flex-direction: column;
            gap: 2rem;
        }

        .message {
            display: flex;
            gap: 1.2rem;
        }

        .message-content {
            padding: 1.2rem 1.6rem;
            border-radius: 1.2rem;
            max-width: 80%;
        }

        .message.agent .message-content {
            background-color: var(--message-agent-bg);
            border-top-left-radius: 0;
        }
        
        .message.customer {
            justify-content: flex-end;
        }

        .message.customer .message-content {
            background-color: var(--message-customer-bg);
            border-top-right-radius: 0;
        }

        .message-sender {
            font-weight: 600;
            font-size: 1.4rem;
            margin-bottom: 0.4rem;
        }
        
        .message-text {
            font-size: 1.4rem;
            line-height: 1.7;
        }
        
        .message-timestamp {
            font-size: 1.2rem;
            color: var(--text-secondary);
            margin-top: 0.8rem;
        }

        .reply-box {
            padding-top: 1.6rem;
            border-top: 1px solid var(--border-color);
        }

        .reply-box textarea {
            width: 100%;
            height: 12rem;
            border: 1px solid var(--border-color);
            border-radius: 0.8rem;
            padding: 1.2rem;
            font-family: 'Inter', sans-serif;
            font-size: 1.4rem;
            resize: vertical;
            margin-bottom: 1.2rem;
        }
        
        .reply-box textarea:focus {
             outline: none;
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }

        .reply-box button {
            width: 100%;
            padding: 1.2rem;
            background-color: var(--accent-primary);
            color: var(--text-light);
            border-radius: 0.8rem;
            font-weight: 600;
            transition: background-color 0.2s;
        }
        
        .reply-box button:hover {
            background-color: var(--accent-primary-hover);
        }


        /* Responsive Design */
        @media (max-width: 1280px) {
            .conversation-open .conversation-sidebar {
                width: 32rem;
            }
            .ticket-card {
                grid-template-columns: 5rem 1fr 10rem 12rem;
                gap: 1.2rem;
            }
            .customer-name {
                display: none; /* Hide customer name on smaller desktop screens */
            }
        }
        
        @media (max-width: 992px) {
            .conversation-sidebar { display: none; } /* Hide conversation on tablet */
            .sidebar {
                width: 7.2rem;
                padding: 2.4rem 1.2rem;
            }
            
            .sidebar .logo-text, .sidebar .nav-text {
                display: none;
            }
            
            .sidebar-header {
                justify-content: center;
            }
            
            .nav-item a {
                justify-content: center;
            }
            
            .ticket-card {
                grid-template-columns: 5rem 1fr 12rem;
            }
            
            .last-updated, .status-label {
                display: none; /* Hide more columns on tablet */
            }
        }
        
        @media (max-width: 768px) {
            .app-container {
                flex-direction: column;
            }
            
            .sidebar {
                width: 100%;
                height: auto;
                flex-direction: row;
                justify-content: space-between;
                align-items: center;
                padding: 1.2rem 1.6rem;
            }

            .sidebar-header, .sidebar-nav, .new-ticket-btn {
                margin: 0;
            }
            
            .sidebar-header { gap: 0.8rem; }
            .logo-icon { width: 2.8rem; height: 2.8rem; }
            .logo-text { display: block; font-size: 1.8rem; } /* Show logo text on mobile */

            .nav-list {
                display: flex;
                gap: 0.8rem;
            }
            
            .new-ticket-btn {
                display: none; /* Hide button on mobile, focus on list */
            }
            
            .main-content {
                padding: 1.6rem;
            }
            
            .search-and-user {
                width: 100%;
                justify-content: space-between;
            }
            
            .search-input {
                width: 100%;
            }

            .ticket-card {
                grid-template-columns: 4rem 1fr;
                padding: 1.6rem;
            }

            .agent-avatar {
                grid-row: 1 / 3; /* Span avatar across two rows */
            }

            .ticket-info {
                grid-column: 2;
            }
            
            .priority-label {
                grid-column: 2;
                justify-self: start;
                margin-top: 0.8rem;
            }
        }
   