:root {
    color-scheme: light;
    font-family: Inter, Arial, sans-serif;
    color: var(--theme-text, #1c2733);
    background: var(--theme-surface-raised, #eef2f5);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1240px; }

.top-bar {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    color: #fff;
    background: #172b4d;
}

.brand { display: flex; align-items: center; gap: 11px; color: inherit; font-size: 20px; font-weight: 700; text-decoration: none; }
.brand img { display: block; width: 151px; max-height: 38px; object-fit: contain; }
.brand span {
    color: var(--theme-muted, #78b8ff);
    display: inline-block;
    width: 112px;
    font-family: "Arial Black", Arial, sans-serif;
    font-size: 18px;
    font-style: italic;
    font-weight: 900;
    letter-spacing: -.055em;
    line-height: 1;
    white-space: nowrap;
    transform: skewX(-9deg) scaleX(1.16);
    transform-origin: left center;
}
.draft-badge, .readonly-status {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
}
.draft-badge { color: var(--theme-warning-text, #fddf92); background: #4d3b13; }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.top-actions a, .link-button { color: var(--theme-muted, #dcecff); font: inherit; text-decoration: none; }
.link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.signed-in-user { color: #fff; font-weight: 700; }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 5px; color: #fff; cursor: pointer; font-weight: 700; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary::after { content: "▾"; color: var(--theme-muted, #aec6e1); font-size: 10px; }
.account-menu-popover { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; display: none; width: 164px; padding: 5px; border: 1px solid var(--theme-border, #b7cad9); border-radius: 6px; background: var(--theme-surface, #fff); box-shadow: 0 7px 18px rgba(11, 35, 60, .22); }
.account-menu:hover .account-menu-popover, .account-menu:focus-within .account-menu-popover, .account-menu[open] .account-menu-popover { display: grid; }
.account-menu-popover form { margin: 0; }
.account-menu-popover a, .account-menu-popover button { display: block; width: 100%; margin: 0; padding: 8px 9px; border: 0; border-radius: 4px; color: var(--theme-link, #1b5687); background: transparent; font: inherit; font-size: 12px; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
.account-menu-popover a:hover, .account-menu-popover button:hover { color: #fff; background: #176eae; }

.workspace { display: grid; grid-template-columns: 240px minmax(620px, .9fr) minmax(600px, 1.1fr); height: calc(100vh - 58px); }
.workspace.without-open-ticket { grid-template-columns: 240px minmax(900px, 1fr); }
.workspace.without-open-ticket .conversation-details { display: none; }
.queue-workspace { display: grid; grid-template-columns: 240px minmax(900px, 1fr); height: calc(100vh - 58px); }
.ticket-workspace { display: flex; height: calc(100vh - 58px); flex-direction: column; }
.ticket-workspace .conversation-details { flex: 1 1 auto; }
.sidebar, .conversation-list { overflow-y: auto; border-right: 1px solid var(--theme-border, #d8e0e7); background: var(--theme-surface, #fff); }
.sidebar { padding: 24px 14px; }
.sidebar h2, .sidebar h3 { margin: 0 10px 12px; }
.sidebar h2 { font-size: 17px; }
.sidebar h3 { margin-top: 28px; color: var(--theme-muted, #697582); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.queue-link { display: flex; justify-content: space-between; gap: 8px; padding: 10px; border-radius: 6px; color: var(--theme-text, #384554); font-size: 14px; text-decoration: none; }
.queue-link:hover, .queue-link.selected { color: var(--theme-link, #0f4c81); background: var(--theme-surface-raised, #e3f1ff); }
.sidebar-note { margin: 30px 10px 0; color: var(--theme-muted, #687583); font-size: 12px; line-height: 1.5; }

.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 20px 16px; border-bottom: 1px solid var(--theme-border, #d8e0e7); }
.section-heading h1, .details-heading h1 { margin: 0; font-size: 20px; line-height: 1.25; }
.section-heading p, .details-heading p { margin: 5px 0 0; color: var(--theme-muted, #6e7b89); font-size: 13px; }
.conversation-count { min-width: 26px; padding: 4px 8px; border-radius: 14px; color: var(--theme-muted, #55616f); background: var(--theme-surface-raised, #e7edf2); font-size: 12px; text-align: center; }
.tickets-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.tickets-table th, .tickets-table td { padding: 11px 10px; border-bottom: 1px solid var(--theme-border, #e1e7ed); vertical-align: middle; }
.tickets-table th { color: var(--theme-muted, #637282); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--theme-link, #17639b); text-decoration: underline; }
.tickets-table th:nth-child(1) { width: 110px; }
.tickets-table th:nth-child(2) { width: 82px; }
.tickets-table th:nth-child(3) { width: 88px; }
.tickets-table th:nth-child(4) { width: 84px; }
.tickets-table th:nth-child(6) { width: 140px; }
.tickets-table th:nth-child(7) { width: 130px; }
.tickets-table th:nth-child(8) { width: 102px; }
.tickets-table th:nth-child(5), .tickets-table td:nth-child(5) { border-left: 1px solid var(--theme-border, #edf1f4); }
.tickets-table tbody tr { cursor: default; }
.tickets-table tbody tr.ticket-row-link { cursor: pointer; }
.tickets-table tbody tr.ticket-row-link:focus { outline: 2px solid #176eae; outline-offset: -2px; }
.tickets-table tbody tr:hover, .tickets-table tbody tr.selected { background: var(--theme-surface-raised, #edf7ff); }
.source-label, .ticket-status { display: inline-block; padding: 4px 6px; border-radius: 4px; color: var(--theme-link, #17639b); background: var(--theme-surface-raised, #e8f3fc); font-size: 11px; font-weight: 800; white-space: nowrap; }
.source-label.marketplace-ebay { color: #71551c; background: #f7efd2; }
.source-label.marketplace-amazon { color: #884522; background: #f8e6d8; }
.source-label.marketplace-walmart { color: #285782; background: #dfeaf5; }
.source-label.marketplace-google-voice { color: #65447e; background: #ece4f3; }
.source-label.marketplace-other { color: #475569; background: #e7ebef; }
.ticket-status { min-width: 62px; color: #374151; background: #e5e7eb; text-align: center; }
.ticket-status:is([data-status=""], [data-status="NEW"]) { color: #174a8b; background: #dbeafe; }
.ticket-status:is([data-status="ACTIVE"], [data-status="OPEN"]) { color: #9a3412; background: #ffedd5; }
.ticket-status[data-status="PENDING"] { color: #713f12; background: #fef3c7; }
.ticket-status[data-status="ON_HOLD"] { color: #6b21a8; background: #f3e8ff; }
.ticket-status[data-status="SOLVED"] { color: #166534; background: #dcfce7; }
.ticket-status[data-status="CLOSED"] { color: #334155; background: #cbd5e1; }
.message-count { display: inline-grid; min-width: 28px; place-items: center; padding: 4px 6px; border-radius: 12px; color: var(--theme-muted, #34566e); background: var(--theme-surface-raised, #e5eef5); font-size: 12px; font-weight: 800; }
.ticket-id { color: var(--theme-link, #365f7d); font-size: 12px; font-weight: 800; }
.queue-controls { display: flex; flex: 0 0 auto; gap: 9px; align-items: end; }
.queue-controls label { display: grid; gap: 4px; margin: 0; color: var(--theme-muted, #637687); font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
.queue-controls input, .queue-controls select { width: auto; min-width: 92px; padding: 7px 8px; font-size: 12px; }
.queue-controls input { width: 145px; }
.queue-controls button { margin: 0; padding: 8px 11px; font-size: 12px; }
.queue-controls .exact-search-option { display: flex; gap: 5px; align-items: center; padding-bottom: 8px; color: var(--theme-muted, #526777); letter-spacing: 0; text-transform: none; white-space: nowrap; }
.queue-controls .exact-search-option input { width: 14px; min-width: 14px; height: 14px; padding: 0; }
.reset-search { padding: 8px 3px; color: var(--theme-link, #17639b); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.reset-search:hover { text-decoration: underline; }
.ticket-subject { overflow: hidden; }
.ticket-subject a { display: block; overflow: hidden; color: var(--theme-link, #1b5687); font-weight: 700; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.ticket-subject a:hover { text-decoration: underline; }
.ticket-subject > span { display: block; overflow: hidden; margin-top: 3px; color: var(--theme-muted, #70808e); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tickets-table td:not(.ticket-subject) { overflow: hidden; color: var(--theme-text, #475966); text-overflow: ellipsis; white-space: nowrap; }
.customer-cell { overflow: visible !important; white-space: normal !important; }
.assignee-cell { font-size: 12px; }
.customer-menu { position: relative; display: inline-block; max-width: 100%; }
.customer-name { display: block; overflow: hidden; color: var(--theme-link, #1b5687); cursor: pointer; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.customer-menu:hover .customer-name, .customer-menu:focus-within .customer-name { text-decoration: underline; }
.customer-menu-popover { position: absolute; z-index: 10; top: 100%; right: 0; left: auto; display: none; width: 280px; max-width: calc(100vw - 32px); padding: 5px; border: 1px solid var(--theme-border, #b7cad9); border-radius: 6px; background: var(--theme-surface, #fff); box-shadow: 0 7px 18px rgba(31, 56, 80, .18); }
.customer-menu:hover .customer-menu-popover, .customer-menu:focus-within .customer-menu-popover { display: grid; }
.customer-menu-popover a, .customer-menu .customer-menu-popover button { display: block; width: 100%; margin: 0; padding: 7px 9px; border: 0; border-radius: 4px; color: var(--theme-link, #1b5687); background: transparent; font: inherit; font-size: 12px; font-weight: 700; text-align: left; text-decoration: none; white-space: normal; }
.customer-menu-popover a:hover, .customer-menu .customer-menu-popover button:hover { color: #fff; background: #176eae; }
.related-ticket-list { display: grid; gap: 3px; padding: 7px 9px; border-top: 1px solid var(--theme-border, #d6e0e8); color: var(--theme-link, #526b7d); font-size: 11px; }
.related-ticket-list > strong { color: var(--theme-link, #526b7d); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.customer-menu-popover .related-ticket-list a { display: grid; gap: 1px; padding: 5px 6px; color: var(--theme-link, #1b5687); font-size: 11px; font-weight: 600; }
.related-ticket-list a em, .related-ticket-list a small { color: var(--theme-link, #526b7d); font-size: 10px; font-style: normal; font-weight: 400; line-height: 1.25; }
.customer-menu-popover .related-ticket-list a:hover em, .customer-menu-popover .related-ticket-list a:hover small { color: #fff; }
.ticket-details-panel .customer-menu-popover { right: auto; left: 0; }
.marketplace-context-panel .customer-menu-popover { right: 0; left: auto; }
.conversation-row { display: block; padding: 14px 18px; border-bottom: 1px solid var(--theme-border, #edf0f3); color: inherit; text-decoration: none; }
.conversation-row:hover { background: var(--theme-surface, #f6f9fc); }
.conversation-row.selected { border-left: 3px solid #1677c8; padding-left: 15px; background: var(--theme-surface-raised, #eaf5ff); }
.conversation-row-top, .conversation-row-bottom, .message-meta { display: flex; justify-content: space-between; gap: 10px; }
.conversation-row-top time, .conversation-row-bottom, .message-meta { color: var(--theme-muted, #71808f); font-size: 12px; }
.conversation-title { margin-top: 6px; overflow: hidden; font-weight: 700; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--theme-muted, #607080); font-size: 13px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.conversation-row-bottom { margin-top: 9px; }
.unread { color: var(--theme-link, #075b9c); font-weight: 700; }
.marketplace-name { color: var(--theme-link, #27628f); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }

.conversation-details { display: flex; min-width: 0; min-height: 0; overflow: hidden; flex-direction: column; background: var(--theme-surface, #f6f8fa); }
.ticket-tabs { display: flex; flex: 0 0 auto; gap: 3px; min-height: 43px; overflow-x: auto; padding: 7px 12px 0; border-bottom: 1px solid var(--theme-border, #cbd7e1); background: var(--theme-surface, #fff); }
.ticket-tab { display: flex; flex: 0 0 155px; min-width: 0; align-items: center; gap: 5px; height: 35px; padding: 3px 5px 3px 7px; border: 1px solid var(--theme-border, #c6d4df); border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--theme-text, #405466); background: var(--theme-surface-raised, #edf2f6); font-size: 11px; }
.ticket-tab.active { position: relative; bottom: -1px; border-color: #176eae; border-bottom-color: var(--theme-border, #173f61); color: #fff; background: #173f61; font-weight: 700; box-shadow: inset 0 3px 0 #63b8f0; }
.ticket-tab a { display: flex; min-width: 0; overflow: hidden; flex: 1 1 auto; align-items: center; gap: 6px; color: inherit; text-decoration: none; }
.ticket-tab-source { display: grid; width: 31px; height: 22px; flex: 0 0 auto; place-items: center; border-radius: 3px; color: #475569; background: #e7ebef; font-size: 8px; font-weight: 900; letter-spacing: -.02em; }
.ticket-tab-source.amazon { color: #884522; background: #f8e6d8; }
.ticket-tab-source.ebay { color: #71551c; background: #f7efd2; }
.ticket-tab-source.walmart { color: #285782; background: #dfeaf5; }
.ticket-tab-source.google_voice { color: #65447e; background: #ece4f3; }
.ticket-tab-information { display: grid; min-width: 0; line-height: 1.05; }
.ticket-tab-information strong { font-size: 12px; }
.ticket-tab-status { overflow: hidden; margin-top: 2px; color: var(--theme-muted, #718596); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ticket-tab.active .ticket-tab-status { color: var(--theme-muted, #bbddf4); }
.ticket-tab button { display: grid; width: 21px; height: 21px; flex: 0 0 auto; place-items: center; margin: 0; padding: 0 0 1px; border: 0; border-radius: 4px; color: var(--theme-muted, #425a6e); background: var(--theme-surface-raised, #d5e0e8); font-size: 17px; font-weight: 700; line-height: 1; }
.ticket-tab.active button { color: var(--theme-muted, #d9ecf9); background: rgba(255, 255, 255, .16); }
.ticket-tabs button:hover { color: #fff; background: #c83d4b; }
.ticket-page-toolbar { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; height: 43px; padding: 0 20px; border-bottom: 1px solid var(--theme-border, #cbd7e1); color: var(--theme-text, #485b6d); background: var(--theme-surface, #fff); font-size: 13px; }
.back-to-queue { display: flex; width: fit-content; height: 29px; align-items: center; gap: 8px; padding: 0 9px 0 6px; border-radius: 4px; color: var(--theme-link, #195c90); background: var(--theme-surface-raised, #e9f4fd); font-size: 13px; font-weight: 700; line-height: 1; text-decoration: none; }
.back-to-queue > span:first-child { font-size: 21px; }
.back-to-queue:hover { color: #fff; background: #176eae; }
.ticket-content { display: grid; flex: 1 1 auto; min-height: 0; grid-template-columns: 245px minmax(500px, 1fr) 300px; background: var(--theme-surface, #f6f8fa); }
.ticket-side-panel { position: relative; z-index: 2; min-width: 0; overflow: visible; padding: 21px 18px; border-right: 1px solid var(--theme-border, #d9e1e8); background: var(--theme-surface, #fff); }
/* Let customer menus extend over the thread; only the history list should scroll/clip. */
.marketplace-context-panel { display: flex; min-height: 0; overflow: visible; flex-direction: column; border-right: 0; border-left: 1px solid var(--theme-border, #d9e1e8); }
.ticket-side-panel h2 { margin: 0 0 17px; color: var(--theme-text, #263b4e); font-size: 15px; }
.marketplace-context-disclaimer { margin: -7px 0 16px; color: var(--theme-muted, #687789); font-size: 12px; line-height: 1.45; }
.ticket-assignment-fields { display: grid; gap: 18px; }
.ticket-field { display: grid; gap: 7px; min-width: 0; }
.ticket-field-label { display: flex; align-items: center; justify-content: space-between; min-height: 16px; color: var(--theme-text, #405161); font-size: 12px; font-weight: 700; }
.ticket-customer-control { display: flex; min-width: 0; min-height: 34px; align-items: center; padding: 0 10px; border: 1px solid var(--theme-border, #aebfcd); border-radius: 4px; background: var(--theme-surface, #fff); }
.ticket-customer-menu { width: 100%; }
.ticket-customer-menu .customer-name { width: 100%; }
.muted-customer { color: var(--theme-muted, #71808f); }
.ticket-assignee-label { color: var(--theme-text, #405161); }
.ticket-detail-list { display: grid; gap: 5px; margin: 0; }
.ticket-meta-list { margin-top: 23px; padding-top: 17px; border-top: 1px solid var(--theme-border, #d9e1e8); }
.ticket-detail-list dt { margin-top: 11px; color: var(--theme-muted, #697b8b); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.ticket-detail-list dt:first-child { margin-top: 0; }
.ticket-detail-list dd { margin: 0; overflow-wrap: anywhere; color: var(--theme-text, #233e55); font-size: 13px; line-height: 1.35; }
.ticket-assignment-notice { margin: -7px 0 14px; padding: 8px 9px; border-radius: 5px; color: var(--theme-success-text, #155c3c); background: var(--theme-success-bg, #e9f8ef); font-size: 12px; line-height: 1.4; }
.take-ticket-form { display: inline; margin: 0; }
.ticket-assignee-label .take-ticket-form button:not(.link-button) { height: auto; margin: 0; padding: 0; border: 0; color: var(--theme-link, #17639b); background: transparent; font-size: 12px; font-weight: 700; line-height: 1.2; text-decoration: none; }
.ticket-assignee-label .take-ticket-form button:not(.link-button):hover { color: var(--theme-link, #0e5e98); background: transparent; text-decoration: underline; }
.assign-ticket-form { display: block; margin: 0; }
.assign-ticket-form select { min-width: 0; height: 34px; padding: 6px 31px 6px 8px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.25 6 6.5l5-5.25' fill='none' stroke='%23405261' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; background-size: 11px 8px; font-size: 13px; }
.ticket-thread-column { display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.details-heading { display: flex; flex: 0 0 auto; justify-content: space-between; gap: 16px; padding: 24px 30px; border-bottom: 1px solid var(--theme-border, #d9e1e8); background: var(--theme-surface, #f6f8fa); }
.readonly-status { height: fit-content; color: var(--theme-danger-text, #6e5608); background: var(--theme-warning-bg, #fff1c9); white-space: nowrap; }
.references { display: flex; flex: 0 0 auto; flex-direction: column; gap: 8px; align-items: stretch; padding: 0 0 17px; border-bottom: 1px solid var(--theme-border, #d9e1e8); background: transparent; }
.references h3 { margin: 0 0 2px; font-size: 13px; }
.odoo-order-context { padding: 17px 0; border-bottom: 1px solid var(--theme-border, #d9e1e8); }
.odoo-order-context > h3 { margin: 0; font-size: 13px; }
.odoo-order-context .marketplace-context-disclaimer { margin: 6px 0 12px; }
.odoo-order-details { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 6px 8px; margin: 0; font-size: 13px; }
.odoo-order-details dt { color: var(--theme-muted, #687789); }
.odoo-order-details dd { min-width: 0; margin: 0; color: var(--theme-text, #233e55); font-weight: 700; overflow-wrap: anywhere; }
.odoo-order-record + .odoo-order-record { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--theme-border, #d9e1e8); }
.odoo-order-record > h4:first-child { margin-top: 0; }
.odoo-order-context h4 { margin: 15px 0 8px; color: var(--theme-link, #526b80); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.odoo-delivery { display: grid; gap: 4px; margin-top: 8px; padding: 10px; border: 1px solid var(--theme-border, #d7e3ec); border-radius: 5px; color: var(--theme-muted, #4d6274); font-size: 12px; line-height: 1.35; }
.odoo-delivery strong { color: var(--theme-text, #233e55); font-size: 13px; }
.odoo-empty-state { margin: 0; color: var(--theme-muted, #687789); font-size: 12px; line-height: 1.45; }
.order-time-context { display: flex; flex-direction: column; gap: 8px; padding: 17px 0; border-bottom: 1px solid var(--theme-border, #d9e1e8); }
.order-time-context h3 { margin: 0; font-size: 13px; }
.order-time-context time { color: var(--theme-text, #233e55); font-size: 14px; font-weight: 700; }
.order-time-context label { color: var(--theme-muted, #697b8b); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.order-time-context select { padding: 7px 8px; font-size: 13px; }
.marketplace-detail-list { padding-top: 17px; }
.ticket-history { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--theme-border, #d9e1e8); }
.ticket-history > h3 { margin: 0; color: var(--theme-text, #263b4e); font-size: 13px; }
.ticket-history > p { margin: 5px 0 12px; color: var(--theme-muted, #687789); font-size: 12px; line-height: 1.4; }
.ticket-history-list { position: relative; display: grid; min-height: 0; overflow-y: auto; gap: 2px; padding-right: 5px; scrollbar-width: thin; scrollbar-color: var(--theme-border, #bdccd8) transparent; }
.ticket-history-list::-webkit-scrollbar { width: 5px; }
.ticket-history-list::-webkit-scrollbar-track { background: transparent; }
.ticket-history-list::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--theme-surface-raised, #bdccd8); }
.ticket-history-list::-webkit-scrollbar-thumb:hover { background: #91a9bb; }
.ticket-history-list::before { position: absolute; z-index: 0; top: 8px; bottom: 8px; left: 4px; width: 1px; background: var(--theme-surface-raised, #cdd9e3); content: ""; }
.ticket-history-item { position: relative; z-index: 1; display: flex; gap: 9px; min-width: 0; padding: 8px 7px 8px 0; border-radius: 5px; color: var(--theme-text, #223f55); text-decoration: none; }
.ticket-history-item:hover { background: var(--theme-surface-raised, #eef7fd); }
.ticket-history-item.current { background: var(--theme-surface-raised, #e4f1fb); }
.ticket-history-item > i { display: block; width: 9px; height: 9px; flex: 0 0 9px; margin-top: 4px; border-radius: 2px; background: #647786; }
.ticket-history-item.current > i { background: #176eae; }
.ticket-history-content { display: grid; min-width: 0; gap: 3px; }
.ticket-history-meta { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--theme-text, #3f5364); font-size: 11px; }
.ticket-history-meta strong { min-width: 0; color: var(--theme-text, #263b4e); font-size: 12px; }
.ticket-history-meta time { flex: 0 0 auto; color: var(--theme-muted, #687789); font-size: 11px; white-space: nowrap; }
.ticket-history-preview { display: -webkit-box; overflow: hidden; color: var(--theme-link, #516879); font-size: 12px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.ticket-history-item small { color: var(--theme-muted, #718391); font-size: 11px; }
.reference { display: grid; grid-template-columns: 60px minmax(0, 1fr) 18px; min-height: 38px; column-gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--theme-border, #c7d8e5); border-radius: 5px; background: var(--theme-surface, #f9fcff); font-size: 13px; line-height: 1.2; }
.reference-link { color: var(--theme-link, #185b8e); font-weight: 700; text-decoration: none; }
.reference-link:hover { border-color: #176eae; color: #fff; background: #176eae; }
.reference-link:hover span, .reference-link:hover strong, .reference-link:hover .reference-action { color: var(--theme-muted, #dbefff); }
.reference span { color: var(--theme-muted, #687789); white-space: nowrap; }
.reference strong { min-width: 0; color: var(--theme-text, #1d2c3a); font: inherit; font-weight: 700; text-align: left; overflow-wrap: anywhere; }
.reference-customer-menu { display: block; min-width: 0; }
.reference-customer-menu .customer-name { color: var(--theme-link, #1b5687); }
.reference-link strong, .reference-button strong { color: var(--theme-link, #185b8e); }
.reference-action { display: block; color: var(--theme-link, #3688c2); font-size: 16px; font-style: normal; text-align: right; }
.reference-button, button.reference-button:not(.link-button) { width: 100%; margin: 0; padding: 8px 10px; border: 1px solid var(--theme-border, #c7d8e5); border-radius: 5px; color: inherit; background: var(--theme-surface, #f9fcff); font-family: inherit; font-size: 13px; font-weight: 400; line-height: 1.2; cursor: pointer; text-align: left; }
.reference-button:hover, button.reference-button:not(.link-button):hover { border-color: #176eae; color: #fff; background: #176eae; }
.reference-button:hover span, .reference-button:hover strong, .reference-button:hover .reference-action { color: var(--theme-muted, #dbefff); }
.product-information-modal[hidden] { display: none; }
.product-information-modal { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(18, 37, 58, .42); }
.product-information-dialog { position: relative; width: min(560px, 100%); max-height: min(620px, calc(100vh - 40px)); overflow: auto; padding: 24px; border-radius: 8px; background: var(--theme-surface, #fff); box-shadow: 0 18px 48px rgba(10, 30, 50, .28); }
.product-information-dialog h2 { margin: 0 34px 4px 0; font-size: 20px; }
.product-information-close, button.product-information-close:not(.link-button) { position: absolute; top: 13px; right: 13px; display: block; width: 30px; height: 30px; margin: 0; padding: 0; border: 0; border-radius: 4px; color: transparent; background: #176eae; font-size: 0; cursor: pointer; }
.product-information-close:hover, button.product-information-close:not(.link-button):hover { color: #fff; background: #0e5e98; }
.product-information-close::before, .product-information-close::after { position: absolute; top: 14px; left: 7px; width: 16px; height: 2px; border-radius: 1px; background: var(--theme-surface, #fff); content: ""; }
.product-information-close::before { transform: rotate(45deg); }
.product-information-close::after { transform: rotate(-45deg); }
.product-information-sku { margin: 0 0 20px; color: var(--theme-muted, #687789); font-size: 14px; }
.product-information-content h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--theme-link, #526b80); }
.product-information-content h3:first-child { margin-top: 0; }
.product-information-content p { margin: 0; }
.product-information-content table { width: 100%; border-collapse: collapse; font-size: 14px; }
.product-information-content th, .product-information-content td { padding: 9px; border: 1px solid var(--theme-border, #d9e1e8); text-align: left; overflow-wrap: anywhere; }
.product-information-content th { color: var(--theme-link, #526b80); background: var(--theme-surface, #f3f7fa); font-size: 12px; }
.muted { color: var(--theme-muted, #71808f); font-size: 13px; }
.message-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 30px 26px; }
.message-thread > h2, .reply-composer h2 { margin: 0 0 14px; font-size: 15px; }
.message { max-width: 850px; margin: 0 0 16px; padding: 15px 17px; border: 1px solid var(--theme-border, #dbe3ea); border-radius: 8px; background: var(--theme-surface, #fff); box-shadow: 0 1px 1px rgba(13, 30, 50, .03); }
.message.outbound { margin-left: 7%; border-color: var(--theme-border, #c2e3d4); background: var(--theme-success-bg, #eefaf5); }
.message.internal { border-color: var(--theme-border, #f0d494); background: var(--theme-warning-bg, #fff9e8); }
.message-meta { align-items: center; padding-bottom: 9px; border-bottom: 1px solid rgba(97, 117, 135, .16); }
.message-meta strong { margin-right: auto; color: var(--theme-text, #304559); }
.message-body { padding-top: 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.original-email { margin-top: 14px; }
.original-email summary { width: fit-content; cursor: pointer; color: var(--theme-link, #17639b); font-size: 12px; font-weight: 700; }
.original-email iframe { width: 100%; height: min(680px, 62vh); margin-top: 10px; border: 1px solid var(--theme-border, #d6e0e8); background: var(--theme-surface, #fff); }
.reply-composer { flex: 0 0 auto; margin: 0; padding: 18px 30px; border-top: 1px solid var(--theme-border, #b7c8d6); background: var(--theme-surface, #fff); box-shadow: 0 -3px 10px rgba(25, 49, 72, .05); }
.composer-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.composer-heading p { margin: 0; color: var(--theme-muted, #6c7c8a); font-size: 13px; line-height: 1.45; }
.composer-heading > span { padding: 5px 8px; border-radius: 4px; color: var(--theme-link, #17639b); background: var(--theme-surface-raised, #e8f4fe); font-size: 12px; font-weight: 700; white-space: nowrap; }
.reply-composer textarea { width: 100%; min-height: 125px; margin-top: 16px; padding: 12px; resize: vertical; border: 1px solid var(--theme-border, #c8d4de); border-radius: 5px; color: var(--theme-muted, #72808c); background: var(--theme-surface, #f5f7f9); font: inherit; line-height: 1.5; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; color: var(--theme-muted, #71808e); font-size: 12px; }
.composer-actions button { margin-top: 0; }
.ticket-status-control { display: flex; align-items: center; gap: 8px; margin: 0; }
.ticket-status-control label { margin: 0; color: var(--theme-muted, #687789); font-size: 12px; font-weight: 700; white-space: nowrap; }
.ticket-status-control select { width: 130px; height: 34px; padding: 6px 31px 6px 8px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.25 6 6.5l5-5.25' fill='none' stroke='%23405261' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; background-size: 11px 8px; font-size: 13px; }
.ticket-tabs .ticket-tab > button {
    display: inline-flex !important;
    width: 21px !important;
    height: 21px !important;
    align-self: center;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.queue-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--theme-muted, #536778); font-size: 13px; }
.queue-pagination a { padding: 7px 10px; border: 1px solid var(--theme-border, #bcd0df); border-radius: 4px; color: var(--theme-link, #17639b); background: var(--theme-surface, #fff); font-weight: 700; text-decoration: none; }
.queue-pagination a:hover { color: #fff; background: #176eae; }
.page-numbers { display: inline-flex; align-items: center; gap: 3px; }
.page-summary { margin-right: 4px; color: var(--theme-muted, #536778); font-weight: 700; white-space: nowrap; }
.queue-pagination .page-number { min-width: 32px; padding: 7px 8px; text-align: center; }
.queue-pagination .page-number.current { min-width: 32px; padding: 8px; border-radius: 4px; color: #fff; background: #173f61; font-weight: 800; text-align: center; }
.page-jump { display: inline-flex; align-items: center; gap: 6px; margin-left: 7px; }
.page-jump label { margin: 0; color: var(--theme-muted, #536778); font-size: 12px; white-space: nowrap; }
.page-jump input[type="number"] { width: 64px; padding: 7px 8px; font-size: 13px; }
.page-jump button { margin: 0; padding: 8px 10px; font-size: 12px; }
button:disabled { cursor: not-allowed; opacity: .52; }
.empty-state { margin: 24px; padding: 25px; border: 1px dashed var(--theme-border, #c9d4de); border-radius: 8px; color: var(--theme-muted, #697786); font-size: 14px; text-align: center; }
.empty-state.center { margin: 120px auto; max-width: 440px; background: var(--theme-surface, #fff); }

.account-page { display: grid; min-width: 0; min-height: 100vh; place-items: center; padding: 24px; background: var(--theme-surface-raised, #eaf0f5); }
.account-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--theme-border, #d7e0e8); border-radius: 10px; background: var(--theme-surface, #fff); box-shadow: 0 12px 36px rgba(24, 44, 70, .11); }
.brand.dark { color: var(--theme-text, #172b4d); }
.account-card h1 { margin: 26px 0 8px; font-size: 24px; }
.account-card p { margin: 0 0 24px; color: var(--theme-muted, #687889); font-size: 14px; line-height: 1.5; }
.account-card form, .admin-card form { display: grid; gap: 8px; }
label { margin-top: 8px; color: var(--theme-text, #405161); font-size: 13px; font-weight: 700; }
input, select { width: 100%; padding: 10px 11px; border: 1px solid var(--theme-border, #bcc9d4); border-radius: 5px; color: var(--theme-text, #1d2c3a); background: var(--theme-surface, #fff); font: inherit; }
input:focus, select:focus { outline: 2px solid var(--theme-border, #9dcbf3); border-color: #1976bf; }
button:not(.link-button) { margin-top: 12px; padding: 11px 14px; border: 0; border-radius: 5px; color: #fff; background: #176eae; font: inherit; font-weight: 700; cursor: pointer; }
button:not(.link-button):hover { background: #0e5e98; }
.account-notice, .validation-message, .success-message { margin: 0 0 18px; padding: 10px 12px; border-radius: 5px; font-size: 13px; line-height: 1.4; }
.account-notice { color: var(--theme-danger-text, #604b00); background: var(--theme-warning-bg, #fff5d6); }
.validation-message { color: var(--theme-danger-text, #9f2830); background: var(--theme-surface-raised, #fff0f1); }
.validation-message:empty { display: none; }

.admin-page { min-width: 0; background: var(--theme-surface, #f4f7fa); }
.password-card { max-width: 520px; }
.password-generator { display: grid; gap: 7px; margin-top: 10px; }
.secondary-button { width: fit-content; margin: 0; padding: 7px 9px; border: 1px solid var(--theme-border, #aebfcd); border-radius: 4px; color: var(--theme-link, #1b5687); background: var(--theme-surface, #f9fcff); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.secondary-button:hover { color: #fff; border-color: #176eae; background: #176eae; }
.generated-password { display: flex; min-height: 34px; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--theme-border, #c7d8e5); border-radius: 4px; background: var(--theme-surface, #f3f8fc); color: var(--theme-text, #405161); font-size: 12px; }
.generated-password code { flex: 1; min-width: 0; color: var(--theme-text, #153e62); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.generated-password .secondary-button { flex: 0 0 auto; }
.admin-content { max-width: 1180px; margin: 0 auto; padding: 36px 28px; }
.admin-heading h1 { margin: 0; font-size: 25px; }
.admin-heading p { margin: 7px 0 28px; color: var(--theme-muted, #6d7b89); }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 350px) minmax(480px, 1fr); gap: 22px; align-items: start; }
.admin-card { padding: 24px; border: 1px solid var(--theme-border, #d7e0e8); border-radius: 8px; background: var(--theme-surface, #fff); }
.admin-card h2 { margin: 0 0 16px; font-size: 17px; }
.maintenance-card { margin-top: 22px; }
.maintenance-card > p { max-width: 760px; margin: -6px 0 16px; color: var(--theme-muted, #687889); font-size: 13px; line-height: 1.5; }
.maintenance-card code { padding: 1px 4px; border-radius: 3px; color: var(--theme-text, #40576c); background: var(--theme-surface-raised, #edf2f6); }
.account-checkboxes { display: flex; flex-wrap: wrap; gap: 16px; }
.account-checkboxes label { display: flex; gap: 7px; align-items: center; margin: 0; font-weight: 400; }
.account-checkboxes input { width: 15px; height: 15px; padding: 0; }
.sync-result { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--theme-border, #e1e7ed); }
.sync-result > p { margin: 0 0 10px; color: var(--theme-muted, #687889); font-size: 13px; }
.synchronization-progress { margin: 10px 0 0; color: var(--theme-link, #17639b); font-size: 13px; font-weight: 700; }
.success-message { color: var(--theme-success-text, #155c3c); background: var(--theme-success-bg, #e9f8ef); }
.users-table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 8px; border-bottom: 1px solid var(--theme-border, #e1e7ed); text-align: left; }
th { color: var(--theme-muted, #637282); font-size: 12px; text-transform: uppercase; }
.access-status { display: inline-block; padding: 4px 7px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.access-status.active { color: var(--theme-success-text, #155c3c); background: var(--theme-success-bg, #e8f7ef); }
.access-status.closed { color: var(--theme-danger-text, #81500a); background: var(--theme-warning-bg, #fff0cf); }
.user-actions { min-width: 190px; }
.user-actions-content { display: flex; gap: 7px; align-items: center; }
.user-actions-content form { display: inline; }
.user-actions button { margin: 0; padding: 7px 9px; font-size: 12px; white-space: nowrap; }
.user-actions .access-button { background: #6e7d8b; }
.user-actions .access-button:hover { background: #566674; }
.user-actions .delete-button { background: #bd3943; }
.user-actions .delete-button:hover { background: #9c2731; }
.ticket-tabs .ticket-tab > button {
    display: inline-flex !important;
    width: 21px !important;
    height: 21px !important;
    align-self: center;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.message-image-link {
    display: block;
    border-radius: 0.6rem;
    overflow: hidden;
    background: var(--theme-surface, #f4f5f7);
    cursor: zoom-in;
}

.message-image {
    display: block;
    width: min(18rem, 100%);
    max-height: 20rem;
    object-fit: contain;
}

.message-attachment-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--theme-border, #d8dde5);
    border-radius: 0.5rem;
}

body.image-viewer-open {
    overflow: hidden;
}

.image-viewer[hidden] {
    display: none;
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3.5rem;
    background: rgba(8, 12, 20, 0.94);
    user-select: none;
    cursor: grab;
    touch-action: none;
}

.image-viewer.dragging {
    cursor: grabbing;
}

.image-viewer-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
}

.image-viewer-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.image-viewer-close:hover,
.image-viewer-close:focus-visible {
    background: rgba(180, 28, 28, 0.9);
    outline: 2px solid var(--theme-border, #fff);
}
.generated-password[hidden] { display: none; }
