@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --ink: #101B34;
  --ink-soft: #24304F;
  --paper: #F4F6FA;
  --panel: #FFFFFF;
  --line: #DFE4EE;
  --teal: #0868F5;
  --teal-dark: #0552C4;
  --text: #172038;
  --text-muted: #5B657E;

  --st-aberto: #3457D5;
  --st-andamento: #B8770F;
  --st-aguardando: #7C4FCC;
  --st-concluido: #0E7C6B;
  --st-cancelado: #C23A3A;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --ink: #0B1220;
  --ink-soft: #1B263D;
  --paper: #0F1626;
  --panel: #161F33;
  --line: #2A3651;
  --teal: #4C8DFF;
  --teal-dark: #8AB4FF;
  --text: #E7ECF7;
  --text-muted: #8D99B8;

  --st-aberto: #6C8CFF;
  --st-andamento: #E3A542;
  --st-aguardando: #B79BFF;
  --st-concluido: #34D2B0;
  --st-cancelado: #F0837E;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0 0 6px 0;
  color: var(--ink);
}
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--text); }

.topbar {
  background: var(--ink);
  color: #EDF1FA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 62px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  flex-shrink: 0;
}

.topbar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #EDF1FA;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.topbar-nav-btn:hover { background: rgba(255,255,255,0.18); }


.brand .brand-mark {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.06em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #A9B4CE;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.nav-link:hover { color: #fff; }
.nav-link.active {
  color: #fff;
  border-bottom-color: var(--teal);
}

/* Menu do usuário (dropdown) */
.user-menu {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.12); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
.user-menu-trigger:hover { background: rgba(255,255,255,0.12); }
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-menu-chevron {
  width: 10px;
  height: 10px;
  opacity: 0.7;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.user-menu.open .user-menu-chevron { transform: rotate(180deg); }

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 32px rgba(16,27,52,0.22);
  min-width: 220px;
  padding: 6px;
  display: none;
  z-index: 60;
}
.user-menu.open .user-menu-dropdown { display: block; }

.user-menu-email {
  padding: 9px 10px 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
  word-break: break-all;
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 0.87rem;
  font-family: var(--font-body);
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--paper); color: var(--teal-dark); }

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 18px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--teal-dark); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: #EDF1FA;
  border: 1px solid rgba(255,255,255,0.28);
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); }

.btn-outline {
  background: transparent;
  color: var(--teal-dark);
  border: 1px solid var(--teal);
}
.btn-outline:hover { background: rgba(8,104,245,0.08); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.container-narrow {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 24px;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 10%, rgba(8,104,245,0.10), transparent 45%),
    var(--paper);
}

.auth-brand {
  padding: 28px 32px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 10px;
  display: block;
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

.field textarea { resize: vertical; min-height: 110px; }

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.helper-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.alert-error {
  background: #FBEAEA;
  color: #A32E2E;
  border: 1px solid #F0C6C6;
}
[data-theme="dark"] .alert-error { background: #3A1E1E; color: #F4A6A2; border-color: #5A2A2A; }

.switch-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.switch-link a { color: var(--teal-dark); font-weight: 600; }

/* Dashboard */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.stat-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-muted);
}
.stat-chip.active { border-color: var(--teal); color: var(--teal-dark); background: rgba(8,104,245,0.12); }
.stat-chip strong { color: var(--ink); }
[data-theme="dark"] .stat-chip strong { color: var(--text); }

.ticket-list { display: flex; flex-direction: column; gap: 12px; }

.ticket-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: border-color 0.15s ease;
}
.ticket-card:hover { border-color: var(--teal); }

.ticket-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.ticket-code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.ticket-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .ticket-title { color: var(--text); }

