/* ============================================================================
   NANOSPHERE — tema del portal de cliente (osTicket 1.18.2)
   ----------------------------------------------------------------------------
   Reemplaza assets/default/css/theme.css. Se carga por ASSETS_PATH, definido en
   client.inc.php. Para revertir todo el tema: apunta ASSETS_PATH de vuelta a
   'assets/default/' — una linea.

   Este archivo cubre el orden de carga #2 de 12. Todo lo que tenga que ganarle
   a thread.css, jQuery UI, redactor, select2 o rtl.css NO va aqui: va en
   client-override.css, que se inyecta como ultimo <link> del head via
   $ost->addExtraHeader().

   Los tokens estan duplicados desde tokens.css a proposito (ver la nota ahi).

   SECCIONES
     1  @font-face
     2  Tokens
     3  Primitivas nuevas (.ns-*)
     4  Reset y base
     5  Tipografia
     6  Shell: container, header, logo, nav, footer
     7  Botones
     8  Campos de formulario
     9  Tarjetas de cristal
     10 Alertas
     11 Tablas
     12 Paginacion
     13 Pantallas de auth
     14 Landing y sidebar
     15 Base de conocimiento
     16 Vista de ticket y hilo
     17 Etiquetas, iconos y utilidades
     18 Responsive          <- si algo se rompe, comenta SOLO esta seccion
     19 RTL
   ========================================================================== */

/* ============================================================================
   1. @font-face — self-hosted, copiadas del build de NanoSphere
   Subsets latin + latin-ext. El rango latin es u+00?? = todo U+0000-U+00FF,
   que cubre a e i o u con tilde, dieresis, ñ Ñ ¿ ¡. No hace falta Google Fonts.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/bricolage-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/bricolage-latin-ext.woff2") format("woff2");
  unicode-range: u+0100-02ba, u+02bd-02c5, u+02c7-02cc, u+02ce-02d7, u+02dd-02ff, u+0304, u+0308, u+0329, u+1d00-1dbf, u+1e00-1e9f, u+1ef2-1eff, u+2020, u+20a0-20ab, u+20ad-20c0, u+2113, u+2c60-2c7f, u+a720-a7ff;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/instrument-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/instrument-latin-ext.woff2") format("woff2");
  unicode-range: u+0100-02ba, u+02bd-02c5, u+02c7-02cc, u+02ce-02d7, u+02dd-02ff, u+0304, u+0308, u+0329, u+1d00-1dbf, u+1e00-1e9f, u+1ef2-1eff, u+2020, u+20a0-20ab, u+20ad-20c0, u+2113, u+2c60-2c7f, u+a720-a7ff;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-latin-ext.woff2") format("woff2");
  unicode-range: u+0100-02ba, u+02bd-02c5, u+02c7-02cc, u+02ce-02d7, u+02dd-02ff, u+0304, u+0308, u+0329, u+1d00-1dbf, u+1e00-1e9f, u+1ef2-1eff, u+2020, u+20a0-20ab, u+20ad-20c0, u+2113, u+2c60-2c7f, u+a720-a7ff;
}

/* ============================================================================
   2. Tokens — DUPLICADO de tokens.css. Si editas aqui, edita alli y en
   scp.css y scp-login.css.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #06070b;
  --bg-elev: #0a0c13;
  --surface: #101320;
  --surface-2: #171b2b;
  --surface-3: #1f2438;

  --fg: #eceff7;
  --fg-muted: #99a1ba;
  --fg-subtle: #7b85a6;

  --brand: #5b7cff;
  --brand-strong: #7b95ff;
  --brand-deep: #3b57e0;
  --accent: #35e0dc;
  --accent-2: #b26bff;
  --signal: #ffb765;
  --danger: #ff6b6b;
  --ok: #35e0a0;

  --glow-1: 53 224 220;
  --glow-2: 91 124 255;
  --glow-3: 178 107 255;
  --glow-4: 255 183 101;

  --border: rgb(236 239 247 / 0.08);
  --border-strong: rgb(236 239 247 / 0.16);
  --ring: rgb(91 124 255 / 0.55);

  --glass: rgb(236 239 247 / 0.035);
  --glass-border: rgb(236 239 247 / 0.1);
  --glass-shadow:
    inset 0 1px 0 rgb(236 239 247 / 0.05),
    0 24px 60px -24px rgb(0 0 0 / 0.85);

  --grad-spectrum: linear-gradient(100deg, #35e0dc 0%, #5b7cff 46%, #b26bff 100%);
  --grad-text: linear-gradient(96deg, #eceff7 0%, #b9c4ff 55%, #8fe9e6 100%);
  --halo-brand: radial-gradient(closest-side, rgb(91 124 255 / 0.35), transparent 70%);
  --glow-sm: 0 0 0 1px rgb(91 124 255 / 0.25), 0 8px 24px -10px rgb(91 124 255 / 0.55);
  --glow-md: 0 0 0 1px rgb(91 124 255 / 0.3), 0 18px 48px -18px rgb(91 124 255 / 0.7);

  --text-display: clamp(2.5rem, 6vw, 4.5rem);
  --text-h2: clamp(2rem, 4.2vw, 3.25rem);
  --text-h3: clamp(1.375rem, 2.2vw, 1.75rem);
  --text-lead: clamp(1.0625rem, 1.4vw, 1.25rem);
  --text-label: 0.6875rem;
  --text-page-h1: clamp(1.6rem, 3vw, 2.25rem);
  --text-body: 0.9375rem;

  --radius-card: 1.25rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-pill: 999px;

  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ============================================================================
   3. Primitivas nuevas
   Traduccion de las utilidades Tailwind del sitio a CSS plano. Son las UNICAS
   clases nuevas del tema; todo lo demas se engancha a selectores que osTicket
   ya emite.

   Nota: en globals.css el .glass del sitio NO puede declarar backdrop-filter
   (Lightning CSS lo elimina dentro de @utility) y hay que emparejarlo con
   backdrop-blur-xl en el markup. Aqui, en CSS plano, esa restriccion no existe.
   ========================================================================== */

