/* ==========================================================================
   Dizisavvy Support — modern client portal theme for osTicket 1.18
   Loaded after theme.css. Change the brand in the :root block below.
   ========================================================================== */

:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --accent: #06b6d4;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0369a1;
  --info-bg: #f0f9ff;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px -8px rgba(16, 24, 40, .10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #818cf8;
    --brand-600: #a5b4fc;
    --brand-50: rgba(129, 140, 248, .14);
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, .12);
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, .12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, .12);
    --info: #38bdf8;
    --info-bg: rgba(56, 189, 248, .12);
    --bg: #0b0d14;
    --surface: #131622;
    --surface-2: #181c2b;
    --border: #262b3d;
    --text: #f3f4f6;
    --text-2: #c4c8d4;
    --text-3: #8d93a5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 12px 32px -12px rgba(0, 0, 0, .6);
  }
  img[src*="logo.php"] { filter: brightness(1.1); }
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 400px at 85% -120px, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    radial-gradient(700px 360px at 0% -100px, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body, input, select, textarea, .button, button { font-family: var(--font); color: var(--text); }
::selection { background: var(--brand); color: #fff; }

a, .link { color: var(--brand); transition: color .15s; }
a:hover, .link:hover { color: var(--brand-600); border-bottom: 0; margin-bottom: 1px; }

h1 { color: var(--text); font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 8px; }
h2, .subject { color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 600; color: var(--text); }
h1 + p { color: var(--text-2); margin: 0 0 24px; }
.faded { color: var(--text-3); }
hr { border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- Layout ---------- */
#container {
  width: auto;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
}

#header {
  height: auto;
  padding: 20px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row-reverse;
  gap: 16px;
}
#header #logo { float: none; height: auto; display: flex; align-items: center; }
#header #logo img { max-height: 44px; max-width: 220px; }
#header .valign-helper { display: none; }
#header .pull-right { float: none; }
#header p { width: auto; padding: 0; margin: 0; font-size: 13px; color: var(--text-3); }
#header p a { color: var(--text-2); font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm); }
#header p a:hover { background: var(--brand-50); color: var(--brand); }
#header p a[href*="login.php"] { background: var(--brand); color: #fff; padding: 7px 16px; }
#header p a[href*="login.php"]:hover { background: var(--brand-600); color: #fff; }
#header p:empty { display: none; }
#container > hr { display: none; }

/* Navigation */
#nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  height: auto;
  margin: 12px 0 0;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
#nav li { display: block; }
#nav li a {
  height: auto;
  line-height: 1.2;
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background-image: none !important;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}
#nav li a:hover { background: var(--surface-2); color: var(--text); }
#nav li a.active, #nav li a.active:hover { background: var(--brand-50); color: var(--brand); font-weight: 600; }

#content {
  margin: 0;
  padding: 32px 0 48px;
  min-height: 400px;
}

/* Footer */
#footer { padding: 24px 0 36px; color: var(--text-3); font-size: 13px; }
#footer a { color: var(--text-3); }
#footer p { margin: 0 0 6px; }
#footer #poweredBy { display: none; }

/* ---------- Alerts ---------- */
#msg_notice, #msg_warning, #msg_error, #msg_info, .warning-banner,
.notice_bar, .warning_bar, .error_bar {
  height: auto;
  line-height: 1.5;
  padding: 12px 16px;
  margin: 0 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  background-image: none;
  font-size: 14px;
}
#msg_notice, .notice_bar { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
#msg_warning, .warning-banner, .warning_bar { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
#msg_error, .error_bar { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
#msg_info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.notice_bar, .warning_bar, .error_bar { border-width: 0 0 1px; border-radius: 0; text-align: center; }
.error, font.error { color: var(--danger); }

/* ---------- Buttons ---------- */
.button, .button:visited,
input[type=submit], input[type=reset], input[type=button], button.button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  max-width: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  text-shadow: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.button:hover, input[type=submit]:hover, button.button:hover, .btn:hover {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--brand) 45%, transparent);
  border-bottom: 1px solid transparent;
}
.button:active, input[type=submit]:active { transform: translateY(1px); top: 0; box-shadow: none; }
.green.button, .green.button:visited { background: var(--brand); }
.green.button:hover { background: var(--brand-600); }
.blue.button, .blue.button:visited { background: var(--brand); }
.blue.button:hover { background: var(--brand-600); }
input[type=reset], input[type=button] {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}
input[type=reset]:hover, input[type=button]:hover {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
}
.action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-2) !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.action-button:hover { background: var(--surface-2); color: var(--text) !important; border-bottom: 1px solid var(--border); }
.action-button span, .action-button a { float: none; color: inherit !important; }

