/* ═══════════════════════════════════════════════════════════════
   Support tickets — stats, filter row, ticket table
   ═══════════════════════════════════════════════════════════════ */

/* ── STAT MINI ── */
.sup-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 900px) {
    .sup-stats { grid-template-columns: repeat(2, 1fr); }
}
.sup-stat {
    background: var(--white);
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.sup-stat__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--blue-800);
    line-height: 1.1;
}
.sup-stat__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--gray-400);
    margin-top: 4px;
}
.sup-stat__sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}
.sup-stat__icon {
    position: absolute;
    top: 10px; right: 12px;
    font-size: 22px;
    opacity: .15;
}

/* ── FILTER ROW ── */
.sup-filters {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.sup-filters__input {
    flex: 1;
    min-width: 160px;
}
.sup-filters__pick {
    /* Wide enough for "Todas las prioridades" / "Todas las categorías" without cutting the text. */
    flex: 0 0 auto;
    min-width: 200px;
}
@media (max-width: 700px) {
    .sup-filters__pick { width: 100%; }
}

/* ── TICKET TABLE ── */
.sup-table-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    overflow: hidden;
}
.sup-table {
    width: 100%;
    border-collapse: collapse;
}
.sup-table th {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--gray-400);
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.sup-table td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.sup-table tr:last-child td { border-bottom: none; }
.sup-table tr:hover td { background: var(--blue-50); }

.sup-table__id { font-weight: 700; color: var(--blue-700); }
.sup-table__id--resolved { color: var(--gray-300); }
.sup-table__subject { font-weight: 600; color: var(--gray-800); }
.sup-table__subject--resolved {
    text-decoration: line-through;
    color: var(--gray-400);
}
.sup-table__subline {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}
.sup-table__contact {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sup-table__due--overdue {
    color: var(--red-500);
    font-weight: 600;
}
.sup-table__due--past {
    color: var(--gray-400);
}

.sup-pager {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sup-pager__info {
    font-size: 12px;
    color: var(--gray-400);
}
.sup-pager__nav {
    display: flex;
    gap: 5px;
    align-items: center;
}
.sup-pager__num {
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-800);
    padding: 0 8px;
}

/* ── BADGES (support-specific) ── */
.sup-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.sup-badge--new      { background: var(--blue-100); color: var(--blue-700); border-color: var(--blue-100); }
.sup-badge--open     { background: var(--orange-100); color: var(--orange-500); border-color: var(--orange-border); }
.sup-badge--progress { background: var(--gold-100); color: var(--gold-600); border-color: var(--gold-200); }
.sup-badge--resolved { background: var(--green-100); color: var(--green-500); border-color: var(--green-border); }
.sup-badge--closed   { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-200); }
.sup-badge--high     { background: var(--red-100); color: var(--red-500); border-color: var(--red-border); }
.sup-badge--med      { background: var(--gold-100); color: var(--gold-600); border-color: var(--gold-200); }
.sup-badge--low      { background: var(--green-100); color: var(--green-500); border-color: var(--green-border); }

/* ═══════════════════════════════════════════════════════════════
   S1 · bandeja, detalle, ficha del contacto y portal (solo variables del tema: claro y oscuro)
   ═══════════════════════════════════════════════════════════════ */
.sup-badge--waiting { background: var(--gold-100); color: var(--gold-600); border-color: var(--gold-200); }

.sup-alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); }
.sup-alert--error { background: var(--red-100); border-color: var(--red-border); color: var(--red-600); }
.sup-alert--ok { background: var(--green-100); border-color: var(--green-border); color: var(--green-600); }
.sup-hint { font-size: 12px; color: var(--gray-500); }
.sup-empty { text-align: center; padding: 32px; color: var(--gray-400); }

