/* -----------------------------------------------------------------------------------
 * Originally found at https://userstyles.org/styles/139070/osticket-dark-theme
 * Modifications by Privex Inc. — https://github.com/Privex/osticket-dark
 * Palette: bg/header #222526, inputs #3e4346, borders rgb(72,78,81),
 *          active sub_nav li rgb(31,63,94); priority high/emergency #3f0303,
 *          normal #2d2d00, low #124700
 * -----------------------------------------------------------------------------------
 */

:root {
  --ost-bg: #222526;
  --ost-input: #3e4346;
  --ost-border: rgb(72, 78, 81);
  --ost-border-th: rgb(72, 78, 81);
  --ost-subnav-active: rgb(31, 63, 94);
  --ost-text: #bcbcbc;
  --ost-text-bright: #e0e0e0;
  --ost-accent: #e0b400;
  --ost-unread: #e74c3c;
  --ost-prio-high: #3f0303;
  --ost-prio-normal: #2d2d00;
  --ost-prio-low: #124700;
}

body, html {
  background: var(--ost-bg);
  color: var(--ost-text);
}

.type-icon {
  background-color: var(--ost-bg);
}

.thread-event .type-icon::after {
  border: 16px solid var(--ost-bg);
}

.dialog {
  background: var(--ost-bg);
  border: 2px solid var(--ost-accent);
}

.dialog th {
  background: var(--ost-bg);
}

.thread-body {
  color: var(--ost-text);
  background-color: var(--ost-bg);
}

/* Remove stock white top/bottom separators on thread entries */
.thread-entry::before,
.thread-entry::after {
  border: none !important;
  content: none !important;
  display: none !important;
}

.thread-entry .faded.title {
  color: #a06060;
}

/* Ticket thread headers: message (was blue #C3D9FF), response (was #FFE0B3) */
.thread-entry.message .header,
div.thread-entry.message .header {
  background: #292c2e !important;
  color: #ffffff !important;
}

.thread-entry.response .header,
div.thread-entry.response .header {
  background: rgb(97, 57, 0) !important;
  color: #ffffff !important;
}

.thread-entry.note .header,
div.thread-entry.note .header {
  background: #292c2e !important;
  color: #ffffff !important;
}

.thread-entry .header time,
.thread-entry .header .textra,
.thread-entry .header .textra.light,
.thread-entry .header a time {
  color: #ffffff !important;
}

.thread-entry.message .header > b,
.thread-entry.response .header > b,
.thread-entry.note .header > b,
div.thread-entry.message .header > b,
div.thread-entry.response .header > b {
  color: #ffffff !important;
}

/* Avatar carets match header backgrounds */
.thread-entry.avatar.message .header:before {
  border-left-color: #292c2e !important;
}

.thread-entry.avatar.message .header:after {
  border-left-color: #292c2e !important;
}

.thread-entry.avatar.response .header:before {
  border-right-color: rgb(97, 57, 0) !important;
}

.thread-entry.avatar.response .header:after {
  border-right-color: rgb(97, 57, 0) !important;
}

.thread-entry.avatar.note .header:before,
.thread-entry.avatar.note .header:after {
  border-right-color: #292c2e !important;
}

.ticket_info,
.tip_content,
.sticky.bar.fixed,
#ticket_actions,
.sticky.bar,
.pull-right.flush-right {
  background: var(--ost-bg);
}

.tixTitle h3 {
  color: var(--ost-text);
}

.ticket_info.custom-data thead th {
  background-color: var(--ost-bg);
}

ul.tabs.clean li.active,
ul.tabs {
  background-color: var(--ost-bg);
}

ul.tabs li.active {
  color: var(--ost-text);
  background-color: var(--ost-input);
}

ul.tabs li.active a {
  color: var(--ost-text);
}

/* ---- Tables ---- */

table {
  border-collapse: collapse;
}

table.list {
  background-color: var(--ost-bg);
  border: 1px solid var(--ost-border);
}

table.list thead th {
  background-color: var(--ost-bg);
  color: var(--ost-text);
  border: 1px solid var(--ost-border-th);
}

table.list thead th a {
  color: var(--ost-text);
}

table.list thead th a.asc,
table.list thead th a.desc {
  background-color: var(--ost-input);
}