.ns-glass {
  background-color: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-card);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.ns-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.ns-text-spectrum {
  background-image: var(--grad-spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ns-hairline {
  height: 1px;
  border: 0;
  background-image: var(--grad-spectrum);
}

/* ============================================================================
   4. Reset y base
   ========================================================================== */

html {
  font-size: 100%;
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, input, select, textarea, button {
  font-family: var(--font-sans);
  color: var(--fg);
}

b, strong { font-weight: 600; }

blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 2px solid var(--border-strong);
  color: var(--fg-muted);
}

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
  padding: 0;
}

small { font-size: 85%; }

ul, ol { margin: 1em 0; padding: 0 0 0 1.75rem; }

img { border: 0; vertical-align: middle; max-width: 100%; }

form { margin: 0; }

fieldset { border: 0; margin: 0; padding: 0; }

label { cursor: pointer; }

input, select, textarea {
  font-size: 100%;
  margin: 0;
  vertical-align: baseline;
}

input { line-height: normal; }

input[type="button"],
input[type="reset"],
input[type="submit"] {
  cursor: pointer;
  -webkit-appearance: button;
}

input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  accent-color: var(--brand);
}

textarea { overflow: auto; vertical-align: top; resize: vertical; }

table { border-collapse: collapse; border-spacing: 0; }

th, td { vertical-align: top; }
th { text-align: left; font-weight: 500; }

h1, h2, h3, h4, h5, h6, form, fieldset { margin: 0; padding: 0; }

::selection { background: var(--brand); color: #fff; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Barra de scroll, espejo de globals.css */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-deep); }

/* ============================================================================
   5. Tipografia
   ========================================================================== */

a, .link {
  color: var(--brand-strong);
  text-decoration: none;
  display: inline;
  transition: color 0.18s var(--ease-out-expo);
}

/* El stock pone un border-bottom punteado en :hover de TODOS los enlaces, lo
   que ensucia logos, botones y celdas. Se cambia por color. */
a:hover, .link:hover {
  color: var(--accent);
  border-bottom: 0;
  cursor: pointer;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

h1 {
  font-size: var(--text-page-h1);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

h2, .subject { font-size: 1.125rem; color: var(--fg); }
h3 { font-size: 1.0625rem; }

/* Voz mono: etiquetas, numeros y metadatos */
.ns-eyebrow,
.label,
#pagination,
#ticketTable caption,
.sidebar section .header {
  font-family: var(--font-mono);
}

.tnum,
#ticketTable td,
#ticketInfo td {
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   6. Shell
   ========================================================================== */

#container {
  width: 100%;
  max-width: 80rem;          /* == .shell del sitio */
  margin: 0 auto;
  padding-inline: 1.25rem;
  box-sizing: border-box;
  background: transparent;
  box-shadow: none;
}

#header {
  position: relative;
  height: auto;
  min-height: 4.5rem;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Logo: no existe ningun lockup horizontal para el hueco 220x71 del stock
   (lockup-640.webp es 640x635). Igual que Logo.tsx en el sitio, se sirve solo
   la marca y el wordmark va como texto vivo. */
#header #logo {
  height: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}
#header #logo img {
  max-height: 34px;
  max-width: none;
  width: auto;
  height: auto;
  vertical-align: middle;
}
#header #logo .valign-helper { display: none; }
#header #logo::after {
  content: "NanoSphere Tech";
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
}
#header #logo:hover { border-bottom: 0; }
#header #logo:hover::after { color: var(--fg); }

.valign-helper {
  height: 100%;
  display: inline-block;
  vertical-align: middle;
}

#header p {
  width: auto;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.9;
}
#header p a { color: var(--fg-muted); }
#header p a:hover { color: var(--brand-strong); }
#header .pull-right { text-align: right; }

/* Nav: sin sprites, sin gradiente, sin sombra. Flex con pastillas.
   Con 5 items envuelve a dos filas en movil sin necesidad de hamburguesa. */
#nav {
  margin: 0;
  padding: 0 0 0.5rem;
  height: auto;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
}

#nav li { margin: 0; padding: 0; list-style: none; display: block; }

#nav li a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  height: auto;
  line-height: 1;
  text-align: left;
  padding: 0.625rem 1rem;
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.875rem;
  background: none;
  border-radius: var(--radius-pill);
  transition:
    color 0.18s var(--ease-out-expo),
    background-color 0.18s var(--ease-out-expo);
}

/* Iconos: Font Awesome 3.2.1 ya carga en todas las paginas del cliente
   (header.inc.php:48), asi que los sprites PNG salen sin tocar el markup.
   Codepoints verificados contra css/font-awesome.min.css. */
#nav li a::before {
  font-family: FontAwesome;
  font-style: normal;
  font-weight: normal;
  font-size: 0.95em;
  line-height: 1;
}
#nav li a.home::before    { content: "\f015"; }
#nav li a.kb::before      { content: "\f02d"; }
#nav li a.new::before     { content: "\f055"; }
#nav li a.status::before  { content: "\f002"; }
#nav li a.tickets::before { content: "\f145"; }

#nav li a:hover {
  background-color: rgb(236 239 247 / 0.04);
  color: var(--fg);
  border-bottom: 0;
}
#nav li a.active {
  background-color: rgb(91 124 255 / 0.12);
  color: var(--fg);
}

#content {
  padding: 2rem 0 3rem;
  margin: 0;
  height: auto !important;
  min-height: 40vh;
}

#footer {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  position: relative;
}
/* Hairline de espectro en el borde del footer, igual que Footer.tsx */
#footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background-image: var(--grad-spectrum);
  opacity: 0.5;
}
#footer a { color: var(--fg-muted); }
#footer a:hover { color: var(--brand-strong); }
#footer p { margin: 0 0 0.5rem; }

