:root{
  --bg:#0b0f1a; --card:#111829; --text:#e6eefc; --muted:#93a4c4;
  --primary:#7df9ff; --accent:#8a63ff; --success:#0ee5a0;
  --warning:#f7c948; --danger:#ff5d5d;
  --radius:18px; --border:1px solid rgba(255,255,255,.08);
  --shadow:0 10px 30px rgba(0,0,0,.35);
}
*{ box-sizing:border-box } html,body{ height:100% }
body{
  margin:0; font-family:"Outfit",system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial,sans-serif;
  background:linear-gradient(180deg,#0b0f1a 0%, #0c1324 100%); color:var(--text); -webkit-font-smoothing:antialiased
}

/* Topbar */
.topbar{ position:sticky; top:0; z-index:10; display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; background:rgba(17,24,41,.9); backdrop-filter: blur(8px); border-bottom:var(--border) }
.brand{ display:flex; gap:10px; align-items:center; font-weight:700; letter-spacing:.2px } .brand i{ color:var(--primary) }
.top-actions .btn{ margin-left:8px }

/* Layout base */
.container{ max-width:760px; margin:28px auto; padding:0 16px }
.card{ background:var(--card); border:var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px }
.card.single h2{ margin:0 0 6px; font-weight:700 }
.muted{ color:var(--muted) } .small{ font-size:.85rem }
code{ background:rgba(255,255,255,.06); padding:2px 6px; border-radius:8px }

/* Form */
.form{ display:grid; gap:12px }
label{ font-weight:600; color:var(--text) }
input, select, textarea{ width:100%; padding:12px 12px; border-radius:14px; border:var(--border); background:#0d1426; color:var(--text); outline:none }
input::placeholder, textarea::placeholder{ color:#7f8fb1 } textarea{ resize:vertical }
.input-icon{ position:relative } .input-icon i{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#798bb0; pointer-events:none }
.input-icon input{ padding-left:38px }

/* Botões */
.btn{ display:inline-flex; align-items:center; gap:8px; border-radius:14px; padding:12px 16px; border:var(--border);
  background:#0d1426; color:var(--text); text-decoration:none; cursor:pointer }
.btn.full{ width:100%; justify-content:center }
.btn.primary{ background:linear-gradient(90deg,var(--accent),var(--primary)); color:#06121e; font-weight:700; border:none }
.btn.success{ background:linear-gradient(90deg,#18e7a9,#82ffd9); color:#06281f; font-weight:700; border:none }
.btn.ghost{ background:transparent } .btn:hover{ filter:brightness(1.05) }

.grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px }
@media (max-width:720px){ .grid{ grid-template-columns:1fr } }

.divider{ height:1px; background:rgba(255,255,255,.08); margin:16px 0 6px; border-radius:10px }
.footer{ margin:24px 0 8px; text-align:center; color:var(--muted); font-size:.95rem }
.hide-sm{ display:inline } @media (max-width:520px){ .hide-sm{ display:none } }

/* Resultado da consulta */
.result{ margin-top:14px }
.result.hidden{ display:none }

/* ---------- Ticket card com ribbon lateral (corrigido) ---------- */
.ticket-card{
  position: relative;
  background:#0d1426; border:var(--border); border-radius:14px;
  box-shadow:var(--shadow);
  /* reserva espaço pro ribbon lateral (fixo) */
  padding:16px 16px 16px 150px;
}
.ticket-card .ribbon{
  position:absolute; z-index:2;
  left:0px; top:16px;
  width:130px; /* largura fixa para não sobrepor conteúdo */
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 12px 10px 18px;
  border-radius:0 999px 999px 0;
  font-weight:700; letter-spacing:.2px;
  box-shadow:0 8px 22px rgba(0,0,0,.35);
}
.ribbon.aberto  { background:rgba(247,201,72,.18); color:var(--warning); border:1px solid rgba(247,201,72,.35) }
.ribbon.analise { background:rgba(138,99,255,.18); color:var(--accent);  border:1px solid rgba(138,99,255,.35) }
.ribbon.fechado { background:rgba(14,229,160,.18); color:var(--success); border:1px solid rgba(14,229,160,.35) }

.ticket-header{ display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center }
.ticket-header .t-num{ font-weight:800; }
.ticket-header small{ color:var(--muted) }

/* Responsivo: abaixo de 560px, ribbon vira badge acima do card */
@media (max-width:560px){
  .ticket-card{ padding:56px 14px 14px 14px; } /* espaço vertical pro badge */
  .ticket-card .ribbon{
    position:absolute; left:14px; top:-12px; width:auto;
    border-radius:12px; padding:8px 12px;
  }
}

/* ---------- Linha do tempo / tracker ---------- */
.tracker{ margin-top:12px; padding:6px 2px 2px; display:grid; gap:16px }
.tracker-steps{
  display:grid; grid-template-columns: repeat(3,1fr); gap:12px;
}
@media (max-width:560px){
  .tracker-steps{ grid-template-columns:1fr; }
}
.step{
  position:relative; background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.06);
  border-radius:12px; padding:12px 12px 12px 48px; min-height:58px;
}
.step .dot{
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  width:20px; height:20px; border-radius:50%;
  border:2px solid rgba(255,255,255,.25); background:transparent;
  display:flex; align-items:center; justify-content:center; font-size:.72rem;
}
.step .title{ font-weight:700; margin:0; }
.step .time{ color:var(--muted); font-size:.86rem; margin-top:2px }

.step.active { border-color: rgba(125,249,255,.45); box-shadow:0 8px 20px rgba(125,249,255,.08); }
.step.active .dot{ background:var(--primary); border-color:var(--primary); color:#0a1222 }
.step.done   { border-color: rgba(14,229,160,.45); }
.step.done .dot{ background:var(--success); border-color:var(--success); color:#072218 }
.step.pending{ opacity:.62 }

/* Detalhes do ticket */
.ticket-details{ margin-top:8px; line-height:1.6 }

/* ---------- Thumbs (página de abertura) ---------- */
.thumbs{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:10px; margin-top:8px;
}
.thumb{
  position:relative; width:100%; aspect-ratio:1/1; border:var(--border); border-radius:12px; overflow:hidden;
  background:#0d1426; display:flex; align-items:center; justify-content:center;
}
.thumb img, .thumb video{ width:100%; height:100%; object-fit:cover; display:block }
.thumb .label{
  position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.55); color:#fff; font-size:.7rem;
  padding:2px 6px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
}
.thumb .remove{
  position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; border:var(--border);
  background:rgba(0,0,0,.45); color:#fff; cursor:pointer
}
.thumb.file{ font-size:.75rem; color:var(--muted); padding:6px; text-align:center }


/* Ações inline ao lado do select (caneta / lixeira) */
.inline-actions{
  display:flex; align-items:center; gap:8px;
}
.inline-actions select{ flex:1 }
.icon-btn{
  min-width:40px; height:40px; border-radius:10px; border:var(--border);
  background:#0d1426; color:var(--text); display:inline-flex; align-items:center; justify-content:center;
}
.icon-btn:hover{ filter:brightness(1.1) }
.icon-btn.danger{ color:var(--danger); border-color:rgba(255,93,93,.3) }


/* ====== MODAL (SweetAlert2) — tema GRPX ====== */
.swal2-popup{
  background: #0f172a !important;              /* mais escuro */
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 18px !important;
  box-shadow: 0 22px 60px rgba(0,0,0,.55) !important;
  color: var(--text) !important;
}
.swal2-title{
  font-weight: 800 !important;
  letter-spacing: .3px !important;
  color: var(--text) !important;
}
.swal2-html-container{ margin: 12px 0 0 !important }

/* entradas padrão SweetAlert */
.swal2-input{
  height: 46px !important;
  background: #0d1426 !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  color: var(--text) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

/* botões padrões */
.swal2-styled.swal2-confirm{
  background: linear-gradient(90deg, var(--accent), var(--primary)) !important;
  color: #081428 !important;
  font-weight: 800 !important;
  border-radius: 12px !important;
  border: none !important;
}
.swal2-styled.swal2-cancel{
  background: transparent !important;
  border: 1px solid rgba(255,255,255,.1) !important;
  color: var(--text) !important;
  border-radius: 12px !important;
}
.swal2-actions{ gap: 10px !important }

/* ====== Elementos do nosso gerenciador ====== */
.sw-wrap{ text-align:left }
.sw-head{
  display:flex; gap:10px; align-items:center; margin-bottom:12px;
}
.sw-head input{ flex:1 }
#swal-add{
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  color: #081428; border: none; font-weight: 800;
}
#swal-add i{ margin-right:6px }

.sw-list{
  max-height: 320px; overflow:auto; padding:6px;
  border:1px solid rgba(255,255,255,.12); border-radius: 12px;
}

/* scrollbar suave (webkit) */
.sw-list::-webkit-scrollbar{ height:8px; width:8px }
.sw-list::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.12); border-radius:99px }

.sw-item{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 8px; border-bottom:1px dashed rgba(255,255,255,.06);
}
.sw-item:last-child{ border-bottom:none }
.sw-name{ font-weight:600 }
.sw-name small{ color:var(--muted) }

.sw-del{
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; padding:0 12px; border-radius:10px; cursor:pointer;
  background: rgba(255,93,93,.12); border:1px solid rgba(255,93,93,.35);
  color: var(--danger);
}
.sw-del:hover{ filter: brightness(1.1) }


/* timeline pública (mesmo visual do painel) */
.timeline{display:flex;flex-direction:column;gap:10px}
.t-item{background:#0f162b;border:1px solid #223059;border-radius:12px;padding:10px}
.t-head{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:13px;margin-bottom:6px}
.t-body{white-space:pre-wrap;line-height:1.45}


/* ===== Consulta Pública: header e prioridade ===== */
.ticket-card{background:#0f162b;border:1px solid #1a2443;border-radius:18px;padding:14px;box-shadow:0 10px 30px rgba(0,0,0,.18);margin-top:12px}
.ticket-header{display:flex;flex-direction:column;gap:6px;margin:6px 0 12px 0}
.ticket-header .t-num{font-weight:700;font-size:18px;display:flex;align-items:center;gap:8px}
.ticket-header .t-num .t-prio{display:inline-flex}

/* ribbon de status (mantém seu padrão) */
.ticket-card .ribbon{position:relative;display:inline-flex;align-items:center;gap:.5rem;padding:.35rem .7rem;border-radius:999px;font-weight:600;margin-bottom:.25rem}
.ticket-card .ribbon.aberto{background:#2e250e;color:#f7c948;border:1px solid #5a4715}
.ticket-card .ribbon.analise{background:#1b1730;color:#c8baff;border:1px solid #3a2f76}
.ticket-card .ribbon.fechado{background:#0f2a24;color:#1cf1b5;border:1px solid #145e4e}

/* ===== Timeline pública ===== */
.timeline-public{margin-top:12px}
.tl-title{font-weight:700;margin:6px 0 10px 0;display:flex;align-items:center;gap:.5rem;color:var(--muted)}
.tl-item{background:#0f162b;border:1px solid #223059;border-radius:12px;padding:10px;margin:8px 0}
.tl-head{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:13px;margin-bottom:6px}
.tl-head em{font-style:normal;opacity:.8}
.tl-body{line-height:1.45;white-space:pre-wrap}
.tl-item.tl-status .tl-body i{margin:0 .5rem;opacity:.8}
.timeline-empty{opacity:.8;font-style:italic;border:1px dashed #223059;border-radius:12px;padding:10px}

/* responsivo do card (segue seu padrão) */
@media (max-width:640px){
  .ticket-header .t-num{flex-wrap:wrap;gap:6px}
}


/* ====== Público / Cartão de consulta ====== */
.ticket-card{background:#0f162b;border:1px solid #1a2443;border-radius:16px;padding:16px;box-shadow:0 10px 30px rgba(0,0,0,.18)}
.ticket-header .t-num{font-weight:700;font-size:18px;display:flex;align-items:center;gap:.5rem}
.ticket-header .prio-wrap{display:inline-flex;vertical-align:middle}
.timeline-wrap{margin-top:14px}
.tl-title{color:var(--muted);font-weight:700;margin:4px 0 10px 0;display:flex;align-items:center;gap:.5rem}

.tl-item{background:#0c1428;border:1px solid #223059;border-radius:12px;padding:10px;margin:8px 0}
.tl-head{display:flex;justify-content:space-between;gap:10px;color:#a9b5d4;font-size:13px;margin-bottom:6px}
.tl-body{white-space:pre-wrap;line-height:1.45}

/* Ribbon do status (coerente com seu tema) */
.ticket-card .ribbon{border-radius:12px;padding:6px 10px;display:inline-flex;align-items:center;gap:.5rem;margin-bottom:10px}
.ribbon.aberto {background:#13230f;border:1px solid #2c5d20;color:#89f7b1}
.ribbon.analise{background:#1a1730;border:1px solid #3a2f76;color:#c8baff}
.ribbon.fechado{background:#11211f;border:1px solid #2b6b5d;color:#9ff1da}



/* ====== Galeria de anexos ====== */
.tl-gallery{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(72px,1fr));
  gap:.5rem;
}
.gal-thumb{
  display:block;
  width:100%; aspect-ratio:1/1;
  border-radius:10px; overflow:hidden;
  background:#0c1327; border:1px solid #223059;
  padding:0; cursor:pointer;
}
.gal-thumb img{
  width:100%; height:100%; object-fit:cover; display:block; pointer-events:none;
}
.gal-thumb:focus{ outline:2px solid rgba(125,249,255,.45); outline-offset:2px; }

/* ====== Badges de prioridade (com glow/pulse p/ Crítica) ====== */
.prio{
  display:inline-flex; align-items:center; gap:.35rem;
  padding:.28rem .6rem; border-radius:999px; line-height:1;
  font-size:.82rem; font-weight:600; border:0;
  position:relative; isolation:isolate;
  transition:box-shadow .25s ease, transform .1s ease;
}
.prio::after{
  content:""; position:absolute; inset:-1px; border-radius:inherit; pointer-events:none; z-index:-1;
}

/* CRÍTICA – vermelho com pulso */
.prio--critica{
  color:#ffd7d7;
  background:
    radial-gradient(120% 140% at 10% 10%, rgba(255,93,93,.18), transparent 60%),
    linear-gradient(180deg,#3a0f14 0%, #2b0f12 100%);
  box-shadow:0 0 0 1px rgba(255,93,93,.45) inset, 0 6px 16px rgba(255,93,93,.25);
  animation:prioPulseSoft 1.6s ease-in-out infinite;
}
.prio--critica::after{ box-shadow:0 0 0 2px rgba(255,93,93,.45); }

/* ALTA – laranja com leve respiração */
.prio--alta{
  color:#ffd9c6;
  background:
    radial-gradient(120% 140% at 10% 10%, rgba(255,166,86,.14), transparent 60%),
    linear-gradient(180deg,#3a1b10 0%, #2b1410 100%);
  box-shadow:0 0 0 1px rgba(255,134,86,.40) inset, 0 6px 12px rgba(255,134,86,.18);
  animation:prioBreathe 2.6s ease-in-out infinite;
}
.prio--alta::after{ box-shadow:0 0 0 2px rgba(255,134,86,.30); }

/* MÉDIA – âmbar */
.prio--media{
  color:#ffe08a;
  background:
    radial-gradient(120% 140% at 10% 10%, rgba(247,201,72,.14), transparent 60%),
    linear-gradient(180deg,#362a10 0%, #2e250e 100%);
  box-shadow:0 0 0 1px rgba(247,201,72,.35) inset, 0 4px 10px rgba(247,201,72,.10);
}
.prio--media::after{ box-shadow:0 0 0 2px rgba(247,201,72,.22); }

/* BAIXA – azulado */
.prio--baixa{
  color:#cfe2ff;
  background:
    radial-gradient(120% 140% at 10% 10%, rgba(125,249,255,.10), transparent 60%),
    linear-gradient(180deg,#1a2636 0%, #16202e 100%);
  box-shadow:0 0 0 1px rgba(125,249,255,.22) inset, 0 3px 8px rgba(125,249,255,.10);
}
.prio--baixa::after{ box-shadow:0 0 0 2px rgba(125,249,255,.20); }

@keyframes prioPulseSoft{
  0%  { box-shadow:0 0 0 1px rgba(255,93,93,.45) inset, 0 6px 16px rgba(255,93,93,.25); }
  50% { box-shadow:0 0 0 2px rgba(255,93,93,.60) inset, 0 12px 26px rgba(255,93,93,.35); }
  100%{ box-shadow:0 0 0 1px rgba(255,93,93,.45) inset, 0 6px 16px rgba(255,93,93,.25); }
}
@keyframes prioBreathe{
  0%,100%{ box-shadow:0 0 0 1px rgba(255,134,86,.40) inset, 0 6px 12px rgba(255,134,86,.18); }
  50%    { box-shadow:0 0 0 2px rgba(255,134,86,.52) inset, 0 12px 22px rgba(255,134,86,.28); }
}
@media (prefers-reduced-motion:reduce){ .prio{ animation:none !important; } }
