/* STICS: capa de estilo del portal de clientes de osTicket 1.18.4 (mismo lenguaje visual que el login de agentes,
   el panel y el tablero). Se carga DESPUÉS de todas las hojas de osTicket (parche stics-portal en
   include/client/header.inc.php). Solo cambia la apariencia: no toca formularios, permisos ni lógica.
   Adaptable: en pantallas de 720 px o menos el portal ocupa todo el ancho y los bloques se apilan. */
:root {
  --st-marino: #062c4a; --st-azul: #0b4f82; --st-claro: #eaf4fb; --st-foco: #7fb3dd;
  --st-tinta: #1d2733; --st-tenue: #586773; --st-fondo: #f5f7fa; --st-linea: #e3eaf1; --st-borde: #cdd7e1;
  --st-alerta: #a8461a; --st-ok: #2e7d4f; --st-aviso: #8a5d00;
  --st-sombra: 0 1px 2px rgba(6,44,74,.06), 0 1px 1px rgba(6,44,74,.03);
  --st-letra: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

/* ---- base ---- */
html, body { background: var(--st-fondo); color: var(--st-tinta); }
body { font-family: var(--st-letra); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body, input, select, textarea, button, table { font-family: var(--st-letra); }
a { color: var(--st-azul); }
a:hover { color: var(--st-marino); }
:focus-visible { outline: 3px solid var(--st-foco); outline-offset: 2px; }
::selection { background: var(--st-claro); color: var(--st-marino); }
h1, h2, h3 { color: var(--st-marino); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0 0 .5rem; }
h2 { font-size: 1.375rem; } h3 { font-size: 1.125rem; }
.clear { clear: both; }

/* ---- contenedor: tarjeta blanca centrada ---- */
#container { width: min(1040px, calc(100% - 32px)); margin: 24px auto; background: #fff; border-radius: 16px;
  box-shadow: var(--st-sombra); overflow: hidden; }

/* ---- encabezado ---- */
#header { height: auto; min-height: 72px; display: flex; align-items: center; justify-content: space-between;
  flex-direction: row-reverse; gap: 16px; padding: 12px 24px; }
#header .pull-right { float: none; }
#header p { width: auto; margin: 0; padding: 0; font-size: .9375rem; color: var(--st-tenue); text-align: right; }
#header p:empty { display: none; }
#logo { float: none; height: auto; display: flex; align-items: center; }
#logo .valign-helper { display: none; }
#header #logo img { max-height: 56px; max-width: 240px; }

/* ---- menú: texto con subrayado azul (sin íconos de 2013) ---- */
#nav { margin: 0; padding: 0 24px; height: auto; display: flex; gap: 4px; flex-wrap: wrap; white-space: normal;
  background: #fff; border-top: 1px solid var(--st-linea); border-bottom: 1px solid var(--st-linea); box-shadow: none; }
#nav li { display: block; }
#nav li a, .rtl #nav li a { height: auto; line-height: 1.4; margin: 0; padding: 12px 12px 10px; border-radius: 0;
  background: none !important; color: var(--st-tenue); font-weight: 500; border-bottom: 2px solid transparent; }
#nav li a:hover { color: var(--st-tinta); background: none; text-decoration: none; }
#nav li a.active { color: var(--st-marino); font-weight: 700; border-bottom-color: var(--st-azul); }
hr { border: 0; border-top: 1px solid var(--st-linea); margin: 0; }

/* ---- contenido ---- */
#content { margin: 0; padding: 28px 24px 32px; min-height: 320px; }
#content p { max-width: 70ch; }
.main-content { width: auto; overflow: hidden; }
.sidebar { width: 280px; margin: 0 0 16px 32px; }
.sidebar .content:empty { display: none; }
#landing_page .thread-body, .thread-body { color: var(--st-tinta); font-size: 1rem; line-height: 1.6; }
.thread-body h1 { margin-top: 0; }