/* El enlace "powered by osTicket" SE MANTIENE: es condicion de licencia de la
   edicion gratuita. Solo cambia el sprite por texto mono. */
#footer #poweredBy {
  display: inline-block;
  width: auto;
  height: auto;
  outline: none;
  text-indent: 0;
  margin: 0 auto;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
#footer #poweredBy:hover { color: var(--fg-muted); }

/* ============================================================================
   7. Botones
   El lenguaje NanoSphere tiene exactamente UN boton relleno. El .green del
   stock pasa a ser la variante secundaria (contorno), no un segundo CTA.
   ========================================================================== */

.button,
.button:visited,
.btn,
input[type="submit"],
button[type="submit"],
input[type="button"],
input[type="reset"],
.action-button,
a.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.6875rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  text-shadow: none;
  box-shadow: none;
  max-width: none;           /* mata el max-width:220px del stock */
  position: relative;
  overflow: visible;
  background-image: none;    /* mata los 5 gradientes con prefijo de vendor */
  transition:
    background-color 0.18s var(--ease-out-expo),
    border-color 0.18s var(--ease-out-expo),
    color 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo);
}

/* Primario. Incluye .btn, que en el stock NO estaba estilado en ninguna parte:
   los cuatro formularios de auth renderizaban un boton nativo del navegador. */
.button,
.button:visited,
.blue.button,
.blue.button:visited,
.btn,
input[type="submit"],
button[type="submit"] {
  background-color: var(--brand);
  color: #fff;
  box-shadow: var(--glow-sm);
}

.button:hover,
.blue.button:hover,
.btn:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
  background-color: var(--brand-strong);
  color: #fff;
  box-shadow: var(--glow-md);
  border-bottom: 1px solid transparent;
}

/* Secundario / contorno */
.green.button,
.green.button:visited,
input[type="button"],
input[type="reset"],
.action-button,
a.action-button {
  background-color: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
  box-shadow: none;
  font-size: 0.8125rem;
  padding: 0.5rem 0.9375rem;
  line-height: 1.2;
  margin-left: 0;
}

.green.button:hover,
input[type="button"]:hover,
input[type="reset"]:hover,
.action-button:hover,
a.action-button:hover {
  background-color: rgb(91 124 255 / 0.08);
  border-color: var(--brand);
  color: var(--brand-strong);
  border-bottom-width: 1px;
}

/* El stock pone color:#777 !important en .action-button y sus hijos */
.action-button,
.action-button span,
.action-button a,
a.action-button {
  color: var(--fg) !important;
}
.action-button:hover,
.action-button:hover span,
.action-button:hover a,
a.action-button:hover {
  color: var(--brand-strong) !important;
}
.action-button span,
.action-button a {
  display: inline-block;
  float: none;
  text-decoration: none;
}
.image-hover a.action-button,
.image-hover a.action-button:hover {
  color: var(--fg) !important;
  text-decoration: none;
}

.button:active,
.btn:active,
input[type="submit"]:active {
  top: 0;
  transform: translateY(1px);
  box-shadow: none;
}

.button[disabled],
.btn[disabled],
input[type="submit"][disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================================================================
   8. Campos de formulario
   class.forms.php no emite ninguna clase en los inputs que genera, asi que hay
   que atacar por tipo dentro de #content. El canonico es el campo de contacto
   del sitio: rounded-xl, borde --line, fondo --bg, foco --brand.
   ========================================================================== */

#content input[type="text"],
#content input[type="password"],
#content input[type="email"],
#content input[type="tel"],
#content input[type="number"],
#content input[type="search"],
#content input[type="url"],
#content input[type="date"],
#content input:not([type]),
#content textarea,
#content select,
#clientLogin input[type="text"],
#clientLogin input[type="password"],
.searchbar .search,
.search-form .search {
  box-sizing: border-box;
  width: 100%;
  max-width: 32rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--fg);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo);
}

#content input::placeholder,
#content textarea::placeholder,
#clientLogin input::placeholder {
  color: var(--fg-subtle);
  opacity: 1;
}

#content input:focus,
#content textarea:focus,
#content select:focus,
#clientLogin input:focus,
.searchbar .search:focus,
.search-form .search:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(91 124 255 / 0.18);
  outline: none;
}

/* Flecha del select como data-URI: sin peticion, sin dependencia de sprite */
#content select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2399a1ba' stroke-width='1.6'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.25rem;
}
#content select option {
  background: var(--surface);
  color: var(--fg);
}

#content input[type="checkbox"],
#content input[type="radio"] {
  width: auto;
  min-width: 0;
  padding: 0;
  margin-right: 0.5rem;
  accent-color: var(--brand);
}

#content input[type="file"] {
  width: auto;
  max-width: 100%;
  color: var(--fg-muted);
  border: 0;
  background: none;
  padding-left: 0;
}

/* Estructura de fila del stock */
#ticketForm div.clear,
#clientLogin div.clear {
  clear: both;
  padding: 0.1875rem 0;
  overflow: hidden;
}

#ticketForm div label,
#clientLogin div label {
  display: block;
  color: var(--fg-muted);
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
}

label.required,
span.required { font-weight: 600; }

#ticketForm div label.required,
#clientLogin div label.required { text-align: left; }

/* OJO con la especificidad: "#clientLogin div input" vale 1-0-2 y le gana a
   ".btn" (0-1-0), asi que sin el :not() de abajo el boton Sign In se pintaba
   con el fondo de un campo de texto. Los tipos boton quedan excluidos aqui y
   los estila la seccion 7. */
#ticketForm div input:not([type="submit"]):not([type="button"]):not([type="reset"]),
#clientLogin div input:not([type="submit"]):not([type="button"]):not([type="reset"]),
#ticketForm div textarea,
#clientLogin div textarea {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
}

#ticketForm div input[type="file"],
#clientLogin div input[type="file"] { border: 0; }

#ticketForm div select,
#clientLogin div select { display: block; float: none; }

