/* ============================================================
   GUILD TECNOLOGIA — Chamados SLA — Identidade visual
   Tokens replicados de SITE GUILD para consistência de marca
   ============================================================ */

:root {
  --bg:       #06090F;
  --bg2:      #0B111A;
  --bg3:      #0F1822;
  --bg4:      #141F2E;
  --red:      #C41E1E;
  --red-b:    #E52222;
  --red-d:    #8B1010;
  --red-g:    rgba(196,30,30,0.35);
  --red-gs:   rgba(196,30,30,0.12);
  --navy:     #1D2F45;
  --navy-l:   #2A4060;
  --white:    #FFFFFF;
  --g1:       #C8D8E8;
  --g2:       #7890A8;
  --g3:       #3A5068;
  --ok:       #2FB86A;
  --ok-g:     rgba(47,184,106,0.35);
  --warn:     #E5A722;
  --warn-g:   rgba(229,167,34,0.35);
  --border:   rgba(196,30,30,0.18);
  --border-navy: rgba(42,64,96,0.5);
  --r:        0.75rem;
  --rl:       1.25rem;
  --ease:     cubic-bezier(.4,0,.2,1);
  --t:        all .3s var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--g1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 4px; }

a { color: inherit; }
.tf { font-family: 'Orbitron', monospace; }

.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Orbitron', monospace; font-size: 0.65rem;
  letter-spacing: 3px; text-transform: uppercase; color: var(--red);
}
.tag::before { content:''; width:28px; height:2px; background:var(--red); flex-shrink:0; }

/* ── BOTÕES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1px solid transparent;
  font-family: 'Inter', sans-serif; font-size: .85rem; font-weight: 600;
  cursor: pointer; transition: var(--t); text-decoration: none; white-space: nowrap;
}
.btn-red   { background: var(--red); color: var(--white); }
.btn-red:hover   { background: var(--red-b); box-shadow: 0 0 16px var(--red-g); }
.btn-ghost { background: transparent; border-color: var(--border-navy); color: var(--g1); }
.btn-ghost:hover { border-color: var(--red); color: var(--white); }
.btn-ok    { background: var(--ok); color: var(--white); }
.btn-ok:hover    { box-shadow: 0 0 16px var(--ok-g); }
.btn-sm    { padding: 7px 16px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon  { padding: 9px; border-radius: 50%; }

/* ── CAMPOS DE FORMULÁRIO ──────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .78rem; color: var(--g2); font-weight: 500; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  background: var(--bg3); border: 1px solid var(--border-navy); border-radius: var(--r);
  color: var(--white); font-size: .875rem; font-family: 'Inter', sans-serif;
  padding: 11px 14px; outline: none; transition: var(--t); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-gs);
}
.field textarea { resize: vertical; min-height: 90px; }
.field select option { background: var(--bg3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }
.field-hint { font-size: .72rem; color: var(--g3); }

/* ── LAYOUT APP ─────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 40; transition: transform .3s var(--ease);
}
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-logo img { height: 30px; }
.sidebar-logo-text { font-family: 'Orbitron', monospace; font-size: .78rem; font-weight: 700; color: var(--white); }
.sidebar-logo-text span { color: var(--red); display: block; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section { font-family: 'Orbitron', monospace; font-size: .6rem; letter-spacing: 2px; text-transform: uppercase; color: var(--g3); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r);
  color: var(--g2); text-decoration: none; cursor: pointer; font-size: .85rem; font-weight: 500;
  transition: var(--t); margin-bottom: 2px; border: 1px solid transparent;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--white); }
.nav-item.active { background: var(--red-gs); border-color: var(--border); color: var(--white); }
.nav-item .badge-count {
  margin-left: auto; background: var(--red); color: var(--white); font-size: .68rem; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center;
}

.main-content { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

.topbar {
  height: 68px; flex-shrink: 0; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-family: 'Orbitron', monospace; font-size: .95rem; font-weight: 700; color: var(--white); flex: 1; }
.menu-toggle { display: none; background: none; border: none; color: var(--white); cursor: pointer; padding: 6px; }
@media (max-width: 900px) { .menu-toggle { display: block; } }

.content-area { flex: 1; padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }
@media (max-width: 600px) { .content-area { padding: 16px; } }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; }
.sidebar-overlay.active { display: block; }

/* ── CARDS / KPIs ───────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--bg2); border: 1px solid var(--border-navy); border-radius: var(--rl);
  padding: 20px; position: relative; overflow: hidden;
}
.kpi-card::before { content:''; position:absolute; top:0; left:0; width:3px; height:100%; background: var(--red); }
.kpi-card.ok::before { background: var(--ok); }
.kpi-card.warn::before { background: var(--warn); }
.kpi-value { font-family: 'Orbitron', monospace; font-size: 1.9rem; font-weight: 900; color: var(--white); line-height: 1; }
.kpi-label { font-size: .75rem; color: var(--g2); margin-top: 8px; }

.card { background: var(--bg2); border: 1px solid var(--border-navy); border-radius: var(--rl); padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-family: 'Orbitron', monospace; font-size: .85rem; font-weight: 700; color: var(--white); }

/* ── BADGES / STATUS / SLA ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge-prioridade-baixa    { background: rgba(120,144,168,.15); color: var(--g1); border-color: rgba(120,144,168,.3); }
.badge-prioridade-media    { background: rgba(229,167,34,.15); color: var(--warn); border-color: var(--warn-g); }
.badge-prioridade-alta     { background: rgba(196,30,30,.15); color: var(--red-b); border-color: var(--red-g); }
.badge-prioridade-critica  { background: var(--red); color: var(--white); border-color: var(--red-b); }

.badge-status-aberto             { background: rgba(196,30,30,.15); color: var(--red-b); border-color: var(--red-g); }
.badge-status-em_andamento       { background: rgba(229,167,34,.15); color: var(--warn); border-color: var(--warn-g); }
.badge-status-aguardando_cliente { background: rgba(120,144,168,.15); color: var(--g1); border-color: rgba(120,144,168,.3); }
.badge-status-resolvido          { background: rgba(47,184,106,.15); color: var(--ok); border-color: var(--ok-g); }
.badge-status-fechado            { background: rgba(120,144,168,.1); color: var(--g3); border-color: rgba(120,144,168,.2); }
.badge-status-cancelado          { background: rgba(120,144,168,.1); color: var(--g3); border-color: rgba(120,144,168,.2); text-decoration: line-through; }

.badge-sla-no_prazo           { background: rgba(47,184,106,.15); color: var(--ok); border-color: var(--ok-g); }
.badge-sla-em_risco           { background: rgba(229,167,34,.15); color: var(--warn); border-color: var(--warn-g); }
.badge-sla-atrasado_resposta,
.badge-sla-atrasado_resolucao { background: var(--red); color: var(--white); border-color: var(--red-b); }

/* ── TABELA ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.tbl th {
  text-align: left; padding: 10px 14px; font-size: .68rem; letter-spacing: 1px; text-transform: uppercase;
  color: var(--g3); border-bottom: 1px solid var(--border-navy); white-space: nowrap;
}
table.tbl td { padding: 13px 14px; border-bottom: 1px solid rgba(42,64,96,.25); vertical-align: middle; }
table.tbl tr:hover td { background: var(--bg3); }
table.tbl tr.clickable { cursor: pointer; }
.tbl-numero { font-family: 'Orbitron', monospace; color: var(--red); font-weight: 700; }

/* ── FILTROS ────────────────────────────────────────────────── */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filters-bar select, .filters-bar input {
  background: var(--bg3); border: 1px solid var(--border-navy); border-radius: var(--r);
  color: var(--white); font-size: .8rem; padding: 9px 12px; outline: none;
}
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--red); }

