:root {
  --bg: #edf2f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #17212f;
  --muted: #6b7280;
  --primary: #123b67;
  --primary-2: #1f5f99;
  --primary-soft: #eaf2fb;
  --border: #d8e2ee;
  --border-strong: #c5d3e3;
  --shadow: 0 8px 24px rgba(18, 59, 103, 0.08);
  --shadow-soft: 0 4px 14px rgba(18, 59, 103, 0.06);
  --radius: 18px;
  --success: #0f766e;
  --warning: #b45309;
  --danger: #b91c1c;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }
body {
  background:
    radial-gradient(circle at top left, rgba(31, 95, 153, 0.06), transparent 28%),
    linear-gradient(180deg, #eef3f8 0%, #f7f9fc 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}
.decorative-squares {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.decorative-square {
  position: absolute;
  display: block;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(31, 95, 153, 0.18);
  background: rgba(31, 95, 153, 0.055);
  border-radius: 18px;
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.18), 0 18px 42px rgba(18, 59, 103, 0.08);
  animation: decorative-square-float 18s ease-in-out infinite;
}
.square-1 { top: 8%; left: 7%; width: 138px; height: 138px; animation-delay: -2s; }
.square-2 { top: 20%; right: 10%; width: 86px; height: 86px; animation-delay: -7s; }
.square-3 { bottom: 11%; left: 14%; width: 92px; height: 92px; animation-delay: -11s; }
.square-4 { bottom: 15%; right: 16%; width: 148px; height: 148px; animation-delay: -4s; }
.square-5 { top: 48%; left: 48%; width: 64px; height: 64px; animation-delay: -13s; }
.square-6 { top: 36%; left: 4%; width: 58px; height: 58px; animation-delay: -9s; }
@keyframes decorative-square-float {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0.46;
  }
  45% {
    transform: translate3d(22px, -28px, 0) rotate(10deg);
    opacity: 0.72;
  }
  75% {
    transform: translate3d(-14px, 18px, 0) rotate(-7deg);
    opacity: 0.56;
  }
}
.auth-shell,
.container {
  position: relative;
  z-index: 1;
}
.hidden-app { display: none; }
.container { max-width: 1520px; margin: 0 auto; padding: 24px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 24px; }
.auth-brand h1 { color: var(--primary); font-size: 30px; margin-bottom: 12px; }
.auth-brand p { color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.auth-brand { display: flex; align-items: center; gap: 18px; }
.auth-brand-text { min-width: 0; }
.auth-logo {
  width: 180px;
  height: auto;
  display: block;
  object-fit: contain;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.brand-text { min-width: 0; }
.header-logo {
  width: 170px;
  height: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.auth-tab { border: 1px solid var(--border); background: #edf2f7; color: var(--primary); border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-panel { display: none; }
.auth-panel.active { display: grid; gap: 12px; }
.auth-message { margin-top: 14px; border: 1px solid var(--border); background: #f8fbff; border-radius: 14px; padding: 14px; line-height: 1.4; }
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  padding: 4px 2px;
}
.header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  margin-bottom: 6px;
}
.header p {
  color: var(--muted);
  font-size: 14px;
  max-width: 720px;
  line-height: 1.45;
}
.header-right { display: flex; gap: 10px; align-items: center; }
.header-right-stack { align-items: flex-start; flex-direction: column; }
.clock-box, .sync-chip, .user-box {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  padding: 10px 14px;
  color: var(--primary);
  backdrop-filter: blur(8px);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.clock-box, .sync-chip { font-weight: 700; }
.user-box { display: grid; gap: 2px; min-width: 230px; }
.user-box strong { font-size: 14px; }
.user-box span { font-size: 12px; color: var(--muted); }
.link-btn { background: transparent; color: var(--primary); font-weight: 700; border: 1px solid transparent; cursor: pointer; padding: 10px 6px; border-radius: 12px; min-height: 48px; }
.link-btn:hover { background: rgba(18, 59, 103, 0.06); border-color: var(--border); }
.top-actions { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.tab-btn { border: 1px solid var(--border); background: #edf2f7; color: var(--primary); border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .report-box h3 { color: var(--primary); font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.form-card { padding-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: #374151; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; font-size: 14px; background: #fcfdff; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--border-strong); background: #ffffff; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(31, 106, 165, 0.12); background: #fff; }
.field textarea { min-height: 92px; resize: vertical; }
.full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: none; border-radius: 12px; padding: 12px 16px; cursor: pointer; font-weight: 800; transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 8px 18px rgba(18, 59, 103, 0.18); }
.btn-light { background: #eef3f8; color: var(--primary); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.content-area { display: grid; gap: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; }
.compact-stats { align-items: stretch; }
.compact-stats .stat-card { min-height: 74px; padding: 12px 14px; }
.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
  opacity: 0.9;
}
.stat-card span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding-left: 10px; }
.stat-card strong { font-size: 28px; line-height: 1; color: var(--primary); font-weight: 800; padding-left: 10px; }
.badge-info, .badge-count { background: #edf5ff; color: var(--primary); font-size: 12px; padding: 6px 10px; border-radius: 999px; font-weight: 700; }
.filters-grid { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(150px, 1fr)); gap: 12px; padding: 18px 18px 0; }
.table-wrap { overflow: auto; padding: 18px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1250px; table-layout: fixed; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { color: var(--primary); background: #f5f8fc; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background 0.2s ease, transform 0.2s ease; }
tbody tr:hover { background: #f8fbff; }
.ticket-row { cursor: pointer; }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-aberto { background: #dbeafe; color: #1d4ed8; }
.status-em-andamento { background: #fef3c7; color: #92400e; }
.status-finalizado { background: #d1fae5; color: #065f46; }
.status-cancelado { background: #fee2e2; color: #991b1b; }
.sla-ok { color: var(--success); font-weight: 700; }
.sla-alerta { color: var(--warning); font-weight: 700; }
.sla-estourado { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 24px; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ellipsis-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.report-card { padding-bottom: 20px; }
.report-filters { display: flex; gap: 10px; }
.report-filters select { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; }
.report-box { border: 1px solid var(--border); border-radius: 16px; padding: 18px; background: linear-gradient(180deg, #ffffff, #f8fbff); }
.summary-list { display: grid; gap: 10px; margin-top: 12px; }
.summary-item { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--border); padding-bottom: 8px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 999; }
.modal-backdrop[hidden] { display: none !important; }
.modal-card { width: 100%; max-width: 560px; background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.18); overflow: hidden; max-height: 90vh; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; display: grid; gap: 12px; }
.modal-actions { padding: 16px 18px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; }
.modal-ticket-info { background: #f8fbff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 6px; font-size: 14px; }
.modal-ticket-info div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { border: none; background: #eef3f9; color: var(--primary); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 20px; line-height: 1; }
.table-wrap table th,
.table-wrap table td,
.report-table th,
.report-table td { white-space: nowrap; }
.table-wrap table td,
.report-table td { overflow: hidden; text-overflow: ellipsis; }
.table-wrap table th:nth-child(1), .table-wrap table td:nth-child(1) { width: 72px; }
.table-wrap table th:nth-child(2), .table-wrap table td:nth-child(2) { width: 160px; }
.table-wrap table th:nth-child(3), .table-wrap table td:nth-child(3) { width: 130px; }
.table-wrap table th:nth-child(4), .table-wrap table td:nth-child(4) { width: 82px; }
.table-wrap table th:nth-child(5), .table-wrap table td:nth-child(5) { width: 135px; }
.table-wrap table th:nth-child(6), .table-wrap table td:nth-child(6) { width: 84px; }
.table-wrap table th:nth-child(7), .table-wrap table td:nth-child(7) { width: 110px; }
.table-wrap table th:nth-child(8), .table-wrap table td:nth-child(8) { width: 165px; }
.table-wrap table th:nth-child(9), .table-wrap table td:nth-child(9) { width: 180px; }
.table-wrap table th:nth-child(10), .table-wrap table td:nth-child(10) { width: 150px; }
.table-wrap table th:nth-child(11), .table-wrap table td:nth-child(11) { width: 200px; }
.report-stats-6 { grid-template-columns: repeat(6, 1fr); }
.report-stats-8 { grid-template-columns: repeat(8, 1fr); }
.report-table-wrap { margin: 0 20px 20px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.report-table-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.report-table { width: 100%; min-width: 1100px; border-collapse: collapse; }
@media (max-width: 1400px) {
  .report-stats-6 { grid-template-columns: repeat(3, 1fr); }
  .report-stats-8 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .layout, .stats-grid, .filters-grid, .form-grid, .report-grid { grid-template-columns: 1fr; }
  .header, .top-actions { flex-direction: column; align-items: flex-start; }
  .sync-chip, .user-box { width: 100%; }
}

.kpi-strip { margin-bottom: 2px; }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-grid { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .container { padding: 16px; }
  .brand-block,
  .auth-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-logo,
  .auth-logo {
    width: 150px;
  }
  .header,
  .top-actions { flex-direction: column; align-items: flex-start; }
  .header-right,
  .header-right-stack { width: 100%; justify-content: flex-start; }
  .header-right-stack { flex-direction: column; align-items: flex-start; }
  .clock-box,
  .sync-chip,
  .user-box,
  .link-btn { width: 100%; }
  .stats-grid,
  .filters-grid,
  .form-grid,
  .report-stats-6,
  .report-stats-8 { grid-template-columns: 1fr; }
}


.modal-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* ===== AJUSTE FINAL: TOPO EM LINHA E RELATÓRIO COMPLETO ===== */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap !important;
}

.clock-box,
.user-box,
.link-btn {
  white-space: nowrap;
}

.report-table-wrap,
.report-table-scroll {
  overflow: hidden !important;
  max-height: none !important;
}

.report-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 12px !important;
  padding: 12px 6px !important;
  vertical-align: middle !important;
}

.report-table th {
  font-size: 10px !important;
  letter-spacing: 0.02em !important;
}

.report-table th:nth-child(1), .report-table td:nth-child(1) { width: 4% !important; }   /* Nº */
.report-table th:nth-child(2), .report-table td:nth-child(2) { width: 9% !important; }   /* Assunto */
.report-table th:nth-child(3), .report-table td:nth-child(3) { width: 7% !important; }   /* Status */
.report-table th:nth-child(4), .report-table td:nth-child(4) { width: 10% !important; }  /* Abertura */
.report-table th:nth-child(5), .report-table td:nth-child(5) { width: 10% !important; }  /* Início */
.report-table th:nth-child(6), .report-table td:nth-child(6) { width: 10% !important; }  /* Fechamento */
.report-table th:nth-child(7), .report-table td:nth-child(7) { width: 7% !important; }   /* Tempo gasto */
.report-table th:nth-child(8), .report-table td:nth-child(8) { width: 7% !important; }   /* Aprovação */
.report-table th:nth-child(9), .report-table td:nth-child(9) { width: 10% !important; }  /* Aprovado por */
.report-table th:nth-child(10), .report-table td:nth-child(10) { width: 10% !important; } /* Data aprovação */
.report-table th:nth-child(11), .report-table td:nth-child(11) { width: 8% !important; }  /* Responsável */
.report-table th:nth-child(12), .report-table td:nth-child(12) { width: 8% !important; }  /* Ação tomada */

.report-table td:nth-child(12),
.report-table th:nth-child(12) {
  white-space: normal !important;
  line-height: 1.2 !important;
}

.report-table .ellipsis-cell,
.report-table td.ellipsis-cell {
  max-width: none !important;
}

.modal-actions-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.field textarea:disabled,
.field select:disabled,
.field input:disabled {
  background: #f4f7fb;
  color: #4b5563;
  opacity: 1;
  cursor: default;
}

@media (max-width: 768px) {
  .header-right {
    width: 100%;
    flex-wrap: wrap !important;
    justify-content: flex-start;
  }

  .clock-box,
  .user-box,
  .link-btn {
    width: auto;
  }
}


/* ajuste mínimo solicitado */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-tab:nth-child(2) {
  display: flex;
  justify-content: center;
}


/* ===== LOGIN LIMPO ===== */
.auth-card-clean {
  max-width: 460px;
  padding: 30px 24px 24px;
}
.auth-brand-center {
  justify-content: center;
  margin-bottom: 24px;
}
.auth-logo-center {
  width: 220px;
  margin: 0 auto;
}
.auth-actions-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-message:empty {
  display: none;
}
.auth-tabs {
  display: none !important;
}

/* ===== RELATÓRIO EXPORTÁVEL ===== */
.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.report-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.report-actions .btn {
  min-height: 42px;
}
.report-total-hours {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  margin: 0 20px 20px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  color: var(--primary);
  font-size: 16px;
}
.report-total-hours span {
  font-weight: 800;
  font-size: 22px;
}
.report-print-meta {
  display: none;
  align-items: center;
  gap: 18px;
  margin: 20px 20px 10px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
}
.report-print-logo {
  width: 170px;
  height: auto;
  object-fit: contain;
}
.report-print-meta-text {
  display: grid;
  gap: 4px;
}
.report-print-meta-text h3 {
  color: var(--primary);
  font-size: 22px;
  margin: 0 0 4px;
}

@media (max-width: 1100px) {
  .report-toolbar,
  .report-controls,
  .report-actions {
    width: 100%;
  }
}

@media print {
  body {
    background: #ffffff !important;
  }

  #authView,
  .header,
  .top-actions,
  .report-actions,
  #logoutBtn {
    display: none !important;
  }

  #tab-operacao {
    display: none !important;
  }

  #tab-relatorio,
  .tab-panel.active,
  .tab-panel {
    display: block !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .card,
  .report-card,
  .report-box,
  .report-table-wrap,
  .report-total-hours {
    box-shadow: none !important;
    background: #fff !important;
  }

  .report-card {
    border: none !important;
    border-radius: 0 !important;
  }

  .report-grid,
  .report-stats-6 {
    break-inside: avoid;
  }

  .report-print-meta {
    display: flex !important;
  }

  .report-filters {
    display: none !important;
  }

  .report-table-wrap {
    overflow: visible !important;
    margin: 0 20px 20px;
  }

  .report-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  .report-table th,
  .report-table td {
    font-size: 10px !important;
    padding: 8px 4px !important;
  }

  .report-total-hours {
    margin-top: 12px !important;
    page-break-inside: avoid;
  }
}


/* ===== VISITA TÉCNICA + RELATÓRIO UNIFICADO ===== */
.report-table th:nth-child(1), .report-table td:nth-child(1) { width: 8% !important; }   /* Tipo */
.report-table th:nth-child(2), .report-table td:nth-child(2) { width: 6% !important; }   /* Nº */
.report-table th:nth-child(3), .report-table td:nth-child(3) { width: 10% !important; }  /* Assunto */
.report-table th:nth-child(4), .report-table td:nth-child(4) { width: 7% !important; }   /* Status */
.report-table th:nth-child(5), .report-table td:nth-child(5) { width: 9% !important; }   /* Abertura */
.report-table th:nth-child(6), .report-table td:nth-child(6) { width: 9% !important; }   /* Início */
.report-table th:nth-child(7), .report-table td:nth-child(7) { width: 9% !important; }   /* Fechamento */
.report-table th:nth-child(8), .report-table td:nth-child(8) { width: 7% !important; }   /* Tempo gasto */
.report-table th:nth-child(9), .report-table td:nth-child(9) { width: 7% !important; }   /* Aprovação */
.report-table th:nth-child(10), .report-table td:nth-child(10) { width: 8% !important; } /* Aprovado por */
.report-table th:nth-child(11), .report-table td:nth-child(11) { width: 8% !important; } /* Data aprovação */
.report-table th:nth-child(12), .report-table td:nth-child(12) { width: 6% !important; } /* Responsável */
.report-table th:nth-child(13), .report-table td:nth-child(13) { width: 10% !important; }/* Ação tomada */

#tab-visitas .table-wrap table th:nth-child(1), #tab-visitas .table-wrap table td:nth-child(1) { width: 110px; }
#tab-visitas .table-wrap table th:nth-child(2), #tab-visitas .table-wrap table td:nth-child(2) { width: 180px; }
#tab-visitas .table-wrap table th:nth-child(3), #tab-visitas .table-wrap table td:nth-child(3) { width: 180px; }
#tab-visitas .table-wrap table th:nth-child(4), #tab-visitas .table-wrap table td:nth-child(4) { width: 170px; }
#tab-visitas .table-wrap table th:nth-child(5), #tab-visitas .table-wrap table td:nth-child(5) { width: 170px; }
#tab-visitas .table-wrap table th:nth-child(6), #tab-visitas .table-wrap table td:nth-child(6) { width: 120px; }
#tab-visitas .table-wrap table th:nth-child(7), #tab-visitas .table-wrap table td:nth-child(7) { width: 320px; }


.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fcfdff;
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.check-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.visit-responsibles {
  justify-content: flex-start;
}

/* ===== AJUSTE SOLICITADO NO RELATÓRIO ===== */
.report-stats-8 .stat-card:nth-child(6) strong,
.report-stats-8 .stat-card:nth-child(7) strong,
.report-stats-8 .stat-card:nth-child(8) strong {
  font-size: 22px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

.report-stats-8 .stat-card:nth-child(6),
.report-stats-8 .stat-card:nth-child(7),
.report-stats-8 .stat-card:nth-child(8) {
  min-height: 74px;
}

.report-table-wrap {
  overflow: hidden !important;
}

.report-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.report-table th,
.report-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: 10px !important;
  padding: 10px 4px !important;
  letter-spacing: 0 !important;
}

.report-table th {
  font-size: 9px !important;
}

.report-table th:nth-child(1), .report-table td:nth-child(1) { width: 5% !important; }   /* Tipo */
.report-table th:nth-child(2), .report-table td:nth-child(2) { width: 6% !important; }   /* Nº */
.report-table th:nth-child(3), .report-table td:nth-child(3) { width: 10% !important; }  /* Assunto */
.report-table th:nth-child(4), .report-table td:nth-child(4) { width: 7% !important; }   /* Status */
.report-table th:nth-child(5), .report-table td:nth-child(5) { width: 9% !important; }   /* Abertura */
.report-table th:nth-child(6), .report-table td:nth-child(6) { width: 9% !important; }   /* Início */
.report-table th:nth-child(7), .report-table td:nth-child(7) { width: 9% !important; }   /* Fechamento */
.report-table th:nth-child(8), .report-table td:nth-child(8) { width: 7% !important; }   /* Tempo gasto */
.report-table th:nth-child(9), .report-table td:nth-child(9) { width: 7% !important; }   /* Aprovação */
.report-table th:nth-child(10), .report-table td:nth-child(10) { width: 9% !important; } /* Aprovado por */
.report-table th:nth-child(11), .report-table td:nth-child(11) { width: 9% !important; } /* Data aprovação */
.report-table th:nth-child(12), .report-table td:nth-child(12) { width: 9% !important; } /* Responsável */
.report-table th:nth-child(13), .report-table td:nth-child(13) {
  width: 4% !important;   /* Ação tomada */
  text-overflow: ellipsis !important;
}



/* ===== AJUSTE FINAL: BARRA VERTICAL APÓS 7 REGISTROS ===== */
#tab-relatorio .report-table-wrap {
  margin: 0 20px 20px !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  background: #fff !important;
  overflow: hidden !important;
}

#tab-relatorio .report-table-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 16px 18px !important;
  border-bottom: 1px solid var(--border) !important;
  background: #fff !important;
}

#tab-relatorio .report-table-scroll {
  height: 386px !important;      /* cabeçalho da grade + 7 linhas visíveis */
  max-height: 386px !important;
  overflow-y: scroll !important; /* força a barra vertical */
  overflow-x: auto !important;
  border-bottom-left-radius: 16px !important;
  border-bottom-right-radius: 16px !important;
}

#tab-relatorio .report-table {
  width: 100% !important;
  min-width: 1400px !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  table-layout: fixed !important;
}

#tab-relatorio .report-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 3 !important;
  background: #f5f8fc !important;
}

#tab-relatorio .report-table th,
#tab-relatorio .report-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar-thumb {
  background: #c5d3e3;
  border-radius: 999px;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar-track {
  background: #eef3f8;
  border-radius: 999px;
}

@media print {
  #tab-relatorio .report-table-scroll {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}


/* ===== AJUSTE PONTUAL: ROLAGEM EM "POR TIPO DE SOLICITAÇÃO" APÓS 5 ITENS ===== */
#reportByType {
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

#reportByType::-webkit-scrollbar {
  width: 10px;
}

#reportByType::-webkit-scrollbar-thumb {
  background: #c5d3e3;
  border-radius: 999px;
}

#reportByType::-webkit-scrollbar-track {
  background: #eef3f8;
  border-radius: 999px;
}



/* ===== FIX MODAL (ESCOPADO - NÃO QUEBRA LAYOUT) ===== */
#ticketModal .modal-card {
  width: 90%;
  max-width: 700px;
}

#ticketModal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

#ticketModal .modal-ticket-info div {
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}


/* ===== HOVER CARD APENAS NO RELATÓRIO MENSAL ===== */
.report-hover-card {
  position: fixed;
  z-index: 1200;
  width: min(430px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 16px;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.report-hover-card[hidden] {
  display: none !important;
}

.report-hover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-hover-header strong {
  color: var(--primary);
  font-size: 15px;
}

.report-hover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.report-hover-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.report-hover-item.full {
  grid-column: 1 / -1;
}

.report-hover-item span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.report-hover-item div {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}

#tab-relatorio .report-hover-row {
  cursor: default;
}

#tab-relatorio .report-hover-row:hover {
  background: #f8fbff;
}


/* ===== AJUSTE RELATÓRIO: BOTÃO ÚNICO + QUEBRA SÓ EM AÇÃO TOMADA ===== */
#tab-relatorio .report-actions {
  justify-content: flex-end;
}

#tab-relatorio .report-table th,
#tab-relatorio .report-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: top !important;
}

#tab-relatorio .report-table th:nth-child(13),
#tab-relatorio .report-table td:nth-child(13) {
  white-space: normal !important;
  word-break: break-word !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35 !important;
}


/* ===== RELATÓRIO GERADO EM NOVA TELA ===== */
#tab-relatorio .report-table-scroll {
  height: 386px !important;
  max-height: 386px !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
}

#tab-relatorio .report-table {
  min-width: 1400px !important;
  table-layout: fixed !important;
}