table.list tbody td {
  background: var(--ost-bg);
  color: var(--ost-text);
  border: 1px solid var(--ost-border);
}

table.list tbody tr:nth-child(2n+1) td {
  background-color: var(--ost-bg);
}

table.list tbody tr:hover td,
table.list tbody tr.highlight td,
table.list tbody tr:nth-child(2n+1):hover td {
  background: var(--ost-input);
  color: var(--ost-text-bright);
}

table tfoot td {
  background: var(--ost-bg);
  border: 1px solid var(--ost-border);
}

table.dashboard-stats tbody:nth-child(2) tr:hover,
table.dashboard-stats tbody:nth-child(2) tr:nth-child(odd) {
  background-color: var(--ost-input);
}

/* Tickets queue: never wrap cell text */
table.list.queue.tickets th,
table.list.queue.tickets td,
table.list.queue.tickets td > div,
table.list.queue.tickets td .truncate {
  text-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Unread / unanswered ticket numbers */
table.list.queue.tickets tbody td[style*="font-weight"] a.preview,
table.list.queue.tickets tbody td[style*="font-weight"] > div a.preview {
  color: var(--ost-unread) !important;
  font-weight: bold;
}

/* Priority cells: center + light text on dark priority colors */
table.list.queue tbody td[style*="background-color"],
table.list.queue tbody td[style*="background-color"] > div {
  text-align: center !important;
  vertical-align: middle !important;
  color: var(--ost-text-bright) !important;
}

/* Priority cells in ticket lists: osTicket inlines ost_ticket_priority.priority_color
   (normal #FFFFF0, low #DDFFDD, high/emergency #FEE7E7) on both the td and its div. */
table.list.queue tbody td[style*="FFFFF0" i],
table.list.queue tbody td[style*="FFFFF0" i] > div {
  background-color: #2A2E30 !important;
}

table.list.queue tbody td[style*="DDFFDD" i],
table.list.queue tbody td[style*="DDFFDD" i] > div {
  background-color: var(--ost-prio-low) !important;
}

table.list.queue tbody td[style*="FEE7E7" i],
table.list.queue tbody td[style*="FEE7E7" i] > div {
  background-color: var(--ost-prio-high) !important;
}

.priority.low {
  color: #b3ffa3;
  background-color: var(--ost-prio-low) !important;
}

.priority.normal {
  color: #e0e080;
  background-color: var(--ost-prio-normal) !important;
}

.priority.high,
.priority.emergency {
  color: #ffb0b0;
  background-color: var(--ost-prio-high) !important;
}

/* ---- Chrome / layout ---- */

#header {
  background-color: var(--ost-bg);
  border-left: 1px solid var(--ost-border-th);
  border-right: 1px solid var(--ost-border-th);
  border-top: 1px solid var(--ost-border-th);
}

/* Welcome line — keep stock light border; do not dark-theme it */
#header p,
#info {
  background: var(--ost-bg);
}

#container {
  margin: 15px auto 20px auto !important;
}

#basic_search,
#nav,
#content {
  background: var(--ost-bg);
}

#content {
  border: 1px solid var(--ost-border);
}

/* Top nav + sub_nav share th border color */
#nav,
#sub_nav {
  background: var(--ost-bg);
  border-left: 1px solid var(--ost-border-th);
  border-right: 1px solid var(--ost-border-th);
}

#nav {
  border-top: 1px solid var(--ost-border-th);
  border-bottom: 1px solid var(--ost-border-th);
}

#sub_nav {
  border-bottom: 1px solid var(--ost-border-th);
}

/* Stock sets #sub_nav > li > a { color:#000 } — force white */
#sub_nav a,
#sub_nav > li > a,
#customQ_nav .jb-overflowmenu-menu-primary li.item > a {
  color: #ffffff !important;
}

#sub_nav > li > a:hover,
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover > a {
  color: #ffffff !important;
  text-decoration: none;
}

/* Hovered sub_nav item matches dropdown panel bg; keep icon background-image */
#sub_nav > li:hover > a,
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover {
  background-color: var(--ost-bg) !important;
  border-color: var(--ost-border-th) !important;
  color: #ffffff !important;
}