.ticket-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-aberto { background: #E7ECFB; color: var(--st-aberto); }
.badge-em_andamento { background: #FBF0DD; color: var(--st-andamento); }
.badge-aguardando_cliente { background: #F0E9FB; color: var(--st-aguardando); }
.badge-concluido { background: #E1F3EF; color: var(--st-concluido); }
.badge-cancelado { background: #FBE7E7; color: var(--st-cancelado); }
[data-theme="dark"] .badge-aberto { background: rgba(108,140,255,0.16); }
[data-theme="dark"] .badge-em_andamento { background: rgba(227,165,66,0.16); }
[data-theme="dark"] .badge-aguardando_cliente { background: rgba(183,155,255,0.16); }
[data-theme="dark"] .badge-concluido { background: rgba(52,210,176,0.16); }
[data-theme="dark"] .badge-cancelado { background: rgba(240,131,126,0.16); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: 8px; }
[data-theme="dark"] .empty-state h3 { color: var(--text); }

/* Detalhe */
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: var(--text-muted); }
.info-list .value { font-weight: 600; color: var(--ink); text-align: right; }
[data-theme="dark"] .info-list .value { color: var(--text); }

.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  position: relative;
  padding: 0 0 22px 26px;
  border-left: 2px solid var(--line);
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--teal);
}
.timeline-item.autor-cliente::before { background: var(--st-aberto); box-shadow: 0 0 0 1px var(--st-aberto); }
.timeline-item.autor-admin::before { background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.timeline-item.autor-sistema::before { background: var(--text-muted); box-shadow: 0 0 0 1px var(--text-muted); }

.timeline-top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 0.85rem;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.timeline-autor { font-weight: 700; color: var(--ink); }
[data-theme="dark"] .timeline-autor { color: var(--text); }
.timeline-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--text-muted);
  border: 1px solid var(--line);
}
.timeline-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.72rem; }
.timeline-msg { font-size: 0.92rem; color: var(--text); line-height: 1.5; }
.timeline-status-change {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Citação da mensagem original quando alguém "responde" a ela na linha do tempo (estilo resposta do WhatsApp) */
.timeline-quote {
  border-left: 3px solid var(--teal);
  background: var(--paper);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.timeline-quote-autor {
  display: block;
  font-weight: 700;
  color: var(--teal-dark);
  font-size: 0.78rem;
}

/* Botão "Responder" embaixo de cada mensagem da linha do tempo */
.btn-responder {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0 0;
  margin-top: 2px;
}
.btn-responder:hover { color: var(--teal-dark); }

/* Prévia da mensagem sendo respondida, acima do campo de texto do formulário (some ao cancelar) */
.resposta-preview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-left: 3px solid var(--teal);
  background: var(--paper);
  border-radius: 6px 6px 0 0;
  padding: 8px 10px;
  margin-bottom: -1px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.resposta-preview-texto { line-height: 1.4; }
.resposta-preview-autor {
  display: block;
  font-weight: 700;
  color: var(--teal-dark);
  font-size: 0.78rem;
}
.resposta-preview-fechar {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 4px;
}
.resposta-preview-fechar:hover { color: var(--st-cancelado); }

.section-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.form-inline { margin-top: 22px; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
table.admin-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--paper);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
table.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  vertical-align: middle;
}
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table tr:hover { background: var(--paper); }

.toolbar-formatacao { display:flex; gap:6px; margin-bottom:6px; }
.toolbar-formatacao button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--ink);
}
.toolbar-formatacao button:hover { background: var(--paper); }

/* Tela de clientes: a coluna dos formulários precisa de mais espaço que o padrão 2fr/1fr do .detail-grid */
.clientes-grid { grid-template-columns: 3fr 2fr; }
.clientes-grid .panel { padding: 24px; }
@media (max-width: 900px) {
  .clientes-grid { grid-template-columns: 1fr; }
}

.cliente-form-panel { position: relative; }
.panel-icon-badge {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.panel-icon-badge svg { width: 18px; height: 18px; }

.field-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 5px 0 0;
}

/* Botão com spinner de carregamento */
.btn-loading { position: relative; display:flex; align-items:center; justify-content:center; gap:8px; }
.btn-loading .btn-spinner {
  display: none;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}
.btn-loading.is-loading { opacity: 0.85; cursor: default; }
.btn-loading.is-loading .btn-spinner { display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Área de upload customizada (substitui o <input type=file> nativo, que varia muito entre navegadores) */
.file-drop {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
}
.file-drop:hover { border-color: var(--teal); color: var(--teal); }
.file-drop svg { width: 17px; height: 17px; flex-shrink: 0; }

/* Modais (cadastrar cliente / importar em massa) */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(16, 27, 52, 0.55);
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal-overlay.is-open { display: flex; }
.modal-box {
  background: var(--panel);
  border-radius: 14px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 50px rgba(16, 27, 52, 0.25);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px;
  border: none; background: transparent;
  font-size: 1.4rem; line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.modal-close:hover { background: var(--paper); color: var(--text); }
@media (max-width: 520px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; }
}

.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 30px 0 10px;
}

@media print {
  .no-print, .topbar { display: none !important; }
  .print-only { display: block !important; margin-bottom: 18px; }
  body { background: #fff; }
  .admin-table { border: 1px solid #999; }
  .container, .container-narrow { max-width: 100%; padding: 0; }
  .panel { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
}

/* Miniaturas de anexo */
.anexo-thumb {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-top: 8px;
  cursor: pointer;
}

/* Indicador de novidade (bolinha verde) */
.novidade-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.20);
  flex-shrink: 0;
  animation: pulso-novo 1.8s ease-in-out infinite;
}
@keyframes pulso-novo {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.previsao-tag {
  font-size: 0.78rem;
  color: var(--teal-dark);
  font-family: var(--font-mono);
}

/* Respostas rápidas */
.respostas-rapidas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 16px;
}
.resposta-rapida-btn {
  font-family: var(--font-body);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}
.resposta-rapida-btn:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: rgba(8,104,245,0.12);
}

