:root {
    --brand-primary: #0f4c81;
    --brand-primary-dark: #0a3358;
    --brand-accent: #d4af37;
    --bg-canvas: #f1f5f9;
    --sidebar-w: 260px;
}

/* Global Overrides to break osTicket constraints */
#container,
.page {
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* LOGIN PAGE INTEGRATION */
.orion-login-page .orion-sidebar {
    display: block !important;
    /* Restore sidebar as per prototype */
}

body.orion-login-page .orion-main {
    margin-left: var(--sidebar-w) !important;
    padding: 0 !important;
    background: #ffffff !important;
    /* Pure White Backdrop */
    background-image: none !important;
    /* Remove gradient for absolute white */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
}

body.orion-hub.orion-login-page {
    background-color: #ffffff !important;
    /* Higher specificity to beat line 75 */
}

body.orion-hub.orion-login-page .orion-main {
    background-color: #ffffff !important;
    background-image: none !important;
}

@media (max-width: 1024px) {
    .orion-login-page .orion-main {
        margin-left: 0 !important;
    }
}

.orion-login-page #container,
.orion-login-page .page,
.orion-login-page #content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#content {
    width: auto !important;
    padding: 0 !important;
}

body.orion-hub {
    font-family: 'Inter', sans-serif !important;
    background-color: #f8fafc !important;
    /* Lighter, modern canvas */
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    overflow-x: hidden;
    color: #1e293b;
}

.orion-main {
    background-color: transparent !important;
}

/* 
   FIX: Restore Icon Fonts potentially broken by body font !important 
   osTicket legacy uses FontAwesome 3 ([class^="icon-"])
   Redactor uses its own font ([class^="re-icon-"])
*/
[class^="icon-"],
[class*=" icon-"] {
    font-family: FontAwesome !important;
}

[class^="re-icon-"],
[class*=" re-icon-"] {
    font-family: 'Redactor' !important;
}

/* Ensure FA6 also wins if applied directly to shared elements */
[class^="fa-"],
[class*=" fa-"],
.fas,
.far,
.fab,
.fa-solid,
.fa-regular,
.fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "FontAwesome" !important;
}

.orion-sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1024px) {
    .orion-sidebar {
        left: -280px;
        width: 280px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }

    .orion-sidebar.open {
        left: 0;
    }
}

.orion-main {
    margin-left: var(--sidebar-w);
    padding: 24px 40px;
    /* Reduced top padding slightly for better balance */
    min-height: 100vh;
    position: relative;
    background: radial-gradient(circle at top right, #ffffff 0%, #f1f5f9 100%);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

@media (max-width: 1280px) {
    .orion-main {
        padding: 24px;
    }
}

@media (max-width: 1024px) {
    .orion-main {
        margin-left: 0 !important;
        padding: 0 !important;
        padding-top: 72px !important;
        width: 100% !important;
        box-sizing: border-box;
    }
}

.orion-mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: var(--brand-primary);
    color: white;
    z-index: 1000;
    align-items: center;
    padding: 0 24px;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1024px) {
    .orion-mobile-nav {
        display: flex;
    }
}

.orion-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 76, 129, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.orion-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar Nav */
.orion-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 12px;
    margin: 4px 16px;
    transition: all 0.2s;
    text-decoration: none !important;
}

.orion-nav-item:hover,
.orion-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
}

.orion-nav-item.active {
    background: rgba(255, 255, 255, 0.15);
}

.orion-nav-item.active i {
    color: var(--brand-accent);
}

.orion-nav-section-title {
    color: rgba(255, 255, 255, 0.2);
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    padding: 24px 32px 12px;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #0f4c81 0%, #062a4d 100%);
    border-radius: 40px;
    padding: 60px 40px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 25px 50px -12px rgba(15, 76, 129, 0.25) !important;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 40px 24px;
        border-radius: 24px;
    }

    .hero-section h2 {
        font-size: 32px !important;
    }

    .hero-section p {
        font-size: 14px !important;
    }
}

.hero-section::after {
    content: '';
    position: absolute;
    right: -5%;
    top: -15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0) 70%);
    border-radius: 50%;
    filter: blur(60px);
}