/* Active subheader queue tab */
#sub_nav > li.active,
#sub_nav > li.active > a,
#sub_nav a.active,
#sub_nav li.active > a,
#sub_nav li.child.active > a,
#customQ_nav .jb-overflowmenu-menu-primary li.item.active,
#customQ_nav .jb-overflowmenu-menu-primary li.item > a.active {
  background-color: var(--ost-subnav-active) !important;
  border-color: var(--ost-subnav-active) !important;
  color: #ffffff !important;
}

#nav .active a,
#nav .inactive a,
#nav .active,
#nav .inactive {
  color: var(--ost-accent);
}

#nav li.active,
#nav li.inactive:hover {
  background-color: var(--ost-bg);
  border-color: var(--ost-border-th);
}

/* Staff nav dropdown menus */
#nav li.inactive > ul {
  background-color: var(--ost-bg);
  border: 1px solid var(--ost-border-th);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

#nav .inactive li {
  background-color: var(--ost-bg);
}

#nav .inactive li a {
  color: var(--ost-text);
  /* keep stock background-image icons — do not use background shorthand */
  background-position: 10px 50%;
  background-repeat: no-repeat;
}

#nav .inactive li a:hover {
  background-color: var(--ost-bg);
  color: var(--ost-accent);
}

/* Custom queue dropdown (1.17+) */
.customQ-dropdown,
.customQ-dropdown ul,
#customQ_nav ul li.item div.customQ-dropdown {
  background: var(--ost-bg) !important;
  color: var(--ost-text) !important;
  border-color: var(--ost-border-th) !important;
}

.customQ-dropdown * {
  color: inherit;
}

.customQ-dropdown li h4,
.customQ-dropdown li.top-level {
  background-color: var(--ost-input) !important;
  color: var(--ost-text) !important;
  border-color: var(--ost-border-th) !important;
}

.customQ-dropdown li.personalQ {
  border-bottom: 2px dashed var(--ost-border) !important;
  background-color: var(--ost-bg) !important;
}

.customQ-dropdown a,
.customQ-dropdown a.truncate {
  color: var(--ost-accent) !important;
}

.customQ-dropdown a:hover {
  background-color: var(--ost-bg) !important;
}

.customQ-dropdown li:not(.personalQ) > span {
  color: var(--ost-accent) !important;
}

a,
.dialog a,
h2,
.dialog h3,
.link,
.link.truncate {
  color: var(--ost-accent);
}

.action-button,
.action-button.muted,
.button {
  color: var(--ost-accent);
  box-shadow: 0 0 0 1px var(--ost-accent) inset;
}

.green.button:hover {
  box-shadow: 0 0 0 2px #16ab39 inset;
  color: #16ab39;
}

.button:hover,
.button:active,
.action-button:hover,
.action-button:active,
input[type=button]:hover,
input[type=button]:active,
input[type=reset]:hover,
input[type=reset]:active {
  color: var(--ost-accent);
  box-shadow: 0 0 0 2px var(--ost-accent) inset;
}

.quicknote a.action,
.floating-options a.action {
  color: var(--ost-accent) !important;
}

button[type=submit]:hover,
input[type=submit]:hover,
input[type=submit]:active {
  color: #16ab39;
  box-shadow: 0 0 0 2px #16ab39 inset;
}

/* ---- Forms / inputs ---- */

.form_table,
.has_bottom_border,
#response_options > form {
  background: var(--ost-bg);
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.form_table th,
div.section-break {
  background: var(--ost-bg);
  color: var(--ost-text);
  padding: 8px 10px;
  vertical-align: top;
  width: 20%;
  min-width: 140px;
  font-weight: 600;
  border-color: var(--ost-border);
}

.form_table td {
  background: var(--ost-bg);
  color: var(--ost-text);
  padding: 8px 10px;
  vertical-align: middle;
  border-color: var(--ost-border);
}

.form_table th label,
.form_table label,
label {
  color: var(--ost-text);
}

.form_table th em {
  color: #9a9a9a;
  display: block;
  margin-top: 4px;
  font-weight: normal;
}

.form_table td .error,
.form_table .error {
  color: #ff6b6b;
}

#content .form_table + .form_table,
#content form .form_table {
  margin-bottom: 12px;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=search],
