/* =====================================================================
   SANTO PECADO — Sistema de tickets (cliente y panel)
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--red-bright, #9b2633); color: #fff; font-size: 11px; font-weight: 700; }
.drop__item .nav-badge, .side-nav .nav-badge { margin-left: auto; }

/* Cabeceras y pestañas */
.tk-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.tk-page-head h1 { font-size: 30px; margin: 0 0 6px; }
.tk-page-head p { margin: 0; }
.tk-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tk-tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13.5px; }
.tk-tab small { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(244, 241, 235, .06); color: var(--muted); font-size: 11px; text-align: center; }
.tk-tab:hover { color: var(--white); }
.tk-tab.is-active { color: var(--gold-light); border-bottom-color: var(--gold); }
.tk-tab.is-active small { background: rgba(197, 161, 90, .18); color: var(--gold-light); }

/* Estados, prioridades, chips */
.tk-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid; }
.tk-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tk-status--open { color: #7fb4ff; border-color: rgba(127, 180, 255, .4); background: rgba(127, 180, 255, .08); }
.tk-status--pending { color: var(--warning); border-color: rgba(224, 176, 79, .4); background: rgba(224, 176, 79, .08); }
.tk-status--answered { color: var(--success); border-color: rgba(111, 191, 115, .4); background: rgba(111, 191, 115, .08); }
.tk-status--closed { color: var(--muted); border-color: rgba(244, 241, 235, .15); }
.tk-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.tk-dot--open { background: #7fb4ff; box-shadow: 0 0 10px #7fb4ff; }
.tk-dot--pending { background: var(--warning); box-shadow: 0 0 10px var(--warning); }
.tk-dot--answered { background: var(--success); box-shadow: 0 0 10px var(--success); }
.tk-dot--closed { background: var(--muted-2); }
.tk-prio { display: inline-flex; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tk-prio--low { color: var(--muted); background: rgba(244, 241, 235, .05); }
.tk-prio--normal { color: var(--bone, #E9E1CF); background: rgba(244, 241, 235, .08); }
.tk-prio--high { color: #ffb36b; background: rgba(255, 140, 50, .12); }
.tk-prio--urgent { color: #fff; background: #b3263a; box-shadow: 0 0 16px -4px #e2465a; }
.tk-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); background: rgba(8, 8, 8, .5); }
.tk-chip .ico { color: var(--gold); }
.tk-new { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--success); font-weight: 600; }

/* Lista de tickets del cliente */
.tk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tk-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, #121110, #0c0c0b); color: var(--white); transition: border-color .2s, transform .25s var(--ease); }
.tk-item:hover { color: var(--white); border-color: var(--line-strong); transform: translateY(-2px); }
.tk-item.is-new { border-color: rgba(111, 191, 115, .45); box-shadow: inset 3px 0 0 var(--success); }
.tk-item__main { display: grid; gap: 6px; min-width: 0; }
.tk-item__top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-item__subject { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-item__meta { font-size: 12.5px; color: var(--muted-2); }
.tk-item__side { display: grid; justify-items: end; gap: 6px; }
.tk-help { display: flex; gap: 14px; align-items: center; margin-top: 28px; padding: 18px 20px; border-radius: 14px; border: 1px dashed var(--line-strong); }
.tk-help > .ico { width: 26px; height: 26px; color: var(--gold); }
.tk-help div { display: grid; gap: 2px; font-size: 14px; }

/* Nuevo ticket */
.tk-new { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.tk-new__main { display: grid; gap: 22px; justify-items: start; }
.tk-new__main > .panel { width: 100%; margin: 0; }
.tk-new__side { display: grid; gap: 22px; position: sticky; top: calc(var(--header-h) + 20px); }
.tk-new__side .panel + .panel { margin-top: 0; }
.tk-step { display: flex; align-items: center; gap: 12px; font-size: 18px; margin-bottom: 18px; }
.tk-step span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-metal); color: #140f07; font-size: 14px; font-family: var(--font-body); font-weight: 700; }
.tk-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tk-topic { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(8, 8, 8, .5); cursor: pointer; transition: border-color .2s, background .2s; }
.tk-topic input { position: absolute; opacity: 0; pointer-events: none; }
.tk-topic__icon { flex: 0 0 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(197, 161, 90, .1); color: var(--gold); }
.tk-topic__text { display: grid; gap: 3px; }
.tk-topic__text strong { font-size: 14.5px; }
.tk-topic__text small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.tk-topic:hover { border-color: var(--line-strong); }
.tk-topic:has(input:checked) { border-color: var(--gold); background: rgba(197, 161, 90, .08); box-shadow: inset 0 0 0 1px var(--gold); }
.tk-topic:has(input:checked) .tk-topic__icon { background: var(--gold-metal); color: #140f07; }
.tk-topic:has(input:focus-visible) { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.tk-drop { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px; border-radius: 14px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; cursor: pointer; text-align: center; transition: border-color .2s, background .2s; }
.tk-drop:hover { border-color: var(--gold); background: rgba(197, 161, 90, .04); color: var(--gold-light); }
.tk-drop input, .tk-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tk-drop .ico { width: 24px; height: 24px; color: var(--gold); }
.tk-file-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tk-file-list:empty { display: none; }
.tk-file-list--inline { margin: 0; flex: 1; }
.tk-file { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 8, 8, .6); font-size: 12px; color: var(--muted); max-width: 220px; }
.tk-file img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.tk-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-file.is-error { border-color: rgba(226, 100, 111, .5); color: var(--danger); }
.mini-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-links a { display: block; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.mini-links a:hover { background: rgba(197, 161, 90, .06); }

/* Vista de ticket */
.tk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.tk-head h1, .tk-head h2 { margin: 6px 0 10px; font-size: clamp(22px, 2.6vw, 30px); }
.tk-head__ref { font-size: 13px; }
.tk-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tk-banner { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 14px; margin-bottom: 24px; font-size: 14px; border: 1px solid var(--line); background: rgba(8, 8, 8, .5); }
.tk-banner .ico { flex: 0 0 auto; }
.tk-banner--answered { border-color: rgba(111, 191, 115, .4); background: rgba(111, 191, 115, .07); }
.tk-banner--answered .ico { color: var(--success); }
.tk-banner--pending .ico, .tk-banner--open .ico { color: var(--warning); }
.tk-banner--closed .ico { color: var(--muted); }
.tk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.tk-layout--admin { grid-template-columns: minmax(0, 1fr) 340px; }
.tk-side { display: grid; gap: 18px; }
.tk-side .panel { padding: 22px; margin: 0; }
.tk-side .panel + .panel { margin-top: 0; }
.tk-side .kv { display: grid; grid-template-columns: 105px 1fr; gap: 10px 12px; margin: 0; font-size: 13.5px; }
.tk-side .kv dt { color: var(--muted); }
.tk-side .kv dd { margin: 0; min-width: 0; word-break: break-word; }
.tk-side__label { margin: 16px 0 6px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }

/* Conversación */
.tk-thread { display: grid; gap: 18px; margin-bottom: 22px; }
.tmsg { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: start; max-width: 88%; }
.tmsg--mine { margin-left: auto; grid-template-columns: minmax(0, 1fr) 44px; }
.tmsg--mine .tmsg__avatar { order: 2; }
.tmsg__avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: rgba(197, 161, 90, .12); border: 1px solid var(--line-strong); color: var(--gold-light); font-family: var(--font-display); font-weight: 700; }
.tmsg__avatar img { width: 100%; height: 100%; object-fit: cover; }
.tmsg--staff .tmsg__avatar { background: #0b0b0a; }
.tmsg--staff .tmsg__avatar img { object-fit: contain; padding: 3px; }
.tmsg__bubble { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: #121110; }
.tmsg--mine .tmsg__bubble { border-top-right-radius: 4px; }
.tmsg:not(.tmsg--mine) .tmsg__bubble { border-top-left-radius: 4px; }
.tmsg--staff .tmsg__bubble { background: linear-gradient(160deg, rgba(197, 161, 90, .1), #121110 70%); border-color: var(--line-strong); }
.tmsg--internal .tmsg__bubble { background: repeating-linear-gradient(135deg, rgba(224, 176, 79, .06) 0 12px, rgba(224, 176, 79, .03) 12px 24px), #14120d; border: 1px dashed rgba(224, 176, 79, .5); }
.tmsg__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.tmsg__head strong { color: var(--white); }
.tmsg--staff .tmsg__head strong { color: var(--gold-light); }
.tmsg__head time { margin-left: auto; color: var(--muted-2); font-size: 12px; }
.tmsg__tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-light); background: rgba(197, 161, 90, .12); }
.tmsg__tag--internal { color: var(--warning); background: rgba(224, 176, 79, .14); }
.tmsg__body { font-size: 14.5px; line-height: 1.65; color: rgba(244, 241, 235, .9); word-wrap: break-word; }
.tmsg__files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.tmsg__file { display: block; width: 120px; height: 90px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); transition: border-color .2s, transform .2s; }
.tmsg__file:hover { border-color: var(--gold); transform: scale(1.03); }
.tmsg__file img { width: 100%; height: 100%; object-fit: cover; }

/* Editor de respuesta */
.tk-composer { display: grid; gap: 12px; padding: 18px; border-radius: 16px; border: 1px solid var(--line-strong); background: #0f0e0d; scroll-margin-top: 100px; }
.tk-composer .textarea { min-height: 120px; }
.tk-composer__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tk-composer__bar .btn--gold { margin-left: auto; }
.tk-attach { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; cursor: pointer; }
.tk-attach:hover { border-color: var(--line-strong); color: var(--gold-light); }
.tk-attach:focus-within { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.tk-mode { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: rgba(8, 8, 8, .6); border: 1px solid var(--line); width: max-content; max-width: 100%; }
.tk-mode label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }
.tk-mode input { position: absolute; opacity: 0; pointer-events: none; }
.tk-mode label:has(input:checked) { background: rgba(197, 161, 90, .14); color: var(--gold-light); }
.tk-mode label:has(input[value="1"]:checked) { background: rgba(224, 176, 79, .16); color: var(--warning); }
.tk-quick { max-width: 360px; }
.tk-internal-hint { display: none; margin: 0; font-size: 12.5px; color: var(--warning); align-items: center; gap: 6px; }
.tk-composer--staff:has(input[name="internal"][value="1"]:checked) { border-color: rgba(224, 176, 79, .6); border-style: dashed; background: #13110c; }
.tk-composer--staff:has(input[name="internal"][value="1"]:checked) .tk-internal-hint { display: flex; }
.tk-composer--staff:has(input[name="internal"][value="1"]:checked) .tk-close-btn { display: none; }
.tk-closed-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 18px; border-radius: 14px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 14px; }
.tk-closed-box span { display: inline-flex; gap: 8px; align-items: center; }

/* Gestión (panel) */
.tk-props { display: grid; gap: 12px; margin-bottom: 16px; }
.tk-props .select { padding-top: 10px; padding-bottom: 10px; }
.tk-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-height: 340px; overflow-y: auto; }
.tk-events li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 13px; }
.tk-events__icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(197, 161, 90, .08); color: var(--gold); }
.tk-events time { display: block; color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
.tk-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.tk-filters .input-icon { flex: 1; min-width: 240px; max-width: 420px; }
.tk-filters .select { width: auto; min-width: 160px; padding-top: 10px; padding-bottom: 10px; }
.tk-filters__replies { margin-left: auto; }
.tk-table td { vertical-align: middle; }
.tk-row__link { display: grid; gap: 3px; color: var(--white); }
.tk-row__link:hover strong { color: var(--gold-light); }
.tk-row__meta { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; color: var(--muted-2); }
.tk-row--urgent td:first-child { box-shadow: inset 3px 0 0 #e2465a; }
.tk-row--high td:first-child { box-shadow: inset 3px 0 0 #ff8c32; }
.tk-sla { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.tk-sla--ok { color: var(--success); }
.tk-sla--warn { color: var(--warning); }
.tk-sla--late { color: var(--danger); }
.tk-replies { display: grid; gap: 14px; }
.tk-reply { margin: 0 !important; }
.tk-reply__body { margin: 0; color: rgba(244, 241, 235, .78); font-size: 14px; }

/* Valoración */
.stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; margin-bottom: 14px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { cursor: pointer; color: var(--muted-2); transition: color .15s, transform .15s; }
.stars label .ico { width: 30px; height: 30px; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: var(--gold-light); }
.stars label:hover { transform: scale(1.12); }
.stars input:checked ~ label .ico, .stars label:hover .ico, .stars label:hover ~ label .ico { fill: currentColor; }
.stars input:focus-visible + label { outline: 2px solid var(--gold-light); border-radius: 4px; }
.tk-rate .textarea { min-height: 80px; margin-bottom: 12px; }
.stars-static { display: inline-flex; gap: 3px; color: var(--muted-2); margin-bottom: 8px; }
.stars-static .on { color: var(--gold-light); }
.stars-static .on .ico { fill: currentColor; }

@media (max-width: 1100px) {
  .tk-layout, .tk-layout--admin, .tk-new { grid-template-columns: 1fr; }
  .tk-new__side { position: static; }
  .tk-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tk-topics { grid-template-columns: 1fr; }
  .tk-item { grid-template-columns: auto 1fr; padding: 16px; gap: 12px; }
  .tk-item__side { grid-column: 2; justify-items: start; grid-auto-flow: column; justify-content: start; gap: 10px; }
  .tmsg, .tmsg--mine { max-width: 100%; }
  .tmsg { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
  .tmsg--mine { grid-template-columns: minmax(0, 1fr) 36px; }
  .tmsg__avatar { width: 36px; height: 36px; }
  .tmsg__file { width: 96px; height: 72px; }
  .tk-composer__bar .btn--gold { width: 100%; margin-left: 0; }
  .tk-mode { width: 100%; }
  .tk-mode label { flex: 1; justify-content: center; padding: 8px; }
  .tk-filters__replies { margin-left: 0; }
}

/* ---------------------------------------------------------------- Pagos: PayPal y SINPE Móvil */
.pay-method__icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; border: 1px solid var(--line); color: var(--gold); background: rgba(197, 161, 90, .06); }
.pay-method:has(input:checked) .pay-method__icon { border-color: var(--gold); }
.sinpe-steps { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 10px; }
.sinpe-steps li { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "n label btn" "n value btn" "n hint hint"; column-gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(8, 8, 8, .45); }
.sinpe-steps li::before { content: attr(data-n); grid-area: n; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); font-family: var(--font-display); font-size: 13px; }
.sinpe-steps li > span:first-child { grid-area: label; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sinpe-steps li > strong { grid-area: value; font-size: 20px; letter-spacing: .03em; }
.sinpe-steps li > .btn { grid-area: btn; }
.sinpe-steps li > small { grid-area: hint; color: var(--muted); font-size: 12px; margin-top: 4px; }
.paypal-box { max-width: 460px; margin-top: 14px; padding: 16px; border-radius: 12px; background: rgba(244, 241, 235, .97); }
.paypal-box__holder { min-height: 50px; }
.paypal-box__loading { display: flex; align-items: center; gap: 8px; color: #333; font-size: 14px; }
.paypal-box.is-ready .paypal-box__loading { display: none; }
.paypal-box.is-fallback { background: transparent; padding: 0; }
.paypal-box [data-paypal-status] { margin-top: 10px; color: #222; }
.paypal-box.is-fallback [data-paypal-status] { color: inherit; }
.receipt-thumb { display: grid; gap: 6px; margin-top: 12px; text-decoration: none; }
.receipt-thumb img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.receipt-thumb span { font-size: 12px; color: var(--gold-light); }
@media (max-width: 560px) {
  .sinpe-steps li { grid-template-columns: auto 1fr; grid-template-areas: "n label" "n value" "n btn" "n hint"; }
  .sinpe-steps li > .btn { justify-self: start; margin-top: 6px; }
}