.hero-section::before {
    content: '';
    position: absolute;
    left: -10%;
    bottom: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    filter: blur(40px);
}

.search-box {
    background: #fff;
    border-radius: 20px;
    padding: 8px;
    display: flex;
    align-items: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .search-box {
        flex-direction: column;
        gap: 10px;
        background: transparent;
        box-shadow: none;
        padding: 0;
    }

    .search-box input {
        background: #fff !important;
        border-radius: 16px;
        width: 100%;
    }

    .search-box .btn-premium {
        width: 100%;
    }

    .search-box i {
        display: none;
    }
}

.search-box input {
    flex: 1;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    background: transparent !important;
}

.btn-premium {
    background: var(--brand-primary);
    color: #fff;
    padding: 14px 28px;
    border-radius: 16px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border: none;
    transition: all 0.3s;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 76, 129, 0.2);
}

/* ULTRA MODERN - SaaS STYLE COMPONENTS */
.modern-card {
    background: #ffffff;
    border-radius: 40px !important;
    border: 1px solid rgba(15, 76, 129, 0.05) !important;
    box-shadow: 0 40px 80px -15px rgba(15, 76, 129, 0.08) !important;
    width: 100% !important;
    display: block !important;
    overflow: hidden !important;
    position: relative;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glass Variant for Login */
.modern-card.glass-style {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 50px 100px -20px rgba(15, 76, 129, 0.15) !important;
    border-radius: 48px !important;
}

.modern-card:hover {
    box-shadow: 0 50px 100px -20px rgba(15, 76, 129, 0.12) !important;
}

.modern-card.flex-row {
    display: flex !important;
    flex-direction: row !important;
}

@media (max-width: 768px) {
    .modern-card {
        border-radius: 28px !important;
        margin: 0 !important;
        /* Remove margin to avoid double padding with container */
        width: 100% !important;
    }
}

.bg-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(15, 76, 129, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
}

.blob-1 {
    top: -100px;
    right: -100px;
}

.blob-2 {
    bottom: -100px;
    left: 100px;
}

.login-side {
    padding: 60px !important;
    flex: 1.2;
}

.links-side {
    background: rgba(255, 255, 255, 0.4) !important;
    padding: 60px !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid rgba(15, 76, 129, 0.05) !important;
    position: relative;
}

.padlock-aura {
    position: absolute;
    right: 40px;
    bottom: 40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    animation: aura-pulse 3s infinite ease-in-out;
}

@keyframes aura-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.padlock-aura i {
    color: var(--brand-accent);
    font-size: 40px;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.4));
}

.modern-input-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.modern-input-wrapper input {
    width: 100% !important;
    background: #f8fafc !important;
    /* Subtle gray background for inputs exactly like mockup */
    border: 1px solid #e2e8f0 !important;
    /* Light border */
    border-radius: 20px !important;
    padding: 18px 24px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--brand-primary-dark) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    box-shadow: none !important;
}

.modern-input-wrapper input:focus {
    background: #fff !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 15px 30px rgba(15, 76, 129, 0.08) !important;
    transform: translateY(-2px) !important;
}

.btn-modern {
    background: var(--brand-primary) !important;
    color: white !important;
    width: 100% !important;
    padding: 20px !important;
    border-radius: 20px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.4s !important;
    box-shadow: 0 15px 35px rgba(15, 76, 129, 0.25) !important;
    margin-top: 10px !important;
    display: block !important;
    text-align: center !important;
    text-decoration: none !important;
}

.btn-modern:hover {
    transform: translateY(-4px) scale(1.02) !important;
    box-shadow: 0 25px 50px rgba(15, 76, 129, 0.35) !important;
    filter: brightness(1.1) !important;
}


/* Action Cards - PRECISE SYNC WITH PROTOTYPE */
.glass-card {
    background: #ffffff;
    /* Removed !important to allow variations */
    border-radius: 32px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 10px 30px -5px rgba(15, 76, 129, 0.08) !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    display: block !important;
}

.glass-card-primary {
    background: #0f4c81 !important;
    border: none !important;
    color: #ffffff !important;
}

.action-card {
    padding: 60px 40px !important;
    /* Increased padding for premium feel */
    text-align: center;
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
}