textarea,
select,
input {
  background: var(--ost-input);
  color: var(--ost-text-bright);
  border: 1px solid var(--ost-border-th);
}

input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
textarea:focus,
select:focus {
  background: #4a5054;
  color: var(--ost-text-bright);
  border-color: var(--ost-accent);
  outline: none;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: var(--ost-input) !important;
  color: var(--ost-text-bright) !important;
  border-color: var(--ost-border-th) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ost-text-bright) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--ost-text) transparent transparent transparent;
}

.select2-dropdown,
.select2-container--default .select2-results > .select2-results__options {
  background-color: var(--ost-bg) !important;
  color: var(--ost-text) !important;
  border: 1px solid var(--ost-border-th) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--ost-input) !important;
  color: var(--ost-accent) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--ost-input);
  color: var(--ost-text-bright);
  border: 1px solid var(--ost-border-th);
}

/* ---- Misc ---- */

/* Redactor — stock redactor.css uses light backgrounds; force dark with !important */
.redactor-editor,
.redactor-box,
.redactor-box.redactor-styles-on,
.redactor-box textarea,
.redactor-in,
.redactor-toolbar-wrapper,
.redactor-toolbar,
.redactor-air,
.redactor-statusbar,
.redactor-source,
.redactor-box .redactor-toolbar {
  background: var(--ost-input) !important;
  background-color: var(--ost-input) !important;
  color: var(--ost-text-bright) !important;
  border-color: var(--ost-border) !important;
}

.redactor-toolbar,
.redactor-air,
.redactor-toolbar-wrapper,
.redactor-box.redactor-styles-on .redactor-toolbar {
  background: var(--ost-bg) !important;
  background-color: var(--ost-bg) !important;
}

.redactor-statusbar {
  background: var(--ost-bg) !important;
  background-color: var(--ost-bg) !important;
  color: var(--ost-text) !important;
}

.redactor-statusbar li,
.redactor-statusbar a {
  color: var(--ost-text) !important;
  border-color: var(--ost-border) !important;
}

.redactor-statusbar a:hover {
  color: var(--ost-accent) !important;
}

.redactor-toolbar a,
.redactor-air a,
.redactor-toolbar a.re-button-icon,
.redactor-air a.re-button-icon {
  color: var(--ost-accent) !important;
  background: transparent !important;
  background-color: transparent !important;
}

.redactor-toolbar a:hover,
.redactor-air a:hover,
.redactor-toolbar a.redactor-button-active,
.redactor-air a.redactor-button-active {
  background: var(--ost-input) !important;
  background-color: var(--ost-input) !important;
  color: var(--ost-accent) !important;
}

.redactor-in,
.redactor-editor {
  color: var(--ost-text-bright) !important;
}

.redactor-focus.redactor-styles-on,
.redactor-focus:focus.redactor-styles-on {
  border-color: var(--ost-accent) !important;
}

.faded,
.faded b,
.faded-more {
  color: var(--ost-text);
}

.faded strong {
  color: #16ab39;
}

.thread-body .attachments {
  background-color: var(--ost-bg);
}

#error_bar,
#warning_bar,
#notice_bar,
#msg_warning,
.warning-banner,
#msg_notice,
#msg_info {
  background-color: var(--ost-bg);
  color: var(--ost-text);
}

.pjax,
.flush-left,
.ticket_info.custom-data {
  background: transparent;
}

div.tip_box {
  background: var(--ost-bg);
  color: var(--ost-text);
  border-color: var(--ost-border-th);
}

#resp_sec div.selected-signature {
  background: #111;
  color: #fff;
}

/* Remap leftover stock light borders (#fff / #aaa / #ddd / #ccc / #bebebe / #999).
   Intentionally excludes #info / #header p (welcome banner). */