/* ---------- Inputs ---------- */
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number],
input[type=search], input[type=url], input:not([type]), select, textarea,
#ticketForm div input, #clientLogin div input, #reply input[type=text] {
  box-sizing: border-box;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
select { padding-right: 32px; }
input[type=file] { padding: 8px 0; box-shadow: none; border: 0 !important; background: transparent !important; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; vertical-align: middle; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
::placeholder { color: var(--text-3); opacity: 1; }
.error input, .error textarea, #ticketForm div.error input { border-color: var(--danger); }
label { font-weight: 500; color: var(--text); }
label.required, span.required { font-weight: 600; }
em { font-style: normal; }
#ticketForm em, #clientLogin em { color: var(--text-3); font-size: 13px; }

/* ---------- Landing page ---------- */
#landing_page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}
#landing_page > .sidebar { grid-column: 2; grid-row: 1; float: none; width: auto; margin: 0; }
#landing_page > .main-content { grid-column: 1; grid-row: 1; width: auto; }
#landing_page > .clear { display: none; }
#landing_page > div:not(.sidebar):not(.main-content) { grid-column: 1 / -1; }
#landing_page .search-form { padding: 0 0 24px; }
#landing_page .search-form form { display: flex; gap: 10px; }
.search-form .search, .searchbar .search {
  flex: 1;
  width: auto;
  padding: 14px 18px 14px 46px;
  font-size: 16px;
  border-radius: var(--radius);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 16px 50% no-repeat;
  box-shadow: var(--shadow);
}
.search-form button.button { padding: 0 24px; border-radius: var(--radius); }
#landing_page .thread-body, .main-content .thread-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
}
.main-content .thread-body h1, .main-content .thread-body h2, .main-content .thread-body h3 { color: var(--text); }