#tab-relatorio .report-table th,
#tab-relatorio .report-table td {
  font-size: 10px !important;
  padding: 10px 6px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  height: 44px !important;
}

#tab-relatorio .report-table th:nth-child(13),
#tab-relatorio .report-table td:nth-child(13) {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  vertical-align: top !important;
}

.generated-report-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
  z-index: 2000;
  padding: 22px;
}

.generated-report-backdrop[hidden] {
  display: none !important;
}

.generated-report-shell {
  width: min(1500px, 100%);
  height: calc(100vh - 44px);
  margin: 0 auto;
  background: #f3f7fb;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.generated-report-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.generated-report-topbar strong {
  color: var(--primary);
  display: block;
  font-size: 18px;
}

.generated-report-topbar span {
  color: var(--muted);
  font-size: 13px;
}

.generated-report-scroll {
  overflow: auto;
  padding: 22px;
}

.generated-report-sheet {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  gap: 18px;
}

.generated-report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.generated-report-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.generated-report-logo {
  width: 180px;
  height: auto;
  object-fit: contain;
}

.generated-report-brand h2 {
  color: var(--primary);
  font-size: 30px;
  margin-bottom: 6px;
}

.generated-report-brand p {
  color: var(--muted);
}

.generated-report-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.generated-report-meta div,
.generated-kpi-card,
.generated-panel,
.generated-report-footer {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.generated-report-meta div {
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.generated-report-meta span,
.generated-kpi-card span,
.generated-panel-title,
.generated-report-footer span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.generated-report-meta strong,
.generated-kpi-card strong,
.generated-report-footer strong {
  color: var(--primary);
}

.generated-kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(140px, 1fr));
  gap: 14px;
}