#ticketForm > table { table-layout: auto; width: 100%; }
#ticketForm > table td { width: auto; }
#ticketForm > table td:first-child {
  width: 11rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
}
#ticketForm > table td + td { width: auto; }

/* El stock fija 600px en estos textarea */
#ticketForm td textarea,
#clientLogin td textarea,
#ticketForm div textarea,
#clientLogin div textarea {
  width: 100%;
  max-width: 40rem;
  min-height: 9rem;
}

#ticketForm td em,
#clientLogin td em,
#ticketForm div em,
#clientLogin div em {
  color: var(--fg-subtle);
  font-style: normal;
  font-size: 0.8125rem;
}

#ticketForm td .captcha,
#clientLogin td .captcha,
#ticketForm div .captcha,
#clientLogin div .captcha {
  width: 88px;
  height: 31px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: block;
  float: left;
  margin-right: 1.25rem;
}

#ticketForm div div.captchaRow,
#clientLogin div div.captchaRow { line-height: 31px; }
#ticketForm div div.captchaRow input,
#clientLogin div div.captchaRow input { position: relative; top: 0; }

#ticketForm td label.inline,
#clientLogin td label.inline,
#ticketForm div label.inline,
#clientLogin div label.inline {
  width: auto;
  padding: 0 0.625rem;
  display: inline-block;
}

/* Errores de validacion */
.error,
font.error,
div.error,
span.error { color: var(--danger); }

.error input,
#ticketForm div.error input,
#clientLogin div.error input { border: 1px solid var(--danger); }

#ticketForm div.error label,
#clientLogin div.error label { color: var(--danger); }

.warning {
  background: rgb(255 183 101 / 0.1);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-style: normal;
  color: var(--signal);
}
.warning strong {
  text-transform: uppercase;
  color: var(--signal);
  font-style: normal;
  letter-spacing: 0.06em;
}

/* Buscadores */
.search-form { padding-top: 0.75rem; }
.searchbar .search { width: 100%; box-sizing: border-box; margin-bottom: 0.625rem; }

/* ============================================================================
   9. Tarjetas de cristal
   ========================================================================== */

.sidebar .content,
.search.well,
.freetext-files,
.infoTable,
table.custom-data,
#reply {
  background-color: var(--glass);
  background-image: none;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-card);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.search.well {
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  margin-top: 0;
}

.freetext-files {
  padding: 1rem 1.25rem;
  margin-top: 0.625rem;
}
.freetext-files .file {
  margin-right: 0.625rem;
  display: inline-block;
  width: 48%;
  padding-top: 0.2em;
}
.freetext-files .title {
  font-weight: 600;
  margin-bottom: 0.3em;
  font-size: 1.05em;
  color: var(--fg);
}

/* ============================================================================
   10. Alertas
   El stock las fija a height:16px, asi que cualquier mensaje de mas de una
   linea se recorta. Bug preexistente; se arregla aqui.
   ========================================================================== */

#msg_notice,
#msg_warning,
#msg_error,
#msg_info,
.warning-banner,
.error_bar,
.warning_bar,
.notice_bar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  height: auto;
  min-height: 2.75rem;
  line-height: 1.45;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  background-image: none;   /* mata los sprites ok/alert/error.png */
  background-repeat: no-repeat;
}

#msg_notice::before,
#msg_warning::before,
#msg_error::before,
#msg_info::before,
.warning-banner::before,
.error_bar::before,
.warning_bar::before,
.notice_bar::before {
  font-family: FontAwesome;
  font-style: normal;
  font-weight: normal;
  font-size: 1em;
  flex: 0 0 auto;
}

#msg_notice,
.notice_bar {
  border-color: rgb(53 224 160 / 0.35);
  background-color: rgb(53 224 160 / 0.08);
  color: var(--ok);
}
#msg_notice::before,
.notice_bar::before { content: "\f00c"; }

#msg_warning,
.warning-banner,
.warning_bar {
  border-color: rgb(255 183 101 / 0.35);
  background-color: rgb(255 183 101 / 0.08);
  color: var(--signal);
}
#msg_warning::before,
.warning-banner::before,
.warning_bar::before { content: "\f071"; }

#msg_error,
.error_bar {
  border-color: rgb(255 107 107 / 0.35);
  background-color: rgb(255 107 107 / 0.08);
  color: var(--danger);
}
#msg_error::before,
.error_bar::before { content: "\f057"; }

#msg_info {
  border-color: rgb(91 124 255 / 0.35);
  background-color: rgb(91 124 255 / 0.08);
  color: var(--brand-strong);
}
#msg_info::before { content: "\f05a"; }

/* Los enlaces dentro de una alerta heredan su color */
#msg_notice a, #msg_warning a, #msg_error a, #msg_info a,
.error_bar a, .warning_bar a, .notice_bar a {
  color: inherit;
  text-decoration: underline;
}

/* ============================================================================
   11. Tablas
   ========================================================================== */

#ticketTable {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--glass);
}

#ticketTable caption {
  padding: 0.875rem 1.25rem;
  text-align: left;
  color: var(--fg-subtle);
  background: transparent;
  border: 0;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#ticketTable th {
  height: auto;
  line-height: 1.3;
  padding: 0.625rem 0.875rem;
  background: rgb(236 239 247 / 0.03);
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
#ticketTable th a { color: var(--fg-muted); }
#ticketTable th a:hover { color: var(--fg); }

#ticketTable th.required,
#ticketTable td.required { font-weight: 600; text-align: left; }

#ticketTable td {
  padding: 0.75rem 0.875rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.875rem;
}
#ticketTable td a { color: var(--fg); font-weight: 500; }
#ticketTable td a:hover { color: var(--brand-strong); }

#ticketTable tr.alt td { background: rgb(236 239 247 / 0.015); }
#ticketTable tbody tr:hover td { background: rgb(91 124 255 / 0.07); }
#ticketTable tbody tr:last-child td { border-bottom: 0; }