.sup-views { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.sup-view { border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-600); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sup-view--on { background: var(--blue-50); border-color: var(--blue-600); color: var(--blue-800); }
.sup-view:focus-visible, .sup-file:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

.sup-table__subject a { color: inherit; text-decoration: none; }
.sup-table__subject a:hover { text-decoration: underline; }
.sup-row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

.sup-detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .sup-detail { grid-template-columns: 1fr; } }
.sup-detail__main, .sup-detail__side { background: var(--white); border: 1px solid var(--gray-100); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm); }
.sup-detail__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sup-detail__number { font-weight: 700; color: var(--blue-700); }
.sup-detail__subject { font-size: 18px; margin: 0; color: var(--gray-800); flex: 1; min-width: 0; }
.sup-side__row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: 13px; color: var(--gray-700); }
.sup-side__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-400); }
.sup-side__row select, .sup-inline select { border: 1px solid var(--gray-200); border-radius: 8px; padding: 6px 8px; background: var(--white); color: var(--gray-800); font: inherit; }
.sup-inline { display: flex; gap: 6px; align-items: center; }
.sup-inline select { flex: 1; min-width: 0; }

.sup-thread { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sup-entry { border: 1px solid var(--gray-100); border-radius: 12px; padding: 10px 14px; background: var(--white); }
.sup-entry--customer { background: var(--blue-50); border-color: var(--blue-100); }
.sup-entry--note { background: var(--gold-100); border-color: var(--gold-200); }
.sup-entry--event { border: none; background: transparent; padding: 2px 4px; font-size: 12px; color: var(--gray-500); display: flex; gap: 6px; align-items: center; }
.sup-entry__head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--gray-800); margin-bottom: 4px; }
.sup-entry__tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-600); }
.sup-entry__when { margin-left: auto; font-size: 11px; color: var(--gray-400); }
.sup-entry__body { font-size: 14px; color: var(--gray-800); line-height: 1.5; overflow-wrap: anywhere; }
.sup-entry__body p { margin: 0 0 8px; }
.sup-entry__body a { color: var(--blue-700); }
.sup-entry__body ul, .sup-entry__body ol { margin: 0 0 8px; padding-left: 22px; }
.sup-entry__body ul { list-style: disc; }
.sup-entry__body ol { list-style: decimal; }
.sup-entry__body > :last-child { margin-bottom: 0; }
.sup-entry__files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sup-file { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.sup-file span { color: var(--gray-400); }

.sup-composer { border-top: 1px solid var(--gray-100); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sup-composer__tabs { display: flex; gap: 6px; }
.sup-composer__text { width: 100%; border: 1px solid var(--gray-200); border-radius: 10px; padding: 10px; font: inherit; background: var(--white); color: var(--gray-800); resize: vertical; }
.sup-composer__text--note { background: var(--gold-100); border-color: var(--gold-200); }
/* Rich-text body (SupportEditor): the base colors come from the theme-token .e-richtexteditor rules in comms.css; the internal note
   keeps its gold tint like its entries in the thread. */
.sup-editor .e-richtexteditor { border-radius: 10px; overflow: hidden; }
.sup-editor--note .e-richtexteditor { border-color: var(--gold-200) !important; }
.sup-editor--note .e-richtexteditor .e-rte-content,
.sup-editor--note .e-richtexteditor .e-rte-content .e-content { background: var(--gold-100) !important; }
.sup-composer__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sup-composer__row > .comms-btn:last-child { margin-left: auto; }
.sup-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--gray-700); }
.sup-picked { font-size: 12px; color: var(--gray-500); }

.sup-form { display: flex; flex-direction: column; gap: 10px; }
.sup-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--gray-600); }
.sup-form label.sup-check { flex-direction: row; font-weight: 500; }
.sup-field { display: flex; flex-direction: column; gap: 4px; }
.sup-field__label { font-size: 12px; font-weight: 600; color: var(--ds-color-text-muted, var(--gray-500)); text-transform: uppercase; letter-spacing: 0.4px; }
.sup-form input[type=text], .sup-form input[type=search], .sup-form input[type=number], .sup-form textarea, .sup-form select {
    border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--white); color: var(--gray-800); }

.sup-contact__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.sup-contact__title { font-size: 15px; margin: 0; color: var(--gray-800); display: flex; gap: 6px; align-items: center; }