.icon-circle {
    width: 80px !important;
    height: 80px !important;
    border-radius: 24px !important;
    background: #f1f5f9 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.8rem !important;
    color: #0f4c81 !important;
    margin-bottom: 24px !important;
    transition: all 0.3s ease !important;
}

/* Remove osTicket legacy icon markers */
.icon-circle::before,
.icon-circle::after {
    content: none !important;
    display: none !important;
}

.glass-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 20px 40px -10px rgba(15, 76, 129, 0.15) !important;
    border-color: #d4af37 !important;
}

.glass-card:hover .icon-circle {
    background: #0f4c81 !important;
    color: #ffffff !important;
    transform: scale(1.1) rotate(5deg) !important;
}


/* Table modernizations (applied to osTicket tables) */
#ticketTable {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
}

#ticketTable thead th {
    background: #f8fafc !important;
    padding: 24px 30px !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.25em !important;
    color: #94a3b8 !important;
    font-weight: 900 !important;
    border-bottom: 2px solid #f1f5f9 !important;
}

#ticketTable tbody td {
    padding: 24px 30px !important;
    border-bottom: 1px solid #f8fafc !important;
    vertical-align: middle !important;
    transition: all 0.2s ease;
}

#ticketTable tr.group:hover td {
    background: #fafbfc !important;
}

#ticketTable tr.group:hover td:first-child {
    border-left: 4px solid var(--brand-primary) !important;
}

/* Status Badge Matrix */
.badge-status {
    padding: 8px 16px !important;
    border-radius: 99px !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.15em !important;
    border-width: 1px !important;
    border-style: solid !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: block;
}

.badge-status-open {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border-color: #d1fae5 !important;
}

.badge-status-open::before {
    background: #10b981;
}

.badge-status-closed {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

.badge-status-closed::before {
    background: #94a3b8;
}

.badge-status-overdue {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fee2e2 !important;
}

.badge-status-overdue::before {
    background: #ef4444;
}

/* Pagination Modern Refinement */
.pagination-orion a,
.pagination-orion span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0 4px !important;
}

.pagination-orion .active {
    background: var(--brand-primary) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px -5px rgba(15, 76, 129, 0.4) !important;
}

/* Form Modernization - ORION Hub Standard */
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea {
    width: 100%;
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 14px 20px !important;
    background: #f8fafc !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: var(--brand-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 5px rgba(15, 76, 129, 0.08) !important;
}

input[type="submit"],
button.btn,
.btn-premium {
    background: var(--brand-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 14px 32px !important;
    border-radius: 16px !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 10px 20px rgba(15, 76, 129, 0.15) !important;
}

input[type="submit"]:hover,
button.btn:hover,
.btn-premium:hover,
.btn-modern:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 15px 30px rgba(15, 76, 129, 0.25) !important;
    background: #0d4372 !important;
}

.btn-modern {
    background: var(--brand-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 18px 48px !important;
    border-radius: 20px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 10px 20px rgba(15, 76, 129, 0.15) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

/* Select2 Customization for ORION Hub */
.select2-container--default .select2-selection--single {
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    height: 52px !important;
    background: #f8fafc !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 52px !important;
    padding-left: 20px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 50px !important;
}

input[type="submit"]:active,
button.btn:active {
    transform: translateY(0) !important;
}

/* Specific osTicket Form Layout Adjustments */
form td {
    padding: 10px 0 !important;
}

.login-box {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 24px !important;
    padding: 40px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
}

.required_star {
    color: #ef4444 !important;
    margin-left: 4px;
}

.error {
    color: #ef4444 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    margin-top: 8px;
}

/* Hide original elements we are replacing */
#header,
#nav,
#footer,
.error_bar,
.warning_bar,
.notice_bar,
#msg_error,
#msg_notice,
#msg_warning {
    display: none !important;
}

/* Navigation adjustment */
#clientLogin {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    /* Killer of the dark gray background */
}

/* Modern Dynamic Form (Table to Block transformation) */
.modern-dynamic-form table,
.modern-dynamic-form tbody,
.modern-dynamic-form tr,
.modern-dynamic-form td {
    display: block !important;
    width: 100% !important;
    border: none !important;
}

.modern-dynamic-form tr {
    margin-bottom: 24px !important;
}