.generated-kpi-card {
  padding: 14px 16px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.generated-kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.generated-kpi-card strong {
  font-size: 30px;
  line-height: 1.1;
}

.generated-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.generated-panel {
  padding: 18px;
}

.generated-summary-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.generated-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--border);
}

.generated-summary-item span {
  color: var(--text);
}

.generated-summary-item strong {
  color: var(--primary);
  font-size: 18px;
}

.generated-table-panel {
  padding: 0;
  overflow: hidden;
}

.generated-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.generated-table-header h3 {
  color: var(--primary);
  font-size: 18px;
}

.generated-table-header span {
  color: var(--muted);
}

.generated-table-wrap {
  overflow: auto;
}

.generated-report-table {
  width: 100%;
  min-width: 1480px;
  table-layout: fixed;
  border-collapse: collapse;
}

.generated-report-table th,
.generated-report-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 8px;
  font-size: 12px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.generated-report-table th {
  background: #f5f8fc;
  color: var(--primary);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.generated-report-table tbody tr:hover {
  background: #f8fbff;
}

.generated-report-table th:nth-child(1), .generated-report-table td:nth-child(1) { width: 6%; }
.generated-report-table th:nth-child(2), .generated-report-table td:nth-child(2) { width: 6%; }
.generated-report-table th:nth-child(3), .generated-report-table td:nth-child(3) { width: 12%; }
.generated-report-table th:nth-child(4), .generated-report-table td:nth-child(4) { width: 8%; }
.generated-report-table th:nth-child(5), .generated-report-table td:nth-child(5) { width: 10%; }
.generated-report-table th:nth-child(6), .generated-report-table td:nth-child(6) { width: 10%; }
.generated-report-table th:nth-child(7), .generated-report-table td:nth-child(7) { width: 10%; }
.generated-report-table th:nth-child(8), .generated-report-table td:nth-child(8) { width: 8%; }
.generated-report-table th:nth-child(9), .generated-report-table td:nth-child(9) { width: 8%; }
.generated-report-table th:nth-child(10), .generated-report-table td:nth-child(10) { width: 10%; }
.generated-report-table th:nth-child(11), .generated-report-table td:nth-child(11) { width: 10%; }
.generated-report-table th:nth-child(12), .generated-report-table td:nth-child(12) { width: 10%; }
.generated-report-table th:nth-child(13), .generated-report-table td:nth-child(13) { width: 18%; }

.generated-report-table td.actions-col,
.generated-report-table th:nth-child(13) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.generated-report-footer {
  padding: 18px 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.generated-report-footer strong {
  font-size: 30px;
}

@media (max-width: 1200px) {
  .generated-report-header,
  .generated-summary-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .generated-report-meta,
  .generated-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .generated-report-backdrop {
    padding: 10px;
  }

  .generated-report-shell {
    height: calc(100vh - 20px);
  }

  .generated-report-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .generated-report-meta,
  .generated-kpi-grid,
  .generated-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* ===== AJUSTE: AÇÃO TOMADA COM QUEBRA DE LINHA ===== */
.table-wrap table th:nth-child(11),
.table-wrap table td:nth-child(11) {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35 !important;
}

#tab-relatorio .report-table th:nth-child(13),
#tab-relatorio .report-table td:nth-child(13),
.generated-report-table th:nth-child(13),
.generated-report-table td:nth-child(13),
.actions-col {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35 !important;
}



/* ===== AJUSTE FINAL SOMENTE NA TELA OPERAÇÃO ===== */
/* mantém visual normal; barra vertical aparece só quando precisar */
#tab-operacao .table-card {
  overflow: hidden !important;
}

#tab-operacao .table-card .table-wrap {
  max-height: 540px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 18px 18px !important;
  scrollbar-gutter: auto !important;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar {
  width: 10px;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar-thumb {
  background: #c5d3e3;
  border-radius: 999px;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar-track {
  background: #eef3f8;
  border-radius: 999px;
}

#tab-operacao .table-card table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#tab-operacao .table-card thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  background: #f5f8fc !important;
}

#tab-operacao .table-card th,
#tab-operacao .table-card td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
}

#tab-operacao .table-card th:nth-child(1), #tab-operacao .table-card td:nth-child(1) { width: 6% !important; }
#tab-operacao .table-card th:nth-child(2), #tab-operacao .table-card td:nth-child(2) { width: 12% !important; }
#tab-operacao .table-card th:nth-child(3), #tab-operacao .table-card td:nth-child(3) { width: 10% !important; }
#tab-operacao .table-card th:nth-child(4), #tab-operacao .table-card td:nth-child(4) { width: 7% !important; }
#tab-operacao .table-card th:nth-child(5), #tab-operacao .table-card td:nth-child(5) { width: 12% !important; }
#tab-operacao .table-card th:nth-child(6), #tab-operacao .table-card td:nth-child(6) { width: 7% !important; }
#tab-operacao .table-card th:nth-child(7), #tab-operacao .table-card td:nth-child(7) { width: 10% !important; }
#tab-operacao .table-card th:nth-child(8), #tab-operacao .table-card td:nth-child(8) { width: 12% !important; }
#tab-operacao .table-card th:nth-child(9), #tab-operacao .table-card td:nth-child(9) { width: 12% !important; }
#tab-operacao .table-card th:nth-child(10), #tab-operacao .table-card td:nth-child(10) { width: 13% !important; }

#tab-operacao .table-card th:nth-child(11) {
  width: 19% !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
}

#tab-operacao .table-card td:nth-child(11) {
  width: 19% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}




