/* ==========================================================================
   Referencia Virtual — Biblioteca UCES
   Design system based on the UCES Visual Identity Manual V.1.1
   (IDENTIDAD_VISUAL.md: Part A brand palette, Part B screen adaptation)
   ========================================================================== */

/* ---- Montserrat (bundled locally, SIL OFL) ---- */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/montserrat-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 900; font-display: swap; src: url("../fonts/montserrat-latin-900-normal.woff2") format("woff2"); }

:root {
  /* ---- Paleta oficial (Manual V.1.1) — no modificar ---- */
  --uces-verde: #006548;
  --uces-verde-claro: #93C465;
  --uces-grafito: #3E3F3F;
  --uces-blanco: #FFFFFF;
  --uces-oro: #E39328;

  /* ---- Adaptación para pantallas (Parte B) — sólo superficies y estados ---- */
  --ui-fondo: #E9EDEB;
  --ui-superficie: #FFFFFF;
  --ui-borde: #C3CEC8;
  --ui-borde-suave: #DBE3DF;
  --ui-encabezado-tabla: #E1E9E5;
  --ui-resaltado-fila: #E5F0EA;
  --ui-cebra: #EEF3F0;
  --ui-texto-secundario: #666969;
  --ui-verde-tinte: #D1E8DB;
  --ui-verde-tinte-fuerte: #A9D2BC;
  --ui-verde-oscuro: #004D37;
  --ui-negativo: #CD2C4A;
  --ui-negativo-tinte: #F5D3DA;
  --ui-texto-negativo: #A3213A;
  --ui-verde-claro-pantalla: #80B452;

  --ui-fuente: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* ---- Layout scale ---- */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --gap: 1rem;
  --shadow: 0 1px 2px rgba(62, 63, 63, .06), 0 2px 8px rgba(62, 63, 63, .05);
  --shadow-lg: 0 10px 30px rgba(62, 63, 63, .18);
  --focus: 0 0 0 3px rgba(0, 101, 72, .28);
  --container: 1140px;
  --header-h: 112px;
  --sidebar-w: 264px;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ui-fuente);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--uces-grafito);
  background: var(--ui-fondo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--uces-verde); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ui-verde-oscuro); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--ui-borde-suave); margin: 1.5rem 0; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { white-space: pre-wrap; background: var(--ui-cebra); padding: .75rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; }
::selection { background: var(--ui-verde-tinte); }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--uces-verde); color: #fff; padding: .6rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; color: #fff; }

/* ---- Typography (A2) ---- */
h1, h2, h3, h4 { margin: 0 0 .75rem; line-height: 1.25; color: var(--uces-grafito); hyphens: none; }
/* Long titles: Montserrat Medium, normal case */
h1, .title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 500; color: var(--uces-verde); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 500; }
h3 { font-size: 1.08rem; font-weight: 600; }
/* Short titles: Montserrat Black, uppercase */
.title-short { font-weight: 900; text-transform: uppercase; letter-spacing: .01em; color: var(--uces-verde); }
/* Subtitles: Montserrat Bold uppercase, only grafito or #006548 */
.subtitle, .eyebrow { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--uces-grafito); margin: 0 0 .5rem; }
.eyebrow--green { color: var(--uces-verde); }
.lead { font-size: 1.08rem; color: var(--uces-grafito); }
.muted, .help { color: var(--ui-texto-secundario); }
.help { font-size: .85rem; margin: .3rem 0 0; }
.small { font-size: .85rem; }
strong, b { font-weight: 700; }

/* ---- Layout ---- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 28px; } }
.page { padding: 1.5rem 0 3rem; }
@media (min-width: 768px) { .page { padding: 2.25rem 0 4rem; } }
.stack > * + * { margin-top: var(--gap); }
.stack-lg > * + * { margin-top: 1.75rem; }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--top { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 1.25rem; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.75rem; align-items: start; }
  .layout-aside--left { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (min-width: 720px) and (max-width: 979px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.layout-aside > * + * { margin-top: 0; }
@media (max-width: 979px) { .layout-aside > * + * { margin-top: 1.5rem; } }

/* ---- Site header (logo on a white surface, B4) ---- */
.site-header { background: var(--ui-superficie); border-bottom: 1px solid var(--ui-borde); position: relative; z-index: 20; }
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 22px; text-decoration: none; color: inherit; padding: 14px 0; }
/* Isotipo: minimum 150px on screen (A1) with clear space of one module */
.brand__logo { width: 150px; height: auto; flex: none; display: block; color: var(--uces-verde); }
.brand__divider { width: 1px; align-self: stretch; background: var(--ui-borde); margin: 10px 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__app { font-weight: 900; text-transform: uppercase; color: var(--uces-verde); font-size: 1.05rem; letter-spacing: .02em; }
.brand__sub { font-weight: 700; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; color: var(--uces-grafito); margin-top: .25rem; }
@media (max-width: 559px) {
  .brand { gap: 14px; }
  .brand__divider, .brand__text { display: none; }
  :root { --header-h: 104px; }
}
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.site-nav a { display: flex; align-items: center; gap: .45rem; white-space: nowrap; padding: .6rem .75rem; border-radius: var(--radius-sm); color: var(--uces-grafito); text-decoration: none; font-weight: 500; font-size: .95rem; }
.site-nav a:hover { background: var(--ui-resaltado-fila); color: var(--uces-verde); }
.site-nav a[aria-current="page"] { color: var(--uces-verde); font-weight: 700; box-shadow: inset 0 -3px 0 var(--uces-verde); border-radius: 0; }
.btn.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 1099px) {
  .btn.nav-toggle { display: inline-flex; }
  .site-nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--ui-superficie); border-bottom: 1px solid var(--ui-borde); box-shadow: var(--shadow-lg); display: none; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding: .5rem 16px 1rem; }
  .site-nav a { padding: .85rem .75rem; }
  .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--uces-verde); background: var(--ui-cebra); }
}