/* .sup-form is a flex column; the categories table also uses it for its inputs, so give the table its own layout back
   (otherwise the Activa / Orden headings don't line up with their columns). */
.sup-cats, .sup-cats.sup-form { display: table; width: 100%; border-collapse: collapse; }
.sup-cats td, .sup-cats th { padding: 8px; border-bottom: 1px solid var(--gray-100); text-align: left; font-size: 13px; color: var(--gray-700); }
.sup-cats input[type=text] { width: 100%; }
.sup-cats input[type=number] { width: 72px; }
/* Holidays: the date in Spanish next to (or instead of) the browser's native date field. */
.sup-holiday__date { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-holiday__text { font-weight: 600; color: var(--gray-800); }
.sup-holiday__label { font-size: 12px; color: var(--gray-500); }

.sup-portal { display: flex; flex-direction: column; gap: 14px; }
.sup-portal__back { color: var(--blue-700); text-decoration: none; font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.sup-portal__list { list-style: none; margin: 0; padding: 0; }
.sup-portal__row { display: flex; gap: 10px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); text-decoration: none; }
.sup-portal__row:hover { background: var(--blue-50); }
.sup-portal__num { font-weight: 700; color: var(--blue-700); min-width: 56px; }
.sup-portal__subject { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sup-portal__meta { font-size: 12px; color: var(--gray-400); }
.sup-portal__form-title { font-size: 16px; margin: 0; color: var(--gray-800); }

/* Links inside the ticket (contact, related ticket): theme colour, also once visited (the browser's purple is unreadable in dark). */
.sup-detail a, .sup-detail a:visited { color: var(--blue-600); text-decoration: none; }
.sup-detail a:hover { text-decoration: underline; }

/* "Nuevo ticket" from the inbox: contact lookup. */
/* flex-shrink: 0 — the modal body is a scrolling flex column; without it a short window squeezed the list to a few pixels. */
.sup-pick { flex-shrink: 0; list-style: none; margin: -4px 0 0; padding: 4px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--white); max-height: 220px; overflow-y: auto; }
.sup-pick__item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
    background: transparent; color: var(--gray-800); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.sup-pick__item span { font-size: 12px; color: var(--gray-500); }
.sup-pick__item:hover, .sup-pick__item:focus-visible { background: var(--blue-50); }
.sup-pick__none { font-size: 12px; color: var(--gray-500); }
.sup-picked { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; color: var(--gray-800); }
.sup-picked span { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   SLA (S2) — cards, clocks, chips and the settings screen
   ═══════════════════════════════════════════════════════════════ */
.sup-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .sup-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .sup-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sup-stat__value--alert { color: var(--red-500); }

.sup-sla { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; line-height: 1.3; border-radius: 999px;
    padding: 2px 8px; border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-600); }
.sup-sla--risk { background: var(--gold-100); color: var(--gold-600); border-color: var(--gold-200); }
.sup-sla--breached { background: var(--red-100); color: var(--red-600); border-color: var(--red-border); }
.sup-sla--met { background: var(--green-100); color: var(--green-600); border-color: var(--green-border); }
.sup-sla--paused { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }
.sup-table__subject .sup-sla { margin-left: 6px; vertical-align: middle; }

.sup-sla-line { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 4px; }
.sup-sla-line__label { font-size: 12px; color: var(--gray-500); }
.sup-sla-line__due { font-size: 11px; color: var(--gray-400); }

.sup-settings__section { background: var(--white); border: 1px solid var(--gray-100); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm);
    margin-bottom: 16px; }