/* ===== AJUSTE FINAL LIMPO: OPERAÇÃO + RELATÓRIO MENSAL ===== */
/* Objetivo:
   - manter tudo em uma linha
   - aumentar o layout para caber melhor
   - só "Ação tomada / Ação realizada" pode ficar resumido com ...
*/

/* largura maior da área principal */
.container {
  max-width: 1860px !important;
}

/* =========================
   OPERAÇÃO
   ========================= */
#tab-operacao .content-area {
  min-width: 0 !important;
}

#tab-operacao .table-card {
  overflow: hidden !important;
}

#tab-operacao .table-card .table-wrap {
  max-height: 540px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0 18px 18px !important;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 0 !important;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar-thumb {
  background: #c5d3e3;
  border-radius: 999px;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar-track {
  background: #eef3f8;
  border-radius: 999px;
}

#tab-operacao .table-card table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#tab-operacao .table-card thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  background: #f5f8fc !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
  font-size: 12px !important;
  padding: 10px 8px !important;
  line-height: 1.15 !important;
}

/* todas as colunas em uma linha */
#tab-operacao .table-card td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  padding: 10px 8px !important;
}

/* larguras da operação */
#tab-operacao .table-card th:nth-child(1),  #tab-operacao .table-card td:nth-child(1)  { width: 5% !important; }
#tab-operacao .table-card th:nth-child(2),  #tab-operacao .table-card td:nth-child(2)  { width: 12% !important; }
#tab-operacao .table-card th:nth-child(3),  #tab-operacao .table-card td:nth-child(3)  { width: 12% !important; }
#tab-operacao .table-card th:nth-child(4),  #tab-operacao .table-card td:nth-child(4)  { width: 5% !important; }
#tab-operacao .table-card th:nth-child(5),  #tab-operacao .table-card td:nth-child(5)  { width: 12% !important; }
#tab-operacao .table-card th:nth-child(6),  #tab-operacao .table-card td:nth-child(6)  { width: 6% !important; }
#tab-operacao .table-card th:nth-child(7),  #tab-operacao .table-card td:nth-child(7)  { width: 10% !important; }
#tab-operacao .table-card th:nth-child(8),  #tab-operacao .table-card td:nth-child(8)  { width: 10% !important; }
#tab-operacao .table-card th:nth-child(9),  #tab-operacao .table-card td:nth-child(9)  { width: 14% !important; }
#tab-operacao .table-card th:nth-child(10), #tab-operacao .table-card td:nth-child(10) { width: 11% !important; }