/* ---- Hero with typographic pattern (A2 "Patrón tipográfico") ---- */
.hero { position: relative; overflow: hidden; background: var(--uces-verde); color: #fff; border-radius: var(--radius-lg); padding: 2rem 1.25rem; margin-bottom: 2rem; isolation: isolate; }
@media (min-width: 768px) { .hero { padding: 3rem 3rem 3.25rem; } }
.hero h1 { color: #fff; font-weight: 500; margin-bottom: .5rem; max-width: 22ch; }
.hero p { color: #fff; max-width: 52ch; margin-bottom: 1.5rem; }
.hero .eyebrow { color: #fff; }
.hero__pattern { position: absolute; inset: -20% -10% auto auto; width: 120%; transform: rotate(-2deg); z-index: -1; pointer-events: none; user-select: none; }
.hero__pattern span { display: block; white-space: nowrap; font-weight: 900; text-transform: uppercase; font-size: clamp(2.6rem, 2rem + 4vw, 5.2rem); line-height: 1.05; color: transparent; -webkit-text-stroke: .5pt rgba(255, 255, 255, .32); letter-spacing: .01em; }
.hero__pattern span:nth-child(2) { margin-left: -2.2em; }
.hero__pattern span:nth-child(3) { margin-left: -.9em; }
.hero__pattern span:nth-child(4) { margin-left: -3.1em; }
.search-hero { display: flex; gap: .5rem; max-width: 640px; background: #fff; border-radius: 999px; padding: .35rem .35rem .35rem 1.1rem; box-shadow: var(--shadow-lg); align-items: center; }
.search-hero .icon { color: var(--ui-texto-secundario); }
.search-hero input[type=search] { border: 0; box-shadow: none; min-height: 40px; outline: 0; flex: 1; min-width: 0; font: inherit; padding: .55rem .25rem; color: var(--uces-grafito); background: transparent; }
.search-hero input:focus { box-shadow: none; }
.search-hero:focus-within { box-shadow: var(--shadow-lg), 0 0 0 3px rgba(147, 196, 101, .6); }
@media (max-width: 479px) { .search-hero .btn span { display: none; } }

/* ---- Cards / surfaces ---- */
.card { background: var(--ui-superficie); border: 1px solid var(--ui-borde); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__body { padding: 1.25rem; }
@media (min-width: 768px) { .card__body { padding: 1.5rem 1.75rem; } }
.card__header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--ui-borde-suave); display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
@media (min-width: 768px) { .card__header { padding: 1.1rem 1.75rem; } }
.card__header h2, .card__header h3 { margin: 0; }
.card__footer { padding: 1rem 1.25rem; border-top: 1px solid var(--ui-borde-suave); background: var(--ui-cebra); border-radius: 0 0 var(--radius) var(--radius); }
.card--flat { box-shadow: none; }
.card--accent { border-top: 4px solid var(--uces-verde); }

.action-card { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit; padding: 1.5rem; height: 100%; transition: border-color .15s, transform .15s, box-shadow .15s; }
.action-card:hover { border-color: var(--uces-verde); transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.action-card__icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--ui-verde-tinte); color: var(--ui-verde-oscuro); margin-bottom: .5rem; }
.action-card__icon .icon { width: 26px; height: 26px; }
.action-card h2 { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--uces-verde); }
.action-card p { margin: 0; color: var(--ui-texto-secundario); }
.action-card .more { margin-top: auto; padding-top: .75rem; font-weight: 600; color: var(--uces-verde); display: inline-flex; gap: .35rem; align-items: center; }

/* ---- Buttons ---- */
.btn { --btn-bg: var(--ui-superficie); --btn-fg: var(--uces-verde); --btn-bd: var(--ui-borde);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem 1.1rem;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-bd); border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { border-color: var(--uces-verde); color: var(--ui-verde-oscuro); background: var(--ui-resaltado-fila); }
.btn--primary { --btn-bg: var(--uces-verde); --btn-fg: #fff; --btn-bd: var(--uces-verde); }
.btn--primary:hover { background: var(--ui-verde-oscuro); border-color: var(--ui-verde-oscuro); color: #fff; }
.btn--danger { --btn-fg: var(--ui-texto-negativo); }
.btn--danger:hover { background: var(--ui-negativo-tinte); border-color: var(--ui-negativo); color: var(--ui-texto-negativo); }
.btn--ghost { --btn-bd: transparent; --btn-bg: transparent; }
.btn--sm { min-height: 36px; padding: .35rem .75rem; font-size: .85rem; }
.btn--icon { padding: .5rem; min-width: 44px; }
.btn--sm.btn--icon { min-width: 36px; padding: .35rem; }
.btn--block { width: 100%; }
.btn--pill { border-radius: 999px; }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-group { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--uces-verde); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn--danger { color: var(--ui-texto-negativo); }

/* ---- Forms ---- */
.form-grid { display: grid; gap: 1.1rem 1.25rem; }
@media (min-width: 720px) { .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-2 { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; min-width: 0; }
.field > label, .field > .label, legend.label { font-weight: 600; font-size: .92rem; margin-bottom: .35rem; color: var(--uces-grafito); padding: 0; }
.req { color: var(--ui-texto-negativo); margin-left: .15rem; text-decoration: none; }
.input, input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], input[type=time], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--uces-grafito); background: var(--ui-superficie);
  border: 1px solid var(--ui-borde); border-radius: var(--radius-sm); padding: .62rem .8rem; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23006548' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.25rem; }
select[multiple] { background-image: none; padding-right: .8rem; min-height: 120px; }
input:hover, select:hover, textarea:hover { border-color: #9fb3a9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--uces-verde); box-shadow: var(--focus); }
[aria-invalid="true"] { border-color: var(--ui-negativo) !important; background: #fffafb; }
.field-error { color: var(--ui-texto-negativo); font-size: .85rem; margin: .35rem 0 0; font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: .6rem; padding: .3rem 0; cursor: pointer; line-height: 1.4; }
.check input { width: 18px; height: 18px; margin: .15rem 0 0; accent-color: var(--uces-verde); flex: none; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.input-group { display: flex; gap: .5rem; align-items: stretch; }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.5rem; }
.form-section + .form-section { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--ui-borde-suave); }
.captcha { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.captcha img { border-radius: var(--radius-sm); border: 1px solid var(--ui-borde); background: var(--ui-cebra); width: 180px; height: 56px; }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
.file-list { display: grid; gap: .5rem; }
.counter { font-size: .8rem; color: var(--ui-texto-secundario); text-align: right; margin-top: .25rem; }

/* ---- Alerts (B3 state tints) ---- */
.alert { display: flex; gap: .75rem; align-items: flex-start; border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; border: 1px solid; background: var(--ui-superficie); }
.alert .icon { margin-top: .15rem; width: 1.3em; height: 1.3em; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert ul { margin: .35rem 0 0; }
.alert--success { background: var(--ui-verde-tinte); border-color: var(--ui-verde-tinte-fuerte); color: var(--ui-verde-oscuro); }
.alert--error { background: var(--ui-negativo-tinte); border-color: #e9a9b6; color: var(--ui-texto-negativo); }
.alert--notice, .alert--info { background: var(--ui-superficie); border-color: var(--ui-borde); color: var(--uces-grafito); border-left: 4px solid var(--uces-oro); }
.alert__close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--ui-superficie); border: 1px solid var(--ui-borde); color: var(--uces-grafito); line-height: 1.4; }
.badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; flex: none; }
.badge--new { background: var(--ui-verde-tinte); border-color: var(--ui-verde-tinte-fuerte); color: var(--ui-verde-oscuro); }
.badge--waiting::before { background: var(--uces-oro); }
.badge--waiting { border-color: var(--uces-oro); }
.badge--replied::before { background: var(--ui-verde-claro-pantalla); }
.badge--progress::before { background: var(--uces-verde); }
.badge--hold { color: var(--ui-texto-secundario); }
.badge--hold::before { background: var(--ui-texto-secundario); }
.badge--resolved { background: var(--ui-cebra); color: var(--ui-texto-secundario); }
.badge--resolved::before { background: var(--ui-borde); }
.badge--plain::before { display: none; }
.badge--count { background: var(--uces-verde); border-color: var(--uces-verde); color: #fff; padding: .05rem .45rem; min-width: 1.4rem; justify-content: center; font-size: .72rem; }
.badge--count::before { display: none; }
.prio { font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.prio::before { content: ""; width: .55rem; height: .55rem; border-radius: 2px; background: var(--ui-borde); }
.prio--critical { color: var(--ui-texto-negativo); }
.prio--critical::before { background: var(--ui-negativo); }
.prio--high::before { background: var(--uces-oro); }
.prio--medium::before { background: var(--uces-grafito); }
.prio--low { color: var(--ui-texto-secundario); font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--ui-verde-oscuro); background: var(--ui-verde-tinte); border-radius: var(--radius-sm); padding: .1rem .45rem; }

/* ---- Breadcrumbs ---- */
.breadcrumbs { font-size: .85rem; margin-bottom: 1rem; color: var(--ui-texto-secundario); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.breadcrumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--ui-borde); }
.breadcrumbs a { color: var(--ui-texto-secundario); text-decoration: none; }
.breadcrumbs a:hover { color: var(--uces-verde); text-decoration: underline; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .35rem 0 0; }

/* ---- Lists ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--ui-borde-suave); }
.list > li:first-child { border-top: 0; }
.list-link { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 0; text-decoration: none; color: inherit; }
.list-link:hover .list-link__title { color: var(--uces-verde); text-decoration: underline; }
.list-link__icon { color: var(--uces-verde); margin-top: .15rem; }
.list-link__title { font-weight: 600; color: var(--uces-grafito); }
.list-link__meta { display: block; font-size: .82rem; color: var(--ui-texto-secundario); }
.list-link__excerpt { display: block; font-size: .9rem; color: var(--ui-texto-secundario); margin-top: .2rem; }
.card .list { padding: 0 1.25rem; }
@media (min-width: 768px) { .card .list { padding: 0 1.75rem; } }

.kb-cat { padding: 1.25rem 1.25rem 1rem; display: flex; flex-direction: column; gap: .35rem; height: 100%; }
.kb-cat h3 { margin: 0; display: flex; gap: .5rem; align-items: center; }
.kb-cat h3 a { text-decoration: none; }
.kb-cat h3 .icon { color: var(--uces-verde); }
.kb-cat ul { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .92rem; }
.kb-cat li { padding: .25rem 0; }
.kb-cat .more { margin-top: auto; font-size: .88rem; font-weight: 600; }

.stars { display: inline-flex; gap: 1px; color: var(--uces-oro); vertical-align: middle; }
.stars .icon { width: 15px; height: 15px; }
.stars .off { color: var(--ui-borde); }
.stars .half { color: var(--uces-oro); opacity: .55; }

/* ---- Article (rich content) ---- */
.prose { line-height: 1.7; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.5rem; color: var(--uces-verde); }
.prose img { height: auto; border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--ui-borde-suave); padding: .45rem .6rem; text-align: left; }
.prose th { background: var(--ui-encabezado-tabla); }
.prose blockquote { margin: 1rem 0; padding: .5rem 1rem; border-left: 4px solid var(--ui-verde-tinte-fuerte); background: var(--ui-cebra); }
.prose > :last-child { margin-bottom: 0; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; font-size: .9rem; margin: 0; }
.meta-list dt { color: var(--ui-texto-secundario); font-weight: 500; }
.meta-list dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.vote { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--ui-cebra); border: 1px solid var(--ui-borde-suave); }
.vote strong { margin-right: auto; }

/* ---- Ticket conversation ---- */
.ticket-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.ticket-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; letter-spacing: .03em; color: var(--uces-verde); background: var(--ui-verde-tinte); padding: .1rem .5rem; border-radius: var(--radius-sm); font-size: .9rem; white-space: nowrap; }
.thread { display: flex; flex-direction: column; gap: 1rem; }
.msg { background: var(--ui-superficie); border: 1px solid var(--ui-borde); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.msg__head { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--ui-borde-suave); background: var(--ui-superficie); }
.msg__avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--ui-encabezado-tabla); color: var(--uces-grafito); flex: none; }
.msg__who { font-weight: 700; }
.msg__role { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-texto-secundario); }
.msg__time { font-size: .82rem; color: var(--ui-texto-secundario); margin-left: auto; }
.msg__body { padding: 1.1rem; overflow-wrap: anywhere; line-height: 1.65; }
@media (min-width: 768px) { .msg__body, .msg__head { padding-left: 1.4rem; padding-right: 1.4rem; } }
.msg__foot { padding: .7rem 1.1rem; border-top: 1px solid var(--ui-borde-suave); background: var(--ui-cebra); display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .9rem; }
.msg--staff { border-left: 4px solid var(--uces-verde); }
.msg--staff .msg__avatar { background: var(--uces-verde); color: #fff; }
.msg--note { background: #fffdf8; border-color: #ecd2ab; border-left: 4px solid var(--uces-oro); }
.msg--note .msg__head { background: transparent; border-bottom-color: #f1dfc4; }
.msg--note .msg__avatar { background: #f6e3c6; color: var(--uces-grafito); }
.msg--unread { box-shadow: 0 0 0 2px var(--ui-verde-tinte-fuerte), var(--shadow); }
.attachments { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.attachment { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--ui-borde); border-radius: var(--radius-sm); font-size: .88rem; text-decoration: none; background: var(--ui-superficie); max-width: 100%; }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment:hover { border-color: var(--uces-verde); }
.custom-fields { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .92rem; margin: 0 0 1rem; padding: .75rem 1rem; background: var(--ui-cebra); border-radius: var(--radius-sm); }
.custom-fields dt { color: var(--ui-texto-secundario); }
@media (max-width: 559px) { .custom-fields { grid-template-columns: 1fr; gap: 0; } .custom-fields dd + dt { margin-top: .5rem; } }
.custom-fields dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.custom-fields--after { margin: 1rem 0 0; }
.history { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.history li { padding: .45rem 0 .45rem 1.1rem; border-left: 2px solid var(--ui-borde-suave); position: relative; color: var(--uces-grafito); }
.history li::before { content: ""; position: absolute; left: -5px; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--ui-verde-tinte-fuerte); }
.history font, .history span { font-weight: 600; }

/* ---- Sticky side panel (ticket info) ---- */
.side-panel { position: sticky; top: 1rem; }
/* Never taller than the viewport, or its bottom (e.g. the Save button) is unreachable while it sticks */
@media (min-width: 980px) {
  .side-panel { max-height: calc(100vh - 2rem); overflow-y: auto; }
  .admin-content .side-panel { top: calc(64px + 1rem); max-height: calc(100vh - 64px - 2rem); }
}
.side-panel .card + .card { margin-top: 1rem; }
.info-rows { margin: 0; }
.info-rows > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--ui-borde-suave); font-size: .9rem; align-items: center; }
.info-rows > div:first-child { border-top: 0; }
.info-rows dt { color: var(--ui-texto-secundario); }
.info-rows dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.info-rows dd .badge { white-space: normal; text-align: left; }

/* ---- Tables (responsive: stack into cards below 820px) ---- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th { background: var(--ui-encabezado-tabla); text-align: left; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--uces-grafito); padding: .7rem .9rem; border-bottom: 1px solid var(--ui-borde); white-space: nowrap; }
.table th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.table th a:hover { color: var(--uces-verde); }
.table th[aria-sort] a { color: var(--uces-verde); }
.table td { padding: .75rem .9rem; border-bottom: 1px solid var(--ui-borde-suave); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--ui-cebra); }
.table tbody tr:hover td { background: var(--ui-resaltado-fila); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-check { width: 40px; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-unread td:first-child { box-shadow: inset 3px 0 0 var(--uces-oro); }
.table tr.is-unread .t-subject a { font-weight: 700; }
.table td.t-subject { min-width: 240px; }
a.ticket-id { text-decoration: none; }
a.ticket-id:hover { background: var(--ui-verde-tinte-fuerte); color: var(--ui-verde-oscuro); }
.t-subject a { color: var(--uces-grafito); font-weight: 600; text-decoration: none; }
.t-subject a:hover { color: var(--uces-verde); text-decoration: underline; }
.t-sub { display: block; font-size: .8rem; color: var(--ui-texto-secundario); font-weight: 400; }
.card > .table-wrap .table th:first-child { border-top-left-radius: 0; }
@media (max-width: 899px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { position: relative; padding: .85rem 1rem .75rem; border-bottom: 1px solid var(--ui-borde-suave); }
  .table--stack tbody tr:nth-child(even) td, .table--stack tbody tr:hover td { background: transparent; }
  .table--stack tbody tr:nth-child(even) { background: var(--ui-cebra); }
  .table--stack td { border: 0; padding: .15rem 0; display: flex; gap: .75rem; justify-content: space-between; align-items: center; text-align: right; }
  .table--stack td::before { content: attr(data-label); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ui-texto-secundario); text-align: left; }
  .table--stack td.t-subject { display: block; text-align: left; font-size: 1rem; padding: .1rem 2.25rem .4rem 0; }
  .table--stack td.t-subject::before, .table--stack td.col-check::before { display: none; }
  .table--stack tr:has(> td.col-check) { padding-right: 3rem; }
  .table--stack td.col-check { position: absolute; right: .75rem; top: .8rem; width: auto; padding: 0; }
  .table--stack td.col-actions { justify-content: flex-end; padding-top: .5rem; }
  .table--stack td.col-actions::before { display: none; }
  .table--stack td:empty { display: none; }
  .table--stack tr.is-unread { box-shadow: inset 3px 0 0 var(--uces-oro); }
  .table--stack tr.is-unread td:first-child { box-shadow: none; }
}

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--ui-borde-suave); }
.search-field { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--ui-borde); border-radius: var(--radius-sm); padding: 0 .6rem; background: #fff; min-height: 44px; }
.search-field:focus-within { border-color: var(--uces-verde); box-shadow: var(--focus); }
.search-field input { border: 0 !important; min-height: 42px; padding: 0; box-shadow: none !important; }
.search-field .icon { color: var(--ui-texto-secundario); }
.toolbar .search { flex: 1 1 260px; display: flex; align-items: center; gap: .5rem; border: 1px solid var(--ui-borde); border-radius: var(--radius-sm); padding: 0 .6rem; background: #fff; min-height: 44px; }
.toolbar .search input { border: 0; min-height: 40px; padding: 0; box-shadow: none !important; }
.toolbar .search .icon { color: var(--ui-texto-secundario); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
@media (max-width: 719px) { .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1.25rem; padding: 0 1.25rem .15rem; } .chips::-webkit-scrollbar { display: none; } .chip { flex: none; } }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--ui-borde); background: #fff; font-size: .85rem; font-weight: 600; color: var(--uces-grafito); text-decoration: none; min-height: 34px; cursor: pointer; }
.chip:hover { border-color: var(--uces-verde); color: var(--uces-verde); }
.chip.is-active, .chip[aria-pressed="true"] { background: var(--uces-verde); border-color: var(--uces-verde); color: #fff; }
.chip .badge--count { background: var(--ui-cebra); color: var(--uces-grafito); border-color: var(--ui-borde); }
.chip.is-active .badge--count { background: #fff; color: var(--uces-verde); border-color: #fff; }
.filters-panel { padding: 1.25rem; border-bottom: 1px solid var(--ui-borde-suave); background: var(--ui-cebra); }
.filters-panel[hidden] { display: none; }
.bulkbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem 1.25rem; border-top: 1px solid var(--ui-borde-suave); background: var(--ui-cebra); border-radius: 0 0 var(--radius) var(--radius); }
.bulkbar select { width: auto; min-width: 200px; }

.pagination { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: center; padding: 1rem; }
.pagination a, .pagination span { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 .6rem; border-radius: var(--radius-sm); border: 1px solid var(--ui-borde); text-decoration: none; font-weight: 600; font-size: .9rem; background: #fff; }
.pagination a:hover { border-color: var(--uces-verde); }
.pagination [aria-current="page"] { background: var(--uces-verde); color: #fff; border-color: var(--uces-verde); }
.pagination .gap { border: 0; background: none; }

.empty { text-align: center; padding: 3rem 1.25rem; color: var(--ui-texto-secundario); }
.empty > .icon { width: 44px; height: 44px; color: var(--ui-verde-tinte-fuerte); margin-bottom: .5rem; }
.empty h3 { color: var(--uces-grafito); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--ui-borde); overflow-x: auto; scrollbar-width: thin; padding: 0 1.25rem; }
.tabs a, .tabs button { flex: none; padding: .85rem 1rem; font: inherit; font-weight: 600; font-size: .92rem; color: var(--ui-texto-secundario); text-decoration: none; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover, .tabs button:hover { color: var(--uces-verde); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--uces-verde); border-bottom-color: var(--uces-verde); }
.tab-panel[hidden] { display: none; }

/* ---- Details / disclosure ---- */
details.disclosure { border: 1px solid var(--ui-borde); border-radius: var(--radius); background: #fff; }
details.disclosure > summary { cursor: pointer; padding: .9rem 1.25rem; font-weight: 600; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: ""; margin-left: auto; width: .55rem; height: .55rem; border-right: 2px solid var(--uces-verde); border-bottom: 2px solid var(--uces-verde); transform: rotate(45deg); transition: transform .15s; }
details.disclosure[open] > summary::after { transform: rotate(-135deg); }
details.disclosure > .disclosure__body { padding: 0 1.25rem 1.25rem; }

/* ---- Dialog ---- */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--uces-grafito); }
dialog::backdrop { background: rgba(62, 63, 63, .45); }
.dialog__head { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--ui-borde-suave); display: flex; align-items: center; gap: 1rem; }
.dialog__head h2 { margin: 0; font-size: 1.15rem; }
.dialog__body { padding: 1.25rem 1.5rem; }
.dialog__foot { padding: 1rem 1.5rem; border-top: 1px solid var(--ui-borde-suave); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; background: var(--ui-cebra); }