.modern-dynamic-form td {
    padding: 0 !important;
}

.modern-dynamic-form hr {
    display: none !important;
}

.modern-dynamic-form h3 {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin-bottom: 8px !important;
}

.modern-dynamic-form .form-header {
    margin-bottom: 24px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.modern-dynamic-form label {
    display: block !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: #64748b !important;
    margin-bottom: 8px !important;
}

/* Redactor & Upload Modernization */
.redactor-box {
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    background: #fff !important;
}

.redactor-toolbar {
    background-image: none !important;
    background-color: #f8fafc !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 10px 16px !important;
    box-shadow: none !important;
}

.redactor-toolbar li a {
    color: #64748b !important;
    padding: 8px 12px !important;
    margin: 2px !important;
    border: none !important;
    border-radius: 10px !important;
    background: transparent !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.redactor-toolbar li a:hover {
    background: #f1f5f9 !important;
    color: #0f4c81 !important;
}

.redactor-editor {
    padding: 32px !important;
    font-size: 15px !important;
    line-height: 1.8 !important;
    color: #334155 !important;
    min-height: 250px !important;
}

.redactor-statusbar {
    background: #fafafa !important;
    border-top: 1px solid #f1f5f9 !important;
    padding: 8px 16px !important;
    font-family: inherit !important;
    color: #94a3b8 !important;
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Upload Container Integration */
.filedrop {
    margin-top: 16px !important;
    border: 2px dashed #e2e8f0 !important;
    background: #f8fafc !important;
    border-radius: 20px !important;
    padding: 40px !important;
    transition: all 0.3s ease !important;
    text-align: center !important;
}

.filedrop:hover {
    border-color: var(--brand-primary) !important;
    background: #f1f5f9 !important;
}

.filedrop .btn {
    background: #fff !important;
    color: var(--brand-primary) !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.orion-nav-section-title {
    padding: 24px 32px 8px;
    font-size: 10px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Thread Conversation UI */
.thread-body img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    margin: 12px 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.thread-body a {
    color: inherit !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
}

/* Select2 Modern Overrides */
.select2-container--default .select2-selection--single.select2-modern {
    height: 56px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    background-color: #fff !important;
}

.select2-container--default .select2-selection--single.select2-modern .select2-selection__rendered {
    line-height: 54px !important;
    padding-left: 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #475569 !important;
}

.select2-container--default .select2-selection--single.select2-modern .select2-selection__arrow {
    height: 54px !important;
    right: 12px !important;
}

.select2-dropdown.modern-dropdown {
    border: 1px solid #f1f5f9 !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
    background: #fff !important;
}

/* Thread Conversation UI Refinement */
.thread-body {
    line-height: 1.7;
    word-break: break-word;
    font-size: 15px;
    background: transparent !important;
    /* Force transparency for the container */
}

.thread-body p {
    margin-bottom: 16px;
}

.thread-body *:last-child {
    margin-bottom: 0;
}

/* Base Styles for Body content */
.thread-body,
.thread-body * {
    background: transparent !important;
}

/* Fix for sidebar overlapping or breaking on smaller screens */
.orion-main {
    overflow-x: hidden !important;
}

@media (min-width: 1024px) {
    .orion-main {
        padding-right: 20px !important;
    }
}

/* Ensure images and videos don't break the sidebar/main grid */
img,
video,
iframe {
    max-width: 100% !important;
    height: auto !important;
}

/* System Events (Timeline Markers) */
.thread-event {
    margin: 24px 0 !important;
    font-family: 'Inter', sans-serif !important;
}

.thread-event i {
    font-size: 10px !important;
}

/* Specific bubble adjustments */
.modern-thread>div:last-child {
    margin-bottom: 0;
}

/* Redactor/Editor Fixes for Premium Theme */
.redactor-box {
    border: 1px solid #f1f5f9 !important;
    border-radius: 24px !important;
    overflow: hidden;
    background: #fff !important;
}

.redactor-editor {
    min-height: 250px !important;
    padding: 30px !important;
    background: transparent !important;
    font-size: 15px !important;
    color: #334155 !important;
}

.redactor-toolbar {
    background: #f8fafc !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 12px 20px !important;
}

/* Reply Area Grid Fix */
.reply-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 60px;
}

@media (max-width: 1280px) {
    .reply-grid {
        grid-template-columns: 280px 1fr;
        gap: 40px;
    }
}

@media (max-width: 1024px) {
    .reply-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* Utility to hide legacy elements that might leak */
.type-icon,
.faded.description {
    display: none !important;
}

/* Listing & Table System - Enterprise Fluid */
#ticketTable th,
#ticketTable td {
    border-right: none !important;
    border-left: none !important;
    padding: 24px !important;
}

#ticketTable thead tr {
    background-color: transparent !important;
    border-bottom: 2px solid #f1f5f9 !important;
}

#ticketTable tbody tr {
    border-bottom: 1px solid #f8fafc !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}



.subject-text {
    font-weight: 700 !important;
    color: var(--brand-primary) !important;
    font-size: 14px !important;
    letter-spacing: -0.01em;
}

.ticket-id-badge {
    color: var(--brand-primary) !important;
    font-family: inherit;
    font-weight: 900 !important;
}

.badge-status {
    padding: 8px 16px !important;
    border-radius: 100px !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.badge-status-open {
    background: #ecfdf5 !important;
    color: #059669 !important;
}

.badge-status-closed {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: none !important;
}

/* ORION ELITE LISTING SYSTEM */
#ticketTable {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
}

#ticketTable thead th {
    background: transparent !important;
    border: none !important;
    padding-bottom: 24px !important;
}

#ticketTable tbody tr {
    background: white !important;
    transition: all 0.3s ease !important;
    border: 1px solid #f1f5f9 !important;
}

#ticketTable tbody td {
    border-top: 1px solid #f1f5f9 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 30px 24px !important;
}