.sidebar .front-page-button { display: grid; gap: 12px; margin-bottom: 20px; }
.sidebar .front-page-button p { margin: 0; }
.sidebar .front-page-button .button { width: 100%; padding: 15px 20px; font-size: 15px; border-radius: var(--radius); }
.sidebar .front-page-button .button.green {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.sidebar .front-page-button .button.green:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); color: var(--brand); }
.sidebar .content {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.sidebar section .header { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.sidebar section > div:not(.header) { padding: 6px 0; border-top: 1px solid var(--border); }
.sidebar section > div:not(.header) a { color: var(--text); font-weight: 500; }
.sidebar section > div:not(.header) a:hover { color: var(--brand); }

/* ---------- Knowledge base ---------- */
.featured-category {
  width: calc(50% - 8px);
  margin: 0 0 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.featured-category:nth-of-type(odd) { margin-right: 12px; }
.featured-category i { color: var(--brand); text-shadow: none; }
.category-name { font-weight: 600; font-size: 16px; color: var(--text); }
.article-headline { margin-left: 34px; }
.article-teaser { color: var(--text-3); height: auto; max-height: 3em; }
.article-title { font-weight: 500; }
.faq-content .article-title { font-size: 24px; font-weight: 700; }
#kb { padding: 0; margin: 0; list-style: none; }
#kb > li {
  padding: 16px 20px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
#kb > li > i { background-image: none; display: none; }
#kb > li h4 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
#kb > li h4 a { font-size: inherit; }
#kb > li h4 span { color: var(--text-3); font-weight: 400; }
#faq ol { border-top: 0; padding: 0; }
#faq ol li a {
  padding: 12px 16px 12px 40px;
  margin-bottom: 8px;
  background: var(--surface) url('../images/icons/page.png') 14px 50% no-repeat;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
}
#faq ol li a:hover { background-color: var(--brand-50); border-color: var(--brand); }
#faq .article-meta { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 16px; }
#kb-search #breadcrumbs { color: var(--text-3); }

/* ---------- Forms (open ticket / check status / login) ---------- */
#ticketForm, #clientLogin, #reply, #ticketInfo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#ticketForm { padding: 28px 32px; max-width: 760px; }
#ticketForm > table, #ticketForm table[width] { width: 100% !important; table-layout: auto; }
#ticketForm td, #ticketForm th { width: auto !important; padding: 0; }
#ticketForm td[colspan] { display: block; }
#ticketForm tr > td { padding-bottom: 4px; }
#ticketForm td.required, #ticketForm td:first-child:not([colspan]) { font-weight: 600; }
#ticketForm input[type=text], #ticketForm input[type=password], #ticketForm input[type=email],
#ticketForm select, #ticketForm textarea,
#ticketForm div input, #ticketForm div textarea { width: 100% !important; max-width: 100%; display: block; }
#ticketForm select { float: none !important; }
#ticketForm .form-header h3 { margin-top: 4px; }
#ticketForm .form-header div { color: var(--text-3); font-size: 14px; }
#ticketForm hr { margin: 12px 0 0; }
#ticketForm .captcha { background: transparent; }
#ticketForm .captcha img { border-radius: 6px; }
#ticketForm .captchaRow input { top: 0; width: 120px !important; display: inline-block; }
p.buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
p.buttons input[type=submit] { order: 3; }
.redactor-box, .redactor-container { border-radius: var(--radius-sm); overflow: hidden; border-color: var(--border) !important; }
.redactor-toolbar { background: var(--surface-2) !important; border-color: var(--border) !important; }
.redactor-styles { background: var(--surface) !important; color: var(--text) !important; }

#clientLogin {
  max-width: 460px;
  margin: 8px 0 0;
  padding: 32px;
  background-image: none;
  display: block;
}
#clientLogin > div { display: block !important; }
#clientLogin .login-box { display: block; width: auto; padding: 0; box-shadow: none; }
#clientLogin .login-box > div { margin-bottom: 14px; }
#clientLogin > div > div:not(.login-box) { display: block !important; padding: 20px 0 0 !important; margin-top: 20px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 14px; }
#clientLogin input[type=text], #clientLogin input[type=password], #clientLogin input[type=email] {
  width: 100%; padding: 11px 14px; margin: 0;
}
#clientLogin input[type=submit] { width: 100%; padding: 12px; }
#clientLogin strong { color: var(--danger); font-size: 13px; font-weight: 500; margin-bottom: 8px; }
#clientLogin .instructions { display: block; padding: 0 0 16px; }
#clientLogin p { margin: 16px 0 0; }
.external-auth-box { border-color: var(--border); border-radius: var(--radius-sm); }
.external-auth-icon, .external-auth-name { color: var(--text); }

/* ---------- Ticket list ---------- */
.search.well {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.states { font-size: 14px; }
.states a { padding: 6px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; }
.states a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.states small { font-size: 12px; color: var(--text-3); }
#ticketTable {
  width: 100% !important;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
#ticketTable caption { padding: 12px 16px; background: var(--surface-2); color: var(--text-2); border: 0; border-bottom: 1px solid var(--border); font-weight: 600; }
#ticketTable th {
  height: auto;
  line-height: 1.4;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}
#ticketTable th a { color: var(--text-3); }
#ticketTable th a:hover { color: var(--brand); }
#ticketTable td { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
#ticketTable tr:last-child td { border-bottom: 0; }
#ticketTable tr.alt td { background: transparent; }
#ticketTable tbody tr:hover td { background: var(--surface-2); }
#ticketTable td a { font-weight: 500; }
.Icon { color: var(--brand); }
.Icon.Ticket, .Icon.webTicket, .Icon.emailTicket, .Icon.phoneTicket, .Icon.otherTicket, .Icon.apiTicket { padding-left: 24px; background-position: 0 50%; }
i.refresh { color: var(--success); }

/* Pagination */
#pagination { margin: 20px 0 0; }
#pagination li a, #pagination .active, #pagination .previousOff, #pagination .nextOff {
  min-width: 18px; padding: 7px 12px; border-radius: var(--radius-sm); text-align: center;
  font-size: 13px; margin-right: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