.infoTable { width: 100%; }
.infoTable th {
  text-align: left;
  padding: 0.5rem 0.875rem;
  color: var(--fg-muted);
  font-weight: 500;
}
.infoTable td { padding: 0.5rem 0.875rem; }

table.custom-data { margin-top: 0.625rem; width: 100%; }
table.custom-data th {
  width: 25%;
  background-color: rgb(236 239 247 / 0.03);
  padding: 0.5rem 0.875rem;
  color: var(--fg-muted);
  font-weight: 500;
}
table.custom-data td { padding: 0.5rem 0.875rem; }

table .headline,
table.custom-data .headline {
  border-bottom: 1px solid var(--border-strong);
  font-weight: 600;
  background-color: transparent;
  color: var(--fg);
}

table.padded { width: 100%; max-width: 44rem; }
table.padded tr > td,
table.padded tr > th {
  height: auto;
  padding: 0.5rem 0 1rem;
  vertical-align: middle;
}
table.padded tr > td:first-child {
  width: 11rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
  padding-right: 1rem;
}
table.padded hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 0.5rem;
}
table.padded h3 {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.2;
  color: var(--fg);
}

/* ============================================================================
   12. Paginacion
   ========================================================================== */

#pagination {
  border: 0;
  margin: 1.5rem 0 2.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
}
#pagination li {
  border: 0;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  list-style: none;
  display: block;
}
#pagination li a {
  margin: 0;
  display: block;
  float: none;
  padding: 0.375rem 0.6875rem;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  text-decoration: none;
  transition: background-color 0.18s var(--ease-out-expo);
}
#pagination li a:hover {
  color: var(--fg);
  background: rgb(236 239 247 / 0.05);
  border-bottom: 0;
}
#pagination .previousOff,
#pagination .nextOff {
  color: var(--fg-subtle);
  display: block;
  float: none;
  font-weight: 500;
  padding: 0.375rem 0.6875rem;
  opacity: 0.5;
}
#pagination .next a,
#pagination .previous a { font-weight: 600; }
#pagination .active {
  color: var(--fg);
  background: rgb(91 124 255 / 0.15);
  font-weight: 600;
  margin: 0;
  display: block;
  float: none;
  padding: 0.375rem 0.6875rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

/* ============================================================================
   13. Pantallas de auth
   Cuatro plantillas comparten #clientLogin: login.inc.php, accesslink.inc.php,
   pwreset.request.php y pwreset.login.php.

   El h1 y el parrafo viven FUERA del form (login.inc.php:18-19) y su texto sale
   de la base de datos (Page::lookupByType('banner-client')), asi que no se
   puede asumir longitud: text-wrap:balance y nada de alturas fijas.
   ========================================================================== */

body:has(#clientLogin) #content {
  max-width: 34rem;
  margin-inline: auto;
  text-align: center;
  padding-top: 3rem;
}

body:has(#clientLogin) #nav { display: none; }

body:has(#clientLogin) #content > h1 {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--fg);
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

/* Eyebrow mono sobre el titulo, sin tocar la plantilla */
body:has(#clientLogin) #content > h1::before {
  content: "ACCESO";
  display: block;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.18em;
  color: var(--fg-subtle);
}

body:has(#clientLogin) #content > p {
  color: var(--fg-muted);
  font-size: var(--text-lead);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}

/* Halo de marca detras de la tarjeta */
body:has(#clientLogin)::before {
  content: "";
  position: fixed;
  z-index: -1;
  top: -20vh;
  left: 50%;
  width: 70rem;
  height: 70rem;
  transform: translateX(-50%);
  background-image: var(--halo-brand);
  opacity: 0.55;
  pointer-events: none;
}

#clientLogin {
  position: relative;
  overflow: hidden;
  display: block;
  margin: 2rem 0 1.5rem;
  padding: 2rem;
  text-align: left;
  background-color: var(--glass);
  background-image: none;    /* mata lock.png */
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

/* Hairline de espectro en el borde superior */
#clientLogin::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background-image: var(--grad-spectrum);
}

#clientLogin .instructions {
  display: block;
  padding: 0;
}

#clientLogin p {
  clear: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0;
}

#clientLogin strong {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--danger);
  display: block;
  margin-bottom: 0.5rem;
}

#clientLogin label {
  display: block;
  color: var(--fg-muted);
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
}

#clientLogin div + div { margin-top: 1rem; }

#clientLogin #email,
#clientLogin #ticketno { margin-right: 0; }

#clientLogin input[type="text"],
#clientLogin input[type="password"] {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

#clientLogin a { color: var(--fg-muted); }
#clientLogin a:hover { color: var(--brand-strong); border-bottom: 0; }

.login-box {
  width: auto;
  display: block;
  box-shadow: none;
  padding: 0;
}

/* Autenticacion externa (si algun dia se instala un plugin SSO) */
.external-auth + .external-auth { margin-top: 0.5rem; }
a.external-sign-in { text-decoration: none; }
.external-auth-box {
  vertical-align: middle;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  transition: border-color 0.18s var(--ease-out-expo);
}
.external-auth-box:hover { border-color: var(--brand); }
.external-auth-icon {
  display: inline-block;
  color: var(--fg-muted);
  width: 30px;
  padding: 0.5rem 0.625rem;
  border-right: 1px solid var(--border);
}
.external-auth-name {
  color: var(--fg);
  width: auto;
  min-width: 100px;
  padding: 0.5rem 0.875rem;
  line-height: 1.5;
  font-size: 0.875rem;
}
img.sign-in-image {
  border: none;
  max-height: 40px;
  max-width: 200px;
  width: auto;
  height: auto;
}

/* ============================================================================
   14. Landing y sidebar
   ========================================================================== */

.main-content { width: auto; min-width: 0; }