/* ---- botones ---- */
.button, .button:visited, input[type="submit"], input[type="button"], input[type="reset"], button.button, .btn {
  box-sizing: border-box; display: inline-block; min-height: 40px; padding: 8px 16px; border: 0; border-radius: 10px;
  font-size: 1rem; font-weight: 600; line-height: 24px; text-align: center; text-shadow: none; cursor: pointer;
  background: #fff; color: var(--st-tinta); box-shadow: inset 0 0 0 1px var(--st-borde);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease; }
.button:active, input[type="submit"]:active, .btn:active { transform: scale(.97); }
/* Acción principal: azul STICS (abrir solicitud, enviar, iniciar sesión) */
.blue.button, .blue.button:visited, input[type="submit"], .btn[type="submit"] {
  background: var(--st-azul); color: #fff; box-shadow: none; }
/* osTicket pinta de blanco los campos de estos formularios con más prioridad: el botón de enviar se reafirma */
#clientLogin div input[type="submit"], #ticketForm div input[type="submit"], #clientLogin p input[type="submit"] {
  background: var(--st-azul); color: #fff; padding: 8px 16px; border-radius: 10px; margin: 0; }
/* Acción secundaria (antes verde): borde azul */
.green.button, .green.button:visited { background: #fff; color: var(--st-azul); box-shadow: inset 0 0 0 1px var(--st-azul); }
@media (hover: hover) and (pointer: fine) {
  .blue.button:hover, input[type="submit"]:hover, .btn[type="submit"]:hover { background: var(--st-marino); color: #fff; }
  .green.button:hover, .button:hover, input[type="button"]:hover, input[type="reset"]:hover {
    background: var(--st-claro); color: var(--st-marino); text-decoration: none; }
}
.front-page-button p { margin: 0 0 12px; }
.front-page-button .button { width: 100%; }

/* ---- campos ---- */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="search"], input:not([type]), select, textarea {
  box-sizing: border-box; max-width: 100%; border: 1px solid var(--st-borde); border-radius: 10px; background: #fff;
  color: var(--st-tinta); font-size: 1rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="search"], input:not([type]), select { min-height: 40px; padding: 6px 12px; }
textarea { padding: 8px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--st-azul); outline: none; box-shadow: 0 0 0 3px rgba(127,179,221,.45); }
::placeholder { color: #6b7883; opacity: 1; }
label.required, .required { color: var(--st-tinta); }
.error, font.error, span.error { color: var(--st-alerta); }

/* ---- inicio de sesión y «ver estado» ---- */
#clientLogin { width: auto; max-width: 720px; margin: 16px 0 0; padding: 24px; border: 1px solid var(--st-linea);
  border-radius: 14px; background: #fff; box-shadow: none; display: flex; flex-wrap: wrap; gap: 8px 32px; }
#clientLogin > div[style*="table-row"] { display: flex !important; flex-wrap: wrap; gap: 8px 32px; width: 100%; }
#clientLogin .login-box { float: none; width: auto; flex: 1 1 280px; margin: 0; padding: 0; border: 0; box-shadow: none; }
#clientLogin .login-box > div { margin-bottom: 12px; }
#clientLogin input[type="text"], #clientLogin input[type="password"], #clientLogin input[type="email"] { width: 100%; }
#clientLogin div[style*="table-cell"] { display: block !important; flex: 1 1 220px; padding: 0 !important; color: var(--st-tenue); }
#clientLogin strong { color: var(--st-alerta); }
#clientLogin .instructions { border: 0; padding: 0; color: var(--st-tenue); }
#clientLogin label { font-weight: 600; color: var(--st-tinta); }
/* El aviso «…abra un nuevo Ticket» del login lleva a una página que exige cuenta: se oculta solo en el login */
#clientLogin + br, #clientLogin + br + p { display: none; }

/* ---- formulario de solicitud ---- */
#ticketForm > table, #ticketForm table { width: 100% !important; }
#ticketForm td { padding: 6px 0; vertical-align: top; }
#ticketForm td textarea, #ticketForm div textarea { width: 100% !important; }
.form-header h1, .form-header h3 { margin-bottom: 4px; }
hr.faded, div.form-header hr { border-top-color: var(--st-linea); }

/* ---- lista de solicitudes ---- */
.search.well { background: var(--st-fondo); border: 0; border-radius: 12px; padding: 12px 16px; box-shadow: none; }
.states .state { color: var(--st-tenue); }
.states .state.active { color: var(--st-marino); font-weight: 700; }
#ticketTable { width: 100% !important; border: 1px solid var(--st-linea); border-radius: 12px; border-spacing: 0;
  border-collapse: separate; overflow: hidden; font-variant-numeric: tabular-nums; }
#ticketTable caption { padding: 8px 0; text-align: left; color: var(--st-tenue); font-weight: 600; }
#ticketTable th { background: #eef2f6; color: var(--st-tenue); font-size: .8125rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border: 0; text-align: left; }
#ticketTable th a { color: var(--st-tenue); }
#ticketTable td { padding: 10px 12px; border: 0; border-top: 1px solid var(--st-linea); background: #fff; }
#ticketTable tr.alt td { background: #fafcfd; }
@media (hover: hover) and (pointer: fine) { #ticketTable tbody tr:hover td { background: var(--st-claro); } }
#ticketTable .truncate { max-width: 32ch !important; max-height: none !important; }

/* ---- detalle de una solicitud ---- */
#ticketInfo h1 { font-size: 1.5rem; }
#ticketInfo h1 small { color: var(--st-tenue); font-weight: 500; }
.infoTable { width: 100% !important; }
.infoTable th { color: var(--st-tenue); font-weight: 600; text-align: left; padding: 4px 12px 4px 0; }
.infoTable td { padding: 4px 0; }
.thread-entry { border-radius: 12px; }
.thread-entry .header { border-color: var(--st-linea); border-radius: 12px 12px 0 0; }
.thread-entry.message .header { background: #eef2f6; }
.thread-entry.avatar.message .header:after { border-left-color: #eef2f6; }
.thread-entry.response .header { background: #eef6fc; }
.thread-entry.avatar.response .header:after { border-right-color: #eef6fc; }
.thread-entry .thread-body { overflow-wrap: anywhere; }
#reply { border: 1px solid var(--st-linea); border-radius: 14px; background: #fff; padding: 20px; }
#reply h2 { margin-top: 0; }

/* ---- avisos ---- */
#msg_notice, #msg_warning, #msg_error, #msg_info, .notice_bar, .warning_bar, .error_bar {
  border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; color: var(--st-tinta); background-image: none; }
#msg_notice, .notice_bar { border: 1px solid #b9dcc6; background-color: #eaf6ef; }
#msg_warning, .warning_bar { border: 1px solid #ecd39b; background-color: #fdf6e7; }
#msg_error, .error_bar { border: 1px solid #e8c2b0; background-color: #fbf0ea; }
#msg_info { border: 1px solid #bcd8ee; background-color: var(--st-claro); }

/* ---- pie ---- */
#footer { padding: 0 16px 24px; color: var(--st-tenue); font-size: .8125rem; }
#footer a { color: var(--st-tenue); }
/* Sin «powered by osTicket»: el pie queda solo con los derechos de STICS (la licencia GPL v2 no exige mostrarlo) */
#footer #poweredBy { display: none; }

/* ---- celular y pantallas angostas ---- */
@media (max-width: 720px) {
  #container { width: 100%; margin: 0; border-radius: 0; box-shadow: none; }
  #header { flex-direction: column-reverse; align-items: flex-start; padding: 12px 16px; }
  #header p { text-align: left; }
  #header #logo img { max-height: 44px; max-width: 200px; }
  #nav { padding: 0 8px; }
  #nav li a, .rtl #nav li a { padding: 10px 8px 8px; }
  #content { padding: 20px 16px 24px; }
  .sidebar, .rtl .sidebar { float: none; width: auto; margin: 0 0 16px; }
  .main-content { width: auto; }
  #clientLogin { padding: 16px; }
  #ticketTable { display: block; overflow-x: auto; }
  .search.well .pull-right, .search.well .flush-left { float: none; }
  h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .button:active, input[type="submit"]:active, .btn:active { transform: none; }
}

/* ---- portal3: iniciales en lugar de avatares (scp/js/stics-panel.js pone el círculo; aquí se oculta la imagen) ---- */
img.avatar { display: none !important; }
.stics-ini { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 40px; height: 40px; border-radius: 50%; background: var(--st-marino); color: #fff;
  font-weight: 600; font-size: 15px; line-height: 1; letter-spacing: .02em; vertical-align: middle; user-select: none; }
.stics-ini-cliente { background: #e3eef8; color: var(--st-marino); box-shadow: inset 0 0 0 1px #c9dcee; }
.thread-entry > .avatar { text-align: center; }
.thread-entry > .avatar .stics-ini { margin-top: 2px; }
.stics-ini.stics-ini-mini { display: inline-block; width: 24px; height: 24px; padding: 0; line-height: 24px; text-align: center;
  font-size: 10px; letter-spacing: .02em; vertical-align: middle; margin: -2px 6px 0 2px; background: var(--st-claro);
  color: var(--st-marino); box-shadow: inset 0 0 0 1px #c9dcee; }
/* espacio entre el nombre y la fecha en los eventos («SYSTEM 06/11/26») */
.thread-event .description time::before { content: " "; }
