/* ============================================================
   Sistema de Chamados do PA — estilo simples, limpo e responsivo
   ============================================================ */

:root {
  --brand:        #1e6fd9;
  --brand-dark:   #1657ab;
  --bg:           #f2f5f9;
  --card:         #ffffff;
  --text:         #1f2937;
  --muted:        #6b7280;
  --border:       #dce3ec;
  --ok:           #16a34a;
  --warn:         #d97706;
  --danger:       #dc2626;
  --shadow:       0 4px 18px rgba(15, 40, 80, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

/* ---------- layout ---------- */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar {
  position: relative;
  background: var(--brand);
  color: #fff;
  padding: 16px;
  text-align: center;
}
.topbar-logo {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  height: 52px;
  width: auto;
  background: #fff;
  border-radius: 10px;
  padding: 5px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
@media (max-width: 480px) {
  .topbar-logo { height: 38px; left: 10px; padding: 4px 6px; }
}
.topbar h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: .5px;
}
.topbar small { opacity: .85; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 20px;
}

.step-title {
  text-align: center;
  font-size: 22px;
  margin: 8px 0 4px;
}
.step-sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 20px;
}

/* ---------- grade de botões ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 96px;
  padding: 18px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.big-btn:hover,
.big-btn:focus-visible {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
}

/* botão PA gigante da tela inicial */
.pa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none;
  border-radius: 20px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.pa-btn small {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: normal;
  opacity: .9;
}
.pa-btn:hover,
.pa-btn:focus-visible { transform: scale(1.02); outline: none; }

/* ---------- botões de ação ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
  background: #fff;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* área de exclusão do chamado */
.danger-zone {
  text-align: center;
  margin-top: 64px;
  padding: 8px 0 4px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.actions .btn { flex: 1; min-width: 140px; }

/* ---------- caminho / breadcrumb ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.crumb {
  background: #eaf1fb;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- formulário ---------- */
label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
select.field {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
textarea:focus, input:focus, select.field:focus { border-color: var(--brand); outline: none; }
textarea { min-height: 120px; resize: vertical; }

/* ---------- confirmação ---------- */
.success {
  text-align: center;
  padding: 12px 0;
}
.success .check {
  width: 84px; height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.ticket-num {
  font-size: 40px;
  font-weight: 800;
  color: var(--brand);
  margin: 8px 0 4px;
}

/* ============================================================
   Lado do técnico
   ============================================================ */
.login-wrap {
  max-width: 400px;
  margin: 8vh auto;
  padding: 0 16px;
}
.form-row { margin-bottom: 16px; }
.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* abas Ativos / Finalizados */
.tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 0;
  border-bottom: 2px solid var(--border);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 2px solid transparent;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  margin-bottom: -2px;
}
.tab:hover { color: var(--brand); }
.tab-active {
  color: var(--brand-dark);
  background: #fff;
  border-color: var(--border);
  border-bottom: 2px solid #fff;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.filters select {
  padding: 10px 12px;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
th { background: #f5f8fc; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-aberto     { background: #fef3c7; color: #92400e; }
.badge-andamento  { background: #dbeafe; color: #1e40af; }
.badge-resolvido  { background: #dcfce7; color: #166534; }

.status-form { display: flex; gap: 6px; align-items: center; }
.status-form select {
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.status-form button {
  padding: 6px 10px;
  font-size: 13px;
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
}
.status-form button:hover { background: var(--brand-dark); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

/* link do nº do chamado + selo de comentários */
/* observação encurtada na tabela (texto completo fica no chamado) */
.obs-cell {
  max-width: 260px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ticket-link {
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
}
.ticket-link:hover { text-decoration: underline; }
.coment-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- detalhe do chamado ---------- */
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 0 0 16px;
}
.detail-grid dt, .detail-obs dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-grid dd, .detail-obs dd {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.detail-grid dd a, .detail-obs dd a { overflow-wrap: anywhere; }
.detail-grid > div { min-width: 0; }
.detail-obs {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* ---------- histórico / auditoria ---------- */
.audit { list-style: none; margin: 0; padding: 0; }
.audit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.audit-item:last-child { border-bottom: none; }
.audit-txt { font-size: 14px; }
.audit-when { font-size: 12px; margin-left: auto; }

/* ---------- comentários ---------- */
.comments { list-style: none; margin: 0 0 18px; padding: 0; }
.comment {
  background: #f7fafd;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.comment-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
}
.comment-text {
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.comment-form textarea { min-height: 90px; }

.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;
}

/* paginação da aba Finalizados */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.pager-info { color: var(--muted); font-weight: 600; font-size: 14px; }
.btn.is-disabled {
  opacity: .45;
  cursor: default;
  pointer-events: none;
}

/* ============================================================
   Dashboard
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand);
  border-radius: 12px;
  padding: 14px 16px;
}
.stat.s-aberto    { border-left-color: #d97706; }
.stat.s-andamento { border-left-color: #2563eb; }
.stat.s-resolvido { border-left-color: #16a34a; }
.stat.s-hoje      { border-left-color: #7c3aed; }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

.dash-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.barchart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { flex: 0 0 130px; font-size: 13px; color: var(--text); }
.bar-track { flex: 1; background: #eef2f7; border-radius: 999px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; min-width: 2px; }
.bar-val { flex: 0 0 30px; text-align: right; font-size: 13px; font-weight: 700; color: var(--text); }

.vol-total { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.vol-total strong { font-size: 18px; color: var(--text); }

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 128px;
}
.spark-bar {
  flex: 1;
  position: relative;
  background: var(--brand);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.spark-val {
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.spark-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.spark-labels { display: flex; gap: 3px; margin-top: 6px; }
.spark-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.seg-btn {
  background: #fff;
  border: none;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.active { background: var(--brand); color: #fff; }

.muted { color: var(--muted); }
.count-pill {
  background: #eaf1fb;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 700;
}

/* rodapé institucional */
.site-footer {
  text-align: center;
  padding: 28px 16px 36px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.site-footer strong {
  display: block;
  color: var(--text);
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