/* ── LOGIN ──────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 0%, var(--bg3) 0%, var(--bg) 60%); padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 40px 32px; position: relative; overflow: hidden;
}
.login-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}
.login-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 30px; }
.login-logo img { height: 46px; margin-bottom: 14px; }
.login-logo h1 { font-family: 'Orbitron', monospace; font-size: 1rem; font-weight: 700; color: var(--white); text-align: center; }
.login-logo h1 span { color: var(--red); display: block; font-size: .65rem; letter-spacing: 3px; margin-top: 6px; font-weight: 400; }
.login-error {
  background: var(--red-gs); border: 1px solid var(--border); color: var(--red-b);
  border-radius: var(--r); padding: 10px 14px; font-size: .8rem; margin-bottom: 16px; display: none;
}
.login-card .btn { width: 100%; margin-top: 6px; padding: 13px; }

/* ── LOADING / SPINNER ──────────────────────────────────────── */
.spinner { width: 30px; height: 30px; border: 3px solid var(--border-navy); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 60px 20px; color: var(--g2); font-size: .85rem; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--g3); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: 14px; color: var(--g3); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--rl); width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; }
.modal.lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-navy); }
.modal-head h3 { font-family: 'Orbitron', monospace; font-size: .9rem; color: var(--white); }
.modal-close { background: none; border: none; color: var(--g2); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.modal-close:hover { color: var(--white); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--border-navy); }

/* ── TOAST ──────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg3); border: 1px solid var(--border-navy); border-left: 3px solid var(--red);
  border-radius: var(--r); padding: 13px 18px; color: var(--white); font-size: .84rem;
  min-width: 240px; max-width: 340px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toast-in .25s var(--ease);
}
.toast.success { border-left-color: var(--ok); }
.toast.error   { border-left-color: var(--red); }
.toast.removing { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in  { from { opacity:0; transform:translateX(20px);} to { opacity:1; transform:none; } }
@keyframes toast-out { to { opacity:0; transform:translateX(20px);} }

/* ── THREAD DE INTERAÇÕES ──────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 14px; }
.thread-item { background: var(--bg3); border: 1px solid var(--border-navy); border-radius: var(--r); padding: 14px 16px; }
.thread-item.sistema { background: transparent; border: none; padding: 6px 4px; font-size: .78rem; color: var(--g3); display: flex; align-items: center; gap: 8px; }
.thread-item.staff { border-left: 3px solid var(--red); }
.thread-item.cliente { border-left: 3px solid var(--navy-l); }
.thread-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.thread-author { font-weight: 700; font-size: .82rem; color: var(--white); }
.thread-time { font-size: .72rem; color: var(--g3); }
.thread-msg { font-size: .85rem; color: var(--g1); white-space: pre-wrap; }

/* ── UTILITÁRIOS ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.text-muted { color: var(--g2); } .text-dim { color: var(--g3); }
.text-sm { font-size: .78rem; } .text-xs { font-size: .7rem; }
.text-center { text-align: center; }
.w-full { width: 100%; }