/* só Ação realizada fica resumida */
#tab-operacao .table-card th:nth-child(11),
#tab-operacao .table-card td:nth-child(11) {
  width: 3% !important;
}
#tab-operacao .table-card th:nth-child(11) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#tab-operacao .table-card td:nth-child(11) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* =========================
   RELATÓRIO MENSAL
   ========================= */
#tab-relatorio .report-card {
  overflow: hidden !important;
}

#tab-relatorio .report-table-wrap {
  margin: 0 20px 20px !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  background: #fff !important;
  overflow: hidden !important;
}

#tab-relatorio .report-table-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 16px 18px !important;
  border-bottom: 1px solid var(--border) !important;
  background: #fff !important;
}

#tab-relatorio .report-table-scroll {
  height: 386px !important;
  max-height: 386px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 0 !important;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar-thumb {
  background: #c5d3e3;
  border-radius: 999px;
}

#tab-relatorio .report-table-scroll::-webkit-scrollbar-track {
  background: #eef3f8;
  border-radius: 999px;
}

#tab-relatorio .report-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#tab-relatorio .report-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 3 !important;
  background: #f5f8fc !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
  font-size: 11px !important;
  padding: 10px 6px !important;
  line-height: 1.15 !important;
}

/* todas as colunas em uma linha */
#tab-relatorio .report-table td {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
  line-height: 1.2 !important;
  font-size: 11px !important;
  padding: 10px 6px !important;
}