/* ---- Suggestions box ---- */
.suggest { border: 1px solid var(--ui-verde-tinte-fuerte); background: #fff; border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: .75rem; }
.suggest[hidden] { display: none; }
.suggest h3 { font-size: .95rem; margin-bottom: .35rem; display: flex; gap: .5rem; align-items: center; color: var(--ui-verde-oscuro); }
.typo-hint { font-size: .88rem; margin-top: .4rem; }
.typo-hint[hidden] { display: none; }

/* ---- Footer ---- */
.site-footer { background: var(--ui-superficie); border-top: 1px solid var(--ui-borde); padding: 2rem 0; font-size: .88rem; color: var(--ui-texto-secundario); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--ui-texto-secundario); }
.site-footer a:hover { color: var(--uces-verde); }
.site-footer .lema { font-weight: 700; color: var(--uces-verde); }

/* ---- Success / stat ---- */
.success-panel { text-align: center; padding: 2.5rem 1.25rem; }
.success-panel .icon { width: 56px; height: 56px; color: var(--uces-verde); }
.success-panel .ticket-id { font-size: 1.4rem; padding: .3rem .8rem; display: inline-block; margin: .5rem 0 1rem; }
.stat { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .2rem; }
.stat__label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-texto-secundario); }
.stat__value { font-size: 1.9rem; font-weight: 700; color: var(--uces-grafito); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: .82rem; color: var(--ui-texto-secundario); }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--uces-verde); }