.sup-settings__title { font-size: 16px; margin: 0 0 12px; color: var(--gray-800); display: flex; gap: 6px; align-items: center; }
.sup-settings__subtitle { font-size: 14px; margin: 16px 0 8px; color: var(--gray-700); }
.sup-settings__actions { margin-top: 12px; }
.sup-hours__day { font-weight: 600; white-space: nowrap; color: var(--gray-700); }
.sup-hours__windows { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sup-hours__window { display: inline-flex; gap: 4px; align-items: center; color: var(--gray-500); }
.sup-hours__window input[type=text] { width: 64px; text-align: center; }
.sup-cats input[type=date] { border: 1px solid var(--gray-200); border-radius: 8px; padding: 6px 8px; font: inherit; background: var(--white); color: var(--gray-800); }

/* ── S3: merge, collections, saved replies, satisfaction (tokens only: readable in light and dark) ── */
.sup-entry__tag--copy { background: var(--gold-100); color: var(--gold-600); border: 1px solid var(--gold-200); }
.sup-banner { padding: 8px 12px; margin: 8px 0; border-radius: 8px; border: 1px solid var(--blue-100); background: var(--blue-50); color: var(--blue-800); font-size: 13px; }
.sup-banner a { color: var(--blue-700); font-weight: 600; }
.sup-chip { display: inline-block; margin: 2px 4px 0 0; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--blue-50); color: var(--blue-700); }
.sup-chip--rating { background: var(--green-100); color: var(--green-600); border: 1px solid var(--green-border); }
.sup-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--gold-200); background: var(--gold-100); color: var(--gray-800); }
.sup-bulk__count { font-weight: 600; margin-right: 4px; }
.sup-bulk select { min-width: 180px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-800); }
.sup-table__check { width: 1%; text-align: center; }
.sup-merge-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 320px; overflow: auto; }
.sup-merge-list li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); }
.sup-collection__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .sup-collection__grid { grid-template-columns: minmax(0, 1fr); } }
.sup-collection select, .sup-collection textarea { width: 100%; }
.sup-result { margin-top: 8px; font-size: 13px; color: var(--gray-700); }
.sup-result ul { margin: 4px 0 0; padding-left: 18px; }
.sup-csat { max-width: 560px; margin: 24px auto; padding: 24px; border-radius: 14px; border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-800); }
.sup-csat__title { margin: 0 0 8px; font-size: 20px; color: var(--blue-800); }
.sup-csat__scores { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sup-csat__score { min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--gold-200); background: var(--gold-100); color: var(--gray-800); font-weight: 700; cursor: pointer; }
.sup-csat__score:hover, .sup-csat__score--on { background: var(--gold-600); color: var(--white); }
.sup-csat input[type=text], .sup-csat-inline input[type=text] { font: inherit; width: 100%; margin: 6px 0; padding: 8px; border-radius: 8px; border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-800); }
/* New collection: name, description and the button on one row that wraps on a phone. */
.sup-form.sup-new { flex-direction: row; flex-wrap: wrap; align-items: center; }
.sup-form.sup-new input { flex: 1 1 220px; min-width: 0; }
/* Collection page: the saved-reply picker and the ticket links in theme colors. */
.sup-collection select { padding: 6px 8px; margin: 4px 0 8px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--white); color: var(--gray-800); font: inherit; }
.sup-collection .sup-table a { color: var(--blue-700); font-weight: 600; text-decoration: none; }
.sup-collection .sup-table a:hover { text-decoration: underline; }
/* Support settings → auto-close: sentence, days and the button on one row. */
.sup-autoclose__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--gray-800); font-size: 14px; }
.sup-autoclose__row input { width: 80px; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--white); color: var(--gray-800); font: inherit; }

/* File picker in Spanish (SupportFilePicker): the native input is visually hidden but still focusable and clickable through the label. */
.sup-file { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.sup-file__input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sup-file__input:focus-visible + .sup-file__button { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.sup-file__names { font-size: 12px; color: var(--gray-500); }

/* The Sales Funnel stylesheet styles every <label> (uppercase, block, margins); checkbox labels in Support are plain sentences. */
.sup-check, .sup-merge-list label { display: inline-flex; align-items: center; gap: 6px; margin: 0; text-transform: none; letter-spacing: normal;
    font-size: 13px; font-weight: 500; color: var(--gray-700); }
.sup-merge-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sup-merge-list li { display: flex; align-items: center; gap: 8px; }
.sup-merge-list label { display: inline; }

/* Portal panels that only hold text (closed notice, rating) need their own padding. */
[data-testid=portal-closed], .sup-csat-inline { padding: 16px 18px; }