/* larguras do relatório */
#tab-relatorio .report-table th:nth-child(1),  #tab-relatorio .report-table td:nth-child(1)  { width: 5% !important; }
#tab-relatorio .report-table th:nth-child(2),  #tab-relatorio .report-table td:nth-child(2)  { width: 6% !important; }
#tab-relatorio .report-table th:nth-child(3),  #tab-relatorio .report-table td:nth-child(3)  { width: 13% !important; }
#tab-relatorio .report-table th:nth-child(4),  #tab-relatorio .report-table td:nth-child(4)  { width: 8% !important; }
#tab-relatorio .report-table th:nth-child(5),  #tab-relatorio .report-table td:nth-child(5)  { width: 9% !important; }
#tab-relatorio .report-table th:nth-child(6),  #tab-relatorio .report-table td:nth-child(6)  { width: 9% !important; }
#tab-relatorio .report-table th:nth-child(7),  #tab-relatorio .report-table td:nth-child(7)  { width: 9% !important; }
#tab-relatorio .report-table th:nth-child(8),  #tab-relatorio .report-table td:nth-child(8)  { width: 8% !important; }
#tab-relatorio .report-table th:nth-child(9),  #tab-relatorio .report-table td:nth-child(9)  { width: 7% !important; }
#tab-relatorio .report-table th:nth-child(10), #tab-relatorio .report-table td:nth-child(10) { width: 10% !important; }
#tab-relatorio .report-table th:nth-child(11), #tab-relatorio .report-table td:nth-child(11) { width: 10% !important; }
#tab-relatorio .report-table th:nth-child(12), #tab-relatorio .report-table td:nth-child(12) { width: 11% !important; }