/* ---- Charts (B5) ---- */
.bars { display: grid; gap: .55rem; }
.bar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: .75rem; align-items: center; font-size: .88rem; }
.bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { display: block; height: 14px; background: var(--ui-cebra); border-radius: 4px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--uces-verde); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar__fill--prev { background: var(--ui-verde-claro-pantalla); }
.bar__value { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3ch; text-align: right; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid line { stroke: var(--ui-borde-suave); }
.chart-svg .axis text { fill: var(--ui-texto-secundario); font-size: 11px; font-family: var(--ui-fuente); }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .85rem; color: var(--ui-texto-secundario); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- Rich text editor ---- */
.editor { border: 1px solid var(--ui-borde); border-radius: var(--radius-sm); background: #fff; }
.editor:focus-within { border-color: var(--uces-verde); box-shadow: var(--focus); }
.editor__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: .35rem; border-bottom: 1px solid var(--ui-borde-suave); background: var(--ui-cebra); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.editor__bar button { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; border: 1px solid transparent; background: none; border-radius: 4px; cursor: pointer; font: inherit; font-weight: 700; color: var(--uces-grafito); padding: 0 .35rem; }
.editor__bar button:hover:not(:disabled) { background: #fff; border-color: var(--ui-borde); }
.editor__bar button[aria-pressed="true"] { background: var(--ui-verde-tinte); border-color: var(--ui-verde-tinte-fuerte); color: var(--ui-verde-oscuro); }
.editor__bar button:disabled, .editor__bar select:disabled, .editor__color:has(input:disabled) { opacity: .4; cursor: default; }
.editor__bar select { width: auto; min-height: 32px; padding: 0 1.6rem 0 .5rem; font-size: .85rem; background-color: #fff; background-position: right .45rem center; }
.editor__color { position: relative; display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; border-radius: 4px; cursor: pointer; font-weight: 700; color: var(--uces-grafito); }
.editor__color:hover { background: #fff; }
.editor__color span { line-height: 1; border-bottom: 4px solid var(--swatch, currentColor); padding: 0 2px 1px; }
.editor__color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.editor__bar .sep { align-self: stretch; width: 1px; background: var(--ui-borde); margin: 4px 4px; }
/* Long articles scroll inside the editor so the toolbar stays in view */
.editor__area { min-height: 260px; max-height: 70vh; overflow-y: auto; resize: vertical; padding: .9rem 1rem; outline: none; overflow-wrap: anywhere; }
.editor textarea.editor__source { max-height: 70vh; border: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; box-shadow: none; }

/* =========================================================================
   Admin panel
   ========================================================================= */
.admin-body { min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--ui-superficie); border-right: 1px solid var(--ui-borde); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.sidebar__brand { padding: 22px 24px 18px; border-bottom: 1px solid var(--ui-borde-suave); }
.sidebar__brand a { display: block; text-decoration: none; }
.sidebar__brand .brand__logo { width: 150px; }
.sidebar__brand .brand__sub { display: block; margin-top: .9rem; }
.sidebar nav { padding: .75rem .75rem 1rem; flex: 1; }
.sidebar .nav-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ui-texto-secundario); padding: 1rem .75rem .35rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a.nav-item { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: var(--radius-sm); color: var(--uces-grafito); text-decoration: none; font-weight: 500; font-size: .93rem; }
.sidebar a.nav-item .icon { color: var(--ui-texto-secundario); }
.sidebar a.nav-item:hover { background: var(--ui-resaltado-fila); color: var(--uces-verde); }
.sidebar a.nav-item:hover .icon { color: var(--uces-verde); }
.sidebar a.nav-item[aria-current="page"] { background: var(--ui-verde-tinte); color: var(--ui-verde-oscuro); font-weight: 700; }
.sidebar a.nav-item[aria-current="page"] .icon { color: var(--ui-verde-oscuro); }
.sidebar a.nav-item .badge--count { margin-left: auto; }
.sidebar__foot { padding: 1rem 1.25rem; border-top: 1px solid var(--ui-borde-suave); font-size: .82rem; color: var(--ui-texto-secundario); }
.online-list { list-style: none; padding: 0; margin: .35rem 0 0; }
.online-list li { display: flex; align-items: center; gap: .4rem; padding: .15rem 0; }
.online-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ui-verde-claro-pantalla); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--ui-superficie); border-bottom: 1px solid var(--ui-borde); min-height: 64px; display: flex; align-items: center; gap: .75rem; padding: 0 16px; position: sticky; top: 0; z-index: 30; }
@media (min-width: 768px) { .topbar { padding: 0 28px; } }
.topbar__search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: .5rem; background: var(--ui-cebra); border: 1px solid var(--ui-borde-suave); border-radius: 999px; padding: 0 .9rem; min-height: 42px; }
.topbar__search input { border: 0; background: transparent; min-height: 40px; padding: 0; box-shadow: none !important; }
.topbar__search .icon { color: var(--ui-texto-secundario); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.usermenu { position: relative; }
.usermenu > button:not(.btn) { display: flex; align-items: center; gap: .6rem; background: none; border: 1px solid transparent; border-radius: 999px; padding: .25rem .6rem .25rem .25rem; cursor: pointer; font: inherit; color: var(--uces-grafito); }
.usermenu > button:not(.btn):hover { border-color: var(--ui-borde); }
.usermenu .msg__avatar { width: 34px; height: 34px; background: var(--uces-verde); color: #fff; }
.usermenu__name { font-weight: 600; font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--ui-borde); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: .4rem; z-index: 50; }
.dropdown[hidden] { display: none; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .75rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--uces-grafito); background: none; border: 0; font: inherit; font-size: .92rem; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--ui-resaltado-fila); color: var(--uces-verde); }
.dropdown hr { margin: .35rem 0; }
.admin-content { padding: 1.5rem 16px 3rem; width: 100%; max-width: 1360px; }
@media (min-width: 768px) { .admin-content { padding: 2rem 28px 4rem; } }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(62, 63, 63, .4); z-index: 35; }
  .usermenu__name { display: none; }
}
@media (max-width: 559px) { .topbar__search { display: none; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 16px; }
.login-card { width: min(440px, 100%); }
.login-card .brand { justify-content: center; flex-direction: column; gap: 1rem; padding: 0 0 1.25rem; text-align: center; }
.login-card .brand__text { align-items: center; display: flex; }

/* Admin ticket page */
.ticket-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.quick-form { display: flex; gap: .5rem; align-items: center; }
.quick-form select { min-height: 38px; padding-top: .35rem; padding-bottom: .35rem; font-size: .9rem; }
.timer { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.timer input { width: 120px; font-variant-numeric: tabular-nums; text-align: center; }
.reply-options { display: grid; gap: .25rem 1.5rem; }
@media (min-width: 720px) { .reply-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.perm-grid { display: grid; gap: .25rem 1.5rem; }
@media (min-width: 720px) { .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .perm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tree-indent-1 { padding-left: 1.25rem !important; }
.tree-indent-2 { padding-left: 2.5rem !important; }
.tree-indent-3 { padding-left: 3.75rem !important; }
.tree-indent-4 { padding-left: 5rem !important; }

.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; background: var(--ui-cebra); border: 1px solid var(--ui-borde); border-radius: 4px; padding: .05rem .35rem; }

/* ---- Utilities ---- */
.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: .5rem !important; } .mt-2 { margin-top: 1rem !important; } .mt-3 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: .5rem !important; } .mb-2 { margin-bottom: 1rem !important; } .mb-3 { margin-bottom: 1.5rem !important; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.w-auto { width: auto !important; }
.hide-sm { } @media (max-width: 719px) { .hide-sm { display: none !important; } }
.show-sm { display: none !important; } @media (max-width: 719px) { .show-sm { display: initial !important; } }
.danger-text { color: var(--ui-texto-negativo); }
.ok-text { color: var(--uces-verde); }
[hidden] { display: none !important; }

/* ---- Print ---- */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .sidebar, .topbar, .no-print, .form-actions, .btn, .bulkbar, .toolbar { display: none !important; }
  .card, .msg { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .page, .admin-content { padding: 0; }
  a { color: #000; text-decoration: none; }
  .layout-aside { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