#ticketTable tbody td:first-child {
    border-left: 4px solid transparent !important;
    border-top-left-radius: 16px !important;
    border-bottom-left-radius: 16px !important;
}

#ticketTable tbody td:last-child {
    border-right: 1px solid #f1f5f9 !important;
    border-top-right-radius: 16px !important;
    border-bottom-right-radius: 16px !important;
}

#ticketTable tbody tr:hover {
    background-color: #f8fafc !important;
    transform: translateX(4px) !important;
    transition: all 0.2s ease !important;
}

/* Status Indicators on Border */
#ticketTable tr:has(.badge-status-open) td:first-child {
    border-left-color: #10b981 !important;
}

#ticketTable tr:has(.badge-status-closed) td:first-child {
    border-left-color: #94a3b8 !important;
}

.subject-text {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #1e293b !important;
}

/* Profile Form Elite Refinement */
.modern-form-grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.modern-form-grid h3 {
    font-size: 11px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.2em !important;
    color: #94a3b8 !important;
    margin: 40px 0 16px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-bottom: 8px !important;
}

.modern-form-grid hr {
    display: none !important;
}

.modern-form-grid table {
    width: 100% !important;
}

.modern-form-grid td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
}

.modern-form-grid label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #334155 !important;
    margin-bottom: 10px !important;
}

.modern-form-grid input[type="text"],
.modern-form-grid input[type="email"],
.modern-form-grid input[type="password"],
.modern-form-grid select,
.modern-form-grid textarea {
    width: 100% !important;
    height: 58px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 18px !important;
    padding: 0 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.modern-form-grid input:focus {
    background: #fff !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 5px rgba(15, 76, 129, 0.06) !important;
    outline: none !important;
}

.modern-form-grid .required {
    color: #ef4444 !important;
    margin-left: 4px;
}

/* ORION CHAT INTELLIGENCE SYSTEM */
.modern-thread {
    position: relative;
    padding-left: 20px;
}

.modern-thread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--brand-primary) 0%, #f1f5f9 100%);
    border-radius: 10px;
    opacity: 0.2;
}

/* Individual Thread Bubbles Override */
.thread-entry {
    margin-bottom: 40px !important;
    position: relative;
}