/* só Ação tomada fica resumida */
#tab-relatorio .report-table th:nth-child(13),
#tab-relatorio .report-table td:nth-child(13) {
  width: 3% !important;
}
#tab-relatorio .report-table th:nth-child(13) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#tab-relatorio .report-table td:nth-child(13) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* mantém hover bonito no relatório */
#tab-relatorio .report-hover-row {
  cursor: default;
}
#tab-relatorio .report-hover-row:hover {
  background: #f8fbff;
}


.helper-text {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
}

.mono-cell {
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 12px;
}

#tab-usuarios .table-wrap {
  max-height: 620px;
  overflow: auto;
}


.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow: visible !important;
  min-width: 170px;
}

.actions-cell .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.user-delete-btn {
  font-weight: 700;
}


/* ===== MELHORIA ITEM 2/3: HIERARQUIA VISUAL E SLA POR PRIORIDADE ===== */
.priority-row td:first-child {
  border-left: 5px solid transparent;
}

.priority-critical td:first-child {
  border-left-color: #b91c1c;
}

.priority-high td:first-child {
  border-left-color: #ea580c;
}

.priority-medium td:first-child {
  border-left-color: #1f5f99;
}

.priority-low td:first-child {
  border-left-color: #0f766e;
}

.priority-critical {
  background: linear-gradient(90deg, rgba(185, 28, 28, 0.055), transparent 42%);
}

.priority-high {
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.045), transparent 42%);
}

#tab-operacao .table-card tr.priority-critical:hover,
#tab-operacao .table-card tr.priority-high:hover {
  background: #fff7ed;
}

.badge-info {
  white-space: nowrap;
}


/* ===== CORREÇÃO FINAL: RELATÓRIO GERADO - HORAS E META EM UMA LINHA ===== */
/* Mantém os cards elegantes e evita quebra feia em datas, nomes e horas. */

.generated-report-meta {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) !important;
}

.generated-report-meta div {
  min-width: 0 !important;
  padding: 12px 14px !important;
}