/* Anexos */
.anexo-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.anexo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.anexo-item a {
  color: var(--teal-dark);
  font-weight: 600;
  word-break: break-all;
}
.anexo-icon {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.timeline-item.eh-reclamacao {
  background: rgba(240,131,126,0.10);
  border: 1px solid #F3C6C6;
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin-left: -14px;
}
[data-theme="dark"] .timeline-item.eh-reclamacao { border-color: #5A2A2A; }
.timeline-item.eh-reclamacao::before {
  background: var(--st-cancelado);
  box-shadow: 0 0 0 1px var(--st-cancelado);
}
.tag-reclamacao {
  background: #FBE7E7;
  color: var(--st-cancelado);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
[data-theme="dark"] .tag-reclamacao { background: rgba(240,131,126,0.18); }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 4px 0 18px;
}
.checkbox-field input { width: auto; }

/* Mensagem de sucesso vira um "toast" flutuante no canto da tela, some sozinha depois de alguns segundos
   (em vez de empurrar o conteúdo da página como um banner fixo) — ver .toast-hide e o script no topbar.php */
.alert-success {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  background: var(--panel);
  color: #146449;
  border: 1px solid #BEE3D2;
  border-left: 3px solid var(--st-concluido);
  box-shadow: 0 12px 28px rgba(16,27,52,0.16);
  animation: toast-entra 0.25s ease;
}
.alert-success::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--st-concluido);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='9' stroke='white' stroke-width='1.6'/%3E%3Cpath d='M6.5 10.2l2.3 2.3 4.7-5' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='9' stroke='white' stroke-width='1.6'/%3E%3Cpath d='M6.5 10.2l2.3 2.3 4.7-5' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.alert-success.toast-sai { animation: toast-sai 0.25s ease forwards; }
[data-theme="dark"] .alert-success { background: var(--panel); color: #6EE7C4; border-color: #1F4D3D; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-sai { to { opacity: 0; transform: translateY(-10px); } }
@media (max-width: 520px) {
  .alert-success { left: 16px; right: 16px; top: 12px; max-width: none; }
}

/* Página de erro */
.erro-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
}
.erro-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 48px 36px;
}
.erro-codigo {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1;
  margin-bottom: 6px;
}

/* ===== Responsivo (mobile) — precisa vir por último para sobrescrever as regras acima ===== */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  align-items: center;
}

@media (max-width: 880px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 62px;
    padding: 12px 16px;
    position: relative;
    row-gap: 4px;
  }
  .brand { order: 1; }
  .nav-toggle { display: flex; order: 2; }
  .user-menu { order: 3; }

  .topbar nav {
    display: none;
    order: 4;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    height: auto;
    background: var(--ink);
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 4px;
  }
  .topbar nav.nav-open { display: flex; }

  .nav-link {
    height: auto;
    padding: 13px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-left: 2px solid transparent;
  }
  .nav-link.active { border-bottom-color: rgba(255,255,255,0.08); border-left-color: var(--teal); padding-left: 12px; }

  .user-menu-nome { display: none; }
  .user-menu-trigger { padding: 6px; }
  .user-menu-dropdown { min-width: 200px; }

  .container, .container-narrow { padding: 24px 16px 48px; }

  .page-head, .detail-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .stat-strip { flex-wrap: wrap; }

  .ticket-card { flex-direction: column; align-items: flex-start; gap: 10px; }

  table.admin-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------- */
/* Lightbox de anexos (imagens)                                           */
/* ---------------------------------------------------------------------- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 24, 0.86);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox-overlay.aberto { display: flex; }
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.lightbox-fechar {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.lightbox-fechar:hover { background: rgba(255,255,255,0.22); }

/* ---------------------------------------------------------------------- */
/* Avaliação de satisfação (estrelas)                                     */
/* ---------------------------------------------------------------------- */
.rating-input {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}
.rating-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating-input label {
  font-size: 2rem;
  line-height: 1;
  color: var(--line);
  cursor: pointer;
  transition: color 0.1s ease;
}
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label {
  color: #E3A542;
}

/* ---------------------------------------------------------------------- */
/* Barra de progresso do prazo estimado                                   */
/* ---------------------------------------------------------------------- */
.prazo-bar-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.prazo-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* ---------------------------------------------------------------------- */
/* Página inicial pública (visitante não logado)                          */
/* ---------------------------------------------------------------------- */
.landing-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: var(--paper);
}
.landing-hero .brand-box { margin-bottom: 28px; }
.landing-hero h1 {
  font-size: 2.1rem;
  max-width: 640px;
  margin-bottom: 14px;
}
.landing-hero p {
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.6;
  margin-bottom: 28px;
}
.landing-hero .landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 720px;
  margin-top: 40px;
  text-align: left;
}
.landing-hero .landing-features .panel { padding: 18px; }
@media (max-width: 700px) {
  .landing-hero .landing-features { grid-template-columns: 1fr; }
}