#landing_page #new_ticket,
#landing_page #check_status {
  width: auto;
  padding-left: 0;
  margin-top: 2rem;
  background: none;   /* fuera new_ticket_icon.png / check_status_icon.png */
  position: relative;
}
#landing_page #new_ticket::before,
#landing_page #check_status::before {
  font-family: FontAwesome;
  font-style: normal;
  font-size: 1.5rem;
  color: var(--brand);
  display: block;
  margin-bottom: 0.625rem;
}
#landing_page #new_ticket::before { content: "\f055"; }
#landing_page #check_status::before { content: "\f002"; }

#landing_page h1,
#landing_page h2,
#landing_page h3 { margin-bottom: 0.625rem; }

/* La landing se renderiza dentro de .thread-body, que en client-override.css
   se deja CLARA a proposito porque ahi normalmente va correo entrante. Pero la
   landing es contenido nuestro, no correo: vuelve a oscuro. */
#landing_page .thread-body,
#landing_page .thread-body * {
  background: transparent;
  color: var(--fg);
}
#landing_page .thread-body {
  border: 0;
  padding: 0;
  font-family: var(--font-sans);
}

.sidebar {
  margin: 0 0 1.25rem;
  width: 100%;
  box-sizing: border-box;
}
.sidebar .content {
  padding: 1.25rem;
}
.sidebar .content:empty { display: none; }
.sidebar section .header {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 0.75rem;
}
.sidebar section + section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.sidebar ul { padding-left: 1.1rem; margin: 0; }
.sidebar li { margin-bottom: 0.375rem; }

/* ============================================================================
   15. Base de conocimiento
   ========================================================================== */

#faq {
  clear: both;
  margin: 0;
  padding: 0;
}
#faq ol {
  font-size: 0.9375rem;
  margin-left: 0;
  padding-left: 0;
  border-top: 1px solid var(--border);
}
#faq ol li {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--fg-subtle);
}
#faq ol li a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.5rem;
  height: auto !important;
  overflow: hidden;
  margin: 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  background: none;      /* fuera icons/page.png */
  border-radius: var(--radius-sm);
  color: var(--fg);
}
#faq ol li a::before {
  font-family: FontAwesome;
  font-style: normal;
  content: "\f016";
  color: var(--fg-subtle);
  flex: 0 0 auto;
}
#faq ol li a:hover {
  background-color: rgb(91 124 255 / 0.07);
  color: var(--brand-strong);
}
#faq .article-meta {
  padding: 0.75rem 1rem;
  background: rgb(236 239 247 / 0.03);
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  font-size: 0.8125rem;
}

#kb {
  margin: 0.5rem 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}
#kb > li {
  padding: 1rem 0;
  height: auto !important;
  overflow: hidden;
  margin: 0;
  background: none;      /* fuera kb_category_bg.png */
  border-bottom: 1px solid var(--border);
  display: block;
}
#kb > li h4 { margin-bottom: 0.25rem; }
#kb > li h4 span { color: var(--fg-subtle); font-weight: 400; }
#kb > li h4 a { font-size: 1rem; }
#kb > li > i {
  display: block;
  width: 32px;
  height: 32px;
  float: left;
  margin-right: 0.75rem;
  background: none;      /* fuera kb_large_folder.png */
  font-family: FontAwesome;
  font-style: normal;
  font-size: 1.5rem;
  line-height: 32px;
  color: var(--brand);
  text-align: center;
}
#kb > li > i::before { content: "\f07c"; }

.featured-category {
  margin-top: 0.625rem;
  width: 49.7%;
  display: inline-block;
  box-sizing: border-box;
  vertical-align: top;
}
.category-name {
  display: inline-block;
  font-weight: 500;
  font-size: 1.0625rem;
}
.featured-category i {
  color: var(--accent);
  text-shadow: none;
  display: inline-block;
  vertical-align: middle;
}
.article-headline { margin-left: 34px; }
.article-teaser {
  font-size: 0.875rem;
  line-height: 1.5em;
  height: 3em;
  overflow: hidden;
  color: var(--fg-muted);
}
.article-title { font-weight: 500; color: var(--fg); }
.faq-content .article-title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  margin-top: 1rem;
}

#kb-search { padding: 0.75rem 0; overflow: hidden; }
#kb-search div { clear: both; overflow: visible; padding-top: 0.5rem; }
#kb-search #query,
#kb-search #cid,
#kb-search #topic-id {
  margin: 0 0.5rem 0.5rem 0;
  display: inline-block;
  float: none;
  width: 100%;
  max-width: 18rem;
  top: 0;
}
#kb-search #topic-id { max-width: 26rem; }
#kb-search #searchSubmit {
  margin: 0;
  display: inline-block;
  float: none;
  position: relative;
  top: 0;
  width: auto;
}
#kb-search #breadcrumbs { color: var(--fg-muted); margin-bottom: 1rem; }
#kb-search #breadcrumbs a { color: var(--fg-muted); }
#kb-search #breadcrumbs a:hover { color: var(--brand-strong); }

/* ============================================================================
   16. Vista de ticket y hilo
   El CUERPO de los mensajes (.thread-body) se deja claro en
   client-override.css: es correo entrante con HTML que no controlamos. Aqui
   solo se trata el chrome.
   ========================================================================== */

#ticketInfo h1 {
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
#ticketInfo h1 small { font-weight: 400; color: var(--fg-muted); }

.thread-entry { margin-bottom: 1.25rem; }
.thread-entry.avatar { margin-left: 60px; }
.thread-entry.response.avatar { margin-right: 60px; margin-left: 0; }
.thread-entry > .avatar {
  margin-left: -60px;
  display: inline-block;
  width: 48px;
  height: auto;
  border-radius: var(--radius-md);
}
.thread-entry.response > .avatar { margin-left: initial; margin-right: -60px; }
img.avatar { border-radius: inherit; }
.avatar > img.avatar { width: 100%; height: auto; }

.thread-entry .header {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--fg-muted);
  font-size: 0.8125rem;
  background: var(--surface);
}
.thread-entry .header b,
.thread-entry .header strong { color: var(--fg); font-weight: 600; }