.generated-report-meta strong {
  font-size: 13px !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

.generated-kpi-grid {
  grid-template-columns: repeat(8, minmax(120px, 1fr)) !important;
  gap: 10px !important;
}

.generated-kpi-card {
  min-height: 78px !important;
  padding: 12px 12px !important;
  min-width: 0 !important;
}

.generated-kpi-card span {
  font-size: 9px !important;
  line-height: 1.05 !important;
  margin-bottom: 6px !important;
  white-space: normal !important;
}

.generated-kpi-card strong {
  font-size: 24px !important;
  line-height: 1 !important;
  letter-spacing: -0.6px !important;
  white-space: nowrap !important;
}

/* Somente os cards de horas precisam ser menores para caber: Horas chamados, Horas visitas e Tempo total atendido */
.generated-kpi-card:nth-child(6) strong,
.generated-kpi-card:nth-child(7) strong,
.generated-kpi-card:nth-child(8) strong {
  font-size: 17px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* Garante que o relatório impresso/exportado mantenha a mesma leitura */
@media print {
  .generated-kpi-card strong {
    white-space: nowrap !important;
  }

  .generated-kpi-card:nth-child(6) strong,
  .generated-kpi-card:nth-child(7) strong,
  .generated-kpi-card:nth-child(8) strong {
    font-size: 15px !important;
  }
}


/* ===== AJUSTE: BOTÃO IMPRIMIR NO RELATÓRIO GERADO ===== */
.generated-report-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.generated-report-topbar-actions .btn {
  min-height: 38px;
  padding: 10px 14px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .generated-report-topbar {
    align-items: flex-start;
  }

  .generated-report-topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}


/* ===== BOTÃO EXPORTAR EXCEL ===== */
#exportReportExcelBtn,
#generatedReportExcelBtn {
  min-width: 150px;
  font-weight: 800;
  white-space: nowrap;
}

#generatedReportExcelBtn {
  min-height: 38px;
  padding: 10px 14px;
}

/* ===== CORREÇÕES 15/05: LAYOUT EXPANDIDO + COLUNA AÇÃO VISÍVEL ===== */
.container {
  max-width: 2240px !important;
  width: min(100%, 2240px) !important;
}

.layout {
  grid-template-columns: 320px minmax(0, 1fr) !important;
}

#tab-operacao .table-card .table-wrap {
  max-height: 720px !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  padding: 0 18px 18px !important;
}

#tab-operacao .table-card table {
  min-width: 1580px !important;
  width: 100% !important;
  table-layout: fixed !important;
}

#tab-operacao .table-card th:nth-child(1),  #tab-operacao .table-card td:nth-child(1)  { width: 5% !important; }
#tab-operacao .table-card th:nth-child(2),  #tab-operacao .table-card td:nth-child(2)  { width: 12% !important; }
#tab-operacao .table-card th:nth-child(3),  #tab-operacao .table-card td:nth-child(3)  { width: 11% !important; }
#tab-operacao .table-card th:nth-child(4),  #tab-operacao .table-card td:nth-child(4)  { width: 7% !important; }
#tab-operacao .table-card th:nth-child(5),  #tab-operacao .table-card td:nth-child(5)  { width: 11% !important; }
#tab-operacao .table-card th:nth-child(6),  #tab-operacao .table-card td:nth-child(6)  { width: 7% !important; }
#tab-operacao .table-card th:nth-child(7),  #tab-operacao .table-card td:nth-child(7)  { width: 10% !important; }
#tab-operacao .table-card th:nth-child(8),  #tab-operacao .table-card td:nth-child(8)  { width: 11% !important; }
#tab-operacao .table-card th:nth-child(9),  #tab-operacao .table-card td:nth-child(9)  { width: 13% !important; }
#tab-operacao .table-card th:nth-child(10), #tab-operacao .table-card td:nth-child(10) { width: 11% !important; }
#tab-operacao .table-card th:nth-child(11), #tab-operacao .table-card td:nth-child(11) { width: 14% !important; }

#tab-operacao .table-card th:nth-child(11),
#tab-operacao .table-card td:nth-child(11) {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#tab-operacao .table-card .table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px !important;
}

@media (min-width: 1900px) {
  #tab-operacao .table-card table {
    min-width: 0 !important;
  }
}

/* ===== ADMIN: RECALCULAR SEM ESCONDER BOTÃO ===== */
#adminTicketCalculatedTime[readonly] {
  min-width: 0;
}

#adminTicketRecalculateTimeBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== ADMIN ORLANDO: PAINEL DE CORREÇÃO MANUAL ===== */
.admin-tools-card { padding-bottom: 20px; }
.admin-subtitle { margin-top: 6px; font-size: 13px; }
.admin-search-row {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 14px;
  align-items: end;
  padding: 18px 20px;
}
.admin-search-actions,
.admin-edit-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-ticket-message {
  margin: 0 20px 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fbff;
  color: var(--primary);
  font-weight: 700;
}
.admin-ticket-message.success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.admin-ticket-message.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.admin-ticket-editor { padding: 0 20px 20px; }
.admin-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}
.admin-edit-grid .field.full { grid-column: 1 / -1; }
.admin-edit-grid textarea { min-height: 90px; }
.admin-edit-actions { justify-content: flex-end; padding-top: 4px; }
#adminTicketSavedTime[readonly],
#adminTicketCalculatedTime[readonly],
#tab-admin-tools .admin-edit-grid input[readonly] {
  background: #eef3f8;
  color: var(--primary);
  font-weight: 800;
}
#adminTicketRecalculateTimeBtn {
  border: 1px solid var(--border-strong);
}
@media (max-width: 1200px) {
  .admin-edit-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .admin-search-row,
  .admin-edit-grid { grid-template-columns: 1fr; }
}