.thread-entry .header {
    background: transparent !important;
    border: none !important;
    padding: 0 0 12px 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.thread-entry .header .name {
    font-size: 13px !important;
    font-weight: 900 !important;
    color: #1e293b !important;
    letter-spacing: -0.02em;
}

.thread-entry .header .date {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase;
}

/* thread-body: apenas texto, o container pai (bolha) já tem o estilo */
.thread-body {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 15px !important;
    line-height: 1.8 !important;
    color: inherit !important;
    position: relative;
}

.thread-entry.response .thread-body {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.thread-entry.response::after {
    content: 'SUPORTE ORION';
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 8px;
    font-weight: 900;
    color: var(--brand-accent);
    letter-spacing: 0.2em;
}

/* Metadata Widgets Refinement */
.metadata-widget {
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    padding: 32px !important;
    border-radius: 40px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.02) !important;
}

.metadata-widget h4 {
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-bottom: 12px !important;
}

.metadata-widget .group-label {
    color: #94a3b8 !important;
}

.metadata-widget .group-value {
    color: #334155 !important;
}

/* ORION ELITE THREAD SYSTEM - V2 */
.modern-thread {
    position: relative;
    padding-left: 48px !important;
}

.modern-thread::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
    opacity: 0.5;
    border-radius: 10px;
}

.thread-entry {
    margin-bottom: 50px !important;
    position: relative;
    border: none !important;
    background: transparent !important;
}

/* Timeline dot */
.thread-entry::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 24px;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid var(--brand-primary);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 0 4px white;
}

.thread-entry.response::before {
    border-color: var(--brand-accent);
}

.thread-entry .header {
    background: transparent !important;
    border: none !important;
    padding: 0 0 12px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.thread-entry .header .name {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    font-family: 'Outfit', sans-serif;
}

.thread-entry .header .date {
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* V2 thread-body: transparente — container pai já estiliza */
.thread-body {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    line-height: 1.8 !important;
    color: inherit !important;
}

.thread-entry.response .thread-body {
    background: transparent !important;
}

.thread-entry.response .header .name {
    color: var(--brand-accent) !important;
}

/* Remove default osTicket icons if they interfere */
.thread-entry .header i {
    display: none !important;
}


/* ORION ELITE - DEFINITIVE IMPLEMENTATION */
.font-heading {
    font-family: 'Outfit', sans-serif !important;
}

/* Timeline refinement */
.modern-thread {
    position: relative;
    padding-left: 60px !important;
    margin-top: 40px;
}

.modern-thread::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
    opacity: 0.5;
}

.thread-entry {
    margin-bottom: 60px !important;
    position: relative;
}

/* DEFINITIVE: thread-body é apenas container de texto — sem estilo próprio */
.thread-body,
.thread-body::before {
    all: unset !important;
    display: block !important;
    line-height: 1.8 !important;
    color: inherit !important;
    word-break: break-word;
}

/* Hero Header Elite */
.hero-tag {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--brand-primary);
    opacity: 0.6;
}

.hero-tag::before {
    content: '';
    width: 40px;
    height: 1px;
    background: var(--brand-primary);
    opacity: 0.3;
}

/* Sidebar Stats */
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    color: #1e293b;
    font-size: 14px;
    font-weight: 900;
}

.stat-label {
    color: #94a3b8;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 800;
}

/* ORION ELITE — Chat Thread System (from approved prototype) */
.chat-bubble {
    position: relative;
    padding: 24px;
    border-radius: 24px;
    background: white;
    border: 1px solid #f1f5f9;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    top: 24px;
    left: -8px;
    width: 16px;
    height: 16px;
    background: white;
    border-left: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    transform: rotate(45deg);
}

.staff-bubble {
    background: #fffdf9 !important;
    border-color: rgba(184, 150, 87, 0.1) !important;
}

.staff-bubble::before {
    background: #fffdf9 !important;
    border-color: rgba(184, 150, 87, 0.1) !important;
}

/* Thread event inline (criado/fechado etc) */
#ticketThread .thread-event {
    margin: 0 !important;
}

/* =====================================================
   SIDEBAR WIDGET — Contraste e elevação (faltava)
   ===================================================== */
.sidebar-widget {
    border-radius: 32px;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 24px rgba(15, 76, 129, 0.05), 0 1px 4px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.3s ease;
}

.sidebar-widget:hover {
    box-shadow: 0 8px 32px rgba(15, 76, 129, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}