.thread-entry.avatar .header { position: relative; }

/* Mensaje del cliente: acento aqua. Respuesta del agente: acento indigo. */
.thread-entry.message .header {
  background: rgb(53 224 220 / 0.07);
  border-color: rgb(53 224 220 / 0.2);
}
.thread-entry.response .header {
  background: rgb(91 124 255 / 0.09);
  border-color: rgb(91 124 255 / 0.22);
}

/* Los picos triangulares del stock apuntan a colores que ya no existen */
.thread-entry.avatar .header::before,
.thread-entry.avatar .header::after { display: none; }

.thread-entry .header .title {
  max-width: 500px;
  vertical-align: bottom;
  display: inline-block;
  margin-left: 0.9375rem;
  color: var(--fg);
}

.thread-entry .thread-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.thread-body .attachments {
  background-color: rgb(236 239 247 / 0.04);
  margin: 0;
  position: static;
  padding: 0.5rem 0.9em;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.thread-body .attachments .filesize { margin-left: 0.5em; color: var(--fg-subtle); }
.thread-body .attachments a,
.thread-body .attachments a:hover { text-decoration: none; }
.thread-body .attachment-info {
  margin-right: 0.625rem;
  display: inline-block;
  width: 48%;
}
.thread-body .attachment-info .filename { max-width: calc(100% - 70px); }

.thread-event {
  padding: 0 0.125rem 1rem;
  margin-left: 60px;
  color: var(--fg-subtle);
  font-size: 0.8125rem;
}
.thread-event .description {
  margin-left: -30px;
  padding-top: 0.375rem;
  padding-left: 30px;
  display: inline-block;
  width: calc(100% - 95px);
  line-height: 1.4em;
}
.thread-event img.avatar {
  vertical-align: middle;
  border-radius: var(--radius-sm);
  width: auto;
  max-height: 24px;
  margin: -3px 3px 0;
}
.thread-event .type-icon { position: relative; }

/* El stock dibuja un recuadro blanco de 16px detras del icono para tapar la
   linea punteada del hilo. Sobre oscuro tiene que ser del color del lienzo. */
.thread-event .type-icon::after {
  content: "";
  border: 16px solid var(--bg);
  position: absolute;
  top: -3px;
  bottom: 0;
  left: -3px;
  right: 0;
  z-index: -1;
}
.thread-entry::after {
  content: "";
  border-bottom: 2px solid var(--bg);
  display: block;
}
.thread-entry::before {
  content: "";
  display: block;
  border-top: 2px solid var(--bg);
}

#ticketThread {
  z-index: 0;
  position: relative;
  border-bottom: 1px solid var(--border);
}
#ticketThread::before {
  border-left: 1px dotted var(--border-strong);
  position: absolute;
  margin-left: 74px;
  z-index: -1;
  content: "";
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
}

#reply {
  margin-top: 1.25rem;
  padding: 1.25rem;
}
#reply h2 {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
#reply > table { width: 100%; }
#reply table td { vertical-align: top; }
#reply textarea { width: 100%; }
#reply input[type="text"],
#reply #response_options textarea {
  border: 1px solid var(--border);
  background: var(--bg);
}

/* ============================================================================
   17. Etiquetas, iconos y utilidades
   ========================================================================== */

.label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  vertical-align: baseline;
  white-space: nowrap;
  text-shadow: none;
  background-color: rgb(236 239 247 / 0.08);
  border: 1px solid var(--border);
}
.label-bare {
  background-color: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  text-shadow: none;
}

.type-icon {
  border-radius: var(--radius-sm);
  background-color: var(--surface-2);
  padding: 0.25rem 0.375rem;
  margin-right: 0.3125rem;
  text-align: center;
  display: inline-block;
  font-size: 1.05em;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  vertical-align: top;
}
.type-icon.dark {
  border-color: var(--border-strong);
  background-color: var(--surface-3);
}

/* Iconos de ticket: los .gif del stock son oscuros sobre transparente y
   desaparecen. Se sustituyen por glifos de Font Awesome. */
.Icon {
  width: auto;
  padding-left: 0;
  background-image: none !important;
  color: var(--brand-strong);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
}
.Icon::before {
  font-family: FontAwesome;
  font-style: normal;
  font-weight: normal;
  flex: 0 0 auto;
  color: var(--fg-subtle);
}
.Icon.Ticket::before,
.Icon.webTicket::before,
.Icon.emailTicket::before,
.Icon.phoneTicket::before,
.Icon.otherTicket::before,
.Icon.apiTicket::before { content: "\f145"; }
.Icon.emailTicket::before { content: "\f0e0"; }
.Icon.attachment::before,
.Icon.file::before { content: "\f0c6"; }
.Icon.refresh::before { content: "\f021"; }
.Icon.thread { font-weight: 600; font-size: 1em; }
.Icon.thread::before { content: "\f086"; }

i.refresh { color: var(--ok); font-size: 80%; vertical-align: middle; }

.states small { font-size: 70%; color: var(--fg-subtle); }
.active.state { font-weight: 600; color: var(--fg); }

.centered { text-align: center; }
.clear { clear: both; height: 1px; visibility: hidden; }
.hidden { display: none; }
.faded { color: var(--fg-muted); }
.flush-right { text-align: right; }
.flush-left { text-align: left; }
.bleed { margin: 0 !important; padding: 0 !important; }

.row { }
.span4 { display: inline-block; width: 29.5%; margin: 0 1%; vertical-align: top; }
.span8 { display: inline-block; width: 66%; margin: 0 1%; vertical-align: top; }