#pagination li a:hover { color: var(--brand); border-color: var(--brand); }
#pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Ticket view & thread ---------- */
#ticketInfo { width: 100% !important; padding: 24px 28px; margin-bottom: 24px; box-sizing: border-box; }
#ticketInfo h1 { font-size: 22px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
#ticketInfo h1 small { color: var(--text-3); font-size: 14px; }
.infoTable, table.custom-data { background: transparent; width: 100%; border-collapse: collapse; }
.infoTable th, table.custom-data th {
  background: transparent;
  padding: 9px 8px 9px 0;
  width: 38%;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.infoTable td, table.custom-data td { padding: 9px 0; border-bottom: 1px solid var(--border); }
.infoTable .headline, table .headline, table.custom-data .headline {
  background: transparent; border-bottom: 2px solid var(--border);
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600;
}

#ticketThread { border: 0; padding: 4px 0; }
#ticketThread::before { display: none; }
.thread-entry::before, .thread-entry::after { display: none; }
.thread-entry { margin-bottom: 18px; }
.thread-entry.avatar { margin-left: 60px; }
.thread-entry.response.avatar { margin-right: 60px; }
.thread-entry > .avatar { border-radius: 50%; overflow: hidden; }
.thread-entry .header, .thread-entry.message .header, .thread-entry.response .header {
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px;
  color: var(--text-3);
}
.thread-entry.message .header { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }
.thread-entry.avatar .header:before, .thread-entry.avatar .header:after { display: none; }
.thread-entry .header .title { max-width: none; margin-left: 10px; color: var(--text); font-weight: 600; }
.thread-entry .thread-body {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.thread-entry.message .thread-body { border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }
.thread-body .attachments { background: var(--surface-2); border-top: 1px solid var(--border); margin: 16px -16px -16px; top: 0; padding: 10px 16px; }
.thread-event { margin-left: 60px; padding: 0 2px 14px; color: var(--text-3); font-size: 13px; }
.thread-event .description { width: calc(100% - 50px); }
.type-icon { background: var(--surface-2); border-color: var(--border); }
.thread-event .type-icon::after { display: none; }
.label { padding: 3px 8px; border-radius: 999px; font-size: 11px; background: var(--text-3); text-shadow: none; }
.freetext-files { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }

#reply { margin-top: 24px; padding: 24px 28px; box-sizing: border-box; background: var(--surface); }
#reply h2 { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
#reply > table, #reply table { width: 100% !important; }
#reply textarea { width: 100% !important; }

/* ---------- Misc ---------- */
.ui-widget-content, .ui-datepicker { border-radius: var(--radius-sm); border-color: var(--border); }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple { border-color: var(--border); border-radius: var(--radius-sm); min-height: 42px; background: var(--surface); }
#loading { border: 1px solid var(--border); border-radius: var(--radius); background-color: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#loading h4 { color: var(--brand); }
.non-local-image { border-color: var(--border); }
.thread-body img { max-width: 100%; height: auto; }
.thread-body blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--border); color: var(--text-2); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #landing_page { grid-template-columns: 1fr; }
  #landing_page > .sidebar { grid-column: 1; grid-row: 2; }
  #landing_page > .main-content { grid-row: 1; }
  .featured-category { width: 100%; margin-right: 0 !important; }
}
@media (max-width: 640px) {
  #container { padding: 0 16px; }
  #header { flex-direction: column; align-items: flex-start; padding-top: 16px; }
  h1 { font-size: 24px; }
  #content { padding: 20px 0 32px; }
  #nav { overflow-x: auto; flex-wrap: nowrap; }
  #nav li a { white-space: nowrap; }
  #ticketForm, #ticketInfo, #reply, #clientLogin { padding: 20px; }
  #landing_page .thread-body { padding: 20px; }
  #landing_page .search-form form { flex-direction: column; }
  .search-form button.button { padding: 12px; }
  #ticketTable { display: block; overflow-x: auto; }
  .thread-entry.avatar, .thread-entry.response.avatar, .thread-event { margin-left: 0; margin-right: 0; }
  .thread-entry > .avatar { display: none; }
  .span4, .span8 { display: block; width: 100%; margin: 0; }
  p.buttons { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ==========================================================================
   Third-party widgets: select2, jQuery UI, typeahead, redactor.
   These ship with hard-coded light colours; re-skin them with the theme.
   ========================================================================== */
:root { --w-surface-3: var(--surface-3, var(--surface-2)); }

/* select2 */
.select2-container { font-family: var(--font); font-size: 14px; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple,
.select2-container--classic .select2-selection--single,
.select2-container--classic .select2-selection--multiple {
  background: var(--surface) !important;
  background-image: none !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 38px;
  box-shadow: var(--shadow-sm);
  filter: none;
}
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--classic .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important; line-height: 36px !important; padding-left: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder,
.select2-container--classic .select2-selection--single .select2-selection__placeholder { color: var(--text-3) !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow,
.select2-container--classic .select2-selection--single .select2-selection__arrow {
  height: 36px !important; background: transparent !important; border: 0 !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--text-3) transparent transparent transparent; }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { border-color: transparent transparent var(--text-3) transparent; }
.select2-container--default .select2-selection--single .select2-selection__clear { color: var(--text-3); }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--brand-50); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); border-radius: 6px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--brand); }
.select2-dropdown, .select2-container--default .select2-dropdown, .select2-container--classic .select2-dropdown {
  background: var(--surface) !important;
  color: var(--text);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.select2-search--dropdown { padding: 8px; }
.select2-container--default .select2-search--dropdown .select2-search__field,
.select2-container--classic .select2-search--dropdown .select2-search__field,
.select2-search__field {
  background: var(--surface-2) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 6px !important; padding: 7px 10px;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus { border-color: var(--brand) !important; }
.select2-results__option { padding: 8px 12px; color: var(--text-2) !important; background: transparent; }
.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--classic .select2-results__option[aria-selected=true] {
  background: var(--brand-50) !important; color: var(--brand) !important; font-weight: 600;
}
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
  background: var(--brand) !important; color: #fff !important;
}
.select2-container--default .select2-results__option--disabled { color: var(--text-3) !important; opacity: .6; }
.select2-container--default .select2-results__group { color: var(--text-3); }
.select2-close-mask { background: transparent; }

/* jQuery UI (datepicker, autocomplete, menus, tabs, dialog) */
.ui-widget, .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: var(--font); }
.ui-widget-content, .ui-widget.ui-widget-content {
  background: var(--surface) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius-sm);
}
.ui-widget-content a { color: var(--brand); }
.ui-widget-header {
  background: var(--surface-2) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius-sm); font-weight: 600;
}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default,
.ui-button, html .ui-button.ui-state-disabled {
  background: var(--surface) !important; color: var(--text-2) !important; border: 1px solid var(--border) !important;
  font-weight: 500;
}
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: var(--text-2) !important; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus,
.ui-button:hover, .ui-button:focus {
  background: var(--w-surface-3) !important; color: var(--text) !important; border-color: var(--border) !important;
}
.ui-state-hover a, .ui-state-focus a { color: var(--text) !important; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active,
.ui-state-highlight, .ui-widget-content .ui-state-highlight {
  background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important;
}
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited, .ui-state-highlight a { color: #fff !important; }
.ui-state-highlight { background: var(--brand-50) !important; color: var(--brand) !important; }
.ui-menu-item .ui-menu-item-wrapper { padding: 8px 12px; color: var(--text-2); }
.ui-menu .ui-state-active, .ui-menu .ui-state-focus, .ui-menu-item .ui-state-active {
  background: var(--brand-50) !important; color: var(--brand) !important; border: 1px solid transparent !important; margin: 0;
}
.ui-datepicker { padding: 10px; box-shadow: var(--shadow-lg); width: auto; }
.ui-datepicker .ui-datepicker-header { background: transparent !important; border: 0 !important; padding: 4px 0 8px; }
.ui-datepicker .ui-datepicker-title select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; height: auto; }
.ui-datepicker th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.ui-datepicker td span, .ui-datepicker td a { text-align: center; padding: 6px; border-radius: 6px; }
.ui-datepicker td .ui-state-default { border-color: transparent !important; background: transparent !important; }
.ui-datepicker td .ui-state-hover { background: var(--w-surface-3) !important; }
.ui-datepicker td .ui-state-active { background: var(--brand) !important; }
.ui-datepicker td .ui-state-highlight { background: var(--brand-50) !important; color: var(--brand) !important; }
.ui-datepicker .ui-datepicker-buttonpane { border-top: 1px solid var(--border); background: transparent; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { filter: none; }
.ui-datepicker-prev, .ui-datepicker-next { border-radius: 6px; }
.ui-timepicker-div dl { color: var(--text-2); }
.ui-slider { background: var(--w-surface-3); border: 0 !important; }
.ui-slider .ui-slider-handle { background: var(--brand) !important; border-color: var(--brand) !important; border-radius: 50%; }
.ui-tabs .ui-tabs-nav { background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; border-radius: 0; }
.ui-dialog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0; }
.ui-dialog .ui-dialog-titlebar { background: var(--surface-2) !important; border: 0 !important; border-bottom: 1px solid var(--border) !important; }
.ui-widget-overlay { background: #0b0d14; opacity: .55; }
.ui-icon { filter: none; }
@media (prefers-color-scheme: dark) {
  .ui-icon, .ui-datepicker-prev span, .ui-datepicker-next span { filter: invert(.85); }
}

/* typeahead / autocomplete dropdowns */
.dropdown-menu, ul.typeahead {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 6px !important;
  opacity: 1 !important;
}
.dropdown-menu li > a, ul.typeahead li > a { color: var(--text-2) !important; padding: 8px 12px; border-radius: 6px; display: block; }
.dropdown-menu li.active > a, .dropdown-menu li > a:hover, ul.typeahead li.active > a, ul.typeahead li > a:hover {
  background: var(--brand-50) !important; color: var(--brand) !important;
}
.dropdown-menu .divider { background: var(--border); }

/* redactor rich text editor */
.redactor-box.redactor-styles-on, .upload-redactor-box { background: var(--surface) !important; }
.redactor-statusbar { background: var(--surface-2) !important; border-top: 1px solid var(--border); color: var(--text-3); }
.redactor-toolbar a { color: var(--text-2) !important; }
.redactor-toolbar a:hover { background: var(--brand-50) !important; color: var(--brand) !important; }
.redactor-toolbar a.redactor-button-active { background: var(--brand-50) !important; color: var(--brand) !important; }
.redactor-toolbar a.redactor-button-disabled { color: var(--text-3) !important; opacity: .5; }
.redactor-dropdown { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-lg) !important; padding: 6px; }
.redactor-dropdown a { color: var(--text-2) !important; border-radius: 6px; }
.redactor-dropdown a:hover { background-color: var(--brand-50) !important; color: var(--brand) !important; }
.redactor-dropdown a.redactor-dropdown-item-disabled { background: transparent; color: var(--text-3); }
.redactor-dropdown-selector span:hover, .redactor-dropdown-selector span.active { background: var(--w-surface-3); }
.redactor-modal { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.redactor-modal-header, .redactor-modal .redactor-close, .redactor-modal label { color: var(--text) !important; }
.redactor-modal input, .redactor-modal select, .redactor-modal textarea,
.redactor-modal input:hover, .redactor-modal textarea:hover, .redactor-modal select:hover,
.redactor-modal input:focus, .redactor-modal textarea:focus, .redactor-modal select:focus {
  background-color: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: 6px;
}
.redactor-modal button { background-color: var(--brand) !important; color: #fff !important; border-radius: 6px; }
.redactor-modal button.redactor-button-secondary { background-color: var(--surface-2) !important; color: var(--text-2) !important; }
.redactor-modal-tabs a.active, .redactor-modal-tabs a:hover { color: var(--brand) !important; }
.redactor-styles a { color: var(--brand); }
.redactor-styles h1, .redactor-styles h2, .redactor-styles h3, .redactor-styles h4, .redactor-styles h5, .redactor-styles h6 { color: var(--text); }
.redactor-styles code, .redactor-styles pre, .redactor-styles pre code { background-color: var(--surface-2); color: var(--text-2); }

/* "red" buttons are destructive actions: solid red with white text */
.red.button, .red.button:visited, a.red.button { color: #fff !important; background: var(--danger); border-color: transparent; }
.red.button:hover { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff !important; border-color: transparent; box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--danger) 45%, transparent); }

/* Primary submit buttons: always white text on the brand colour, whatever the page wraps them in */
input[type=submit], button[type=submit], .primary.button { color: #fff !important; }
input[type=submit]:hover, button[type=submit]:hover, .primary.button:hover { color: #fff !important; }