#header,
#nav,
#sub_nav,
#content,
#basic_search,
#ticket_actions,
#response_options > form,
#bar,
#basic-ticket-search,
a.refresh,
a.edit,
a.print,
.search input[type=text],
table.list,
table.list thead th,
table.list tbody td,
table.list tbody th,
table.dashboard-stats,
table.dashboard-stats tbody th,
table.dashboard-stats tbody td,
.form_table,
.form_table td,
.form_table th,
div.section-break,
.settings_table,
.settings_table td,
.has_bottom_border,
.ticket_info.custom-data thead th,
.thread-entry .header,
.thread-entry .thread-body,
.thread-body .attachments,
.thread-preview-entry .header,
.thread-preview-entry .thread-body,
.thread-preview-entry.collapsed .thread-body,
ul.tabs,
ul.tabs li,
ul.tabs li.active,
ul.tabs.vertical,
ul.tabs.vertical li,
ul.tabs.vertical li.active,
ul.tabs.alt,
.tip_box,
.tip_content .links,
.tip_menu,
.tip_menu li a,
.tip_content textarea,
.tip_content h1,
#kb li,
#faq ol li,
.dialog fieldset input:not([type=checkbox]),
.button.attached,
.input.attached input,
div.selected-signature,
.muted-button:hover,
.quicknote a.action,
.floating-options a.action,
.label-bare,
.accordian dt,
.accordian dd,
.freetext-files,
.saved-search + .saved-search,
.secondary_lang,
.customQ-dropdown,
.customQ-dropdown ul.scroll-height,
.customQ-dropdown ul li.subQ > ul,
.jb-overflowmenu-menu-primary div.customQ-dropdown,
.jb-overflowmenu-menu-secondary,
.jb-overflowmenu-menu-secondary li.item,
.jb-overflowmenu-menu-secondary div.customQ-dropdown,
.jb-overflowmenu .jb-overflowmenu-container,
.jb-overflowmenu .jb-overflowmenu-container > a.jb-overflowmenu-menu-secondary-handle,
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover,
#nav li.inactive > ul {
  border-color: var(--ost-border);
}

/* Re-assert accent/focus borders after the light-border remap */
input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
textarea:focus,
select:focus {
  border-color: var(--ost-accent);
}


#thread-items::before,
.advanced-search .adv-search-method:before,
.advanced-search .adv-search-val:before {
  border-color: var(--ost-border);
}

/* Preserve #info welcome banner border (stock #ccc) */
#header p#info,
#info {
  border-color: #ccc;
}

/* --- Adiciones locales (WireBot): login del panel de agentes (scp/css/login.css) --- */
body, #background { background-color: #1a1c1d !important; }
#loginBox { background: #222526 !important; color: #d6d6d6; box-shadow: 0 0 20px rgba(0,0,0,.6); }
#loginBox:after { background-color: rgba(34,37,38,0.85) !important; }
#loginBox h3, #loginBox label, #loginBox a { color: #d6d6d6; }
#loginBox fieldset input { background: #3e4346 !important; color: #e4e4e4 !important; border-color: rgb(72,78,81) !important; }
#loginBox .button { background: #2d3a46 !important; color: #e4e4e4 !important; border-color: rgb(72,78,81) !important; }
#loginBox .button:hover { background: rgb(31,63,94) !important; }
#loginBox div.banner { color: #9a9a9a; }

/* --- Adiciones locales (WireBot): tablas `.table` (Mi perfil: Cuenta/Preferencias/Firma, Autenticación, Estado) ---
   scp.css pinta `.table td:not(:empty)` de blanco y separa filas con #ddd; el tema upstream solo cubre `.form_table`. */
.table,
.table td,
.table td:not(:empty),
.table th {
  background-color: var(--ost-bg);
  color: var(--ost-text);
}
.table tr:not(:last-child):not(.header) { border-bottom-color: var(--ost-border); }
.table tr.header th,
.table > thead th { color: var(--ost-text-bright); }
.table input[disabled],
.table input[readonly],
.table select[disabled] { background: #2d3033 !important; color: #8f8f8f !important; border-color: var(--ost-border) !important; }

/* --- Adiciones locales (WireBot): fondo del login de agentes = mismo archivo que el portal de clientes ---
   login.css lo toma de ../logo.php?backdrop (imagen guardada en la base, se cambia desde el panel); acá se pisa con
   osticket-theme/images/fondo-portal.jpeg para tener una sola imagen. Al reemplazar el archivo, subir el ?v= de la URL. */
#background, #brickwall { background-image: url('/images/fondo-portal.jpeg?v=2') !important; }