.truncate {
  display: inline-block;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* ============================================================================
   18. Responsive
   El stock no tiene NI UNA media query: #container 840px, .main-content 565px,
   .sidebar 215px, #clientLogin 400px, tablas a width="800".

   Si tras subir esta fase algo se ve roto, comenta SOLO esta seccion y vuelves
   al comportamiento de la fase anterior sin perder el resto del tema.
   ========================================================================== */

@media (min-width: 640px) {
  #container { padding-inline: 2rem; }
}

/* Landing: sidebar + main-content.
   OJO con la estructura real: #landing_page NO tiene dos hijos sino cuatro
   (index.php:23-80) — .sidebar, .main-content, un .clear y un <div> suelto con
   los articulos destacados. Un flex-direction:row a secas pondria los cuatro
   en la misma fila. Por eso se usa flex-wrap con basis 100% y se reordena:
   el bloque de destacados se va a una segunda linea a ancho completo.

   El .sidebar lleva .pull-right, o sea float:right desde osticket.css:27; el
   float se ignora dentro de un contexto flex, y el !important cubre el caso de
   que :has() no aplique en el navegador. */
#landing_page,
#content:has(> .sidebar) {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

/* El .clear del stock existe para cerrar floats; en flex sobra y ademas
   ocuparia una linea entera. */
#landing_page > .clear,
#content:has(> .sidebar) > .clear { display: none; }

#landing_page > .sidebar,
#content > .sidebar {
  float: none !important;
  width: 100% !important;
  flex: 0 0 100%;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

#landing_page > .main-content,
#content > .main-content {
  width: auto !important;
  min-width: 0;
  flex: 1 1 100%;
}

/* Cualquier otro hijo suelto (los destacados) ocupa su propia linea */
#landing_page > div:not(.sidebar):not(.main-content):not(.clear) {
  flex: 1 1 100%;
  min-width: 0;
}

@media (min-width: 900px) {
  #landing_page > .sidebar,
  #content > .sidebar {
    width: 18rem !important;
    flex: 0 0 18rem;
    order: 2;
  }
  #landing_page > .main-content,
  #content > .main-content {
    flex: 1 1 0;
    order: 1;
  }
  #landing_page > div:not(.sidebar):not(.main-content):not(.clear) { order: 3; }
}

/* #clientLogin: los display:table-row / table-cell son atributos style=
   INLINE en login.inc.php:22,38, accesslink.inc.php:22 y los tres
   pwreset.*.php. Los estilos inline solo pierden contra !important, por eso
   esta es la unica forma de arreglarlo sin editar las plantillas. */
#clientLogin > div[style],
#clientLogin > div > div[style] {
  display: block !important;
  width: auto !important;
  padding: 0 !important;
}
#clientLogin .login-box,
#clientLogin .instructions {
  display: block !important;
  width: auto !important;
  box-shadow: none !important;
  padding: 0 !important;
}
#clientLogin > div[style*="width:50%"],
#clientLogin > div[style*="width: 50%"] {
  width: 100% !important;
  display: block !important;
}
#clientLogin hr[style] { width: 100% !important; }

/* La segunda columna del login (registro / soy agente) queda debajo,
   separada por una linea */
#clientLogin > div > div[style*="table-cell"] {
  margin-top: 1.5rem !important;
  padding-top: 1.5rem !important;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* Tablas con width="800" en el markup: el atributo de presentacion pierde
   contra cualquier regla CSS. */
#ticketForm > table,
#ticketInfo,
#ticketTable,
table.padded {
  width: 100% !important;
  max-width: 100%;
}
table.padded { max-width: 44rem; }

@media (max-width: 900px) {
  .featured-category { width: 100%; }
  .span4, .span8 { width: 98%; display: block; }
  .thread-body .attachment-info { width: 100%; }
  .freetext-files .file { width: 100%; }
}

@media (max-width: 720px) {
  #header { flex-direction: column; align-items: flex-start; }
  #header .pull-right { text-align: left; float: none !important; }

  #ticketForm > table,
  #ticketForm > table tbody,
  #ticketForm > table tr,
  #ticketForm > table td {
    display: block;
    width: auto !important;
  }
  #ticketForm > table td:first-child { padding-bottom: 0.25rem; }

  #ticketInfo > tbody > tr > td { display: block; width: 100% !important; }

  table.padded,
  table.padded tbody,
  table.padded tr,
  table.padded td {
    display: block;
    width: auto !important;
  }
  table.padded tr > td:first-child { padding-bottom: 0.25rem; padding-right: 0; }

  .thread-entry.avatar { margin-left: 0; }
  .thread-entry.response.avatar { margin-right: 0; }
  .thread-entry > .avatar { display: none; }
  .thread-event { margin-left: 0; }
  .thread-event .description { margin-left: 0; padding-left: 0; width: 100%; }
  #ticketThread::before { display: none; }

  body:has(#clientLogin) #content { padding-top: 1.5rem; }
  #clientLogin { padding: 1.5rem; }
}

@media (max-width: 620px) {
  /* Ocultar las dos columnas de menor valor en vez de forzar scroll lateral:
     2 = fecha de creacion, 5 = departamento. */
  #ticketTable th:nth-child(2),
  #ticketTable td:nth-child(2),
  #ticketTable th:nth-child(5),
  #ticketTable td:nth-child(5) { display: none; }
}

@media (max-width: 560px) {
  #nav li a { padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
  #header #logo::after { font-size: 1rem; }
}

/* ============================================================================
   19. RTL
   Al desaparecer los sprites y los background-position en favor de flexbox con
   gap, casi toda la compensacion del stock sobra. Solo hay que evitar que
   css/rtl.css reintroduzca paddings pensados para los iconos PNG.
   Si no hay ningun idioma RTL configurado en Admin, esta seccion no hace nada.
   ========================================================================== */

.rtl #nav li a {
  padding-left: 1rem;
  padding-right: 1rem;
  margin-right: 0;
  margin-left: 0;
  background-position: initial;
}
.rtl #clientLogin { background-position: initial; }
.rtl #clientLogin .instructions { padding-left: 0; padding-right: 0; }
.rtl .login-box { box-shadow: none; }
.rtl .sidebar { margin-left: 0; margin-right: 0; }
.rtl .article-headline { margin-left: 0; margin-right: 34px; }
